@funkit/connect 11.3.0 → 11.4.1

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 (71) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
  3. package/dist/clients/{chunk-L2XMI4EX.js → chunk-BB5FHA47.js} +13 -12
  4. package/dist/clients/chunk-MSLPLXR2.js +30 -0
  5. package/dist/clients/{chunk-QQEGNLGD.js → chunk-TYG42JRZ.js} +4 -4
  6. package/dist/clients/{chunk-46L2KJJ4.js → chunk-UMU5S2WF.js} +34 -43
  7. package/dist/clients/internal/nado/withdrawalCallback.js +4 -11
  8. package/dist/clients/internal/nado/withdrawalConfig.d.ts +3 -1
  9. package/dist/clients/internal/nado/withdrawalConfig.js +2 -3
  10. package/dist/clients/internal/nado/withdrawalErrors.d.ts +6 -10
  11. package/dist/clients/internal/nado/withdrawalErrors.js +1 -2
  12. package/dist/clients/internal/nado/withdrawalForm.css +44 -36
  13. package/dist/clients/internal/nado/withdrawalForm.d.ts +1 -1
  14. package/dist/clients/internal/nado/withdrawalForm.js +20 -73
  15. package/dist/clients/internal/nado/withdrawalStatus.js +4 -8
  16. package/dist/clients/lighter.css +44 -36
  17. package/dist/clients/lighter.d.ts +0 -31
  18. package/dist/clients/lighter.js +10 -102
  19. package/dist/clients/nado.d.ts +3 -1
  20. package/dist/clients/nado.js +8 -15
  21. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +47 -39
  22. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
  23. package/dist/clients/polymarket/index.css +47 -39
  24. package/dist/clients/polymarket/index.js +9 -9
  25. package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
  26. package/dist/components/Dropdown/BaseDropdown.d.ts +0 -1
  27. package/dist/domains/checkout.d.ts +6 -1
  28. package/dist/hooks/track/analytics/events.d.ts +19 -9
  29. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +1 -0
  30. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +11 -3
  31. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +3 -33
  32. package/dist/hooks/track/useTrackV2.d.ts +2 -0
  33. package/dist/hooks/useAssetPrice.d.ts +1 -6
  34. package/dist/hooks/useBluvo.d.ts +7 -2
  35. package/dist/index.css +44 -36
  36. package/dist/index.js +922 -1205
  37. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +5 -11
  38. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -1
  39. package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
  40. package/dist/utils/withdrawal.d.ts +1 -21
  41. package/dist/wallets/walletConnectors/index.js +32 -32
  42. package/package.json +6 -6
  43. package/dist/clients/chunk-2576N7PQ.js +0 -44
  44. package/dist/clients/chunk-3P2C436B.js +0 -20
  45. package/dist/clients/chunk-63XTVHO3.js +0 -19
  46. package/dist/clients/chunk-6T6URLBM.js +0 -33
  47. package/dist/clients/chunk-FM7SFGAV.js +0 -106
  48. package/dist/clients/chunk-JFDRLSYM.js +0 -42
  49. package/dist/clients/chunk-TZGKB6WY.js +0 -160
  50. package/dist/clients/chunk-VIAEAD75.js +0 -61
  51. package/dist/clients/chunk-WZRW6WUM.js +0 -112
  52. package/dist/clients/chunk-Z7HTQFEO.js +0 -69
  53. package/dist/clients/internal/nado/consts.d.ts +0 -22
  54. package/dist/clients/internal/nado/consts.js +0 -15
  55. package/dist/clients/internal/nado/encoding.d.ts +0 -25
  56. package/dist/clients/internal/nado/encoding.js +0 -11
  57. package/dist/clients/internal/nado/errors.d.ts +0 -68
  58. package/dist/clients/internal/nado/errors.js +0 -19
  59. package/dist/clients/internal/nado/fetch.d.ts +0 -15
  60. package/dist/clients/internal/nado/fetch.js +0 -9
  61. package/dist/clients/internal/nado/gateway.d.ts +0 -61
  62. package/dist/clients/internal/nado/gateway.js +0 -17
  63. package/dist/clients/internal/nado/hooks.d.ts +0 -208
  64. package/dist/clients/internal/nado/hooks.js +0 -21
  65. package/dist/clients/internal/nado/indexer.d.ts +0 -43
  66. package/dist/clients/internal/nado/indexer.js +0 -13
  67. package/dist/clients/internal/nado/typedData.d.ts +0 -80
  68. package/dist/clients/internal/nado/typedData.js +0 -10
  69. package/dist/clients/internal/nado/withdrawalTypes.d.ts +0 -49
  70. package/dist/clients/internal/nado/withdrawalTypes.js +0 -1
  71. package/dist/utils/safeBigInt.d.ts +0 -5
@@ -1,24 +1,8 @@
1
1
  "use client";
2
- import {
3
- useNadoFeeRates,
4
- useNadoMaxWithdrawable
5
- } from "../../chunk-FM7SFGAV.js";
6
- import "../../chunk-JFDRLSYM.js";
7
- import {
8
- safeBigInt
9
- } from "../../chunk-63XTVHO3.js";
10
2
  import {
11
3
  isNadoWithdrawalConfig
12
- } from "../../chunk-QQEGNLGD.js";
13
- import "../../chunk-DGBIV3ZS.js";
14
- import {
15
- x18ToRawBaseUnit,
16
- x18ToTokenUnits
17
- } from "../../chunk-6T6URLBM.js";
18
- import "../../chunk-TZGKB6WY.js";
19
- import "../../chunk-3P2C436B.js";
20
- import "../../chunk-WZRW6WUM.js";
21
- import "../../chunk-Z7HTQFEO.js";
4
+ } from "../../chunk-TYG42JRZ.js";
5
+ import "../../chunk-B7UU2ETA.js";
22
6
  import {
23
7
  useGeneralWallet
24
8
  } from "../../chunk-BPDLF2R6.js";
@@ -37,17 +21,18 @@ import {
37
21
  } from "../../chunk-AHYOV7AV.js";
38
22
 
39
23
  // src/clients/internal/nado/withdrawalForm.ts
24
+ import { safeBigInt } from "@funkit/connect-core";
25
+ import {
26
+ useNadoFeeRates,
27
+ useNadoMaxWithdrawable,
28
+ x18ToRawBaseUnit,
29
+ x18ToTokenUnits
30
+ } from "@funkit/connect-core/clients/nado";
40
31
  import { useEffect, useMemo, useState } from "react";
41
32
  import { formatUnits } from "viem";
42
33
 
43
34
  // src/hooks/useAssetPrice.ts
44
- import {
45
- getAssetPriceInfo
46
- } from "@funkit/api-base";
47
- import {
48
- convertFunToRelayTokenAddress,
49
- getRelayAssetPriceInfo
50
- } from "@funkit/fun-relay";
35
+ import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
51
36
  import { skipToken, useQuery } from "@tanstack/react-query";
52
37
 
53
38
  // src/hooks/useIsStablecoin.ts
@@ -87,48 +72,6 @@ var useIsStablecoin = () => {
87
72
  };
88
73
 
89
74
  // src/hooks/useAssetPrice.ts
90
- async function getFormattedRelayAssetPriceInfo({
91
- chainId,
92
- assetTokenAddress
93
- }) {
94
- try {
95
- const relayResponse = await getRelayAssetPriceInfo({
96
- chainId,
97
- address: convertFunToRelayTokenAddress(
98
- assetTokenAddress,
99
- Number(chainId)
100
- )
101
- });
102
- return {
103
- unitPrice: relayResponse.price,
104
- amount: 1,
105
- total: 1
106
- };
107
- } catch (error) {
108
- logger.error("Unable to fetch token price from Relay", error);
109
- throw error;
110
- }
111
- }
112
- async function getAssetPriceInfoWithFallback({
113
- apiKey,
114
- chainId,
115
- assetTokenAddress
116
- }) {
117
- try {
118
- return await getAssetPriceInfo({
119
- apiKey,
120
- assetTokenAddress,
121
- chainId,
122
- logger
123
- });
124
- } catch (primaryError) {
125
- logger.warn(
126
- "Unable to fetch token price from Primary provider, trying fallback",
127
- { primaryError }
128
- );
129
- return await getFormattedRelayAssetPriceInfo({ chainId, assetTokenAddress });
130
- }
131
- }
132
75
  function useAssetAddressPrice({
133
76
  chainId,
134
77
  assetTokenAddress,
@@ -144,7 +87,8 @@ function useAssetAddressPrice({
144
87
  queryFn: enabled && chainId && assetTokenAddress ? () => getAssetPriceInfoWithFallback({
145
88
  apiKey,
146
89
  chainId,
147
- assetTokenAddress
90
+ assetTokenAddress,
91
+ logger
148
92
  }) : skipToken,
149
93
  refetchInterval
150
94
  });
@@ -190,11 +134,13 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
190
134
  const isNado = !!nadoConfig;
191
135
  const subaccount = nadoConfig?.customerConfig.subaccount;
192
136
  const { t } = useFunkitTranslation();
193
- const [spotLeverage, setSpotLeverage] = useState(false);
194
- const { data: feeRates } = useNadoFeeRates(subaccount);
137
+ const [spotLeverage, setSpotLeverage] = useState(
138
+ () => nadoConfig?.defaultSpotLeverage ?? false
139
+ );
140
+ const { data: feeRates } = useNadoFeeRates({ sender: subaccount, logger });
195
141
  useEffect(() => {
196
- setSpotLeverage(false);
197
- }, [subaccount]);
142
+ setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
143
+ }, [subaccount, nadoConfig?.defaultSpotLeverage]);
198
144
  const amountToggle = {
199
145
  label: t("withdrawal.enableBorrowing"),
200
146
  tooltip: t("withdrawal.enableBorrowingTooltip"),
@@ -225,7 +171,8 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
225
171
  const { data: maxWithdrawableX18 } = useNadoMaxWithdrawable({
226
172
  productId: selectedOption?.productId,
227
173
  sender: subaccount,
228
- spotLeverage
174
+ spotLeverage,
175
+ logger
229
176
  });
230
177
  const sequencerFee = getSequencerFee(feeRates, selectedOption);
231
178
  const withdrawableBalanceTokenUnits = getMaxEnterableAmount({
@@ -15,10 +15,11 @@ import {
15
15
  import {
16
16
  getCompletionTxInfo,
17
17
  processRecentDepositsForNotifications,
18
+ useLogOnce,
18
19
  useRecentDepositsApiQuery
19
20
  } from "@funkit/connect-core";
20
21
  import { isEVMAddressEquivalent } from "@funkit/utils";
21
- import { useEffect, useMemo, useRef, useState } from "react";
22
+ import { useEffect, useMemo, useState } from "react";
22
23
  import { zeroHash } from "viem";
23
24
 
24
25
  // src/hooks/useCheckoutDirectExecutionHistory.ts
@@ -170,19 +171,14 @@ function useNadoWithdrawalStatus({
170
171
  setHasSettled(true);
171
172
  }
172
173
  }, [status]);
173
- const loggedStatusRef = useRef(void 0);
174
- useEffect(() => {
175
- if (status === "pending" || loggedStatusRef.current === status) {
176
- return;
177
- }
178
- loggedStatusRef.current = status;
174
+ useLogOnce(status === "pending" ? void 0 : status, () => {
179
175
  logger.info("nado:withdrawal:settled", {
180
176
  depositAddress,
181
177
  status,
182
178
  txHash: latestStep?.txHash,
183
179
  relayStatus: latestStep?.listenerInfo?.status
184
180
  });
185
- }, [status, depositAddress, latestStep]);
181
+ });
186
182
  const completionTx = useMemo(() => {
187
183
  if (status !== "completed" || !latestStep) {
188
184
  return void 0;
@@ -16780,19 +16780,42 @@
16780
16780
  transition: all 150ms cubic-bezier(0.3, 0, 0.06, 1);
16781
16781
  }
16782
16782
 
16783
- /* vanilla-extract-css-ns:src/components/Dropdown/BaseDropdown.css.ts.vanilla.css?source=#H4sIAAAAAAAAA9WTwW7bMAyG73kKIqcEsAIb3YpBxi5r36IYBtqiYyGqKFB03HTouw92mjQZVmAodtmNBPX_Ij9Kmx9VjPn2kEv4uQDgPUkXeDQHCzgo1wuA3AqH0KCY0TvtLUSOVC9eFpuz1lozUrPzas6HZzvncwp4-IOkmuuJs1fP0YJQQPV7qi-asNB75yheC61tqGOh2aDlqBTVwnJZX_lhkzkMOvspJwvlFAXq9DUUv-1PcU_H5NOX9DTlDba7rfAQnYXgI6GYraDzFHWlDA2r8mMBe5SVMbIzLQeWbDhRvBdOjsf47WxxNxXXBahgzAmFoq6PvfqoJIb2FDWfEAFwwtbr4bW1WXWaKQSoPpePGdqh8a1p6NmTrMrNTQFlAeWmvC2gms2fjY-OnixUv8PDTkn-nt1x1n-KTzn9l-weHCqaDh0Z5fR1qTLQ8vvVczzf_770CPRN_baPd8Q3c_FDs1y62B7z6gHFo3E-YxPInZpY2376cvM9l7vz0avHMDFpB8ksE2g1GAKP5OrFyy9ESovqPQQAAA */
16784
- [data-rk] ._1nns6ys0 {
16783
+ /* vanilla-extract-css-ns:src/components/Dropdown/BaseDropdown.css.ts.vanilla.css?source=#H4sIAAAAAAAAA9VVYWvbMBD9nl8hAoMEomC3XbcpFMq2f1HKOFvnRETWmdM5aTr634dlp03ahnZjH7ZPlji9d-_eneTrNe4qhhqj-pGHEC93MVM_R0plH9JHKWqgdLIzKlukvTCEWBHXRsUSPE6y-ZdP0y72MFIqz14C8xPAfEA9jK5fqshPqHiL7HUJ79D-MJrvc5_dWBDQvL7tF1FA8Gpceopox7eJvCEXBFnjBoNEowIFXBySnKdjtEGuPG31zihohbpcsWTyvgDWW2dl9RrWGL3FYu1EPx5OdNbFxsPuFcjFoCo6cRSMYvQgboOLAxFGrZy1GI6BxhRYEWMiKCkIBjFqPF4c8UERybeS-ISawVKPlQxLdsvVfr3CfnPxubnr9gWU6yVTG6xR3gUE1ksG6zDIREgVJEL1TG2AJ1rzWpfkiaOmBsN3psbSNnx9pPjWBaezvpkNMAaZLk525PkQJNS-Ju9V_jGroyrbwpW6wHuHPMnm5zOVzVQ2zy5nqh-se-2Cxbs0f8fmQSXI7_eur_Wv2ifU_Jfe9ZerAotaqLkaC7c4vj0ax8NrfwLaG_qEfurHCfBlCv5RLYcsZgVxcgPsQFsXofBo9yKmZtVduZTnsHcuOHHgO0_KliNxZ7Ro8J62aDv66xqtAzVpGCvkqBltW6LVNfVKA-k-hKHEaUrw1qvVDcLwZikFwdXQUWnbMvScqfLFs7C42oWlrtpQ9qeeOXMxOHO2b_IhuHLe65osGlURb4HtC_4ANZqnX87-7f6tJ_ifLScf_ii_AJ3ZdB5dBwAA */
16784
+ @keyframes _1nns6ys0 {
16785
+ 0% {
16786
+ opacity: 0;
16787
+ transform: scale(0.97);
16788
+ }
16789
+ 100% {
16790
+ opacity: 1;
16791
+ transform: scale(1);
16792
+ }
16793
+ }
16794
+ @keyframes _1nns6ys1 {
16795
+ 0% {
16796
+ opacity: 1;
16797
+ transform: scale(1);
16798
+ }
16799
+ 100% {
16800
+ opacity: 0;
16801
+ transform: scale(0.97);
16802
+ }
16803
+ }
16804
+ ._1nns6ys2[data-rk][data-state=closed] {
16805
+ pointer-events: none;
16806
+ }
16807
+ [data-rk] ._1nns6ys3 {
16785
16808
  overflow-y: auto;
16786
16809
  scrollbar-width: none;
16787
16810
  }
16788
- [data-rk] ._1nns6ys0::-webkit-scrollbar {
16811
+ [data-rk] ._1nns6ys3::-webkit-scrollbar {
16789
16812
  display: none;
16790
16813
  }
16791
- [data-rk] ._1nns6ys1 {
16814
+ [data-rk] ._1nns6ys4 {
16792
16815
  position: relative;
16793
16816
  overflow: hidden;
16794
16817
  }
16795
- [data-rk] ._1nns6ys1::before {
16818
+ [data-rk] ._1nns6ys4::before {
16796
16819
  content: "";
16797
16820
  position: absolute;
16798
16821
  top: 0;
@@ -16809,7 +16832,7 @@
16809
16832
  transition: all 150ms cubic-bezier(0.3, 0, 0.06, 1);
16810
16833
  z-index: 1;
16811
16834
  }
16812
- [data-rk] ._1nns6ys1::after {
16835
+ [data-rk] ._1nns6ys4::after {
16813
16836
  content: "";
16814
16837
  position: absolute;
16815
16838
  bottom: 0;
@@ -16826,48 +16849,33 @@
16826
16849
  transition: all 150ms cubic-bezier(0.3, 0, 0.06, 1);
16827
16850
  z-index: 1;
16828
16851
  }
16829
- [data-rk] ._1nns6ys1[data-fade-top=true]::before {
16852
+ [data-rk] ._1nns6ys4[data-fade-top=true]::before {
16830
16853
  opacity: 1;
16831
16854
  }
16832
- [data-rk] ._1nns6ys1[data-fade-bottom=true]::after {
16855
+ [data-rk] ._1nns6ys4[data-fade-bottom=true]::after {
16833
16856
  opacity: 1;
16834
16857
  }
16835
- [data-rk] ._1nns6ys3 {
16858
+ [data-rk] ._1nns6ys6 {
16836
16859
  transition: all 150ms cubic-bezier(0.3, 0, 0.06, 1);
16837
16860
  }
16838
- [data-rk] ._1nns6ys3:has([aria-disabled=true]):hover {
16861
+ [data-rk] ._1nns6ys6:has([aria-disabled=true]):hover {
16839
16862
  background: initial;
16840
16863
  cursor: not-allowed;
16841
16864
  }
16842
-
16843
- /* src/components/Dropdown/BaseDropdownAnimation.css */
16844
- @keyframes funkit-dropdown-fade-in {
16845
- 0% {
16846
- opacity: 0;
16847
- transform: scale(0.97);
16848
- }
16849
- 100% {
16850
- opacity: 1;
16851
- transform: scale(1);
16852
- }
16853
- }
16854
- @keyframes funkit-dropdown-fade-out {
16855
- 0% {
16856
- opacity: 1;
16857
- transform: scale(1);
16865
+ @media (prefers-reduced-motion: no-preference) {
16866
+ ._1nns6ys2[data-rk][data-state=open] {
16867
+ animation-duration: 150ms;
16868
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
16869
+ animation-fill-mode: forwards;
16870
+ animation-name: _1nns6ys0;
16858
16871
  }
16859
- 100% {
16860
- opacity: 0;
16861
- transform: scale(0.97);
16872
+ ._1nns6ys2[data-rk][data-state=closed] {
16873
+ animation-duration: 150ms;
16874
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
16875
+ animation-fill-mode: forwards;
16876
+ animation-name: _1nns6ys1;
16862
16877
  }
16863
16878
  }
16864
- .funkit-dropdown-content[data-state=open] {
16865
- animation: funkit-dropdown-fade-in 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
16866
- }
16867
- .funkit-dropdown-content[data-state=closed] {
16868
- animation: funkit-dropdown-fade-out 150ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
16869
- pointer-events: none;
16870
- }
16871
16879
 
16872
16880
  /* vanilla-extract-css-ns:src/components/Dropdown/BaseDropdownItem.css.ts.vanilla.css?source=Ll8xOGhodzNrMSB7CiAgY3Vyc29yOiBwb2ludGVyOwp9Ci5fMThoaHczazMgewogIGN1cnNvcjogbm90LWFsbG93ZWQ7CiAgb3BhY2l0eTogMC41Owp9 */
16873
16881
  [data-rk] ._18hhw3k1 {
@@ -106,37 +106,6 @@ export interface LighterSecureWithdrawalConfig {
106
106
  */
107
107
  onBeforeSign?: () => Promise<void> | void;
108
108
  }
109
- /**
110
- * Records a Lighter Secure withdrawal in Fun's direct-execution table as
111
- * `EXTERNALLY_FULFILLED` — tracking-only, since Fun is not in the execution
112
- * path. The row is keyed off the L2 tx hash and exists purely for attribution
113
- * and support tooling; the backend writes a one-time terminal `listenerInfo`
114
- * and never polls for L1 settlement (see EXTERNALLY_FULFILLED design doc).
115
- *
116
- * Fire-and-forget: callers should not await this, and any failure here must
117
- * not block the withdrawal success UI. Failures log at warn/error and return.
118
- */
119
- export declare function trackLighterSecureWithdrawal({ apiKey, userId, txHash, recipientAddr, assetIndex, mainnetTokenAddress, amountTokenUnits, withdrawalUSD, }: {
120
- apiKey: string;
121
- userId: string;
122
- txHash: string;
123
- recipientAddr: Address;
124
- /**
125
- * Lighter L2 asset index. Used as `fromTokenAddress`
126
- * (`pad(toHex(assetIndex))`) and to resolve symbol + mainnet decimals from
127
- * {@link LIGHTER_SECURE_ASSETS_BY_INDEX}.
128
- */
129
- assetIndex: number;
130
- /** Mainnet ERC-20 address the L2 asset bridges to (resolved by the modal). */
131
- mainnetTokenAddress: Address;
132
- /** User-input amount in token units (e.g. "1.5" for 1.5 ETH). */
133
- amountTokenUnits: string;
134
- /**
135
- * USD value of the withdrawal as computed by the modal (token amount × live
136
- * spot price). Avoids a separate spot-price round-trip from this helper.
137
- */
138
- withdrawalUSD: string;
139
- }): Promise<void>;
140
109
  /** Single-method config for Lighter's Secure withdrawal (bridge to Ethereum). */
141
110
  export declare function createLighterSecureWithdrawalConfig(config: LighterSecureWithdrawalConfig): CustomWithdrawalConfig;
142
111
  /**
@@ -28,17 +28,11 @@ import {
28
28
  } from "./chunk-AHYOV7AV.js";
29
29
 
30
30
  // src/clients/lighter.tsx
31
- import {
32
- DirectExecutionType as DirectExecutionType2,
33
- LIGHTERXYZ_API_KEY,
34
- createDirectExecution as createDirectExecution2
35
- } from "@funkit/api-base";
36
- import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
31
+ import { LIGHTERXYZ_API_KEY } from "@funkit/api-base";
32
+ import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
37
33
  import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
38
34
  import i18next from "i18next";
39
35
  import React4, { useMemo as useMemo2 } from "react";
40
- import { v4 as uuid2 } from "uuid";
41
- import { pad as pad2, parseUnits as parseUnits2, toHex } from "viem";
42
36
  import { arbitrum, base, bsc, mainnet as mainnet2, optimism } from "viem/chains";
43
37
 
44
38
  // src/components/ChainIcon/ChainIcon.tsx
@@ -158,12 +152,10 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React2.createElement(
158
152
  import {
159
153
  LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS as LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS2,
160
154
  LIGHTER_FAST_MAX_WITHDRAWAL_USD as LIGHTER_FAST_MAX_WITHDRAWAL_USD2,
161
- LIGHTER_SECURE_ASSETS_BY_INDEX as LIGHTER_SECURE_ASSETS_BY_INDEX2,
162
155
  LIGHTER_USDC_SPOT_SYMBOL as LIGHTER_USDC_SPOT_SYMBOL2,
163
- getLighterBaseSymbol as getLighterBaseSymbol3
164
- } from "@funkit/connect-core/clients/lighter";
165
- import {
156
+ getLighterBaseSymbol as getLighterBaseSymbol3,
166
157
  createLighterAdaptedWallet,
158
+ trackLighterSecureWithdrawal,
167
159
  useLighterWithdrawalDelaySeconds
168
160
  } from "@funkit/connect-core/clients/lighter";
169
161
 
@@ -216,40 +208,35 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
216
208
  }
217
209
 
218
210
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
211
+ import { useLogOnce } from "@funkit/connect-core";
219
212
  import {
220
213
  LIGHTER_ROUTE_TYPE,
221
- LIGHTER_STAKING_POOL_INDEX,
222
214
  buildLighterL1WithdrawTransaction,
223
- findLighterStakingShare,
224
215
  getLighterBaseSymbol,
225
216
  isLighterWithdrawalRateLimitError,
226
217
  lighterWithdrawBaseUnits,
227
- resolveLighterSharePrice,
228
- resolveLighterUnstakedFeeTokens,
229
218
  resolveLighterWithdrawalExplorerUrl,
230
- truncateToDecimals
219
+ truncateToDecimals,
220
+ useLighterFastUnstakedFeeTokens
231
221
  } from "@funkit/connect-core/clients/lighter";
232
222
  import {
233
223
  LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
234
224
  LIGHTER_FAST_MAX_WITHDRAWAL_USD,
235
225
  LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE2,
236
226
  LIGHTER_SECURE_ASSETS_BY_INDEX,
237
- LIGHTER_STAKING_POOL_INDEX as LIGHTER_STAKING_POOL_INDEX2,
227
+ LIGHTER_STAKING_POOL_INDEX,
238
228
  LIGHTER_STAKING_THRESHOLD_LIT,
239
229
  LIGHTER_UNSTAKED_FEE_TOKENS,
240
230
  LIGHTER_USDC_SPOT_SYMBOL,
241
231
  getLighterBaseSymbol as getLighterBaseSymbol2,
242
232
  getLighterSecureMainnetAddress,
243
233
  resolveLighterAssetIndex,
244
- resolveLighterSecureRouteType,
245
- resolveLighterSharePrice as resolveLighterSharePrice2,
246
- resolveLighterUnstakedFeeTokens as resolveLighterUnstakedFeeTokens2
234
+ resolveLighterSecureRouteType
247
235
  } from "@funkit/connect-core/clients/lighter";
248
236
  var LIGHTER_FAST_METHOD_ID = "lighter-fast";
249
237
  var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
250
238
 
251
239
  // src/clients/lighter.tsx
252
- import { truncateToDecimals as truncateToDecimals2 } from "@funkit/connect-core/clients/lighter";
253
240
  import { LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE3 } from "@funkit/connect-core/clients/lighter";
254
241
  import {
255
242
  LIGHTER_WITHDRAW_ABI,
@@ -274,78 +261,6 @@ function useLighterSecureDelayText() {
274
261
  true
275
262
  );
276
263
  }
277
- async function trackLighterSecureWithdrawal({
278
- apiKey,
279
- userId,
280
- txHash,
281
- recipientAddr,
282
- assetIndex,
283
- mainnetTokenAddress,
284
- amountTokenUnits,
285
- withdrawalUSD
286
- }) {
287
- const assetMeta = LIGHTER_SECURE_ASSETS_BY_INDEX2[assetIndex];
288
- if (!assetMeta) {
289
- logger.error(
290
- "lighter:withdrawal:secure:tracking:unknownAssetIndex",
291
- new Error(`Unknown Lighter Secure asset index: ${assetIndex}`),
292
- { assetIndex, txHash }
293
- );
294
- return;
295
- }
296
- const { symbol, decimals } = assetMeta;
297
- const estTotalUsd = Number(withdrawalUSD);
298
- const safeAmount = truncateToDecimals2(amountTokenUnits, decimals);
299
- const baseUnitAmount = parseUnits2(safeAmount, decimals).toString();
300
- const fromTokenAddress = pad2(toHex(assetIndex), { size: 20 });
301
- await createDirectExecution2({
302
- apiKey,
303
- logger,
304
- // Lighter L2 tx hashes are not 0x-prefixed EVM hashes — they're the L2's
305
- // own format. We cast here for convenience to satisfy the DE row type;
306
- // the backend stores the literal string and we never use it as an EVM hash.
307
- txHash,
308
- type: DirectExecutionType2.EXTERNALLY_FULFILLED,
309
- userId,
310
- recipientAddr,
311
- fromChainId: LIGHTER_CHAIN_ID.toString(),
312
- fromTokenAddress,
313
- toChainId: mainnet2.id.toString(),
314
- toTokenAddress: mainnetTokenAddress,
315
- fromAmountBaseUnit: baseUnitAmount,
316
- toAmountBaseUnit: baseUnitAmount,
317
- estTotalUsd,
318
- // Secure withdrawals come out of the user's Lighter account balance; the
319
- // L1 owner of that account is the recipient (Secure locks to connected wallet).
320
- sourceOfFund: `balance|lighter-secure|${recipientAddr}`,
321
- clientMetadata: {
322
- id: uuid2(),
323
- startTimestampMs: Date.now(),
324
- finalDollarValue: estTotalUsd,
325
- latestQuote: null,
326
- depositAddress: null,
327
- initSettings: {
328
- config: {
329
- targetAsset: mainnetTokenAddress,
330
- targetChain: mainnet2.id.toString(),
331
- targetAssetTicker: symbol
332
- }
333
- },
334
- selectedSourceAssetInfo: {
335
- address: fromTokenAddress,
336
- symbol,
337
- chainId: LIGHTER_CHAIN_ID.toString(),
338
- iconSrc: null
339
- },
340
- selectedPaymentMethodInfo: {
341
- paymentMethod: "LIGHTER_SECURE_WITHDRAWAL",
342
- title: "",
343
- description: ""
344
- },
345
- isWithdrawal: true
346
- }
347
- });
348
- }
349
264
  function buildSecureWithdrawalCallback({
350
265
  exec
351
266
  }) {
@@ -391,6 +306,7 @@ function buildSecureWithdrawalCallback({
391
306
  });
392
307
  void trackLighterSecureWithdrawal({
393
308
  apiKey: LIGHTERXYZ_API_KEY,
309
+ logger,
394
310
  // Secure locks the destination to the connected wallet, so the L1
395
311
  // recipient address doubles as the userId for tracking purposes.
396
312
  userId: destinationAddress,
@@ -400,13 +316,6 @@ function buildSecureWithdrawalCallback({
400
316
  mainnetTokenAddress: targetAssetAddress,
401
317
  amountTokenUnits,
402
318
  withdrawalUSD
403
- }).catch((err) => {
404
- logger.warn("lighter:withdrawal:secure:trackingFailed", {
405
- error: err instanceof Error ? err.message : String(err),
406
- txHash,
407
- assetIndex,
408
- amountTokenUnits
409
- });
410
319
  });
411
320
  return txHash;
412
321
  };
@@ -627,6 +536,5 @@ export {
627
536
  createLighterSecureWithdrawalConfig,
628
537
  isLighterWithdrawalRateLimitError2 as isLighterWithdrawalRateLimitError,
629
538
  lighterWithdrawBaseUnits2 as lighterWithdrawBaseUnits,
630
- trackLighterSecureWithdrawal,
631
539
  useLighterWithdrawalConfig
632
540
  };
@@ -52,6 +52,8 @@ export interface NadoWithdrawalOptions {
52
52
  * sequencer fee, which Nado charges per asset, not per dollar.
53
53
  */
54
54
  getMinWithdrawalAmount?: (symbol: string) => number;
55
+ /** Initial state of the borrow (spot leverage) toggle */
56
+ defaultSpotLeverage?: boolean;
55
57
  }
56
58
  /**
57
59
  * Withdrawal config for a Nado subaccount, or `null` while one can't be built —
@@ -64,4 +66,4 @@ export interface NadoWithdrawalOptions {
64
66
  */
65
67
  export declare function useNadoWithdrawalConfig(options: NadoWithdrawalOptions | null): NadoWithdrawalConfig | null;
66
68
  export type { NadoWithdrawalConfig } from './internal/nado/withdrawalConfig';
67
- export type { NadoWithdrawalCustomerConfig, NadoWithdrawalCustomerData, } from './internal/nado/withdrawalTypes';
69
+ export type { NadoWithdrawalCustomerConfig, NadoWithdrawalCustomerData, } from '@funkit/connect-core/clients/nado';
@@ -1,23 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createNadoWithdrawalCallback
4
- } from "./chunk-46L2KJJ4.js";
5
- import "./chunk-2576N7PQ.js";
6
- import "./chunk-VIAEAD75.js";
7
- import "./chunk-63XTVHO3.js";
4
+ } from "./chunk-UMU5S2WF.js";
5
+ import "./chunk-MSLPLXR2.js";
8
6
  import {
9
7
  resolveNadoSubaccount
10
- } from "./chunk-QQEGNLGD.js";
11
- import "./chunk-DGBIV3ZS.js";
12
- import "./chunk-6T6URLBM.js";
13
- import "./chunk-TZGKB6WY.js";
14
- import {
15
- INK_CHAIN_ID
16
- } from "./chunk-3P2C436B.js";
17
- import "./chunk-WZRW6WUM.js";
18
- import "./chunk-Z7HTQFEO.js";
8
+ } from "./chunk-TYG42JRZ.js";
9
+ import "./chunk-B7UU2ETA.js";
19
10
  import "./chunk-OODIKHYE.js";
20
- import "./chunk-PENJ5JGH.js";
21
11
  import {
22
12
  useAccount,
23
13
  useConfig
@@ -25,10 +15,12 @@ import {
25
15
  import {
26
16
  i18n_default
27
17
  } from "./chunk-C45VNQXY.js";
18
+ import "./chunk-PENJ5JGH.js";
28
19
  import "./chunk-AHYOV7AV.js";
29
20
 
30
21
  // src/clients/nado.tsx
31
22
  import { useMemo } from "react";
23
+ import { INK_CHAIN_ID } from "@funkit/connect-core/clients/nado";
32
24
  function useNadoWithdrawalConfig(options) {
33
25
  const { address: walletAddress } = useAccount();
34
26
  const wagmiConfig = useConfig();
@@ -65,7 +57,8 @@ function useNadoWithdrawalConfig(options) {
65
57
  getMaxWithdrawalUSD: options.getMaxWithdrawalUSD,
66
58
  getMinWithdrawalAmount: options.getMinWithdrawalAmount,
67
59
  withdrawCallback,
68
- customerConfig: { customerName: "nado", walletAddress, subaccount }
60
+ customerConfig: { customerName: "nado", walletAddress, subaccount },
61
+ defaultSpotLeverage: options.defaultSpotLeverage
69
62
  };
70
63
  }
71
64
  export {