@riocrypto/common-server 1.0.1324 → 1.0.1326
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.
|
@@ -79,6 +79,7 @@ declare class BitsoClient {
|
|
|
79
79
|
sequence: string;
|
|
80
80
|
}>;
|
|
81
81
|
getMakerFee(crypto: Crypto): Promise<number>;
|
|
82
|
+
getMXNBalance(): Promise<number>;
|
|
82
83
|
signRequest(requestConfig: AxiosRequestConfig): AxiosRequestConfig;
|
|
83
84
|
}
|
|
84
85
|
export declare const buildBitsoClient: () => Promise<BitsoClient>;
|
|
@@ -268,6 +268,25 @@ class BitsoClient {
|
|
|
268
268
|
return Number(book.maker_fee_decimal || 0);
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
+
getMXNBalance() {
|
|
272
|
+
var _a, _b;
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
const requestConfig = {
|
|
275
|
+
method: "GET",
|
|
276
|
+
url: `${this.baseUrl}/v3/balance?currency=mxn`,
|
|
277
|
+
headers: {
|
|
278
|
+
"Content-Type": "application/json",
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
const signedRequestConfig = this.signRequest(requestConfig);
|
|
282
|
+
const res = yield (0, axios_1.default)(signedRequestConfig);
|
|
283
|
+
const data = res.data;
|
|
284
|
+
if (!data.success) {
|
|
285
|
+
throw new Error("Error getting Bitso fees");
|
|
286
|
+
}
|
|
287
|
+
return Number(((_b = (_a = data.payload) === null || _a === void 0 ? void 0 : _a.balances[0]) === null || _b === void 0 ? void 0 : _b.available) || 0);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
271
290
|
signRequest(requestConfig) {
|
|
272
291
|
var _a;
|
|
273
292
|
const url = new URL(requestConfig.url || "");
|