log transactio broadcasted

pull/1/head
yann300 7 years ago
parent 05472c45d4
commit 0fa25eecf4
  1. 3
      src/app.js
  2. 6
      src/app/panels/terminal.js
  3. 8
      src/universal-dapp.js

@ -302,6 +302,9 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
logMessage: (msg) => {
self._components.editorpanel.log({ type: 'log', value: msg })
},
logHtmlMessage: (msg) => {
self._components.editorpanel.log({ type: 'html', value: msg })
},
config: self._api.config,
detectNetwork: (cb) => {
executionContext.detectNetwork(cb)

@ -66,6 +66,7 @@ class Terminal {
self._INDEX.allMain = []
self._INDEX.commands = {}
self._INDEX.commandsMain = {}
self.registerCommand('html', self._blocksRenderer('html'), { activate: true })
self.registerCommand('log', self._blocksRenderer('log'), { activate: true })
self.registerCommand('info', self._blocksRenderer('info'), { activate: true })
self.registerCommand('error', self._blocksRenderer('error'), { activate: true })
@ -448,6 +449,11 @@ class Terminal {
}, 0)
}
_blocksRenderer (mode) {
if (mode === 'html') {
return function logger (args, scopedCommands, append) {
if (args.length) append(args[0])
}
}
mode = { log: styles.terminal.text_RegularLog, info: styles.terminal.text_InfoLog, error: styles.terminal.text_ErrorLog }[mode] // defaults
if (mode) {
return function logger (args, scopedCommands, append) {

@ -51,6 +51,14 @@ UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) {
executionContext.vm().stateManager.cache.flush(function () {})
}
this.txRunner = new TxRunner(this.accounts, this._api)
this.txRunner.event.register('transactionBroadcasted', (txhash) => {
this._api.detectNetwork((error, network) => {
if (!error && network) {
var txLink = executionContext.txDetailsLink(network.name, txhash)
if (txLink) this._api.logHtmlMessage(yo`<a href="${txLink}" target="_blank">${txLink}</a>`)
}
})
})
}
UniversalDApp.prototype.newAccount = function (password, cb) {

Loading…
Cancel
Save