@riocrypto/common 1.0.500 → 1.0.502

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.
@@ -42,6 +42,7 @@ declare class CCXTClient {
42
42
  crypto: Crypto;
43
43
  fiat: Fiat;
44
44
  }>;
45
+ getDepositAddress(crypto: Crypto): Promise<string>;
45
46
  }
46
47
  export declare const ccxtWrapper: CCXTClient;
47
48
  export {};
@@ -184,6 +184,17 @@ class CCXTClient {
184
184
  }
185
185
  });
186
186
  }
187
+ getDepositAddress(crypto) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ const exchange = yield this.getOptimalExchange(crypto);
190
+ if (!exchange)
191
+ throw new Error("Unable to get optimal exchange");
192
+ let depositAddress = yield exchange.fetchDepositAddress(crypto);
193
+ if (!depositAddress)
194
+ throw new Error("Unable to get deposit address");
195
+ return depositAddress.address;
196
+ });
197
+ }
187
198
  }
188
199
  exports.ccxtWrapper = new CCXTClient([rio_env_1.RioEnv.Production, rio_env_1.RioEnv.Staging].includes(process.env.RIO_ENV)
189
200
  ? "production"
@@ -1,4 +1,4 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { BusinessUser } from "../types/business-user";
3
3
  import { User } from "../types/user";
4
- export declare const getUserFromClientHelper: (client: AxiosInstance) => Promise<User | BusinessUser | null>;
4
+ export declare const getUserFromClientHelper: (client: AxiosInstance, includeDeleted?: boolean) => Promise<User | BusinessUser | null | undefined>;
@@ -11,7 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getUserFromClientHelper = void 0;
13
13
  const rio_client_1 = require("../clients/rio-client");
14
- const getUserFromClientHelper = (client) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const user_attribute_1 = require("../types/user-attribute");
15
+ const getUserFromClientHelper = (client, includeDeleted) => __awaiter(void 0, void 0, void 0, function* () {
16
+ var _a;
15
17
  let individualUser;
16
18
  let businessUser;
17
19
  try {
@@ -27,6 +29,13 @@ const getUserFromClientHelper = (client) => __awaiter(void 0, void 0, void 0, fu
27
29
  businessUser = null;
28
30
  }
29
31
  const user = individualUser || businessUser;
30
- return user;
32
+ if (includeDeleted) {
33
+ return user;
34
+ }
35
+ else {
36
+ if ((_a = user === null || user === void 0 ? void 0 : user.attributes) === null || _a === void 0 ? void 0 : _a.includes(user_attribute_1.UserAttribute.deleted)) {
37
+ return null;
38
+ }
39
+ }
31
40
  });
32
41
  exports.getUserFromClientHelper = getUserFromClientHelper;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.500",
3
+ "version": "1.0.502",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",