diff --git a/packages/light-react/src/stores/createAccountStore.js b/packages/light-react/src/stores/createAccountStore.js index 1ea1fd9632db6a376911ecde44bfb481d02aee49..f92f09e7d2cb97a7e89c5d853af1f43dd74abb9b 100644 --- a/packages/light-react/src/stores/createAccountStore.js +++ b/packages/light-react/src/stores/createAccountStore.js @@ -14,10 +14,6 @@ class CreateAccountStore { @observable password = ''; @observable phrase = null; // The 12-word seed phrase - constructor () { - this.api = parityStore.api; - } - /** * Reinitialize everything */ @@ -28,15 +24,17 @@ class CreateAccountStore { } generateNewAccount = () => { - return this.api.parity.generateSecretPhrase().then(this.setPhrase); + return parityStore.api.parity.generateSecretPhrase().then(this.setPhrase); }; saveAccountToParity = () => { - return this.api.parity + return parityStore.api.parity .newAccountFromPhrase(this.phrase, this.password) - .then(() => this.api.parity.setAccountName(this.address, this.name)) .then(() => - this.api.parity.setAccountMeta(this.address, { + parityStore.api.parity.setAccountName(this.address, this.name) + ) + .then(() => + parityStore.api.parity.setAccountMeta(this.address, { timestamp: Date.now() }) ); @@ -69,7 +67,7 @@ class CreateAccountStore { @action setPhrase = phrase => { this.phrase = phrase; - return this.api.parity + return parityStore.api.parity .phraseToAddress(phrase) .then(address => this.setAddress(address)); }; diff --git a/packages/light-react/src/stores/sendStore.js b/packages/light-react/src/stores/sendStore.js index da4d45272c925b3b82bc41da0fd5818256659a0d..187f893a7800a2069009db75d25d7a7ae1c412cd 100644 --- a/packages/light-react/src/stores/sendStore.js +++ b/packages/light-react/src/stores/sendStore.js @@ -24,10 +24,6 @@ class SendStore { tx = {}; // The actual tx we are sending. No need to be observable. @observable txStatus; // Status of the tx, see wiki for details. - constructor () { - this.api = parityStore.api; - } - acceptRequest = password => { // Avoid calling this method from a random place if (!this.requestId) { @@ -40,7 +36,11 @@ class SendStore { // to calculate the number of confirmations this.subscription = blockNumber$().subscribe(this.setBlockNumber); - return this.api.signer.confirmRequest(this.requestId, null, password); + return parityStore.api.signer.confirmRequest( + this.requestId, + null, + password + ); }; /** @@ -103,7 +103,7 @@ class SendStore { * memoize it. */ estimateGasForEth = memoize(txForEth => { - return this.api.eth + return parityStore.api.eth .estimateGas(txForEth) .then(this.setEstimated) .catch(noop); @@ -136,7 +136,7 @@ class SendStore { new Error('The requestId has not been generated yet.') ); } - return this.api.signer.rejectRequest(this.requestId); + return parityStore.api.signer.rejectRequest(this.requestId); }; @computed