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/CHANGELOG.md ADDED
@@ -0,0 +1,155 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.5.17] - 2024-03-25
9
+
10
+ ### Changed
11
+
12
+ - Updated type property in SubAccount for enhanced flexibility
13
+
14
+ ## [1.5.16] - 2024-03-25
15
+
16
+ ### Changed
17
+
18
+ - Refactored fiat_account type in IssuingCardDetailItem to use FiatAccounts.FiatAccount for better structure and consistency
19
+
20
+ ## [1.5.15] - 2024-03-25
21
+
22
+ ### Changed
23
+
24
+ - Refactored fiat_account type in IssuingCardListItem to use FiatAccounts.FiatAccount for improved structure and consistency
25
+
26
+ ## [1.5.14] - 2024-03-25
27
+
28
+ ### Changed
29
+
30
+ - Updated currency type in API types from Currencies.Currency to Currencies.FiatCurrency for enhanced clarity and specificity
31
+
32
+ ## [1.5.13] - 2024-03-25
33
+
34
+ ### Changed
35
+
36
+ - Updated currency type in API types from Currencies.Currency to Currencies.FiatCurrency for improved clarity
37
+
38
+ ## [1.5.12] - 2024-03-25
39
+
40
+ ### Added
41
+
42
+ - Added optional security_code property to CardSensitiveData interface in API types
43
+
44
+ ## [1.5.11] - 2024-03-25
45
+
46
+ ### Changed
47
+
48
+ - Refactored StandAloneRequest type to simplify structure by removing unnecessary properties while maintaining compatibility with CommonRequest
49
+
50
+ ## [1.5.10] - 2024-03-25
51
+
52
+ ### Changed
53
+
54
+ - Refactored API types to introduce a CommonRequest interface for shared properties in StandAloneRequest and FiatAccountRequest
55
+
56
+ ## [1.5.9] - 2024-03-25
57
+
58
+ ### Added
59
+
60
+ - Added card issuing and fee properties to API types
61
+
62
+ ## [1.5.8] - 2024-03-25
63
+
64
+ ### Changed
65
+
66
+ - Updated package dependencies to use caret versioning
67
+ - Made filter properties optional in API types
68
+
69
+ ## [1.5.7] - 2024-03-25
70
+
71
+ ### Changed
72
+
73
+ - Updated API list filtering from array to object
74
+
75
+ ## [1.5.6] - 2024-03-25
76
+
77
+ ### Changed
78
+
79
+ - Refactored logout handling in API client to use window.location.href for redirection instead of navigate function
80
+
81
+ ## [1.5.5] - 2024-03-25
82
+
83
+ ### Changed
84
+
85
+ - Refactored authentication API types to replace SupabaseGetSessionResponse with Tokens for sign-in and sign-up methods
86
+
87
+ ## [1.5.4] - 2024-03-25
88
+
89
+ ### Changed
90
+
91
+ - Updated authentication API endpoints to include '/email' suffix for sign-in and sign-up methods
92
+
93
+ ## [1.5.3] - 2024-03-25
94
+
95
+ ### Added
96
+
97
+ - Introduced new SortingDirection enum
98
+ - Updated types for issuing card details and limits
99
+
100
+ ## [1.5.2] - 2024-03-25
101
+
102
+ ### Changed
103
+
104
+ - Enhanced API types and wallet transactions structure
105
+ - Added DetailedTransaction interface
106
+ - Refactored transaction retrieval methods for improved clarity and functionality
107
+
108
+ ## [1.5.1] - 2024-03-25
109
+
110
+ ### Changed
111
+
112
+ - Updated README and API exports for squarefi_bff_api_client
113
+ - Enhanced documentation with installation, usage examples, environment variables, and security practices
114
+
115
+ ## [1.5.0] - 2024-03-25
116
+
117
+ ### Changed
118
+
119
+ - Removed react-icons dependency
120
+
121
+ ## [1.4.0] - 2024-03-25
122
+
123
+ ### Added
124
+
125
+ - Added tenants module to API
126
+
127
+ ## [1.3.0] - 2024-03-25
128
+
129
+ ### Changed
130
+
131
+ - Refactored API request methods to remove unnecessary promise chaining in exchange, issuing, list, orders, and wallets modules for improved readability and consistency
132
+
133
+ ## [1.2.0] - 2024-03-25
134
+
135
+ ### Changed
136
+
137
+ - Exported squarefiBffApiClient as a named export in the API module
138
+
139
+ ## [1.1.0] - 2024-03-25
140
+
141
+ ### Changed
142
+
143
+ - Refactored API client imports to use centralized apiClientFactory
144
+ - Updated import paths in auth, developer, exchange, fiat_accounts, issuing, kyc, list, orders, user, and wallets modules
145
+
146
+ ## [1.0.2] - 2024-03-25
147
+
148
+ ### Changed
149
+
150
+ - Initial release with core functionality
151
+ - Basic API client implementation
152
+ - Support for authentication
153
+ - Wallet management features
154
+ - Exchange operations
155
+ - Card issuing capabilities
package/README.md CHANGED
@@ -14,19 +14,46 @@ npm install squarefi-bff-api-module
14
14
  import { squarefi_bff_api_client } from 'squarefi-bff-api-module';
15
15
 
16
16
  // Authentication
17
- await squarefi_bff_api_client.auth.login(credentials);
18
-
19
- // Exchange operations
20
- const rates = await squarefi_bff_api_client.exchange.getRates();
21
-
22
- // Tenant operations
23
- const tenantInfo = await squarefi_bff_api_client.tenants.getTenantInfo();
17
+ await squarefi_bff_api_client.auth.signin.omni.email({
18
+ email: 'user@example.com',
19
+ invite_code: 'optional_invite_code',
20
+ referrer: 'optional_referrer',
21
+ redirect_url: 'optional_redirect_url',
22
+ });
23
+
24
+ // Telegram authentication
25
+ await squarefi_bff_api_client.auth.signin.telegram({
26
+ tg_id: 123456789,
27
+ hash: 'telegram_hash',
28
+ init_data_raw: 'telegram_init_data',
29
+ });
30
+
31
+ // Password authentication
32
+ await squarefi_bff_api_client.auth.signin.password('user@example.com', 'password');
33
+
34
+ // OTP verification
35
+ await squarefi_bff_api_client.auth.otp.verify.email('user@example.com', 'otp_token');
36
+ await squarefi_bff_api_client.auth.otp.verify.phone('+1234567890', 'otp_token');
37
+
38
+ // User operations
39
+ const userData = await squarefi_bff_api_client.user.get();
40
+ const userProfile = await squarefi_bff_api_client.user.userData.get();
24
41
 
25
42
  // Wallet operations
26
- const balance = await squarefi_bff_api_client.wallets.getBalance();
43
+ const wallets = await squarefi_bff_api_client.wallets.getAll();
44
+ const walletDetails = await squarefi_bff_api_client.wallets.getByUuid('wallet_uuid');
45
+
46
+ // Card operations
47
+ const cards = await squarefi_bff_api_client.issuing.cards.byWalletUuid.getAll({
48
+ wallet_uuid: 'wallet_uuid',
49
+ limit: 10,
50
+ offset: 0,
51
+ });
27
52
 
28
- // Fiat accounts
29
- const accounts = await squarefi_bff_api_client.fiat_accounts.getAccounts();
53
+ // Exchange operations
54
+ const exchangeRates = await squarefi_bff_api_client.exchange.byOrderType[OrderType.DEPOSIT_FIAT_SEPA].getByFromCurrency(
55
+ 'from_uuid'
56
+ );
30
57
  ```
31
58
 
32
59
  ## 📚 Available API Modules
@@ -34,15 +61,49 @@ const accounts = await squarefi_bff_api_client.fiat_accounts.getAccounts();
34
61
  Access different API functionalities through the client:
35
62
 
36
63
  - `squarefi_bff_api_client.auth` - Authentication and authorization
64
+ - OTP verification (email/phone)
65
+ - Sign in (email/phone/telegram/password)
66
+ - Sign up (email/telegram)
67
+ - Token refresh
68
+ - `squarefi_bff_api_client.counterparties` - Counterparty management
69
+ - List, create, update counterparties
70
+ - Manage counterparty destinations
71
+ - `squarefi_bff_api_client.developer` - Developer tools
72
+ - API key management
73
+ - Vendor management
37
74
  - `squarefi_bff_api_client.exchange` - Currency exchange operations
75
+ - Get exchange rates by order type
76
+ - Get rates by currency
38
77
  - `squarefi_bff_api_client.fiat_accounts` - Fiat account management
78
+ - List accounts with/without cards
79
+ - Create and manage fiat accounts
80
+ - Transaction history
39
81
  - `squarefi_bff_api_client.issuing` - Card issuing operations
82
+ - Create and manage cards
83
+ - Card limits and controls
84
+ - Transaction history
85
+ - Card status management
40
86
  - `squarefi_bff_api_client.kyc` - Know Your Customer procedures
87
+ - Sumsub integration
41
88
  - `squarefi_bff_api_client.list` - Listing and pagination utilities
89
+ - Currencies list
90
+ - Chains list
91
+ - `squarefi_bff_api_client.location` - Location services
92
+ - Countries list
42
93
  - `squarefi_bff_api_client.orders` - Order management
94
+ - Create orders by type
95
+ - Calculate exchange rates
43
96
  - `squarefi_bff_api_client.tenants` - Tenant management operations
97
+ - Tenant configuration
44
98
  - `squarefi_bff_api_client.user` - User profile operations
99
+ - Get/update user data
100
+ - Update contact information
101
+ - OTP verification
45
102
  - `squarefi_bff_api_client.wallets` - Crypto wallet operations
103
+ - Create and manage wallets
104
+ - Address management
105
+ - Transaction history
106
+ - Balance tracking
46
107
 
47
108
  ## ⚙️ Environment Variables
48
109
 
@@ -115,6 +176,10 @@ For support and questions, please [open an issue](link-to-issues) or contact our
115
176
 
116
177
  We welcome contributions! Please see our [Contributing Guide](link-to-contributing) for details.
117
178
 
179
+ ## 📝 Changelog
180
+
181
+ See [CHANGELOG.md](CHANGELOG.md) for a list of changes and updates.
182
+
118
183
  ## 📄 License
119
184
 
120
185
  MIT
@@ -0,0 +1,13 @@
1
+ import { API } from './types';
2
+ export declare const counterparties: {
3
+ getAll: ({ wallet_id, ...params }: API.Counterparties.List.Request) => Promise<API.Counterparties.List.Response>;
4
+ getById: ({ wallet_id, counterparty_account_id }: API.Counterparties.GetById.Request) => Promise<API.Counterparties.Counterparty>;
5
+ create: ({ wallet_id, ...data }: API.Counterparties.Create.Request) => Promise<API.Counterparties.Counterparty>;
6
+ update: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Update.Request) => Promise<API.Counterparties.Counterparty>;
7
+ destinations: {
8
+ getAll: ({ wallet_id, counterparty_account_id, ...params }: API.Counterparties.Destination.List.Request) => Promise<API.Counterparties.Destination.List.Response>;
9
+ getById: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }: API.Counterparties.Destination.Detail.Request) => Promise<API.Counterparties.Destination.Detail.DestinationDetailItem>;
10
+ create: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Destination.Create.Request) => Promise<API.Counterparties.Destination.Create.Response>;
11
+ update: ({ wallet_id, counterparty_account_id, counterparty_destination_id, ...data }: API.Counterparties.Destination.Update.Request) => Promise<API.Counterparties.Destination.List.DestinationListItemCommonFields>;
12
+ };
13
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.counterparties = void 0;
15
+ const apiClientFactory_1 = require("../utils/apiClientFactory");
16
+ exports.counterparties = {
17
+ getAll: (_a) => {
18
+ var { wallet_id } = _a, params = __rest(_a, ["wallet_id"]);
19
+ return apiClientFactory_1.apiClientV2.getRequest(`/counterparties/${wallet_id}`, {
20
+ params,
21
+ });
22
+ },
23
+ getById: ({ wallet_id, counterparty_account_id }) => apiClientFactory_1.apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`),
24
+ create: (_a) => {
25
+ var { wallet_id } = _a, data = __rest(_a, ["wallet_id"]);
26
+ return apiClientFactory_1.apiClientV2.postRequest(`/counterparties/${wallet_id}`, { data });
27
+ },
28
+ update: (_a) => {
29
+ var { wallet_id, counterparty_account_id } = _a, data = __rest(_a, ["wallet_id", "counterparty_account_id"]);
30
+ return apiClientFactory_1.apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`, { data });
31
+ },
32
+ destinations: {
33
+ getAll: (_a) => {
34
+ var { wallet_id, counterparty_account_id } = _a, params = __rest(_a, ["wallet_id", "counterparty_account_id"]);
35
+ return apiClientFactory_1.apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { params });
36
+ },
37
+ getById: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }) => apiClientFactory_1.apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`),
38
+ create: (_a) => {
39
+ var { wallet_id, counterparty_account_id } = _a, data = __rest(_a, ["wallet_id", "counterparty_account_id"]);
40
+ return apiClientFactory_1.apiClientV2.postRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { data });
41
+ },
42
+ update: (_a) => {
43
+ var { wallet_id, counterparty_account_id, counterparty_destination_id } = _a, data = __rest(_a, ["wallet_id", "counterparty_account_id", "counterparty_destination_id"]);
44
+ return apiClientFactory_1.apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`, { data });
45
+ },
46
+ },
47
+ };
@@ -1,4 +1,5 @@
1
1
  import { auth } from './auth';
2
+ import { counterparties } from './counterparties';
2
3
  import { developer } from './developer';
3
4
  import { exchange } from './exchange';
4
5
  import { fiat_accounts } from './fiat_accounts';
@@ -11,12 +12,14 @@ import { user } from './user';
11
12
  import { wallets } from './wallets';
12
13
  type Api = {
13
14
  auth: typeof auth;
15
+ counterparties: typeof counterparties;
14
16
  developer: typeof developer;
15
17
  exchange: typeof exchange;
16
18
  fiat_accounts: typeof fiat_accounts;
17
19
  issuing: typeof issuing;
18
20
  kyc: typeof kyc;
19
21
  list: typeof list;
22
+ location: typeof location;
20
23
  orders: typeof orders;
21
24
  tenants: typeof tenants;
22
25
  user: typeof user;
package/dist/api/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.squarefi_bff_api_client = void 0;
4
4
  const auth_1 = require("./auth");
5
+ const counterparties_1 = require("./counterparties");
5
6
  const developer_1 = require("./developer");
6
7
  const exchange_1 = require("./exchange");
7
8
  const fiat_accounts_1 = require("./fiat_accounts");
@@ -14,12 +15,14 @@ const user_1 = require("./user");
14
15
  const wallets_1 = require("./wallets");
15
16
  exports.squarefi_bff_api_client = {
16
17
  auth: auth_1.auth,
18
+ counterparties: counterparties_1.counterparties,
17
19
  developer: developer_1.developer,
18
20
  exchange: exchange_1.exchange,
19
21
  fiat_accounts: fiat_accounts_1.fiat_accounts,
20
22
  issuing: issuing_1.issuing,
21
23
  kyc: kyc_1.kyc,
22
24
  list: list_1.list,
25
+ location,
23
26
  orders: orders_1.orders,
24
27
  tenants: tenants_1.tenants,
25
28
  user: user_1.user,
@@ -0,0 +1,6 @@
1
+ import { API } from './types';
2
+ export declare const location: {
3
+ countries: {
4
+ list: () => Promise<API.Location.Countries.List.Response>;
5
+ };
6
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.location = void 0;
4
+ const apiClientFactory_1 = require("../utils/apiClientFactory");
5
+ exports.location = {
6
+ countries: {
7
+ list: () => apiClientFactory_1.apiClientV2.getRequest('/location/countries'),
8
+ },
9
+ };