From 573d199cf31040dfdca3a4679dfa5c4313ddbe78 Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 15 Dec 2020 15:42:38 +0200 Subject: [PATCH] Fix relayTransactionHash already defined --- infura-transactions/call.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infura-transactions/call.js b/infura-transactions/call.js index 84e985e..04171b0 100644 --- a/infura-transactions/call.js +++ b/infura-transactions/call.js @@ -42,13 +42,13 @@ async function main() { // Final signature of the form keccak256("\x19Ethereum Signed Message:\n" + len((to + data + gas + chainId)) + (to + data + gas + chainId))) // Where (to + data + gas + chainId) represents the RLP encoded concatenation of these fields. // ITX will check the from address of this signature and deduct balance according to the gas used by the transaction - const relayTransactionHash = ethers.utils.keccak256( + const relayTransactionHashToSign = ethers.utils.keccak256( ethers.utils.defaultAbiCoder.encode( ['address', 'bytes', 'uint', 'uint'], [tx.to, tx.data, tx.gas, 4] // Rinkeby chainId is 4 ) ); - const signature = await signer.signMessage(ethers.utils.arrayify(relayTransactionHash)); + const signature = await signer.signMessage(ethers.utils.arrayify(relayTransactionHashToSign)); // Relay the transaction through ITX const relayTransactionHash = await itx.send('relay_sendTransaction', [tx, signature]);