I am trying to mint a token and wait for its minting transaction to go through. And for this I am using the tx.wait(NUMBER_OF_CONFIRMATIONS) of ethersjs. from https://docs.ethers.org/v5/api/providers/types/#providers-TransactionResponse

And we are running the whole process of minting the nft in firebase cloud functions.

This is how I've implemented the mint function in the contract(if its relevant)

function mint(address _to, uint256 _amount, string memory _tokenURI) public{
        require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Only Admin can call this function!");
        tokenId += 1;
        s_supply[tokenId] += _amount;
        s_tokenIdToURI[tokenId] = _tokenURI;
        _mint(_to, tokenId, _amount, "");
        emit NftMinted(_to, tokenId, _amount, _tokenURI);

Below is the how I am making the function call on my smart contract

const bridgeMintingTxn = await bridgeNftContract.mint(
              {gasLimit: 10000000}

And this is how I am waiting for confirmation of the transaction await bridgeMintingTxn.wait(1);

But this .wait(1) call is not resolving 7 out of 10 times.

Can any one point out any mistake I'm making here. Any help would be very much appreciated. Thanks in advance.

1 Answer 1


Okay so in my case it was the not the problem of ethersjs, but my RPC URL that I was using was not functioning properly. It was not sending the transactions properly and same goes for receiving their confirmations. Changing the RPC URL worked for me.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.