suggested changes

pull/7/head
aniket-engg 5 years ago committed by Aniket
parent 096dda5fb1
commit 03f3b2a98c
  1. 9
      remix-lib/src/execution/execution-context.js
  2. 34
      remix-lib/src/web3Provider/web3VmProvider.js

@ -217,10 +217,7 @@ function ExecutionContext () {
if (context === 'injected') { if (context === 'injected') {
if (injectedProvider === undefined) { if (injectedProvider === undefined) {
var alertMsg = 'No injected Web3 provider found. ' infoCb('No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page).')
alertMsg += 'Make sure your provider (e.g. MetaMask) is active and running '
alertMsg += '(when recently activated you may have to reload the page).'
infoCb(alertMsg)
return cb() return cb()
} else { } else {
self.askPermission() self.askPermission()
@ -288,9 +285,7 @@ function ExecutionContext () {
cb() cb()
} else { } else {
web3.setProvider(oldProvider) web3.setProvider(oldProvider)
var alertMsg = 'Not possible to connect to the Web3 provider. ' cb('Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC).')
alertMsg += 'Make sure the provider is running and a connection is open (via IPC or RPC).'
cb(alertMsg)
} }
}) })
} }

@ -18,29 +18,29 @@ function web3VmProvider () {
this.incr = 0 this.incr = 0
this.eth = {} this.eth = {}
this.debug = {} this.debug = {}
this.eth.getCode = function (address, cb) { return self.getCode(address, cb) } this.eth.getCode = (...args) => self.getCode(...args)
this.eth.getTransaction = function (hash, cb) { return self.getTransaction(hash, cb) } this.eth.getTransaction = (...args) => self.getTransaction(...args)
this.eth.getTransactionReceipt = function (hash, cb) { return self.getTransactionReceipt(hash, cb) } this.eth.getTransactionReceipt = (...args) => self.getTransactionReceipt(...args)
this.eth.getTransactionFromBlock = function (blockNumber, txIndex, cb) { return self.getTransactionFromBlock(blockNumber, txIndex, cb) } this.eth.getTransactionFromBlock = (...args) => self.getTransactionFromBlock(...args)
this.eth.getBlockNumber = function (cb) { return self.getBlockNumber(cb) } this.eth.getBlockNumber = (...args) => self.getBlockNumber(...args)
this.debug.traceTransaction = function (hash, options, cb) { return self.traceTransaction(hash, options, cb) } this.debug.traceTransaction = (...args) => self.traceTransaction(...args)
this.debug.storageRangeAt = function (blockNumber, txIndex, address, start, end, maxLength, cb) { return self.storageRangeAt(blockNumber, txIndex, address, start, end, maxLength, cb) } this.debug.storageRangeAt = (...args) => self.storageRangeAt(...args)
this.debug.preimage = function (hashedKey, cb) { return self.preimage(hashedKey, cb) } this.debug.preimage = (...args) => self.preimage(...args)
this.providers = { 'HttpProvider': function (url) {} } this.providers = { 'HttpProvider': function (url) {} }
this.currentProvider = {'host': 'vm provider'} this.currentProvider = {'host': 'vm provider'}
this.storageCache = {} this.storageCache = {}
this.lastProcessedStorageTxHash = {} this.lastProcessedStorageTxHash = {}
this.sha3Preimages = {} this.sha3Preimages = {}
// util // util
this.sha3 = function () { return self.web3.utils.sha3.apply(self.web3, arguments) } this.sha3 = (...args) => self.web3.utils.sha3(...args)
this.toHex = function () { return self.web3.utils.toHex.apply(self.web3, arguments) } this.toHex = (...args) => self.web3.utils.toHex(...args)
this.toAscii = function () { return self.web3.utils.hexToAscii.apply(self.web3, arguments) } this.toAscii = (...args) => self.web3.utils.hexToAscii(...args)
this.fromAscii = function () { return self.web3.utils.asciiToHex.apply(self.web3, arguments) } this.fromAscii = (...args) => self.web3.utils.asciiToHex(...args)
this.fromDecimal = function () { return self.web3.utils.numberToHex.apply(self.web3, arguments) } this.fromDecimal = (...args) => self.web3.utils.numberToHex(...args)
this.fromWei = function () { return self.web3.utils.fromWei.apply(self.web3, arguments) } this.fromWei = (...args) => self.web3.utils.fromWei(...args)
this.toWei = function () { return self.web3.utils.toWei.apply(self.web3, arguments) } this.toWei = (...args) => self.web3.utils.toWei(...args)
this.toBigNumber = function () { return self.web3.utils.toBN.apply(self.web3, arguments) } this.toBigNumber = (...args) => self.web3.utils.toBN(...args)
this.isAddress = function () { return self.web3.utils.isAddress.apply(self.web3, arguments) } this.isAddress = (...args) => self.web3.utils.isAddress(...args)
this.utils = Web3.utils || [] this.utils = Web3.utils || []
} }

Loading…
Cancel
Save