I'm trying to call multiple (3) times this Solidity function
function mint(address to, uint256 id) public onlyOwner {
ERC1155._mint(to, id, 1, "");
}
from this TS code
contract = new ethers.Contract(contract_address, ERC1155.abi, this.signer)
await contract.connect(this.signer).mint(this.signer.address, 1)
await contract.connect(this.signer).mint(this.signer.address, 2)
await contract.connect(this.signer).mint(this.signer.address, 3)
but get this error
ERROR [Testing] Error: nonce has already been used (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":75,\"error\":{\"code\":-32000,\"message\":\"Nonce too low. Expected nonce to be 3 but got 2.\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_sendRawTransaction\",\"params\":[\"0x02f90112827a6902849502f90084f2d737e08303aa4494e7f1725e7734ce288f8367e1bb143e90bb3f051280b8a450f0bf8e000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003c080a00dd2dec8c00eeca9761235a7ce58a87d2b74c4012622dcc63c08befecf7fc5a9a051027eb339d80ce5dfcf5da75c88dd92e082566d32ac5dc859fa00871e7e3fda\"],\"id\":75,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"http://127.0.0.1:8545/"}, method="sendTransaction", transaction="0x02f90112827a6902849502f90084f2d737e08303aa4494e7f1725e7734ce288f8367e1bb143e90bb3f051280b8a450f0bf8e000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003c080a00dd2dec8c00eeca9761235a7ce58a87d2b74c4012622dcc63c08befecf7fc5a9a051027eb339d80ce5dfcf5da75c88dd92e082566d32ac5dc859fa00871e7e3fda", code=NONCE_EXPIRED, version=providers/5.5.3)
Software versions:
- solidity 0.8.9
- ethers.js 5.5.4
- hardhat 2.4.8
- @nomiclabs/hardhat-ethers 2.0.5
(eth node is npx hardhat node on http://127.0.0.1:8545)
Did you face this error? How can I get this code works? Thank you in advance! 🙌