kodadot / stick

GraphQL service for Uniques and Assets on Asset Hubs
MIT License
3 stars 10 forks source link

Metadata field is not updated #179

Closed vikiival closed 6 months ago

vikiival commented 6 months ago

Context

Minted one NFT on Ahk today all the details got disregarded image is collection cover, name is just default naming for collection, etc https://canary.kodadot.xyz/ahk/gallery/276-33

transaction: https://assethub-kusama.subscan.io/tx/0xaca556237c90236a7082331da3300242923a5b6e2a6875c0bf427f2227097deb

This looks like issue on the indexer side. Transaction seems to be correct

metadata

{
  "name": "Nature Enjoyement",
  "description": "",
  "image": "ipfs://ipfs/bafybeictc5prop6xvl3f432dtosywuwssl54de62xan3ixpcgm6c6no3wy",
  "animation_url": "",
  "attributes": [],
  "external_url": "https://kodadot.xyz",
  "type": "image/webp"
}

Query

query x {
  nftEntityById(id: "276-33") {
    name
    image
    metadata
    meta {
      id
      name
      image
    }
    token {
      id
      image
      metadata
    }
  }
}

Res

{
  "data": {
    "nftEntityById": {
      "name": "Sun Beams",
      "image": "ipfs://ipfs/bafybeiaq3cdfh5drknvrlfef25vkzt5lfmmfwiob3m25x5utjp5gwl3rta",
      "metadata": "ipfs://ipfs/bafkreia647pfzm6mmx5cvlhrgkrxi6x24mbgmz4axdzibsmjqmoql6dg3a",
      "meta": {
        "id": "ipfs://ipfs/bafkreibztqxstydvyqeyjgryclwappw4fugmwak45e3rhwyoqnbc2pebkm",
        "name": "Sun Beams",
        "image": "ipfs://ipfs/bafybeiaq3cdfh5drknvrlfef25vkzt5lfmmfwiob3m25x5utjp5gwl3rta"
      },
      "token": {
        "id": "276-41ea75b06f57fcd281d8d9c3c1497eb1",
        "image": "ipfs://ipfs/bafybeiaq3cdfh5drknvrlfef25vkzt5lfmmfwiob3m25x5utjp5gwl3rta",
        "metadata": "ipfs://ipfs/bafkreibztqxstydvyqeyjgryclwappw4fugmwak45e3rhwyoqnbc2pebkm"
      }
    }
  }
}

Originally posted by @vikiival in https://github.com/kodadot/nft-gallery/issues/8910#issuecomment-1881125422

vikiival commented 6 months ago

@roiLeo can you please chceck ?

roiLeo commented 6 months ago

Debug

...
  event: {
    args: {
      collection: 276,
      item: 33,
      owner: '0x0887f584ae9309f983b3b42b082a684de363f898ae6267d34ebf6b6b2b84d641'
    },
    id: '0006172214-000005-f09c4',
    indexInBlock: 5,
    name: 'Nfts.Issued',
    phase: 'ApplyExtrinsic',
    pos: 9,
    extrinsic: {
      error: null,
      hash: '0xaca556237c90236a7082331da3300242923a5b6e2a6875c0bf427f2227097deb',
      id: '0006172214-000002-f09c4',
      indexInBlock: 2,
      pos: 20,
      signature: [Object],
      success: true,
      version: 4,
      fee: 109475620n,
      tip: 0n,
      call: [Object]
    },
    call: {
      args: [Object],
      error: null,
      id: '0006172214-000002-f09c4-000001',
      name: 'Nfts.mint',
      origin: [Object],
      pos: 10,
      success: true,
      parent: [Object]
    }
  }
...

no arg metadata in context nor CreateTokenEvent, check if we can get it in NftsIssuedEvent

now on handleMetadataSet:

[METADATA] {
   "caller": "CmWHiv7h4m9tEzKD94DH4mqwGTvsdYQe2nouWPF7ipmHpqA",
   "blockNumber": "6172214",
   "timestamp": "2024-01-08T14:13:54.000Z",
   "collectionId": "276",
   "sn": "33",
   "metadata": "ipfs://ipfs/bafkreia647pfzm6mmx5cvlhrgkrxi6x24mbgmz4axdzibsmjqmoql6dg3a"
 }
vikiival commented 6 months ago

now on handleMetadataSet:

Yes this is the correct metadata hash, I am just wondering why it was not updated .

roiLeo commented 6 months ago

now on handleMetadataSet:

Yes this is the correct metadata hash, I am just wondering why it was not updated .

any idea what this part does? https://github.com/kodadot/stick/blob/cb6133ed1dd16d440db60660c461a988dcc9dcae/src/mappings/nfts/setMetadata.ts#L49-L59

I managed to make it work without Capture d’écran 2024-01-09 à 11 59 10 AM

vikiival commented 6 months ago

Guess that was because of tokenEntity handling cc @daiagi ?