joshstevens19 / ethereum-abi-types-generator

Generate typings based on your ABIs, with provider wrappers exposed.
MIT License
163 stars 22 forks source link

Question: How to handle Duplicate definition #35

Closed akf0rce closed 2 years ago

akf0rce commented 2 years ago

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

joshstevens19 commented 2 years ago

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