@funkit/connect 11.2.0 → 11.4.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 +100 -0
- package/dist/clients/{chunk-SU3YSNMB.js → chunk-3Y5EIONT.js} +3 -9
- package/dist/clients/chunk-6EU6CXNH.js +20 -0
- package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
- package/dist/clients/{chunk-QQEGNLGD.js → chunk-EQFVPSR2.js} +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
- package/dist/clients/internal/nado/withdrawalConfig.d.ts +2 -0
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +13 -58
- package/dist/clients/lighter.d.ts +4 -61
- package/dist/clients/lighter.js +66 -338
- package/dist/clients/nado.d.ts +2 -0
- package/dist/clients/nado.js +7 -6
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +1 -1
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
- package/dist/clients/polymarket/index.js +1 -1
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
- package/dist/domains/checkout.d.ts +8 -2
- package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
- package/dist/hooks/track/analytics/events.d.ts +176 -9
- package/dist/hooks/track/analytics/mappers.d.ts +15 -0
- package/dist/hooks/track/analytics/quote.d.ts +12 -0
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +71 -3
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +17 -0
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
- package/dist/hooks/track/useTrackV2.d.ts +2 -0
- package/dist/hooks/useAssetPrice.d.ts +1 -6
- package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
- package/dist/index.js +2214 -1094
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
- package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
- package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
- package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
- package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
- package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
- package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +17 -2
- package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
- package/dist/utils/customer.d.ts +24 -276
- package/dist/utils/lighter.d.ts +1 -83
- package/dist/utils/signature.d.ts +1 -2
- package/dist/utils/withdrawal.d.ts +1 -21
- package/dist/wallets/walletConnectors/index.js +10 -10
- package/package.json +4 -5
- package/dist/clients/chunk-6QCAWEAT.js +0 -53
package/dist/utils/customer.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DynamicTargetAssetCandidate } from '@funkit/connect-core';
|
|
1
|
+
import type { DynamicTargetAssetCandidate, LighterAccountLookup } from '@funkit/connect-core';
|
|
3
2
|
import type { Address } from 'viem';
|
|
4
|
-
export { LIGHTER_TRADING_MODE, getLighterAccountsByL1Address, useLighterAccountsQuery, } from '@funkit/connect-core';
|
|
5
|
-
export type { LighterAccountsByL1AddressResponse, LighterSubAccount, } from '@funkit/connect-core';
|
|
3
|
+
export { LIGHTER_TRADING_MODE, getLighterAccount, getLighterAccountsByL1Address, useInvalidateLighterAccount, useLighterAccountQuery, useLighterAccountsQuery, } from '@funkit/connect-core';
|
|
4
|
+
export type { LighterAccount, LighterAccountLookup, LighterAccountResponse, LighterAccountsByL1AddressResponse, LighterAsset, LighterPoolInfo, LighterShare, LighterSubAccount, } from '@funkit/connect-core';
|
|
6
5
|
/**
|
|
7
6
|
* Strips the ` (Perps)` variant suffix off a Lighter ticker (e.g.
|
|
8
7
|
* `USDC (Perps)` → `USDC`). Non-perps tickers pass through unchanged.
|
|
@@ -16,256 +15,11 @@ export declare function stripLighterPerpsSuffix(symbol: string | undefined): str
|
|
|
16
15
|
* routes (`LIGHTER_USDC_PERPS*`), only the presentation differs.
|
|
17
16
|
*/
|
|
18
17
|
export declare function adaptLighterTargetAssetsForUnifiedAccount(candidates: DynamicTargetAssetCandidate[]): DynamicTargetAssetCandidate[];
|
|
19
|
-
export type LighterAsset = {
|
|
20
|
-
symbol: string;
|
|
21
|
-
asset_id: number;
|
|
22
|
-
balance: string;
|
|
23
|
-
locked_balance: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* A user's stake in a Lighter public pool, identified by matching
|
|
27
|
-
* `public_pool_index` against the known pool index.
|
|
28
|
-
*
|
|
29
|
-
* Carries only *entry* state — there is no current-value field:
|
|
30
|
-
* - `principal_amount` — deposited at entry, in the pool's own asset (Lighter's
|
|
31
|
-
* UI shows this as "Your Deposits"). Never grows with accrued yield.
|
|
32
|
-
* - `shares_amount` — pool shares held. Current value ("Your Stake") is this
|
|
33
|
-
* times the pool's share price, so it needs the pool account too.
|
|
34
|
-
*/
|
|
35
|
-
export type LighterShare = {
|
|
36
|
-
public_pool_index: number;
|
|
37
|
-
shares_amount: number;
|
|
38
|
-
entry_usdc: string;
|
|
39
|
-
principal_amount: string;
|
|
40
|
-
entry_timestamp: number;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Public-pool accounting, present only on pool accounts (`account_type: 4`).
|
|
44
|
-
* Share price is `<pool asset balance> / total_shares`.
|
|
45
|
-
*/
|
|
46
|
-
export type LighterPoolInfo = {
|
|
47
|
-
total_shares: number;
|
|
48
|
-
operator_shares: number;
|
|
49
|
-
};
|
|
50
|
-
export type LighterAccount = {
|
|
51
|
-
code: number;
|
|
52
|
-
account_type: number;
|
|
53
|
-
index: number;
|
|
54
|
-
l1_address: Address;
|
|
55
|
-
cancel_all_time: number;
|
|
56
|
-
total_order_count: number;
|
|
57
|
-
total_isolated_order_count: number;
|
|
58
|
-
pending_order_count: number;
|
|
59
|
-
available_balance: string;
|
|
60
|
-
status: number;
|
|
61
|
-
collateral: string;
|
|
62
|
-
transaction_time: number;
|
|
63
|
-
account_trading_mode: number;
|
|
64
|
-
account_index: number;
|
|
65
|
-
name: string;
|
|
66
|
-
description: string;
|
|
67
|
-
can_invite: boolean;
|
|
68
|
-
referral_points_percentage: string;
|
|
69
|
-
can_rfq: boolean;
|
|
70
|
-
created_at: number;
|
|
71
|
-
positions: unknown[];
|
|
72
|
-
assets: LighterAsset[];
|
|
73
|
-
total_asset_value: string;
|
|
74
|
-
cross_asset_value: string;
|
|
75
|
-
shares: LighterShare[];
|
|
76
|
-
pending_unlocks: unknown[];
|
|
77
|
-
/** Pool accounts only — absent on user accounts. */
|
|
78
|
-
pool_info?: LighterPoolInfo;
|
|
79
|
-
};
|
|
80
|
-
export type LighterAccountResponse = {
|
|
81
|
-
code: number;
|
|
82
|
-
total: number;
|
|
83
|
-
accounts: LighterAccount[];
|
|
84
|
-
};
|
|
85
|
-
export type LighterAccountLookup = {
|
|
86
|
-
by: 'index';
|
|
87
|
-
value: LighterAccountIndex;
|
|
88
|
-
} | {
|
|
89
|
-
by: 'l1_address';
|
|
90
|
-
value: Address;
|
|
91
|
-
};
|
|
92
|
-
export declare function getLighterAccount(lookup: LighterAccountLookup, activeOnly?: boolean): Promise<LighterAccountResponse>;
|
|
93
18
|
export declare function useLighterAccount(lookup: LighterAccountLookup | null, options?: {
|
|
94
19
|
activeOnly?: boolean;
|
|
95
20
|
}): {
|
|
96
|
-
account: LighterAccount | undefined;
|
|
97
|
-
data: LighterAccountResponse;
|
|
98
|
-
error: Error;
|
|
99
|
-
isError: true;
|
|
100
|
-
isPending: false;
|
|
101
|
-
isLoading: false;
|
|
102
|
-
isLoadingError: false;
|
|
103
|
-
isRefetchError: true;
|
|
104
|
-
isSuccess: false;
|
|
105
|
-
isPlaceholderData: false;
|
|
106
|
-
status: "error";
|
|
107
|
-
dataUpdatedAt: number;
|
|
108
|
-
errorUpdatedAt: number;
|
|
109
|
-
failureCount: number;
|
|
110
|
-
failureReason: Error | null;
|
|
111
|
-
errorUpdateCount: number;
|
|
112
|
-
isFetched: boolean;
|
|
113
|
-
isFetchedAfterMount: boolean;
|
|
114
|
-
isFetching: boolean;
|
|
115
|
-
isInitialLoading: boolean;
|
|
116
|
-
isPaused: boolean;
|
|
117
|
-
isRefetching: boolean;
|
|
118
|
-
isStale: boolean;
|
|
119
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
120
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
121
|
-
promise: Promise<LighterAccountResponse>;
|
|
122
|
-
} | {
|
|
123
|
-
account: LighterAccount | undefined;
|
|
124
|
-
data: LighterAccountResponse;
|
|
125
|
-
error: null;
|
|
126
|
-
isError: false;
|
|
127
|
-
isPending: false;
|
|
128
|
-
isLoading: false;
|
|
129
|
-
isLoadingError: false;
|
|
130
|
-
isRefetchError: false;
|
|
131
|
-
isSuccess: true;
|
|
132
|
-
isPlaceholderData: false;
|
|
133
|
-
status: "success";
|
|
134
|
-
dataUpdatedAt: number;
|
|
135
|
-
errorUpdatedAt: number;
|
|
136
|
-
failureCount: number;
|
|
137
|
-
failureReason: Error | null;
|
|
138
|
-
errorUpdateCount: number;
|
|
139
|
-
isFetched: boolean;
|
|
140
|
-
isFetchedAfterMount: boolean;
|
|
141
|
-
isFetching: boolean;
|
|
142
|
-
isInitialLoading: boolean;
|
|
143
|
-
isPaused: boolean;
|
|
144
|
-
isRefetching: boolean;
|
|
145
|
-
isStale: boolean;
|
|
146
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
147
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
148
|
-
promise: Promise<LighterAccountResponse>;
|
|
149
|
-
} | {
|
|
150
|
-
account: LighterAccount | undefined;
|
|
151
|
-
data: undefined;
|
|
152
|
-
error: Error;
|
|
153
|
-
isError: true;
|
|
154
|
-
isPending: false;
|
|
155
|
-
isLoading: false;
|
|
156
|
-
isLoadingError: true;
|
|
157
|
-
isRefetchError: false;
|
|
158
|
-
isSuccess: false;
|
|
159
|
-
isPlaceholderData: false;
|
|
160
|
-
status: "error";
|
|
161
|
-
dataUpdatedAt: number;
|
|
162
|
-
errorUpdatedAt: number;
|
|
163
|
-
failureCount: number;
|
|
164
|
-
failureReason: Error | null;
|
|
165
|
-
errorUpdateCount: number;
|
|
166
|
-
isFetched: boolean;
|
|
167
|
-
isFetchedAfterMount: boolean;
|
|
168
|
-
isFetching: boolean;
|
|
169
|
-
isInitialLoading: boolean;
|
|
170
|
-
isPaused: boolean;
|
|
171
|
-
isRefetching: boolean;
|
|
172
|
-
isStale: boolean;
|
|
173
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
174
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
175
|
-
promise: Promise<LighterAccountResponse>;
|
|
176
|
-
} | {
|
|
177
|
-
account: LighterAccount | undefined;
|
|
178
|
-
data: undefined;
|
|
179
|
-
error: null;
|
|
180
|
-
isError: false;
|
|
181
|
-
isPending: true;
|
|
182
|
-
isLoading: true;
|
|
183
|
-
isLoadingError: false;
|
|
184
|
-
isRefetchError: false;
|
|
185
|
-
isSuccess: false;
|
|
186
|
-
isPlaceholderData: false;
|
|
187
|
-
status: "pending";
|
|
188
|
-
dataUpdatedAt: number;
|
|
189
|
-
errorUpdatedAt: number;
|
|
190
|
-
failureCount: number;
|
|
191
|
-
failureReason: Error | null;
|
|
192
|
-
errorUpdateCount: number;
|
|
193
|
-
isFetched: boolean;
|
|
194
|
-
isFetchedAfterMount: boolean;
|
|
195
|
-
isFetching: boolean;
|
|
196
|
-
isInitialLoading: boolean;
|
|
197
|
-
isPaused: boolean;
|
|
198
|
-
isRefetching: boolean;
|
|
199
|
-
isStale: boolean;
|
|
200
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
201
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
202
|
-
promise: Promise<LighterAccountResponse>;
|
|
203
|
-
} | {
|
|
204
|
-
account: LighterAccount | undefined;
|
|
205
|
-
data: undefined;
|
|
206
|
-
error: null;
|
|
207
|
-
isError: false;
|
|
208
|
-
isPending: true;
|
|
209
|
-
isLoadingError: false;
|
|
210
|
-
isRefetchError: false;
|
|
211
|
-
isSuccess: false;
|
|
212
|
-
isPlaceholderData: false;
|
|
213
|
-
status: "pending";
|
|
214
|
-
dataUpdatedAt: number;
|
|
215
|
-
errorUpdatedAt: number;
|
|
216
|
-
failureCount: number;
|
|
217
|
-
failureReason: Error | null;
|
|
218
|
-
errorUpdateCount: number;
|
|
219
|
-
isFetched: boolean;
|
|
220
|
-
isFetchedAfterMount: boolean;
|
|
221
|
-
isFetching: boolean;
|
|
222
|
-
isLoading: boolean;
|
|
223
|
-
isInitialLoading: boolean;
|
|
224
|
-
isPaused: boolean;
|
|
225
|
-
isRefetching: boolean;
|
|
226
|
-
isStale: boolean;
|
|
227
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
228
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
229
|
-
promise: Promise<LighterAccountResponse>;
|
|
230
|
-
} | {
|
|
231
|
-
account: LighterAccount | undefined;
|
|
232
|
-
data: LighterAccountResponse;
|
|
233
|
-
isError: false;
|
|
234
|
-
error: null;
|
|
235
|
-
isPending: false;
|
|
236
|
-
isLoading: false;
|
|
237
|
-
isLoadingError: false;
|
|
238
|
-
isRefetchError: false;
|
|
239
|
-
isSuccess: true;
|
|
240
|
-
isPlaceholderData: true;
|
|
241
|
-
status: "success";
|
|
242
|
-
dataUpdatedAt: number;
|
|
243
|
-
errorUpdatedAt: number;
|
|
244
|
-
failureCount: number;
|
|
245
|
-
failureReason: Error | null;
|
|
246
|
-
errorUpdateCount: number;
|
|
247
|
-
isFetched: boolean;
|
|
248
|
-
isFetchedAfterMount: boolean;
|
|
249
|
-
isFetching: boolean;
|
|
250
|
-
isInitialLoading: boolean;
|
|
251
|
-
isPaused: boolean;
|
|
252
|
-
isRefetching: boolean;
|
|
253
|
-
isStale: boolean;
|
|
254
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
255
|
-
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
256
|
-
promise: Promise<LighterAccountResponse>;
|
|
257
|
-
};
|
|
258
|
-
/**
|
|
259
|
-
* Ungated {@link useLighterAccount}. For callers whose module is Lighter-specific
|
|
260
|
-
* by construction — `clients/lighter` is a separate bundle entry with its own copy
|
|
261
|
-
* of the config context, so `useFunkitConfig()` there yields no api key and a
|
|
262
|
-
* customer check would disable the query forever.
|
|
263
|
-
*/
|
|
264
|
-
export declare function useLighterAccountQuery(lookup: LighterAccountLookup | null, options?: {
|
|
265
|
-
activeOnly?: boolean;
|
|
266
|
-
}): {
|
|
267
|
-
account: LighterAccount | undefined;
|
|
268
|
-
data: LighterAccountResponse;
|
|
21
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
22
|
+
data: import("@funkit/connect-core").LighterAccountResponse;
|
|
269
23
|
error: Error;
|
|
270
24
|
isError: true;
|
|
271
25
|
isPending: false;
|
|
@@ -287,12 +41,12 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
287
41
|
isPaused: boolean;
|
|
288
42
|
isRefetching: boolean;
|
|
289
43
|
isStale: boolean;
|
|
290
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
44
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
291
45
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
292
|
-
promise: Promise<LighterAccountResponse>;
|
|
46
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
293
47
|
} | {
|
|
294
|
-
account: LighterAccount | undefined;
|
|
295
|
-
data: LighterAccountResponse;
|
|
48
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
49
|
+
data: import("@funkit/connect-core").LighterAccountResponse;
|
|
296
50
|
error: null;
|
|
297
51
|
isError: false;
|
|
298
52
|
isPending: false;
|
|
@@ -314,11 +68,11 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
314
68
|
isPaused: boolean;
|
|
315
69
|
isRefetching: boolean;
|
|
316
70
|
isStale: boolean;
|
|
317
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
71
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
318
72
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
319
|
-
promise: Promise<LighterAccountResponse>;
|
|
73
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
320
74
|
} | {
|
|
321
|
-
account: LighterAccount | undefined;
|
|
75
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
322
76
|
data: undefined;
|
|
323
77
|
error: Error;
|
|
324
78
|
isError: true;
|
|
@@ -341,11 +95,11 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
341
95
|
isPaused: boolean;
|
|
342
96
|
isRefetching: boolean;
|
|
343
97
|
isStale: boolean;
|
|
344
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
98
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
345
99
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
346
|
-
promise: Promise<LighterAccountResponse>;
|
|
100
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
347
101
|
} | {
|
|
348
|
-
account: LighterAccount | undefined;
|
|
102
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
349
103
|
data: undefined;
|
|
350
104
|
error: null;
|
|
351
105
|
isError: false;
|
|
@@ -368,11 +122,11 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
368
122
|
isPaused: boolean;
|
|
369
123
|
isRefetching: boolean;
|
|
370
124
|
isStale: boolean;
|
|
371
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
125
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
372
126
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
373
|
-
promise: Promise<LighterAccountResponse>;
|
|
127
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
374
128
|
} | {
|
|
375
|
-
account: LighterAccount | undefined;
|
|
129
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
376
130
|
data: undefined;
|
|
377
131
|
error: null;
|
|
378
132
|
isError: false;
|
|
@@ -395,12 +149,12 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
395
149
|
isPaused: boolean;
|
|
396
150
|
isRefetching: boolean;
|
|
397
151
|
isStale: boolean;
|
|
398
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
152
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
399
153
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
400
|
-
promise: Promise<LighterAccountResponse>;
|
|
154
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
401
155
|
} | {
|
|
402
|
-
account: LighterAccount | undefined;
|
|
403
|
-
data: LighterAccountResponse;
|
|
156
|
+
account: import("@funkit/connect-core").LighterAccount | undefined;
|
|
157
|
+
data: import("@funkit/connect-core").LighterAccountResponse;
|
|
404
158
|
isError: false;
|
|
405
159
|
error: null;
|
|
406
160
|
isPending: false;
|
|
@@ -422,9 +176,9 @@ export declare function useLighterAccountQuery(lookup: LighterAccountLookup | nu
|
|
|
422
176
|
isPaused: boolean;
|
|
423
177
|
isRefetching: boolean;
|
|
424
178
|
isStale: boolean;
|
|
425
|
-
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<LighterAccountResponse, Error>>;
|
|
179
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/connect-core").LighterAccountResponse, Error>>;
|
|
426
180
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
427
|
-
promise: Promise<LighterAccountResponse>;
|
|
181
|
+
promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
|
|
428
182
|
};
|
|
429
183
|
export declare function useLighterAccounts({ address, }: {
|
|
430
184
|
address: Address | '' | undefined;
|
|
@@ -603,9 +357,3 @@ export declare function useLighterAccounts({ address, }: {
|
|
|
603
357
|
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
604
358
|
promise: Promise<import("@funkit/connect-core").LighterAccountsByL1AddressResponse>;
|
|
605
359
|
};
|
|
606
|
-
/**
|
|
607
|
-
* Returns a callback that invalidates the cached Lighter account queries so the
|
|
608
|
-
* balance refetches eagerly (e.g. right after a withdrawal). No-op for
|
|
609
|
-
* non-Lighter customers.
|
|
610
|
-
*/
|
|
611
|
-
export declare function useInvalidateLighterAccount(): () => void;
|
package/dist/utils/lighter.d.ts
CHANGED
|
@@ -1,83 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const LIGHTER_DEPOSIT_ADDRESS: Address;
|
|
3
|
-
export declare const LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS: number;
|
|
4
|
-
export declare const LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF: number;
|
|
5
|
-
/**
|
|
6
|
-
* zkLighter L1 `withdraw` ABI — selector `0xd20191bd`, non-payable, on the same
|
|
7
|
-
* contract as deposits. `amount` is in Lighter base units (see
|
|
8
|
-
* {@link lighterWithdrawBaseUnits}).
|
|
9
|
-
*/
|
|
10
|
-
export declare const LIGHTER_WITHDRAW_ABI: readonly [{
|
|
11
|
-
readonly type: "function";
|
|
12
|
-
readonly name: "withdraw";
|
|
13
|
-
readonly stateMutability: "nonpayable";
|
|
14
|
-
readonly inputs: readonly [{
|
|
15
|
-
readonly name: "accountIndex";
|
|
16
|
-
readonly type: "uint48";
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "assetIndex";
|
|
19
|
-
readonly type: "uint16";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "routeType";
|
|
22
|
-
readonly type: "uint8";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "amount";
|
|
25
|
-
readonly type: "uint64";
|
|
26
|
-
}];
|
|
27
|
-
readonly outputs: readonly [];
|
|
28
|
-
}];
|
|
29
|
-
/** Strips fractional digits beyond `decimals` (string-based, no float math). */
|
|
30
|
-
export declare function truncateToDecimals(amount: string, decimals: number): string;
|
|
31
|
-
/**
|
|
32
|
-
* Converts a token-unit amount to Lighter L1 `withdraw` base units.
|
|
33
|
-
*
|
|
34
|
-
* Uses the L2 convention — USDC (asset index 3) = 6 decimals, all other assets
|
|
35
|
-
* = 8 — NOT the mainnet ERC-20 decimals (LIT/ETH would be 18). Confirmed on
|
|
36
|
-
* chain: 1 USDC → `1_000_000`, 1 LIT → `100_000_000`.
|
|
37
|
-
*/
|
|
38
|
-
export declare function lighterWithdrawBaseUnits(assetIndex: number, amountTokenUnits: string): bigint;
|
|
39
|
-
/**
|
|
40
|
-
* Builds the on-chain `withdraw` transaction for the L1 fallback. `value` is 0
|
|
41
|
-
* (no protocol fee — the user pays gas only).
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildLighterL1WithdrawTransaction(params: {
|
|
44
|
-
accountIndex: number;
|
|
45
|
-
assetIndex: number;
|
|
46
|
-
routeType: number;
|
|
47
|
-
amountBaseUnit: bigint;
|
|
48
|
-
}): {
|
|
49
|
-
to: Address;
|
|
50
|
-
data: Hex;
|
|
51
|
-
value: bigint;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Explorer link for a Lighter Secure withdrawal tx. The L1 on-chain fallback
|
|
55
|
-
* produces a canonical 32-byte mainnet tx hash → Etherscan; L2 Secure hashes
|
|
56
|
-
* are Lighter's own (non-EVM) format → Lighter explorer. Detecting the EVM hash
|
|
57
|
-
* keeps L1-vs-L2 routing self-contained (no extra state threaded through the
|
|
58
|
-
* modal step machine).
|
|
59
|
-
*/
|
|
60
|
-
export declare function resolveLighterWithdrawalExplorerUrl(txHash: string): string;
|
|
61
|
-
/**
|
|
62
|
-
* True when an error is Lighter's **L2 (Secure) withdrawal** rate limit —
|
|
63
|
-
* codes 23004 / 23005, e.g. "Too Many L2 Withdrawal Requests!: L2 withdrawal
|
|
64
|
-
* rate limit exceeded. Only 3 withdrawals allowed per 2 hours". Used to offer
|
|
65
|
-
* the on-chain L1 fallback (Secure withdrawals only).
|
|
66
|
-
*
|
|
67
|
-
* The L2 SDK usually surfaces this as a plain string (the numeric code isn't
|
|
68
|
-
* always preserved), so we match message content — plus the structured `code`
|
|
69
|
-
* field when the error carries one.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isLighterWithdrawalRateLimitError(error: unknown): boolean;
|
|
72
|
-
export declare const LIGHTER_DYNAMIC_ROUTING_ID: {
|
|
73
|
-
ETH_SPOT: string;
|
|
74
|
-
USDC_PERPS: string;
|
|
75
|
-
ETH_SPOT_NEW_USER: string;
|
|
76
|
-
USDC_PERPS_NEW_USER: string;
|
|
77
|
-
LINK_SPOT_NEW_USER: string;
|
|
78
|
-
UNI_SPOT_NEW_USER: string;
|
|
79
|
-
AAVE_SPOT_NEW_USER: string;
|
|
80
|
-
SKY_SPOT_NEW_USER: string;
|
|
81
|
-
LDO_SPOT_NEW_USER: string;
|
|
82
|
-
LIT_SPOT_NEW_USER: string;
|
|
83
|
-
};
|
|
1
|
+
export { LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF, LIGHTER_DEPOSIT_ADDRESS, LIGHTER_DYNAMIC_ROUTING_ID, LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS, LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError, lighterWithdrawBaseUnits, resolveLighterWithdrawalExplorerUrl, truncateToDecimals, } from '@funkit/connect-core/clients/lighter';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function isSwitchChainError(error: unknown): boolean;
|
|
1
|
+
export { isSwitchChainError, isUserRejectedError } from '@funkit/connect-core';
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, SourceTokenOption, WalletWithdrawalConfig
|
|
2
|
-
/**
|
|
3
|
-
* Deducts a flat fee (in token units) from a withdrawal input amount, clamped
|
|
4
|
-
* at 0. Uses `dnum` fixed-point math so decimal strings straight off the amount
|
|
5
|
-
* field stay exact.
|
|
6
|
-
*/
|
|
7
|
-
export declare function deductFlatFee(inputAmount: string, feeTokens: number): string;
|
|
8
|
-
/**
|
|
9
|
-
* Resolves the integrator's `withdrawalSourceTokenBalance` callback to a numeric
|
|
10
|
-
* string. Shared by the withdrawal amount screen and the Swapped cash cap.
|
|
11
|
-
*
|
|
12
|
-
* Named `resolve*`, not `safeEvaluate*`: it may legitimately not resolve. It
|
|
13
|
-
* never throws either way.
|
|
14
|
-
*
|
|
15
|
-
* - `undefined` means the integrator supplied no callback — distinct from a
|
|
16
|
-
* callback returning `0`, which means "nothing withdrawable". Callers that
|
|
17
|
-
* only display a number should coalesce to `'0'`.
|
|
18
|
-
* - A throw or an unusable value yields `'0'` (with a warn), never `undefined`:
|
|
19
|
-
* a broken callback must not silently fall through to another balance source.
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveWithdrawalSourceTokenBalance(fn: ((params: WithdrawalSourceTokenBalanceParams) => string | number) | undefined, params: WithdrawalSourceTokenBalanceParams): string | undefined;
|
|
1
|
+
import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdrawalConfig, SourceTokenOption, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext';
|
|
22
2
|
/**
|
|
23
3
|
* Type guard to check if withdrawal config uses wallet-based flow
|
|
24
4
|
*/
|
|
@@ -71,15 +71,15 @@ import {
|
|
|
71
71
|
import {
|
|
72
72
|
oneInchWallet
|
|
73
73
|
} from "./chunk-QG6ZHI7B.js";
|
|
74
|
-
import {
|
|
75
|
-
phantomWallet
|
|
76
|
-
} from "./chunk-QY53O7WG.js";
|
|
77
74
|
import {
|
|
78
75
|
oneKeyWallet
|
|
79
76
|
} from "./chunk-WVT6BBJH.js";
|
|
80
77
|
import {
|
|
81
|
-
|
|
82
|
-
} from "./chunk-
|
|
78
|
+
phantomWallet
|
|
79
|
+
} from "./chunk-QY53O7WG.js";
|
|
80
|
+
import {
|
|
81
|
+
foxWallet
|
|
82
|
+
} from "./chunk-MIQTHJ6X.js";
|
|
83
83
|
import {
|
|
84
84
|
frameWallet
|
|
85
85
|
} from "./chunk-BU3ZAT5X.js";
|
|
@@ -123,20 +123,20 @@ import {
|
|
|
123
123
|
desigWallet
|
|
124
124
|
} from "./chunk-FW3WZETT.js";
|
|
125
125
|
import {
|
|
126
|
-
|
|
127
|
-
} from "./chunk-
|
|
126
|
+
enkryptWallet
|
|
127
|
+
} from "./chunk-HBQK5RD5.js";
|
|
128
128
|
import {
|
|
129
129
|
argentWallet
|
|
130
130
|
} from "./chunk-NTMBEOR2.js";
|
|
131
|
-
import {
|
|
132
|
-
bifrostWallet
|
|
133
|
-
} from "./chunk-4T6ZSRJF.js";
|
|
134
131
|
import {
|
|
135
132
|
bitgetWallet
|
|
136
133
|
} from "./chunk-CPI4TD43.js";
|
|
137
134
|
import {
|
|
138
135
|
bitskiWallet
|
|
139
136
|
} from "./chunk-7HRFUZFX.js";
|
|
137
|
+
import {
|
|
138
|
+
bifrostWallet
|
|
139
|
+
} from "./chunk-4T6ZSRJF.js";
|
|
140
140
|
import {
|
|
141
141
|
bitverseWallet
|
|
142
142
|
} from "./chunk-NSK6A7TI.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
"@bluvo/react": "3.0.0-beta.1",
|
|
88
88
|
"@bluvo/sdk-ts": "3.0.0-beta.1",
|
|
89
89
|
"@datadog/browser-logs": "5.22.0",
|
|
90
|
-
"@lifeomic/attempt": "3.1.0",
|
|
91
90
|
"@number-flow/react": "^0.5.5",
|
|
92
91
|
"@radix-ui/react-dropdown-menu": "^2.1.7",
|
|
93
92
|
"@radix-ui/react-tooltip": "^1.2.0",
|
|
@@ -107,10 +106,10 @@
|
|
|
107
106
|
"ua-parser-js": "^1.0.37",
|
|
108
107
|
"use-debounce": "^10.0.5",
|
|
109
108
|
"uuid": "^11.1.1",
|
|
110
|
-
"@funkit/api-base": "7.
|
|
109
|
+
"@funkit/api-base": "7.1.0",
|
|
111
110
|
"@funkit/chains": "2.2.0",
|
|
112
|
-
"@funkit/
|
|
113
|
-
"@funkit/
|
|
111
|
+
"@funkit/fun-relay": "2.12.0",
|
|
112
|
+
"@funkit/connect-core": "3.1.0",
|
|
114
113
|
"@funkit/utils": "4.0.0"
|
|
115
114
|
},
|
|
116
115
|
"repository": {
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/utils/customer.ts
|
|
4
|
-
import { useLighterAccountsQuery } from "@funkit/connect-core";
|
|
5
|
-
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useCallback } from "react";
|
|
7
|
-
import {
|
|
8
|
-
LIGHTER_TRADING_MODE,
|
|
9
|
-
getLighterAccountsByL1Address,
|
|
10
|
-
useLighterAccountsQuery as useLighterAccountsQuery2
|
|
11
|
-
} from "@funkit/connect-core";
|
|
12
|
-
async function getLighterAccount(lookup, activeOnly) {
|
|
13
|
-
const params = new URLSearchParams({
|
|
14
|
-
by: lookup.by,
|
|
15
|
-
value: String(lookup.value),
|
|
16
|
-
...activeOnly !== void 0 && { active_only: String(activeOnly) }
|
|
17
|
-
});
|
|
18
|
-
const response = await fetch(
|
|
19
|
-
`https://mainnet.zklighter.elliot.ai/api/v1/account?${params}`
|
|
20
|
-
);
|
|
21
|
-
if (!response.ok) {
|
|
22
|
-
throw new Error(`Failed to fetch lighter account: ${response.statusText}`);
|
|
23
|
-
}
|
|
24
|
-
return response.json();
|
|
25
|
-
}
|
|
26
|
-
function useLighterAccountQuery(lookup, options) {
|
|
27
|
-
const enabled = lookup !== null && (lookup.by === "index" ? true : !!lookup.value && lookup.value !== "0x");
|
|
28
|
-
const query = useQuery({
|
|
29
|
-
queryKey: [
|
|
30
|
-
"lighterAccount",
|
|
31
|
-
lookup?.by,
|
|
32
|
-
lookup?.value,
|
|
33
|
-
options?.activeOnly
|
|
34
|
-
],
|
|
35
|
-
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
36
|
-
queryFn: () => getLighterAccount(lookup, options?.activeOnly),
|
|
37
|
-
enabled,
|
|
38
|
-
// Refetch on every (re)mount so reopening the withdraw widget shows a fresh
|
|
39
|
-
// balance after a spot→perps transfer; 10s stale window keeps it current.
|
|
40
|
-
staleTime: 1e4,
|
|
41
|
-
refetchOnMount: "always",
|
|
42
|
-
retry: false
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
...query,
|
|
46
|
-
account: query.data?.accounts?.[0]
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
useLighterAccountQuery,
|
|
52
|
-
useLighterAccountsQuery2 as useLighterAccountsQuery
|
|
53
|
-
};
|