@riocrypto/common-server 1.0.2499 → 1.0.2500

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 CHANGED
@@ -97,6 +97,7 @@ export * from "./models/auth-activity-slack-thread";
97
97
  export * from "./models/twap-session";
98
98
  export * from "./models/bulk-bank-payout";
99
99
  export * from "./models/bulk-crypto-payout";
100
+ export * from "./models/twap-settlement";
100
101
  export * from "./clients/axios-with-logging";
101
102
  export * from "./clients/slack-client";
102
103
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -113,6 +113,7 @@ __exportStar(require("./models/auth-activity-slack-thread"), exports);
113
113
  __exportStar(require("./models/twap-session"), exports);
114
114
  __exportStar(require("./models/bulk-bank-payout"), exports);
115
115
  __exportStar(require("./models/bulk-crypto-payout"), exports);
116
+ __exportStar(require("./models/twap-settlement"), exports);
116
117
  __exportStar(require("./clients/axios-with-logging"), exports);
117
118
  __exportStar(require("./clients/slack-client"), exports);
118
119
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -20,14 +20,8 @@ interface TWAPSessionAttrs {
20
20
  twoWaySettlementType: TwoWaySettlementType;
21
21
  twoWaySettlementDateOffset: number;
22
22
  averageNetPrice?: number;
23
- activeBulkBankPayoutId?: string;
24
- activeBulkCryptoPayoutId?: string;
25
- completedBulkBankPayoutIds?: string[];
26
- completedBulkCryptoPayoutIds?: string[];
27
- activeBulkBankPaymentId?: string;
28
- activeBulkCryptoPaymentId?: string;
29
- completedBulkBankPaymentIds?: string[];
30
- completedBulkCryptoPaymentIds?: string[];
23
+ activeTWAPSettlementId?: string;
24
+ executedTWAPSettlementIds: string[];
31
25
  lastRanAt?: Date;
32
26
  }
33
27
  interface TWAPSessionModel extends Model<TWAPSessionDoc> {
@@ -55,14 +49,8 @@ interface TWAPSessionDoc extends Document {
55
49
  twoWaySettlementDateOffset: number;
56
50
  averageNetPrice?: number;
57
51
  lastRanAt?: Date;
58
- activeBulkBankPayoutId?: string;
59
- activeBulkCryptoPayoutId?: string;
60
- completedBulkBankPayoutIds?: string[];
61
- completedBulkCryptoPayoutIds?: string[];
62
- activeBulkBankPaymentId?: string;
63
- activeBulkCryptoPaymentId?: string;
64
- completedBulkBankPaymentIds?: string[];
65
- completedBulkCryptoPaymentIds?: string[];
52
+ activeTWAPSettlementId?: string;
53
+ executedTWAPSettlementIds: string[];
66
54
  }
67
55
  declare const buildTWAPSession: (mongoose: Mongoose) => TWAPSessionModel;
68
56
  export { buildTWAPSession, TWAPSessionDoc, TWAPSessionAttrs };
@@ -84,29 +84,12 @@ const buildTWAPSession = (mongoose) => {
84
84
  type: Number,
85
85
  required: true,
86
86
  },
87
- activeBulkBankPayoutId: {
87
+ activeTWAPSettlementId: {
88
88
  type: String,
89
89
  },
90
- activeBulkCryptoPayoutId: {
91
- type: String,
92
- },
93
- completedBulkBankPayoutIds: {
94
- type: [String],
95
- },
96
- completedBulkCryptoPayoutIds: {
97
- type: [String],
98
- },
99
- activeBulkBankPaymentId: {
100
- type: String,
101
- },
102
- activeBulkCryptoPaymentId: {
103
- type: String,
104
- },
105
- completedBulkBankPaymentIds: {
106
- type: [String],
107
- },
108
- completedBulkCryptoPaymentIds: {
90
+ executedTWAPSettlementIds: {
109
91
  type: [String],
92
+ required: true,
110
93
  },
111
94
  }, {
112
95
  toJSON: {
@@ -0,0 +1,38 @@
1
+ import { Fiat, Crypto, DeferredPaymentType, TWAPSettlementStatus } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface TWAPSettlementAttrs {
4
+ createdAt: Date;
5
+ userId: string;
6
+ status: TWAPSettlementStatus;
7
+ TWAPSessionId: string;
8
+ deferredPaymentType: DeferredPaymentType;
9
+ paymentAmount: number;
10
+ paymentCurrency: Fiat | Crypto;
11
+ payoutAmount: number;
12
+ payoutCurrency: Fiat | Crypto;
13
+ bulkBankPaymentId?: string;
14
+ bulkCryptoPaymentId?: string;
15
+ bulkBankPayoutId?: string;
16
+ bulkCryptoPayoutId?: string;
17
+ }
18
+ interface TWAPSettlementModel extends Model<TWAPSettlementDoc> {
19
+ build(attrs: TWAPSettlementAttrs): TWAPSettlementDoc;
20
+ }
21
+ interface TWAPSettlementDoc extends Document {
22
+ id: string;
23
+ createdAt: Date;
24
+ userId: string;
25
+ status: TWAPSettlementStatus;
26
+ TWAPSessionId: string;
27
+ deferredPaymentType: DeferredPaymentType;
28
+ paymentAmount: number;
29
+ paymentCurrency: Fiat | Crypto;
30
+ payoutAmount: number;
31
+ payoutCurrency: Fiat | Crypto;
32
+ bulkBankPaymentId?: string;
33
+ bulkCryptoPaymentId?: string;
34
+ bulkBankPayoutId?: string;
35
+ bulkCryptoPayoutId?: string;
36
+ }
37
+ declare const buildTWAPSettlement: (mongoose: Mongoose) => TWAPSettlementModel;
38
+ export { buildTWAPSettlement, TWAPSettlementDoc, TWAPSettlementAttrs };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTWAPSettlement = void 0;
4
+ const buildTWAPSettlement = (mongoose) => {
5
+ if (mongoose.models.TWAPSettlement) {
6
+ return mongoose.model("TWAPSettlement");
7
+ }
8
+ const TWAPSettlementSchema = new mongoose.Schema({
9
+ createdAt: {
10
+ type: Date,
11
+ required: true,
12
+ },
13
+ userId: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+ status: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ TWAPSessionId: {
22
+ type: String,
23
+ required: true,
24
+ },
25
+ deferredPaymentType: {
26
+ type: String,
27
+ required: true,
28
+ },
29
+ paymentAmount: {
30
+ type: Number,
31
+ required: true,
32
+ },
33
+ paymentCurrency: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ payoutAmount: {
38
+ type: Number,
39
+ required: true,
40
+ },
41
+ payoutCurrency: {
42
+ type: String,
43
+ required: true,
44
+ },
45
+ bulkBankPaymentId: {
46
+ type: String,
47
+ },
48
+ bulkCryptoPaymentId: {
49
+ type: String,
50
+ },
51
+ bulkBankPayoutId: {
52
+ type: String,
53
+ },
54
+ bulkCryptoPayoutId: {
55
+ type: String,
56
+ },
57
+ }, {
58
+ toJSON: {
59
+ transform(doc, ret) {
60
+ ret.id = ret._id.valueOf();
61
+ delete ret._id;
62
+ delete ret.__v;
63
+ },
64
+ },
65
+ });
66
+ TWAPSettlementSchema.statics.build = (attrs) => {
67
+ return new TWAPSettlement(attrs);
68
+ };
69
+ const TWAPSettlement = mongoose.model("TWAPSettlement", TWAPSettlementSchema);
70
+ return TWAPSettlement;
71
+ };
72
+ exports.buildTWAPSettlement = buildTWAPSettlement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2499",
3
+ "version": "1.0.2500",
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.2266",
31
+ "@riocrypto/common": "^1.0.2269",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",