diff --git a/src/app.js b/src/app.js index 598223283f..5ccb6a3676 100644 --- a/src/app.js +++ b/src/app.js @@ -313,7 +313,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org registry.put({api: self._components.compilersArtefacts, name: 'compilersartefacts'}) // ----------------- UniversalDApp ----------------- - var udapp = new UniversalDApp(registry) + var udapp = new UniversalDApp(registry, registry.get('config').api) registry.put({api: udapp, name: 'udapp'}) udapp.event.register('transactionBroadcasted', (txhash, networkName) => { var txLink = executionContext.txDetailsLink(networkName, txhash) diff --git a/src/config.js b/src/config.js index 6a41ebd133..d5095b919b 100644 --- a/src/config.js +++ b/src/config.js @@ -53,6 +53,8 @@ function Config (storage) { return this.unpersistedItems[key] } + // TODO: this only used for *one* property "doNotShowTransactionConfirmationAgain" + // and can be removed once it's refactored away in txRunner this.setUnpersistedProperty = function (key, value) { this.unpersistedItems[key] = value } diff --git a/src/universal-dapp.js b/src/universal-dapp.js index a9c82b0ef5..56073b0072 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -8,7 +8,7 @@ var txHelper = remixLib.execution.txHelper var EventManager = remixLib.EventManager var executionContext = remixLib.execution.executionContext -function UniversalDApp (globalRegistry) { +function UniversalDApp (globalRegistry, config) { this.event = new EventManager() this._deps = { config: globalRegistry.get('config').api, @@ -42,12 +42,12 @@ UniversalDApp.prototype.resetEnvironment = function () { executionContext.vm().stateManager.cache.flush(function () {}) } this.txRunner = new TxRunner(this.accounts, { - config: this._deps.config, + config: this.config, detectNetwork: (cb) => { executionContext.detectNetwork(cb) }, personalMode: () => { - return this._deps.config.get('settings/personal-mode') + return this.config.get('settings/personal-mode') } }) this.txRunner.event.register('transactionBroadcasted', (txhash) => { @@ -71,7 +71,7 @@ UniversalDApp.prototype.createVMAccount = function (privateKey, balance, cb) { UniversalDApp.prototype.newAccount = function (password, passwordPromptCb, cb) { if (!executionContext.isVM()) { - if (!this._deps.config.get('settings/personal-mode')) { + if (!this.config.get('settings/personal-mode')) { return cb('Not running in personal mode') } passwordPromptCb((passphrase) => { @@ -112,7 +112,7 @@ UniversalDApp.prototype.getAccounts = function (cb) { // Weirdness of web3: listAccounts() is sync, `getListAccounts()` is async // See: https://github.com/ethereum/web3.js/issues/442 if (this._deps.config.get('settings/personal-mode')) { - executionContext.web3().personal.getListAccounts(cb) + return executionContext.web3().personal.getListAccounts(cb) } else { executionContext.web3().eth.getAccounts(cb) }