Hi guys,
Here is an error that I get when try to call the mint
fn of multi token contract.
Error: Transaction is not inserted. Hash is already known: {"response":{"data":null,"errors":[{"message":"Transaction is not inserted. Hash is already known","locations":[{"line":2,"column":3}],"path":["submit"]}],"status":200,"headers":{"map":{"content-type":"application/json"}}},"request":{"query":"mutation submit($encodedTransaction: HexString!) {\n submit(tx: $encodedTransaction) {\n id\n }\n}","variables":{"encodedTransaction":"0x0000000000000000000000000000000200000000009896800000000000000000000000000000001800000000000000a00000000000000002000000000000000c00000000000000010000000000000000000000000000000000000000000000000000000000000000724028a8724428805d451000724828882d41148a2404000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8c627b9cd9ee42e2c2bd9793b13bc9f8e9aad32e25a99ea574f23c1dd17685a00000000812e79b000000000000028d87aa35fdbcd9e3ef68475417f35b7bd6778e7fafa5f0b4b190a353db900183212e26ef19029cc92e234d9457823ca0811b92db9ce9dbf8db99c0fdd75d11338f00000000ba43b74000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d8c627b9cd9ee42e2c2bd9793b13bc9f8e9aad32e25a99ea574f23c1dd17685a000000000000000043ded2bb3e9b919f819f36be1b727ffc58d0ca43a864cb223957619cc36c461400000000000000017aa35fdbcd9e3ef68475417f35b7bd6778e7fafa5f0b4b190a353db900183212000000001dcd645d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027aa35fdbcd9e3ef68475417f35b7bd6778e7fafa5f0b4b190a353db90018321200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000408337ea135a8633646cc309445991514dff7aa193b2134882de3a155f2b1abab6d312a7b7f187aafc74c73b3a0f89a47678d97186fb65ba16110e4b0964ba1041"}}}
My code
const SEED =
"0x5a9df5... [removed by mod, never share your seeds]";
const wallet = Wallet.fromPrivateKey(SEED, accountStore.provider!);
const tokenFactoryContract = TokenFactoryAbi__factory.connect(
tokenFactory,
wallet
);
const token = TOKENS_BY_ASSET_ID[assetId];
const amount = BN.parseUnits(faucetAmounts[token.symbol], token.decimals);
const hash = hashMessage(token.symbol);
const userAddress = wallet.address.toB256();
const { transactionResult } = await tokenFactoryContract.functions
.mint({ value: "userAddress" }, hash, amount.toString())
.txParams({ gasPrice: 2 })
.call();
The nature of this error is strange, when I call the mint function with a specific assetId for the first time it starts to load super long, like up to 2 mins and then I just reject this request and make a new one that fails with the error above, in some attempts like 4 calls I am able to successfully make a mint for my address.