aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/order-utils/src')
-rw-r--r--packages/order-utils/src/index.ts1
-rw-r--r--packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts16
2 files changed, 17 insertions, 0 deletions
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index b4a7a6b67..2322409a4 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -17,6 +17,7 @@ export { OrderError, MessagePrefixType, MessagePrefixOpts, EIP712Parameter, EIP7
export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
export { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher';
export { BalanceAndProxyAllowanceLazyStore } from './store/balance_and_proxy_allowance_lazy_store';
+export { OrderFilledCancelledLazyStore } from './store/order_filled_cancelled_lazy_store';
export { RemainingFillableCalculator } from './remaining_fillable_calculator';
export { OrderStateUtils } from './order_state_utils';
export { assetProxyUtils } from './asset_proxy_utils';
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 e7352119d..8235725ed 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 { assetProxyUtils } from '../asset_proxy_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 = assetProxyUtils.decodeAssetData(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 = {};