aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:42:27 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-07-13 23:42:27 +0800
commitfcfa43b6f1349442141ceb4a42bf673cee1cb030 (patch)
tree51f9699853a258a7a6b41591c8087bd6839db261 /packages
parent56b4c556540a71dbe4081c101df5d3bae5237365 (diff)
downloaddexon-sol-tools-fcfa43b6f1349442141ceb4a42bf673cee1cb030.tar.gz
dexon-sol-tools-fcfa43b6f1349442141ceb4a42bf673cee1cb030.tar.zst
dexon-sol-tools-fcfa43b6f1349442141ceb4a42bf673cee1cb030.zip
Export newly created store from order-utils
Diffstat (limited to 'packages')
-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 = {};