I'm doing transactions with Contract on Avalanche test network. I am simply minting an NFT in my Contract. I'm implementing this in Node.js as an API. Normally my codes are working. However, sometimes I get an error like this and I couldn't figure out why. Can you help me?
message: {
code: -32000,
message: 'nonce too low: address 0x190cc0978615a474092676aB740F486b7f528A5F current nonce (491) > tx nonce (490) -- Reason given: Custom error (could not decode).',
reason: 'Custom error (could not decode)'
}
Here are the parts I made with Mint:
On Contracts...
function mint(address minter, string memory uri) public returns (uint256) {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
idToOwner[newItemId] = minter;
_safeMint(minter, newItemId);
_setTokenURI(newItemId, uri);
emit Mint(minter, uri, newItemId);
return newItemId;
}
On Nodejs API...
const mintMetaData = async (_id, mintURL, res) => {
const _instance = await hyliContract.at(process.env.CONTRACT_NFT_ADDRESS);
try {
const result = await _instance.mint(provider.getAddress(), mintURL, { from: provider.getAddress() });
...