web3.js
web3.js copied to clipboard
Add method decodeAbi to method interface
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
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,
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)