squarefi-bff-api-module 1.26.14 → 1.27.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/.prettierignore +5 -0
- package/.prettierrc +7 -0
- package/dist/api/auth.js +18 -6
- package/dist/api/exchange.js +9 -3
- package/dist/api/issuing.js +14 -3
- package/dist/api/orders.d.ts +4 -1
- package/dist/api/orders.js +12 -3
- package/dist/api/types/types.d.ts +199 -442
- package/dist/constants.d.ts +15 -2
- package/dist/constants.js +13 -0
- package/package.json +5 -2
- package/src/api/auth.ts +18 -5
- package/src/api/bank-data.ts +1 -1
- package/src/api/counterparties.ts +7 -7
- package/src/api/exchange.ts +16 -7
- package/src/api/frontend.ts +1 -1
- package/src/api/issuing.ts +31 -17
- package/src/api/kyc.ts +1 -1
- package/src/api/orders.ts +79 -48
- package/src/api/persona.ts +1 -1
- package/src/api/totp.ts +2 -2
- package/src/api/types/types.ts +214 -522
- package/src/api/wallets.ts +5 -5
- package/src/constants.ts +13 -0
- package/src/hooks/useCalc.ts +3 -3
- package/src/hooks/useSupabaseSubscription/useSupabaseSubscription.ts +1 -1
- package/src/utils/apiClientFactory.ts +13 -4
package/src/api/wallets.ts
CHANGED
|
@@ -16,7 +16,7 @@ export const wallets = {
|
|
|
16
16
|
|
|
17
17
|
return apiClientV2.postRequest<API.Wallets.WalletChain.Create.Response>(
|
|
18
18
|
`/wallets/${wallet_uuid}/addresses/${chain}`,
|
|
19
|
-
{ data: { label } }
|
|
19
|
+
{ data: { label } },
|
|
20
20
|
);
|
|
21
21
|
},
|
|
22
22
|
get: {
|
|
@@ -29,7 +29,7 @@ export const wallets = {
|
|
|
29
29
|
transactions: {
|
|
30
30
|
byWalletUuid: {
|
|
31
31
|
getAll: async (
|
|
32
|
-
data: API.Wallets.WalletTransactions.TransactionList.Request
|
|
32
|
+
data: API.Wallets.WalletTransactions.TransactionList.Request,
|
|
33
33
|
): Promise<API.Wallets.WalletTransactions.TransactionList.Response> => {
|
|
34
34
|
const {
|
|
35
35
|
wallet_uuid,
|
|
@@ -40,7 +40,7 @@ export const wallets = {
|
|
|
40
40
|
|
|
41
41
|
return apiClientV2.getRequest<API.Wallets.WalletTransactions.TransactionList.Response>(
|
|
42
42
|
`/wallets/${wallet_uuid}/transactions`,
|
|
43
|
-
{ params: { limit, offset, ...params } }
|
|
43
|
+
{ params: { limit, offset, ...params } },
|
|
44
44
|
);
|
|
45
45
|
},
|
|
46
46
|
getByUuid: ({
|
|
@@ -48,7 +48,7 @@ export const wallets = {
|
|
|
48
48
|
uuid,
|
|
49
49
|
}: API.Wallets.WalletTransactions.GetByUuid.Request): Promise<API.Wallets.WalletTransactions.DetailedTransaction> =>
|
|
50
50
|
apiClientV2.getRequest<API.Wallets.WalletTransactions.DetailedTransaction>(
|
|
51
|
-
`/wallets/${wallet_uuid}/transactions/${uuid}
|
|
51
|
+
`/wallets/${wallet_uuid}/transactions/${uuid}`,
|
|
52
52
|
),
|
|
53
53
|
},
|
|
54
54
|
csv: {
|
|
@@ -58,7 +58,7 @@ export const wallets = {
|
|
|
58
58
|
}: API.Wallets.WalletTransactions.TransactionList.ExportCsv.Request): Promise<API.Wallets.WalletTransactions.TransactionList.ExportCsv.Response> =>
|
|
59
59
|
apiClientV2.getRequest<API.Wallets.WalletTransactions.TransactionList.ExportCsv.Response>(
|
|
60
60
|
`/wallets/${wallet_uuid}/transactions/export/csv`,
|
|
61
|
-
{ params }
|
|
61
|
+
{ params },
|
|
62
62
|
),
|
|
63
63
|
},
|
|
64
64
|
},
|
package/src/constants.ts
CHANGED
|
@@ -85,6 +85,15 @@ export enum OrderType {
|
|
|
85
85
|
RN_CARDS_OFFRAMP = 'RN_CARDS_OFFRAMP',
|
|
86
86
|
TBD_SWIFT_WITHDRAWAL = 'TBD_SWIFT_WITHDRAWAL', // not implemented yet
|
|
87
87
|
SEGREGATED_CRYPTO_TRANSFER = 'SEGREGATED_CRYPTO_TRANSFER',
|
|
88
|
+
L2F_ACH_ONRAMP = 'L2F_ACH_ONRAMP',
|
|
89
|
+
L2F_WIRE_ONRAMP = 'L2F_WIRE_ONRAMP',
|
|
90
|
+
L2F_SWIFT_ONRAMP = 'L2F_SWIFT_ONRAMP',
|
|
91
|
+
L2F_SEPA_ONRAMP = 'L2F_SEPA_ONRAMP',
|
|
92
|
+
L2F_ACH_OFFRAMP = 'L2F_ACH_OFFRAMP',
|
|
93
|
+
L2F_WIRE_OFFRAMP = 'L2F_WIRE_OFFRAMP',
|
|
94
|
+
L2F_SWIFT_OFFRAMP = 'L2F_SWIFT_OFFRAMP',
|
|
95
|
+
L2F_SEPA_OFFRAMP = 'L2F_SEPA_OFFRAMP',
|
|
96
|
+
OMNIBUS_CRYPTO_WITHDRAWAL = 'OMNIBUS_CRYPTO_WITHDRAWAL',
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
export enum WalletTransactionRecordType {
|
|
@@ -123,6 +132,10 @@ export enum WalletTransactionRecordType {
|
|
|
123
132
|
WITHDRAWAL_CRYPTO_EXTERNAL = 'WITHDRAWAL_CRYPTO_EXTERNAL',
|
|
124
133
|
WITHDRAWAL_CRYPTO_INTERNAL = 'WITHDRAWAL_CRYPTO_INTERNAL',
|
|
125
134
|
WITHDRAWAL_INTERNAL = 'WITHDRAWAL_INTERNAL',
|
|
135
|
+
L2F_ACH_OFFRAMP = 'L2F_ACH_OFFRAMP',
|
|
136
|
+
L2F_WIRE_OFFRAMP = 'L2F_WIRE_OFFRAMP',
|
|
137
|
+
L2F_SWIFT_OFFRAMP = 'L2F_SWIFT_OFFRAMP',
|
|
138
|
+
L2F_SEPA_OFFRAMP = 'L2F_SEPA_OFFRAMP',
|
|
126
139
|
}
|
|
127
140
|
|
|
128
141
|
export enum RequestStatus {
|
package/src/hooks/useCalc.ts
CHANGED
|
@@ -127,7 +127,7 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
127
127
|
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
abortControllerRef.current?.signal ? undefined : 1000
|
|
130
|
+
abortControllerRef.current?.signal ? undefined : 1000,
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
const onBuyingValueUpdate = debounce(
|
|
@@ -136,14 +136,14 @@ export const useOrderCalc: UseOrderCalc = (props: UseOrderCalcProps) => {
|
|
|
136
136
|
updateCalculations({ is_reverse: true, is_subtract: false });
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
-
abortControllerRef.current?.signal ? undefined : 1000
|
|
139
|
+
abortControllerRef.current?.signal ? undefined : 1000,
|
|
140
140
|
);
|
|
141
141
|
|
|
142
142
|
const onToAddressUpdate = debounce(
|
|
143
143
|
() => {
|
|
144
144
|
updateCalculations({ is_reverse: false, is_subtract: true });
|
|
145
145
|
},
|
|
146
|
-
abortControllerRef.current?.signal ? undefined : 1000
|
|
146
|
+
abortControllerRef.current?.signal ? undefined : 1000,
|
|
147
147
|
);
|
|
148
148
|
|
|
149
149
|
useEffect(() => {
|
|
@@ -32,7 +32,7 @@ export const useSupabaseSubscription = ({ config, callback, enabled = true, key
|
|
|
32
32
|
table: config.table,
|
|
33
33
|
...(config.filter && { filter: config.filter }),
|
|
34
34
|
},
|
|
35
|
-
(payload) => callbackRef.current(payload)
|
|
35
|
+
(payload) => callbackRef.current(payload),
|
|
36
36
|
)
|
|
37
37
|
.subscribe();
|
|
38
38
|
|
|
@@ -55,9 +55,15 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
|
|
|
55
55
|
modifiedHeaders.Authorization = authHeader;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
config.context = {
|
|
58
|
+
config.context = {
|
|
59
|
+
...config.context,
|
|
60
|
+
appEnvironment: isTMA() ? AppEnviroment.TELEGRAM : AppEnviroment.WEB,
|
|
61
|
+
};
|
|
59
62
|
|
|
60
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
...config,
|
|
65
|
+
headers: modifiedHeaders,
|
|
66
|
+
} as unknown as InternalAxiosRequestConfig;
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
instance.interceptors.response.use(
|
|
@@ -119,7 +125,10 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
|
|
|
119
125
|
return new Promise((res, rej) => {
|
|
120
126
|
requestQueue.push({
|
|
121
127
|
resolve: () => {
|
|
122
|
-
failedRequestConfig.context = {
|
|
128
|
+
failedRequestConfig.context = {
|
|
129
|
+
...failedRequestConfig.context,
|
|
130
|
+
isRetryRequest: true,
|
|
131
|
+
};
|
|
123
132
|
return res(instance(failedRequestConfig));
|
|
124
133
|
},
|
|
125
134
|
reject: () => rej(instance(failedRequestConfig)),
|
|
@@ -130,7 +139,7 @@ export const createApiClient = ({ baseURL, isBearerToken, tenantId }: CreateApiC
|
|
|
130
139
|
console.error('Axios error', error);
|
|
131
140
|
|
|
132
141
|
return Promise.reject(error);
|
|
133
|
-
}
|
|
142
|
+
},
|
|
134
143
|
);
|
|
135
144
|
|
|
136
145
|
const patchRequest = async <T>(url: string, config?: AxiosRequestConfig): Promise<T> => {
|