Merge pull request #1313 from ethereum/tserror

timestamp added for VM only
pull/5370/head
yann300 4 years ago committed by GitHub
commit edace9892e
  1. 2
      apps/remix-ide/src/blockchain/blockchain.js
  2. 20
      libs/remix-lib/src/execution/txRunnerWeb3.ts

@ -23,6 +23,7 @@ class Blockchain {
detectNetwork: (cb) => { detectNetwork: (cb) => {
this.executionContext.detectNetwork(cb) this.executionContext.detectNetwork(cb)
}, },
isVM: () => { return this.executionContext.isVM() },
personalMode: () => { personalMode: () => {
return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false
} }
@ -322,6 +323,7 @@ class Blockchain {
detectNetwork: (cb) => { detectNetwork: (cb) => {
this.executionContext.detectNetwork(cb) this.executionContext.detectNetwork(cb)
}, },
isVM: () => { return this.executionContext.isVM() },
personalMode: () => { personalMode: () => {
return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false
} }

@ -73,21 +73,11 @@ export class TxRunnerWeb3 {
if (useCall) { if (useCall) {
tx['gas'] = gasLimit tx['gas'] = gasLimit
tx['timestamp'] = timestamp if (this._api && this._api.isVM()) tx['timestamp'] = timestamp
return this._api.detectNetwork((err, network) => { return this.getWeb3().eth.call(tx, function (error, result: any) {
if (err) { if (error) return callback(error)
console.log(err) callback(null, {
return result: result
// Remove `timestamp` from tx if network is Kovan
// It shows: 'Error: Returned error: Invalid params: unknown field `timestamp`'
// See: https://github.com/ethereum/remix-project/issues/1282
} else if (network && network.name === 'Kovan') delete tx['timestamp']
return this.getWeb3().eth.call(tx, function (error, result: any) {
if (error) return callback(error)
callback(null, {
result: result
})
}) })
}) })
} }

Loading…
Cancel
Save