Skip to content

Type incompatibilities with Ethers #1975

@mcmire

Description

@mcmire

SafeEventEmitterProvider is not type-compatible with Ethers. Specify, when passing an instance of SafeEventEmitterProvider to Ethers v5's Web3Provider class, the following type error is produced:

[tsserver 2345] [E] Argument of type 'SafeEventEmitterProvider' is not assignable to parameter of type 'ExternalProvider | JsonRpcFetchFunc'.
  Type 'SafeEventEmitterProvider' is not assignable to type 'ExternalProvider'.
    Types of property 'sendAsync' are incompatible.
      Type '(req: JsonRpcRequest<unknown>, callback: (error: unknown, providerRes?: any) => void) => void' is not assignable to type '(request: { method: string; params?: any[] | undefined; }, callback: (error: any, response: any) => void) => void'.
        Types of parameters 'req' and 'request' are incompatible.
          Type '{ method: string; params?: any[] | undefined; }' is missing the following properties from type 'JsonRpcRequest<unknown>': jsonrpc, id

With Ethers v6's BrowserProvider class, the following type error occurs:

[tsserver 2345] [E] Argument of type 'SafeEventEmitterProvider' is not assignable to parameter of type 'Eip1193Provider'.
  Property 'request' is missing in type 'SafeEventEmitterProvider' but required in type 'Eip1193Provider'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestteam-wallet-frameworkDeprecated: Please use `team-core-platform` instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions