@riocrypto/common-server 1.0.1936 → 1.0.1937
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.
|
@@ -81,6 +81,8 @@ declare class BitsoClient {
|
|
|
81
81
|
}>;
|
|
82
82
|
getMakerFee(crypto: Crypto): Promise<number>;
|
|
83
83
|
getMXNBalance(): Promise<number>;
|
|
84
|
+
getUSDTBalance(): Promise<number>;
|
|
85
|
+
getUSDCBalance(): Promise<number>;
|
|
84
86
|
createCryptoWithdrawal(amount: number, crypto: Crypto, address: string): Promise<Object>;
|
|
85
87
|
signRequest(requestConfig: AxiosRequestConfig): AxiosRequestConfig;
|
|
86
88
|
}
|
|
@@ -325,6 +325,58 @@ class BitsoClient {
|
|
|
325
325
|
return Number(mxn.available || 0);
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
+
getUSDTBalance() {
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
const requestConfig = {
|
|
331
|
+
method: "GET",
|
|
332
|
+
url: `${this.baseUrl}/v3/balance?currency=usdt`,
|
|
333
|
+
headers: {
|
|
334
|
+
"Content-Type": "application/json",
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
const signedRequestConfig = this.signRequest(requestConfig);
|
|
338
|
+
const res = yield (0, axios_with_logging_1.default)(signedRequestConfig);
|
|
339
|
+
const data = res.data;
|
|
340
|
+
if (!data.success) {
|
|
341
|
+
throw new Error("Error getting Bitso fees");
|
|
342
|
+
}
|
|
343
|
+
const balances = data.payload.balances;
|
|
344
|
+
if (!balances) {
|
|
345
|
+
throw new Error("Unable to get balances");
|
|
346
|
+
}
|
|
347
|
+
const usdt = balances.find((obj) => obj.currency === "usdt");
|
|
348
|
+
if (!usdt) {
|
|
349
|
+
throw new Error("Unable to get USDT balance");
|
|
350
|
+
}
|
|
351
|
+
return Number(usdt.available || 0);
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
getUSDCBalance() {
|
|
355
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
356
|
+
const requestConfig = {
|
|
357
|
+
method: "GET",
|
|
358
|
+
url: `${this.baseUrl}/v3/balance?currency=usdc`,
|
|
359
|
+
headers: {
|
|
360
|
+
"Content-Type": "application/json",
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
const signedRequestConfig = this.signRequest(requestConfig);
|
|
364
|
+
const res = yield (0, axios_with_logging_1.default)(signedRequestConfig);
|
|
365
|
+
const data = res.data;
|
|
366
|
+
if (!data.success) {
|
|
367
|
+
throw new Error("Error getting Bitso fees");
|
|
368
|
+
}
|
|
369
|
+
const balances = data.payload.balances;
|
|
370
|
+
if (!balances) {
|
|
371
|
+
throw new Error("Unable to get balances");
|
|
372
|
+
}
|
|
373
|
+
const usdc = balances.find((obj) => obj.currency === "usdc");
|
|
374
|
+
if (!usdc) {
|
|
375
|
+
throw new Error("Unable to get USDC balance");
|
|
376
|
+
}
|
|
377
|
+
return Number(usdc.available || 0);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
328
380
|
createCryptoWithdrawal(amount, crypto, address) {
|
|
329
381
|
return __awaiter(this, void 0, void 0, function* () {
|
|
330
382
|
if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local].includes(process.env.RIO_ENV)) {
|