@riocrypto/common-server 1.0.1779 → 1.0.1781

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.
@@ -1,4 +1,4 @@
1
- import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount } from "@riocrypto/common";
1
+ import { Quote, Fiat, Crypto, BitsoBankAccount, Side, Country, Order, CryptoAddress, BankAccount, ChainedQuote } from "@riocrypto/common";
2
2
  declare class ClusterClient {
3
3
  private baseUrl;
4
4
  private clusterApiKey;
@@ -6,6 +6,7 @@ declare class ClusterClient {
6
6
  constructor(baseUrl: string, clusterApiKey: string);
7
7
  getNewQuote(orderId: string, quote: Quote, newAmountFiat?: number, newAmountCrypto?: number): Promise<Quote>;
8
8
  getQuote(userId: string, side: Side, country: Country, fiat: Fiat, crypto: Crypto, amountFiat?: number, amountCrypto?: number, USBankTransferMethod?: "ach_push" | "wire"): Promise<Quote>;
9
+ getNewChainedQuote(chainedOrderId: string, chainedQuote: ChainedQuote, newOriginAmount?: number): Promise<ChainedQuote>;
9
10
  getBidQuote(userId: string, side: Side, country: Country, fiat: Fiat, crypto: Crypto, amountFiat?: number, amountCrypto?: number, USBankTransferMethod?: "ach_push" | "wire", netPrice?: string): Promise<Quote>;
10
11
  getCryptoAddresses(userId: string, crypto: Crypto): Promise<CryptoAddress[]>;
11
12
  createOrder(quoteId: string, cryptoAddress?: string, notes?: string, externalAccountId?: string): Promise<Order>;
@@ -104,6 +104,30 @@ class ClusterClient {
104
104
  return response.data.quote;
105
105
  });
106
106
  }
107
+ getNewChainedQuote(chainedOrderId, chainedQuote, newOriginAmount) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const response = yield this.axios.post(`${this.baseUrl}/api/quotes/chained`, {
110
+ chainedOrderId,
111
+ originFiat: chainedQuote.originFiat,
112
+ destinationFiat: chainedQuote.destinationFiat,
113
+ originAmountFiat: newOriginAmount,
114
+ originUserId: chainedQuote.originUserId,
115
+ destinationUserId: chainedQuote.destinationUserId,
116
+ crypto: chainedQuote.crypto,
117
+ originCountry: chainedQuote.originCountry,
118
+ destinationCountry: chainedQuote.destinationCountry,
119
+ discount: chainedQuote,
120
+ markup: chainedQuote.markup,
121
+ noMarkups: chainedQuote.noMarkups,
122
+ reissueAfterExpiration: chainedQuote.reissueAfterExpiration,
123
+ }, {
124
+ headers: {
125
+ "x-cluster-api-key": this.clusterApiKey,
126
+ },
127
+ });
128
+ return response.data.chainedQuote;
129
+ });
130
+ }
107
131
  getBidQuote(userId, side, country, fiat, crypto, amountFiat, amountCrypto, USBankTransferMethod, netPrice) {
108
132
  return __awaiter(this, void 0, void 0, function* () {
109
133
  const response = yield this.axios.post(`${this.baseUrl}/api/quotes`, {
@@ -22,6 +22,7 @@ interface ChainedOrderAttrs {
22
22
  createdAt: Date;
23
23
  brokerId?: string;
24
24
  notes?: string;
25
+ netPrice: number;
25
26
  }
26
27
  interface ChainedOrderDoc extends Document {
27
28
  originUserId: string;
@@ -45,6 +46,7 @@ interface ChainedOrderDoc extends Document {
45
46
  createdAt: Date;
46
47
  brokerId?: string;
47
48
  notes?: string;
49
+ netPrice: number;
48
50
  }
49
51
  interface ChainedOrderModel extends Model<ChainedOrderDoc> {
50
52
  build(attrs: ChainedOrderAttrs): ChainedOrderDoc;
@@ -98,6 +98,9 @@ const buildChainedOrder = (mongoose) => {
98
98
  type: mongoose.Schema.Types.Date,
99
99
  required: true,
100
100
  },
101
+ netPrice: {
102
+ type: Number,
103
+ },
101
104
  }, {
102
105
  toJSON: {
103
106
  transform(doc, ret) {
@@ -15,9 +15,14 @@ interface ChainedQuoteAttrs {
15
15
  destinationQuoteId: string;
16
16
  fees: Fees;
17
17
  price: number;
18
+ discount?: number;
19
+ markup?: number;
20
+ noMarkups: boolean;
21
+ isRequote: boolean;
22
+ reissueAfterExpiration: boolean;
18
23
  createdAt: Date;
19
24
  brokerId?: string;
20
- netPrice?: number;
25
+ netPrice: number;
21
26
  }
22
27
  interface ChainedQuoteDoc extends Document {
23
28
  originUserId: string;
@@ -34,9 +39,14 @@ interface ChainedQuoteDoc extends Document {
34
39
  destinationQuoteId: string;
35
40
  fees: Fees;
36
41
  price: number;
42
+ discount?: number;
43
+ markup?: number;
44
+ noMarkups: boolean;
45
+ isRequote: boolean;
46
+ reissueAfterExpiration: boolean;
37
47
  createdAt: Date;
38
48
  brokerId?: string;
39
- netPrice?: number;
49
+ netPrice: number;
40
50
  }
41
51
  interface ChainedQuoteModel extends Model<ChainedQuoteDoc> {
42
52
  build(attrs: ChainedQuoteAttrs): ChainedQuoteDoc;
@@ -71,6 +71,18 @@ const buildChainedQuote = (mongoose) => {
71
71
  price: {
72
72
  type: Number,
73
73
  },
74
+ discount: {
75
+ type: Number,
76
+ },
77
+ markup: {
78
+ type: Number,
79
+ },
80
+ noMarkups: {
81
+ type: Boolean,
82
+ },
83
+ isRequote: {
84
+ type: Boolean,
85
+ },
74
86
  brokerId: {
75
87
  type: String,
76
88
  },
@@ -44,6 +44,7 @@ interface OrderAttrs {
44
44
  USBankTransferMethod?: "wire" | "ach_push";
45
45
  isAfterHours?: boolean;
46
46
  chainedOrderId?: string;
47
+ netPrice: number;
47
48
  }
48
49
  interface OrderDoc extends Document {
49
50
  quoteId: string;
@@ -89,6 +90,7 @@ interface OrderDoc extends Document {
89
90
  USBankTransferMethod?: "wire" | "ach_push";
90
91
  isAfterHours?: boolean;
91
92
  chainedOrderId?: string;
93
+ netPrice: number;
92
94
  }
93
95
  interface OrderModel extends Model<OrderDoc> {
94
96
  build(attrs: OrderAttrs): OrderDoc;
@@ -197,6 +197,9 @@ const buildOrder = (mongoose) => {
197
197
  },
198
198
  },
199
199
  ],
200
+ netPrice: {
201
+ type: Number,
202
+ },
200
203
  }, {
201
204
  toJSON: {
202
205
  transform(doc, ret) {
@@ -30,7 +30,7 @@ interface QuoteAttrs {
30
30
  USBankTransferMethod?: "wire" | "ach_push";
31
31
  isBid?: boolean;
32
32
  isAfterHours?: boolean;
33
- netPrice?: number;
33
+ netPrice: number;
34
34
  }
35
35
  interface QuoteDoc extends Document {
36
36
  userId: string;
@@ -62,7 +62,7 @@ interface QuoteDoc extends Document {
62
62
  USBankTransferMethod?: "wire" | "ach_push";
63
63
  isBid?: boolean;
64
64
  isAfterHours?: boolean;
65
- netPrice?: number;
65
+ netPrice: number;
66
66
  }
67
67
  interface QuoteModel extends Model<QuoteDoc> {
68
68
  build(attrs: QuoteAttrs): QuoteDoc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1779",
3
+ "version": "1.0.1781",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "@google-cloud/secret-manager": "^5.3.0",
27
27
  "@google-cloud/storage": "^6.9.5",
28
28
  "@hyperdx/node-opentelemetry": "^0.4.2",
29
- "@riocrypto/common": "^1.0.1574",
29
+ "@riocrypto/common": "^1.0.1579",
30
30
  "@types/express": "^4.17.13",
31
31
  "axios": "^1.6.0",
32
32
  "crypto-js": "^4.2.0",