From ca831ee69b8425ba980e3a439409ec3c98f6f29b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 6 Feb 2018 09:03:49 -0500 Subject: [PATCH] initial logical separation between the UI and the logic of the universal-dapp --- src/universal-dapp.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 9e14263018..2e63574e27 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -16,7 +16,7 @@ var modalCustom = require('./app/ui/modal-dialog-custom') /* trigger debugRequested */ -function UniversalDApp (opts = {}) { +function UniversalDAppModel (opts = {}) { this.event = new EventManager() var self = this @@ -29,7 +29,7 @@ function UniversalDApp (opts = {}) { self.txRunner = new TxRunner({}, opts.api) } -UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) { +UniversalDAppModel.prototype.reset = function (contracts, transactionContextAPI) { this.contracts = contracts if (transactionContextAPI) { this.transactionContextAPI = transactionContextAPI @@ -46,7 +46,7 @@ UniversalDApp.prototype.reset = function (contracts, transactionContextAPI) { this.txRunner = new TxRunner(this.accounts, this._api) } -UniversalDApp.prototype.newAccount = function (password, cb) { +UniversalDAppModel.prototype.newAccount = function (password, cb) { if (!executionContext.isVM()) { if (!this._api.personalMode()) { return cb('Not running in personal mode') @@ -68,7 +68,7 @@ UniversalDApp.prototype.newAccount = function (password, cb) { } } -UniversalDApp.prototype._addAccount = function (privateKey, balance) { +UniversalDAppModel.prototype._addAccount = function (privateKey, balance) { var self = this if (!executionContext.isVM()) { @@ -85,7 +85,7 @@ UniversalDApp.prototype._addAccount = function (privateKey, balance) { } } -UniversalDApp.prototype.getAccounts = function (cb) { +UniversalDAppModel.prototype.getAccounts = function (cb) { var self = this if (!executionContext.isVM()) { @@ -105,7 +105,7 @@ UniversalDApp.prototype.getAccounts = function (cb) { } } -UniversalDApp.prototype.getBalance = function (address, cb) { +UniversalDAppModel.prototype.getBalance = function (address, cb) { var self = this address = ethJSUtil.stripHexPrefix(address) @@ -211,7 +211,7 @@ function execute (pipeline, env, callback) { next(null, env) } -UniversalDApp.prototype.runTx = function (args, cb) { +UniversalDAppModel.prototype.runTx = function (args, cb) { var self = this 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 @@ -296,4 +296,4 @@ function runTransaction (env, next) { }) } -module.exports = UniversalDApp +module.exports = UniversalDAppModel