move the declaration

pull/3481/head
yann300 2 years ago
parent 53cec11285
commit 3e18a173e8
  1. 12
      apps/remix-ide/src/app/providers/injected-provider.tsx

@ -15,18 +15,18 @@ export class InjectedProvider extends Plugin implements IProvider {
constructor (profile) {
super(profile)
if ((window as any).ethereum) {
this.provider = new Web3((window as any).ethereum)
}
}
onActivation(): void {
this.listenerAccountsChanged = (accounts: Array<string>) => {
this.emit('accountsChanged', accounts)
}
this.listenerChainChanged = (chainId: number) => {
this.emit('chainChanged', chainId)
}
if ((window as any).ethereum) {
this.provider = new Web3((window as any).ethereum)
}
}
onActivation(): void {
(window as any).ethereum.on('accountsChanged', this.listenerAccountsChanged);
(window as any).ethereum.on('chainChanged', this.listenerChainChanged);
}

Loading…
Cancel
Save