Commit c8ae7097 authored by yann300's avatar yann300

move TransactionReceiptResolver away

parent 1168d21c
...@@ -46,6 +46,7 @@ var BasicReadOnlyExplorer = require('./app/files/basicReadOnlyExplorer') ...@@ -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 ...@@ -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) {
......
'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)
}
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment