@codedartdev/coinsentry-sdk 0.1.0
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/README.md +271 -0
- package/dist/brand/config.d.ts +78 -0
- package/dist/brand/config.d.ts.map +1 -0
- package/dist/brand/config.js +274 -0
- package/dist/brand/config.js.map +1 -0
- package/dist/brand/index.d.ts +4 -0
- package/dist/brand/index.d.ts.map +1 -0
- package/dist/brand/index.js +2 -0
- package/dist/brand/index.js.map +1 -0
- package/dist/brand/types.d.ts +122 -0
- package/dist/brand/types.d.ts.map +1 -0
- package/dist/brand/types.js +2 -0
- package/dist/brand/types.js.map +1 -0
- package/dist/client.d.ts +169 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +239 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +32 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +143 -0
- package/dist/errors.js.map +1 -0
- package/dist/guards.d.ts +12 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +76 -0
- package/dist/guards.js.map +1 -0
- package/dist/http.d.ts +38 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +175 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/kyc/config.d.ts +20 -0
- package/dist/kyc/config.d.ts.map +1 -0
- package/dist/kyc/config.js +224 -0
- package/dist/kyc/config.js.map +1 -0
- package/dist/kyc/flow.d.ts +37 -0
- package/dist/kyc/flow.d.ts.map +1 -0
- package/dist/kyc/flow.js +329 -0
- package/dist/kyc/flow.js.map +1 -0
- package/dist/kyc/index.d.ts +6 -0
- package/dist/kyc/index.d.ts.map +1 -0
- package/dist/kyc/index.js +4 -0
- package/dist/kyc/index.js.map +1 -0
- package/dist/kyc/locale.d.ts +17 -0
- package/dist/kyc/locale.d.ts.map +1 -0
- package/dist/kyc/locale.js +40 -0
- package/dist/kyc/locale.js.map +1 -0
- package/dist/kyc/types.d.ts +289 -0
- package/dist/kyc/types.d.ts.map +1 -0
- package/dist/kyc/types.js +2 -0
- package/dist/kyc/types.js.map +1 -0
- package/dist/products.d.ts +280 -0
- package/dist/products.d.ts.map +1 -0
- package/dist/products.js +302 -0
- package/dist/products.js.map +1 -0
- package/dist/realtime.d.ts +33 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +28 -0
- package/dist/realtime.js.map +1 -0
- package/dist/types.d.ts +145 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { CoinSentryHttpRequest } from './http.js';
|
|
2
|
+
export type CoinSentryRequestOptions = {
|
|
3
|
+
signal?: AbortSignal;
|
|
4
|
+
};
|
|
5
|
+
export type CoinSentryQueryValue = string | number | boolean | null | undefined;
|
|
6
|
+
export type CoinSentryQuery = Record<string, CoinSentryQueryValue>;
|
|
7
|
+
export type CoinSentryPaginationParams = {
|
|
8
|
+
page?: number;
|
|
9
|
+
per_page?: number;
|
|
10
|
+
};
|
|
11
|
+
export type CoinSentryPaginationMeta = {
|
|
12
|
+
current_page: number;
|
|
13
|
+
per_page: number;
|
|
14
|
+
total: number;
|
|
15
|
+
last_page: number;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
export type CoinSentryEnvelope<T> = {
|
|
19
|
+
success?: boolean;
|
|
20
|
+
data?: T;
|
|
21
|
+
meta?: CoinSentryPaginationMeta;
|
|
22
|
+
message?: string;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
export type CoinSentryTwoFactorStatus = {
|
|
26
|
+
two_factor_enabled: boolean;
|
|
27
|
+
two_factor_confirmed: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type CoinSentryPasswordResetPayload = {
|
|
30
|
+
email: string;
|
|
31
|
+
slideCaptchaToken: string;
|
|
32
|
+
};
|
|
33
|
+
export type CoinSentryResetPasswordPayload = {
|
|
34
|
+
token: string;
|
|
35
|
+
email: string;
|
|
36
|
+
password: string;
|
|
37
|
+
password_confirmation: string;
|
|
38
|
+
};
|
|
39
|
+
export type CoinSentryOtcCoin = {
|
|
40
|
+
id: number;
|
|
41
|
+
coin_tag: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
section: 'cryptocurrency' | 'fiat';
|
|
45
|
+
main_network_id: number;
|
|
46
|
+
available: boolean;
|
|
47
|
+
deposit_enabled: boolean;
|
|
48
|
+
withdraw_enabled: boolean;
|
|
49
|
+
markets_enabled: boolean;
|
|
50
|
+
color: string;
|
|
51
|
+
precision: number;
|
|
52
|
+
tag_required: boolean;
|
|
53
|
+
tag_delimiter: string | null;
|
|
54
|
+
confirmations?: number;
|
|
55
|
+
release_at: string;
|
|
56
|
+
closed_at: string | null;
|
|
57
|
+
created_at: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
};
|
|
60
|
+
export type CoinSentryOtcAvailableCoin = {
|
|
61
|
+
tag: string;
|
|
62
|
+
name: string;
|
|
63
|
+
precision: number;
|
|
64
|
+
description: string;
|
|
65
|
+
section: 'cryptocurrency' | 'fiat';
|
|
66
|
+
main_network: {
|
|
67
|
+
tag: string;
|
|
68
|
+
name: string;
|
|
69
|
+
icon: string | null;
|
|
70
|
+
} | null;
|
|
71
|
+
deposit_enabled: boolean;
|
|
72
|
+
withdraw_enabled: boolean;
|
|
73
|
+
markets_enabled: boolean;
|
|
74
|
+
color: string;
|
|
75
|
+
tag_required: boolean;
|
|
76
|
+
tag_delimiter: string | null;
|
|
77
|
+
};
|
|
78
|
+
export type CoinSentryOtcTradingPair = {
|
|
79
|
+
id: number;
|
|
80
|
+
symbol: string;
|
|
81
|
+
base_currency: string;
|
|
82
|
+
quote_currency: string;
|
|
83
|
+
is_active: boolean;
|
|
84
|
+
min_order_size: string;
|
|
85
|
+
max_order_size: string;
|
|
86
|
+
price_precision: number;
|
|
87
|
+
quantity_precision: number;
|
|
88
|
+
fee_percentage: string;
|
|
89
|
+
maker_fee: string;
|
|
90
|
+
taker_fee: string;
|
|
91
|
+
created_at: string;
|
|
92
|
+
updated_at: string;
|
|
93
|
+
base_coin?: CoinSentryOtcCoin | null;
|
|
94
|
+
quote_coin?: CoinSentryOtcCoin | null;
|
|
95
|
+
};
|
|
96
|
+
export type CoinSentryOtcTradingPairsResponse = {
|
|
97
|
+
trading_pairs: CoinSentryOtcTradingPair[];
|
|
98
|
+
base_currency: CoinSentryOtcCoin | null;
|
|
99
|
+
quote_currency: CoinSentryOtcCoin | null;
|
|
100
|
+
available_coins: CoinSentryOtcAvailableCoin[];
|
|
101
|
+
};
|
|
102
|
+
export type CoinSentryOtcConvertQuoteRequest = {
|
|
103
|
+
symbol: string;
|
|
104
|
+
from_currency: string;
|
|
105
|
+
to_currency: string;
|
|
106
|
+
from_amount: string;
|
|
107
|
+
};
|
|
108
|
+
export type CoinSentryOtcConvertQuote = {
|
|
109
|
+
quote_id: string;
|
|
110
|
+
from_currency: string;
|
|
111
|
+
to_currency: string;
|
|
112
|
+
from_amount: string;
|
|
113
|
+
to_amount: string;
|
|
114
|
+
price: string;
|
|
115
|
+
inverse_price: string;
|
|
116
|
+
fee: string;
|
|
117
|
+
fee_currency: string;
|
|
118
|
+
status: 'PENDING';
|
|
119
|
+
expires_at: string;
|
|
120
|
+
created_at: string;
|
|
121
|
+
symbol: string;
|
|
122
|
+
display_price: string;
|
|
123
|
+
base_currency: string;
|
|
124
|
+
quote_currency: string;
|
|
125
|
+
side: 'BUY' | 'SELL';
|
|
126
|
+
spread_amount_quote: string;
|
|
127
|
+
fee_quote: string;
|
|
128
|
+
};
|
|
129
|
+
export type CoinSentryOtcConvertExecuteRequest = {
|
|
130
|
+
quote_id: string;
|
|
131
|
+
};
|
|
132
|
+
export type CoinSentryOtcConvertResult = {
|
|
133
|
+
id: number;
|
|
134
|
+
entity_id: number;
|
|
135
|
+
quote_id: string;
|
|
136
|
+
from_currency: string;
|
|
137
|
+
to_currency: string;
|
|
138
|
+
from_amount: string;
|
|
139
|
+
to_amount: string;
|
|
140
|
+
price: string;
|
|
141
|
+
fee: string;
|
|
142
|
+
fee_currency: string;
|
|
143
|
+
status: 'COMPLETED' | 'FAILED';
|
|
144
|
+
error_message: string | null;
|
|
145
|
+
created_at: string;
|
|
146
|
+
completed_at: string;
|
|
147
|
+
};
|
|
148
|
+
export type CoinSentryOtcRecurringPlanRequest = {
|
|
149
|
+
name: string;
|
|
150
|
+
from_currency: string;
|
|
151
|
+
to_currency: string;
|
|
152
|
+
amount: string;
|
|
153
|
+
frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY';
|
|
154
|
+
price_limit?: string;
|
|
155
|
+
max_period_days?: number;
|
|
156
|
+
};
|
|
157
|
+
export type CoinSentryOtcRecurringPlan = {
|
|
158
|
+
id: number;
|
|
159
|
+
entity_id: number;
|
|
160
|
+
name: string;
|
|
161
|
+
from_currency: string;
|
|
162
|
+
to_currency: string;
|
|
163
|
+
amount: string;
|
|
164
|
+
frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY';
|
|
165
|
+
status: 'ACTIVE' | 'PAUSED' | 'CANCELLED' | 'COMPLETED';
|
|
166
|
+
price_limit: string | null;
|
|
167
|
+
max_period_days: number | null;
|
|
168
|
+
next_execution_at: string | null;
|
|
169
|
+
last_execution_at: string | null;
|
|
170
|
+
executed_count: number;
|
|
171
|
+
total_invested: string;
|
|
172
|
+
total_received: string;
|
|
173
|
+
average_price: string;
|
|
174
|
+
success_rate: string;
|
|
175
|
+
created_at: string;
|
|
176
|
+
updated_at: string;
|
|
177
|
+
};
|
|
178
|
+
export type CoinSentryOtcRecurringExecution = {
|
|
179
|
+
id: number;
|
|
180
|
+
plan_id: number;
|
|
181
|
+
from_amount: string;
|
|
182
|
+
to_amount: string;
|
|
183
|
+
price: string;
|
|
184
|
+
fee: string;
|
|
185
|
+
status: 'SUCCESS' | 'FAILED' | 'SKIPPED';
|
|
186
|
+
error_message: string | null;
|
|
187
|
+
executed_at: string;
|
|
188
|
+
};
|
|
189
|
+
type CoinSentryRequest = <T>(input: CoinSentryHttpRequest) => Promise<T>;
|
|
190
|
+
export declare function createCoinSentryProductServices(request: CoinSentryRequest): {
|
|
191
|
+
account: {
|
|
192
|
+
twoFactor: {
|
|
193
|
+
enable: () => Promise<unknown>;
|
|
194
|
+
qrCode: () => Promise<{
|
|
195
|
+
svg: string;
|
|
196
|
+
}>;
|
|
197
|
+
confirm: (code: string) => Promise<unknown>;
|
|
198
|
+
recoveryCodes: () => Promise<string[]>;
|
|
199
|
+
regenerateRecoveryCodes: () => Promise<string[]>;
|
|
200
|
+
disable: () => Promise<unknown>;
|
|
201
|
+
status: () => Promise<CoinSentryTwoFactorStatus>;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
contacts: {
|
|
205
|
+
bank: {
|
|
206
|
+
list: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
207
|
+
create: <T = unknown>(payload: unknown) => Promise<T>;
|
|
208
|
+
delete: (id: number) => Promise<unknown>;
|
|
209
|
+
};
|
|
210
|
+
banks: {
|
|
211
|
+
list: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
212
|
+
};
|
|
213
|
+
wallet: {
|
|
214
|
+
getByNetwork: <T = unknown>(network: string, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
215
|
+
create: <T = unknown>(payload: unknown) => Promise<T>;
|
|
216
|
+
update: <T = unknown>(payload: unknown) => Promise<T>;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
deposits: {
|
|
220
|
+
get: <T = unknown>(currency: string, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
221
|
+
createIntent: <T = unknown>(payload: unknown) => Promise<T>;
|
|
222
|
+
};
|
|
223
|
+
withdrawals: {
|
|
224
|
+
get: <T = unknown>(currency: string, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
225
|
+
fiat: <T = unknown>(payload: unknown) => Promise<T>;
|
|
226
|
+
crypto: <T = unknown>(payload: unknown) => Promise<T>;
|
|
227
|
+
networkFee: <T = unknown>(query: CoinSentryQuery, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
228
|
+
};
|
|
229
|
+
payments: {
|
|
230
|
+
getCurrencies: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
231
|
+
getHistory: <T = unknown>(query?: CoinSentryPaginationParams, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
232
|
+
createReceiveIntent: <T = unknown>(payload: unknown) => Promise<T>;
|
|
233
|
+
getReceiveStatus: <T = unknown>(id: string, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
234
|
+
lookup: <T = unknown>(payload: unknown) => Promise<T>;
|
|
235
|
+
pay: <T = unknown>(payload: unknown) => Promise<T>;
|
|
236
|
+
};
|
|
237
|
+
affiliate: {
|
|
238
|
+
getCode: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
239
|
+
getStatus: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
240
|
+
getReferrals: <T = unknown>(query?: CoinSentryPaginationParams, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
241
|
+
getPayouts: <T = unknown>(query?: CoinSentryPaginationParams & {
|
|
242
|
+
type?: string;
|
|
243
|
+
}, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
244
|
+
getRankingsByValueReceived: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
245
|
+
getRankingsByActiveReferrals: <T = unknown>(options?: CoinSentryRequestOptions) => Promise<T>;
|
|
246
|
+
};
|
|
247
|
+
market: {
|
|
248
|
+
getOrderbook: <T = unknown>(symbol: string, depth?: number, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
249
|
+
getMarket: <T = unknown>(symbol: string, options?: CoinSentryRequestOptions) => Promise<T>;
|
|
250
|
+
createOrder: <T = unknown>(payload: unknown) => Promise<T>;
|
|
251
|
+
cancelOrder: (orderId: number) => Promise<unknown>;
|
|
252
|
+
cancelAllOrders: (symbol: string) => Promise<unknown>;
|
|
253
|
+
};
|
|
254
|
+
otc: {
|
|
255
|
+
createQuote: (payload: CoinSentryOtcConvertQuoteRequest) => Promise<CoinSentryOtcConvertQuote>;
|
|
256
|
+
executeConvert: (payload: CoinSentryOtcConvertExecuteRequest) => Promise<CoinSentryOtcConvertResult>;
|
|
257
|
+
getConvertHistory: (query?: CoinSentryPaginationParams) => Promise<{
|
|
258
|
+
data: CoinSentryOtcConvertResult[];
|
|
259
|
+
meta: CoinSentryPaginationMeta;
|
|
260
|
+
}>;
|
|
261
|
+
activateQuote: (quoteId: string) => Promise<unknown>;
|
|
262
|
+
deactivateQuote: (quoteId: string) => Promise<unknown>;
|
|
263
|
+
getRecurringPlans: (query?: {
|
|
264
|
+
status?: string;
|
|
265
|
+
}) => Promise<CoinSentryOtcRecurringPlan[]>;
|
|
266
|
+
createRecurringPlan: (payload: CoinSentryOtcRecurringPlanRequest) => Promise<CoinSentryOtcRecurringPlan>;
|
|
267
|
+
getRecurringPlan: (id: number) => Promise<CoinSentryOtcRecurringPlan>;
|
|
268
|
+
updateRecurringPlan: (id: number, payload: Partial<CoinSentryOtcRecurringPlanRequest>) => Promise<CoinSentryOtcRecurringPlan>;
|
|
269
|
+
cancelRecurringPlan: (id: number) => Promise<unknown>;
|
|
270
|
+
pauseRecurringPlan: (id: number) => Promise<CoinSentryOtcRecurringPlan>;
|
|
271
|
+
activateRecurringPlan: (id: number) => Promise<CoinSentryOtcRecurringPlan>;
|
|
272
|
+
getRecurringExecutions: (id: number, query?: CoinSentryPaginationParams) => Promise<{
|
|
273
|
+
data: CoinSentryOtcRecurringExecution[];
|
|
274
|
+
meta: CoinSentryPaginationMeta;
|
|
275
|
+
}>;
|
|
276
|
+
getTradingPairs: (symbol?: string) => Promise<CoinSentryOtcTradingPairsResponse>;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
export {};
|
|
280
|
+
//# sourceMappingURL=products.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAGvD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAEnE,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB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,OAAO;+BAKpB,MAAM;kCAIH,MAAM;;;+BAOH,gCAAgC;kCAM7B,kCAAkC;oCAMhC,0BAA0B;;kBA3Oa,wBAAwB;;iCAiPxE,MAAM;mCAIJ,MAAM;oCAIC;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE;uCAMhB,iCAAiC;+BAMzC,MAAM;kCAKH,MAAM,WAAW,OAAO,CAAC,iCAAiC,CAAC;kCAMjE,MAAM;iCAID,MAAM;oCAKH,MAAM;qCAKL,MAAM,UAAU,0BAA0B;;kBA9RJ,wBAAwB;;8CAoSnD,OAAO,CAAC,iCAAiC,CAAC;;EAqB7F"}
|
package/dist/products.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
function dataOrPayload(payload) {
|
|
2
|
+
if (payload
|
|
3
|
+
&& typeof payload === 'object'
|
|
4
|
+
&& 'data' in payload
|
|
5
|
+
&& payload.data !== undefined) {
|
|
6
|
+
return payload.data;
|
|
7
|
+
}
|
|
8
|
+
return payload;
|
|
9
|
+
}
|
|
10
|
+
function envelopePage(payload) {
|
|
11
|
+
return {
|
|
12
|
+
data: payload.data ?? [],
|
|
13
|
+
meta: payload.meta ?? {
|
|
14
|
+
current_page: 1,
|
|
15
|
+
per_page: payload.data?.length ?? 0,
|
|
16
|
+
total: payload.data?.length ?? 0,
|
|
17
|
+
last_page: 1,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function requestOptions(options) {
|
|
22
|
+
return options?.signal ? { signal: options.signal } : {};
|
|
23
|
+
}
|
|
24
|
+
export function createCoinSentryProductServices(request) {
|
|
25
|
+
return {
|
|
26
|
+
account: {
|
|
27
|
+
twoFactor: {
|
|
28
|
+
enable: () => request({ method: 'POST', path: '/auth/user/two-factor-authentication' }),
|
|
29
|
+
qrCode: async () => dataOrPayload(await request({
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: '/auth/user/two-factor-qr-code',
|
|
32
|
+
})),
|
|
33
|
+
confirm: (code) => request({
|
|
34
|
+
method: 'POST',
|
|
35
|
+
path: '/auth/user/confirmed-two-factor-authentication',
|
|
36
|
+
body: { code },
|
|
37
|
+
}),
|
|
38
|
+
recoveryCodes: () => request({
|
|
39
|
+
method: 'GET',
|
|
40
|
+
path: '/auth/user/two-factor-recovery-codes',
|
|
41
|
+
}),
|
|
42
|
+
regenerateRecoveryCodes: () => request({
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: '/auth/user/two-factor-recovery-codes',
|
|
45
|
+
}),
|
|
46
|
+
disable: () => request({
|
|
47
|
+
method: 'DELETE',
|
|
48
|
+
path: '/auth/user/two-factor-authentication',
|
|
49
|
+
}),
|
|
50
|
+
status: () => request({
|
|
51
|
+
method: 'GET',
|
|
52
|
+
path: '/auth/user/confirmed-password-status',
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
contacts: {
|
|
57
|
+
bank: {
|
|
58
|
+
list: (options) => request({
|
|
59
|
+
method: 'GET',
|
|
60
|
+
path: '/api/bank-contacts',
|
|
61
|
+
...requestOptions(options),
|
|
62
|
+
}),
|
|
63
|
+
create: (payload) => request({
|
|
64
|
+
method: 'POST',
|
|
65
|
+
path: '/api/bank-contacts',
|
|
66
|
+
body: payload,
|
|
67
|
+
}),
|
|
68
|
+
delete: (id) => request({
|
|
69
|
+
method: 'DELETE',
|
|
70
|
+
path: `/api/bank-contacts/${id}`,
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
banks: {
|
|
74
|
+
list: (options) => request({
|
|
75
|
+
method: 'GET',
|
|
76
|
+
path: '/api/banks',
|
|
77
|
+
...requestOptions(options),
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
wallet: {
|
|
81
|
+
getByNetwork: (network, options) => request({
|
|
82
|
+
method: 'GET',
|
|
83
|
+
path: `/api/v1/wallet-contacts/${network}`,
|
|
84
|
+
...requestOptions(options),
|
|
85
|
+
}),
|
|
86
|
+
create: (payload) => request({
|
|
87
|
+
method: 'POST',
|
|
88
|
+
path: '/api/v1/wallet-contacts',
|
|
89
|
+
body: payload,
|
|
90
|
+
}),
|
|
91
|
+
update: (payload) => request({
|
|
92
|
+
method: 'POST',
|
|
93
|
+
path: '/api/v1/wallet-contacts/edit',
|
|
94
|
+
body: payload,
|
|
95
|
+
}),
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
deposits: {
|
|
99
|
+
get: (currency, options) => request({
|
|
100
|
+
method: 'GET',
|
|
101
|
+
path: `/api/deposit/${currency}`,
|
|
102
|
+
...requestOptions(options),
|
|
103
|
+
}),
|
|
104
|
+
createIntent: (payload) => request({
|
|
105
|
+
method: 'POST',
|
|
106
|
+
path: '/api/v1/depositIntent',
|
|
107
|
+
body: payload,
|
|
108
|
+
}),
|
|
109
|
+
},
|
|
110
|
+
withdrawals: {
|
|
111
|
+
get: (currency, options) => request({
|
|
112
|
+
method: 'GET',
|
|
113
|
+
path: `/api/withdraw/${currency}`,
|
|
114
|
+
...requestOptions(options),
|
|
115
|
+
}),
|
|
116
|
+
fiat: (payload) => request({
|
|
117
|
+
method: 'POST',
|
|
118
|
+
path: '/api/withdrawals/fiat',
|
|
119
|
+
body: payload,
|
|
120
|
+
}),
|
|
121
|
+
crypto: (payload) => request({
|
|
122
|
+
method: 'POST',
|
|
123
|
+
path: '/api/withdrawals/crypto',
|
|
124
|
+
body: payload,
|
|
125
|
+
}),
|
|
126
|
+
networkFee: (query, options) => request({
|
|
127
|
+
method: 'GET',
|
|
128
|
+
path: '/api/withdrawals/network-fee',
|
|
129
|
+
query,
|
|
130
|
+
...requestOptions(options),
|
|
131
|
+
}),
|
|
132
|
+
},
|
|
133
|
+
payments: {
|
|
134
|
+
getCurrencies: (options) => request({
|
|
135
|
+
method: 'GET',
|
|
136
|
+
path: '/api/payments/currencies',
|
|
137
|
+
...requestOptions(options),
|
|
138
|
+
}),
|
|
139
|
+
getHistory: (query, options) => request({
|
|
140
|
+
method: 'GET',
|
|
141
|
+
path: '/api/payments/history',
|
|
142
|
+
query,
|
|
143
|
+
...requestOptions(options),
|
|
144
|
+
}),
|
|
145
|
+
createReceiveIntent: (payload) => request({
|
|
146
|
+
method: 'POST',
|
|
147
|
+
path: '/api/payments/pix/receive',
|
|
148
|
+
body: payload,
|
|
149
|
+
}),
|
|
150
|
+
getReceiveStatus: (id, options) => request({
|
|
151
|
+
method: 'GET',
|
|
152
|
+
path: `/api/payments/pix/receive/${id}`,
|
|
153
|
+
...requestOptions(options),
|
|
154
|
+
}),
|
|
155
|
+
lookup: (payload) => request({
|
|
156
|
+
method: 'POST',
|
|
157
|
+
path: '/api/payments/pix/lookup',
|
|
158
|
+
body: payload,
|
|
159
|
+
}),
|
|
160
|
+
pay: (payload) => request({
|
|
161
|
+
method: 'POST',
|
|
162
|
+
path: '/api/payments/pix/pay',
|
|
163
|
+
body: payload,
|
|
164
|
+
}),
|
|
165
|
+
},
|
|
166
|
+
affiliate: {
|
|
167
|
+
getCode: (options) => request({
|
|
168
|
+
method: 'GET',
|
|
169
|
+
path: '/api/v1/affiliate/code',
|
|
170
|
+
...requestOptions(options),
|
|
171
|
+
}),
|
|
172
|
+
getStatus: (options) => request({
|
|
173
|
+
method: 'GET',
|
|
174
|
+
path: '/api/v1/affiliate/status',
|
|
175
|
+
...requestOptions(options),
|
|
176
|
+
}),
|
|
177
|
+
getReferrals: (query, options) => request({
|
|
178
|
+
method: 'GET',
|
|
179
|
+
path: '/api/v1/affiliate/referrals',
|
|
180
|
+
query,
|
|
181
|
+
...requestOptions(options),
|
|
182
|
+
}),
|
|
183
|
+
getPayouts: (query, options) => request({
|
|
184
|
+
method: 'GET',
|
|
185
|
+
path: '/api/v1/affiliate/payouts',
|
|
186
|
+
query,
|
|
187
|
+
...requestOptions(options),
|
|
188
|
+
}),
|
|
189
|
+
getRankingsByValueReceived: (options) => request({
|
|
190
|
+
method: 'GET',
|
|
191
|
+
path: '/api/v1/affiliate/rankings/value-received',
|
|
192
|
+
...requestOptions(options),
|
|
193
|
+
}),
|
|
194
|
+
getRankingsByActiveReferrals: (options) => request({
|
|
195
|
+
method: 'GET',
|
|
196
|
+
path: '/api/v1/affiliate/rankings/active-referrals',
|
|
197
|
+
...requestOptions(options),
|
|
198
|
+
}),
|
|
199
|
+
},
|
|
200
|
+
market: {
|
|
201
|
+
getOrderbook: (symbol, depth, options) => request({
|
|
202
|
+
method: 'GET',
|
|
203
|
+
path: `/api/v1/orderbook/${symbol}`,
|
|
204
|
+
query: depth ? { depth } : undefined,
|
|
205
|
+
...requestOptions(options),
|
|
206
|
+
}),
|
|
207
|
+
getMarket: (symbol, options) => request({
|
|
208
|
+
method: 'GET',
|
|
209
|
+
path: `/api/v1/market/${symbol}`,
|
|
210
|
+
...requestOptions(options),
|
|
211
|
+
}),
|
|
212
|
+
createOrder: (payload) => request({
|
|
213
|
+
method: 'POST',
|
|
214
|
+
path: '/api/v1/createOrder',
|
|
215
|
+
body: payload,
|
|
216
|
+
}),
|
|
217
|
+
cancelOrder: (orderId) => request({
|
|
218
|
+
method: 'DELETE',
|
|
219
|
+
path: `/api/v1/order/${orderId}`,
|
|
220
|
+
}),
|
|
221
|
+
cancelAllOrders: (symbol) => request({
|
|
222
|
+
method: 'DELETE',
|
|
223
|
+
path: '/api/v1/orders/cancel-all',
|
|
224
|
+
body: { symbol },
|
|
225
|
+
}),
|
|
226
|
+
},
|
|
227
|
+
otc: {
|
|
228
|
+
createQuote: async (payload) => dataOrPayload(await request({
|
|
229
|
+
method: 'POST',
|
|
230
|
+
path: '/api/v1/otc/convert/quote',
|
|
231
|
+
body: payload,
|
|
232
|
+
})),
|
|
233
|
+
executeConvert: async (payload) => dataOrPayload(await request({
|
|
234
|
+
method: 'POST',
|
|
235
|
+
path: '/api/v1/otc/convert/execute',
|
|
236
|
+
body: payload,
|
|
237
|
+
})),
|
|
238
|
+
getConvertHistory: async (query) => envelopePage(await request({
|
|
239
|
+
method: 'GET',
|
|
240
|
+
path: '/api/v1/otc/convert/history',
|
|
241
|
+
query,
|
|
242
|
+
})),
|
|
243
|
+
activateQuote: (quoteId) => request({
|
|
244
|
+
method: 'POST',
|
|
245
|
+
path: `/api/v1/otc/convert/quote/${quoteId}/activate`,
|
|
246
|
+
}),
|
|
247
|
+
deactivateQuote: (quoteId) => request({
|
|
248
|
+
method: 'POST',
|
|
249
|
+
path: `/api/v1/otc/convert/quote/${quoteId}/deactivate`,
|
|
250
|
+
}),
|
|
251
|
+
getRecurringPlans: async (query) => dataOrPayload(await request({
|
|
252
|
+
method: 'GET',
|
|
253
|
+
path: '/api/v1/otc/recurring/plans',
|
|
254
|
+
query,
|
|
255
|
+
})),
|
|
256
|
+
createRecurringPlan: async (payload) => dataOrPayload(await request({
|
|
257
|
+
method: 'POST',
|
|
258
|
+
path: '/api/v1/otc/recurring/plans',
|
|
259
|
+
body: payload,
|
|
260
|
+
})),
|
|
261
|
+
getRecurringPlan: async (id) => dataOrPayload(await request({
|
|
262
|
+
method: 'GET',
|
|
263
|
+
path: `/api/v1/otc/recurring/plans/${id}`,
|
|
264
|
+
})),
|
|
265
|
+
updateRecurringPlan: async (id, payload) => dataOrPayload(await request({
|
|
266
|
+
method: 'PATCH',
|
|
267
|
+
path: `/api/v1/otc/recurring/plans/${id}`,
|
|
268
|
+
body: payload,
|
|
269
|
+
})),
|
|
270
|
+
cancelRecurringPlan: (id) => request({
|
|
271
|
+
method: 'DELETE',
|
|
272
|
+
path: `/api/v1/otc/recurring/plans/${id}`,
|
|
273
|
+
}),
|
|
274
|
+
pauseRecurringPlan: async (id) => dataOrPayload(await request({
|
|
275
|
+
method: 'POST',
|
|
276
|
+
path: `/api/v1/otc/recurring/plans/${id}/pause`,
|
|
277
|
+
})),
|
|
278
|
+
activateRecurringPlan: async (id) => dataOrPayload(await request({
|
|
279
|
+
method: 'POST',
|
|
280
|
+
path: `/api/v1/otc/recurring/plans/${id}/activate`,
|
|
281
|
+
})),
|
|
282
|
+
getRecurringExecutions: async (id, query) => envelopePage(await request({
|
|
283
|
+
method: 'GET',
|
|
284
|
+
path: `/api/v1/otc/recurring/plans/${id}/executions`,
|
|
285
|
+
query,
|
|
286
|
+
})),
|
|
287
|
+
getTradingPairs: async (symbol = 'BTC_USDT') => {
|
|
288
|
+
const payload = await request({
|
|
289
|
+
method: 'GET',
|
|
290
|
+
path: `/api/v1/market/${symbol}`,
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
trading_pairs: payload.trading_pairs ?? [],
|
|
294
|
+
base_currency: payload.base_currency ?? null,
|
|
295
|
+
quote_currency: payload.quote_currency ?? null,
|
|
296
|
+
available_coins: payload.available_coins ?? [],
|
|
297
|
+
};
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAmNA,SAAS,aAAa,CAAI,OAAkC;IAC1D,IACE,OAAO;WACJ,OAAO,OAAO,KAAK,QAAQ;WAC3B,MAAM,IAAI,OAAO;WAChB,OAAiC,CAAC,IAAI,KAAK,SAAS,EACxD,CAAC;QACD,OAAQ,OAAiC,CAAC,IAAS,CAAC;IACtD,CAAC;IAED,OAAO,OAAY,CAAC;AACtB,CAAC;AAED,SAAS,YAAY,CAAI,OAAgC;IACvD,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI;YACpB,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;YACnC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;YAChC,SAAS,EAAE,CAAC;SACb;KACF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAAkC;IACxD,OAAO,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,E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AAG,MAAM,OAAO,CAM1B;oBACD,MAAM,EAAE,KAAK;oBACb,IAAI,EAAE,kBAAkB,MAAM,EAAE;iBACjC,CAAC,CAAC;gBAEH,OAAO;oBACL,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;oBAC1C,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI;oBAC5C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,IAAI;oBAC9C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,EAAE;iBAC/C,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { CoinSentryHttpRequest } from './http.js';\nimport type { CoinSentryLoginResponse } from './types.js';\n\nexport type CoinSentryRequestOptions = {\n signal?: AbortSignal;\n};\n\nexport type CoinSentryQueryValue = string | number | boolean | null | undefined;\nexport type CoinSentryQuery = Record<string, CoinSentryQueryValue>;\n\nexport type CoinSentryPaginationParams = {\n page?: number;\n per_page?: number;\n};\n\nexport type CoinSentryPaginationMeta = {\n current_page: number;\n per_page: number;\n total: number;\n last_page: number;\n [key: string]: unknown;\n};\n\nexport type CoinSentryEnvelope<T> = {\n success?: boolean;\n data?: T;\n meta?: CoinSentryPaginationMeta;\n message?: string;\n [key: string]: unknown;\n};\n\nexport type CoinSentryTwoFactorStatus = {\n two_factor_enabled: boolean;\n two_factor_confirmed: boolean;\n};\n\nexport type CoinSentryPasswordResetPayload = {\n email: string;\n slideCaptchaToken: string;\n};\n\nexport type CoinSentryResetPasswordPayload = {\n token: string;\n email: string;\n password: string;\n password_confirmation: string;\n};\n\nexport type CoinSentryOtcCoin = {\n id: number;\n coin_tag: string;\n name: string;\n description: string;\n section: 'cryptocurrency' | 'fiat';\n main_network_id: number;\n available: boolean;\n deposit_enabled: boolean;\n withdraw_enabled: boolean;\n markets_enabled: boolean;\n color: string;\n precision: number;\n tag_required: boolean;\n tag_delimiter: string | null;\n confirmations?: number;\n release_at: string;\n closed_at: string | null;\n created_at: string;\n updated_at: string;\n};\n\nexport type CoinSentryOtcAvailableCoin = {\n tag: string;\n name: string;\n precision: number;\n description: string;\n section: 'cryptocurrency' | 'fiat';\n main_network: {\n tag: string;\n name: string;\n icon: string | null;\n } | null;\n deposit_enabled: boolean;\n withdraw_enabled: boolean;\n markets_enabled: boolean;\n color: string;\n tag_required: boolean;\n tag_delimiter: string | null;\n};\n\nexport type CoinSentryOtcTradingPair = {\n id: number;\n symbol: string;\n base_currency: string;\n quote_currency: string;\n is_active: boolean;\n min_order_size: string;\n max_order_size: string;\n price_precision: number;\n quantity_precision: number;\n fee_percentage: string;\n maker_fee: string;\n taker_fee: string;\n created_at: string;\n updated_at: string;\n base_coin?: CoinSentryOtcCoin | null;\n quote_coin?: CoinSentryOtcCoin | null;\n};\n\nexport type CoinSentryOtcTradingPairsResponse = {\n trading_pairs: CoinSentryOtcTradingPair[];\n base_currency: CoinSentryOtcCoin | null;\n quote_currency: CoinSentryOtcCoin | null;\n available_coins: CoinSentryOtcAvailableCoin[];\n};\n\nexport type CoinSentryOtcConvertQuoteRequest = {\n symbol: string;\n from_currency: string;\n to_currency: string;\n from_amount: string;\n};\n\nexport type CoinSentryOtcConvertQuote = {\n quote_id: string;\n from_currency: string;\n to_currency: string;\n from_amount: string;\n to_amount: string;\n price: string;\n inverse_price: string;\n fee: string;\n fee_currency: string;\n status: 'PENDING';\n expires_at: string;\n created_at: string;\n symbol: string;\n display_price: string;\n base_currency: string;\n quote_currency: string;\n side: 'BUY' | 'SELL';\n spread_amount_quote: string;\n fee_quote: string;\n};\n\nexport type CoinSentryOtcConvertExecuteRequest = {\n quote_id: string;\n};\n\nexport type CoinSentryOtcConvertResult = {\n id: number;\n entity_id: number;\n quote_id: string;\n from_currency: string;\n to_currency: string;\n from_amount: string;\n to_amount: string;\n price: string;\n fee: string;\n fee_currency: string;\n status: 'COMPLETED' | 'FAILED';\n error_message: string | null;\n created_at: string;\n completed_at: string;\n};\n\nexport type CoinSentryOtcRecurringPlanRequest = {\n name: string;\n from_currency: string;\n to_currency: string;\n amount: string;\n frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY';\n price_limit?: string;\n max_period_days?: number;\n};\n\nexport type CoinSentryOtcRecurringPlan = {\n id: number;\n entity_id: number;\n name: string;\n from_currency: string;\n to_currency: string;\n amount: string;\n frequency: 'DAILY' | 'WEEKLY' | 'MONTHLY';\n status: 'ACTIVE' | 'PAUSED' | 'CANCELLED' | 'COMPLETED';\n price_limit: string | null;\n max_period_days: number | null;\n next_execution_at: string | null;\n last_execution_at: string | null;\n executed_count: number;\n total_invested: string;\n total_received: string;\n average_price: string;\n success_rate: string;\n created_at: string;\n updated_at: string;\n};\n\nexport type CoinSentryOtcRecurringExecution = {\n id: number;\n plan_id: number;\n from_amount: string;\n to_amount: string;\n price: string;\n fee: string;\n status: 'SUCCESS' | 'FAILED' | 'SKIPPED';\n error_message: string | null;\n executed_at: string;\n};\n\ntype CoinSentryRequest = <T>(input: CoinSentryHttpRequest) => Promise<T>;\n\nfunction dataOrPayload<T>(payload: T | CoinSentryEnvelope<T>): T {\n if (\n payload\n && typeof payload === 'object'\n && 'data' in payload\n && (payload as CoinSentryEnvelope<T>).data !== undefined\n ) {\n return (payload as CoinSentryEnvelope<T>).data as T;\n }\n\n return payload as T;\n}\n\nfunction envelopePage<T>(payload: CoinSentryEnvelope<T[]>): { data: T[]; meta: CoinSentryPaginationMeta } {\n return {\n data: payload.data ?? [],\n meta: payload.meta ?? {\n current_page: 1,\n per_page: payload.data?.length ?? 0,\n total: payload.data?.length ?? 0,\n last_page: 1,\n },\n };\n}\n\nfunction requestOptions(options?: CoinSentryRequestOptions): Pick<CoinSentryHttpRequest, 'signal'> {\n return options?.signal ? { signal: options.signal } : {};\n}\n\nexport function createCoinSentryProductServices(request: CoinSentryRequest) {\n return {\n account: {\n twoFactor: {\n enable: () => request<unknown>({ method: 'POST', path: '/auth/user/two-factor-authentication' }),\n qrCode: async () => dataOrPayload(await request<{ svg: string } | CoinSentryEnvelope<{ svg: string }>>({\n method: 'GET',\n path: '/auth/user/two-factor-qr-code',\n })),\n confirm: (code: string) => request<unknown>({\n method: 'POST',\n path: '/auth/user/confirmed-two-factor-authentication',\n body: { code },\n }),\n recoveryCodes: () => request<string[]>({\n method: 'GET',\n path: '/auth/user/two-factor-recovery-codes',\n }),\n regenerateRecoveryCodes: () => request<string[]>({\n method: 'POST',\n path: '/auth/user/two-factor-recovery-codes',\n }),\n disable: () => request<unknown>({\n method: 'DELETE',\n path: '/auth/user/two-factor-authentication',\n }),\n status: () => request<CoinSentryTwoFactorStatus>({\n method: 'GET',\n path: '/auth/user/confirmed-password-status',\n }),\n },\n },\n contacts: {\n bank: {\n list: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/bank-contacts',\n ...requestOptions(options),\n }),\n create: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/bank-contacts',\n body: payload,\n }),\n delete: (id: number) => request<unknown>({\n method: 'DELETE',\n path: `/api/bank-contacts/${id}`,\n }),\n },\n banks: {\n list: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/banks',\n ...requestOptions(options),\n }),\n },\n wallet: {\n getByNetwork: <T = unknown>(network: string, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/v1/wallet-contacts/${network}`,\n ...requestOptions(options),\n }),\n create: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/v1/wallet-contacts',\n body: payload,\n }),\n update: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/v1/wallet-contacts/edit',\n body: payload,\n }),\n },\n },\n deposits: {\n get: <T = unknown>(currency: string, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/deposit/${currency}`,\n ...requestOptions(options),\n }),\n createIntent: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/v1/depositIntent',\n body: payload,\n }),\n },\n withdrawals: {\n get: <T = unknown>(currency: string, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/withdraw/${currency}`,\n ...requestOptions(options),\n }),\n fiat: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/withdrawals/fiat',\n body: payload,\n }),\n crypto: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/withdrawals/crypto',\n body: payload,\n }),\n networkFee: <T = unknown>(query: CoinSentryQuery, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/withdrawals/network-fee',\n query,\n ...requestOptions(options),\n }),\n },\n payments: {\n getCurrencies: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/payments/currencies',\n ...requestOptions(options),\n }),\n getHistory: <T = unknown>(query?: CoinSentryPaginationParams, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/payments/history',\n query,\n ...requestOptions(options),\n }),\n createReceiveIntent: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/payments/pix/receive',\n body: payload,\n }),\n getReceiveStatus: <T = unknown>(id: string, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/payments/pix/receive/${id}`,\n ...requestOptions(options),\n }),\n lookup: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/payments/pix/lookup',\n body: payload,\n }),\n pay: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/payments/pix/pay',\n body: payload,\n }),\n },\n affiliate: {\n getCode: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/code',\n ...requestOptions(options),\n }),\n getStatus: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/status',\n ...requestOptions(options),\n }),\n getReferrals: <T = unknown>(query?: CoinSentryPaginationParams, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/referrals',\n query,\n ...requestOptions(options),\n }),\n getPayouts: <T = unknown>(\n query?: CoinSentryPaginationParams & { type?: string },\n options?: CoinSentryRequestOptions,\n ) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/payouts',\n query,\n ...requestOptions(options),\n }),\n getRankingsByValueReceived: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/rankings/value-received',\n ...requestOptions(options),\n }),\n getRankingsByActiveReferrals: <T = unknown>(options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: '/api/v1/affiliate/rankings/active-referrals',\n ...requestOptions(options),\n }),\n },\n market: {\n getOrderbook: <T = unknown>(symbol: string, depth?: number, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/v1/orderbook/${symbol}`,\n query: depth ? { depth } : undefined,\n ...requestOptions(options),\n }),\n getMarket: <T = unknown>(symbol: string, options?: CoinSentryRequestOptions) => request<T>({\n method: 'GET',\n path: `/api/v1/market/${symbol}`,\n ...requestOptions(options),\n }),\n createOrder: <T = unknown>(payload: unknown) => request<T>({\n method: 'POST',\n path: '/api/v1/createOrder',\n body: payload,\n }),\n cancelOrder: (orderId: number) => request<unknown>({\n method: 'DELETE',\n path: `/api/v1/order/${orderId}`,\n }),\n cancelAllOrders: (symbol: string) => request<unknown>({\n method: 'DELETE',\n path: '/api/v1/orders/cancel-all',\n body: { symbol },\n }),\n },\n otc: {\n createQuote: async (payload: CoinSentryOtcConvertQuoteRequest) =>\n dataOrPayload(await request<CoinSentryOtcConvertQuote | CoinSentryEnvelope<CoinSentryOtcConvertQuote>>({\n method: 'POST',\n path: '/api/v1/otc/convert/quote',\n body: payload,\n })),\n executeConvert: async (payload: CoinSentryOtcConvertExecuteRequest) =>\n dataOrPayload(await request<CoinSentryOtcConvertResult | CoinSentryEnvelope<CoinSentryOtcConvertResult>>({\n method: 'POST',\n path: '/api/v1/otc/convert/execute',\n body: payload,\n })),\n getConvertHistory: async (query?: CoinSentryPaginationParams) =>\n envelopePage(await request<CoinSentryEnvelope<CoinSentryOtcConvertResult[]>>({\n method: 'GET',\n path: '/api/v1/otc/convert/history',\n query,\n })),\n activateQuote: (quoteId: string) => request<unknown>({\n method: 'POST',\n path: `/api/v1/otc/convert/quote/${quoteId}/activate`,\n }),\n deactivateQuote: (quoteId: string) => request<unknown>({\n method: 'POST',\n path: `/api/v1/otc/convert/quote/${quoteId}/deactivate`,\n }),\n getRecurringPlans: async (query?: { status?: string }) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan[] | CoinSentryEnvelope<CoinSentryOtcRecurringPlan[]>>({\n method: 'GET',\n path: '/api/v1/otc/recurring/plans',\n query,\n })),\n createRecurringPlan: async (payload: CoinSentryOtcRecurringPlanRequest) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan | CoinSentryEnvelope<CoinSentryOtcRecurringPlan>>({\n method: 'POST',\n path: '/api/v1/otc/recurring/plans',\n body: payload,\n })),\n getRecurringPlan: async (id: number) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan | CoinSentryEnvelope<CoinSentryOtcRecurringPlan>>({\n method: 'GET',\n path: `/api/v1/otc/recurring/plans/${id}`,\n })),\n updateRecurringPlan: async (id: number, payload: Partial<CoinSentryOtcRecurringPlanRequest>) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan | CoinSentryEnvelope<CoinSentryOtcRecurringPlan>>({\n method: 'PATCH',\n path: `/api/v1/otc/recurring/plans/${id}`,\n body: payload,\n })),\n cancelRecurringPlan: (id: number) => request<unknown>({\n method: 'DELETE',\n path: `/api/v1/otc/recurring/plans/${id}`,\n }),\n pauseRecurringPlan: async (id: number) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan | CoinSentryEnvelope<CoinSentryOtcRecurringPlan>>({\n method: 'POST',\n path: `/api/v1/otc/recurring/plans/${id}/pause`,\n })),\n activateRecurringPlan: async (id: number) =>\n dataOrPayload(await request<CoinSentryOtcRecurringPlan | CoinSentryEnvelope<CoinSentryOtcRecurringPlan>>({\n method: 'POST',\n path: `/api/v1/otc/recurring/plans/${id}/activate`,\n })),\n getRecurringExecutions: async (id: number, query?: CoinSentryPaginationParams) =>\n envelopePage(await request<CoinSentryEnvelope<CoinSentryOtcRecurringExecution[]>>({\n method: 'GET',\n path: `/api/v1/otc/recurring/plans/${id}/executions`,\n query,\n })),\n getTradingPairs: async (symbol = 'BTC_USDT'): Promise<CoinSentryOtcTradingPairsResponse> => {\n const payload = await request<{\n success?: boolean;\n trading_pairs?: CoinSentryOtcTradingPair[];\n base_currency?: CoinSentryOtcCoin;\n quote_currency?: CoinSentryOtcCoin;\n available_coins?: CoinSentryOtcAvailableCoin[];\n }>({\n method: 'GET',\n path: `/api/v1/market/${symbol}`,\n });\n\n return {\n trading_pairs: payload.trading_pairs ?? [],\n base_currency: payload.base_currency ?? null,\n quote_currency: payload.quote_currency ?? null,\n available_coins: payload.available_coins ?? [],\n };\n },\n },\n };\n}\n"]}
|