@riocrypto/common-server 1.0.2072 → 1.0.2074

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
@@ -78,6 +78,7 @@ export * from "./models/arbitrage-alert";
78
78
  export * from "./models/liquidity-automation";
79
79
  export * from "./models/arbitrage-session";
80
80
  export * from "./models/arbitrage-trade";
81
+ export * from "./models/pre-settlement-transaction";
81
82
  export * from "./clients/axios-with-logging";
82
83
  export * from "./clients/slack-client";
83
84
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -94,6 +94,7 @@ __exportStar(require("./models/arbitrage-alert"), exports);
94
94
  __exportStar(require("./models/liquidity-automation"), exports);
95
95
  __exportStar(require("./models/arbitrage-session"), exports);
96
96
  __exportStar(require("./models/arbitrage-trade"), exports);
97
+ __exportStar(require("./models/pre-settlement-transaction"), exports);
97
98
  __exportStar(require("./clients/axios-with-logging"), exports);
98
99
  __exportStar(require("./clients/slack-client"), exports);
99
100
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -0,0 +1,22 @@
1
+ import { Fiat, Crypto } from "@riocrypto/common";
2
+ import { PreSettlementTransactionType } from "@riocrypto/common";
3
+ import mongoose from "mongoose";
4
+ interface PreSettlementTransactionAttrs {
5
+ userId: string;
6
+ type: PreSettlementTransactionType;
7
+ amount: number;
8
+ currency: Fiat | Crypto;
9
+ orderId?: string;
10
+ }
11
+ interface PreSettlementTransactionDoc extends mongoose.Document {
12
+ userId: string;
13
+ type: PreSettlementTransactionType;
14
+ amount: number;
15
+ currency: Fiat | Crypto;
16
+ orderId?: string;
17
+ }
18
+ interface PreSettlementTransactionModel extends mongoose.Model<PreSettlementTransactionDoc> {
19
+ build(attrs: PreSettlementTransactionAttrs): PreSettlementTransactionDoc;
20
+ }
21
+ declare const buildPreSettlementTransaction: (mongoose: typeof mongoose) => PreSettlementTransactionModel;
22
+ export { buildPreSettlementTransaction, PreSettlementTransactionDoc, PreSettlementTransactionAttrs, };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPreSettlementTransaction = void 0;
4
+ const common_1 = require("@riocrypto/common");
5
+ const buildPreSettlementTransaction = (mongoose) => {
6
+ // if model is already defined, return it
7
+ if (mongoose.models.PreSettlementTransaction) {
8
+ return mongoose.model("PreSettlementTransaction");
9
+ }
10
+ const PreSettlementTransactionSchema = new mongoose.Schema({
11
+ userId: {
12
+ type: String,
13
+ },
14
+ type: {
15
+ type: String,
16
+ enum: Object.values(common_1.PreSettlementTransactionType),
17
+ },
18
+ amount: {
19
+ type: Number,
20
+ },
21
+ currency: {
22
+ type: String,
23
+ },
24
+ orderId: {
25
+ type: String,
26
+ },
27
+ }, {
28
+ toJSON: {
29
+ transform(doc, ret) {
30
+ ret.id = ret._id;
31
+ delete ret._id;
32
+ delete ret.__v;
33
+ },
34
+ },
35
+ });
36
+ PreSettlementTransactionSchema.statics.build = (attrs) => {
37
+ return new PreSettlementTransaction(attrs);
38
+ };
39
+ const PreSettlementTransaction = mongoose.model("PreSettlementTransaction", PreSettlementTransactionSchema);
40
+ return PreSettlementTransaction;
41
+ };
42
+ exports.buildPreSettlementTransaction = buildPreSettlementTransaction;
@@ -1,4 +1,4 @@
1
- import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, RiskTier, ImmigrationStatus, Country, Fiat } from "@riocrypto/common";
1
+ import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, RiskTier, ImmigrationStatus, Country, Fiat, Crypto, PreSettlementTransactionType } from "@riocrypto/common";
2
2
  import { Mongoose, Model, Document } from "mongoose";
3
3
  interface UserAttrs {
4
4
  createdAt: Date;
@@ -124,6 +124,11 @@ interface UserAttrs {
124
124
  };
125
125
  };
126
126
  attioRecordId?: string;
127
+ preSettlementTransactions?: {
128
+ [transactionType in PreSettlementTransactionType]?: {
129
+ [currency in Fiat | Crypto]?: string;
130
+ };
131
+ };
127
132
  }
128
133
  interface UserModel extends Model<UserDoc> {
129
134
  build(attrs: UserAttrs): UserDoc;
@@ -253,6 +258,11 @@ interface UserDoc extends Document {
253
258
  };
254
259
  };
255
260
  };
261
+ preSettlementTransactions?: {
262
+ [transactionType in PreSettlementTransactionType]?: {
263
+ [currency in Fiat | Crypto]?: string;
264
+ };
265
+ };
256
266
  }
257
267
  declare const buildUser: (mongoose: Mongoose) => UserModel;
258
268
  export { buildUser, UserDoc, UserAttrs };
@@ -338,6 +338,9 @@ const buildUser = (mongoose) => {
338
338
  },
339
339
  },
340
340
  },
341
+ preSettlementTransactions: {
342
+ type: Object,
343
+ },
341
344
  }, {
342
345
  toJSON: {
343
346
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2072",
3
+ "version": "1.0.2074",
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.1810",
31
+ "@riocrypto/common": "^1.0.1812",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",