@riocrypto/common 1.0.451 → 1.0.453
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.
- package/build/clients/gueno-client.d.ts +10 -0
- package/build/clients/gueno-client.js +44 -0
- package/build/clients/slack-client.d.ts +3 -1
- package/build/clients/slack-client.js +2 -2
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/build/models/checked-address.d.ts +17 -0
- package/build/models/checked-address.js +36 -0
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -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.
|
|
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.
|
|
34
|
+
exports.slackClient = new SlackClient(process.env.SLACK_WEBHOOK_URL);
|
package/build/index.d.ts
CHANGED
|
@@ -158,9 +158,11 @@ export * from "./models/user";
|
|
|
158
158
|
export * from "./models/ccxt-order";
|
|
159
159
|
export * from "./models/kushki-payment";
|
|
160
160
|
export * from "./models/kyc";
|
|
161
|
+
export * from "./models/checked-address";
|
|
161
162
|
export * from "./clients/bitstamp-client";
|
|
162
163
|
export * from "./clients/ccxt-client";
|
|
163
164
|
export * from "./clients/fixer-client";
|
|
164
165
|
export * from "./clients/kushki-client";
|
|
165
166
|
export * from "./clients/slack-client";
|
|
167
|
+
export * from "./clients/gueno-client";
|
|
166
168
|
export * from "./helpers/get-user-helper";
|
package/build/index.js
CHANGED
|
@@ -175,9 +175,11 @@ __exportStar(require("./models/user"), exports);
|
|
|
175
175
|
__exportStar(require("./models/ccxt-order"), exports);
|
|
176
176
|
__exportStar(require("./models/kushki-payment"), exports);
|
|
177
177
|
__exportStar(require("./models/kyc"), exports);
|
|
178
|
+
__exportStar(require("./models/checked-address"), exports);
|
|
178
179
|
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
179
180
|
__exportStar(require("./clients/ccxt-client"), exports);
|
|
180
181
|
__exportStar(require("./clients/fixer-client"), exports);
|
|
181
182
|
__exportStar(require("./clients/kushki-client"), exports);
|
|
182
183
|
__exportStar(require("./clients/slack-client"), exports);
|
|
184
|
+
__exportStar(require("./clients/gueno-client"), exports);
|
|
183
185
|
__exportStar(require("./helpers/get-user-helper"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
import { AddressCheckResult } from "../types/address-check-result";
|
|
3
|
+
interface CheckedAddressAttrs {
|
|
4
|
+
address: string;
|
|
5
|
+
result: AddressCheckResult;
|
|
6
|
+
lastChecked: Date;
|
|
7
|
+
}
|
|
8
|
+
interface CheckedAddressDoc extends mongoose.Document {
|
|
9
|
+
address: string;
|
|
10
|
+
result: AddressCheckResult;
|
|
11
|
+
lastChecked: Date;
|
|
12
|
+
}
|
|
13
|
+
interface CheckedAddressModel extends mongoose.Model<CheckedAddressDoc> {
|
|
14
|
+
build(attrs: CheckedAddressAttrs): CheckedAddressDoc;
|
|
15
|
+
}
|
|
16
|
+
declare const buildCheckedAddress: (mongoose: typeof mongoose) => CheckedAddressModel | undefined;
|
|
17
|
+
export { buildCheckedAddress, CheckedAddressDoc };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildCheckedAddress = void 0;
|
|
4
|
+
const buildCheckedAddress = (mongoose) => {
|
|
5
|
+
// if model is already defined, return it
|
|
6
|
+
if (mongoose.models.CheckedAddress) {
|
|
7
|
+
return mongoose.model("CheckedAddress");
|
|
8
|
+
}
|
|
9
|
+
const CheckedAddressSchema = new mongoose.Schema({
|
|
10
|
+
address: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
result: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
lastChecked: {
|
|
19
|
+
type: mongoose.Schema.Types.Date,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
toJSON: {
|
|
24
|
+
transform(doc, ret) {
|
|
25
|
+
ret.id = ret._id;
|
|
26
|
+
delete ret._id;
|
|
27
|
+
delete ret.__v;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
CheckedAddressSchema.statics.build = (attrs) => {
|
|
32
|
+
return new CheckedAddress(attrs);
|
|
33
|
+
};
|
|
34
|
+
const CheckedAddress = mongoose.model("CheckedAddress", CheckedAddressSchema);
|
|
35
|
+
};
|
|
36
|
+
exports.buildCheckedAddress = buildCheckedAddress;
|