Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Ganache's provider type is not compatible with Web3 #2125

Closed
davidmurdoch opened this issue Jan 20, 2022 · 10 comments
Closed

Ganache's provider type is not compatible with Web3 #2125

davidmurdoch opened this issue Jan 20, 2022 · 10 comments
Assignees
Milestone

Comments

@davidmurdoch
Copy link
Member

it's a matter of
(payload: JsonRpcRequest<...>, callback?: Callback | undefined)
(the relevant part of the type on Ganache)
vs
(payload: JsonRPCRequest, callback: Callback<JsonRPCResponse>)

Full error:

    test/encoder.test.ts:76:50 - error TS2345: Argument of type 'EthereumProvider_2' is not assignable to parameter of type 'Provider'.
      Types of property 'send' are incompatible.
        Type '{ <Method extends never>(method: Method, params?: NoUnknownArray<Parameters<Overloads<EthereumApi[Method]>>> | undefined): cleanAndMergePromiseGenerics<...>; <Method extends never>(payload: JsonRpcRequest<...>, callback?: Callback | undefined): undefined; <Method extends never>(payloads: JsonRpcRequest<...>[], callb...' is not assignable to type '(payload: JsonRPCRequest, callback: Callback<JsonRPCResponse>) => any'.
          Types of parameters 'params' and 'callback' are incompatible.
            Type 'Callback<JsonRPCResponse>' is not assignable to type 'undefined'.
            ```
@MicaiahReid
Copy link
Contributor

Blocked until this web3 PR is merged. web3/web3.js#4743

@koraykoska
Copy link

@MicaiahReid As it is merged already, is there any update?

@davidmurdoch
Copy link
Member Author

@koraykoska You can try the new web3 release candidate that contains their fix now: https://github.com/ChainSafe/web3.js/releases/tag/v1.7.2-rc.0

@koraykoska
Copy link

@davidmurdoch I am not using web3.js. It's a dependency of ganache and I only use ganache with ethers.

@davidmurdoch
Copy link
Member Author

Web3 is most certainly not a dependency of Ganache. 😁

Are you suggesting ethers doesn't like the Ganache provider type?

@koraykoska
Copy link

koraykoska commented Apr 7, 2022 via email

@davidmurdoch
Copy link
Member Author

What is the error?

@koraykoska
Copy link

koraykoska commented Apr 8, 2022 via email

@davidmurdoch
Copy link
Member Author

Does adding "skipLibCheck": true temporarily fix it for you?

@MicaiahReid
Copy link
Contributor

I've confirmed that types from Ganache v7.0.2 and above are compatible with web3 v1.7.3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants