Skip to content

calling a function using ethers shows not a function in react #1456

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

You must be logged in to vote

I am assuming you mean the method buy?

You have multiple definitions of buy in your ABI, so you need to specify which you mean. I highly recommend you trim down your ABI to just include the methods you use, but if you wish to keep the full ABI, you will need to use:

// There are two "buy" methers, so you must specify which you mean:
// - buy(uint256)
// - buy(uint256,bytes)
contract["buy(uint256)"](shareId, overrides)

If you trim down the ABI to exclude the ones you don't use, you will be able to have cleaner code (the code you have already would work) and you would cut about 2 megabytes off your application size, as most of that (massive) ABI is unused. :)

Just a suggestion though. :)

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ricmoo
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@vikramIde
Comment options

@zed-wong
Comment options

@amanmehra262001
Comment options

@nickjuntilla
Comment options

@zemse
Comment options

zemse Jun 29, 2023
Collaborator

Answer selected by ricmoo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants
Converted from issue

This discussion was converted from issue #1455 on April 12, 2021 07:55.