Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Property 'sendAsync' is missing in type 'InjectedWeb3Subprovider'. #316

Closed
pierremzz opened this issue Jan 11, 2018 · 1 comment
Closed

Comments

@pierremzz
Copy link

Hello, maybe I am too newbie for this, but i can't find how to provide injectedWeb3Subprovider to the new ZeroEx instance. Is it a problem with the API ? Is it the right way to use it ?
Thank you

window.addEventListener('load', () => {
  
  // Checking if Web3 has been injected by the browser (Mist/MetaMask)
  if (typeof window['web3'] !== 'undefined') {

    // Use the browser's ethereum provider
    const web3: Web3 = window['web3'];
    const injectedWeb3Subprovider: InjectedWeb3Subprovider = new InjectedWeb3Subprovider(web3);

    new ZeroEx(injectedWeb3Subprovider, { networkId: 42 })
      .getAvailableAddressesAsync()
      .then(console.log)

  } else {
    console.log('No web3? You should consider trying MetaMask!')
  }

});
ERROR in src/app/app.component.ts(41,20): error TS2345: Argument of type 'InjectedWeb3Subprovider' is not assignable to parameter of type 'Provider'.
  Property 'sendAsync' is missing in type 'InjectedWeb3Subprovider'.
@LogvinovLeon
Copy link
Contributor

Subproviders are not providers. You need to create a provider engine and add a subprovider to it.
https://www.npmjs.com/package/web3-provider-engine

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

No branches or pull requests

2 participants