nft updates (#530)

* nft updates

* use hasMetadata
This commit is contained in:
Alex Coseru 2022-09-13 11:30:38 +03:00 committed by GitHub
parent c74d938c24
commit c5d86d10df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -110,6 +110,9 @@ type Nft @entity{
"number of orders executed for all underlying datatokens"
orderCount: BigInt!
"has metadata"
hasMetadata: Boolean!
}
type OrderReuse @entity {

View File

@ -30,6 +30,7 @@ export function handleMetadataCreated(event: MetadataCreated): void {
nft.assetState = event.params.state
nft.providerUrl = event.params.decryptorUrl.toString()
nft.hasMetadata = true
const nftUpdate = new NftUpdate(
getId(event.transaction.hash.toHex(), nftAddress)
@ -57,7 +58,7 @@ export function handleMetadataUpdated(event: MetadataUpdated): void {
if (!nft) return
nft.assetState = event.params.state
nft.hasMetadata = true
const nftUpdate = new NftUpdate(
getId(event.transaction.hash.toHex(), nftAddress)
)

View File

@ -59,6 +59,7 @@ export function createNftToken(address: Address): Nft {
token.block = 0
token.tx = ''
token.orderCount = BigInt.zero()
token.hasMetadata = false
token.save()
addNft()
return token
@ -80,6 +81,18 @@ export function getNftTokenWithID(tokenId: string): Nft {
nftToken.name = ''
nftToken.symbol = ''
nftToken.address = tokenId
nftToken.providerUrl = ''
nftToken.tokenUri = ''
nftToken.owner = ''
nftToken.creator = ''
nftToken.assetState = 0
nftToken.template = ''
nftToken.transferable = true
nftToken.createdTimestamp = 0
nftToken.block = 0
nftToken.tx = ''
nftToken.orderCount = BigInt.zero()
nftToken.hasMetadata = false
nftToken.save()
addNft()
}