Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from amanusk/fix-const-txhash
Browse files Browse the repository at this point in the history
Fix relayTransactionHash already defined
  • Loading branch information
meronym authored Jan 6, 2021
2 parents 36b6127 + 573d199 commit c63a4d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions infura-transactions/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit c63a4d6

Please sign in to comment.