|
|
@ -16,7 +16,7 @@ var modalCustom = require('./app/ui/modal-dialog-custom') |
|
|
|
/* |
|
|
|
/* |
|
|
|
trigger debugRequested |
|
|
|
trigger debugRequested |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function UniversalDAppModel (opts = {}) { |
|
|
|
function UniversalDApp (opts = {}) { |
|
|
|
this.event = new EventManager() |
|
|
|
this.event = new EventManager() |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
|
|
|
|
|
|
|
@ -29,7 +29,7 @@ function UniversalDAppModel (opts = {}) { |
|
|
|
self.txRunner = new TxRunner({}, opts.api) |
|
|
|
self.txRunner = new TxRunner({}, opts.api) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.reset = function (contracts, transactionContextAPI) { |
|
|
|
UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) { |
|
|
|
this.contracts = contracts |
|
|
|
this.contracts = contracts |
|
|
|
if (transactionContextAPI) { |
|
|
|
if (transactionContextAPI) { |
|
|
|
this.transactionContextAPI = transactionContextAPI |
|
|
|
this.transactionContextAPI = transactionContextAPI |
|
|
@ -46,7 +46,7 @@ UniversalDAppModel.prototype.reset = function (contracts, transactionContextAPI) |
|
|
|
this.txRunner = new TxRunner(this.accounts, this._api) |
|
|
|
this.txRunner = new TxRunner(this.accounts, this._api) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.newAccount = function (password, cb) { |
|
|
|
UniversalDApp.prototype.newAccount = function (password, cb) { |
|
|
|
if (!executionContext.isVM()) { |
|
|
|
if (!executionContext.isVM()) { |
|
|
|
if (!this._api.personalMode()) { |
|
|
|
if (!this._api.personalMode()) { |
|
|
|
return cb('Not running in personal mode') |
|
|
|
return cb('Not running in personal mode') |
|
|
@ -68,7 +68,7 @@ UniversalDAppModel.prototype.newAccount = function (password, cb) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype._addAccount = function (privateKey, balance) { |
|
|
|
UniversalDApp.prototype._addAccount = function (privateKey, balance) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
|
|
|
|
|
|
|
|
if (!executionContext.isVM()) { |
|
|
|
if (!executionContext.isVM()) { |
|
|
@ -85,7 +85,7 @@ UniversalDAppModel.prototype._addAccount = function (privateKey, balance) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.getAccounts = function (cb) { |
|
|
|
UniversalDApp.prototype.getAccounts = function (cb) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
|
|
|
|
|
|
|
|
if (!executionContext.isVM()) { |
|
|
|
if (!executionContext.isVM()) { |
|
|
@ -105,7 +105,7 @@ UniversalDAppModel.prototype.getAccounts = function (cb) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.getBalance = function (address, cb) { |
|
|
|
UniversalDApp.prototype.getBalance = function (address, cb) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
|
|
|
|
|
|
|
|
address = ethJSUtil.stripHexPrefix(address) |
|
|
|
address = ethJSUtil.stripHexPrefix(address) |
|
|
@ -186,15 +186,15 @@ UniversalDApp.prototype.context = function () { |
|
|
|
return (executionContext.isVM() ? 'memory' : 'blockchain') |
|
|
|
return (executionContext.isVM() ? 'memory' : 'blockchain') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.getABI = function (contract) { |
|
|
|
UniversalDApp.prototype.getABI = function (contract) { |
|
|
|
return txHelper.sortAbiFunction(contract.abi) |
|
|
|
return txHelper.sortAbiFunction(contract.abi) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.getFallbackInterface = function (contractABI) { |
|
|
|
UniversalDApp.prototype.getFallbackInterface = function (contractABI) { |
|
|
|
return txHelper.getFallbackInterface(contractABI) |
|
|
|
return txHelper.getFallbackInterface(contractABI) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.getInputs = function (funABI) { |
|
|
|
UniversalDApp.prototype.getInputs = function (funABI) { |
|
|
|
if (!funABI.inputs) { |
|
|
|
if (!funABI.inputs) { |
|
|
|
return '' |
|
|
|
return '' |
|
|
|
} |
|
|
|
} |
|
|
@ -211,7 +211,7 @@ function execute (pipeline, env, callback) { |
|
|
|
next(null, env) |
|
|
|
next(null, env) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UniversalDAppModel.prototype.runTx = function (args, cb) { |
|
|
|
UniversalDApp.prototype.runTx = function (args, cb) { |
|
|
|
var self = this |
|
|
|
var self = this |
|
|
|
var tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: args.from, value: args.value } |
|
|
|
var tx = { to: args.to, data: args.data.dataHex, useCall: args.useCall, from: args.from, value: args.value } |
|
|
|
var payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName } // contains decoded parameters
|
|
|
|
var payLoad = { funAbi: args.data.funAbi, funArgs: args.data.funArgs, contractBytecode: args.data.contractBytecode, contractName: args.data.contractName } // contains decoded parameters
|
|
|
@ -296,4 +296,4 @@ function runTransaction (env, next) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = UniversalDAppModel |
|
|
|
module.exports = UniversalDApp |
|
|
|