@riocrypto/common-server 1.0.1609 → 1.0.1611
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.
|
@@ -301,7 +301,6 @@ class BitsoClient {
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
getMXNBalance() {
|
|
304
|
-
var _a, _b, _c, _d, _e;
|
|
305
304
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
305
|
const requestConfig = {
|
|
307
306
|
method: "GET",
|
|
@@ -313,15 +312,18 @@ class BitsoClient {
|
|
|
313
312
|
const signedRequestConfig = this.signRequest(requestConfig);
|
|
314
313
|
const res = yield (0, axios_1.default)(signedRequestConfig);
|
|
315
314
|
const data = res.data;
|
|
316
|
-
console.log("Bitso data");
|
|
317
|
-
console.log(data);
|
|
318
|
-
console.log((_a = data.payload) === null || _a === void 0 ? void 0 : _a.balances);
|
|
319
|
-
console.log((_b = data.payload) === null || _b === void 0 ? void 0 : _b.balances[0]);
|
|
320
|
-
console.log((_c = data.payload) === null || _c === void 0 ? void 0 : _c.balances[1]);
|
|
321
315
|
if (!data.success) {
|
|
322
316
|
throw new Error("Error getting Bitso fees");
|
|
323
317
|
}
|
|
324
|
-
|
|
318
|
+
const balances = data.payload.balances;
|
|
319
|
+
if (!balances) {
|
|
320
|
+
throw new Error("Unable to get balances");
|
|
321
|
+
}
|
|
322
|
+
const mxn = balances.find((obj) => obj.currency === "mxn");
|
|
323
|
+
if (!mxn) {
|
|
324
|
+
throw new Error("Unable to get MXN balance");
|
|
325
|
+
}
|
|
326
|
+
return Number(mxn.available || 0);
|
|
325
327
|
});
|
|
326
328
|
}
|
|
327
329
|
signRequest(requestConfig) {
|
|
@@ -11,6 +11,7 @@ declare class FireblocksClient {
|
|
|
11
11
|
getTotalVaultUSDBalance(vaultId: string): Promise<number>;
|
|
12
12
|
getTotalExchangesUSDBalance(): Promise<number>;
|
|
13
13
|
getExchangeCryptoBalance(crypto: Crypto): Promise<number>;
|
|
14
|
+
getSingularExchangeCryptoBalance(id: string, crypto: Crypto): Promise<number>;
|
|
14
15
|
getExchangeFiatBalance(): Promise<number>;
|
|
15
16
|
getTransactions(vaultId: string, crypto: Crypto, nextPage?: string): Promise<any>;
|
|
16
17
|
getDepositAddress(vaultId: string, crypto: Crypto): Promise<string>;
|
|
@@ -184,6 +184,22 @@ class FireblocksClient {
|
|
|
184
184
|
return balance;
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
+
getSingularExchangeCryptoBalance(id, crypto) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
let exchanges = yield this.fireblocks.getExchangeAccounts();
|
|
190
|
+
let balance = 0;
|
|
191
|
+
exchanges.forEach((exchange) => {
|
|
192
|
+
if (exchange.id === id) {
|
|
193
|
+
exchange.assets.forEach((asset) => {
|
|
194
|
+
if (asset.id === crypto) {
|
|
195
|
+
balance += Number(asset.available);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
return balance;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
187
203
|
getExchangeFiatBalance() {
|
|
188
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
205
|
let exchanges = yield this.fireblocks.getExchangeAccounts();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1611",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1451",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.6.0",
|
|
34
34
|
"ccxt": "^3.0.30",
|