@riocrypto/common-server 1.0.2721 → 1.0.2723
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 +5 -0
- package/build/index.js +5 -0
- package/build/middlewares/authorize.d.ts +4 -0
- package/build/middlewares/authorize.js +28 -1
- package/build/models/binance-rfq-log.d.ts +23 -0
- package/build/models/binance-rfq-log.js +47 -0
- package/build/models/binance-rfq-order.d.ts +45 -0
- package/build/models/binance-rfq-order.js +92 -0
- package/build/models/binance-rfq-quote.d.ts +33 -0
- package/build/models/binance-rfq-quote.js +68 -0
- package/build/models/binance-rfq-trade.d.ts +29 -0
- package/build/models/binance-rfq-trade.js +59 -0
- package/build/models/indicative-quote-page-verification.d.ts +23 -0
- package/build/models/indicative-quote-page-verification.js +50 -0
- package/build/models/indicative-quote-page.d.ts +2 -4
- package/build/models/indicative-quote-page.js +1 -4
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -116,8 +116,13 @@ export * from "./models/compliance-session";
|
|
|
116
116
|
export * from "./models/compliance-bot-chat";
|
|
117
117
|
export * from "./models/compliance-bot-rule";
|
|
118
118
|
export * from "./models/compliance-bot-rule-result";
|
|
119
|
+
export * from "./models/binance-rfq-log";
|
|
120
|
+
export * from "./models/binance-rfq-order";
|
|
121
|
+
export * from "./models/binance-rfq-quote";
|
|
122
|
+
export * from "./models/binance-rfq-trade";
|
|
119
123
|
export * from "./models/static-bank-payment-reference";
|
|
120
124
|
export * from "./models/indicative-quote-page";
|
|
125
|
+
export * from "./models/indicative-quote-page-verification";
|
|
121
126
|
export * from "./clients/axios-with-logging";
|
|
122
127
|
export * from "./clients/slack-client";
|
|
123
128
|
export * from "./clients/fireblocks-client";
|
package/build/index.js
CHANGED
|
@@ -132,8 +132,13 @@ __exportStar(require("./models/compliance-session"), exports);
|
|
|
132
132
|
__exportStar(require("./models/compliance-bot-chat"), exports);
|
|
133
133
|
__exportStar(require("./models/compliance-bot-rule"), exports);
|
|
134
134
|
__exportStar(require("./models/compliance-bot-rule-result"), exports);
|
|
135
|
+
__exportStar(require("./models/binance-rfq-log"), exports);
|
|
136
|
+
__exportStar(require("./models/binance-rfq-order"), exports);
|
|
137
|
+
__exportStar(require("./models/binance-rfq-quote"), exports);
|
|
138
|
+
__exportStar(require("./models/binance-rfq-trade"), exports);
|
|
135
139
|
__exportStar(require("./models/static-bank-payment-reference"), exports);
|
|
136
140
|
__exportStar(require("./models/indicative-quote-page"), exports);
|
|
141
|
+
__exportStar(require("./models/indicative-quote-page-verification"), exports);
|
|
137
142
|
__exportStar(require("./clients/axios-with-logging"), exports);
|
|
138
143
|
__exportStar(require("./clients/slack-client"), exports);
|
|
139
144
|
__exportStar(require("./clients/fireblocks-client"), exports);
|
|
@@ -200,6 +200,31 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
200
200
|
}))());
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
// Check for indicative quote auth token - only if needed
|
|
204
|
+
if (authorizationTypes.includes(common_1.AuthorizationType.IndicativeQuoteAuth)) {
|
|
205
|
+
const authHeader = req.header("Authorization");
|
|
206
|
+
const token = (authHeader === null || authHeader === void 0 ? void 0 : authHeader.startsWith("Bearer "))
|
|
207
|
+
? authHeader.slice(7)
|
|
208
|
+
: null;
|
|
209
|
+
if (token) {
|
|
210
|
+
promises.push((() => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
|
+
try {
|
|
212
|
+
const INDICATIVE_PAGE_TOKEN_SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue("INDICATIVE_PAGE_TOKEN_SECRET");
|
|
213
|
+
if (!INDICATIVE_PAGE_TOKEN_SECRET) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const payload = jsonwebtoken_1.default.verify(token, INDICATIVE_PAGE_TOKEN_SECRET);
|
|
217
|
+
if (payload.email && payload.pageId) {
|
|
218
|
+
req.indicativeQuoteAuth = {
|
|
219
|
+
email: payload.email,
|
|
220
|
+
pageId: payload.pageId,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (err) { }
|
|
225
|
+
}))());
|
|
226
|
+
}
|
|
227
|
+
}
|
|
203
228
|
// Wait for all promises to complete
|
|
204
229
|
yield Promise.all(promises);
|
|
205
230
|
// Check authorization results and proceed if authorized
|
|
@@ -216,7 +241,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
216
241
|
req.adminAuth) ||
|
|
217
242
|
((authorizationTypes.includes(common_1.AuthorizationType.User) ||
|
|
218
243
|
authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) &&
|
|
219
|
-
req.user)
|
|
244
|
+
req.user) ||
|
|
245
|
+
(authorizationTypes.includes(common_1.AuthorizationType.IndicativeQuoteAuth) &&
|
|
246
|
+
req.indicativeQuoteAuth)) {
|
|
220
247
|
next();
|
|
221
248
|
return;
|
|
222
249
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
import { BinanceRFQLogDirection } from "@riocrypto/common";
|
|
3
|
+
interface BinanceRFQLogAttrs {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
inOut: BinanceRFQLogDirection;
|
|
6
|
+
msgType: string;
|
|
7
|
+
message: string;
|
|
8
|
+
refId?: string;
|
|
9
|
+
}
|
|
10
|
+
interface BinanceRFQLogDoc extends Document {
|
|
11
|
+
endpoint: string;
|
|
12
|
+
inOut: BinanceRFQLogDirection;
|
|
13
|
+
msgType: string;
|
|
14
|
+
message: string;
|
|
15
|
+
refId?: string;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
interface BinanceRFQLogModel extends Model<BinanceRFQLogDoc> {
|
|
20
|
+
build(attrs: BinanceRFQLogAttrs): BinanceRFQLogDoc;
|
|
21
|
+
}
|
|
22
|
+
declare const buildBinanceRFQLog: (mongoose: Mongoose) => BinanceRFQLogModel;
|
|
23
|
+
export { buildBinanceRFQLog, BinanceRFQLogDoc, BinanceRFQLogAttrs };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBinanceRFQLog = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
5
|
+
const buildBinanceRFQLog = (mongoose) => {
|
|
6
|
+
if (mongoose.models.BinanceRFQLog) {
|
|
7
|
+
return mongoose.model("BinanceRFQLog");
|
|
8
|
+
}
|
|
9
|
+
const BinanceRFQLogSchema = new mongoose.Schema({
|
|
10
|
+
endpoint: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
inOut: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: Object.values(common_1.BinanceRFQLogDirection),
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
msgType: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
message: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
refId: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
}, {
|
|
32
|
+
timestamps: true,
|
|
33
|
+
toJSON: {
|
|
34
|
+
transform(doc, ret) {
|
|
35
|
+
ret.id = ret._id.valueOf();
|
|
36
|
+
delete ret._id;
|
|
37
|
+
delete ret.__v;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
BinanceRFQLogSchema.statics.build = (attrs) => {
|
|
42
|
+
return new BinanceRFQLog(attrs);
|
|
43
|
+
};
|
|
44
|
+
const BinanceRFQLog = mongoose.model("BinanceRFQLog", BinanceRFQLogSchema);
|
|
45
|
+
return BinanceRFQLog;
|
|
46
|
+
};
|
|
47
|
+
exports.buildBinanceRFQLog = buildBinanceRFQLog;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
import { BinanceRFQSide, BinanceRFQStatus } from "@riocrypto/common";
|
|
3
|
+
interface BinanceRFQOrderAttrs {
|
|
4
|
+
rfqId: string;
|
|
5
|
+
rfqStatus: BinanceRFQStatus;
|
|
6
|
+
settlementStatus?: string | null;
|
|
7
|
+
rfqExpireTime: number;
|
|
8
|
+
symbol: string;
|
|
9
|
+
side: BinanceRFQSide;
|
|
10
|
+
baseAsset: string;
|
|
11
|
+
quoteAsset: string;
|
|
12
|
+
quantity: number;
|
|
13
|
+
quoteOrderQty: number;
|
|
14
|
+
lastBidQuoteId?: string | null;
|
|
15
|
+
lastOfferQuoteId?: string | null;
|
|
16
|
+
bidPrice?: number | null;
|
|
17
|
+
bidQuantity?: number | null;
|
|
18
|
+
offerPrice?: number | null;
|
|
19
|
+
offerQuantity?: number | null;
|
|
20
|
+
}
|
|
21
|
+
interface BinanceRFQOrderDoc extends Document {
|
|
22
|
+
rfqId: string;
|
|
23
|
+
rfqStatus: BinanceRFQStatus;
|
|
24
|
+
settlementStatus: string | null;
|
|
25
|
+
rfqExpireTime: number;
|
|
26
|
+
symbol: string;
|
|
27
|
+
side: BinanceRFQSide;
|
|
28
|
+
baseAsset: string;
|
|
29
|
+
quoteAsset: string;
|
|
30
|
+
quantity: number;
|
|
31
|
+
quoteOrderQty: number;
|
|
32
|
+
lastBidQuoteId: string | null;
|
|
33
|
+
lastOfferQuoteId: string | null;
|
|
34
|
+
bidPrice: number | null;
|
|
35
|
+
bidQuantity: number | null;
|
|
36
|
+
offerPrice: number | null;
|
|
37
|
+
offerQuantity: number | null;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
}
|
|
41
|
+
interface BinanceRFQOrderModel extends Model<BinanceRFQOrderDoc> {
|
|
42
|
+
build(attrs: BinanceRFQOrderAttrs): BinanceRFQOrderDoc;
|
|
43
|
+
}
|
|
44
|
+
declare const buildBinanceRFQOrder: (mongoose: Mongoose) => BinanceRFQOrderModel;
|
|
45
|
+
export { buildBinanceRFQOrder, BinanceRFQOrderDoc, BinanceRFQOrderAttrs };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBinanceRFQOrder = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
5
|
+
const buildBinanceRFQOrder = (mongoose) => {
|
|
6
|
+
if (mongoose.models.BinanceRFQOrder) {
|
|
7
|
+
return mongoose.model("BinanceRFQOrder");
|
|
8
|
+
}
|
|
9
|
+
const BinanceRFQOrderSchema = new mongoose.Schema({
|
|
10
|
+
rfqId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
rfqStatus: {
|
|
15
|
+
type: String,
|
|
16
|
+
enum: Object.values(common_1.BinanceRFQStatus),
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
settlementStatus: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: null,
|
|
22
|
+
},
|
|
23
|
+
rfqExpireTime: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
symbol: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
side: {
|
|
32
|
+
type: String,
|
|
33
|
+
enum: Object.values(common_1.BinanceRFQSide),
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
baseAsset: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
quoteAsset: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
quantity: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
quoteOrderQty: {
|
|
49
|
+
type: Number,
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
lastBidQuoteId: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: null,
|
|
55
|
+
},
|
|
56
|
+
lastOfferQuoteId: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: null,
|
|
59
|
+
},
|
|
60
|
+
bidPrice: {
|
|
61
|
+
type: Number,
|
|
62
|
+
default: null,
|
|
63
|
+
},
|
|
64
|
+
bidQuantity: {
|
|
65
|
+
type: Number,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
offerPrice: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: null,
|
|
71
|
+
},
|
|
72
|
+
offerQuantity: {
|
|
73
|
+
type: Number,
|
|
74
|
+
default: null,
|
|
75
|
+
},
|
|
76
|
+
}, {
|
|
77
|
+
timestamps: true,
|
|
78
|
+
toJSON: {
|
|
79
|
+
transform(doc, ret) {
|
|
80
|
+
ret.id = ret._id.valueOf();
|
|
81
|
+
delete ret._id;
|
|
82
|
+
delete ret.__v;
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
BinanceRFQOrderSchema.statics.build = (attrs) => {
|
|
87
|
+
return new BinanceRFQOrder(attrs);
|
|
88
|
+
};
|
|
89
|
+
const BinanceRFQOrder = mongoose.model("BinanceRFQOrder", BinanceRFQOrderSchema);
|
|
90
|
+
return BinanceRFQOrder;
|
|
91
|
+
};
|
|
92
|
+
exports.buildBinanceRFQOrder = buildBinanceRFQOrder;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
import { BinanceRFQQuoteStatus, BinanceRFQSide } from "@riocrypto/common";
|
|
3
|
+
interface BinanceRFQQuoteAttrs {
|
|
4
|
+
rfqId: string;
|
|
5
|
+
quoteId: string;
|
|
6
|
+
clientQuoteId: string;
|
|
7
|
+
baseAsset: string;
|
|
8
|
+
quoteAsset: string;
|
|
9
|
+
side: BinanceRFQSide;
|
|
10
|
+
price: number;
|
|
11
|
+
quantity: number;
|
|
12
|
+
settleTime: number;
|
|
13
|
+
status: BinanceRFQQuoteStatus;
|
|
14
|
+
}
|
|
15
|
+
interface BinanceRFQQuoteDoc extends Document {
|
|
16
|
+
rfqId: string;
|
|
17
|
+
quoteId: string;
|
|
18
|
+
clientQuoteId: string;
|
|
19
|
+
baseAsset: string;
|
|
20
|
+
quoteAsset: string;
|
|
21
|
+
side: BinanceRFQSide;
|
|
22
|
+
price: number;
|
|
23
|
+
quantity: number;
|
|
24
|
+
settleTime: number;
|
|
25
|
+
status: BinanceRFQQuoteStatus;
|
|
26
|
+
createdAt: Date;
|
|
27
|
+
updatedAt: Date;
|
|
28
|
+
}
|
|
29
|
+
interface BinanceRFQQuoteModel extends Model<BinanceRFQQuoteDoc> {
|
|
30
|
+
build(attrs: BinanceRFQQuoteAttrs): BinanceRFQQuoteDoc;
|
|
31
|
+
}
|
|
32
|
+
declare const buildBinanceRFQQuote: (mongoose: Mongoose) => BinanceRFQQuoteModel;
|
|
33
|
+
export { buildBinanceRFQQuote, BinanceRFQQuoteDoc, BinanceRFQQuoteAttrs };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBinanceRFQQuote = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
5
|
+
const buildBinanceRFQQuote = (mongoose) => {
|
|
6
|
+
if (mongoose.models.BinanceRFQQuote) {
|
|
7
|
+
return mongoose.model("BinanceRFQQuote");
|
|
8
|
+
}
|
|
9
|
+
const BinanceRFQQuoteSchema = new mongoose.Schema({
|
|
10
|
+
rfqId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
quoteId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
clientQuoteId: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
baseAsset: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
quoteAsset: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
side: {
|
|
31
|
+
type: String,
|
|
32
|
+
enum: Object.values(common_1.BinanceRFQSide),
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
price: {
|
|
36
|
+
type: Number,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
quantity: {
|
|
40
|
+
type: Number,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
settleTime: {
|
|
44
|
+
type: Number,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
type: String,
|
|
49
|
+
enum: Object.values(common_1.BinanceRFQQuoteStatus),
|
|
50
|
+
required: true,
|
|
51
|
+
},
|
|
52
|
+
}, {
|
|
53
|
+
timestamps: true,
|
|
54
|
+
toJSON: {
|
|
55
|
+
transform(doc, ret) {
|
|
56
|
+
ret.id = ret._id.valueOf();
|
|
57
|
+
delete ret._id;
|
|
58
|
+
delete ret.__v;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
BinanceRFQQuoteSchema.statics.build = (attrs) => {
|
|
63
|
+
return new BinanceRFQQuote(attrs);
|
|
64
|
+
};
|
|
65
|
+
const BinanceRFQQuote = mongoose.model("BinanceRFQQuote", BinanceRFQQuoteSchema);
|
|
66
|
+
return BinanceRFQQuote;
|
|
67
|
+
};
|
|
68
|
+
exports.buildBinanceRFQQuote = buildBinanceRFQQuote;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
import { BinanceRFQTradeStatus } from "@riocrypto/common";
|
|
3
|
+
interface BinanceRFQTradeAttrs {
|
|
4
|
+
rfqId: string;
|
|
5
|
+
quoteId: string;
|
|
6
|
+
tradeId: string;
|
|
7
|
+
executedPrice: number;
|
|
8
|
+
executedQty: number;
|
|
9
|
+
tradeStatus: BinanceRFQTradeStatus;
|
|
10
|
+
tradeAt: Date;
|
|
11
|
+
settledAt: Date | null;
|
|
12
|
+
}
|
|
13
|
+
interface BinanceRFQTradeDoc extends Document {
|
|
14
|
+
rfqId: string;
|
|
15
|
+
quoteId: string;
|
|
16
|
+
tradeId: string;
|
|
17
|
+
executedPrice: number;
|
|
18
|
+
executedQty: number;
|
|
19
|
+
tradeStatus: BinanceRFQTradeStatus;
|
|
20
|
+
tradeAt: Date;
|
|
21
|
+
settledAt: Date | null;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
}
|
|
25
|
+
interface BinanceRFQTradeModel extends Model<BinanceRFQTradeDoc> {
|
|
26
|
+
build(attrs: BinanceRFQTradeAttrs): BinanceRFQTradeDoc;
|
|
27
|
+
}
|
|
28
|
+
declare const buildBinanceRFQTrade: (mongoose: Mongoose) => BinanceRFQTradeModel;
|
|
29
|
+
export { buildBinanceRFQTrade, BinanceRFQTradeDoc, BinanceRFQTradeAttrs };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBinanceRFQTrade = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
5
|
+
const buildBinanceRFQTrade = (mongoose) => {
|
|
6
|
+
if (mongoose.models.BinanceRFQTrade) {
|
|
7
|
+
return mongoose.model("BinanceRFQTrade");
|
|
8
|
+
}
|
|
9
|
+
const BinanceRFQTradeSchema = new mongoose.Schema({
|
|
10
|
+
rfqId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
quoteId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
tradeId: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
executedPrice: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
executedQty: {
|
|
27
|
+
type: Number,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
tradeStatus: {
|
|
31
|
+
type: String,
|
|
32
|
+
enum: Object.values(common_1.BinanceRFQTradeStatus),
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
tradeAt: {
|
|
36
|
+
type: Date,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
settledAt: {
|
|
40
|
+
type: Date,
|
|
41
|
+
default: null,
|
|
42
|
+
},
|
|
43
|
+
}, {
|
|
44
|
+
timestamps: true,
|
|
45
|
+
toJSON: {
|
|
46
|
+
transform(doc, ret) {
|
|
47
|
+
ret.id = ret._id.valueOf();
|
|
48
|
+
delete ret._id;
|
|
49
|
+
delete ret.__v;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
BinanceRFQTradeSchema.statics.build = (attrs) => {
|
|
54
|
+
return new BinanceRFQTrade(attrs);
|
|
55
|
+
};
|
|
56
|
+
const BinanceRFQTrade = mongoose.model("BinanceRFQTrade", BinanceRFQTradeSchema);
|
|
57
|
+
return BinanceRFQTrade;
|
|
58
|
+
};
|
|
59
|
+
exports.buildBinanceRFQTrade = buildBinanceRFQTrade;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
interface IndicativeQuotePageVerificationAttrs {
|
|
3
|
+
pageId: string;
|
|
4
|
+
email: string;
|
|
5
|
+
verificationCode: string;
|
|
6
|
+
expiresAt: Date;
|
|
7
|
+
attempts: number;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
}
|
|
10
|
+
interface IndicativeQuotePageVerificationModel extends Model<IndicativeQuotePageVerificationDoc> {
|
|
11
|
+
build(attrs: IndicativeQuotePageVerificationAttrs): IndicativeQuotePageVerificationDoc;
|
|
12
|
+
}
|
|
13
|
+
interface IndicativeQuotePageVerificationDoc extends Document {
|
|
14
|
+
_id: string;
|
|
15
|
+
pageId: string;
|
|
16
|
+
email: string;
|
|
17
|
+
verificationCode: string;
|
|
18
|
+
expiresAt: Date;
|
|
19
|
+
attempts: number;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
}
|
|
22
|
+
declare const buildIndicativeQuotePageVerification: (mongoose: Mongoose) => IndicativeQuotePageVerificationModel;
|
|
23
|
+
export { buildIndicativeQuotePageVerification, IndicativeQuotePageVerificationDoc, IndicativeQuotePageVerificationAttrs, };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildIndicativeQuotePageVerification = void 0;
|
|
4
|
+
const buildIndicativeQuotePageVerification = (mongoose) => {
|
|
5
|
+
if (mongoose.models.IndicativeQuotePageVerification) {
|
|
6
|
+
return mongoose.model("IndicativeQuotePageVerification");
|
|
7
|
+
}
|
|
8
|
+
const IndicativeQuotePageVerificationSchema = new mongoose.Schema({
|
|
9
|
+
pageId: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
email: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
verificationCode: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
expiresAt: {
|
|
22
|
+
type: Date,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
25
|
+
attempts: {
|
|
26
|
+
type: Number,
|
|
27
|
+
default: 0,
|
|
28
|
+
},
|
|
29
|
+
createdAt: {
|
|
30
|
+
type: Date,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
}, {
|
|
34
|
+
toJSON: {
|
|
35
|
+
transform(doc, ret) {
|
|
36
|
+
ret.id = ret._id.valueOf();
|
|
37
|
+
delete ret._id;
|
|
38
|
+
delete ret.__v;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
IndicativeQuotePageVerificationSchema.index({ pageId: 1, email: 1 }, { unique: true });
|
|
43
|
+
IndicativeQuotePageVerificationSchema.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
44
|
+
IndicativeQuotePageVerificationSchema.statics.build = (attrs) => {
|
|
45
|
+
return new IndicativeQuotePageVerification(attrs);
|
|
46
|
+
};
|
|
47
|
+
const IndicativeQuotePageVerification = mongoose.model("IndicativeQuotePageVerification", IndicativeQuotePageVerificationSchema);
|
|
48
|
+
return IndicativeQuotePageVerification;
|
|
49
|
+
};
|
|
50
|
+
exports.buildIndicativeQuotePageVerification = buildIndicativeQuotePageVerification;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { IndicativeQuotePageQuoteConfig } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
3
|
interface IndicativeQuotePageAttrs {
|
|
4
|
-
userId?: string;
|
|
5
4
|
quotes: IndicativeQuotePageQuoteConfig[];
|
|
6
|
-
|
|
5
|
+
allowedEmails: string[];
|
|
7
6
|
createdBy: string;
|
|
8
7
|
createdAt: Date;
|
|
9
8
|
updatedAt: Date;
|
|
@@ -13,9 +12,8 @@ interface IndicativeQuotePageModel extends Model<IndicativeQuotePageDoc> {
|
|
|
13
12
|
}
|
|
14
13
|
interface IndicativeQuotePageDoc extends Document {
|
|
15
14
|
_id: string;
|
|
16
|
-
userId?: string;
|
|
17
15
|
quotes: IndicativeQuotePageQuoteConfig[];
|
|
18
|
-
|
|
16
|
+
allowedEmails: string[];
|
|
19
17
|
createdBy: string;
|
|
20
18
|
createdAt: Date;
|
|
21
19
|
updatedAt: Date;
|
|
@@ -54,14 +54,11 @@ const buildIndicativeQuotePage = (mongoose) => {
|
|
|
54
54
|
},
|
|
55
55
|
}, { _id: false });
|
|
56
56
|
const IndicativeQuotePageSchema = new mongoose.Schema({
|
|
57
|
-
userId: {
|
|
58
|
-
type: String,
|
|
59
|
-
},
|
|
60
57
|
quotes: {
|
|
61
58
|
type: [QuoteConfigSchema],
|
|
62
59
|
required: true,
|
|
63
60
|
},
|
|
64
|
-
|
|
61
|
+
allowedEmails: {
|
|
65
62
|
type: [String],
|
|
66
63
|
required: true,
|
|
67
64
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2723",
|
|
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.2520",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.7.4",
|
|
34
34
|
"crypto-js": "^4.2.0",
|