@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(`
|
|
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(`
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
}
|