Open sangnguyen1001 opened 7 months ago
I found it, If I change tx from
tx = {"to"=>"0x3f1B32386dE69693F708204BEC1568aB6599E0e6",
"value"=>"0x16345785d8a0000",
"data"=>"0x",
"type"=>0,
"nonce"=>0,
"gasLimit"=>{"type"=>"BigNumber", "hex"=>"0x5208"},
"gasPrice"=>{"type"=>"BigNumber", "hex"=>"0x59682f10"},
"from"=>"0xc9aAD004e656153e7Ea4633BbF3Dc10BcE7a50fb",
"chainId"=>80001}
to
tx = {"to"=>"0x3f1B32386dE69693F708204BEC1568aB6599E0e6",
"value"=>"0x16345785d8a0000",
"data"=>"0x",
"type"=>0,
"nonce"=>0,
"gasLimit"=>"0x5208",
"gasPrice"=>"0x59682f10",
"from"=>"0xc9aAD004e656153e7Ea4633BbF3Dc10BcE7a50fb",
"chainId"=>80001}
it will work.
Note that I populate the tx with:
const provider = new ethers.providers.JsonRpcProvider(nodeUrl);
const signer = provider.getSigner(fromAddress);
try {
const tx = await signer.populateTransaction({
to: toAddress,
value: amount,
data: "0x",
type: 0
});
Ethers Version
5.7.2
Search Terms
No response
Describe the Problem
I have a transaction object was populated with type 0:
When I sign it (offline) with code below:
Then I get error:
{"reason"=>"invalid hexlify value", "code"=>"INVALID_ARGUMENT", "argument"=>"value", "value"=>{"type"=>"BigNumber", "hex"=>"0x59682f10"}}
If I populate transaction using type 2:
Then it will be signed ok
Plz help, thanks!
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
node.js (v12 or newer)
Environment (Other)
No response