diff --git a/remix-lib/src/execution/execution-context.js b/remix-lib/src/execution/execution-context.js index 0e1b2dc313..9c1f770b5c 100644 --- a/remix-lib/src/execution/execution-context.js +++ b/remix-lib/src/execution/execution-context.js @@ -147,7 +147,7 @@ function ExecutionContext () { if (this.isVM()) { callback(null, { id: '-', name: 'VM' }) } else { - this.web3().version.getNetwork((err, id) => { + web3.eth.net.getId((err, id) => { var name = null if (err) name = 'Unknown' // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md @@ -160,7 +160,7 @@ function ExecutionContext () { else name = 'Custom' if (id === '1') { - this.web3().eth.getBlock(0, (error, block) => { + web3.eth.getBlock(0, (error, block) => { if (error) console.log('cant query first block') if (block && block.hash !== mainNetGenesisHash) name = 'Custom' callback(err, { id, name }) @@ -279,6 +279,7 @@ function ExecutionContext () { } else { web3.setProvider(new web3.providers.HttpProvider(endpoint)) } + // fixed if (web3.isConnected()) { executionContext = context self._updateBlockGasLimit() @@ -305,7 +306,7 @@ function ExecutionContext () { if (blockNumber === '0x') { blockNumber = '0x0' } - blockNumber = web3.toHex(web3.toBigNumber(blockNumber)) + blockNumber = web3.utils.toHex(web3.utils.toBN(blockNumber)) self.blocks['0x' + block.hash().toString('hex')] = block self.blocks[blockNumber] = block diff --git a/remix-lib/src/web3Provider/web3VmProvider.js b/remix-lib/src/web3Provider/web3VmProvider.js index 716d71a38a..10274a31a5 100644 --- a/remix-lib/src/web3Provider/web3VmProvider.js +++ b/remix-lib/src/web3Provider/web3VmProvider.js @@ -32,15 +32,15 @@ function web3VmProvider () { this.lastProcessedStorageTxHash = {} this.sha3Preimages = {} // util - this.sha3 = function () { return self.web3.sha3.apply(self.web3, arguments) } - this.toHex = function () { return self.web3.toHex.apply(self.web3, arguments) } - this.toAscii = function () { return self.web3.toAscii.apply(self.web3, arguments) } - this.fromAscii = function () { return self.web3.fromAscii.apply(self.web3, arguments) } - this.fromDecimal = function () { return self.web3.fromDecimal.apply(self.web3, arguments) } - this.fromWei = function () { return self.web3.fromWei.apply(self.web3, arguments) } - this.toWei = function () { return self.web3.toWei.apply(self.web3, arguments) } - this.toBigNumber = function () { return self.web3.toBigNumber.apply(self.web3, arguments) } - this.isAddress = function () { return self.web3.isAddress.apply(self.web3, arguments) } + this.sha3 = function () { return self.web3.utils.sha3.apply(self.web3, arguments) } + this.toHex = function () { return self.web3.utils.toHex.apply(self.web3, arguments) } + this.toAscii = function () { return self.web3.utils.hexToAscii.apply(self.web3, arguments) } + this.fromAscii = function () { return self.web3.utils.asciiToHex.apply(self.web3, arguments) } + this.fromDecimal = function () { return self.web3.utils.numberToHex.apply(self.web3, arguments) } + this.fromWei = function () { return self.web3.utils.fromWei.apply(self.web3, arguments) } + this.toWei = function () { return self.web3.utils.toWei.apply(self.web3, arguments) } + this.toBigNumber = function () { return self.web3.utils.toBN.apply(self.web3, arguments) } + this.isAddress = function () { return self.web3.utils.isAddress.apply(self.web3, arguments) } this.utils = Web3.utils || [] }