Skip to content

How do I get all the transaction functions in an ABI? #1468

Answered by ricmoo
reddyismav asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest is probably:

// If you have a Contract object, you can use contract.interface instead of this next line
const iface = new ethers.utils.Interface(abi);

// Filter out the fragments that are functions and not constants
const txFuncs = iface.fragments.filter((f) => (f.type === "function" && !f.constant));

Let me know if that works for you.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@reddyismav
Comment options

@ricmoo
Comment options

@reddyismav
Comment options

Answer selected by ricmoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants