remove udapp param from make-udapp

pull/5370/head
Iuri Matias 5 years ago
parent bce5f00f15
commit d90dc6263f
  1. 11
      src/app/tabs/runTab/model/blockchain.js
  2. 11
      src/app/udapp/make-udapp.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

@ -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`<a href="${txLink}" target="_blank">${txLink}</a>`)
})
@ -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}
}

Loading…
Cancel
Save