Merge pull request #763 from ethereum/alert_tx_rob3

cleaner attempt addressing issue #747
pull/1/head
yann300 7 years ago committed by GitHub
commit 2e5876fe06
  1. 11
      src/app.js
  2. 1
      src/app/tabs/run-tab.js
  3. 12
      src/universal-dapp.js

@ -343,8 +343,12 @@ function run () {
} }
var udapp = new UniversalDApp({ var udapp = new UniversalDApp({
removable: false, api: {
removable_instances: true logMessage: (msg) => {
self._components.editorpanel.log({ type: 'log', value: msg })
}
},
opt: { removable: false, removable_instances: true }
}) })
udapp.reset({}, transactionContextAPI) udapp.reset({}, transactionContextAPI)
udapp.event.register('debugRequested', this, function (txResult) { udapp.event.register('debugRequested', this, function (txResult) {
@ -402,6 +406,9 @@ function run () {
}, },
runCompiler: () => { runCompiler: () => {
runCompiler() runCompiler()
},
logMessage: (msg) => {
self._components.editorpanel.log({type: 'log', value: msg})
} }
} }
var rhpEvents = { var rhpEvents = {

@ -300,6 +300,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
var args = createButtonInput.value var args = createButtonInput.value
txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), (error, data) => { txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), (error, data) => {
if (!error) { if (!error) {
appAPI.logMessage('transaction added ...')
txExecution.createContract(data, appAPI.udapp(), (error, txResult) => { txExecution.createContract(data, appAPI.udapp(), (error, txResult) => {
if (!error) { if (!error) {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()

@ -96,13 +96,15 @@ var css = csjs`
/* /*
trigger debugRequested trigger debugRequested
*/ */
function UniversalDApp (options) { function UniversalDApp (opts = {}) {
this.event = new EventManager() this.event = new EventManager()
var self = this 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.el = yo`<div class="udapp"></div>`
self.personalMode = self.options.personalMode || false self.personalMode = opts.opt.personalMode || false
self.contracts self.contracts
self.transactionContextAPI self.transactionContextAPI
executionContext.event.register('contextChanged', this, function (context) { 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> <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> <i class="fa fa-clipboard ${css.copy}" aria-hidden="true" onclick=${copyToClipboard} title='Copy to clipboard'></i>
</div>` </div>`
if (this.removable_instance) {
if (this.options.removable_instances) {
var close = yo`<div class="${css.udappClose}" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></div>` var close = yo`<div class="${css.udappClose}" onclick=${remove}><i class="${css.closeIcon} fa fa-close" aria-hidden="true"></i></div>`
title.appendChild(close) title.appendChild(close)
} }
@ -308,6 +309,7 @@ UniversalDApp.prototype.getCallButton = function (args) {
if (!error) { if (!error) {
txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => { txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => {
if (!error) { if (!error) {
self._api.logMessage('UDApp transaction added ...')
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
if (isVM) { if (isVM) {
var vmError = txExecution.checkVMError(txResult) var vmError = txExecution.checkVMError(txResult)

Loading…
Cancel
Save