1

I'm minting successfully from a contract. Then when I go to transfer the NFT I get the error: "HttpResponse: Http error response: (500) [{"kind":"branch","id":"proto.014-PtKathma.contract.counter_in_the_past","contract":"tz1QWad59nCK6BSnoWsCp97HSr6qRtBVrgaJ","expected":"79684600","found":"79684599"}]"

The counter found was the counter used in the mint operation. It seems the counter is not being incremented in/after the mint operation. Here's the code where I'm awaiting a block confirmation. The weirdest part is this code works perfectly on testnet & not on mainnet.

I believe batching is not a possibility because I need to get the tokenId from the internal transaction call from the mint

    const mintNFTOperation = await contract.methods
            .mint(id)
            .send({ amount: costPerMint })
    mintHash = mintNFTOperation.opHash
    confirmation = await mintNFTOperation.confirmation(1)
    tokenId = getTokenIdFromTransactionMetadata(confirmation, mintHash)
    const storage = await contract.storage()
    const FA2ContractAddress = await storage["addresses"].get("id")
    const FA2Contract = await tezos.wallet.at(
        FA2ContractAddress,
        compose(tzip12, tzip16)
    )
    const tokenMetadata = await FA2Contract.tzip12().getTokenMetadata(
        tokenId
    )
    const transferParams = [
      {
        from_: process.env.WALLET,
        txs: [
            {
                to_: walletAddress,
                token_id: tokenId,
                amount: 0,
            },
        ],
      },
    ]
    // This is what fails by using the same counter as the mint transaction. Showing that the counter does not increment on mainnet from the mint function in my code for some reason
    const transferNFTOperation = await FA2Contract.methods
            .transfer(transferParams)
            .send()
4
  • Are you using caching? tezostaquito.io/docs/rpc-cache Commented Nov 4, 2022 at 18:46
  • @RodrigoQuelhas I am not using any caching! :/ Commented Nov 5, 2022 at 22:01
  • Add await transferNFTOperation.confirmation() after the NFT transfer if you are doing more contract calls after that line. Commented Nov 6, 2022 at 10:00
  • I actually am. I just didn't add in that code. I apologize. Thanks for the info though. @RodrigoQuelhas Commented Nov 6, 2022 at 18:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.