@riocrypto/common-server 1.0.2668 → 1.0.2670

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
@@ -105,6 +105,9 @@ export * from "./models/inbound-bank-deposit";
105
105
  export * from "./models/inbound-crypto-deposit";
106
106
  export * from "./models/order-log";
107
107
  export * from "./models/approved-alternative-bank-account-holder-name";
108
+ export * from "./models/liquidity-sourcing-plan";
109
+ export * from "./models/liquidity-sourcing-exclusion";
110
+ export * from "./models/liquidity-sourcing-settings";
108
111
  export * from "./clients/axios-with-logging";
109
112
  export * from "./clients/slack-client";
110
113
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -121,6 +121,9 @@ __exportStar(require("./models/inbound-bank-deposit"), exports);
121
121
  __exportStar(require("./models/inbound-crypto-deposit"), exports);
122
122
  __exportStar(require("./models/order-log"), exports);
123
123
  __exportStar(require("./models/approved-alternative-bank-account-holder-name"), exports);
124
+ __exportStar(require("./models/liquidity-sourcing-plan"), exports);
125
+ __exportStar(require("./models/liquidity-sourcing-exclusion"), exports);
126
+ __exportStar(require("./models/liquidity-sourcing-settings"), exports);
124
127
  __exportStar(require("./clients/axios-with-logging"), exports);
125
128
  __exportStar(require("./clients/slack-client"), exports);
126
129
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -1,7 +1,8 @@
1
1
  import mongoose from "mongoose";
2
2
  import { TreasuryProvider, Fiat, Crypto, InternalTradeStatus, InternalTradeType, InternalTradeStrategy } from "@riocrypto/common";
3
3
  interface InternalTradeAttrs {
4
- adminId: string;
4
+ adminId?: string;
5
+ liquiditySourcingPlanId?: string;
5
6
  createdAt: Date;
6
7
  provider: TreasuryProvider;
7
8
  originAmount: number;
@@ -21,7 +22,8 @@ interface InternalTradeAttrs {
21
22
  }
22
23
  interface InternalTradeDoc extends mongoose.Document {
23
24
  id: string;
24
- adminId: string;
25
+ adminId?: string;
26
+ liquiditySourcingPlanId?: string;
25
27
  createdAt: Date;
26
28
  provider: TreasuryProvider;
27
29
  originAmount: number;
@@ -9,7 +9,9 @@ const buildInternalTrade = (mongoose) => {
9
9
  const InternalTradeSchema = new mongoose.Schema({
10
10
  adminId: {
11
11
  type: String,
12
- required: true,
12
+ },
13
+ liquiditySourcingPlanId: {
14
+ type: String,
13
15
  },
14
16
  createdAt: {
15
17
  type: Date,
@@ -2,8 +2,9 @@ import mongoose from "mongoose";
2
2
  import { InternalTransferType, TreasuryProvider, Fiat, Crypto, InternalTransferOriginStatus, InternalTransferDestinationStatus } from "@riocrypto/common";
3
3
  interface InternalTransferAttrs {
4
4
  createdAt: Date;
5
- adminId: string;
5
+ adminId?: string;
6
6
  liquidityAutomationId?: string;
7
+ liquiditySourcingPlanId?: string;
7
8
  transferType: InternalTransferType;
8
9
  amount: number;
9
10
  currency: Fiat | Crypto;
@@ -28,8 +29,9 @@ interface InternalTransferAttrs {
28
29
  }
29
30
  interface InternalTransferDoc extends mongoose.Document {
30
31
  id: string;
31
- adminId: string;
32
+ adminId?: string;
32
33
  liquidityAutomationId?: string;
34
+ liquiditySourcingPlanId?: string;
33
35
  createdAt: Date;
34
36
  transferType: InternalTransferType;
35
37
  blockchainTxId?: string;
@@ -10,11 +10,13 @@ const buildInternalTransfer = (mongoose) => {
10
10
  const InternalTransferSchema = new mongoose.Schema({
11
11
  adminId: {
12
12
  type: String,
13
- required: true,
14
13
  },
15
14
  liquidityAutomationId: {
16
15
  type: String,
17
16
  },
17
+ liquiditySourcingPlanId: {
18
+ type: String,
19
+ },
18
20
  createdAt: {
19
21
  type: Date,
20
22
  required: true,
@@ -0,0 +1,19 @@
1
+ import mongoose from "mongoose";
2
+ import { Crypto, Fiat, LiquiditySourcingExclusion, LiquiditySourcingExclusionType, TreasuryProvider } from "@riocrypto/common";
3
+ interface LiquiditySourcingExclusionAttrs {
4
+ createdAt: Date;
5
+ type: LiquiditySourcingExclusionType;
6
+ provider: TreasuryProvider;
7
+ currencies?: (Crypto | Fiat)[];
8
+ originCurrencies?: Crypto[];
9
+ destinationCurrencies?: Crypto[];
10
+ reason?: string;
11
+ }
12
+ interface LiquiditySourcingExclusionDoc extends mongoose.Document, Omit<LiquiditySourcingExclusion, "id"> {
13
+ id: string;
14
+ }
15
+ interface LiquiditySourcingExclusionModel extends mongoose.Model<LiquiditySourcingExclusionDoc> {
16
+ build(attrs: LiquiditySourcingExclusionAttrs): LiquiditySourcingExclusionDoc;
17
+ }
18
+ declare const buildLiquiditySourcingExclusion: (mongooseInstance: mongoose.Mongoose) => LiquiditySourcingExclusionModel;
19
+ export { LiquiditySourcingExclusionAttrs, LiquiditySourcingExclusionDoc, LiquiditySourcingExclusionModel, buildLiquiditySourcingExclusion, };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildLiquiditySourcingExclusion = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const common_1 = require("@riocrypto/common");
9
+ const LiquiditySourcingExclusionSchema = new mongoose_1.default.Schema({
10
+ createdAt: { type: Date, required: true },
11
+ type: {
12
+ type: String,
13
+ enum: Object.values(common_1.LiquiditySourcingExclusionType),
14
+ required: true,
15
+ },
16
+ provider: {
17
+ type: String,
18
+ enum: Object.values(common_1.TreasuryProvider),
19
+ required: true,
20
+ },
21
+ currencies: { type: [String], default: [] },
22
+ originCurrencies: { type: [String], default: [] },
23
+ destinationCurrencies: { type: [String], default: [] },
24
+ reason: { type: String },
25
+ }, {
26
+ toJSON: {
27
+ transform(doc, ret) {
28
+ ret.id = ret._id;
29
+ delete ret._id;
30
+ delete ret.__v;
31
+ },
32
+ },
33
+ });
34
+ const buildLiquiditySourcingExclusion = (mongooseInstance) => {
35
+ if (mongooseInstance.models.LiquiditySourcingExclusion) {
36
+ return mongooseInstance.model("LiquiditySourcingExclusion");
37
+ }
38
+ LiquiditySourcingExclusionSchema.statics.build = (attrs) => {
39
+ return new LiquiditySourcingExclusionModelInstance(attrs);
40
+ };
41
+ const LiquiditySourcingExclusionModelInstance = mongooseInstance.model("LiquiditySourcingExclusion", LiquiditySourcingExclusionSchema);
42
+ return LiquiditySourcingExclusionModelInstance;
43
+ };
44
+ exports.buildLiquiditySourcingExclusion = buildLiquiditySourcingExclusion;
@@ -0,0 +1,24 @@
1
+ import mongoose from "mongoose";
2
+ import { Crypto, Fiat, LiquiditySourcingPlan, LiquiditySourcingPlanStatus, LiquiditySourcingStep, TreasuryProvider } from "@riocrypto/common";
3
+ interface LiquiditySourcingPlanAttrs {
4
+ createdAt: Date;
5
+ orderIds?: string[];
6
+ bulkBankPayoutId?: string;
7
+ bulkCryptoPayoutId?: string;
8
+ targetCurrency: Fiat | Crypto;
9
+ targetProvider: TreasuryProvider;
10
+ amountNeeded: number;
11
+ amountToSource: number;
12
+ status: LiquiditySourcingPlanStatus;
13
+ currentStepIndex: number;
14
+ steps: LiquiditySourcingStep[];
15
+ amountSourced?: number;
16
+ }
17
+ interface LiquiditySourcingPlanDoc extends mongoose.Document, Omit<LiquiditySourcingPlan, "id"> {
18
+ id: string;
19
+ }
20
+ interface LiquiditySourcingPlanModel extends mongoose.Model<LiquiditySourcingPlanDoc> {
21
+ build(attrs: LiquiditySourcingPlanAttrs): LiquiditySourcingPlanDoc;
22
+ }
23
+ declare const buildLiquiditySourcingPlan: (mongooseInstance: mongoose.Mongoose) => LiquiditySourcingPlanModel;
24
+ export { LiquiditySourcingPlanAttrs, LiquiditySourcingPlanDoc, LiquiditySourcingPlanModel, buildLiquiditySourcingPlan, };
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildLiquiditySourcingPlan = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const common_1 = require("@riocrypto/common");
9
+ const StepSchema = new mongoose_1.default.Schema({
10
+ type: {
11
+ type: String,
12
+ enum: Object.values(common_1.LiquiditySourcingStepType),
13
+ required: true,
14
+ },
15
+ status: {
16
+ type: String,
17
+ enum: Object.values(common_1.LiquiditySourcingStepStatus),
18
+ required: true,
19
+ },
20
+ startedAt: { type: Date },
21
+ origin: { type: String, enum: Object.values(common_1.TreasuryProvider) },
22
+ destination: { type: String, enum: Object.values(common_1.TreasuryProvider) },
23
+ currency: { type: String },
24
+ amount: { type: Number },
25
+ internalTransferId: { type: String },
26
+ provider: { type: String },
27
+ originCurrency: { type: String },
28
+ originAmount: { type: Number },
29
+ destinationCurrency: { type: String },
30
+ internalTradeId: { type: String },
31
+ externalTradeId: { type: String },
32
+ side: { type: String, enum: Object.values(common_1.Side) },
33
+ }, { _id: false });
34
+ const LiquiditySourcingPlanSchema = new mongoose_1.default.Schema({
35
+ createdAt: { type: Date, required: true },
36
+ orderIds: { type: [String], default: [] },
37
+ bulkBankPayoutId: { type: String },
38
+ bulkCryptoPayoutId: { type: String },
39
+ targetCurrency: { type: String, required: true },
40
+ targetProvider: {
41
+ type: String,
42
+ enum: Object.values(common_1.TreasuryProvider),
43
+ required: true,
44
+ },
45
+ amountNeeded: { type: Number, required: true },
46
+ amountToSource: { type: Number, required: true },
47
+ status: {
48
+ type: String,
49
+ enum: Object.values(common_1.LiquiditySourcingPlanStatus),
50
+ required: true,
51
+ },
52
+ currentStepIndex: { type: Number, required: true },
53
+ steps: { type: [StepSchema], required: true },
54
+ amountSourced: { type: Number },
55
+ }, {
56
+ toJSON: {
57
+ transform(doc, ret) {
58
+ ret.id = ret._id;
59
+ delete ret._id;
60
+ delete ret.__v;
61
+ },
62
+ },
63
+ });
64
+ const buildLiquiditySourcingPlan = (mongooseInstance) => {
65
+ if (mongooseInstance.models.LiquiditySourcingPlan) {
66
+ return mongooseInstance.model("LiquiditySourcingPlan");
67
+ }
68
+ LiquiditySourcingPlanSchema.statics.build = (attrs) => {
69
+ return new LiquiditySourcingPlanModelInstance(attrs);
70
+ };
71
+ const LiquiditySourcingPlanModelInstance = mongooseInstance.model("LiquiditySourcingPlan", LiquiditySourcingPlanSchema);
72
+ return LiquiditySourcingPlanModelInstance;
73
+ };
74
+ exports.buildLiquiditySourcingPlan = buildLiquiditySourcingPlan;
@@ -0,0 +1,16 @@
1
+ import mongoose from "mongoose";
2
+ import { LiquiditySourcingSettings } from "@riocrypto/common";
3
+ interface LiquiditySourcingSettingsAttrs {
4
+ mxnEnabled: boolean;
5
+ usdcEnabled: boolean;
6
+ usdtEnabled: boolean;
7
+ updatedAt: Date;
8
+ }
9
+ interface LiquiditySourcingSettingsDoc extends mongoose.Document, Omit<LiquiditySourcingSettings, "id"> {
10
+ id: string;
11
+ }
12
+ interface LiquiditySourcingSettingsModel extends mongoose.Model<LiquiditySourcingSettingsDoc> {
13
+ build(attrs: LiquiditySourcingSettingsAttrs): LiquiditySourcingSettingsDoc;
14
+ }
15
+ declare const buildLiquiditySourcingSettings: (mongooseInstance: mongoose.Mongoose) => LiquiditySourcingSettingsModel;
16
+ export { LiquiditySourcingSettingsAttrs, LiquiditySourcingSettingsDoc, LiquiditySourcingSettingsModel, buildLiquiditySourcingSettings, };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.buildLiquiditySourcingSettings = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const LiquiditySourcingSettingsSchema = new mongoose_1.default.Schema({
9
+ mxnEnabled: { type: Boolean, required: true, default: true },
10
+ usdcEnabled: { type: Boolean, required: true, default: true },
11
+ usdtEnabled: { type: Boolean, required: true, default: true },
12
+ updatedAt: { type: Date, required: true },
13
+ }, {
14
+ toJSON: {
15
+ transform(doc, ret) {
16
+ ret.id = ret._id;
17
+ delete ret._id;
18
+ delete ret.__v;
19
+ },
20
+ },
21
+ });
22
+ const buildLiquiditySourcingSettings = (mongooseInstance) => {
23
+ if (mongooseInstance.models.LiquiditySourcingSettings) {
24
+ return mongooseInstance.model("LiquiditySourcingSettings");
25
+ }
26
+ LiquiditySourcingSettingsSchema.statics.build = (attrs) => {
27
+ return new LiquiditySourcingSettingsModelInstance(attrs);
28
+ };
29
+ const LiquiditySourcingSettingsModelInstance = mongooseInstance.model("LiquiditySourcingSettings", LiquiditySourcingSettingsSchema);
30
+ return LiquiditySourcingSettingsModelInstance;
31
+ };
32
+ exports.buildLiquiditySourcingSettings = buildLiquiditySourcingSettings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2668",
3
+ "version": "1.0.2670",
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.2466",
31
+ "@riocrypto/common": "^1.0.2470",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",