Hi everyone! I am playing with ITX an at this moment i bit confused. I sending transaction to contract, trying again and getting error:
{“jsonrpc”:“2.0”,“id”:43,“error”:{“code”:-32008,“message”:“Transaction already sent.”}}
but I don’t understand why second transaction considered the same. Should I use some ID on my side, like nounce, but not nounce of course?
And by the way, I don’t got tokens from one address to another
My playgroud:
const { ethers } = require(‘ethers’)
console.log(‘test’);
const itx = new ethers.providers.InfuraProvider(
‘goerli’, // or ‘ropsten’, ‘rinkeby’, ‘kovan’, ‘goerli’
‘api key’
)
console.log(‘test 2’);
const signer = new ethers.Wallet(‘private key’, itx)
async function getBalance() {
response = await itx.send(‘relay_getBalance’, [signer.address])
console.log(Your current ITX balance is ${response.balance}
)
console.log(signer.address);
}
getBalance();
async function signRequest(tx) {
const relayTransactionHash = ethers.utils.keccak256(
ethers.utils.defaultAbiCoder.encode(
[‘address’, ‘bytes’, ‘uint’, ‘uint’, ‘string’],
[tx.to, tx.data, tx.gas, 5, tx.schedule] // Rinkeby chainId is 4
)
)
return await signer.signMessage(ethers.utils.arrayify(relayTransactionHash))
}
async function callContract() {
const tx = {
to: ‘0xc6fDe3FD2Cc2b173aEC24cc3f267cb3Cd78a26B7’,
data: ‘0xa9059cbb000000000000000000000000730d7c03f852739a1ea1b6f3faf8d96a495ca22a0000000000000000000000000000000000000000000000000000000005f5e100’,
gas: ‘100000’,
schedule: ‘fast’
}
const signature = await signRequest(tx)
const relayTransactionHash = await itx.send(‘relay_sendTransaction’, [tx, signature])
console.log(ITX relay hash: ${relayTransactionHash}
)
console.log(relayTransactionHash)
return relayTransactionHash
}
callContract();
Zero,
Welcome and thanks for reaching out. Do you have any transaction hashes or we can trace and take a look at related to the ITX issue you had? Is the hash you have in your code recent and valid?
Kind regards,
Alex | Infura Support
My payment terms are legal. But I do not know how to proceed with those contracts.