use blockchain object instead of executionContext in transactionReceiptResolver

pull/1/head
Iuri Matias 5 years ago
parent 06a08a7f6a
commit 1d7d364b40
  1. 2
      src/app.js
  2. 4
      src/app/udapp/make-udapp.js
  3. 6
      src/lib/transactionReceiptResolver.js

@ -236,7 +236,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name) const compilersArtefacts = new CompilersArtefacts() // store all the compilation results (key represent a compiler name)
registry.put({api: compilersArtefacts, name: 'compilersartefacts'}) registry.put({api: compilersArtefacts, name: 'compilersartefacts'})
const {eventsDecoder, txlistener} = makeUdapp(udapp, executionContext, compilersArtefacts, (domEl) => mainview.getTerminal().logHtml(domEl)) const {eventsDecoder, txlistener} = makeUdapp(blockchain, udapp, executionContext, compilersArtefacts, (domEl) => mainview.getTerminal().logHtml(domEl))
// ----------------- network service (resolve network id / name) ---------------------------- // ----------------- network service (resolve network id / name) ----------------------------
const networkModule = new NetworkModule(executionContext) const networkModule = new NetworkModule(executionContext)
// ----------------- convert offset to line/column service ---------------------------- // ----------------- convert offset to line/column service ----------------------------

@ -5,7 +5,7 @@ var Txlistener = remixLib.execution.txListener
var EventsDecoder = remixLib.execution.EventsDecoder var EventsDecoder = remixLib.execution.EventsDecoder
var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver') var TransactionReceiptResolver = require('../../lib/transactionReceiptResolver')
export function makeUdapp (udapp, executionContext, compilersArtefacts, logHtmlCallback) { export function makeUdapp (blockchain, udapp, executionContext, compilersArtefacts, logHtmlCallback) {
// ----------------- UniversalDApp ----------------- // ----------------- UniversalDApp -----------------
// TODO: to remove when possible // TODO: to remove when possible
udapp.event.register('transactionBroadcasted', (txhash, networkName) => { udapp.event.register('transactionBroadcasted', (txhash, networkName) => {
@ -14,7 +14,7 @@ export function makeUdapp (udapp, executionContext, compilersArtefacts, logHtmlC
}) })
// ----------------- Tx listener ----------------- // ----------------- Tx listener -----------------
const transactionReceiptResolver = new TransactionReceiptResolver(executionContext) const transactionReceiptResolver = new TransactionReceiptResolver(blockchain)
const txlistener = new Txlistener({ const txlistener = new Txlistener({
api: { api: {

@ -1,16 +1,16 @@
'use strict' 'use strict'
module.exports = class TransactionReceiptResolver { module.exports = class TransactionReceiptResolver {
constructor (executionContext) { constructor (blockchain) {
this._transactionReceipts = {} this._transactionReceipts = {}
this.executionContext = executionContext this.blockchain = blockchain
} }
resolve (tx, cb) { resolve (tx, cb) {
if (this._transactionReceipts[tx.hash]) { if (this._transactionReceipts[tx.hash]) {
return cb(null, this._transactionReceipts[tx.hash]) return cb(null, this._transactionReceipts[tx.hash])
} }
this.executionContext.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => { this.blockchain.web3().eth.getTransactionReceipt(tx.hash, (error, receipt) => {
if (!error) { if (!error) {
this._transactionReceipts[tx.hash] = receipt this._transactionReceipts[tx.hash] = receipt
cb(null, receipt) cb(null, receipt)

Loading…
Cancel
Save