Comments (2)
@kigawas The inner tuple type is actually a list of tuple types, tuple[]
, which means it should be (uint256,address)[]
.
>>> from eth_utils import to_bytes
>>> from eth_abi import abi
>>> hex_data = (
... "0x0000000000000000000000000000000000000000000000000000000000000020"
... "000000000000000000000000000000000000000000000000000000000000000000"
... "000000000000000000000000000000000000000000000000000000000000000000"
... "00000000000000000000000000000000000000000003b53d9d99ecb80000000000"
... "0000000000000000001850dd8fb9323b01c340d0eb1da1ec16cc8ee1a200000000"
... "0000000000000000004c00500000ad104d7dbd00e3ae0a5c00560c000000000000"
... "00000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d000000000000"
... "000000000000000000000000000000000000000000000000056100000000000000"
... "000000000000000000000000000000000000000000000000010000000000000000"
... "000000000000000000000000000000000000000000000002000000000000000000"
... "000000000000000000000000000000000000006346e1d200000000000000000000"
... "000000000000000000000000000000000000636fadcd0000000000000000000000"
... "000000000000000000000000000000000000000000360c6ebe0000000000000000"
... "0000000000000000000000000589c7ee474bc5850000007b02230091a7ed012300"
... "72f7006a004d60a8d4e71d599b8104250f00000000007b02230091a7ed01230072"
... "f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000"
... "000000000000000000000000000000000200000000000000000000000000000000"
... "000000000000000000000000000002400000000000000000000000000000000000"
... "0000000000000000000000000002e0000000000000000000000000000000000000"
... "000000000000000000000000000200000000000000000000000000000000000000"
... "000000000018fae27693b400000000000000000000000000000000a26b00c1f0df"
... "003000390027140000faa719000000000000000000000000000000000000000000"
... "00000018fae27693b40000000000000000000000000000a858ddc0445d8131dac4"
... "d1de01f834ffcba52ef10000000000000000000000000000000000000000000000"
... "000000000000000041046bd0fda5b934a96ef4700da1b64e03e7451e6a6ee45a50"
... "04b93823ff3baae34b9f1c4f667781b5fedd27dc67339d4fd3e4ae2a873b315090"
... "e6312853732f9a1c00000000000000000000000000000000000000000000000000"
... "000000000000360c6ebe"
... )
>>> abi.decode(
... ["(address,uint256,uint256,address,address,address,uint256,uint256,uint8,uint256,uint256,bytes32,uint256,bytes32,bytes32,uint256,(uint256,address)[],bytes)"],
... to_bytes(hexstr=hex_data),
... )
(('0x0000000000000000000000000000000000000000',
0,
68400000000000000000,
'0x1850dd8fb9323b01c340d0eb1da1ec16cc8ee1a2',
'0x004c00500000ad104d7dbd00e3ae0a5c00560c00',
'0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d',
1377,
1,
2,
1665589714,
1668263373,
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
24446860302761739304752683030156737591518664810215442929800781758303463785861,
b'\x00\x00\x00{\x02#\x00\x91\xa7\xed\x01#\x00r\xf7\x00j\x00M`\xa8\xd4\xe7\x1dY\x9b\x81\x04%\x0f\x00\x00',
b'\x00\x00\x00{\x02#\x00\x91\xa7\xed\x01#\x00r\xf7\x00j\x00M`\xa8\xd4\xe7\x1dY\x9b\x81\x04%\x0f\x00\x00',
2,
((1800000000000000000, '0x0000a26b00c1f0df003000390027140000faa719'),
(1800000000000000000, '0xa858ddc0445d8131dac4d1de01f834ffcba52ef1')),
b"\x04k\xd0\xfd\xa5\xb94\xa9n\xf4p\r\xa1\xb6N\x03\xe7E\x1ejn\xe4ZP\x04\xb98#\xff;\xaa\xe3K\x9f\x1cOfw\x81\xb5\xfe\xdd'\xdcg3\x9dO\xd3\xe4\xae*\x87;1P\x90\xe61(Ss/\x9a\x1c"),)
from eth-abi.
Thanks for explanation!
from eth-abi.
Related Issues (20)
- ImportError: cannot import name 'encode' from 'eth_abi' HOT 2
- Is there a way to match calldata/memory encoding conventions? HOT 1
- Decoding data of type byte[] array results in an an empty element at the end HOT 3
- Byte value of length 32b results in decoding error using 'decode' HOT 2
- Decoding an array type returns a tuple instead of list HOT 5
- `ImportError: cannot import name 'getargspec' from 'inspect'` in Python >= 3.11 due to outdated `parsimonious` dependency version
- Wrong encoding output when using uint256[] HOT 1
- Decoding arbitrary length bytes fails due to expected padding HOT 2
- encoding tuple with nested tuple containing dynamic types HOT 3
- [Project Management] When will eth-abi>=4.0.0 be released? HOT 2
- Dependency errors for newer versions of uth-utils>=2.0.0 and eth-abi>=3.0.0
- Different behaviour: `encode_single` vs `encode` HOT 9
- typing/linting tools review
- Add utility method for getting an acceptable byte range from a list of ABI types
- OverflowError: Python int too large to convert to C ssize_t HOT 5
- decode failing on input that is not divided by 32 HOT 1
- Replace `functools.lru_cache`
- OverflowError when decode an event data with empty fields HOT 4
- Decode input data with bad padding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth-abi.