Error when minting for CIS2-example-derived smart contract

Hi,
I am getting below error when minting a kind of CIS2 smart contract. I mostly copied the CIS2-nft example including the custom errors and mint code:

Invocation resulted in failure:

  • Energy used: 1189 NRG
  • Reason: ‘mint’ in ‘NFT-example’ at {“index”:820,“subindex”:0} failed with code -1
  • Return value (raw):

    .

From above, I suspect the error code points to ParseError (the first error in the enum) but I could not find what is wrong with my MintParams json below. Am I missing something in the json?

{
“owner”: { “Account”: [“4s3QS7Vdp7b6yrLngKQwCQcexKVQLKifcGKgmVXoH6wffZMQhM”] },
“tokens”: [“01”, “02”]
}

If you are using the cis2-nft contract unchanged then TokenId is meant to be a TokenIdU32 which is 4 bytes long.

So you likely want

“tokens”: [“00000001”, “00000002”]

(8 hex characters per token ID, so 4 bytes per ID)

1 Like

it worked! Thank you. I didn’t get quite get the 4 bytes thing for the TokenIdU32 so thanks for the explanation!

2 Likes