Merge branch 'master' into focushome

pull/5370/head
Liana Husikyan 2 years ago committed by GitHub
commit dd038e84ee
  1. 3
      apps/remix-ide/src/app/providers/abstract-provider.tsx
  2. 15
      apps/remix-ide/src/app/providers/injected-provider.tsx
  3. 2
      apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx

@ -13,7 +13,8 @@ export type JsonDataRequest = {
export type JsonDataResult = { export type JsonDataResult = {
id: number, id: number,
jsonrpc: string // version jsonrpc: string // version
result: any result?: any,
error?: any,
} }
export type RejectRequest = (error: Error) => void export type RejectRequest = (error: Error) => void

@ -57,14 +57,21 @@ export class InjectedProvider extends Plugin implements IProvider {
// This will be displayed on UI tooltip as 'cannot get account list: Environment Updated !!' // This will be displayed on UI tooltip as 'cannot get account list: Environment Updated !!'
if (!this.provider) { if (!this.provider) {
this.call('notification', 'toast', 'No injected provider (e.g Metamask) has been found.') this.call('notification', 'toast', 'No injected provider (e.g Metamask) has been found.')
return reject(new Error('no injected provider found.')) return resolve({ jsonrpc: '2.0', error: 'no injected provider found', id: data.id })
} }
try { try {
if ((window as any) && typeof (window as any).ethereum.request === "function") (window as any).ethereum.request({ method: "eth_requestAccounts" }); 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) let resultData = await this.provider.currentProvider.send(data.method, data.params)
resolve({ jsonrpc: '2.0', result: resultData.result, id: data.id }) if (resultData) {
if (resultData.jsonrpc && resultData.jsonrpc === '2.0') {
resultData = resultData.result
}
resolve({ jsonrpc: '2.0', result: resultData, id: data.id })
} else {
resolve({ jsonrpc: '2.0', error: 'no return data provided', id: data.id })
}
} catch (error) { } catch (error) {
reject(error) resolve({ jsonrpc: '2.0', error: error.message, id: data.id })
} }
} }
} }

@ -15,7 +15,7 @@ export class MainnetForkVMProvider extends BasicVMProvider {
}, blockchain) }, blockchain)
this.blockchain = blockchain this.blockchain = blockchain
this.fork = 'london' this.fork = 'london'
this.nodeUrl = 'https://rpc.archivenode.io/e50zmkroshle2e2e50zm0044i7ao04ym' this.nodeUrl = 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
this.blockNumber = 'latest' this.blockNumber = 'latest'
} }

Loading…
Cancel
Save