From 6737ba7099f87b5cdeeeccf8d9e894c528b6f07b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 27 Dec 2019 16:21:20 -0500 Subject: [PATCH] remove udapp param from make-udapp --- src/app/tabs/runTab/model/blockchain.js | 11 +++++++++++ src/app/udapp/make-udapp.js | 11 ++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/app/tabs/runTab/model/blockchain.js b/src/app/tabs/runTab/model/blockchain.js index 4e2e87ccc4..60fcae6a48 100644 --- a/src/app/tabs/runTab/model/blockchain.js +++ b/src/app/tabs/runTab/model/blockchain.js @@ -39,6 +39,10 @@ class Blockchain { this.udapp.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp) => { this.event.trigger('transactionExecuted', [error, from, to, data, call, txResult, timestamp]) }) + + this.udapp.event.register('transactionBroadcasted', (txhash, networkName) => { + this.event.trigger('transactionBroadcasted', [txhash, networkName]) + }) } async deployContract (selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) { @@ -250,10 +254,17 @@ class Blockchain { } getTxListener (opts) { + opts.event = { + udapp: this.udapp.event + } const txlistener = new Txlistener(opts, this.executionContext) return txlistener } + startListening (txlistener) { + this.udapp.startListening(txlistener) + } + } module.exports = Blockchain diff --git a/src/app/udapp/make-udapp.js b/src/app/udapp/make-udapp.js index 150b912780..e9a8262718 100644 --- a/src/app/udapp/make-udapp.js +++ b/src/app/udapp/make-udapp.js @@ -18,10 +18,10 @@ function txDetailsLink (network, hash) { } } -export function makeUdapp (blockchain, udapp, compilersArtefacts, logHtmlCallback) { +export function makeUdapp (blockchain, compilersArtefacts, logHtmlCallback) { // ----------------- UniversalDApp ----------------- // TODO: to remove when possible - udapp.event.register('transactionBroadcasted', (txhash, networkName) => { + blockchain.event.register('transactionBroadcasted', (txhash, networkName) => { var txLink = txDetailsLink(networkName, txhash) if (txLink && logHtmlCallback) logHtmlCallback(yo`${txLink}`) }) @@ -38,14 +38,11 @@ export function makeUdapp (blockchain, udapp, compilersArtefacts, logHtmlCallbac resolveReceipt: function (tx, cb) { transactionReceiptResolver.resolve(tx, cb) } - }, - event: { - udapp: udapp.event } }) registry.put({api: txlistener, name: 'txlistener'}) - udapp.startListening(txlistener) + blockchain.startListening(txlistener) const eventsDecoder = new EventsDecoder({ api: { @@ -56,5 +53,5 @@ export function makeUdapp (blockchain, udapp, compilersArtefacts, logHtmlCallbac }) txlistener.startListening() - return {udapp, txlistener, eventsDecoder} + return {txlistener, eventsDecoder} }