@riocrypto/common-server 1.0.2370 → 1.0.2374
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/index.d.ts +0 -3
- package/build/index.js +0 -3
- package/build/models/user.d.ts +2 -15
- package/build/models/user.js +0 -53
- package/package.json +2 -2
- package/build/helpers/get-user-transaction-limits.d.ts +0 -5
- package/build/helpers/get-user-transaction-limits.js +0 -46
- package/build/models/UBO.d.ts +0 -90
- package/build/models/UBO.js +0 -53
- package/build/models/ccxt-order.d.ts +0 -16
- package/build/models/ccxt-order.js +0 -37
package/build/index.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export * from "./models/bank-payout";
|
|
|
23
23
|
export * from "./models/bank-payment";
|
|
24
24
|
export * from "./models/order";
|
|
25
25
|
export * from "./models/user";
|
|
26
|
-
export * from "./models/ccxt-order";
|
|
27
26
|
export * from "./models/kushki-payment";
|
|
28
27
|
export * from "./models/crypto-address";
|
|
29
28
|
export * from "./models/fireblocks-vault";
|
|
@@ -52,7 +51,6 @@ export * from "./models/circle-address-book-recipient";
|
|
|
52
51
|
export * from "./models/circle-payout";
|
|
53
52
|
export * from "./models/market-data";
|
|
54
53
|
export * from "./models/telegram-session";
|
|
55
|
-
export * from "./models/UBO";
|
|
56
54
|
export * from "./models/temporary-verification";
|
|
57
55
|
export * from "./models/bid";
|
|
58
56
|
export * from "./models/rio-bank-account";
|
|
@@ -116,7 +114,6 @@ export * from "./helpers/calculate-aggregate-volume-and-revenue";
|
|
|
116
114
|
export * from "./helpers/calculate-volume-and-revenue";
|
|
117
115
|
export * from "./helpers/get-user";
|
|
118
116
|
export * from "./helpers/unescape";
|
|
119
|
-
export * from "./helpers/get-user-transaction-limits";
|
|
120
117
|
export * from "./helpers/sanitize-user-doc";
|
|
121
118
|
export * from "./helpers/sanitize-bank-account-doc";
|
|
122
119
|
export * from "./helpers/sanitize-crypto-address-doc";
|
package/build/index.js
CHANGED
|
@@ -39,7 +39,6 @@ __exportStar(require("./models/bank-payout"), exports);
|
|
|
39
39
|
__exportStar(require("./models/bank-payment"), exports);
|
|
40
40
|
__exportStar(require("./models/order"), exports);
|
|
41
41
|
__exportStar(require("./models/user"), exports);
|
|
42
|
-
__exportStar(require("./models/ccxt-order"), exports);
|
|
43
42
|
__exportStar(require("./models/kushki-payment"), exports);
|
|
44
43
|
__exportStar(require("./models/crypto-address"), exports);
|
|
45
44
|
__exportStar(require("./models/fireblocks-vault"), exports);
|
|
@@ -68,7 +67,6 @@ __exportStar(require("./models/circle-address-book-recipient"), exports);
|
|
|
68
67
|
__exportStar(require("./models/circle-payout"), exports);
|
|
69
68
|
__exportStar(require("./models/market-data"), exports);
|
|
70
69
|
__exportStar(require("./models/telegram-session"), exports);
|
|
71
|
-
__exportStar(require("./models/UBO"), exports);
|
|
72
70
|
__exportStar(require("./models/temporary-verification"), exports);
|
|
73
71
|
__exportStar(require("./models/bid"), exports);
|
|
74
72
|
__exportStar(require("./models/rio-bank-account"), exports);
|
|
@@ -132,7 +130,6 @@ __exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), export
|
|
|
132
130
|
__exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
|
|
133
131
|
__exportStar(require("./helpers/get-user"), exports);
|
|
134
132
|
__exportStar(require("./helpers/unescape"), exports);
|
|
135
|
-
__exportStar(require("./helpers/get-user-transaction-limits"), exports);
|
|
136
133
|
__exportStar(require("./helpers/sanitize-user-doc"), exports);
|
|
137
134
|
__exportStar(require("./helpers/sanitize-bank-account-doc"), exports);
|
|
138
135
|
__exportStar(require("./helpers/sanitize-crypto-address-doc"), exports);
|
package/build/models/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin,
|
|
1
|
+
import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, Country, Fiat, Side, Crypto } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
3
|
interface UserAttrs {
|
|
4
4
|
createdAt: Date;
|
|
@@ -13,16 +13,10 @@ interface UserAttrs {
|
|
|
13
13
|
};
|
|
14
14
|
businessData?: {
|
|
15
15
|
businessName: string;
|
|
16
|
-
UBO?: {
|
|
17
|
-
id?: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
};
|
|
20
16
|
};
|
|
21
|
-
risk: RiskTier;
|
|
22
17
|
type: UserType;
|
|
23
18
|
phoneNumber?: string;
|
|
24
19
|
email: string;
|
|
25
|
-
hasPassedEDD: boolean;
|
|
26
20
|
cosignerGroupId?: string;
|
|
27
21
|
attributes?: UserAttribute[];
|
|
28
22
|
brokerId?: string;
|
|
@@ -68,13 +62,13 @@ interface UserAttrs {
|
|
|
68
62
|
overrideOvernightAndWeekendVault: boolean;
|
|
69
63
|
};
|
|
70
64
|
};
|
|
71
|
-
authorizedPhoneNumbers?: string[];
|
|
72
65
|
onboarding: {
|
|
73
66
|
country: Country;
|
|
74
67
|
aipriseBusinessProfileId?: string;
|
|
75
68
|
aipriseUserProfileId?: string;
|
|
76
69
|
aipriseBusinessVerificationSessionUrl?: string;
|
|
77
70
|
aipriseUserVerificationSessionUrl?: string;
|
|
71
|
+
aipriseUserVerificationSessionId?: string;
|
|
78
72
|
bridgeCustomerId?: string;
|
|
79
73
|
bridgeKYCLinkId?: string;
|
|
80
74
|
status: OnboardingStatus;
|
|
@@ -133,16 +127,10 @@ interface UserDoc extends Document {
|
|
|
133
127
|
};
|
|
134
128
|
businessData?: {
|
|
135
129
|
businessName: string;
|
|
136
|
-
UBO?: {
|
|
137
|
-
id?: string;
|
|
138
|
-
email?: string;
|
|
139
|
-
};
|
|
140
130
|
};
|
|
141
|
-
risk: RiskTier;
|
|
142
131
|
type: UserType;
|
|
143
132
|
phoneNumber?: string;
|
|
144
133
|
email: string;
|
|
145
|
-
hasPassedEDD: boolean;
|
|
146
134
|
cosignerGroupId?: string;
|
|
147
135
|
attributes?: UserAttribute[];
|
|
148
136
|
brokerId?: string;
|
|
@@ -182,7 +170,6 @@ interface UserDoc extends Document {
|
|
|
182
170
|
sell?: number;
|
|
183
171
|
};
|
|
184
172
|
};
|
|
185
|
-
authorizedPhoneNumbers?: string[];
|
|
186
173
|
onboarding: {
|
|
187
174
|
country: Country;
|
|
188
175
|
aipriseBusinessProfileId?: string;
|
package/build/models/user.js
CHANGED
|
@@ -32,14 +32,6 @@ const buildUser = (mongoose) => {
|
|
|
32
32
|
cosignerGroupId: {
|
|
33
33
|
type: String,
|
|
34
34
|
},
|
|
35
|
-
risk: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: true,
|
|
38
|
-
},
|
|
39
|
-
hasPassedEDD: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
35
|
attioRecordId: {
|
|
44
36
|
type: String,
|
|
45
37
|
},
|
|
@@ -224,52 +216,7 @@ const buildUser = (mongoose) => {
|
|
|
224
216
|
},
|
|
225
217
|
],
|
|
226
218
|
},
|
|
227
|
-
BR: {
|
|
228
|
-
buy: [
|
|
229
|
-
{
|
|
230
|
-
min: {
|
|
231
|
-
type: Number,
|
|
232
|
-
required: true,
|
|
233
|
-
},
|
|
234
|
-
max: {
|
|
235
|
-
type: Number,
|
|
236
|
-
required: true,
|
|
237
|
-
},
|
|
238
|
-
fee: {
|
|
239
|
-
type: Number,
|
|
240
|
-
required: true,
|
|
241
|
-
},
|
|
242
|
-
nextDaySettlementFee: {
|
|
243
|
-
type: Number,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
sell: [
|
|
248
|
-
{
|
|
249
|
-
min: {
|
|
250
|
-
type: Number,
|
|
251
|
-
required: true,
|
|
252
|
-
},
|
|
253
|
-
max: {
|
|
254
|
-
type: Number,
|
|
255
|
-
required: true,
|
|
256
|
-
},
|
|
257
|
-
fee: {
|
|
258
|
-
type: Number,
|
|
259
|
-
required: true,
|
|
260
|
-
},
|
|
261
|
-
nextDaySettlementFee: {
|
|
262
|
-
type: Number,
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
},
|
|
267
219
|
},
|
|
268
|
-
authorizedPhoneNumbers: [
|
|
269
|
-
{
|
|
270
|
-
type: String,
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
220
|
rioBankAccount: {
|
|
274
221
|
MX: Object,
|
|
275
222
|
US: Object,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2374",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/secret-manager": "^5.3.0",
|
|
29
29
|
"@google-cloud/storage": "^6.9.5",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.7.0",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.2093",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.7.4",
|
|
34
34
|
"crypto-js": "^4.2.0",
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getUserTransactionLimits = void 0;
|
|
13
|
-
const user_1 = require("../models/user");
|
|
14
|
-
const common_1 = require("@riocrypto/common");
|
|
15
|
-
const calculate_aggregate_volume_and_revenue_1 = require("./calculate-aggregate-volume-and-revenue");
|
|
16
|
-
const getUserTransactionLimits = (mongoose, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const User = (0, user_1.buildUser)(mongoose);
|
|
18
|
-
const user = yield User.findById(id);
|
|
19
|
-
if (!user) {
|
|
20
|
-
throw new common_1.NotFoundError("User");
|
|
21
|
-
}
|
|
22
|
-
const { volume } = yield (0, calculate_aggregate_volume_and_revenue_1.calculateAggregateVolumeAndRevenue)(mongoose, 30, user, true);
|
|
23
|
-
//@ts-ignore
|
|
24
|
-
let risk = user.risk;
|
|
25
|
-
if (!risk) {
|
|
26
|
-
//@ts-ignore
|
|
27
|
-
risk = user.riskTier;
|
|
28
|
-
}
|
|
29
|
-
let limit = 0;
|
|
30
|
-
if (risk === common_1.RiskTier.High) {
|
|
31
|
-
limit = 3000;
|
|
32
|
-
}
|
|
33
|
-
else if (risk === common_1.RiskTier.Medium) {
|
|
34
|
-
limit = 75000;
|
|
35
|
-
}
|
|
36
|
-
else if (risk === common_1.RiskTier.Low) {
|
|
37
|
-
if (user.hasPassedEDD) {
|
|
38
|
-
limit = 100000000;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
limit = 100000;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return { limit, used: volume };
|
|
45
|
-
});
|
|
46
|
-
exports.getUserTransactionLimits = getUserTransactionLimits;
|
package/build/models/UBO.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { OnboardingStatus, CountryOfOrigin } from "@riocrypto/common";
|
|
2
|
-
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
-
interface UBOAttrs {
|
|
4
|
-
createdAt: Date;
|
|
5
|
-
individualData?: {
|
|
6
|
-
firstName: string;
|
|
7
|
-
middleName?: string;
|
|
8
|
-
lastName: string;
|
|
9
|
-
secondLastName?: string;
|
|
10
|
-
birthday: Date;
|
|
11
|
-
countryOfOrigin: CountryOfOrigin;
|
|
12
|
-
};
|
|
13
|
-
phoneNumber: string;
|
|
14
|
-
email: string;
|
|
15
|
-
birthday?: Date;
|
|
16
|
-
associatedUserId?: string;
|
|
17
|
-
onboarding?: {
|
|
18
|
-
[country in CountryOfOrigin]?: {
|
|
19
|
-
status?: OnboardingStatus;
|
|
20
|
-
personalId?: string;
|
|
21
|
-
taxId?: string;
|
|
22
|
-
isResident?: boolean;
|
|
23
|
-
individualIdentityVerification?: {
|
|
24
|
-
status?: "passed" | "failed" | "review";
|
|
25
|
-
};
|
|
26
|
-
files?: {
|
|
27
|
-
certificateOfIncorporation?: string;
|
|
28
|
-
KYCReport?: string;
|
|
29
|
-
taxTranscript?: string;
|
|
30
|
-
proofOfAddress?: string;
|
|
31
|
-
businessRegistration?: string;
|
|
32
|
-
taxIdentificationCertificate?: string;
|
|
33
|
-
legalRepresentativeIdPowerOfAttorney?: string;
|
|
34
|
-
personalIdentificationCertificate?: string;
|
|
35
|
-
extraFiles?: string[];
|
|
36
|
-
};
|
|
37
|
-
address?: {
|
|
38
|
-
street1?: string;
|
|
39
|
-
street2?: string;
|
|
40
|
-
city?: string;
|
|
41
|
-
state?: string;
|
|
42
|
-
postalCode?: string;
|
|
43
|
-
country: CountryOfOrigin;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
interface UBOModel extends Model<UBODoc> {
|
|
49
|
-
build(attrs: UBOAttrs): UBODoc;
|
|
50
|
-
}
|
|
51
|
-
interface UBODoc extends Document {
|
|
52
|
-
_id: string;
|
|
53
|
-
createdAt: Date;
|
|
54
|
-
individualData?: {
|
|
55
|
-
firstName: string;
|
|
56
|
-
middleName?: string;
|
|
57
|
-
lastName: string;
|
|
58
|
-
secondLastName?: string;
|
|
59
|
-
birthday: Date;
|
|
60
|
-
countryOfOrigin: CountryOfOrigin;
|
|
61
|
-
};
|
|
62
|
-
phoneNumber: string;
|
|
63
|
-
email: string;
|
|
64
|
-
birthday?: Date;
|
|
65
|
-
associatedUserId?: string;
|
|
66
|
-
onboarding?: {
|
|
67
|
-
[country in CountryOfOrigin]?: {
|
|
68
|
-
status?: OnboardingStatus;
|
|
69
|
-
personalId?: string;
|
|
70
|
-
taxId?: string;
|
|
71
|
-
isResident?: boolean;
|
|
72
|
-
individualIdentityVerification?: {
|
|
73
|
-
status?: "passed" | "failed" | "review";
|
|
74
|
-
};
|
|
75
|
-
files?: {
|
|
76
|
-
certificateOfIncorporation?: string;
|
|
77
|
-
KYCReport?: string;
|
|
78
|
-
taxTranscript?: string;
|
|
79
|
-
proofOfAddress?: string;
|
|
80
|
-
businessRegistration?: string;
|
|
81
|
-
taxIdentificationCertificate?: string;
|
|
82
|
-
legalRepresentativeIdPowerOfAttorney?: string;
|
|
83
|
-
personalIdentificationCertificate?: string;
|
|
84
|
-
extraFiles?: string[];
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
declare const buildUBO: (mongoose: Mongoose) => UBOModel;
|
|
90
|
-
export { buildUBO, UBODoc, UBOAttrs };
|
package/build/models/UBO.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildUBO = void 0;
|
|
4
|
-
const buildUBO = (mongoose) => {
|
|
5
|
-
// if model is already defined, return it
|
|
6
|
-
if (mongoose.models.UBO) {
|
|
7
|
-
return mongoose.model("UBO");
|
|
8
|
-
}
|
|
9
|
-
const UBOSchema = new mongoose.Schema({
|
|
10
|
-
createdAt: {
|
|
11
|
-
type: mongoose.Schema.Types.Date,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
individualData: {
|
|
15
|
-
type: mongoose.Schema.Types.Mixed,
|
|
16
|
-
required: false,
|
|
17
|
-
},
|
|
18
|
-
phoneNumber: {
|
|
19
|
-
type: mongoose.Schema.Types.String,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
email: {
|
|
23
|
-
type: mongoose.Schema.Types.String,
|
|
24
|
-
required: true,
|
|
25
|
-
},
|
|
26
|
-
birthday: {
|
|
27
|
-
type: mongoose.Schema.Types.Date,
|
|
28
|
-
required: false,
|
|
29
|
-
},
|
|
30
|
-
associatedUserId: {
|
|
31
|
-
type: mongoose.Schema.Types.String,
|
|
32
|
-
required: false,
|
|
33
|
-
},
|
|
34
|
-
onboarding: {
|
|
35
|
-
type: mongoose.Schema.Types.Mixed,
|
|
36
|
-
required: false,
|
|
37
|
-
},
|
|
38
|
-
}, {
|
|
39
|
-
toJSON: {
|
|
40
|
-
transform(doc, ret) {
|
|
41
|
-
ret.id = ret._id.valueOf();
|
|
42
|
-
delete ret._id;
|
|
43
|
-
delete ret.__v;
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
UBOSchema.statics.build = (attrs) => {
|
|
48
|
-
return new UBO(attrs);
|
|
49
|
-
};
|
|
50
|
-
const UBO = mongoose.model("UBO", UBOSchema);
|
|
51
|
-
return UBO;
|
|
52
|
-
};
|
|
53
|
-
exports.buildUBO = buildUBO;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
2
|
-
interface CCXTOrderAttrs {
|
|
3
|
-
orderId: string;
|
|
4
|
-
ccxtId: string;
|
|
5
|
-
status: string;
|
|
6
|
-
}
|
|
7
|
-
interface CCXTOrderDoc extends mongoose.Document {
|
|
8
|
-
orderId: string;
|
|
9
|
-
status: string;
|
|
10
|
-
ccxtId: string;
|
|
11
|
-
}
|
|
12
|
-
interface CCXTOrderModel extends mongoose.Model<CCXTOrderDoc> {
|
|
13
|
-
build(attrs: CCXTOrderAttrs): CCXTOrderDoc;
|
|
14
|
-
}
|
|
15
|
-
declare const buildCCXTOrder: (mongoose: typeof mongoose) => CCXTOrderModel;
|
|
16
|
-
export { buildCCXTOrder, CCXTOrderDoc, CCXTOrderAttrs };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildCCXTOrder = void 0;
|
|
4
|
-
const buildCCXTOrder = (mongoose) => {
|
|
5
|
-
// if model is already defined, return it
|
|
6
|
-
if (mongoose.models.CCXTOrder) {
|
|
7
|
-
return mongoose.model("CCXTOrder");
|
|
8
|
-
}
|
|
9
|
-
const CCXTGenericOrderSchema = new mongoose.Schema({
|
|
10
|
-
orderId: {
|
|
11
|
-
type: String,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
ccxtId: {
|
|
15
|
-
type: String,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
status: {
|
|
19
|
-
type: String,
|
|
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
|
-
CCXTGenericOrderSchema.statics.build = (attrs) => {
|
|
32
|
-
return new CCXTOrder(attrs);
|
|
33
|
-
};
|
|
34
|
-
const CCXTOrder = mongoose.model("CCXTOrder", CCXTGenericOrderSchema);
|
|
35
|
-
return CCXTOrder;
|
|
36
|
-
};
|
|
37
|
-
exports.buildCCXTOrder = buildCCXTOrder;
|