aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-11 01:22:19 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 09:03:18 +0800
commit75b390cf93e0903b1859f02a3f3508bc16a4565a (patch)
tree517abd15931f2f46d17ebcc883de9e12a6813b26
parentdcda8fe538a6db82bed4f036ef63bad5882e681a (diff)
downloaddexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar.gz
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar.bz2
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar.lz
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar.xz
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.tar.zst
dexon-sol-tools-75b390cf93e0903b1859f02a3f3508bc16a4565a.zip
Add functions to clear stores cache
-rw-r--r--src/stores/balance_proxy_allowance_lazy_store.ts10
-rw-r--r--src/stores/order_filled_cancelled_lazy_store.ts6
2 files changed, 16 insertions, 0 deletions
diff --git a/src/stores/balance_proxy_allowance_lazy_store.ts b/src/stores/balance_proxy_allowance_lazy_store.ts
index 2580fd449..92a6aaa51 100644
--- a/src/stores/balance_proxy_allowance_lazy_store.ts
+++ b/src/stores/balance_proxy_allowance_lazy_store.ts
@@ -42,6 +42,11 @@ export class BalanceAndProxyAllowanceLazyStore {
}
this.balance[tokenAddress][userAddress] = balance;
}
+ public deleteBalance(tokenAddress: string, userAddress: string): void {
+ if (!_.isUndefined(this.balance[tokenAddress])) {
+ delete this.balance[tokenAddress][userAddress];
+ }
+ }
public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> {
if (_.isUndefined(this.proxyAllowance[tokenAddress]) ||
_.isUndefined(this.proxyAllowance[tokenAddress][userAddress])) {
@@ -60,4 +65,9 @@ export class BalanceAndProxyAllowanceLazyStore {
}
this.proxyAllowance[tokenAddress][userAddress] = proxyAllowance;
}
+ public deleteProxyAllowance(tokenAddress: string, userAddress: string): void {
+ if (!_.isUndefined(this.proxyAllowance[tokenAddress])) {
+ delete this.proxyAllowance[tokenAddress][userAddress];
+ }
+ }
}
diff --git a/src/stores/order_filled_cancelled_lazy_store.ts b/src/stores/order_filled_cancelled_lazy_store.ts
index beb8fe6d7..cb4c786f3 100644
--- a/src/stores/order_filled_cancelled_lazy_store.ts
+++ b/src/stores/order_filled_cancelled_lazy_store.ts
@@ -35,6 +35,9 @@ export class OrderFilledCancelledLazyStore {
public setFilledTakerAmount(orderHash: string, filledTakerAmount: BigNumber): void {
this.filledTakerAmount[orderHash] = filledTakerAmount;
}
+ public deleteFilledTakerAmount(orderHash: string): void {
+ delete this.filledTakerAmount[orderHash];
+ }
public async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
if (_.isUndefined(this.cancelledTakerAmount[orderHash])) {
const methodOpts = {
@@ -49,4 +52,7 @@ export class OrderFilledCancelledLazyStore {
public setCancelledTakerAmount(orderHash: string, cancelledTakerAmount: BigNumber): void {
this.cancelledTakerAmount[orderHash] = cancelledTakerAmount;
}
+ public deleteCancelledTakerAmount(orderHash: string): void {
+ delete this.cancelledTakerAmount[orderHash];
+ }
}