squarefi-bff-api-module 1.32.1 → 1.32.2

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 (125) hide show
  1. package/dist/api/auth.d.ts +29 -0
  2. package/dist/api/auth.js +59 -0
  3. package/dist/api/bank-data.d.ts +4 -0
  4. package/dist/api/bank-data.js +6 -0
  5. package/dist/api/counterparties.d.ts +14 -0
  6. package/dist/api/counterparties.js +16 -0
  7. package/dist/api/developer.d.ts +12 -0
  8. package/dist/api/developer.js +12 -0
  9. package/dist/api/exchange.d.ts +14 -0
  10. package/dist/api/exchange.js +20 -0
  11. package/dist/api/frontend.d.ts +11 -0
  12. package/dist/api/frontend.js +11 -0
  13. package/dist/api/index.d.ts +38 -0
  14. package/dist/api/index.js +36 -0
  15. package/dist/api/issuing.d.ts +64 -0
  16. package/dist/api/issuing.js +140 -0
  17. package/dist/api/kyc.d.ts +21 -0
  18. package/dist/api/kyc.js +21 -0
  19. package/dist/api/list.d.ts +16 -0
  20. package/dist/api/list.js +16 -0
  21. package/dist/api/orders.d.ts +49 -0
  22. package/dist/api/orders.js +84 -0
  23. package/dist/api/persona.d.ts +7 -0
  24. package/dist/api/persona.js +7 -0
  25. package/dist/api/storage.d.ts +8 -0
  26. package/dist/api/storage.js +16 -0
  27. package/dist/api/tenants.d.ts +6 -0
  28. package/dist/api/tenants.js +6 -0
  29. package/dist/api/totp.d.ts +17 -0
  30. package/dist/api/totp.js +45 -0
  31. package/{src/api/types/autogen/apiV2.types.ts → dist/api/types/autogen/apiV2.types.d.ts} +0 -1
  32. package/dist/api/types/autogen/apiV2.types.js +5 -0
  33. package/dist/api/types/types.d.ts +2258 -0
  34. package/dist/api/types/types.js +1 -0
  35. package/dist/api/user.d.ts +18 -0
  36. package/dist/api/user.js +18 -0
  37. package/dist/api/virtual-accounts.d.ts +9 -0
  38. package/dist/api/virtual-accounts.js +9 -0
  39. package/dist/api/wallets.d.ts +24 -0
  40. package/dist/api/wallets.js +30 -0
  41. package/dist/constants.d.ts +303 -0
  42. package/dist/constants.js +332 -0
  43. package/dist/hooks/index.js +3 -0
  44. package/dist/hooks/useCalc.d.ts +25 -0
  45. package/dist/hooks/useCalc.js +115 -0
  46. package/dist/hooks/useFileUpload.d.ts +49 -0
  47. package/dist/hooks/useFileUpload.js +100 -0
  48. package/dist/hooks/useSupabaseSubscription/config.d.ts +2 -0
  49. package/dist/hooks/useSupabaseSubscription/config.js +5 -0
  50. package/dist/hooks/useSupabaseSubscription/index.js +2 -0
  51. package/dist/hooks/useSupabaseSubscription/specialized.d.ts +5 -0
  52. package/{src/hooks/useSupabaseSubscription/specialized.ts → dist/hooks/useSupabaseSubscription/specialized.js} +2 -5
  53. package/dist/hooks/useSupabaseSubscription/types.d.ts +16 -0
  54. package/dist/hooks/useSupabaseSubscription/types.js +1 -0
  55. package/dist/hooks/useSupabaseSubscription/useSupabaseSubscription.d.ts +5 -0
  56. package/dist/hooks/useSupabaseSubscription/useSupabaseSubscription.js +37 -0
  57. package/dist/index.d.ts +7 -0
  58. package/dist/utils/apiClientFactory.d.ts +31 -0
  59. package/dist/utils/apiClientFactory.js +138 -0
  60. package/dist/utils/converters.d.ts +1 -0
  61. package/dist/utils/converters.js +1 -0
  62. package/dist/utils/encrypt.d.ts +10 -0
  63. package/dist/utils/encrypt.js +77 -0
  64. package/dist/utils/fileStorage.d.ts +120 -0
  65. package/dist/utils/fileStorage.js +292 -0
  66. package/dist/utils/storage.d.ts +3 -0
  67. package/dist/utils/storage.js +24 -0
  68. package/dist/utils/supabase.d.ts +1 -0
  69. package/dist/utils/supabase.js +12 -0
  70. package/dist/utils/tokensFactory.d.ts +12 -0
  71. package/dist/utils/tokensFactory.js +42 -0
  72. package/package.json +4 -1
  73. package/.env.example +0 -1
  74. package/.husky/pre-commit +0 -2
  75. package/.prettierignore +0 -6
  76. package/.prettierrc +0 -7
  77. package/CHANGELOG.md +0 -1415
  78. package/FIXED_RLS_ERROR.md +0 -146
  79. package/QUICK_TEST.md +0 -127
  80. package/STORAGE_MODULE_SUMMARY.md +0 -228
  81. package/TEST_INSTRUCTIONS.md +0 -122
  82. package/docs/AUTH_TOKEN_USAGE.md +0 -290
  83. package/docs/BACKEND_SERVICE_URL.md +0 -334
  84. package/docs/FRONTEND_STORAGE_GUIDE.md +0 -529
  85. package/docs/STORAGE_MODULE.md +0 -490
  86. package/docs/STORAGE_QUICK_START.md +0 -76
  87. package/scripts/generate-openapi-types.ts +0 -41
  88. package/scripts/supabase-storage-setup.sql +0 -223
  89. package/src/api/auth.ts +0 -78
  90. package/src/api/bank-data.ts +0 -11
  91. package/src/api/counterparties.ts +0 -73
  92. package/src/api/developer.ts +0 -20
  93. package/src/api/exchange.ts +0 -44
  94. package/src/api/frontend.ts +0 -20
  95. package/src/api/index.ts +0 -57
  96. package/src/api/issuing.ts +0 -214
  97. package/src/api/kyc.ts +0 -41
  98. package/src/api/list.ts +0 -26
  99. package/src/api/orders.ts +0 -255
  100. package/src/api/persona.ts +0 -16
  101. package/src/api/storage.ts +0 -24
  102. package/src/api/tenants.ts +0 -8
  103. package/src/api/totp.ts +0 -51
  104. package/src/api/types/types.ts +0 -2820
  105. package/src/api/user.ts +0 -27
  106. package/src/api/virtual-accounts.ts +0 -15
  107. package/src/api/wallets.ts +0 -65
  108. package/src/constants.ts +0 -343
  109. package/src/hooks/useCalc.ts +0 -181
  110. package/src/hooks/useFileUpload.ts +0 -129
  111. package/src/hooks/useSupabaseSubscription/config.ts +0 -7
  112. package/src/hooks/useSupabaseSubscription/types.ts +0 -18
  113. package/src/hooks/useSupabaseSubscription/useSupabaseSubscription.ts +0 -53
  114. package/src/utils/apiClientFactory.ts +0 -194
  115. package/src/utils/converters.ts +0 -1
  116. package/src/utils/encrypt.ts +0 -96
  117. package/src/utils/fileStorage.ts +0 -353
  118. package/src/utils/storage.ts +0 -29
  119. package/src/utils/supabase.ts +0 -16
  120. package/src/utils/tokensFactory.ts +0 -59
  121. package/tsconfig.json +0 -15
  122. package/types.d.ts +0 -11
  123. /package/{src/hooks/index.ts → dist/hooks/index.d.ts} +0 -0
  124. /package/{src/hooks/useSupabaseSubscription/index.ts → dist/hooks/useSupabaseSubscription/index.d.ts} +0 -0
  125. /package/{src/index.ts → dist/index.js} +0 -0
@@ -0,0 +1,29 @@
1
+ import { API } from './types/types';
2
+ export declare const telegramSignInPath = "/auth/sign-in/telegram";
3
+ export declare const telegramSignUpPath = "/auth/sign-up/telegram";
4
+ export declare const refreshTokenPath = "/auth/refresh/refresh-token";
5
+ export declare const auth: {
6
+ otp: {
7
+ verify: {
8
+ email: (email: string, token: string) => Promise<API.Auth.VerifyOtp.Response>;
9
+ phone: (phone: string, token: string) => Promise<API.Auth.VerifyOtp.Response>;
10
+ };
11
+ };
12
+ signin: {
13
+ omni: {
14
+ email: (data: API.Auth.SignIn.Omni.Email.OTP.Request) => Promise<API.Auth.Tokens>;
15
+ phone: ({ phone, ...data }: API.Auth.SignIn.Omni.Phone.OTP.Request) => Promise<API.Auth.Tokens>;
16
+ };
17
+ byType: (data: API.Auth.SignIn.ByType.Request) => Promise<API.Auth.Tokens>;
18
+ telegram: (data: API.Auth.Telegram.Signin.Request) => Promise<API.Auth.Telegram.Signin.Response>;
19
+ password: (email: string, password: string) => Promise<API.Auth.Tokens>;
20
+ };
21
+ signup: {
22
+ byType: (data: API.Auth.SignUp.ByType.Request) => Promise<API.Auth.Tokens>;
23
+ password: (email: string, password: string) => Promise<API.Auth.Tokens>;
24
+ telegram: (data: API.Auth.Telegram.Signup.Request) => Promise<API.Auth.Telegram.Signup.Response>;
25
+ };
26
+ refresh: {
27
+ refresh_token: (data: API.Auth.RefreshToken.Request) => Promise<API.Auth.RefreshToken.Response>;
28
+ };
29
+ };
@@ -0,0 +1,59 @@
1
+ import { apiClientV2 } from '../utils/apiClientFactory';
2
+ import { convertPhoneToSupabaseFormat } from '../utils/converters';
3
+ export const telegramSignInPath = '/auth/sign-in/telegram'; // V2 path
4
+ // export const telegramSignInPath = '/auth/signin/telegram'; // V1 path
5
+ export const telegramSignUpPath = '/auth/sign-up/telegram';
6
+ export const refreshTokenPath = '/auth/refresh/refresh-token';
7
+ export const auth = {
8
+ otp: {
9
+ verify: {
10
+ email: (email, token) => apiClientV2.postRequest('/auth/verify/email/otp', {
11
+ data: { email, token, type: 'email' },
12
+ context: { bypassUnauthorizedHandler: true },
13
+ }),
14
+ phone: (phone, token) => apiClientV2.postRequest('/auth/verify/phone/otp', {
15
+ data: {
16
+ phone: convertPhoneToSupabaseFormat(phone),
17
+ token,
18
+ type: 'sms',
19
+ },
20
+ context: { bypassUnauthorizedHandler: true },
21
+ }),
22
+ },
23
+ },
24
+ signin: {
25
+ omni: {
26
+ email: (data) => apiClientV2.postRequest('/auth/sign-in/omni/email/otp', {
27
+ data,
28
+ context: { bypassUnauthorizedHandler: true },
29
+ }),
30
+ phone: ({ phone, ...data }) => apiClientV2.postRequest('/auth/sign-in/omni/phone/otp', {
31
+ data: { phone: convertPhoneToSupabaseFormat(phone), ...data },
32
+ context: { bypassUnauthorizedHandler: true },
33
+ }),
34
+ },
35
+ byType: (data) => apiClientV2.postRequest('/auth/sign-in', {
36
+ data,
37
+ context: { bypassUnauthorizedHandler: true },
38
+ }),
39
+ telegram: (data) => apiClientV2.postRequest(telegramSignInPath, { data }),
40
+ password: (email, password) => apiClientV2.postRequest('/auth/sign-in/password/email', {
41
+ data: { email, password },
42
+ context: { bypassUnauthorizedHandler: true },
43
+ }),
44
+ },
45
+ signup: {
46
+ byType: (data) => apiClientV2.postRequest('/auth/sign-up', {
47
+ data,
48
+ context: { bypassUnauthorizedHandler: true },
49
+ }),
50
+ password: (email, password) => apiClientV2.postRequest('/auth/sign-up/password/email', {
51
+ data: { email, password },
52
+ context: { bypassUnauthorizedHandler: true },
53
+ }),
54
+ telegram: (data) => apiClientV2.postRequest(telegramSignUpPath, { data }),
55
+ },
56
+ refresh: {
57
+ refresh_token: (data) => apiClientV2.postRequest(refreshTokenPath, { data }),
58
+ },
59
+ };
@@ -0,0 +1,4 @@
1
+ import { API } from './types/types';
2
+ export declare const bankData: {
3
+ getBankDataByAccountNumber: (params: API.BankData.GetBankDataByAccountNumber.Request) => Promise<API.BankData.GetBankDataByAccountNumber.Response>;
4
+ };
@@ -0,0 +1,6 @@
1
+ import { apiClientV2 } from '../utils/apiClientFactory';
2
+ export const bankData = {
3
+ getBankDataByAccountNumber: (params) => apiClientV2.getRequest(`/bank-data`, {
4
+ params,
5
+ }),
6
+ };
@@ -0,0 +1,14 @@
1
+ import { API } from './types/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.GetById.Response>;
5
+ create: ({ wallet_id, ...data }: API.Counterparties.Create.Request) => Promise<API.Counterparties.Create.Response>;
6
+ update: ({ wallet_id, counterparty_account_id, ...data }: API.Counterparties.Update.Request) => Promise<API.Counterparties.Update.Response>;
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.Response>;
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.Update.Response>;
12
+ delete: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }: API.Counterparties.Destination.Delete.Request) => Promise<void>;
13
+ };
14
+ };
@@ -0,0 +1,16 @@
1
+ import { apiClientV2 } from '../utils/apiClientFactory';
2
+ export const counterparties = {
3
+ getAll: ({ wallet_id, ...params }) => apiClientV2.getRequest(`/counterparties/${wallet_id}`, {
4
+ params,
5
+ }),
6
+ getById: ({ wallet_id, counterparty_account_id, }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`),
7
+ create: ({ wallet_id, ...data }) => apiClientV2.postRequest(`/counterparties/${wallet_id}`, { data }),
8
+ update: ({ wallet_id, counterparty_account_id, ...data }) => apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}`, { data }),
9
+ destinations: {
10
+ getAll: ({ wallet_id, counterparty_account_id, ...params }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { params }),
11
+ getById: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }) => apiClientV2.getRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`),
12
+ create: ({ wallet_id, counterparty_account_id, ...data }) => apiClientV2.postRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations`, { data }),
13
+ update: ({ wallet_id, counterparty_account_id, counterparty_destination_id, ...data }) => apiClientV2.patchRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`, { data }),
14
+ delete: ({ wallet_id, counterparty_account_id, counterparty_destination_id, }) => apiClientV2.deleteRequest(`/counterparties/${wallet_id}/${counterparty_account_id}/destinations/${counterparty_destination_id}`),
15
+ },
16
+ };
@@ -0,0 +1,12 @@
1
+ import { API } from './types/types';
2
+ export declare const developer: {
3
+ apiKeys: {
4
+ getAll: () => Promise<API.Developer.ApiCode.ApiCode[]>;
5
+ create: (data: API.Developer.ApiCode.Create.Request) => Promise<API.Developer.ApiCode.Create.Response>;
6
+ rotate: (data: API.Developer.ApiCode.Rotate.Request) => Promise<API.Developer.ApiCode.Rotate.Response>;
7
+ update: (data: API.Developer.ApiCode.Update.Request) => Promise<void>;
8
+ };
9
+ vendors: {
10
+ list: () => Promise<API.Developer.Vendors.Vendor[]>;
11
+ };
12
+ };
@@ -0,0 +1,12 @@
1
+ import { apiClientV1 } from '../utils/apiClientFactory';
2
+ export const developer = {
3
+ apiKeys: {
4
+ getAll: () => apiClientV1.getRequest('/developer/access/list'),
5
+ create: (data) => apiClientV1.postRequest('/developer/access/create', { data }),
6
+ rotate: (data) => apiClientV1.postRequest(`/developer/access/rotate`, { data }),
7
+ update: (data) => apiClientV1.postRequest(`/developer/access/update`, { data }),
8
+ },
9
+ vendors: {
10
+ list: () => apiClientV1.getRequest('/developer/vendors/list'),
11
+ },
12
+ };
@@ -0,0 +1,14 @@
1
+ import { API } from './types/types';
2
+ import { OrderType } from '../constants';
3
+ type IExchangeByOrderType = {
4
+ getByFromCurrency: (from_uuid: string) => Promise<API.Exchange.Exchange[]>;
5
+ getByToCurrency: (to_uuid: string) => Promise<API.Exchange.Exchange[]>;
6
+ getByOrderType: () => Promise<API.Exchange.Exchange[]>;
7
+ };
8
+ type IExchangeModule = {
9
+ byOrderType: {
10
+ [key in OrderType]: IExchangeByOrderType;
11
+ };
12
+ };
13
+ export declare const exchange: IExchangeModule;
14
+ export {};
@@ -0,0 +1,20 @@
1
+ import { apiClientV1 } from '../utils/apiClientFactory';
2
+ import { OrderType } from '../constants';
3
+ const createOrderTypeMethods = (orderType) => ({
4
+ getByFromCurrency: (from_uuid) => apiClientV1.getRequest('/exchange/', {
5
+ params: { from_uuid, order_type: orderType },
6
+ }),
7
+ getByToCurrency: (to_uuid) => apiClientV1.getRequest('/exchange/', {
8
+ params: { to_uuid, order_type: orderType },
9
+ }),
10
+ getByOrderType: () => apiClientV1.getRequest('/exchange/', {
11
+ params: { order_type: orderType },
12
+ }),
13
+ });
14
+ const orderTypes = Object.values(OrderType);
15
+ export const exchange = {
16
+ byOrderType: orderTypes.reduce((acc, orderType) => {
17
+ acc[orderType] = createOrderTypeMethods(orderType);
18
+ return acc;
19
+ }, {}),
20
+ };
@@ -0,0 +1,11 @@
1
+ import { API } from './types/types';
2
+ export declare const frontend: {
3
+ access: {
4
+ keys: {
5
+ create: (data: API.Frontend.Access.Keys.Create.Request) => Promise<API.Frontend.Access.Keys.Create.Response>;
6
+ list: () => Promise<API.Frontend.Access.Keys.List.Response>;
7
+ regenerate: (key_id: string) => Promise<API.Frontend.Access.Keys.Regenerate.Response>;
8
+ revoke: (key_id: string) => Promise<API.Frontend.Access.Keys.Revoke.Response>;
9
+ };
10
+ };
11
+ };
@@ -0,0 +1,11 @@
1
+ import { apiClientV1 } from '../utils/apiClientFactory';
2
+ export const frontend = {
3
+ access: {
4
+ keys: {
5
+ create: (data) => apiClientV1.postRequest('/frontend/access/keys', { data }),
6
+ list: () => apiClientV1.getRequest('/frontend/access/keys'),
7
+ regenerate: (key_id) => apiClientV1.postRequest(`/frontend/access/keys/${key_id}/regenerate`),
8
+ revoke: (key_id) => apiClientV1.deleteRequest(`/frontend/access/keys/${key_id}`),
9
+ },
10
+ },
11
+ };
@@ -0,0 +1,38 @@
1
+ import { auth } from './auth';
2
+ import { bankData } from './bank-data';
3
+ import { counterparties } from './counterparties';
4
+ import { developer } from './developer';
5
+ import { exchange } from './exchange';
6
+ import { frontend } from './frontend';
7
+ import { issuing } from './issuing';
8
+ import { kyc } from './kyc';
9
+ import { list } from './list';
10
+ import { orders } from './orders';
11
+ import { persona } from './persona';
12
+ import { storage } from './storage';
13
+ import { tenants } from './tenants';
14
+ import { totp } from './totp';
15
+ import { user } from './user';
16
+ import { virtualAccounts } from './virtual-accounts';
17
+ import { wallets } from './wallets';
18
+ type Api = {
19
+ auth: typeof auth;
20
+ bankData: typeof bankData;
21
+ counterparties: typeof counterparties;
22
+ developer: typeof developer;
23
+ exchange: typeof exchange;
24
+ frontend: typeof frontend;
25
+ issuing: typeof issuing;
26
+ kyc: typeof kyc;
27
+ list: typeof list;
28
+ orders: typeof orders;
29
+ persona: typeof persona;
30
+ storage: typeof storage;
31
+ tenants: typeof tenants;
32
+ totp: typeof totp;
33
+ user: typeof user;
34
+ virtualAccounts: typeof virtualAccounts;
35
+ wallets: typeof wallets;
36
+ };
37
+ export declare const squarefi_bff_api_client: Api;
38
+ export {};
@@ -0,0 +1,36 @@
1
+ import { auth } from './auth';
2
+ import { bankData } from './bank-data';
3
+ import { counterparties } from './counterparties';
4
+ import { developer } from './developer';
5
+ import { exchange } from './exchange';
6
+ import { frontend } from './frontend';
7
+ import { issuing } from './issuing';
8
+ import { kyc } from './kyc';
9
+ import { list } from './list';
10
+ import { orders } from './orders';
11
+ import { persona } from './persona';
12
+ import { storage } from './storage';
13
+ import { tenants } from './tenants';
14
+ import { totp } from './totp';
15
+ import { user } from './user';
16
+ import { virtualAccounts } from './virtual-accounts';
17
+ import { wallets } from './wallets';
18
+ export const squarefi_bff_api_client = {
19
+ auth,
20
+ bankData,
21
+ counterparties,
22
+ developer,
23
+ exchange,
24
+ frontend,
25
+ issuing,
26
+ kyc,
27
+ list,
28
+ orders,
29
+ persona,
30
+ storage,
31
+ tenants,
32
+ totp,
33
+ user,
34
+ virtualAccounts,
35
+ wallets,
36
+ };
@@ -0,0 +1,64 @@
1
+ import { API } from './types/types';
2
+ export declare const issuing: {
3
+ cards: {
4
+ create: {
5
+ standAloneCard: {
6
+ prepaid: (data: API.Cards.Create.StandAloneRequest) => Promise<API.Cards.Create.StandAloneResponse>;
7
+ balance: (data: API.Cards.Create.StandAloneRequest) => Promise<API.Cards.Create.ExtendedSubAccountResponse>;
8
+ };
9
+ subAccountCard: (data: API.Cards.Create.SubAccountRequest) => Promise<API.Cards.Create.ExtendedSubAccountResponse>;
10
+ };
11
+ byWalletUuid: {
12
+ getAll: (params: API.Cards.CardsList.Request.ByWalletUuid) => Promise<API.Cards.CardsList.Response>;
13
+ getBySubaccountType: (params: API.Cards.CardsList.Request.BySubaccountAndWalletUuid) => Promise<API.Cards.CardsList.Response>;
14
+ getBySubAccount: (params: API.Cards.CardsList.Request.BySubAccountAndWalletId) => Promise<API.Cards.CardsList.Response>;
15
+ };
16
+ getById: (card_id: string) => Promise<API.Cards.IssuingCardDetailItem>;
17
+ sensitiveData: {
18
+ encrypted: {
19
+ secretKey: {
20
+ get: (card_id: string) => Promise<API.Cards.SensitiveData>;
21
+ };
22
+ };
23
+ otp: {
24
+ get: (card_id: string) => Promise<API.Cards.OTP>;
25
+ };
26
+ };
27
+ freeze: (card_id: string) => Promise<API.Cards.IssuingCardDetailItem>;
28
+ unfreeze: (card_id: string) => Promise<API.Cards.IssuingCardDetailItem>;
29
+ close: (card_id: string) => Promise<void>;
30
+ limits: {
31
+ update: (card_id: string, data: API.Cards.Limits.UpdateRequest) => Promise<API.Cards.IssuingCardDetailItem>;
32
+ };
33
+ rename: (card_id: string, nick_name: string) => Promise<API.Cards.IssuingCardDetailItem>;
34
+ };
35
+ transactions: {
36
+ getByCardId: (card_id: string, limit?: number, offset?: number) => Promise<API.Cards.TransactionsList>;
37
+ getBySubAccountId: (fiat_account_id: string, limit?: number, offset?: number) => Promise<API.Cards.TransactionsList>;
38
+ csv: {
39
+ getByCardId: (card_id: string) => Promise<string>;
40
+ getBySubAccountId: (sub_account_id: string) => Promise<string>;
41
+ };
42
+ };
43
+ sub_accounts: {
44
+ list: {
45
+ withCards: {
46
+ getSinglecards: (wallet_uuid: string, limit: number, offset: number) => Promise<API.Issuing.SubAccounts.WithCards.Response>;
47
+ getAll: (wallet_uuid: string, limit: number, offset: number) => Promise<API.Issuing.SubAccounts.WithCards.Response>;
48
+ };
49
+ withoutCards: {
50
+ getAll: ({ wallet_uuid, ...params }: API.Issuing.SubAccounts.WithoutCards.Request) => Promise<API.Issuing.SubAccounts.WithoutCards.Response>;
51
+ };
52
+ };
53
+ getByUuid: (uuid: string) => Promise<API.Issuing.SubAccounts.SubAccount>;
54
+ create: (wallet_id: string, program_id: string) => Promise<API.Issuing.SubAccounts.SubAccount>;
55
+ transactions: {
56
+ get: ({ sub_account_id, ...params }: API.Issuing.SubAccounts.TransactionList.Request) => Promise<API.Issuing.SubAccounts.TransactionList.Response>;
57
+ };
58
+ };
59
+ config: {
60
+ programs: {
61
+ getAll: (params: API.Issuing.Programs.Request) => Promise<API.Issuing.Programs.Response>;
62
+ };
63
+ };
64
+ };
@@ -0,0 +1,140 @@
1
+ import { apiClientV1 } from '../utils/apiClientFactory';
2
+ import { defaultPaginationParams } from '../constants';
3
+ import { makeSecureRequest } from '../utils/encrypt';
4
+ export const issuing = {
5
+ cards: {
6
+ create: {
7
+ standAloneCard: {
8
+ prepaid: (data) => apiClientV1.postRequest('/issuing/cards/create', { data }),
9
+ balance: async (data) => {
10
+ const { id: sub_account_id } = await issuing.sub_accounts.create(data.wallet_id, data.program_id);
11
+ const response = await apiClientV1.postRequest('/issuing/cards/balance', {
12
+ data: {
13
+ ...data,
14
+ sub_account_id,
15
+ },
16
+ });
17
+ return {
18
+ ...response,
19
+ sub_account_id,
20
+ };
21
+ },
22
+ },
23
+ subAccountCard: async (data) => {
24
+ const response = await apiClientV1.postRequest('/issuing/cards/balance', {
25
+ data,
26
+ });
27
+ return {
28
+ ...response,
29
+ sub_account_id: data.sub_account_id,
30
+ };
31
+ },
32
+ },
33
+ byWalletUuid: {
34
+ getAll: (params) => apiClientV1.getRequest('/issuing/cards', {
35
+ params,
36
+ }),
37
+ getBySubaccountType: (params) => apiClientV1.getRequest('/issuing/cards', {
38
+ params,
39
+ }),
40
+ getBySubAccount: (params) => apiClientV1.getRequest('/issuing/cards', {
41
+ params,
42
+ }),
43
+ },
44
+ // getById: (card_id: string) => apiClientV1.getRequest<API.Cards.IssuingCardDetailItem>(`/issuing/cards/${card_id}`),
45
+ getById: async (card_id) => {
46
+ const card = await apiClientV1.getRequest(`/issuing/cards/${card_id}`);
47
+ const subAccountData = await issuing.sub_accounts.getByUuid(card.fiat_account.id);
48
+ return {
49
+ ...card,
50
+ fiat_account: { ...subAccountData, type: card.fiat_account.type },
51
+ };
52
+ },
53
+ sensitiveData: {
54
+ // get: (card_id: string) => apiClientV1.getRequest<API.Cards.SensitiveData>(`/issuing/cards/${card_id}/sensitive`), deprecated from v1.13.1
55
+ encrypted: {
56
+ secretKey: {
57
+ get: async (card_id) => {
58
+ const serverPublicKeyEnv = process.env.SERVER_PUBLIC_KEY_BASE64;
59
+ const callback = (props) => apiClientV1.postRequest(`/issuing/cards/${card_id}/sensitive/secretkey`, {
60
+ data: props,
61
+ });
62
+ if (!serverPublicKeyEnv) {
63
+ throw new Error('SERVER_PUBLIC_KEY_BASE64 is not set');
64
+ }
65
+ const encryptedData = await makeSecureRequest({
66
+ callback,
67
+ publicKey: serverPublicKeyEnv,
68
+ });
69
+ return encryptedData;
70
+ },
71
+ },
72
+ },
73
+ otp: {
74
+ // have to update
75
+ get: (card_id) => apiClientV1.getRequest(`/vcards/cards/${card_id}/sensitive/otp`),
76
+ },
77
+ },
78
+ freeze: (card_id) => apiClientV1.patchRequest(`/issuing/cards/${card_id}/freeze`),
79
+ unfreeze: (card_id) => apiClientV1.patchRequest(`/issuing/cards/${card_id}/unfreeze`),
80
+ close: (card_id) => apiClientV1.deleteRequest(`/issuing/cards/${card_id}`),
81
+ limits: {
82
+ update: (card_id, data) => apiClientV1.patchRequest(`/issuing/cards/${card_id}/limits`, { data }),
83
+ },
84
+ rename: (card_id, nick_name) => apiClientV1.patchRequest(`/issuing/cards/${card_id}/update`, {
85
+ data: { nick_name, request_id: crypto.randomUUID() },
86
+ }),
87
+ },
88
+ transactions: {
89
+ getByCardId: (card_id, limit = defaultPaginationParams.limit, offset = defaultPaginationParams.offset) => apiClientV1.getRequest(`/issuing/transactions/`, {
90
+ params: { limit, offset, card_id, new_scheme: true },
91
+ }),
92
+ getBySubAccountId: (fiat_account_id, limit = defaultPaginationParams.limit, offset = defaultPaginationParams.offset) => apiClientV1.getRequest(`/issuing/transactions/`, {
93
+ params: { limit, offset, fiat_account_id, new_scheme: true },
94
+ }),
95
+ csv: {
96
+ getByCardId: (card_id) => apiClientV1.getRequest(`/issuing/transactions/csv`, {
97
+ params: { card_id },
98
+ }),
99
+ getBySubAccountId: (sub_account_id) => apiClientV1.getRequest(`/issuing/sub_account/${sub_account_id}/transactions/csv`),
100
+ },
101
+ },
102
+ sub_accounts: {
103
+ list: {
104
+ withCards: {
105
+ getSinglecards: (wallet_uuid, limit, offset) => apiClientV1.getRequest(`/issuing/sub_account/list/${wallet_uuid}`, {
106
+ params: {
107
+ limit,
108
+ offset,
109
+ lt_cards_limit: 2,
110
+ gt_cards_limit: 0,
111
+ show_cards: true,
112
+ pagination: true,
113
+ },
114
+ }),
115
+ getAll: (wallet_uuid, limit, offset) => apiClientV1.getRequest(`/issuing/sub_account/list/${wallet_uuid}`, {
116
+ params: { limit, offset, show_cards: true, pagination: true },
117
+ }),
118
+ },
119
+ withoutCards: {
120
+ getAll: ({ wallet_uuid, ...params }) => apiClientV1.getRequest(`/issuing/sub_account/list/${wallet_uuid}`, {
121
+ params: { ...params, pagination: true },
122
+ }),
123
+ },
124
+ },
125
+ getByUuid: (uuid) => apiClientV1.getRequest(`/issuing/sub_account/${uuid}`),
126
+ create: (wallet_id, program_id) => apiClientV1.postRequest(`/issuing/sub_account`, {
127
+ data: { wallet_id, program_id },
128
+ }),
129
+ transactions: {
130
+ get: ({ sub_account_id, ...params }) => apiClientV1.getRequest(`/issuing/sub_account/${sub_account_id}/transactions`, {
131
+ params,
132
+ }),
133
+ },
134
+ },
135
+ config: {
136
+ programs: {
137
+ getAll: (params) => apiClientV1.getRequest('/issuing/config/programs', { params }),
138
+ },
139
+ },
140
+ };
@@ -0,0 +1,21 @@
1
+ import { API } from './types/types';
2
+ export declare const kyc: {
3
+ sumsub: {
4
+ generate_token: (data: API.KYC.Sumsub.GenerateToken.Request) => Promise<API.KYC.Sumsub.GenerateToken.Response>;
5
+ };
6
+ entity: {
7
+ get: ({ wallet_id }: API.KYC.Entity.Get.Request) => Promise<API.KYC.Entity.Get.Response>;
8
+ };
9
+ rails: {
10
+ info: {
11
+ getAll: ({ wallet_id }: API.KYC.Rails.RailInfo.List.Request) => Promise<API.KYC.Rails.RailInfo.List.Response>;
12
+ getSingle: ({ wallet_id, rail_id, }: API.KYC.Rails.RailInfo.SingleRail.Request) => Promise<API.KYC.Rails.RailInfo.SingleRail.Response>;
13
+ };
14
+ submit: {
15
+ single: ({ wallet_id, rail_id, }: API.KYC.Rails.Submit.Single.Request) => Promise<API.KYC.Rails.Submit.Single.Response>;
16
+ };
17
+ terms: {
18
+ confirm: ({ wallet_id, rail_id, }: API.KYC.Rails.Terms.Confirm.Request) => Promise<API.KYC.Rails.Terms.Confirm.Response>;
19
+ };
20
+ };
21
+ };
@@ -0,0 +1,21 @@
1
+ import { apiClientV1, apiClientV2 } from '../utils/apiClientFactory';
2
+ export const kyc = {
3
+ sumsub: {
4
+ generate_token: (data) => apiClientV1.postRequest('/kyc/sumsub/generate_token', { data }),
5
+ },
6
+ entity: {
7
+ get: ({ wallet_id }) => apiClientV2.getRequest(`/kyc/${wallet_id}/entity`),
8
+ },
9
+ rails: {
10
+ info: {
11
+ getAll: ({ wallet_id }) => apiClientV2.getRequest(`/kyc/${wallet_id}/rails`),
12
+ getSingle: ({ wallet_id, rail_id, }) => apiClientV2.getRequest(`/kyc/${wallet_id}/rails/${rail_id}`),
13
+ },
14
+ submit: {
15
+ single: ({ wallet_id, rail_id, }) => apiClientV2.postRequest(`/kyc/${wallet_id}/rails/${rail_id}`),
16
+ },
17
+ terms: {
18
+ confirm: ({ wallet_id, rail_id, }) => apiClientV2.postRequest(`/kyc/${wallet_id}/rails/${rail_id}/terms-and-conditions`),
19
+ },
20
+ },
21
+ };
@@ -0,0 +1,16 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { API } from './types/types';
3
+ export declare const list: {
4
+ currencies: {
5
+ getAll: (params?: AxiosRequestConfig) => Promise<API.Currencies.CurrencyList>;
6
+ };
7
+ chains: {
8
+ getAll: (params?: AxiosRequestConfig) => Promise<API.Chains.ChainList>;
9
+ };
10
+ countries: {
11
+ getAll: (params?: AxiosRequestConfig) => Promise<API.Location.Countries.List.Response>;
12
+ };
13
+ states: {
14
+ getAll: ({ country_id }: API.Location.States.List.Request) => Promise<API.Location.States.List.Response>;
15
+ };
16
+ };
@@ -0,0 +1,16 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import { apiClientV2 } from '../utils/apiClientFactory';
3
+ export const list = {
4
+ currencies: {
5
+ getAll: (params) => apiClientV2.getRequest('/system/currencies', params),
6
+ },
7
+ chains: {
8
+ getAll: (params) => apiClientV2.getRequest('/system/chains', params),
9
+ },
10
+ countries: {
11
+ getAll: (params) => apiClientV2.getRequest('/system/countries', params),
12
+ },
13
+ states: {
14
+ getAll: ({ country_id }) => apiClientV2.getRequest(`/system/states/${country_id}`),
15
+ },
16
+ };
@@ -0,0 +1,49 @@
1
+ import { API } from './types/types';
2
+ export declare const orders: {
3
+ calc: ({ signal, ...params }: API.Orders.Calc.Request) => Promise<API.Orders.Calc.Response>;
4
+ orderTypes: {
5
+ list: () => Promise<API.Orders.OrderTypes.List.Response>;
6
+ };
7
+ create: {
8
+ byOrderType: {
9
+ TRANSFER_INTERNAL: (data: API.Orders.Create.ByOrderType.INTERNAL_TRANSFER.Request) => Promise<API.Orders.Create.ByOrderType.INTERNAL_TRANSFER.Response>;
10
+ WITHDRAWAL_CRYPTO: (data: API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Request) => Promise<API.Orders.Create.ByOrderType.WITHDRAWAL_CRYPTO.Response>;
11
+ TRANSFER_CARD_SUBACCOUNT: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Request) => Promise<API.Orders.Create.ByOrderType.TRANSFER_CARD_SUBACCOUNT.Response>;
12
+ TRANSFER_CARD_PREPAID: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_PREPAID.Request) => Promise<API.Orders.Create.ByOrderType.TRANSFER_CARD_PREPAID.Response>;
13
+ TRANSFER_CARD_WHOLESALE: (data: API.Orders.Create.ByOrderType.TRANSFER_CARD_WHOLESALE.Request) => Promise<API.Orders.Create.ByOrderType.TRANSFER_CARD_WHOLESALE.Response>;
14
+ EXCHANGE_CRYPTO_INTERNAL: (data: API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Request) => Promise<API.Orders.Create.ByOrderType.EXCHANGE_CRYPTO_INTERNAL.Response>;
15
+ EXCHANGE_OMNI: (data: API.Orders.Create.ByOrderType.EXCHANGE_OMNI.Request) => Promise<API.Orders.Create.ByOrderType.EXCHANGE_OMNI.Response>;
16
+ WITHDRAW_CARD_PREPAID: (data: API.Orders.Create.ByOrderType.WITHDRAW_CARD_PREPAID.Request) => Promise<API.Orders.Create.ByOrderType.WITHDRAW_CARD_PREPAID.Response>;
17
+ WITHDRAW_CARD_SUBACCOUNT: (data: API.Orders.Create.ByOrderType.WITHDRAW_CARD_SUBACCOUNT.Request) => Promise<API.Orders.Create.ByOrderType.WITHDRAW_CARD_SUBACCOUNT.Response>;
18
+ };
19
+ };
20
+ v2: {
21
+ calc: ({ signal, ...params }: API.Orders.V2.Calc.Request) => Promise<API.Orders.V2.Calc.Response>;
22
+ orderTypes: {
23
+ list: () => Promise<API.Orders.V2.OrderTypes.List.Response>;
24
+ };
25
+ create: {
26
+ byOrderType: {
27
+ TRANSFER_INTERNAL: (data: API.Orders.V2.Create.ByOrderType.INTERNAL_TRANSFER.Request) => Promise<API.Orders.V2.Create.ByOrderType.INTERNAL_TRANSFER.Response>;
28
+ HIFI_WIRE_ONRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_WIRE_ONRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_WIRE_ONRAMP.Response>;
29
+ HIFI_ACH_ONRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_ACH_ONRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_ACH_ONRAMP.Response>;
30
+ HIFI_SEPA_ONRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_SEPA_ONRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_SEPA_ONRAMP.Response>;
31
+ HIFI_WIRE_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_WIRE_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_WIRE_OFFRAMP.Response>;
32
+ HIFI_ACH_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_ACH_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_ACH_OFFRAMP.Response>;
33
+ HIFI_SEPA_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.HIFI_SEPA_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.HIFI_SEPA_OFFRAMP.Response>;
34
+ OMNIBUS_CRYPTO_TRANSFER: (data: API.Orders.V2.Create.ByOrderType.OMNIBUS_CRYPTO_TRANSFER.Request) => Promise<API.Orders.V2.Create.ByOrderType.OMNIBUS_CRYPTO_TRANSFER.Response>;
35
+ SEGREGATED_CRYPTO_TRANSFER: (data: API.Orders.V2.Create.ByOrderType.SEGREGATED_CRYPTO_TRANSFER.Request) => Promise<API.Orders.V2.Create.ByOrderType.SEGREGATED_CRYPTO_TRANSFER.Response>;
36
+ RN_CARDS_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.RN_CARDS_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.RN_CARDS_OFFRAMP.Response>;
37
+ TBD_SWIFT_WITHDRAWAL: (data: API.Orders.V2.Create.ByOrderType.TBD_SWIFT_WITHDRAWAL.Request) => Promise<API.Orders.V2.Create.ByOrderType.TBD_SWIFT_WITHDRAWAL.Response>;
38
+ L2F_SEPA_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.L2F_SEPA_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.L2F_SEPA_OFFRAMP.Response>;
39
+ L2F_SWIFT_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.L2F_SWIFT_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.L2F_SWIFT_OFFRAMP.Response>;
40
+ L2F_ACH_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.L2F_ACH_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.L2F_ACH_OFFRAMP.Response>;
41
+ L2F_WIRE_OFFRAMP: (data: API.Orders.V2.Create.ByOrderType.L2F_WIRE_OFFRAMP.Request) => Promise<API.Orders.V2.Create.ByOrderType.L2F_WIRE_OFFRAMP.Response>;
42
+ };
43
+ };
44
+ list: {
45
+ byWallet: ({ wallet_uuid, ...params }: API.Orders.V2.List.ByWallet.Request) => Promise<API.Orders.V2.List.ByWallet.Response>;
46
+ };
47
+ getById: ({ order_uuid }: API.Orders.V2.GetById.Request) => Promise<API.Orders.V2.GetById.Response>;
48
+ };
49
+ };