@riocrypto/common-server 1.0.1301 → 1.0.1302

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,7 +96,7 @@ class FireblocksClient {
96
96
  getTotalVaultUSDBalance(vaultId) {
97
97
  return __awaiter(this, void 0, void 0, function* () {
98
98
  let balance = 0;
99
- const cachedResponse = cache.get(`this.fireblocks.getVaultAccountById(${vaultId})`);
99
+ const cachedResponse = cache.get(`getTotalVaultUSDBalance(${vaultId})`);
100
100
  if (cachedResponse) {
101
101
  balance = cachedResponse;
102
102
  }
@@ -117,33 +117,39 @@ class FireblocksClient {
117
117
  }
118
118
  }
119
119
  }
120
- cache.set(`this.fireblocks.getVaultAccountById(${vaultId})`, balance);
120
+ cache.set(`getTotalVaultUSDBalance(${vaultId})`, balance);
121
121
  }
122
- console.log("Balance is ", balance);
123
122
  return balance;
124
123
  });
125
124
  }
126
125
  getTotalExchangesUSDBalance() {
127
126
  return __awaiter(this, void 0, void 0, function* () {
128
- let exchanges = yield this.fireblocks.getExchangeAccounts();
129
127
  let balance = 0;
130
- exchanges.forEach((exchange) => {
131
- exchange.assets.forEach((asset) => {
132
- if ([
133
- common_1.Crypto.USDC,
134
- common_1.Crypto.USDCPolygon,
135
- common_1.Crypto.USDCPolygonBridged,
136
- common_1.Crypto.USDCSolana,
137
- common_1.Crypto.USDTEthereum,
138
- "USDT",
139
- "USD",
140
- common_1.Crypto.USDTPolygon,
141
- common_1.Crypto.USDTTron,
142
- ].includes(asset.id)) {
143
- balance += Number(asset.available);
144
- }
128
+ const cachedResponse = cache.get(`getTotalExchangesUSDBalance()`);
129
+ if (cachedResponse) {
130
+ balance = cachedResponse;
131
+ }
132
+ else {
133
+ let exchanges = yield this.fireblocks.getExchangeAccounts();
134
+ exchanges.forEach((exchange) => {
135
+ exchange.assets.forEach((asset) => {
136
+ if ([
137
+ common_1.Crypto.USDC,
138
+ common_1.Crypto.USDCPolygon,
139
+ common_1.Crypto.USDCPolygonBridged,
140
+ common_1.Crypto.USDCSolana,
141
+ common_1.Crypto.USDTEthereum,
142
+ "USDT",
143
+ "USD",
144
+ common_1.Crypto.USDTPolygon,
145
+ common_1.Crypto.USDTTron,
146
+ ].includes(asset.id)) {
147
+ balance += Number(asset.available);
148
+ }
149
+ });
145
150
  });
146
- });
151
+ cache.set(`getTotalExchangesUSDBalance()`, balance);
152
+ }
147
153
  return balance;
148
154
  });
149
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1301",
3
+ "version": "1.0.1302",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",