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