How do I serialize transactions?
See original GitHub issueHey I’m getting a peculiar error from serializeTransaction()
:
Error: invalid object key - from (argument=“transaction”, value={“from”:“0x3f85a22c26cdd23d119d1e2c72ceb73f32d1270a”,“gasPrice”:“0x4a817c800”,“gas”:“0x5208”,“to”:“0x3535353535353535353535353535353535353535”,“value”:“0xde0b6b3a7640000”,“data”:“”,“nonce”:“0x0”}, key=“from”, version=4.0.41)
The executing code is:
const tx = await ethers.utils.resolveProperties(txData);
console.log({tx})
let unsignedTx = ethers.utils.serializeTransaction(tx).substring(2);
console.log({unsignedTx})
The log from tx
is:
{ tx:
{ from: '0x3f85a22c26cdd23d119d1e2c72ceb73f32d1270a',
gasPrice: '0x4a817c800',
gas: '0x5208',
to: '0x3535353535353535353535353535353535353535',
value: '0xde0b6b3a7640000',
data: '',
nonce: '0x0' } }
Greatly appreciate any help.
PS: I ripped this directly from your ledger repo so its a bit puzzling.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Serializing transactions - IBM
You might need to serialize the execution of one or more transactions. This typically occurs when the application logic was not designed to...
Read more >Serializable Transactions | CockroachDB Docs
SERIALIZABLE isolation guarantees that even though transactions may execute in parallel, the result is the same as if they had executed one at...
Read more >What does it mean to serialize a transaction?
Serialization means that the message is packed in a byte stream, which properties (like encoding, byte ordering, etc.) ...
Read more >SERIALIZABLE Isolation - Vertica
SERIALIZABLE is the strictest SQL transaction isolation level. While this isolation level permits transactions to run concurrently, it creates the effect ...
Read more >Serializable Transaction - Ask TOM
A serializable transaction operates in an environment that makes it appear as if there are no other users modifying data in the database, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Right, but ethers Provider is not meant to follow another specification. If I could go back in time, I’d have chosen a different name for
Provider
. Think of a PNG library with access to header fields; it would prolly usepng.text
andpng.pixelDimensions
instead of the equivalents the standard specifiespng.tEXt
andpng.pHYs
(case plays 4 important and interesting roles in the PNG standard).The Provider is its own specification and not trying to copy or mimic something else, its just trying to offer all the functionality. It’s meant to abstract those things away, which gives us a chance to do less worse. 😃
Similarly, rather than “following the standard”, when EIP-712 is supported, it will like be called
signer.signTypedData
instead ofsigner.signTypedDataV4
. The library as an abstraction layer means the library can take care of these things without the developer worrying about the legacy imposed by the JSON-RPC API. It does mean anyone switching between ethers and web3 will need to know to useeth_signTypedData_v4
, but I also don’t expect most people to be switching frequently between these libraries…Anyhoo, I think we discussed most of this in person, already? But I’m updating the ticket here for anyone who stumbles across it. 😃
Going to close it now, but feel free to continue commenting (anyone) or re-open it if you’d like. I do monitor closed issues. 😃
oh funny, its because you don’t accept from without a sig, that makes sense