|
|
|
@ -13,8 +13,6 @@ var txHelper = remixLib.execution.txHelper |
|
|
|
|
var executionContext = require('./execution-context') |
|
|
|
|
var globalRegistry = require('./global/registry') |
|
|
|
|
|
|
|
|
|
var modalCustom = require('./app/ui/modal-dialog-custom') |
|
|
|
|
|
|
|
|
|
function UniversalDApp () { |
|
|
|
|
this.event = new EventManager() |
|
|
|
|
var self = this |
|
|
|
@ -184,8 +182,8 @@ UniversalDApp.prototype.pendingTransactionsCount = function () { |
|
|
|
|
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ). |
|
|
|
|
* @param {Function} callback - callback. |
|
|
|
|
*/ |
|
|
|
|
UniversalDApp.prototype.createContract = function (data, confirmationCb, continueCb, callback) { |
|
|
|
|
this.runTx({data: data, useCall: false}, confirmationCb, continueCb, (error, txResult) => { |
|
|
|
|
UniversalDApp.prototype.createContract = function (data, confirmationCb, continueCb, promptCb, callback) { |
|
|
|
|
this.runTx({data: data, useCall: false}, confirmationCb, continueCb, promptCb, (error, txResult) => { |
|
|
|
|
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
|
|
|
|
|
callback(error, txResult) |
|
|
|
|
}) |
|
|
|
@ -199,8 +197,8 @@ UniversalDApp.prototype.createContract = function (data, confirmationCb, continu |
|
|
|
|
* @param {Object} funAbi - abi definition of the function to call. |
|
|
|
|
* @param {Function} callback - callback. |
|
|
|
|
*/ |
|
|
|
|
UniversalDApp.prototype.callFunction = function (to, data, funAbi, confirmationCb, continueCb, callback) { |
|
|
|
|
this.runTx({to: to, data: data, useCall: funAbi.constant}, confirmationCb, continueCb, (error, txResult) => { |
|
|
|
|
UniversalDApp.prototype.callFunction = function (to, data, funAbi, confirmationCb, continueCb, promptCb, callback) { |
|
|
|
|
this.runTx({to: to, data: data, useCall: funAbi.constant}, confirmationCb, continueCb, promptCb, (error, txResult) => { |
|
|
|
|
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
|
|
|
|
|
callback(error, txResult) |
|
|
|
|
}) |
|
|
|
@ -242,7 +240,7 @@ UniversalDApp.prototype.silentRunTx = function (tx, cb) { |
|
|
|
|
cb) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
UniversalDApp.prototype.runTx = function (args, confirmationCb, continueCb, cb) { |
|
|
|
|
UniversalDApp.prototype.runTx = function (args, confirmationCb, continueCb, promptCb, cb) { |
|
|
|
|
const self = this |
|
|
|
|
async.waterfall([ |
|
|
|
|
function getGasLimit (next) { |
|
|
|
@ -288,10 +286,7 @@ UniversalDApp.prototype.runTx = function (args, confirmationCb, continueCb, cb) |
|
|
|
|
var timestamp = Date.now() |
|
|
|
|
|
|
|
|
|
self.event.trigger('initiatingTransaction', [timestamp, tx, payLoad]) |
|
|
|
|
self.txRunner.rawRun(tx, confirmationCb, continueCb, |
|
|
|
|
function (okCb, cancelCb) { |
|
|
|
|
modalCustom.promptPassphrase(null, 'Personal mode is enabled. Please provide passphrase of account ' + tx.from, '', okCb, cancelCb) |
|
|
|
|
}, |
|
|
|
|
self.txRunner.rawRun(tx, confirmationCb, continueCb, promptCb, |
|
|
|
|
function (error, result) { |
|
|
|
|
let eventName = (tx.useCall ? 'callExecuted' : 'transactionExecuted') |
|
|
|
|
self.event.trigger(eventName, [error, tx.from, tx.to, tx.data, tx.useCall, result, timestamp, payLoad]) |
|
|
|
|