@funkit/connect 11.1.0 → 11.3.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/clients/{chunk-YZSO4EMO.js → chunk-2576N7PQ.js} +1 -1
  3. package/dist/clients/{chunk-II5CZTBC.js → chunk-3P2C436B.js} +3 -1
  4. package/dist/clients/{chunk-YMGRBJAS.js → chunk-46L2KJJ4.js} +14 -16
  5. package/dist/clients/chunk-6EU6CXNH.js +20 -0
  6. package/dist/clients/{chunk-2QYQNTOI.js → chunk-C45VNQXY.js} +24 -16
  7. package/dist/clients/{chunk-SO756ELD.js → chunk-DGBIV3ZS.js} +1 -0
  8. package/dist/clients/{chunk-SYFHMTUO.js → chunk-FM7SFGAV.js} +2 -2
  9. package/dist/clients/{chunk-EJKHMZW3.js → chunk-IYCZWLAF.js} +2 -1
  10. package/dist/clients/{chunk-OJZNF6EM.js → chunk-JFDRLSYM.js} +1 -1
  11. package/dist/clients/{chunk-QIMCURVA.js → chunk-L2XMI4EX.js} +9 -9
  12. package/dist/clients/{chunk-A6OXZWCN.js → chunk-QQEGNLGD.js} +1 -1
  13. package/dist/clients/{chunk-A44M6EAG.js → chunk-TZGKB6WY.js} +1 -1
  14. package/dist/clients/{chunk-C53FRCUM.js → chunk-UK64SY6N.js} +1 -1
  15. package/dist/clients/{chunk-WVM4ZJD2.js → chunk-VIAEAD75.js} +1 -1
  16. package/dist/clients/{chunk-SH3MHRHX.js → chunk-Y7WLUPTX.js} +1 -1
  17. package/dist/clients/{chunk-FAYBQQNB.js → chunk-YUZ3B2Q3.js} +1 -1
  18. package/dist/clients/fanatics.js +2 -2
  19. package/dist/clients/internal/nado/consts.d.ts +6 -0
  20. package/dist/clients/internal/nado/consts.js +5 -3
  21. package/dist/clients/internal/nado/gateway.js +2 -2
  22. package/dist/clients/internal/nado/hooks.js +4 -4
  23. package/dist/clients/internal/nado/indexer.js +2 -2
  24. package/dist/clients/internal/nado/typedData.js +2 -2
  25. package/dist/clients/internal/nado/withdrawalCallback.js +7 -7
  26. package/dist/clients/internal/nado/withdrawalConfig.d.ts +4 -4
  27. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  28. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  29. package/dist/clients/internal/nado/withdrawalForm.css +43 -35
  30. package/dist/clients/internal/nado/withdrawalForm.d.ts +3 -0
  31. package/dist/clients/internal/nado/withdrawalForm.js +15 -11
  32. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  33. package/dist/clients/lighter.css +43 -35
  34. package/dist/clients/lighter.d.ts +4 -30
  35. package/dist/clients/lighter.js +74 -260
  36. package/dist/clients/mallard.js +2 -2
  37. package/dist/clients/nado.js +9 -9
  38. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +43 -35
  39. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +8 -8
  40. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
  41. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  42. package/dist/clients/polymarket/index.css +43 -35
  43. package/dist/clients/polymarket/index.js +11 -11
  44. package/dist/clients/polymarket/polymarket.js +1 -1
  45. package/dist/components/Dialog/Dialog.d.ts +3 -1
  46. package/dist/components/Dialog/DialogContent.css.d.ts +6 -0
  47. package/dist/components/FunCheckbox/FunCheckbox.d.ts +3 -1
  48. package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
  49. package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
  50. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -1
  51. package/dist/domains/checkout.d.ts +2 -1
  52. package/dist/domains/nado.d.ts +11 -2
  53. package/dist/domains/quoteMode/types.d.ts +16 -0
  54. package/dist/domains/relay.d.ts +0 -3
  55. package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
  56. package/dist/hooks/track/analytics/events.d.ts +203 -7
  57. package/dist/hooks/track/analytics/mappers.d.ts +17 -0
  58. package/dist/hooks/track/analytics/quote.d.ts +12 -0
  59. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
  60. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +87 -2
  61. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +48 -0
  62. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
  63. package/dist/hooks/track/useTrack.d.ts +1 -1
  64. package/dist/hooks/useFunkitTranslation.d.ts +5 -0
  65. package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
  66. package/dist/hooks/useTokenAndChainDropdown.d.ts +4 -1
  67. package/dist/index.css +43 -35
  68. package/dist/index.js +5301 -3619
  69. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
  70. package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
  71. package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
  72. package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +5 -1
  73. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +13 -0
  74. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +4 -3
  75. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +9 -1
  76. package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +3 -1
  77. package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
  78. package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +4 -1
  79. package/dist/modals/CheckoutModal/SourceChange/useBottomBarCloseLabel.d.ts +7 -0
  80. package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
  81. package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
  82. package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
  83. package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
  84. package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
  85. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
  86. package/dist/modals/WithdrawalModal/LockedReceiveDisplay.d.ts +22 -0
  87. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
  88. package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
  89. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +18 -1
  90. package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +1 -1
  91. package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
  92. package/dist/providers/FunkitCheckoutContext/types.d.ts +21 -4
  93. package/dist/providers/FunkitStatsigProvider.d.ts +7 -0
  94. package/dist/utils/customer.d.ts +45 -504
  95. package/dist/utils/lighter.d.ts +1 -83
  96. package/dist/utils/signature.d.ts +1 -2
  97. package/dist/utils/withdrawal.d.ts +11 -1
  98. package/dist/wallets/walletConnectors/index.js +49 -49
  99. package/package.json +4 -5
  100. package/dist/clients/chunk-NAVU6W7V.js +0 -89
@@ -11,18 +11,18 @@ import {
11
11
  import {
12
12
  useLighterAccountQuery,
13
13
  useLighterAccountsQuery
14
- } from "./chunk-NAVU6W7V.js";
14
+ } from "./chunk-6EU6CXNH.js";
15
15
  import {
16
16
  useFunkitConfig
17
- } from "./chunk-C53FRCUM.js";
17
+ } from "./chunk-UK64SY6N.js";
18
18
  import {
19
19
  Box
20
20
  } from "./chunk-LUHEVXPD.js";
21
21
  import {
22
22
  useFunkitTranslation
23
- } from "./chunk-FAYBQQNB.js";
23
+ } from "./chunk-YUZ3B2Q3.js";
24
24
  import "./chunk-UPZNKPYU.js";
25
- import "./chunk-2QYQNTOI.js";
25
+ import "./chunk-C45VNQXY.js";
26
26
  import {
27
27
  logger
28
28
  } from "./chunk-AHYOV7AV.js";
@@ -35,12 +35,10 @@ import {
35
35
  } from "@funkit/api-base";
36
36
  import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
37
37
  import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
38
- import { retry } from "@lifeomic/attempt";
39
- import { useQuery as useQuery2 } from "@tanstack/react-query";
40
38
  import i18next from "i18next";
41
39
  import React4, { useMemo as useMemo2 } from "react";
42
40
  import { v4 as uuid2 } from "uuid";
43
- import { pad as pad2, parseUnits as parseUnits3, toHex } from "viem";
41
+ import { pad as pad2, parseUnits as parseUnits2, toHex } from "viem";
44
42
  import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
45
43
 
46
44
  // src/components/ChainIcon/ChainIcon.tsx
@@ -156,6 +154,19 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React2.createElement(
156
154
  )
157
155
  );
158
156
 
157
+ // src/clients/lighter.tsx
158
+ import {
159
+ LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS as LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS2,
160
+ LIGHTER_FAST_MAX_WITHDRAWAL_USD as LIGHTER_FAST_MAX_WITHDRAWAL_USD2,
161
+ LIGHTER_SECURE_ASSETS_BY_INDEX as LIGHTER_SECURE_ASSETS_BY_INDEX2,
162
+ LIGHTER_USDC_SPOT_SYMBOL as LIGHTER_USDC_SPOT_SYMBOL2,
163
+ getLighterBaseSymbol as getLighterBaseSymbol3
164
+ } from "@funkit/connect-core/clients/lighter";
165
+ import {
166
+ createLighterAdaptedWallet,
167
+ useLighterWithdrawalDelaySeconds
168
+ } from "@funkit/connect-core/clients/lighter";
169
+
159
170
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
160
171
  import {
161
172
  DirectExecutionType,
@@ -172,68 +183,9 @@ import React3, {
172
183
  useState
173
184
  } from "react";
174
185
  import { createPortal } from "react-dom";
175
- import { numberToHex, pad, parseUnits as parseUnits2 } from "viem";
186
+ import { numberToHex, pad, parseUnits } from "viem";
176
187
  import { mainnet } from "viem/chains";
177
188
 
178
- // src/utils/lighter.ts
179
- import {
180
- encodeFunctionData,
181
- getAddress,
182
- parseUnits
183
- } from "viem";
184
- var LIGHTER_DEPOSIT_ADDRESS = getAddress(
185
- "0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7"
186
- );
187
- var LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS = 60 * 2;
188
- var LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF = 60 * 5;
189
- var LIGHTER_USDC_ASSET_INDEX = 3;
190
- var LIGHTER_WITHDRAW_ABI = [
191
- {
192
- type: "function",
193
- name: "withdraw",
194
- stateMutability: "nonpayable",
195
- inputs: [
196
- { name: "accountIndex", type: "uint48" },
197
- { name: "assetIndex", type: "uint16" },
198
- { name: "routeType", type: "uint8" },
199
- { name: "amount", type: "uint64" }
200
- ],
201
- outputs: []
202
- }
203
- ];
204
- function truncateToDecimals(amount, decimals) {
205
- const [whole = "0", frac = ""] = amount.split(".");
206
- if (frac.length <= decimals) {
207
- return amount;
208
- }
209
- const truncated = frac.slice(0, decimals);
210
- return truncated ? `${whole}.${truncated}` : whole;
211
- }
212
- function lighterWithdrawBaseUnits(assetIndex, amountTokenUnits) {
213
- const decimals = assetIndex === LIGHTER_USDC_ASSET_INDEX ? 6 : 8;
214
- return parseUnits(truncateToDecimals(amountTokenUnits, decimals), decimals);
215
- }
216
- function buildLighterL1WithdrawTransaction(params) {
217
- const { accountIndex, assetIndex, routeType, amountBaseUnit } = params;
218
- const data = encodeFunctionData({
219
- abi: LIGHTER_WITHDRAW_ABI,
220
- functionName: "withdraw",
221
- args: [accountIndex, assetIndex, routeType, amountBaseUnit]
222
- });
223
- return { to: LIGHTER_DEPOSIT_ADDRESS, data, value: 0n };
224
- }
225
- function isLighterWithdrawalRateLimitError(error) {
226
- if (error && typeof error === "object" && "code" in error) {
227
- const code = error.code;
228
- if (code === 23004 || code === 23005) {
229
- return true;
230
- }
231
- }
232
- const raw = error instanceof Error ? error.message : typeof error === "string" ? error : error && typeof error === "object" && "message" in error ? String(error.message) : "";
233
- const message = raw.toLowerCase();
234
- return message.includes("23004") || message.includes("23005") || message.includes("rate limit") || message.includes("ratelimit");
235
- }
236
-
237
189
  // src/utils/tokenIconUrl.ts
238
190
  var getLocalTokenIconUrl = (symbol) => {
239
191
  return ASSET_LOGO_SRCS[symbol.toUpperCase()] || `https://sdk-cdn.fun.xyz/images/${encodeURIComponent(symbol.toLowerCase())}.svg`;
@@ -264,52 +216,53 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
264
216
  }
265
217
 
266
218
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
219
+ import {
220
+ LIGHTER_ROUTE_TYPE,
221
+ LIGHTER_STAKING_POOL_INDEX,
222
+ buildLighterL1WithdrawTransaction,
223
+ findLighterStakingShare,
224
+ getLighterBaseSymbol,
225
+ isLighterWithdrawalRateLimitError,
226
+ lighterWithdrawBaseUnits,
227
+ resolveLighterSharePrice,
228
+ resolveLighterUnstakedFeeTokens,
229
+ resolveLighterWithdrawalExplorerUrl,
230
+ truncateToDecimals
231
+ } from "@funkit/connect-core/clients/lighter";
232
+ import {
233
+ LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
234
+ LIGHTER_FAST_MAX_WITHDRAWAL_USD,
235
+ LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE2,
236
+ LIGHTER_SECURE_ASSETS_BY_INDEX,
237
+ LIGHTER_STAKING_POOL_INDEX as LIGHTER_STAKING_POOL_INDEX2,
238
+ LIGHTER_STAKING_THRESHOLD_LIT,
239
+ LIGHTER_UNSTAKED_FEE_TOKENS,
240
+ LIGHTER_USDC_SPOT_SYMBOL,
241
+ getLighterBaseSymbol as getLighterBaseSymbol2,
242
+ getLighterSecureMainnetAddress,
243
+ resolveLighterAssetIndex,
244
+ resolveLighterSecureRouteType,
245
+ resolveLighterSharePrice as resolveLighterSharePrice2,
246
+ resolveLighterUnstakedFeeTokens as resolveLighterUnstakedFeeTokens2
247
+ } from "@funkit/connect-core/clients/lighter";
267
248
  var LIGHTER_FAST_METHOD_ID = "lighter-fast";
268
249
  var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
269
- var LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
270
- var LIGHTER_ROUTE_TYPE = {
271
- PERPS: 0,
272
- SPOT: 1
273
- };
274
- function getLighterBaseSymbol(symbol) {
275
- return symbol.replace(/\s*\((?:spot|perps)\)\s*$/i, "");
276
- }
277
- var LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3e6;
278
250
 
279
251
  // src/clients/lighter.tsx
252
+ import { truncateToDecimals as truncateToDecimals2 } from "@funkit/connect-core/clients/lighter";
253
+ import { LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE3 } from "@funkit/connect-core/clients/lighter";
254
+ import {
255
+ LIGHTER_WITHDRAW_ABI,
256
+ buildLighterL1WithdrawTransaction as buildLighterL1WithdrawTransaction2,
257
+ isLighterWithdrawalRateLimitError as isLighterWithdrawalRateLimitError2,
258
+ lighterWithdrawBaseUnits as lighterWithdrawBaseUnits2
259
+ } from "@funkit/connect-core/clients/lighter";
280
260
  var LIGHTER_USDC_PERPS_ADDRESS = "0x0000000000000000000000000000000000000000";
281
261
  var MAINNET_USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
282
- var LIGHTER_SECURE_ASSETS_BY_INDEX = {
283
- 1: { symbol: "ETH", decimals: 18 },
284
- 2: { symbol: "LIT", decimals: 18 },
285
- 3: { symbol: "USDC", decimals: 6 },
286
- 5: { symbol: "LINK", decimals: 18 },
287
- 6: { symbol: "UNI", decimals: 18 },
288
- 7: { symbol: "AAVE", decimals: 18 },
289
- 8: { symbol: "SKY", decimals: 18 },
290
- 9: { symbol: "LDO", decimals: 18 },
291
- 10: { symbol: "AZTEC", decimals: 18 }
292
- };
293
- var LIGHTER_API_BASE = "https://mainnet.zklighter.elliot.ai";
294
- async function getLighterWithdrawalDelay() {
295
- const response = await fetch(`${LIGHTER_API_BASE}/api/v1/withdrawalDelay`);
296
- if (!response.ok) {
297
- throw new Error(
298
- `Failed to fetch Lighter withdrawal delay: ${response.statusText}`
299
- );
300
- }
301
- return response.json();
302
- }
303
262
  function useLighterSecureDelayText() {
304
263
  const { t } = useFunkitTranslation();
305
- const query = useQuery2({
306
- queryKey: ["lighterWithdrawalDelay"],
307
- queryFn: getLighterWithdrawalDelay,
308
- staleTime: 6e4,
309
- retry: 2
310
- });
311
- const seconds = query.data?.seconds;
312
- if (seconds === void 0 || !Number.isFinite(seconds) || seconds <= 0) {
264
+ const seconds = useLighterWithdrawalDelaySeconds();
265
+ if (seconds === void 0) {
313
266
  return void 0;
314
267
  }
315
268
  return formatSecondsTranslated(
@@ -321,140 +274,6 @@ function useLighterSecureDelayText() {
321
274
  true
322
275
  );
323
276
  }
324
- var LIGHTER_TX_STATUS = {
325
- PENDING: 0,
326
- QUEUED: 1,
327
- COMMITTED: 2,
328
- EXECUTED: 3,
329
- FAILED: 4,
330
- REJECTED: 5
331
- };
332
- function coerceLighterStatus(status) {
333
- if (typeof status === "number") {
334
- return status;
335
- }
336
- switch (status) {
337
- case "confirmed":
338
- return LIGHTER_TX_STATUS.EXECUTED;
339
- case "failed":
340
- return LIGHTER_TX_STATUS.FAILED;
341
- default:
342
- return LIGHTER_TX_STATUS.PENDING;
343
- }
344
- }
345
- var LighterTerminalError = class extends Error {
346
- };
347
- async function pollLighterTransaction(txHash, options) {
348
- const { pollIntervalMs, maxAttempts, waitFor } = options;
349
- return retry(
350
- async () => {
351
- const resp = await fetch(
352
- `${LIGHTER_API_BASE}/api/v1/tx?by=hash&value=${txHash}`
353
- );
354
- if (!resp.ok) {
355
- throw new Error(`Lighter API error ${resp.status} for tx ${txHash}`);
356
- }
357
- const tx = await resp.json();
358
- if (!tx.hash) {
359
- throw new Error(`Lighter tx ${txHash} not found yet`);
360
- }
361
- const status = coerceLighterStatus(tx.status ?? LIGHTER_TX_STATUS.PENDING);
362
- if (status === LIGHTER_TX_STATUS.FAILED || status === LIGHTER_TX_STATUS.REJECTED) {
363
- const label = status === LIGHTER_TX_STATUS.FAILED ? "failed" : "rejected";
364
- throw new LighterTerminalError(
365
- `Lighter transaction ${label}: ${tx.message ?? "unknown error"}`
366
- );
367
- }
368
- if (waitFor === "findable") {
369
- return tx;
370
- }
371
- if (status === LIGHTER_TX_STATUS.COMMITTED || status === LIGHTER_TX_STATUS.EXECUTED) {
372
- return tx;
373
- }
374
- throw new Error(
375
- `Lighter transaction ${txHash} did not reach '${waitFor}' after ${maxAttempts} attempts`
376
- );
377
- },
378
- {
379
- maxAttempts,
380
- delay: pollIntervalMs,
381
- factor: 1,
382
- jitter: false,
383
- handleError: (err, context) => {
384
- if (err instanceof LighterTerminalError) {
385
- context.abort();
386
- }
387
- }
388
- }
389
- );
390
- }
391
- function createLighterAdaptedWallet({
392
- signerClient,
393
- accountIndex
394
- }) {
395
- async function handleSendTransactionStep(_chainId, stepItem) {
396
- const action = stepItem.data?.action;
397
- if (!action || action.type !== "transfer") {
398
- throw new Error(
399
- `Unsupported Lighter action: ${action?.type ?? "undefined"}`
400
- );
401
- }
402
- const p = action.parameters;
403
- logger.info("lighter:wallet:transfer", p);
404
- const [, txHash, error] = await signerClient.transfer({
405
- toAccountIndex: p.toAccountIndex,
406
- assetIndex: p.assetIndex,
407
- fromRouteType: p.fromRouteType,
408
- toRouteType: p.toRouteType,
409
- amount: p.amount,
410
- usdcFee: p.usdcFee,
411
- memo: p.memo
412
- });
413
- if (error) {
414
- throw new Error(`Lighter transfer failed: ${error}`);
415
- }
416
- if (!txHash) {
417
- throw new Error("Lighter transfer returned no transaction hash");
418
- }
419
- logger.info("lighter:wallet:transfer:done", { txHash });
420
- return txHash;
421
- }
422
- return {
423
- vmType: "lvm",
424
- getChainId: async () => Number(RELAY_LIGHTER_CHAIN_ID2),
425
- address: async () => accountIndex.toString(),
426
- handleSignMessageStep: async () => {
427
- throw new Error("Message signing not implemented for Lighter");
428
- },
429
- handleSendTransactionStep,
430
- handleConfirmTransactionStep: async (txHash) => {
431
- const tx = await pollLighterTransaction(txHash, {
432
- pollIntervalMs: 2e3,
433
- maxAttempts: 60,
434
- waitFor: "findable"
435
- });
436
- return {
437
- txHash: tx.hash,
438
- blockHeight: tx.block_height ?? 0,
439
- status: tx.status
440
- };
441
- },
442
- // biome-ignore lint/suspicious/noEmptyBlockStatements: Lighter is single-chain — no switching needed
443
- switchChain: async () => {
444
- }
445
- };
446
- }
447
- var LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS = {
448
- USDC: 1,
449
- ETH: 1e-3,
450
- LIT: 1,
451
- LINK: 0.1,
452
- UNI: 0.2,
453
- AAVE: 0.01,
454
- SKY: 20,
455
- LDO: 2,
456
- AZTEC: 100
457
- };
458
277
  async function trackLighterSecureWithdrawal({
459
278
  apiKey,
460
279
  userId,
@@ -465,7 +284,7 @@ async function trackLighterSecureWithdrawal({
465
284
  amountTokenUnits,
466
285
  withdrawalUSD
467
286
  }) {
468
- const assetMeta = LIGHTER_SECURE_ASSETS_BY_INDEX[assetIndex];
287
+ const assetMeta = LIGHTER_SECURE_ASSETS_BY_INDEX2[assetIndex];
469
288
  if (!assetMeta) {
470
289
  logger.error(
471
290
  "lighter:withdrawal:secure:tracking:unknownAssetIndex",
@@ -476,8 +295,8 @@ async function trackLighterSecureWithdrawal({
476
295
  }
477
296
  const { symbol, decimals } = assetMeta;
478
297
  const estTotalUsd = Number(withdrawalUSD);
479
- const safeAmount = truncateToDecimals(amountTokenUnits, decimals);
480
- const baseUnitAmount = parseUnits3(safeAmount, decimals).toString();
298
+ const safeAmount = truncateToDecimals2(amountTokenUnits, decimals);
299
+ const baseUnitAmount = parseUnits2(safeAmount, decimals).toString();
481
300
  const fromTokenAddress = pad2(toHex(assetIndex), { size: 20 });
482
301
  await createDirectExecution2({
483
302
  apiKey,
@@ -629,8 +448,8 @@ function buildLighterSourceTokenOptions({
629
448
  ).map((asset) => {
630
449
  if (asset.symbol.toUpperCase() === "USDC") {
631
450
  return {
632
- symbol: LIGHTER_USDC_SPOT_SYMBOL,
633
- label: LIGHTER_USDC_SPOT_SYMBOL,
451
+ symbol: LIGHTER_USDC_SPOT_SYMBOL2,
452
+ label: LIGHTER_USDC_SPOT_SYMBOL2,
634
453
  iconSrc: getTokenIconUrl("USDC")
635
454
  };
636
455
  }
@@ -654,7 +473,8 @@ function buildLighterFastWalletWithdrawalConfig({
654
473
  }) {
655
474
  const adaptedWallet = createLighterAdaptedWallet({
656
475
  signerClient,
657
- accountIndex
476
+ accountIndex,
477
+ logger
658
478
  });
659
479
  const wallet = {
660
480
  _type: "lighter",
@@ -688,7 +508,7 @@ function buildLighterFastWalletWithdrawalConfig({
688
508
  sourceTokenAddress: LIGHTER_USDC_PERPS_ADDRESS,
689
509
  iconSrc: iconSrc ?? "https://sdk-cdn.fun.xyz/images/logos/lighter.png",
690
510
  getMinWithdrawalUSD: () => 4,
691
- getMaxWithdrawalUSD: () => LIGHTER_FAST_MAX_WITHDRAWAL_USD
511
+ getMaxWithdrawalUSD: () => LIGHTER_FAST_MAX_WITHDRAWAL_USD2
692
512
  };
693
513
  }
694
514
  function ChainIconStack({ chainIds }) {
@@ -746,15 +566,13 @@ function buildLighterMultiMethodConfig({
746
566
  if (userMin !== void 0) {
747
567
  return userMin;
748
568
  }
749
- return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS[getLighterBaseSymbol(symbol).toUpperCase()] ?? 0;
569
+ return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS2[getLighterBaseSymbol3(symbol).toUpperCase()] ?? 0;
750
570
  }
751
571
  });
752
572
  const fast = {
753
573
  id: LIGHTER_FAST_METHOD_ID,
754
574
  keyText: t("withdrawal.methodFast"),
755
- subtitleText: t(
756
- isUnifiedTradingMode ? "withdrawal.fastDisclaimerUnified" : "withdrawal.fastDisclaimer"
757
- ),
575
+ subtitleText: isUnifiedTradingMode ? t("withdrawal.fastDisclaimerUnified") : t("withdrawal.fastDisclaimer"),
758
576
  icon: /* @__PURE__ */ React4.createElement(EvmWallet, { size: 20 }),
759
577
  valueIcon: /* @__PURE__ */ React4.createElement(ChainIconStack, { chainIds: LIGHTER_FAST_PREVIEW_CHAIN_IDS }),
760
578
  config: fastConfig
@@ -780,13 +598,10 @@ function buildLighterMultiMethodConfig({
780
598
  }
781
599
  function useLighterWithdrawalConfig(config) {
782
600
  const { t } = useFunkitTranslation();
783
- const { mainAccountIndex, isUnifiedTradingMode } = useLighterAccountsQuery({
784
- address: config?.l1Address
785
- });
786
- const accountIndex = mainAccountIndex && /^\d+$/.test(mainAccountIndex) ? mainAccountIndex : void 0;
601
+ const { mainAccountIndex: accountIndex, isUnifiedTradingMode } = useLighterAccountsQuery({ address: config?.l1Address });
787
602
  const secureDelayText = useLighterSecureDelayText();
788
603
  const { account } = useLighterAccountQuery(
789
- // Validated numeric above, so the template-literal narrowing is safe.
604
+ // The query validates it as numeric, so the template-literal narrowing holds.
790
605
  accountIndex ? { by: "index", value: accountIndex } : null
791
606
  );
792
607
  const assets = useMemo2(() => account?.assets ?? [], [account]);
@@ -805,14 +620,13 @@ function useLighterWithdrawalConfig(config) {
805
620
  }, [config, accountIndex, t, secureDelayText, isUnifiedTradingMode, assets]);
806
621
  }
807
622
  export {
808
- LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
809
- LIGHTER_ROUTE_TYPE,
623
+ LIGHTER_ROUTE_TYPE3 as LIGHTER_ROUTE_TYPE,
810
624
  LIGHTER_WITHDRAW_ABI,
811
- buildLighterL1WithdrawTransaction,
625
+ buildLighterL1WithdrawTransaction2 as buildLighterL1WithdrawTransaction,
812
626
  buildLighterSourceTokenOptions,
813
627
  createLighterSecureWithdrawalConfig,
814
- isLighterWithdrawalRateLimitError,
815
- lighterWithdrawBaseUnits,
628
+ isLighterWithdrawalRateLimitError2 as isLighterWithdrawalRateLimitError,
629
+ lighterWithdrawBaseUnits2 as lighterWithdrawBaseUnits,
816
630
  trackLighterSecureWithdrawal,
817
631
  useLighterWithdrawalConfig
818
632
  };
@@ -9,12 +9,12 @@ import {
9
9
  } from "./chunk-OODIKHYE.js";
10
10
  import {
11
11
  useFunkitTranslation
12
- } from "./chunk-FAYBQQNB.js";
12
+ } from "./chunk-YUZ3B2Q3.js";
13
13
  import {
14
14
  useAccount,
15
15
  useConfig
16
16
  } from "./chunk-UPZNKPYU.js";
17
- import "./chunk-2QYQNTOI.js";
17
+ import "./chunk-C45VNQXY.js";
18
18
  import {
19
19
  logger
20
20
  } from "./chunk-AHYOV7AV.js";
@@ -1,30 +1,30 @@
1
1
  "use client";
2
2
  import {
3
3
  createNadoWithdrawalCallback
4
- } from "./chunk-YMGRBJAS.js";
5
- import "./chunk-YZSO4EMO.js";
6
- import "./chunk-WVM4ZJD2.js";
4
+ } from "./chunk-46L2KJJ4.js";
5
+ import "./chunk-2576N7PQ.js";
6
+ import "./chunk-VIAEAD75.js";
7
7
  import "./chunk-63XTVHO3.js";
8
8
  import {
9
9
  resolveNadoSubaccount
10
- } from "./chunk-A6OXZWCN.js";
11
- import "./chunk-SO756ELD.js";
10
+ } from "./chunk-QQEGNLGD.js";
11
+ import "./chunk-DGBIV3ZS.js";
12
12
  import "./chunk-6T6URLBM.js";
13
- import "./chunk-A44M6EAG.js";
13
+ import "./chunk-TZGKB6WY.js";
14
14
  import {
15
15
  INK_CHAIN_ID
16
- } from "./chunk-II5CZTBC.js";
16
+ } from "./chunk-3P2C436B.js";
17
17
  import "./chunk-WZRW6WUM.js";
18
18
  import "./chunk-Z7HTQFEO.js";
19
19
  import "./chunk-OODIKHYE.js";
20
+ import "./chunk-PENJ5JGH.js";
20
21
  import {
21
22
  useAccount,
22
23
  useConfig
23
24
  } from "./chunk-UPZNKPYU.js";
24
25
  import {
25
26
  i18n_default
26
- } from "./chunk-2QYQNTOI.js";
27
- import "./chunk-PENJ5JGH.js";
27
+ } from "./chunk-C45VNQXY.js";
28
28
  import "./chunk-AHYOV7AV.js";
29
29
 
30
30
  // src/clients/nado.tsx