aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-18 22:43:25 +0800
committerFabio Berger <me@fabioberger.com>2018-07-18 22:43:25 +0800
commit29d5034260b2e3b4b670d856463ed34377bff3ac (patch)
tree358b3cce6e4b2c4ea4f4c816668635e2aff758f0 /packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
parentf99232095b3effea261b5b24bc01db4f96c416f6 (diff)
parent00d1622b3f087943e750f1b3f6ee6ceab7e80285 (diff)
downloaddexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar.gz
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar.bz2
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar.lz
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar.xz
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.tar.zst
dexon-sol-tools-29d5034260b2e3b4b670d856463ed34377bff3ac.zip
merge v2-prototype
Diffstat (limited to 'packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts')
-rw-r--r--packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
index 6d5a02adf..5a2c1d7ff 100644
--- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
+++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
@@ -1,8 +1,10 @@
+import { AssetProxyId } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { AbstractBalanceAndProxyAllowanceFetcher } from '../abstract/abstract_balance_and_proxy_allowance_fetcher';
import { AbstractBalanceAndProxyAllowanceLazyStore } from '../abstract/abstract_balance_and_proxy_allowance_lazy_store';
+import { assetDataUtils } from '../asset_data_utils';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
@@ -74,6 +76,20 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx
}
}
}
+ public deleteAllERC721ProxyAllowance(tokenAddress: string, userAddress: string): void {
+ for (const assetData in this._proxyAllowance) {
+ if (this._proxyAllowance.hasOwnProperty(assetData)) {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ if (
+ decodedAssetData.assetProxyId === AssetProxyId.ERC721 &&
+ decodedAssetData.tokenAddress === tokenAddress &&
+ !_.isUndefined(this._proxyAllowance[assetData][userAddress])
+ ) {
+ delete this._proxyAllowance[assetData][userAddress];
+ }
+ }
+ }
+ }
public deleteAll(): void {
this._balance = {};
this._proxyAllowance = {};