squarefi-bff-api-module 1.5.16 → 1.6.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/src/api/types.ts CHANGED
@@ -4,6 +4,8 @@ import {
4
4
  CardStatus,
5
5
  CardTransactionType,
6
6
  CardType,
7
+ CounterpartyDestinationType,
8
+ CounterpartyType,
7
9
  CurrencyType,
8
10
  KYCStatuses,
9
11
  OrderStatuses,
@@ -367,6 +369,20 @@ export namespace API {
367
369
  }
368
370
  }
369
371
 
372
+ export namespace Chains {
373
+ export interface Chain {
374
+ id: number;
375
+ name: string;
376
+ symbol: string;
377
+ is_beta: boolean | null;
378
+ }
379
+
380
+ export type ChainList = {
381
+ count: number;
382
+ data: Chain[];
383
+ };
384
+ }
385
+
370
386
  export namespace Common {
371
387
  export namespace Pagination {
372
388
  export interface Request {
@@ -389,6 +405,257 @@ export namespace API {
389
405
  }
390
406
  }
391
407
 
408
+ export namespace Counterparties {
409
+ export interface Counterparty {
410
+ id: string;
411
+ email: string;
412
+ phone: string;
413
+ name: string;
414
+ nickname: string;
415
+ type: CounterpartyType | string;
416
+ created_at: string;
417
+ }
418
+ export namespace Destination {
419
+ export namespace List {
420
+ export interface DestinationListItemCommonFields {
421
+ id: string;
422
+ nickname: string;
423
+ type: CounterpartyDestinationType | string;
424
+ created_at: string;
425
+ }
426
+
427
+ export interface DestinationListItemExternalBankingData {
428
+ account_number: string;
429
+ routing_number: string;
430
+ bank_name: string;
431
+ note: string;
432
+ swift_bic: string;
433
+ address?: {
434
+ city?: string;
435
+ country_id?: number;
436
+ postcode?: string;
437
+ street1?: string;
438
+ street2?: string;
439
+ memo?: string;
440
+ };
441
+ }
442
+
443
+ export interface DestinationListItemExternalCryptoData {
444
+ address: string;
445
+ currency_id: string;
446
+ }
447
+
448
+ export interface DestinationListItemWithExternalBankingData extends DestinationListItemCommonFields {
449
+ type:
450
+ | CounterpartyDestinationType.DOMESTIC_WIRE
451
+ | CounterpartyDestinationType.ACH
452
+ | CounterpartyDestinationType.SWIFT
453
+ | CounterpartyDestinationType.SEPA;
454
+ external_banking_data: DestinationListItemExternalBankingData;
455
+ external_crypto_data?: never;
456
+ }
457
+
458
+ export interface DestinationListItemWithExternalCryptoData extends DestinationListItemCommonFields {
459
+ type: CounterpartyDestinationType.CRYPTO_EXTERNAL | CounterpartyDestinationType.CRYPTO_INTERNAL;
460
+ external_banking_data?: never;
461
+ external_crypto_data: DestinationListItemExternalCryptoData;
462
+ }
463
+
464
+ export type CounterpartyDestinationListItem =
465
+ | DestinationListItemWithExternalBankingData
466
+ | DestinationListItemWithExternalCryptoData;
467
+
468
+ export interface Request {
469
+ wallet_id: string;
470
+ counterparty_account_id: string;
471
+ limit?: number;
472
+ offset?: number;
473
+ search?: string;
474
+ type?: CounterpartyDestinationType | string;
475
+ sort_by?: 'created_at' | 'nickname' | 'type';
476
+ sort_order?: SortingDirection;
477
+ filter?: {
478
+ type?: CounterpartyDestinationType;
479
+ nickname?: string;
480
+ created_at?: string;
481
+ };
482
+ }
483
+
484
+ export type Response = {
485
+ total: number;
486
+ data: CounterpartyDestinationListItem[];
487
+ };
488
+ }
489
+
490
+ export namespace Detail {
491
+ export type DestinationDetailItemCommonFields =
492
+ API.Counterparties.Destination.List.DestinationListItemCommonFields;
493
+
494
+ export interface DestinationDetailItemExternalBankingData
495
+ extends API.Counterparties.Destination.List.DestinationListItemExternalBankingData {
496
+ address: API.Counterparties.Destination.List.DestinationListItemExternalBankingData['address'] & {
497
+ country?: API.Location.Countries.Country;
498
+ };
499
+ }
500
+
501
+ export interface DestinationDetailItemExternalCryptoData
502
+ extends API.Counterparties.Destination.List.DestinationListItemExternalCryptoData {
503
+ currency: API.Currencies.Currency;
504
+ }
505
+
506
+ export interface DestinationDetailItemWithExternalBankingData extends DestinationDetailItemCommonFields {
507
+ type:
508
+ | CounterpartyDestinationType.DOMESTIC_WIRE
509
+ | CounterpartyDestinationType.ACH
510
+ | CounterpartyDestinationType.SWIFT
511
+ | CounterpartyDestinationType.SEPA;
512
+ external_banking_data: DestinationDetailItemExternalBankingData;
513
+ external_crypto_data?: never;
514
+ }
515
+
516
+ export interface DestinationDetailItemWithExternalCryptoData extends DestinationDetailItemCommonFields {
517
+ type: CounterpartyDestinationType.CRYPTO_EXTERNAL | CounterpartyDestinationType.CRYPTO_INTERNAL;
518
+ external_banking_data?: never;
519
+ external_crypto_data: DestinationDetailItemExternalCryptoData;
520
+ }
521
+
522
+ export type DestinationDetailItem =
523
+ | DestinationDetailItemWithExternalBankingData
524
+ | DestinationDetailItemWithExternalCryptoData;
525
+ export interface Request {
526
+ wallet_id: string;
527
+ counterparty_account_id: string;
528
+ counterparty_destination_id: string;
529
+ }
530
+
531
+ export type Response = DestinationDetailItem;
532
+ }
533
+
534
+ export namespace Create {
535
+ export interface Request {
536
+ wallet_id: string;
537
+ counterparty_account_id: string;
538
+ type: CounterpartyDestinationType;
539
+ nickname: string;
540
+ external_banking_data?: API.Counterparties.Destination.Detail.DestinationDetailItemExternalBankingData;
541
+ external_crypto_data?: API.Counterparties.Destination.Detail.DestinationDetailItemExternalCryptoData;
542
+ }
543
+
544
+ export interface Response extends API.Counterparties.Destination.Detail.DestinationDetailItemCommonFields {
545
+ id: string;
546
+ nickname: string;
547
+ created_at: string;
548
+ type: CounterpartyDestinationType;
549
+ external_banking_data?: API.Counterparties.Destination.Detail.DestinationDetailItemExternalBankingData;
550
+ external_crypto_data?: API.Counterparties.Destination.Detail.DestinationDetailItemExternalCryptoData;
551
+ }
552
+ }
553
+
554
+ export namespace Update {
555
+ export interface Request {
556
+ wallet_id: string;
557
+ counterparty_account_id: string;
558
+ counterparty_destination_id: string;
559
+ nickname: string;
560
+ }
561
+
562
+ export type Response = API.Counterparties.Destination.Detail.DestinationDetailItemCommonFields;
563
+ }
564
+ }
565
+
566
+ export namespace GetById {
567
+ export interface Request {
568
+ wallet_id: string;
569
+ counterparty_account_id: string;
570
+ }
571
+
572
+ export type Response = Counterparty;
573
+ }
574
+
575
+ export namespace List {
576
+ export interface Request {
577
+ wallet_id: string;
578
+ offset?: number;
579
+ limit?: number;
580
+ sort_by?: 'created_at' | 'nickname' | 'type' | 'email' | 'phone';
581
+ sort_order?: SortingDirection;
582
+ filter?: {
583
+ type?: CounterpartyDestinationType;
584
+ nickname?: string;
585
+ created_at?: string;
586
+ };
587
+ }
588
+
589
+ export type Response = {
590
+ total: number;
591
+ data: Counterparty[];
592
+ };
593
+ }
594
+
595
+ export namespace Create {
596
+ export interface Request {
597
+ email: string;
598
+ phone: string;
599
+ wallet_id: string;
600
+ nickname: string;
601
+ type: CounterpartyType;
602
+ }
603
+
604
+ export type Response = Counterparty;
605
+ }
606
+
607
+ export namespace Update {
608
+ export interface Request {
609
+ wallet_id: string;
610
+ counterparty_account_id: string;
611
+ nickname: string;
612
+ }
613
+
614
+ export type Response = Counterparty;
615
+ }
616
+ }
617
+
618
+ export namespace Currencies {
619
+ interface CommonCurrencyFields {
620
+ uuid: string;
621
+ decimal: number | null;
622
+ is_memo: boolean | null;
623
+ is_stablecoin: boolean;
624
+ is_enabled: boolean; // added
625
+ render_decimal: number;
626
+ meta: {
627
+ icon: string;
628
+ name: string;
629
+ symbol: string;
630
+ description: string;
631
+ };
632
+ type: CurrencyType; // moved
633
+ }
634
+ export interface CryptoCurrency extends CommonCurrencyFields {
635
+ is_crypto: true;
636
+ meta: CommonCurrencyFields['meta'] & {
637
+ chain_id: number;
638
+ contract: string;
639
+ chain_name: string;
640
+ };
641
+ }
642
+ export interface FiatCurrency extends CommonCurrencyFields {
643
+ is_crypto: false;
644
+ meta: CommonCurrencyFields['meta'] & {
645
+ code: string;
646
+ iso_code: number;
647
+ sign: string;
648
+ };
649
+ }
650
+
651
+ export type Currency = CryptoCurrency | FiatCurrency;
652
+
653
+ export type CurrencyList = {
654
+ count: number;
655
+ data: Currency[];
656
+ };
657
+ }
658
+
392
659
  export namespace Developer {
393
660
  export namespace ApiCode {
394
661
  export interface ApiCode {
@@ -693,206 +960,41 @@ export namespace API {
693
960
  }
694
961
  }
695
962
 
696
- export namespace Currencies {
697
- interface CommonCurrencyFields {
698
- uuid: string;
699
- decimal: number | null;
700
- is_memo: boolean | null;
701
- is_stablecoin: boolean;
702
- is_enabled: boolean; // added
703
- render_decimal: number;
704
- meta: {
705
- icon: string;
706
- name: string;
707
- symbol: string;
708
- description: string;
709
- };
710
- type: CurrencyType; // moved
711
- }
712
- export interface CryptoCurrency extends CommonCurrencyFields {
713
- is_crypto: true;
714
- meta: CommonCurrencyFields['meta'] & {
715
- chain_id: number;
716
- contract: string;
717
- chain_name: string;
718
- };
719
- }
720
- export interface FiatCurrency extends CommonCurrencyFields {
721
- is_crypto: false;
722
- meta: CommonCurrencyFields['meta'] & {
723
- code: string;
724
- iso_code: number;
725
- sign: string;
726
- };
727
- }
728
-
729
- export type Currency = CryptoCurrency | FiatCurrency;
730
-
731
- export type CurrencyList = {
732
- count: number;
733
- data: Currency[];
734
- };
735
- }
736
-
737
- export namespace Chains {
738
- export interface Chain {
739
- id: number;
740
- name: string;
741
- symbol: string;
742
- is_beta: boolean | null;
743
- }
744
-
745
- export type ChainList = {
746
- count: number;
747
- data: Chain[];
748
- };
749
- }
750
-
751
- export namespace Wallets {
752
- export interface WallletBalanceCryptoDetails {
753
- uuid: string;
754
- amount: number;
755
- fiat_amount: number;
756
- currency: API.Currencies.Currency;
757
- }
758
- export interface WalletBalanceItem {
759
- symbol: string;
760
- icon: string;
761
- name: string;
762
- is_crypto: boolean;
763
- decimal?: number | null;
764
- amount: number;
765
- fiat_amount: number;
766
- details: WallletBalanceCryptoDetails[];
767
- }
768
-
769
- export type WalletBalance = WalletBalanceItem[];
770
-
771
- export namespace WalletChain {
772
- export interface WalletChain {
773
- uuid: string;
774
- created_ad: string;
775
- address: string;
776
- wallet_uuid: string;
777
- chain: number;
778
- }
779
-
780
- export namespace Create {
781
- export interface Request {
782
- wallet_uuid: string;
783
- chain: number;
784
- label: string;
785
- }
786
- export type Response = WalletChain;
787
- }
788
- }
789
-
790
- export interface Wallet {
791
- uuid: string;
792
- type: WalletType | string;
793
- created_at: string;
794
- fiat_total: number;
795
- crypto_total: number;
796
- total_amount: number;
797
- balance: WalletBalance;
798
- }
799
-
800
- export namespace WalletsList {
801
- export interface WalletsListItem {
802
- type: WalletType | string;
803
- uuid: string;
804
- created_at: string;
805
- }
806
-
807
- export type Response = {
808
- total: number;
809
- data: WalletsListItem[];
810
- };
811
- }
812
-
813
- export namespace WalletTransactions {
814
- export interface WalletTransactionMeta {
815
- transaction_hash?: string;
816
- fee?: number;
817
- order_id?: string;
818
- from_address?: string; // not added on backend
819
- to_address?: string;
820
- network_fee?: number;
821
- network_fee_currency?: string;
822
- fee_currency?: string;
823
- billing_amount?: number;
824
- utila_transaction?: string;
825
- transcation_amount?: number;
826
- transaction_amount?: number;
827
- billing_amount_currency?: string;
828
- transcation_amount_currency?: string;
829
- transaction_amount_currency?: string;
830
- exchange_rate?: number;
831
- fiat_account_id?: string;
832
- txid?: string;
833
- chain_id?: number;
834
- from_user_data?: number;
835
- to_user_data?: number;
836
- to_card_id?: string;
837
- to_card_last4?: string;
838
- to_fiat_account_id?: string;
839
- to_vendor_id?: string;
840
- }
841
- export interface Transaction {
963
+ export namespace Location {
964
+ export namespace Countries {
965
+ export interface Country {
842
966
  id: number;
843
- created_at: string;
844
- type: WalletTransactionType | string;
845
- method: WalletTransactionMethod | string;
846
- status: string;
847
- amount: number;
848
- from: string | null; // deprecated?
849
- to: string | null; // deprecated?
850
- wallet_id: string;
851
- txid: string; // deprecated?
852
- info: string;
853
- currency: API.Currencies.Currency;
854
- record_type: WalletTransactionRecordType | string;
855
- meta?: WalletTransactionMeta;
856
- }
857
-
858
- export interface DetailedTransaction {
859
- id: number;
860
- amount: number;
861
- created_at: string;
862
- from: string;
863
- info: string;
864
- status: string;
865
- to: string;
866
- txid: string;
867
- type: WalletTransactionType | string;
868
- wallet_id: string;
869
- method: WalletTransactionMethod | string;
870
- meta: WalletTransactionMeta;
871
- record_type: WalletTransactionRecordType | string;
872
- currency: API.Currencies.Currency;
967
+ capital: string;
968
+ currency: string;
969
+ currency_name: string;
970
+ currency_symbol: string;
971
+ emoji: string;
972
+ emojiU: string;
973
+ flag: number;
974
+ iso2: string;
975
+ iso3: string;
976
+ latitude: number;
977
+ longitude: number;
978
+ name: string;
979
+ nationality: string;
980
+ native: string;
981
+ numeric_code: string;
982
+ phonecode: string;
983
+ region: string;
984
+ region_id: number;
985
+ subregion: string;
986
+ subregion_id: number;
987
+ timezones: object[]; // TODO: add type
988
+ tld: string;
989
+ translations: object[]; // TODO: add type
990
+ wikiDataId: string;
873
991
  }
874
992
 
875
- export namespace GetByUuid {
876
- export type Request = {
877
- wallet_uuid: string;
878
- uuid: string;
879
- };
880
- }
881
-
882
- export namespace TransactionList {
883
- export type Request = {
884
- wallet_uuid: string;
885
- limit?: number;
886
- offset?: number;
887
- };
888
- export type Response = {
889
- total: number;
890
- data: Transaction[];
891
- };
993
+ export namespace List {
994
+ export type Response = API.Location.Countries.Country[];
892
995
  }
893
996
  }
894
997
  }
895
-
896
998
  export namespace Orders {
897
999
  export namespace Create {
898
1000
  export namespace ByOrderType {
@@ -1188,4 +1290,149 @@ export namespace API {
1188
1290
  }
1189
1291
  }
1190
1292
  }
1293
+
1294
+ export namespace Wallets {
1295
+ export interface WallletBalanceCryptoDetails {
1296
+ uuid: string;
1297
+ amount: number;
1298
+ fiat_amount: number;
1299
+ currency: API.Currencies.Currency;
1300
+ }
1301
+ export interface WalletBalanceItem {
1302
+ symbol: string;
1303
+ icon: string;
1304
+ name: string;
1305
+ is_crypto: boolean;
1306
+ decimal?: number | null;
1307
+ amount: number;
1308
+ fiat_amount: number;
1309
+ details: WallletBalanceCryptoDetails[];
1310
+ }
1311
+
1312
+ export type WalletBalance = WalletBalanceItem[];
1313
+
1314
+ export namespace WalletChain {
1315
+ export interface WalletChain {
1316
+ uuid: string;
1317
+ created_ad: string;
1318
+ address: string;
1319
+ wallet_uuid: string;
1320
+ chain: number;
1321
+ }
1322
+
1323
+ export namespace Create {
1324
+ export interface Request {
1325
+ wallet_uuid: string;
1326
+ chain: number;
1327
+ label: string;
1328
+ }
1329
+ export type Response = WalletChain;
1330
+ }
1331
+ }
1332
+
1333
+ export interface Wallet {
1334
+ uuid: string;
1335
+ type: WalletType | string;
1336
+ created_at: string;
1337
+ fiat_total: number;
1338
+ crypto_total: number;
1339
+ total_amount: number;
1340
+ balance: WalletBalance;
1341
+ }
1342
+
1343
+ export namespace WalletsList {
1344
+ export interface WalletsListItem {
1345
+ type: WalletType | string;
1346
+ uuid: string;
1347
+ created_at: string;
1348
+ }
1349
+
1350
+ export type Response = {
1351
+ total: number;
1352
+ data: WalletsListItem[];
1353
+ };
1354
+ }
1355
+
1356
+ export namespace WalletTransactions {
1357
+ export interface WalletTransactionMeta {
1358
+ transaction_hash?: string;
1359
+ fee?: number;
1360
+ order_id?: string;
1361
+ from_address?: string; // not added on backend
1362
+ to_address?: string;
1363
+ network_fee?: number;
1364
+ network_fee_currency?: string;
1365
+ fee_currency?: string;
1366
+ billing_amount?: number;
1367
+ utila_transaction?: string;
1368
+ transcation_amount?: number;
1369
+ transaction_amount?: number;
1370
+ billing_amount_currency?: string;
1371
+ transcation_amount_currency?: string;
1372
+ transaction_amount_currency?: string;
1373
+ exchange_rate?: number;
1374
+ fiat_account_id?: string;
1375
+ txid?: string;
1376
+ chain_id?: number;
1377
+ from_user_data?: number;
1378
+ to_user_data?: number;
1379
+ to_card_id?: string;
1380
+ to_card_last4?: string;
1381
+ to_fiat_account_id?: string;
1382
+ to_vendor_id?: string;
1383
+ }
1384
+ export interface Transaction {
1385
+ id: number;
1386
+ created_at: string;
1387
+ type: WalletTransactionType | string;
1388
+ method: WalletTransactionMethod | string;
1389
+ status: string;
1390
+ amount: number;
1391
+ from: string | null; // deprecated?
1392
+ to: string | null; // deprecated?
1393
+ wallet_id: string;
1394
+ txid: string; // deprecated?
1395
+ info: string;
1396
+ currency: API.Currencies.Currency;
1397
+ record_type: WalletTransactionRecordType | string;
1398
+ meta?: WalletTransactionMeta;
1399
+ }
1400
+
1401
+ export interface DetailedTransaction {
1402
+ id: number;
1403
+ amount: number;
1404
+ created_at: string;
1405
+ from: string;
1406
+ info: string;
1407
+ status: string;
1408
+ to: string;
1409
+ txid: string;
1410
+ type: WalletTransactionType | string;
1411
+ wallet_id: string;
1412
+ method: WalletTransactionMethod | string;
1413
+ meta: WalletTransactionMeta;
1414
+ record_type: WalletTransactionRecordType | string;
1415
+ currency: API.Currencies.Currency;
1416
+ }
1417
+
1418
+ export namespace GetByUuid {
1419
+ export type Request = {
1420
+ wallet_uuid: string;
1421
+ uuid: string;
1422
+ };
1423
+ }
1424
+
1425
+ export namespace TransactionList {
1426
+ export type Request = {
1427
+ wallet_uuid: string;
1428
+ limit?: number;
1429
+ offset?: number;
1430
+ };
1431
+ export type Response = {
1432
+ total: number;
1433
+ data: Transaction[];
1434
+ };
1435
+ }
1436
+ }
1437
+ }
1191
1438
  }
package/src/constants.ts CHANGED
@@ -183,3 +183,17 @@ export enum SortingDirection {
183
183
  ASC = 'ASC',
184
184
  DESC = 'DESC',
185
185
  }
186
+
187
+ export enum CounterpartyType {
188
+ INDIVIDUAL = 'INDIVIDUAL',
189
+ BUSINESS = 'BUSINESS',
190
+ }
191
+
192
+ export enum CounterpartyDestinationType {
193
+ DOMESTIC_WIRE = 'DOMESTIC_WIRE',
194
+ ACH = 'ACH',
195
+ SWIFT = 'SWIFT',
196
+ SEPA = 'SEPA',
197
+ CRYPTO_EXTERNAL = 'CRYPTO_EXTERNAL',
198
+ CRYPTO_INTERNAL = 'CRYPTO_INTERNAL',
199
+ }