squarefi-bff-api-module 1.0.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.
Files changed (58) hide show
  1. package/README.md +36 -0
  2. package/dist/api/auth.d.ts +27 -0
  3. package/dist/api/auth.js +38 -0
  4. package/dist/api/config.d.ts +37 -0
  5. package/dist/api/config.js +40 -0
  6. package/dist/api/developer.d.ts +12 -0
  7. package/dist/api/developer.js +15 -0
  8. package/dist/api/exchange.d.ts +35 -0
  9. package/dist/api/exchange.js +27 -0
  10. package/dist/api/fetch_api.d.ts +1 -0
  11. package/dist/api/fetch_api.js +122 -0
  12. package/dist/api/fiat_accounts.d.ts +32 -0
  13. package/dist/api/fiat_accounts.js +51 -0
  14. package/dist/api/index.d.ts +12 -0
  15. package/dist/api/index.js +17 -0
  16. package/dist/api/issuing.d.ts +31 -0
  17. package/dist/api/issuing.js +68 -0
  18. package/dist/api/kyc.d.ts +6 -0
  19. package/dist/api/kyc.js +9 -0
  20. package/dist/api/list.d.ts +10 -0
  21. package/dist/api/list.js +13 -0
  22. package/dist/api/orders.d.ts +12 -0
  23. package/dist/api/orders.js +34 -0
  24. package/dist/api/types.d.ts +945 -0
  25. package/dist/api/types.js +2 -0
  26. package/dist/api/user.d.ts +18 -0
  27. package/dist/api/user.js +21 -0
  28. package/dist/api/wallets.d.ts +18 -0
  29. package/dist/api/wallets.js +42 -0
  30. package/dist/constants.d.ts +149 -0
  31. package/dist/constants.js +172 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.js +22 -0
  34. package/dist/utils/apiClientFactory.d.ts +13 -0
  35. package/dist/utils/apiClientFactory.js +132 -0
  36. package/dist/utils/storage.d.ts +3 -0
  37. package/dist/utils/storage.js +30 -0
  38. package/dist/utils/tokensFactory.d.ts +12 -0
  39. package/dist/utils/tokensFactory.js +53 -0
  40. package/package.json +35 -0
  41. package/src/api/auth.ts +50 -0
  42. package/src/api/developer.ts +18 -0
  43. package/src/api/exchange.ts +32 -0
  44. package/src/api/fiat_accounts.ts +69 -0
  45. package/src/api/index.ts +16 -0
  46. package/src/api/issuing.ts +66 -0
  47. package/src/api/kyc.ts +10 -0
  48. package/src/api/list.ts +18 -0
  49. package/src/api/orders.ts +32 -0
  50. package/src/api/types.ts +1141 -0
  51. package/src/api/user.ts +24 -0
  52. package/src/api/wallets.ts +39 -0
  53. package/src/constants.ts +180 -0
  54. package/src/index.ts +7 -0
  55. package/src/utils/apiClientFactory.ts +154 -0
  56. package/src/utils/storage.ts +29 -0
  57. package/src/utils/tokensFactory.ts +50 -0
  58. package/tsconfig.json +15 -0
@@ -0,0 +1,1141 @@
1
+ import {
2
+ APIKeyRole,
3
+ CardFormFactor,
4
+ CardStatus,
5
+ CardTransactionType,
6
+ CardType,
7
+ CurrencyType,
8
+ KYCStatuses,
9
+ OrderStatuses,
10
+ OrderType,
11
+ SubAccountType,
12
+ WalletTransactionMethod,
13
+ WalletTransactionRecordType,
14
+ WalletTransactionType,
15
+ } from '../constants';
16
+ import { WalletType } from '../';
17
+
18
+ export namespace API {
19
+ export namespace Auth {
20
+ export namespace Telegram {
21
+ export interface Signin {
22
+ tg_id: number;
23
+ hash: string;
24
+ init_data_raw: string;
25
+ }
26
+ export interface Signup {
27
+ phone: string;
28
+ tg_id: number;
29
+ first_name: string;
30
+ last_name?: string;
31
+ hash: string;
32
+ init_data_raw: string;
33
+ referrer?: string;
34
+ invite_code?: string;
35
+ username: string;
36
+ }
37
+ }
38
+
39
+ export interface Tokens {
40
+ access_token: string;
41
+ refresh_token: string;
42
+ }
43
+ export namespace UserData {
44
+ export namespace Update {
45
+ export interface Request {
46
+ default_currency: string;
47
+ }
48
+ }
49
+
50
+ export interface UserData {
51
+ id: number;
52
+ created_at: string;
53
+ user_id: string;
54
+ kyc_status: KYCStatuses | string;
55
+ kyc_date: string;
56
+ turnover_limit?: number;
57
+ default_currency: string;
58
+ tenant_id: string;
59
+ user_group_id: string;
60
+ is_developer: boolean;
61
+ can_invite: boolean;
62
+ total_turnover: {
63
+ onramp: number;
64
+ offramp: number;
65
+ total: number;
66
+ };
67
+ }
68
+ }
69
+
70
+ export namespace Update {
71
+ export namespace Phone {
72
+ export interface Request {
73
+ phone: string;
74
+ }
75
+ }
76
+ }
77
+
78
+ export namespace SignIn {
79
+ export namespace Email {
80
+ export namespace OTP {
81
+ export interface Request {
82
+ email: string;
83
+ invite_code?: string;
84
+ referrer?: string;
85
+ redirect_url?: string;
86
+ }
87
+ }
88
+ }
89
+
90
+ export namespace Phone {
91
+ export namespace OTP {
92
+ export interface Request {
93
+ phone: string;
94
+ invite_code?: string;
95
+ referrer?: string;
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ export namespace SignUp {
102
+ export namespace Password {
103
+ export interface Request {
104
+ email: string;
105
+ password: string;
106
+ invite_code?: string;
107
+ referrer?: string;
108
+ }
109
+ }
110
+ }
111
+ export interface SupabaseGetSessionResponse {
112
+ session?: Tokens;
113
+ // user?: User;
114
+ error?: string;
115
+ }
116
+
117
+ export namespace VerifyOtp {
118
+ export type Response = { access_token: string; refresh_token: string; error?: string };
119
+ }
120
+ }
121
+
122
+ export namespace Cards {
123
+ export namespace Config {
124
+ export interface Program {
125
+ id: string;
126
+ account_currency: string;
127
+ brand: string;
128
+ card_issuing_fee: number | null;
129
+ card_monthly_fee: number | null;
130
+ initial_topup: number | null;
131
+ form_factor: CardFormFactor | string;
132
+ name: string;
133
+ card_limit: number;
134
+ realtime_auth: boolean;
135
+ tokenizable: boolean;
136
+ vendor_id: string;
137
+ purposes: string[] | null;
138
+ type: CardType | string; // MOCK
139
+ sub_account_type: SubAccountType | string;
140
+ description: string | null;
141
+ icon: string | null;
142
+ }
143
+ }
144
+ export interface User {
145
+ email: string;
146
+ whitelabel: string;
147
+ id: string;
148
+ nickname: string;
149
+ role: string;
150
+ status: string;
151
+ user_type: string;
152
+ invite_accept: boolean;
153
+ is_new_client: boolean;
154
+ account: {
155
+ first_name: string;
156
+ middle_name: string;
157
+ last_name: string;
158
+ date_of_birth: string;
159
+ phone: string;
160
+ type: string;
161
+ id: string;
162
+ user_id: number;
163
+ tg_account: string;
164
+ company: {
165
+ name: string;
166
+ registration_number: string;
167
+ phone: string;
168
+ primary_contact_email: string;
169
+ id: string;
170
+ };
171
+ };
172
+ }
173
+
174
+ export interface Limit {
175
+ interval?: string;
176
+ amount: number;
177
+ }
178
+
179
+ export interface Limits {
180
+ single: Limit;
181
+ daily: Limit;
182
+ weekly: Limit;
183
+ monthly: Limit;
184
+ lifetime: Limit;
185
+ }
186
+
187
+ export interface CardDetailItem {
188
+ brand: string;
189
+ card_id: string;
190
+ // card_number: string;
191
+ last4: string;
192
+ card_status: CardStatus | string;
193
+ form_factor: string;
194
+ name_on_card: string;
195
+ nick_name: string;
196
+ program_id: string;
197
+ wallet_id: string;
198
+ type: CardType | string;
199
+ transaction_limits: {
200
+ amount: number;
201
+ interval: string;
202
+ }[];
203
+ authorization_controls: {
204
+ id: string;
205
+ card_id: string;
206
+ allowed_transaction_count: string;
207
+ allowed_merchant_categories: string | null;
208
+ };
209
+ fiat_account: {
210
+ id: string;
211
+ currency: API.Currencies.FiatCurrency;
212
+ type: SubAccountType | string;
213
+ balance: number;
214
+ nick_name: string;
215
+ wallet_id: string;
216
+ created_at: string;
217
+ payment_types: Array<{ order_type: OrderType }>;
218
+ account_details?: API.FiatAccounts.FiatAccountDetails;
219
+ };
220
+ }
221
+ export interface IssuingCardListItem {
222
+ brand: string;
223
+ card_id: string;
224
+ card_status: string;
225
+ created_at: string;
226
+ nick_name: string | null;
227
+ wallet_id: string;
228
+ program_id: string;
229
+ fiat_account: API.FiatAccounts.FiatAccount;
230
+ last4: string;
231
+ request_id: string;
232
+ name_on_card: string | null;
233
+ type: CardType | string;
234
+ form_factor: CardFormFactor | string;
235
+ tokenizable: boolean;
236
+ }
237
+
238
+ export interface FiatAccountCardListItem {
239
+ type: string;
240
+ brand: string;
241
+ last4: string;
242
+ card_id: string;
243
+ nick_name: string;
244
+ vendor_id: string;
245
+ wallet_id: string;
246
+ created_at: string;
247
+ program_id: string;
248
+ request_id: string;
249
+ // card_number: string;
250
+ card_status: string;
251
+ expiry_year: number;
252
+ form_factor: string;
253
+ tokenizable: boolean;
254
+ expiry_month: number;
255
+ fiat_account: string;
256
+ name_on_card: string;
257
+ }
258
+
259
+ export namespace CardsList {
260
+ export namespace Request {
261
+ export type ByWalletUuid = {
262
+ wallet_uuid: string;
263
+ limit: number;
264
+ offset: number;
265
+ };
266
+
267
+ export type ByFiatAccountAndWalletId = ByWalletUuid & {
268
+ fiat_account_id: string;
269
+ };
270
+ }
271
+
272
+ export type Response = {
273
+ count: number;
274
+ data: IssuingCardListItem[];
275
+ };
276
+ }
277
+
278
+ export interface TransactionItem {
279
+ vendor_transaction_id: string;
280
+ created_at: string;
281
+ cleared_at: string;
282
+ merchant: {
283
+ name: string;
284
+ category_code: string;
285
+ city: string;
286
+ country: string;
287
+ };
288
+ last4: string;
289
+ title: string;
290
+ billing_amount: number;
291
+ billing_currency: string;
292
+ transaction_amount: number;
293
+ transaction_currency: string;
294
+ vendor_sub_account_id: string;
295
+ failure_reason: string;
296
+ status: string;
297
+ transaction_type: CardTransactionType | string;
298
+ is_credit: boolean;
299
+ has_receipt: boolean;
300
+ adjustment_type: string;
301
+ review_status: string;
302
+ group: string;
303
+ total_amount: number;
304
+ }
305
+
306
+ export interface TransactionsList {
307
+ data: TransactionItem[];
308
+ has_more: boolean;
309
+ }
310
+
311
+ export interface SensitiveData {
312
+ card_number: string;
313
+ cvv: string;
314
+ expiry_month: number;
315
+ expiry_year: number;
316
+ security_code?: string | null;
317
+ }
318
+
319
+ export interface OTP {
320
+ created_at: number;
321
+ internal_card_id: string;
322
+ otp: string;
323
+ valid_to: number;
324
+ }
325
+
326
+ export type AuthorizationControls = {
327
+ allowed_merchant_categories: string[];
328
+ allowed_transaction_count: string;
329
+ };
330
+
331
+ export type TransactionLimit = {
332
+ amount: number;
333
+ interval: string;
334
+ };
335
+
336
+ export namespace Create {
337
+ export interface CommonRequest {
338
+ program_id: string;
339
+ request_id: string;
340
+ nick_name: string;
341
+ wallet_id: string;
342
+ initial_topup?: number;
343
+ currency_id?: string;
344
+ }
345
+ export interface StandAloneRequest extends CommonRequest {
346
+ authorization_controls: AuthorizationControls;
347
+ transaction_limits: TransactionLimit[];
348
+ purpose?: string;
349
+ }
350
+
351
+ export interface FiatAccountRequest extends CommonRequest {
352
+ sub_account_id: string;
353
+ }
354
+
355
+ export type StandAloneResponse = CardDetailItem;
356
+ export type FiatAccountResponse = CardDetailItem;
357
+ }
358
+
359
+ export namespace Update {
360
+ export interface DeprecatedRequest {
361
+ status: string;
362
+ cardName: string;
363
+ limits: Limits;
364
+ autoTopUp: {
365
+ thresholdAmount: number;
366
+ topUpAmount: number;
367
+ };
368
+ }
369
+ }
370
+ }
371
+
372
+ export namespace Developer {
373
+ export namespace ApiCode {
374
+ export interface ApiCode {
375
+ role: APIKeyRole | string;
376
+ name: string;
377
+ id: string;
378
+ created_at: string;
379
+ updated_at: string;
380
+ }
381
+ export namespace Create {
382
+ export interface Request {
383
+ name: string;
384
+ role: APIKeyRole;
385
+ }
386
+ export interface Response extends ApiCode {
387
+ apiKey: string;
388
+ key_hash: string;
389
+ }
390
+ }
391
+
392
+ export namespace Update {
393
+ export interface Request {
394
+ uuid: string;
395
+ // name: string;
396
+ role: APIKeyRole;
397
+ }
398
+ }
399
+
400
+ export namespace Rotate {
401
+ export interface Request {
402
+ uuid: string;
403
+ }
404
+ export interface Response {
405
+ apiKey: string;
406
+ }
407
+ }
408
+ }
409
+
410
+ export namespace Vendors {
411
+ export interface Vendor {
412
+ id: string;
413
+ name: string;
414
+ type: string;
415
+ currency: string;
416
+ currency_id: string;
417
+ }
418
+ }
419
+ }
420
+
421
+ export namespace Exchange {
422
+ // export interface F2C {
423
+ // crypto_uuid: string;
424
+ // crypto_symbol: string;
425
+ // fiat_uuid: string;
426
+ // fiat_code: string;
427
+ // rate: number;
428
+ // min_amount: number;
429
+ // }
430
+
431
+ // export interface C2F {
432
+ // crypto_uuid: string;
433
+ // crypto_symbol: string;
434
+ // fiat_uuid: string;
435
+ // fiat_code: string;
436
+ // rate: number;
437
+ // min_amount: number;
438
+ // }
439
+
440
+ // export interface C2C {
441
+ // from_uuid: string;
442
+ // from_symbol: string;
443
+ // to_uuid: string;
444
+ // to_symbol: string;
445
+ // rate: number;
446
+ // min_amount: string;
447
+ // }
448
+
449
+ export interface Exchange {
450
+ // id: number;
451
+ updated_at: string;
452
+ from: string;
453
+ to: string;
454
+ rate: number;
455
+ inverted_rate: number;
456
+ rate_source: string;
457
+ from_uuid: string;
458
+ to_uuid: string;
459
+ min_amount: string;
460
+ offramp_enabled: boolean;
461
+ onramp_enabled: boolean;
462
+ }
463
+ }
464
+
465
+ export namespace FiatAccounts {
466
+ export type Transaction = API.Cards.TransactionItem;
467
+ export type FiatAccountDetails = {
468
+ iban: string;
469
+ bank_name: string;
470
+ swift_code: string;
471
+ bank_address: string;
472
+ receiver_name: string;
473
+ payment_details: string;
474
+ reference_number: string;
475
+ registration_number: string;
476
+ };
477
+
478
+ export type TransactionList = {
479
+ count: number;
480
+ data: Transaction[];
481
+ has_more: boolean;
482
+ };
483
+ export interface FiatAccount {
484
+ balance: number;
485
+ cards_count: number;
486
+ created_at: string;
487
+ currency: API.Currencies.FiatCurrency;
488
+ fiat_balance: number;
489
+ id: string;
490
+ issuing_program: API.Cards.Config.Program;
491
+ nick_name: string;
492
+ program_id: string;
493
+ payment_types: Array<{ order_type: OrderType }>;
494
+ realtime_auth: [
495
+ {
496
+ crypto_token: string;
497
+ fiat_account: string;
498
+ id: string;
499
+ priority: number;
500
+ }
501
+ ];
502
+ realtimeauth_balance: number;
503
+ status: string;
504
+ total_balance: number;
505
+ wallet_id: string;
506
+ account_details?: FiatAccountDetails;
507
+ }
508
+
509
+ export interface FiatAccountWithCards extends FiatAccount {
510
+ cards: API.Cards.IssuingCardListItem[];
511
+ }
512
+ }
513
+
514
+ export namespace FiatAccountsV2 {
515
+ export type FiatAccountDetails = {
516
+ iban: string;
517
+ bank_name: string;
518
+ swift_code: string;
519
+ bank_address: string;
520
+ receiver_name: string;
521
+ payment_details: string;
522
+ reference_number: string;
523
+ registration_number: string;
524
+ };
525
+
526
+ export interface FiatAccount {
527
+ balance: number;
528
+ cards_count: number;
529
+ created_at: string;
530
+ currency: API.Currencies.FiatCurrency;
531
+ fiat_balance: number;
532
+ id: string;
533
+ issuing_program: API.Cards.Config.Program;
534
+ nick_name: string;
535
+ program_id: string;
536
+ realtimeauth_balance: number;
537
+ status: string;
538
+ total_balance: number;
539
+ wallet_id: string;
540
+ }
541
+
542
+ export namespace ExtendedFiatAccount {
543
+ export interface ExtendedFiatAccount extends FiatAccount {
544
+ account_details?: FiatAccountDetails;
545
+ payment_types: Array<{ order_type: OrderType }>;
546
+ realtime_auth: [
547
+ {
548
+ crypto_token: string;
549
+ fiat_account: string;
550
+ id: string;
551
+ priority: number;
552
+ }
553
+ ];
554
+ }
555
+ export interface Request {
556
+ wallet_uuid: string;
557
+ fiat_account_id: string;
558
+ }
559
+
560
+ export type Response = ExtendedFiatAccount;
561
+ }
562
+
563
+ export interface FiatAccountWithCards extends FiatAccount {
564
+ cards: API.Cards.IssuingCardListItem[];
565
+ }
566
+
567
+ export interface FiatAccountsList<T extends FiatAccount | FiatAccountWithCards> {
568
+ count: number;
569
+ data: T[];
570
+ }
571
+
572
+ export type FiatAccountsListWithCards = FiatAccountsList<FiatAccountWithCards>;
573
+ export type FiatAccountsListWithoutCards = FiatAccountsList<FiatAccount>;
574
+
575
+ export namespace CreateFiatAccount {
576
+ export interface Request {
577
+ wallet_id: string;
578
+ program_id: string;
579
+ }
580
+ export type Response = {
581
+ id: string;
582
+ balance: number;
583
+ nick_name: string;
584
+ wallet_id: string;
585
+ created_at: string;
586
+ account_currency: string;
587
+ type: SubAccountType | string;
588
+ program_id: string;
589
+ status: 'ACTIVE';
590
+ fiat: {
591
+ code: string;
592
+ uuid: string;
593
+ symbol: string;
594
+ enabled: boolean;
595
+ coingecko: string;
596
+ };
597
+ issuing_program: {
598
+ id: string;
599
+ form_factor: CardFormFactor | string;
600
+ brand: string;
601
+ tokenizable: boolean;
602
+ type: CardType | string;
603
+ };
604
+ };
605
+ }
606
+
607
+ export namespace Transactions {
608
+ // export type Transaction = API.Cards.TransactionItem;
609
+ export type Transaction = {
610
+ vendor_transaction_id: string;
611
+ created_at: string;
612
+ cleared_at: string;
613
+ merchant: {
614
+ name: string;
615
+ category_code: string;
616
+ city: string;
617
+ country: string;
618
+ };
619
+ last4: string;
620
+ title: string;
621
+ billing_amount: number;
622
+ billing_currency: string;
623
+ transaction_amount: number;
624
+ transaction_currency: string;
625
+ vendor_sub_account_id: string;
626
+ failure_reason: string;
627
+ status: string;
628
+ transaction_type: string;
629
+ is_credit: boolean;
630
+ has_receipt: boolean;
631
+ adjustment_type: string;
632
+ review_status: string;
633
+ group: string;
634
+ total_amount: number;
635
+ };
636
+
637
+ export namespace TransactionList {
638
+ export interface Request {
639
+ fiat_account_id: string;
640
+ wallet_uuid: string;
641
+ limit?: number;
642
+ offset?: number;
643
+ }
644
+ export interface Response {
645
+ count: number;
646
+ data: Transaction[];
647
+ has_more: boolean;
648
+ }
649
+ }
650
+ }
651
+ }
652
+
653
+ export namespace Issuing {
654
+ export namespace Programs {
655
+ export type Response = {
656
+ count: number;
657
+ data: API.Cards.Config.Program[];
658
+ };
659
+ }
660
+ }
661
+
662
+ export namespace KYC {
663
+ export namespace Sumsub {
664
+ export namespace GenerateToken {
665
+ export interface Request {
666
+ user_data_id: number;
667
+ }
668
+ export interface Response extends Request {
669
+ token: string;
670
+ }
671
+ }
672
+ }
673
+ }
674
+
675
+ export namespace Currencies {
676
+ interface CommonCurrencyFields {
677
+ uuid: string;
678
+ decimal: number | null;
679
+ is_memo: boolean | null;
680
+ is_stablecoin: boolean;
681
+ is_enabled: boolean; // added
682
+ render_decimal: number;
683
+ meta: {
684
+ icon: string;
685
+ name: string;
686
+ symbol: string;
687
+ description: string;
688
+ };
689
+ type: CurrencyType; // moved
690
+ }
691
+ export interface CryptoCurrency extends CommonCurrencyFields {
692
+ is_crypto: true;
693
+ meta: CommonCurrencyFields['meta'] & {
694
+ chain_id: number;
695
+ contract: string;
696
+ chain_name: string;
697
+ };
698
+ }
699
+ export interface FiatCurrency extends CommonCurrencyFields {
700
+ is_crypto: false;
701
+ meta: CommonCurrencyFields['meta'] & {
702
+ code: string;
703
+ iso_code: number;
704
+ sign: string;
705
+ };
706
+ }
707
+
708
+ export type Currency = CryptoCurrency | FiatCurrency;
709
+
710
+ export type CurrencyList = {
711
+ count: number;
712
+ data: Currency[];
713
+ };
714
+ }
715
+
716
+ export namespace Chains {
717
+ export interface Chain {
718
+ id: number;
719
+ name: string;
720
+ symbol: string;
721
+ is_beta: boolean | null;
722
+ }
723
+
724
+ export type ChainList = {
725
+ count: number;
726
+ data: Chain[];
727
+ };
728
+ }
729
+
730
+ export namespace Wallets {
731
+ export interface WallletBalanceCryptoDetails {
732
+ uuid: string;
733
+ amount: number;
734
+ fiat_amount: number;
735
+ currency: API.Currencies.Currency;
736
+ }
737
+ export interface WalletBalanceItem {
738
+ symbol: string;
739
+ icon: string;
740
+ name: string;
741
+ is_crypto: boolean;
742
+ decimal?: number | null;
743
+ amount: number;
744
+ fiat_amount: number;
745
+ details: WallletBalanceCryptoDetails[];
746
+ }
747
+
748
+ export type WalletBalance = WalletBalanceItem[];
749
+
750
+ export namespace WalletChain {
751
+ export interface WalletChain {
752
+ uuid: string;
753
+ created_ad: string;
754
+ address: string;
755
+ wallet_uuid: string;
756
+ chain: number;
757
+ }
758
+
759
+ export namespace Create {
760
+ export interface Request {
761
+ wallet_uuid: string;
762
+ chain: number;
763
+ label: string;
764
+ }
765
+ export type Response = WalletChain;
766
+ }
767
+ }
768
+
769
+ export interface Wallet {
770
+ uuid: string;
771
+ type: WalletType | string;
772
+ created_at: string;
773
+ fiat_total: number;
774
+ crypto_total: number;
775
+ total_amount: number;
776
+ balance: WalletBalance;
777
+ }
778
+
779
+ export namespace WalletsList {
780
+ export interface WalletsListItem {
781
+ type: WalletType | string;
782
+ uuid: string;
783
+ created_at: string;
784
+ }
785
+
786
+ export type Response = {
787
+ total: number;
788
+ data: WalletsListItem[];
789
+ };
790
+ }
791
+
792
+ export namespace WalletTransactions {
793
+ export interface WalletTransactionMeta {
794
+ transaction_hash?: string;
795
+ fee?: number;
796
+ order_id?: string;
797
+ from_address?: string; // not added on backend
798
+ to_address?: string;
799
+ network_fee?: number;
800
+ network_fee_currency?: string;
801
+ fee_currency?: string;
802
+ billing_amount?: number;
803
+ utila_transaction?: string;
804
+ transcation_amount?: number;
805
+ transaction_amount?: number;
806
+ billing_amount_currency?: string;
807
+ transcation_amount_currency?: string;
808
+ transaction_amount_currency?: string;
809
+ exchange_rate?: number;
810
+ fiat_account_id?: string;
811
+ txid?: string;
812
+ chain_id?: number;
813
+ from_user_data?: number;
814
+ to_user_data?: number;
815
+ to_card_id?: string;
816
+ to_card_last4?: string;
817
+ to_fiat_account_id?: string;
818
+ to_vendor_id?: string;
819
+ }
820
+ export interface Transaction {
821
+ id: number;
822
+ created_at: string;
823
+ type: WalletTransactionType | string;
824
+ method: WalletTransactionMethod | string;
825
+ status: string;
826
+ amount: number;
827
+ from: string | null; // deprecated?
828
+ to: string | null; // deprecated?
829
+ wallet_id: string;
830
+ txid: string; // deprecated?
831
+ info: string;
832
+ currency: API.Currencies.Currency;
833
+ record_type: WalletTransactionRecordType | string;
834
+ meta?: WalletTransactionMeta;
835
+ }
836
+
837
+ export namespace TransactionList {
838
+ export type Response = {
839
+ total: number;
840
+ data: Transaction[];
841
+ };
842
+ }
843
+ }
844
+ }
845
+
846
+ export namespace Orders {
847
+ export namespace Create {
848
+ export namespace ByOrderType {
849
+ export namespace TRANSFER_CARD_SUBACCOUNT {
850
+ export type Request = {
851
+ amount: number;
852
+ wallet_uuid: string;
853
+ from_uuid: string;
854
+ sub_account_id: string;
855
+ };
856
+
857
+ export type Response = {
858
+ id: number;
859
+ created_at: string;
860
+ order_uuid: string;
861
+ wallet_uuid: string;
862
+ fiat_uuid: string;
863
+ crypto_uuid: string;
864
+ amount_fiat: number;
865
+ payment_method: string;
866
+ redirect_url: string;
867
+ status: string;
868
+ provider_uuid: string;
869
+ };
870
+ }
871
+ export namespace WITHDRAWAL_CRYPTO {
872
+ export type Request = {
873
+ amount: number;
874
+ is_subsctract: boolean;
875
+ wallet_uuid: string;
876
+ crypto_uuid: string;
877
+ to_address: string;
878
+ memo?: string;
879
+ };
880
+
881
+ export type Response = {
882
+ id: number;
883
+ created_at: string;
884
+ order_uuid: string;
885
+ wallet_uuid: string;
886
+ crypto_uuid: string;
887
+ amount: number;
888
+ status: string;
889
+ network: string;
890
+ to_address: string;
891
+ txid: string;
892
+ };
893
+ }
894
+ export namespace EXCHANGE_CRYPTO_INTERNAL {
895
+ export type Request = {
896
+ amount: number;
897
+ wallet_uuid: string;
898
+ from_uuid: string;
899
+ to_uuid: string;
900
+ };
901
+ export type Response = {
902
+ id: number;
903
+ // TODO: add response
904
+ };
905
+ }
906
+
907
+ export namespace TRANSFER_CARD_WHOLESALE {
908
+ export type Request = {
909
+ amount: number;
910
+ wallet_id: string;
911
+ currency_id: string;
912
+ vendor_id: string;
913
+ };
914
+ }
915
+ }
916
+ }
917
+ export namespace Calc {
918
+ interface CommonRequestParams {
919
+ from_currency: string;
920
+ to_currency: string;
921
+ amount: number;
922
+ is_reverse?: boolean;
923
+ signal?: AbortSignal;
924
+ }
925
+
926
+ export interface WithdrawCryptoRequest extends CommonRequestParams {
927
+ order_type: OrderType.WITHDRAWAL_CRYPTO;
928
+ to_address?: string;
929
+ }
930
+
931
+ export interface NonWithdrawCryptoRequest extends CommonRequestParams {
932
+ order_type: Exclude<OrderType, OrderType.WITHDRAWAL_CRYPTO>;
933
+ to_address?: never;
934
+ }
935
+
936
+ export type Request = NonWithdrawCryptoRequest | WithdrawCryptoRequest;
937
+ export interface Response {
938
+ from_currency: string;
939
+ to_currency: string;
940
+ from_symbol: string;
941
+ to_symbol: string;
942
+ from_amount: number;
943
+ net_amount: number;
944
+ result_amount: number;
945
+ fees: number;
946
+ comission: number;
947
+ base_markup: number;
948
+ network_fee: number;
949
+ transaction_fee: number;
950
+ rate: number;
951
+ direction: 'c2f' | 'f2c' | 'c2c';
952
+ }
953
+ }
954
+
955
+ // export namespace OffRamp {
956
+ // // deprecated
957
+ // export interface Item {
958
+ // id: number;
959
+ // created_at: string;
960
+ // order_uuid: string;
961
+ // wallet_uuid: string;
962
+ // fiat_uuid: string;
963
+ // crypto_uuid: string;
964
+ // amount_fiat: number;
965
+ // payment_method: string;
966
+ // card_number: string;
967
+ // status: string;
968
+ // provider_uuid: string;
969
+ // }
970
+ // export interface Request {
971
+ // amount: number;
972
+ // wallet_uuid: string;
973
+ // crypto_uuid: string;
974
+ // fiat_uuid: string;
975
+ // card_number: string;
976
+ // is_subsctract: boolean;
977
+ // }
978
+ // export type Response = Item;
979
+ // }
980
+
981
+ export namespace Status {
982
+ export interface Response {
983
+ id: number;
984
+ created_at: string;
985
+ order_uuid: string;
986
+ wallet_uuid: string;
987
+ crypto_uuid: string;
988
+ status: OrderStatuses | string;
989
+ amount: number;
990
+ comission: number;
991
+ net_amount: number;
992
+ type: OrderType | string;
993
+ }
994
+ }
995
+
996
+ // export namespace OrdersIssuing { // deprecated
997
+ // export namespace Topup {
998
+ // export namespace Internal {
999
+ // export namespace Card {
1000
+ // export type Request = {
1001
+ // amount: number;
1002
+ // fiat_uuid: string;
1003
+ // wallet_uuid: string;
1004
+ // crypto_uuid: string;
1005
+ // card_id: string;
1006
+ // is_subsctract: boolean;
1007
+ // };
1008
+ // export interface Response {
1009
+ // id: number;
1010
+ // created_at: string;
1011
+ // order_uuid: string;
1012
+ // wallet_uuid: string;
1013
+ // fiat_uuid: string;
1014
+ // crypto_uuid: string;
1015
+ // amount_fiat: number;
1016
+ // payment_method: string;
1017
+ // status: string;
1018
+ // provider_uuid: string;
1019
+ // card_number: string;
1020
+ // amount_crypto: number;
1021
+ // comission: number;
1022
+ // }
1023
+ // }
1024
+
1025
+ // export namespace FiatAccount {
1026
+ // export type Request = {
1027
+ // amount: number;
1028
+ // fiat_uuid: string;
1029
+ // wallet_uuid: string;
1030
+ // crypto_uuid: string;
1031
+ // fiat_account_id: string;
1032
+ // is_subsctract: boolean;
1033
+ // };
1034
+
1035
+ // export interface Response {
1036
+ // id: number;
1037
+ // created_at: string;
1038
+ // order_uuid: string;
1039
+ // wallet_uuid: string;
1040
+ // fiat_uuid: string;
1041
+ // crypto_uuid: string;
1042
+ // amount_fiat: number;
1043
+ // payment_method: string;
1044
+ // status: string;
1045
+ // provider_uuid: string;
1046
+ // card_number: string;
1047
+ // amount_crypto: number;
1048
+ // comission: number;
1049
+ // }
1050
+ // }
1051
+ // }
1052
+ // }
1053
+ // }
1054
+ }
1055
+
1056
+ export namespace User {
1057
+ export interface User {
1058
+ id: string;
1059
+ aud: string;
1060
+ confirmation_sent_at: string;
1061
+ recovery_sent_at: string;
1062
+ email_change_sent_at: string;
1063
+ new_email: string;
1064
+ new_phone: string;
1065
+ invited_at: string;
1066
+ action_link: string;
1067
+ email: string;
1068
+ phone: string;
1069
+ created_at: string;
1070
+ confirmed_at: string;
1071
+ email_confirmed_at: string;
1072
+ phone_confirmed_at: string;
1073
+ last_sign_in_at: string;
1074
+ role: string;
1075
+ updated_at: string;
1076
+ identities: string[];
1077
+ is_anonymous: boolean;
1078
+ factors: string[];
1079
+ }
1080
+
1081
+ export namespace UpdateUser {
1082
+ export namespace Phone {
1083
+ export namespace RequestOTP {
1084
+ export type Request = {
1085
+ phone: string;
1086
+ access_token: string;
1087
+ refresh_token: string;
1088
+ };
1089
+ }
1090
+ export namespace Confirm {
1091
+ export type Request = {
1092
+ phone: string;
1093
+ token: string;
1094
+ };
1095
+ }
1096
+ }
1097
+
1098
+ export namespace Email {
1099
+ export namespace RequestOTP {
1100
+ export type Request = {
1101
+ email: string;
1102
+ access_token: string;
1103
+ refresh_token: string;
1104
+ };
1105
+ }
1106
+
1107
+ export namespace Confirm {
1108
+ export type Request = {
1109
+ email: string;
1110
+ token: string;
1111
+ };
1112
+ }
1113
+ }
1114
+ }
1115
+
1116
+ export namespace UserData {
1117
+ export interface UserData {
1118
+ can_invite: boolean;
1119
+ created_at: string;
1120
+ id: number;
1121
+ kyc_date: string;
1122
+ kyc_status: KYCStatuses | string;
1123
+ referral_name: string;
1124
+ tenant_id: string;
1125
+ turnover_limit: number;
1126
+ user_id: string;
1127
+ default_currency: string;
1128
+ is_developer: boolean; // have to add in API V2
1129
+ user_group_id: string | null; // have to add in API V2
1130
+ }
1131
+
1132
+ export namespace UpdateUserData {
1133
+ export type Request = {
1134
+ default_currency: string;
1135
+ };
1136
+
1137
+ export type Response = API.User.UserData.UserData;
1138
+ }
1139
+ }
1140
+ }
1141
+ }