move TransactionReceiptResolver away

pull/3094/head
yann300 7 years ago
parent 8975dcc848
commit 1d1a00fee1
  1. 18
      src/app.js
  2. 23
      src/transactionReceiptResolver.js

@ -46,6 +46,7 @@ var BasicReadOnlyExplorer = require('./app/files/basicReadOnlyExplorer')
var NotPersistedExplorer = require('./app/files/NotPersistedExplorer') var NotPersistedExplorer = require('./app/files/NotPersistedExplorer')
var toolTip = require('./app/ui/tooltip') var toolTip = require('./app/ui/tooltip')
var CommandInterpreter = require('./lib/cmdInterpreter') var CommandInterpreter = require('./lib/cmdInterpreter')
var TransactionReceiptResolver = require('./transactionReceiptResolver')
var styleGuide = require('./app/ui/styles-guide/theme-chooser') var styleGuide = require('./app/ui/styles-guide/theme-chooser')
var styles = styleGuide.chooser() var styles = styleGuide.chooser()
@ -404,22 +405,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}) })
// ----------------- Tx listener ----------------- // ----------------- Tx listener -----------------
var transactionReceiptResolver = { var transactionReceiptResolver = new TransactionReceiptResolver()
_transactionReceipts: {},
resolve: function (tx, cb) {
if (this._transactionReceipts[tx.hash]) {
return cb(null, this._transactionReceipts[tx.hash])
}
executionContext.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => {
if (!error) {
this._transactionReceipts[tx.hash] = receipt
cb(null, receipt)
} else {
cb(error)
}
})
}
}
var compiledContracts = function () { var compiledContracts = function () {
if (compiler.lastCompilationResult && compiler.lastCompilationResult.data) { if (compiler.lastCompilationResult && compiler.lastCompilationResult.data) {

@ -0,0 +1,23 @@
'use strict'
var executionContext = require('./execution-context')
module.exports = class TransactionReceiptResolver {
constructor () {
this._transactionReceipts = {}
}
resolve (tx, cb) {
if (this._transactionReceipts[tx.hash]) {
return cb(null, this._transactionReceipts[tx.hash])
}
executionContext.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => {
if (!error) {
this._transactionReceipts[tx.hash] = receipt
cb(null, receipt)
} else {
cb(error)
}
})
}
}
Loading…
Cancel
Save