@riocrypto/common-server 1.0.1608 → 1.0.1610
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;
|
|
305
304
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
305
|
const requestConfig = {
|
|
307
306
|
method: "GET",
|
|
@@ -313,12 +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
315
|
if (!data.success) {
|
|
319
316
|
throw new Error("Error getting Bitso fees");
|
|
320
317
|
}
|
|
321
|
-
|
|
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);
|
|
322
327
|
});
|
|
323
328
|
}
|
|
324
329
|
signRequest(requestConfig) {
|