ethereum-abi-types-generator icon indicating copy to clipboard operation
ethereum-abi-types-generator copied to clipboard

Question: How to handle Duplicate definition

Open akf0rce opened this issue 3 years ago • 1 comments

In my ABI I have overloaded functions;

function test(address, overrides)
function test(address, amount, overrides)

In Javascript function overloading isn't applicable due to hoisting.

so when i call the contract function test the 3 params are available in typescripts scope, but it would invoke all sorts of strange issues. Particularly when I pass overrides as position 2 in the function.

I'm looking for a solution to work around this, and was wondering how other people have handled this?

P.S. Love this library it's a god send <3

akf0rce avatar Feb 24 '22 15:02 akf0rce

Hey hey super interesting I actually not dealt with an ABI with multiple exposed public overloads!! A little bit of digging I’ve found some chat about how it’s dealt with in ethers https://github.com/ethers-io/ethers.js/issues/407

I’m not sure how I can fix this in this lib as this is purely a interface wrapper which holds no logic at all! So I would suggest calling the overload as that issue says! I will look into this more to see if I can force typing in that syntax they use!

Hope it helps

joshstevens19 avatar Feb 24 '22 19:02 joshstevens19