Commit 2e5876fe authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #763 from ethereum/alert_tx_rob3

cleaner attempt addressing issue #747
parents dd6a7a85 2efd747f
......@@ -343,8 +343,12 @@ function run () {
}
var udapp = new UniversalDApp({
removable: false,
removable_instances: true
api: {
logMessage: (msg) => {
self._components.editorpanel.log({ type: 'log', value: msg })
}
},
opt: { removable: false, removable_instances: true }
})
udapp.reset({}, transactionContextAPI)
udapp.event.register('debugRequested', this, function (txResult) {
......@@ -402,6 +406,9 @@ function run () {
},
runCompiler: () => {
runCompiler()
},
logMessage: (msg) => {
self._components.editorpanel.log({type: 'log', value: msg})
}
}
var rhpEvents = {
......
......@@ -300,6 +300,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
var args = createButtonInput.value
txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), (error, data) => {
if (!error) {
appAPI.logMessage('transaction added ...')
txExecution.createContract(data, appAPI.udapp(), (error, txResult) => {
if (!error) {
var isVM = executionContext.isVM()
......
......@@ -96,13 +96,15 @@ var css = csjs`
/*
trigger debugRequested
*/
function UniversalDApp (options) {
function UniversalDApp (opts = {}) {
this.event = new EventManager()
var self = this
self.options = options || {}
self._api = opts.api
self.removable = opts.opt.removable
self.removable_instance = opts.opt.removable_instance
self.el = yo`<div class="udapp"></div>`
self.personalMode = self.options.personalMode || false
self.personalMode = opts.opt.personalMode || false
self.contracts
self.transactionContextAPI
executionContext.event.register('contextChanged', this, function (context) {
......@@ -229,8 +231,7 @@ UniversalDApp.prototype.renderInstance = function (contract, address, contractNa
<div class="${css.titleText}"> ${contractName} at ${shortAddress} (${context}) </div>
<i class="fa fa-clipboard ${css.copy}" aria-hidden="true" onclick=${copyToClipboard} title='Copy to clipboard'></i>
</div>`
if (this.options.removable_instances) {
if (this.removable_instance) {
var close = yo`<div class="${css.udappClose}" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></div>`
title.appendChild(close)
}
......@@ -308,6 +309,7 @@ UniversalDApp.prototype.getCallButton = function (args) {
if (!error) {
txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => {
if (!error) {
self._api.logMessage('UDApp transaction added ...')
var isVM = executionContext.isVM()
if (isVM) {
var vmError = txExecution.checkVMError(txResult)
......
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