@riocrypto/common-server 1.0.1780 → 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`, {
|
|
@@ -15,6 +15,11 @@ 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
25
|
netPrice: number;
|
|
@@ -34,6 +39,11 @@ 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
49
|
netPrice: number;
|
|
@@ -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
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
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.
|
|
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",
|