Add a method to generate tightly packed encodings
See original GitHub issueIs there a way to replicate the non-standard pack mode used by Solidity in Ethers.js?
My use case is I want to sign an EtherDelta order. This is later validated in the trade function with the following code
bytes32 hash = sha256(tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(ecrecover(hash,v,r,s) == user ...
So in JavaScript I want to be able to get the non-standard pack mode of the parameters tokenGet, amountGet, tokenGive, amountGive, expires and nonce which can then be passed into a sha256 function. Is that possible?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:12 (5 by maintainers)
Top Results From Across the Web
How to mimic abi.encodePacked in ethers?
When using the Solidity abi.packEncoded(...) function, a non-standard tightly packed version of encoding is used. These functions implement the ...
Read more >Encoding | Protocol Buffers - Google Developers
Use the packed data type when you are storing consecutive values of the type described in the protocol definition. The tag is dropped...
Read more >Tightly Packed Tries: How to Fit Large Models into Memory ...
We present Tightly Packed Tries (TPTs), a compact implementation of read-only, com- pressed trie structures with fast on-demand paging and short load times....
Read more >Chapter 4. Choose Appropriate Visual Encodings - O'Reilly
One way to make decoding easy is to make your encodings of things and relationships as well aligned with the reality (or your...
Read more >Object Encodings in System F Or: Stacking μ and 9
we have such an instance p, we could for example write p.getx () to get the x-position of the point. The equals-method is...
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
Added in https://github.com/ethers-io/ethers.js/commit/8129f0cb8b932662561d8aa799e4963f44d90c75.
Both
types
andvalues
should be arrays of the values you wish to work with.Give it a try and let me know if you have any issues. There are ~2000 test cases for it procedurally generated in the make-contract-events.js file if curious about coverage.
@PhABC I think what you are looking for is
ethers.utils.solidityPack
? It does not support structs though. Do you need struct support?