0

web3 documentation says that using the web3.eth.signTransaction returns the object which (inside the other object) has the r, s, and v of the message: enter image description here

However, I am not getting that:

enter image description here

Any idea in how can I get the r, s, and v? I want to use if to the permit function of the Dai contract

1

okay figured it out:

Code below:

let alchemy_provider = new ethers.providers.AlchemyProvider("PROVIDE_NETWORK_NAME", "PROVIDE_YOUR_API_KEY");
let wallet = new ethers.Wallet("PROVIDE_PRIVATE_KEY", provider);

let tx = {
        to: "0x4337a3876c1a021762F8eDf16524ad09eF9F5166",
        value: ethers.utils.parseEther("0.02")
      };

const signTx = async () => {
  signedTx = await wallet.signTransaction(tx);
  console.log("SIGNEDTX", signedTx)
  console.log("PARSED TRANSACTION", ethers.utils.parseTransaction(signedTx));}

signTx();
// PARSED TRANSACTION {
  nonce: 0,
  gasPrice: BigNumber { _hex: '0x00', _isBigNumber: true },
  gasLimit: BigNumber { _hex: '0x00', _isBigNumber: true },
  to: '0x4337a3876c1a021762F8eDf16524ad09eF9F5166',
  value: BigNumber { _hex: '0x470de4df820000', _isBigNumber: true },
  data: '0x',
  chainId: 0,
  v: 27,
  r: '0x18b29ac493e5de71706f9b32a065aec46c1b3d1ee4b14b38d137e15dad1f68bc',
  s: '0x4292c664145d5952ef7cce0ba4f67da423b6c96e67713b2bf9189f8b925bb0b3',
  from: '0x4337a3876c1a021762F8eDf16524ad09eF9F5166',
  hash: '0xfccb4d5b6018401b5311065d5a22eaba7b5a6b8c1d4aa0530b8e1d17dab39f3c'
}

Thanks to @ricmoo [https://github.com/ricmoo] for his answer over here [https://github.com/ethers-io/ethers.js/issues/969#issuecomment-662884180]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.