aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/web3_wrapper.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-01-29 00:45:20 +0800
committerFabio Berger <me@fabioberger.com>2018-01-29 00:45:20 +0800
commit005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1 (patch)
tree63aebaf67a71d8587e19a684c394c0ea91b48116 /packages/website/ts/web3_wrapper.ts
parent6206ebc994a2cf76b90ac426218d6ed18b74a072 (diff)
downloaddexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.gz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.bz2
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.lz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.xz
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.tar.zst
dexon-sol-tools-005a02efeb5ac874e1c1a4dd6679bfa3cc21b1b1.zip
Fix bug where could not switch to Ledger and back
Diffstat (limited to 'packages/website/ts/web3_wrapper.ts')
-rw-r--r--packages/website/ts/web3_wrapper.ts13
1 files changed, 5 insertions, 8 deletions
diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts
index 415df6e8b..e19b0ea06 100644
--- a/packages/website/ts/web3_wrapper.ts
+++ b/packages/website/ts/web3_wrapper.ts
@@ -24,9 +24,6 @@ export class Web3Wrapper {
this._web3 = new Web3();
this._web3.setProvider(provider);
-
- // tslint:disable-next-line:no-floating-promises
- this._startEmittingNetworkConnectionAndUserBalanceStateAsync();
}
public isAddress(address: string) {
return this._web3.isAddress(address);
@@ -90,11 +87,7 @@ export class Web3Wrapper {
public updatePrevUserAddress(userAddress: string) {
this._prevUserAddress = userAddress;
}
- private async _getNetworkAsync() {
- const networkId = await promisify(this._web3.version.getNetwork)();
- return networkId;
- }
- private async _startEmittingNetworkConnectionAndUserBalanceStateAsync() {
+ public async startEmittingNetworkConnectionAndUserBalanceStateAsync() {
if (!_.isUndefined(this._watchNetworkAndBalanceIntervalId)) {
return; // we are already emitting the state
}
@@ -145,6 +138,10 @@ export class Web3Wrapper {
},
);
}
+ private async _getNetworkAsync() {
+ const networkId = await promisify(this._web3.version.getNetwork)();
+ return networkId;
+ }
private async _updateUserEtherBalanceAsync(userAddress: string) {
const balance = await this.getBalanceInEthAsync(userAddress);
if (!balance.eq(this._prevUserEtherBalanceInEth)) {