Rubilmax / ethers-multicall-provider

⚡🕰️ Call any set of functions from any set of smart contracts in a single RPC query, seamlessly using ethers' providers API!
https://github.com/Rubilmax/ethers-multicall-provider
MIT License
62 stars 7 forks source link

Type mismatch for the AbstractProvider when trying to wrap ethers v6 JsonRPCProvider. #61

Closed ashwinYardi closed 9 months ago

ashwinYardi commented 9 months ago

Current Behavior

Screenshot 2024-02-08 at 10 29 36 AM

As shown in the above image, in both the cases, when trying to wrap AbstractProvider, the type error is shown:

Argument of type 'import(".../node_modules/ethers/lib.commonjs/providers/abstract-provider").AbstractProvider' is not assignable to parameter of type 'import(".../node_modules/ethers-multicall-provider/node_modules/ethers/lib.commonjs/providers/abstract-provider").AbstractProvider'.

 Property '#private' in type 'AbstractProvider' refers to a different member that cannot be accessed from within type 'AbstractProvider'.

So apparently, two different variations of the type AbstractProvider are being used which is causing the collision.

AbstractProvider returned by getDefaultProvider in ethers v6 is different that what is epected by ethers-multicall-provider

Environment

ashwinYardi commented 9 months ago

One more example:

image

The error is the same. AbstractProvider from ethers lib inside ethers-multicall-provider and AbstractProvider driectly imported from ethers clash with each other. :(

Rubilmax commented 9 months ago

Can you ref a repository pls? Every time i had this error there were 2 versions of ethers installed at the same time. I need to check your lock file

ashwinYardi commented 9 months ago

Hey will quickly spin up a project and share the similar setup with you.

ashwinYardi commented 9 months ago

Hey, so I was not getting this error in the new project that I had setup. So after your hint that this could be due to dependency issues, I cleaned the cache, deleted the lock file, reinstalled ethers and ethers-multicall-provider andd BAMM, the type erros are gone.

Not sure, what was causing the issue, but for now got it working. Thank you so much!

Rubilmax commented 9 months ago

Great! Hopefully it'll be helpful to others later!