@riocrypto/common 1.0.451 → 1.0.452

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.
@@ -0,0 +1,10 @@
1
+ declare class GuenoClient {
2
+ private email;
3
+ private password;
4
+ private env;
5
+ constructor(email: string, password: string, env: "sandbox" | "production");
6
+ getAddressRiskScore(address: string, protocol: Crypto): Promise<any>;
7
+ getAccessToken(): Promise<any>;
8
+ }
9
+ export declare const guenoClient: GuenoClient;
10
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.guenoClient = void 0;
16
+ const axios_1 = __importDefault(require("axios"));
17
+ class GuenoClient {
18
+ constructor(email, password, env) {
19
+ this.email = email;
20
+ this.password = password;
21
+ this.env = env;
22
+ }
23
+ getAddressRiskScore(address, protocol) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const accessToken = yield this.getAccessToken();
26
+ const { data } = yield axios_1.default.get(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/amlCrypto/addressRiskScore?address=${address}&protocol=${protocol}`, {
27
+ headers: {
28
+ Authorization: `Bearer ${accessToken}`,
29
+ },
30
+ });
31
+ return data;
32
+ });
33
+ }
34
+ getAccessToken() {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const { data } = yield axios_1.default.post(`https://api-gueno.${this.env === "production" ? "prd" : "stg"}.gueno.com/api/auth/login`, {
37
+ email: this.email,
38
+ password: this.password,
39
+ });
40
+ return data.access_token;
41
+ });
42
+ }
43
+ }
44
+ exports.guenoClient = new GuenoClient(process.env.GUENO_EMAIL, process.env.GUENO_PASSWORD, process.env.GUENO_ENV);
@@ -1,5 +1,7 @@
1
- export declare class SlackClient {
1
+ declare class SlackClient {
2
2
  private webhookUrl;
3
3
  constructor(webhookUrl: string);
4
4
  sendMessage(message: string): Promise<void>;
5
5
  }
6
+ export declare const slackClient: SlackClient;
7
+ export {};
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SlackClient = void 0;
15
+ exports.slackClient = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  class SlackClient {
18
18
  constructor(webhookUrl) {
@@ -31,4 +31,4 @@ class SlackClient {
31
31
  });
32
32
  }
33
33
  }
34
- exports.SlackClient = SlackClient;
34
+ exports.slackClient = new SlackClient(process.env.SLACK_WEBHOOK_URL);
package/build/index.d.ts CHANGED
@@ -163,4 +163,5 @@ export * from "./clients/ccxt-client";
163
163
  export * from "./clients/fixer-client";
164
164
  export * from "./clients/kushki-client";
165
165
  export * from "./clients/slack-client";
166
+ export * from "./clients/gueno-client";
166
167
  export * from "./helpers/get-user-helper";
package/build/index.js CHANGED
@@ -180,4 +180,5 @@ __exportStar(require("./clients/ccxt-client"), exports);
180
180
  __exportStar(require("./clients/fixer-client"), exports);
181
181
  __exportStar(require("./clients/kushki-client"), exports);
182
182
  __exportStar(require("./clients/slack-client"), exports);
183
+ __exportStar(require("./clients/gueno-client"), exports);
183
184
  __exportStar(require("./helpers/get-user-helper"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.451",
3
+ "version": "1.0.452",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",