@riocrypto/common-server 1.0.1176 → 1.0.1177

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
@@ -44,6 +44,7 @@ export * from "./models/chained-order";
44
44
  export * from "./models/bitso-bank-account";
45
45
  export * from "./models/bitso-receiving-account";
46
46
  export * from "./models/bitso-fx-order";
47
+ export * from "./models/internal-swap";
47
48
  export * from "./clients/bitstamp-client";
48
49
  export * from "./clients/ccxt-client";
49
50
  export * from "./clients/kushki-client";
package/build/index.js CHANGED
@@ -60,6 +60,7 @@ __exportStar(require("./models/chained-order"), exports);
60
60
  __exportStar(require("./models/bitso-bank-account"), exports);
61
61
  __exportStar(require("./models/bitso-receiving-account"), exports);
62
62
  __exportStar(require("./models/bitso-fx-order"), exports);
63
+ __exportStar(require("./models/internal-swap"), exports);
63
64
  __exportStar(require("./clients/bitstamp-client"), exports);
64
65
  __exportStar(require("./clients/ccxt-client"), exports);
65
66
  __exportStar(require("./clients/kushki-client"), exports);
@@ -0,0 +1,25 @@
1
+ import { Crypto } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface InternalSwapAttrs {
4
+ createdAt: Date;
5
+ adminId: string;
6
+ originCrypto: Crypto;
7
+ destinationCrypto: Crypto;
8
+ amount: number;
9
+ exchange: "coinbase";
10
+ status: "processing" | "complete" | "failed";
11
+ }
12
+ interface InternalSwapDoc extends Document {
13
+ createdAt: Date;
14
+ adminId: string;
15
+ originCrypto: Crypto;
16
+ destinationCrypto: Crypto;
17
+ amount: number;
18
+ exchange: "coinbase";
19
+ status: "processing" | "complete" | "failed";
20
+ }
21
+ interface InternalSwapModel extends Model<InternalSwapDoc> {
22
+ build(attrs: InternalSwapAttrs): InternalSwapDoc;
23
+ }
24
+ declare const buildInternalSwap: (mongoose: Mongoose) => InternalSwapModel;
25
+ export { buildInternalSwap, InternalSwapDoc };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildInternalSwap = void 0;
4
+ const buildInternalSwap = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.InternalSwap) {
7
+ return mongoose.model("InternalSwap");
8
+ }
9
+ const InternalSwapSchema = new mongoose.Schema({
10
+ adminId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ createdAt: {
15
+ type: mongoose.Schema.Types.Date,
16
+ required: true,
17
+ },
18
+ originCrypto: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ destinationCrypto: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ amount: {
27
+ type: Number,
28
+ required: true,
29
+ },
30
+ exchange: {
31
+ type: String,
32
+ required: true,
33
+ },
34
+ status: {
35
+ type: String,
36
+ required: true,
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
+ InternalSwapSchema.statics.build = (attrs) => {
48
+ return new InternalSwap(attrs);
49
+ };
50
+ const InternalSwap = mongoose.model("InternalSwap", InternalSwapSchema);
51
+ return InternalSwap;
52
+ };
53
+ exports.buildInternalSwap = buildInternalSwap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1176",
3
+ "version": "1.0.1177",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "@aws-sdk/client-s3": "^3.297.0",
27
27
  "@everapi/currencyapi-js": "^1.0.6",
28
28
  "@google-cloud/storage": "^6.9.5",
29
- "@riocrypto/common": "^1.0.1058",
29
+ "@riocrypto/common": "^1.0.1059",
30
30
  "@types/express": "^4.17.13",
31
31
  "axios": "^0.27.2",
32
32
  "ccxt": "^3.0.30",