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

Add method decodeAbi to method interface #6220

Closed
ofumbi opened this issue Jun 22, 2023 · 2 comments · Fixed by #6950
Closed

Add method decodeAbi to method interface #6220

ofumbi opened this issue Jun 22, 2023 · 2 comments · Fixed by #6950
Assignees

Comments

@ofumbi
Copy link

ofumbi commented Jun 22, 2023

The web3 method signature already has the encodeABI() method.
contract.method.name().encodeABI()
Im requesting that decodeABI() method be added to the signature
contract.method.name().decodeABI(result)
This is usefull when using multicall contracts, since we retrieve result hashes directly from the multicall contract

@Muhammad-Altabba
Copy link
Contributor

Thanks @ofumbi for you suggestion.
We will look into it.
And it would be great if you provide a full example of your usage.
Thanks,

@spacesailor24
Copy link
Contributor

Here is an example taken from here:

const iface = new ethers.utils.Interface(['function swapExactETHForTokens(uint256 amountOutMin, address[] path, address to, uint256 deadline)'])

iface.decodeFunctionData('swapExactETHForTokens', '0x7ff36ab50000000000000000000000000000000000000000000000bc18ba4144048bbab00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000c0c5eb43e2df059e3be6e4fb0284c283caa5991900000000000000000000000000000000000000000000000000000000614d87a80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00000000000000000000000008ba0619b1e7a582e0bce5bbe9843322c954c340')
// gives: [e, ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", "0x08ba0619b1e7A582E0BCe5BBE9843322C954C340"], "0xC0C5eb43E2dF059e3Be6E4fb0284C283CAa59919", e] (4)

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