@riocrypto/common-server 1.0.1937 → 1.0.1939

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,8 +81,11 @@ 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
+ getBalances(): Promise<{
85
+ mxn: number;
86
+ usdt: number;
87
+ usdc: number;
88
+ }>;
86
89
  createCryptoWithdrawal(amount: number, crypto: Crypto, address: string): Promise<Object>;
87
90
  signRequest(requestConfig: AxiosRequestConfig): AxiosRequestConfig;
88
91
  }
@@ -325,11 +325,11 @@ class BitsoClient {
325
325
  return Number(mxn.available || 0);
326
326
  });
327
327
  }
328
- getUSDTBalance() {
328
+ getBalances() {
329
329
  return __awaiter(this, void 0, void 0, function* () {
330
330
  const requestConfig = {
331
331
  method: "GET",
332
- url: `${this.baseUrl}/v3/balance?currency=usdt`,
332
+ url: `${this.baseUrl}/v3/balance`,
333
333
  headers: {
334
334
  "Content-Type": "application/json",
335
335
  },
@@ -348,33 +348,19 @@ class BitsoClient {
348
348
  if (!usdt) {
349
349
  throw new Error("Unable to get USDT balance");
350
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
351
  const usdc = balances.find((obj) => obj.currency === "usdc");
374
352
  if (!usdc) {
375
353
  throw new Error("Unable to get USDC balance");
376
354
  }
377
- return Number(usdc.available || 0);
355
+ const mxn = balances.find((obj) => obj.currency === "mxn");
356
+ if (!mxn) {
357
+ throw new Error("Unable to get MXN balance");
358
+ }
359
+ return {
360
+ mxn: Number(mxn.available || 0),
361
+ usdt: Number(usdt.available || 0),
362
+ usdc: Number(usdc.available || 0),
363
+ };
378
364
  });
379
365
  }
380
366
  createCryptoWithdrawal(amount, crypto, address) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1937",
3
+ "version": "1.0.1939",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",