aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/local_storage/trade_history_storage.tsx
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-11-23 04:21:07 +0800
committerFabio Berger <me@fabioberger.com>2017-11-23 04:21:07 +0800
commitf5e0fd8de5a3201ac17a8dde68aec3314674f1c4 (patch)
tree8001915cd933e1d5eaff1388e7dc842d602aa786 /packages/website/ts/local_storage/trade_history_storage.tsx
parent353b6f3d6df1e13ba76f86287195f7c0ce7cecc7 (diff)
downloaddexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.gz
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.bz2
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.lz
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.xz
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.tar.zst
dexon-sol-tools-f5e0fd8de5a3201ac17a8dde68aec3314674f1c4.zip
Upgrade to latest 0x.js version and refactor subscriptions to use latest interface
Diffstat (limited to 'packages/website/ts/local_storage/trade_history_storage.tsx')
-rw-r--r--packages/website/ts/local_storage/trade_history_storage.tsx14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx
index 415b380b7..dd5872609 100644
--- a/packages/website/ts/local_storage/trade_history_storage.tsx
+++ b/packages/website/ts/local_storage/trade_history_storage.tsx
@@ -31,13 +31,25 @@ export const tradeHistoryStorage = {
const fillHash = this._getFillHash(fill);
const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
if (doesFillExist) {
- return;
+ return; // noop
}
fillsByHash[fillHash] = fill;
const userFillsJSONString = JSON.stringify(fillsByHash);
const userFillsKey = this._getUserFillsKey(userAddress, networkId);
localStorage.setItem(userFillsKey, userFillsJSONString);
},
+ removeFillFromUser(userAddress: string, networkId: number, fill: Fill) {
+ const fillsByHash = this.getUserFillsByHash(userAddress, networkId);
+ const fillHash = this._getFillHash(fill);
+ const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
+ if (!doesFillExist) {
+ return; // noop
+ }
+ delete fillsByHash[fillHash];
+ const userFillsJSONString = JSON.stringify(fillsByHash);
+ const userFillsKey = this._getUserFillsKey(userAddress, networkId);
+ localStorage.setItem(userFillsKey, userFillsJSONString);
+ },
getUserFillsByHash(userAddress: string, networkId: number): {[fillHash: string]: Fill} {
const userFillsKey = this._getUserFillsKey(userAddress, networkId);
const userFillsJSONString = localStorage.getItemIfExists(userFillsKey);