Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ABI decode given just signature #836

Open
fxfactorial opened this issue Nov 2, 2023 · 0 comments
Open

How to ABI decode given just signature #836

fxfactorial opened this issue Nov 2, 2023 · 0 comments

Comments

@fxfactorial
Copy link

What piece of the framework are having the lack of docs?

Here is a code sample

let payload = "128acb08000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000fffd8963efd1fc6a506488495d951d5263988d2500000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb8a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000"

let sig = "swap(address,bool,int256,uint160,bytes)"
// actually does work on payload if you remove the first four bytes of payload
let result = ABIDecoder.decode(types: [
                                 .address, .bool, .int(bits:256), .uint(bits:160), .dynamicBytes,
                               ],
                               data: Data(hex: payload[8...]))

now how can I get result without having to manually give the types? that is, I want to pass to ABIDecoder just the (address,bool,int256,uint160,bytes) and data and get the parsed result.

What bit of docs would you like to have?

How to decode using just signature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
@fxfactorial and others