fix using custom provider

pull/3477/head
yann300 2 years ago
parent c033bfd22c
commit 30115b42b7
  1. 7
      apps/remix-ide/src/app/providers/injected-provider.tsx

@ -61,8 +61,11 @@ export class InjectedProvider extends Plugin implements IProvider {
}
try {
if ((window as any) && typeof (window as any).ethereum.request === "function") (window as any).ethereum.request({ method: "eth_requestAccounts" });
const resultData = await this.provider.currentProvider.send(data.method, data.params)
resolve({ jsonrpc: '2.0', result: resultData.result, id: data.id })
let resultData = await this.provider.currentProvider.send(data.method, data.params)
if (resultData && resultData.jsonrpc === '2.0') {
resultData = resultData.result
}
resolve({ jsonrpc: '2.0', result: resultData, id: data.id })
} catch (error) {
reject(error)
}

Loading…
Cancel
Save