Skip to content

Commit c3e46b4

Browse files
authored
Merge pull request #1313 from ethereum/tserror
timestamp added for VM only
2 parents 45cf8dd + 9b3e86d commit c3e46b4

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

apps/remix-ide/src/blockchain/blockchain.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Blockchain {
2323
detectNetwork: (cb) => {
2424
this.executionContext.detectNetwork(cb)
2525
},
26+
isVM: () => { return this.executionContext.isVM() },
2627
personalMode: () => {
2728
return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false
2829
}
@@ -322,6 +323,7 @@ class Blockchain {
322323
detectNetwork: (cb) => {
323324
this.executionContext.detectNetwork(cb)
324325
},
326+
isVM: () => { return this.executionContext.isVM() },
325327
personalMode: () => {
326328
return this.getProvider() === 'web3' ? this.config.get('settings/personal-mode') : false
327329
}

libs/remix-lib/src/execution/txRunnerWeb3.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,11 @@ export class TxRunnerWeb3 {
7373

7474
if (useCall) {
7575
tx['gas'] = gasLimit
76-
tx['timestamp'] = timestamp
77-
return this._api.detectNetwork((err, network) => {
78-
if (err) {
79-
console.log(err)
80-
return
81-
// Remove `timestamp` from tx if network is Kovan
82-
// It shows: 'Error: Returned error: Invalid params: unknown field `timestamp`'
83-
// See: https://github.com/ethereum/remix-project/issues/1282
84-
} else if (network && network.name === 'Kovan') delete tx['timestamp']
85-
86-
return this.getWeb3().eth.call(tx, function (error, result: any) {
87-
if (error) return callback(error)
88-
callback(null, {
89-
result: result
90-
})
76+
if (this._api && this._api.isVM()) tx['timestamp'] = timestamp
77+
return this.getWeb3().eth.call(tx, function (error, result: any) {
78+
if (error) return callback(error)
79+
callback(null, {
80+
result: result
9181
})
9282
})
9383
}

0 commit comments

Comments
 (0)