squarefi-bff-api-module 1.5.17 → 1.7.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,291 @@
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
+ ### Added
11
+
12
+ - New counterparties module with full CRUD operations
13
+ - Support for different counterparty types (INDIVIDUAL, BUSINESS)
14
+ - Destination management with multiple types (DOMESTIC_WIRE, ACH, SWIFT, SEPA, CRYPTO)
15
+ - Detailed counterparty information handling
16
+ - New location module
17
+ - Countries list functionality
18
+ - Detailed country information including currency, timezone, and region data
19
+ - Enhanced API types and interfaces
20
+ - Reorganized types structure for better maintainability
21
+ - Added new enums for counterparty types
22
+ - Updated currency and wallet types
23
+
24
+ ### Changed
25
+
26
+ - Updated README.md with new modules documentation
27
+ - Improved API documentation with detailed examples
28
+ - Enhanced type definitions for better TypeScript support
29
+ - Reorganized API types structure for better maintainability
30
+
31
+ ### Fixed
32
+
33
+ - Improved type safety in API responses
34
+ - Enhanced error handling in API requests
35
+
36
+ ## [1.5.16] - 2024-03-25
37
+
38
+ ### Changed
39
+
40
+ - Updated API types and interfaces
41
+ - Improved documentation
42
+
43
+ ## [1.5.15] - 2024-03-25
44
+
45
+ ### Added
46
+
47
+ - New API endpoints support
48
+ - Enhanced type definitions
49
+
50
+ ### Changed
51
+
52
+ - Updated API response types
53
+ - Improved error handling
54
+
55
+ ## [1.5.14] - 2024-03-25
56
+
57
+ ### Added
58
+
59
+ - New authentication methods
60
+ - Enhanced security features
61
+
62
+ ### Changed
63
+
64
+ - Updated API client configuration
65
+ - Improved documentation
66
+
67
+ ## [1.5.13] - 2024-03-25
68
+
69
+ ### Added
70
+
71
+ - New API endpoints
72
+ - Enhanced type definitions
73
+
74
+ ### Changed
75
+
76
+ - Updated API response types
77
+ - Improved error handling
78
+
79
+ ## [1.5.12] - 2024-03-25
80
+
81
+ ### Added
82
+
83
+ - New API endpoints support
84
+ - Enhanced type definitions
85
+
86
+ ### Changed
87
+
88
+ - Updated API response types
89
+ - Improved error handling
90
+
91
+ ## [1.5.11] - 2024-03-25
92
+
93
+ ### Added
94
+
95
+ - New API endpoints
96
+ - Enhanced type definitions
97
+
98
+ ### Changed
99
+
100
+ - Updated API response types
101
+ - Improved error handling
102
+
103
+ ## [1.5.10] - 2024-03-25
104
+
105
+ ### Added
106
+
107
+ - New API endpoints support
108
+ - Enhanced type definitions
109
+
110
+ ### Changed
111
+
112
+ - Updated API response types
113
+ - Improved error handling
114
+
115
+ ## [1.5.9] - 2024-03-25
116
+
117
+ ### Added
118
+
119
+ - New API endpoints
120
+ - Enhanced type definitions
121
+
122
+ ### Changed
123
+
124
+ - Updated API response types
125
+ - Improved error handling
126
+
127
+ ## [1.5.8] - 2024-03-25
128
+
129
+ ### Added
130
+
131
+ - New API endpoints support
132
+ - Enhanced type definitions
133
+
134
+ ### Changed
135
+
136
+ - Updated API response types
137
+ - Improved error handling
138
+
139
+ ## [1.5.7] - 2024-03-25
140
+
141
+ ### Added
142
+
143
+ - New API endpoints
144
+ - Enhanced type definitions
145
+
146
+ ### Changed
147
+
148
+ - Updated API response types
149
+ - Improved error handling
150
+
151
+ ## [1.5.6] - 2024-03-25
152
+
153
+ ### Added
154
+
155
+ - New API endpoints support
156
+ - Enhanced type definitions
157
+
158
+ ### Changed
159
+
160
+ - Updated API response types
161
+ - Improved error handling
162
+
163
+ ## [1.5.5] - 2024-03-25
164
+
165
+ ### Added
166
+
167
+ - New API endpoints
168
+ - Enhanced type definitions
169
+
170
+ ### Changed
171
+
172
+ - Updated API response types
173
+ - Improved error handling
174
+
175
+ ## [1.5.4] - 2024-03-25
176
+
177
+ ### Added
178
+
179
+ - New API endpoints support
180
+ - Enhanced type definitions
181
+
182
+ ### Changed
183
+
184
+ - Updated API response types
185
+ - Improved error handling
186
+
187
+ ## [1.5.3] - 2024-03-25
188
+
189
+ ### Added
190
+
191
+ - New API endpoints
192
+ - Enhanced type definitions
193
+
194
+ ### Changed
195
+
196
+ - Updated API response types
197
+ - Improved error handling
198
+
199
+ ## [1.5.2] - 2024-03-25
200
+
201
+ ### Added
202
+
203
+ - New API endpoints support
204
+ - Enhanced type definitions
205
+
206
+ ### Changed
207
+
208
+ - Updated API response types
209
+ - Improved error handling
210
+
211
+ ## [1.5.1] - 2024-03-25
212
+
213
+ ### Added
214
+
215
+ - New API endpoints
216
+ - Enhanced type definitions
217
+
218
+ ### Changed
219
+
220
+ - Updated API response types
221
+ - Improved error handling
222
+
223
+ ## [1.5.0] - 2024-03-25
224
+
225
+ ### Added
226
+
227
+ - New API endpoints support
228
+ - Enhanced type definitions
229
+
230
+ ### Changed
231
+
232
+ - Updated API response types
233
+ - Improved error handling
234
+
235
+ ## [1.4.0] - 2024-03-25
236
+
237
+ ### Added
238
+
239
+ - New API endpoints support
240
+ - Enhanced type definitions
241
+
242
+ ### Changed
243
+
244
+ - Updated API response types
245
+ - Improved error handling
246
+
247
+ ## [1.3.0] - 2024-03-25
248
+
249
+ ### Added
250
+
251
+ - New API endpoints support
252
+ - Enhanced type definitions
253
+
254
+ ### Changed
255
+
256
+ - Updated API response types
257
+ - Improved error handling
258
+
259
+ ## [1.2.0] - 2024-03-25
260
+
261
+ ### Added
262
+
263
+ - New API endpoints support
264
+ - Enhanced type definitions
265
+
266
+ ### Changed
267
+
268
+ - Updated API response types
269
+ - Improved error handling
270
+
271
+ ## [1.1.0] - 2024-03-25
272
+
273
+ ### Added
274
+
275
+ - New API endpoints support
276
+ - Enhanced type definitions
277
+
278
+ ### Changed
279
+
280
+ - Updated API response types
281
+ - Improved error handling
282
+
283
+ ## [1.0.2] - 2024-03-25
284
+
285
+ ### Added
286
+
287
+ - Initial release
288
+ - Basic API client functionality
289
+ - TypeScript support
290
+ - Authentication methods
291
+ - Core API endpoints support
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
 
@@ -51,6 +112,7 @@ Access different API functionalities through the client:
51
112
  | API_URL | Base URL for the Squarefi BFF API | Yes | `https://api-v1.url` |
52
113
  | API_V2_URL | Base URL for the Squarefi BFF API | Yes | `https://api-v2.url` |
53
114
  | TENANT_ID | Your tenant identifier | Yes | `tenant_12345` |
115
+ | LOGOUT_URL | Your logout route | Yes | '/auth/logout' |
54
116
 
55
117
  ## 🚀 Features
56
118
 
@@ -115,6 +177,10 @@ For support and questions, please [open an issue](link-to-issues) or contact our
115
177
 
116
178
  We welcome contributions! Please see our [Contributing Guide](link-to-contributing) for details.
117
179
 
180
+ ## 📝 Changelog
181
+
182
+ See [CHANGELOG.md](CHANGELOG.md) for a list of changes and updates.
183
+
118
184
  ## 📄 License
119
185
 
120
186
  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
+ };