Replies: 1 comment 2 replies
-
You can use the // Most useful; includes all function names, return types, visibility, etc.
contract.interface.getFunction("transfer").format(ethers.utils.FormatTypes.full)
// 'function transfer(address to, uint256 value)'
// If you need to operate against other tools that do not support human-readable ABI
contract.interface.getFunction("transfer").format(ethers.utils.FormatTypes.json)
// '{"type":"function","name":"transfer","constant":false,"payble":false,"inputs":[{"type":"address","name":"to"},{"type":"uint256","name":"value"}],"ouputs":[]}'
// Similar to "full", but is slightly more compact and drops names.
contract.interface.getFunction("transfer").format(ethers.utils.FormatTypes.minimal)
// 'function transfer(address,uint256)'
// This is useful for computing the normalized signatures for computing selectors, but is not sufficient to store to re-create the ABI
contract.interface.getFunction("transfer").format(ethers.utils.FormatTypes.sighash)
// 'transfer(address,uint256)' Is that what you were looking for? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to get the ABI of one of my contract's function ?
Beta Was this translation helpful? Give feedback.
All reactions