@ex-master/core
Advanced tools
Comparing version 0.3.27 to 0.3.28
@@ -116,17 +116,17 @@ "use strict"; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (this.isPrivateness) { | ||
let balances = yield this.getBalances(); | ||
this.balanceMap.clear(); | ||
for (let balance of balances) { | ||
this.balanceMap.set(balance.currency, balance); | ||
} | ||
this.subscription.add(this.balanceUpdate$.subscribe(({ currency, available, frozen }) => { | ||
let balance = this.getBalance(currency); | ||
balance.available = available || balance.available; | ||
balance.frozen = frozen || balance.frozen; | ||
return balance; | ||
})); | ||
} | ||
return new Promise(resolve => process.nextTick(resolve)).then(() => tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
yield this.updateMarkets(); | ||
if (this.isPrivateness) { | ||
let balances = yield this.getBalances(); | ||
this.balanceMap.clear(); | ||
for (let balance of balances) { | ||
this.balanceMap.set(balance.currency, balance); | ||
} | ||
this.subscription.add(this.balanceUpdate$.subscribe(({ currency, available, frozen }) => { | ||
let balance = this.getBalance(currency); | ||
balance.available = available || balance.available; | ||
balance.frozen = frozen || balance.frozen; | ||
return balance; | ||
})); | ||
} | ||
yield this.onInitialize(); | ||
@@ -133,0 +133,0 @@ })); |
{ | ||
"name": "@ex-master/core", | ||
"version": "0.3.27", | ||
"version": "0.3.28", | ||
"main": "bld/library/index.js", | ||
@@ -27,3 +27,3 @@ "types": "bld/library/index.d.ts", | ||
}, | ||
"gitHead": "f2dd1c713b0883604c73e93db59a5cf08ecd58f5" | ||
"gitHead": "c091d3fb102f91c9ff8b45d5a475a14b12b0f1d4" | ||
} |
@@ -296,25 +296,26 @@ import {EventEmitter} from 'events'; | ||
private async initialize(): Promise<void> { | ||
if (this.isPrivateness) { | ||
let balances = await this.getBalances(); | ||
return new Promise(resolve => process.nextTick(resolve)).then(async () => { | ||
await this.updateMarkets(); | ||
this.balanceMap.clear(); | ||
if (this.isPrivateness) { | ||
let balances = await this.getBalances(); | ||
for (let balance of balances) { | ||
this.balanceMap.set(balance.currency, balance); | ||
} | ||
this.balanceMap.clear(); | ||
this.subscription.add( | ||
this.balanceUpdate$.subscribe(({currency, available, frozen}) => { | ||
let balance = this.getBalance(currency); | ||
for (let balance of balances) { | ||
this.balanceMap.set(balance.currency, balance); | ||
} | ||
balance.available = available || balance.available; | ||
balance.frozen = frozen || balance.frozen; | ||
this.subscription.add( | ||
this.balanceUpdate$.subscribe(({currency, available, frozen}) => { | ||
let balance = this.getBalance(currency); | ||
return balance; | ||
}), | ||
); | ||
} | ||
balance.available = available || balance.available; | ||
balance.frozen = frozen || balance.frozen; | ||
return new Promise(resolve => process.nextTick(resolve)).then(async () => { | ||
await this.updateMarkets(); | ||
return balance; | ||
}), | ||
); | ||
} | ||
await this.onInitialize(); | ||
@@ -321,0 +322,0 @@ }); |
Sorry, the diff of this file is not supported yet
65962