@funkit/connect 10.5.0 → 11.0.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 (97) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/clients/chunk-2FSEE3AW.js +277 -0
  3. package/dist/clients/chunk-5MY7WMEJ.js +20 -0
  4. package/dist/clients/chunk-6CYZKITE.js +33 -0
  5. package/dist/clients/{chunk-QHS5N7GP.js → chunk-C4SHJFOV.js} +2 -2
  6. package/dist/clients/{chunk-WRS7AFM2.js → chunk-FNB7OPJI.js} +12 -199
  7. package/dist/clients/{chunk-2NBYHUIW.js → chunk-HZP4DXIZ.js} +1 -0
  8. package/dist/clients/{chunk-F6P4CN27.js → chunk-JD2J5K6S.js} +16 -8
  9. package/dist/clients/chunk-LT4EWLDA.js +30 -0
  10. package/dist/clients/chunk-MGQLVTSH.js +100 -0
  11. package/dist/clients/{chunk-FJ6GCMJ4.js → chunk-OODIKHYE.js} +3 -1
  12. package/dist/clients/chunk-SFDEST63.js +18 -0
  13. package/dist/clients/{chunk-OZ3KD24N.js → chunk-ZCCLJW6F.js} +0 -8
  14. package/dist/clients/fanatics.js +5 -6
  15. package/dist/clients/internal/nado/encoding.js +4 -25
  16. package/dist/clients/internal/nado/gateway.d.ts +0 -21
  17. package/dist/clients/internal/nado/gateway.js +1 -5
  18. package/dist/clients/internal/nado/hooks.d.ts +0 -158
  19. package/dist/clients/internal/nado/hooks.js +10 -121
  20. package/dist/clients/internal/nado/withdrawalConfig.js +3 -12
  21. package/dist/clients/internal/nado/withdrawalForm.css +17529 -0
  22. package/dist/clients/internal/nado/withdrawalForm.d.ts +41 -0
  23. package/dist/clients/internal/nado/withdrawalForm.js +283 -0
  24. package/dist/clients/internal/nado/withdrawalTypes.d.ts +7 -2
  25. package/dist/clients/lighter.css +5 -1
  26. package/dist/clients/lighter.d.ts +29 -1
  27. package/dist/clients/lighter.js +105 -100
  28. package/dist/clients/mallard.js +24 -3
  29. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +5 -1
  30. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -3
  31. package/dist/clients/polymarket/index.css +5 -1
  32. package/dist/clients/polymarket/index.js +6 -3
  33. package/dist/components/BottomLinks/BottomLinks.d.ts +3 -1
  34. package/dist/consts/meld.d.ts +1 -1
  35. package/dist/domains/swapped.d.ts +1 -10
  36. package/dist/hooks/queries/useSwappedDefaultCurrency.d.ts +3 -3
  37. package/dist/hooks/queries/useWithdrawFops.d.ts +0 -1
  38. package/dist/hooks/track/useTrack.d.ts +1 -0
  39. package/dist/hooks/useTokenAndChainDropdown.d.ts +8 -1
  40. package/dist/index.css +5 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +2325 -1552
  43. package/dist/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.d.ts +1 -2
  44. package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +6 -9
  45. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +54 -48
  46. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +5 -9
  47. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +1 -61
  48. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +53 -0
  49. package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +38 -0
  50. package/dist/providers/FunkitCheckoutContext/types.d.ts +61 -4
  51. package/dist/providers/FunkitConfigContext.d.ts +2 -2
  52. package/dist/utils/consts.d.ts +1 -1
  53. package/dist/utils/customer.d.ts +367 -3
  54. package/dist/utils/withdrawal.d.ts +19 -6
  55. package/dist/wagmi/actions.d.ts +1 -1
  56. package/dist/wallets/Wallet.d.ts +21 -1
  57. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  58. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  59. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  60. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  61. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  62. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  63. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  64. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  65. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  66. package/dist/wallets/walletConnectors/index.js +34 -34
  67. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  68. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  69. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  70. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  71. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  72. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  73. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  74. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  75. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  76. package/package.json +3 -3
  77. package/dist/clients/chunk-A4WQS6QG.js +0 -207
  78. package/dist/clients/internal/nado/products.d.ts +0 -36
  79. package/dist/clients/internal/nado/products.js +0 -19
  80. package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
  81. package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
  82. package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
  83. package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
  84. package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
  85. package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
  86. package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
  87. package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
  88. package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
  89. package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
  90. package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
  91. package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
  92. package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
  93. package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
  94. package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
  95. package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
  96. package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
  97. package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 11.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 40b25c4: Lighter withdrawal balances are now supplied by the integrator via `withdrawalSourceTokenBalance` instead of derived by the SDK
8
+
9
+ Migration: pass `withdrawalSourceTokenBalance` to `useLighterWithdrawalConfig`. It receives `{ sourceAsset, customData }` — `sourceAsset.tokenAddress` is the L2 asset index padded into an address, and `customData.routeType` (`LIGHTER_ROUTE_TYPE`) separates perps collateral from spot. Without it the withdrawal amount field reads 0. The selectable source-token list is unchanged and still built by the SDK.
10
+
11
+ ### Minor Changes
12
+
13
+ - 080f00c: Support gasless (permit / EIP-3009) relay signature steps in the withdrawal flow via new optional `WithdrawalClient.signTypedData` / `signMessage`.
14
+ - be54ad3: `withdrawalSourceTokenBalance` now takes precedence over the SDK's own balance for the withdrawal amount field
15
+ - cec0c75: Withdrawal source token options can now carry `decimals` and flow-specific `customData`, so Nado's products are declared on the config instead of fetched by the SDK
16
+ - efc8ef7: Add the Nado withdrawal enter-amount flow to the withdrawal modal.
17
+ - 23a3be4: Withdrawal configs can declare selectable source tokens via `sourceTokens`, so any integrator can offer a source-token dropdown
18
+ - d255ff4: `withdrawalSourceTokenBalance` now receives the source asset it is being asked about, plus flow-specific data identifying Lighter spot vs perps balances
19
+
20
+ ### Patch Changes
21
+
22
+ - 1000acb: feat(connect): add Lightning chain to Transfer Crypto dropdown
23
+ - df4e7d8: fix: treat Bitcoin, Lightning and HyperCore consistently as non-EVM chains across web and RN
24
+ - 4235f2f: refactor(connect-core): share the Swapped `thirdPartyPaymentConfigs` builder across platforms
25
+ - Updated dependencies [df4e7d8]
26
+ - Updated dependencies [4235f2f]
27
+ - @funkit/chains@2.2.0
28
+ - @funkit/connect-core@2.4.0
29
+
30
+ ## 10.6.0
31
+
32
+ ### Minor Changes
33
+
34
+ - 287661f: Remove the token amount shown below the USD value on the checkout confirmation screen; `uiCustomizations.confirmationScreen.showTokenAmount` is now deprecated and ignored (still accepted, so existing configs keep type-checking).
35
+
36
+ ### Patch Changes
37
+
38
+ - b884a6e: Add an internal `logEventV2` tracking seam on `useTrack`.
39
+ - 37829e2: Centralize deposit-side min/max amount math in `@funkit/connect-core`.
40
+ - 8fce60a: Centralize withdrawal-side amount validation and Swapped sell limits in `@funkit/connect-core`.
41
+ - 1584cf7: Prevent the checkout widget from crashing while minimum-transfer settings are loading.
42
+ - 41b30e3: Hide the transaction breakdown row in the withdrawal modal for Lighter Secure withdrawals — it never had fee data to show and always displayed a static "-".
43
+ - ee44046: Add `disable-krw-default-currency` feature gate: when enabled, KRW is never auto-selected as the default fiat currency (USD is used instead)
44
+ - 1cafe22: Waive the Lighter Fast withdrawal fee for users staked at exactly the 100 minimum
45
+ - f637eba: Waive the Lighter Fast withdrawal fee based on a user's current stake value rather than their original deposit
46
+ - 14fb929: Fix modal layout on host pages that ship no CSS reset by normalizing replaced elements inside the modal.
47
+ - 9b285ea: fix(connect-core): require https when validating Swapped embed origins.
48
+ - 7bdb625: chore(connect): update transfer crypto font sizes
49
+ - b52e1bc: Show a spinner on the Withdraw button while the quote is being calculated (ENG-4687)
50
+ - eebb307: Internal refactor of the withdrawal form's submit wiring — no behavior change.
51
+ - 4ecaec6: Internal refactor of the withdrawal form's source balance, price and fee wiring — no behavior change.
52
+ - 58a964f: Internal refactor of the withdrawal form's hook structure — no behavior change.
53
+ - 1dae391: Internal restructuring of the withdrawal amount form — no behavior change.
54
+ - b94cfa8: Internal restructuring of the withdrawal amount form — no behavior change.
55
+ - f1f3cb8: Internal restructuring of the withdrawal amount form — no behavior change.
56
+ - d951292: Internal restructuring of the withdrawal amount form — no behavior change.
57
+ - 674bef3: Fix spurious withdrawal quotes: no more zero-amount quote errors after entering an amount or switching the destination chain, and clearing the amount input no longer refires the previous quote.
58
+ - Updated dependencies [37829e2]
59
+ - Updated dependencies [8fce60a]
60
+ - Updated dependencies [1584cf7]
61
+ - Updated dependencies [ee44046]
62
+ - Updated dependencies [9b285ea]
63
+ - @funkit/connect-core@2.3.0
64
+
3
65
  ## 10.5.0
4
66
 
5
67
  ### Minor Changes
@@ -0,0 +1,277 @@
1
+ "use client";
2
+ import {
3
+ useFunkitTranslation
4
+ } from "./chunk-JD2J5K6S.js";
5
+
6
+ // src/utils/customer.ts
7
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
8
+ import { useCallback } from "react";
9
+
10
+ // src/providers/FunkitConfigContext.tsx
11
+ import {
12
+ createContext,
13
+ useContext,
14
+ useMemo
15
+ } from "react";
16
+ var DEFAULT_TEXT_CUSTOMIZATIONS = {
17
+ virtualFiat: "Deposit with SEPA",
18
+ brokerageOrExchange: "Connect Exchange",
19
+ debitOrCredit: "Deposit with Card",
20
+ accountBalance: "Wallet",
21
+ selectAccount: "Select an exchange",
22
+ perpsTransferTitle: "Transfer",
23
+ sourceMethodTitle: "Your source",
24
+ tokensListTitle: "Your tokens",
25
+ transferTokens: "Transfer Crypto",
26
+ bitcoinLightning: "Bitcoin Lightning",
27
+ cashAppLightning: "Cash App",
28
+ receiveDropdownTitle: "",
29
+ // Default to empty
30
+ receiveDropdownLabel: "Asset to Receive",
31
+ confirmationScreen: {
32
+ payAmountLabel: "You send",
33
+ receiveAmountLabel: "You receive"
34
+ },
35
+ paymentMethodSubtitles: {}
36
+ };
37
+ var DEFAULT_UI_CUSTOMIZATIONS = {
38
+ alignTitle: "center",
39
+ alwaysShowTopDivider: false,
40
+ showModalTitle: true,
41
+ callToActionsUppercase: false,
42
+ enableCompactList: false,
43
+ checkoutHistory: {
44
+ showGetHelpAsAlert: true,
45
+ simplifiedUi: false
46
+ },
47
+ confirmationScreen: {
48
+ autoExpandFeesSummary: false,
49
+ preferDestinationWhenSame: false,
50
+ showAmountSummaryAbovePaymentMethod: false,
51
+ showDisclaimerAsAlert: true,
52
+ showInstantTimeEstimate: false,
53
+ showLeftAlignedDollarValueWithLabel: false,
54
+ showPaymentAmountUsd: false,
55
+ showReceiveAmountUsd: false,
56
+ showSelectedRoute: false,
57
+ stepIndicatorType: "spinner",
58
+ showTransactionDigest: "none"
59
+ },
60
+ sourceChangeScreen: {
61
+ bottomBarCloseButton: {
62
+ enabled: false,
63
+ labelKey: "common.close"
64
+ },
65
+ showTargetAssetSelection: false,
66
+ showWalletOnInsufficientBalance: false,
67
+ showWalletConnect: true,
68
+ showCustomTopComponentDivider: false,
69
+ paymentMethodIcons: {}
70
+ },
71
+ inputAmountScreen: {
72
+ allowTokenAmountInput: true
73
+ },
74
+ selectAssetScreen: {
75
+ isSecondaryTokenSymbolVisible: true,
76
+ navigateOnAssetClick: false
77
+ },
78
+ transferCryptoScreen: {
79
+ showYouSendYouReceive: false
80
+ },
81
+ withdrawalScreen: {
82
+ autoExpandFeesSummary: false
83
+ },
84
+ selectBrokerageScreen: {},
85
+ connectExchangeScreen: {},
86
+ customIcons: {},
87
+ customFontFamily: {
88
+ primary: "",
89
+ secondary: "",
90
+ tertiary: ""
91
+ }
92
+ };
93
+ var DEFAULT_FUNKIT_CONFIG = {
94
+ apiKey: "",
95
+ appName: "",
96
+ textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
97
+ uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
98
+ };
99
+ var FunkitConfigContext = createContext(
100
+ DEFAULT_FUNKIT_CONFIG
101
+ );
102
+ function useFunkitConfig() {
103
+ const originalFunkitConfig = useContext(FunkitConfigContext);
104
+ const { t } = useFunkitTranslation();
105
+ const translatedDefaults = useMemo(() => {
106
+ return {
107
+ virtualFiat: t("textCustomizations.virtualFiat"),
108
+ brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
109
+ debitOrCredit: t("textCustomizations.debitOrCredit"),
110
+ accountBalance: t("textCustomizations.accountBalance"),
111
+ selectAccount: t("textCustomizations.selectAccount"),
112
+ perpsTransferTitle: t("perpsTransfer.title"),
113
+ sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
114
+ tokensListTitle: t("textCustomizations.tokensListTitle"),
115
+ transferTokens: t("textCustomizations.transferTokens"),
116
+ bitcoinLightning: t("textCustomizations.bitcoinLightning"),
117
+ cashAppLightning: t("textCustomizations.cashAppLightning"),
118
+ receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
119
+ receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
120
+ confirmationScreen: {
121
+ payAmountLabel: t("textCustomizations.payAmountLabel"),
122
+ receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
123
+ },
124
+ paymentMethodSubtitles: {}
125
+ };
126
+ }, [t]);
127
+ const finalFunkitConfig = useMemo(() => {
128
+ return {
129
+ ...DEFAULT_FUNKIT_CONFIG,
130
+ ...originalFunkitConfig,
131
+ textCustomizations: {
132
+ ...translatedDefaults,
133
+ ...originalFunkitConfig.textCustomizations,
134
+ confirmationScreen: {
135
+ ...translatedDefaults.confirmationScreen,
136
+ ...originalFunkitConfig.textCustomizations?.confirmationScreen
137
+ },
138
+ paymentMethodSubtitles: {
139
+ ...translatedDefaults.paymentMethodSubtitles,
140
+ ...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
141
+ }
142
+ },
143
+ uiCustomizations: {
144
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
145
+ ...originalFunkitConfig.uiCustomizations,
146
+ checkoutHistory: {
147
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
148
+ ...originalFunkitConfig.uiCustomizations?.checkoutHistory
149
+ },
150
+ confirmationScreen: {
151
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
152
+ ...originalFunkitConfig.uiCustomizations?.confirmationScreen
153
+ },
154
+ connectExchangeScreen: {
155
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
156
+ ...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
157
+ },
158
+ inputAmountScreen: {
159
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
160
+ ...originalFunkitConfig.uiCustomizations?.inputAmountScreen
161
+ },
162
+ selectAssetScreen: {
163
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
164
+ ...originalFunkitConfig.uiCustomizations?.selectAssetScreen
165
+ },
166
+ selectBrokerageScreen: {
167
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
168
+ ...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
169
+ },
170
+ sourceChangeScreen: {
171
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
172
+ ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
173
+ bottomBarCloseButton: {
174
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
175
+ ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
176
+ }
177
+ },
178
+ transferCryptoScreen: {
179
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
180
+ ...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
181
+ },
182
+ withdrawalScreen: {
183
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
184
+ ...originalFunkitConfig.uiCustomizations?.withdrawalScreen
185
+ }
186
+ }
187
+ };
188
+ }, [originalFunkitConfig, translatedDefaults]);
189
+ return finalFunkitConfig;
190
+ }
191
+
192
+ // src/utils/customer.ts
193
+ var LIGHTER_MAIN_ACCOUNT_TYPE = 0;
194
+ var LIGHTER_TRADING_MODE = {
195
+ SIMPLE: 0,
196
+ UNIFIED: 1
197
+ };
198
+ async function getLighterAccountsByL1Address(address) {
199
+ const response = await fetch(
200
+ `https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
201
+ );
202
+ if (!response.ok) {
203
+ throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
204
+ }
205
+ const data = await response.json();
206
+ return data;
207
+ }
208
+ async function getLighterAccount(lookup, activeOnly) {
209
+ const params = new URLSearchParams({
210
+ by: lookup.by,
211
+ value: String(lookup.value),
212
+ ...activeOnly !== void 0 && { active_only: String(activeOnly) }
213
+ });
214
+ const response = await fetch(
215
+ `https://mainnet.zklighter.elliot.ai/api/v1/account?${params}`
216
+ );
217
+ if (!response.ok) {
218
+ throw new Error(`Failed to fetch lighter account: ${response.statusText}`);
219
+ }
220
+ return response.json();
221
+ }
222
+ function useLighterAccountQuery(lookup, options) {
223
+ const enabled = lookup !== null && (lookup.by === "index" ? true : !!lookup.value && lookup.value !== "0x");
224
+ const query = useQuery({
225
+ queryKey: [
226
+ "lighterAccount",
227
+ lookup?.by,
228
+ lookup?.value,
229
+ options?.activeOnly
230
+ ],
231
+ // biome-ignore lint/style/noNonNullAssertion: already checked for null
232
+ queryFn: () => getLighterAccount(lookup, options?.activeOnly),
233
+ enabled,
234
+ // Refetch on every (re)mount so reopening the withdraw widget shows a fresh
235
+ // balance after a spot→perps transfer; 10s stale window keeps it current.
236
+ staleTime: 1e4,
237
+ refetchOnMount: "always",
238
+ retry: false
239
+ });
240
+ return {
241
+ ...query,
242
+ account: query.data?.accounts?.[0]
243
+ };
244
+ }
245
+ function useLighterAccountsQuery({
246
+ address
247
+ }) {
248
+ const enabled = !!address && address !== "0x";
249
+ const query = useQuery({
250
+ queryKey: ["lighterAccounts", address],
251
+ queryFn: () => getLighterAccountsByL1Address(address),
252
+ enabled,
253
+ staleTime: Number.POSITIVE_INFINITY,
254
+ gcTime: Number.POSITIVE_INFINITY,
255
+ retry: false,
256
+ // allows us to always refetch the data but return the previous data until the new data is fetched
257
+ refetchOnMount: "always"
258
+ });
259
+ const subAccounts = query.data?.sub_accounts;
260
+ const mainAccount = subAccounts?.find(
261
+ (account) => account.account_type === LIGHTER_MAIN_ACCOUNT_TYPE
262
+ );
263
+ return {
264
+ ...query,
265
+ mainAccountIndex: mainAccount?.index?.toString(),
266
+ // False until the accounts load — consumers fall back to the simple-mode
267
+ // UI (both USDC variants shown) while the trading mode is unknown.
268
+ isUnifiedTradingMode: mainAccount?.account_trading_mode === LIGHTER_TRADING_MODE.UNIFIED,
269
+ subAccounts
270
+ };
271
+ }
272
+
273
+ export {
274
+ useFunkitConfig,
275
+ useLighterAccountQuery,
276
+ useLighterAccountsQuery
277
+ };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ // src/consts/funkit.ts
4
+ import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/chains";
5
+ var FUN_ORG_NAME = "Fun.xyz";
6
+ var PLACEHOLDER_FUNKIT_USER_INFO = {
7
+ id: "0x",
8
+ address: "0x",
9
+ name: "Guest",
10
+ nameTruncated: "Guest",
11
+ type: "unknown",
12
+ typeLabel: "",
13
+ iconSrc: "",
14
+ isConnected: false
15
+ };
16
+
17
+ export {
18
+ FUN_ORG_NAME,
19
+ PLACEHOLDER_FUNKIT_USER_INFO
20
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ // src/clients/internal/nado/encoding.ts
4
+ import {
5
+ concatHex,
6
+ formatUnits,
7
+ pad,
8
+ stringToHex
9
+ } from "viem";
10
+ var SUBACCOUNT_NAME_BYTES = 12;
11
+ var X18_DECIMALS = 18;
12
+ function buildNadoSubaccountId(owner, name = "default") {
13
+ const nameHex = stringToHex(name);
14
+ if ((nameHex.length - 2) / 2 > SUBACCOUNT_NAME_BYTES) {
15
+ throw new Error("Nado subaccount name must be 12 bytes or fewer");
16
+ }
17
+ return concatHex([
18
+ owner,
19
+ pad(nameHex, { dir: "right", size: SUBACCOUNT_NAME_BYTES })
20
+ ]);
21
+ }
22
+ function x18ToRawBaseUnit(x18Amount, decimals) {
23
+ return BigInt(x18Amount) * 10n ** BigInt(decimals) / 10n ** BigInt(X18_DECIMALS);
24
+ }
25
+ function x18ToTokenUnits(x18Amount, decimals) {
26
+ return formatUnits(x18ToRawBaseUnit(x18Amount, decimals), decimals);
27
+ }
28
+
29
+ export {
30
+ buildNadoSubaccountId,
31
+ x18ToRawBaseUnit,
32
+ x18ToTokenUnits
33
+ };
@@ -3,7 +3,7 @@ import {
3
3
  FunInput,
4
4
  FunSkeletonBlock,
5
5
  TooltipAnchorRefContext
6
- } from "./chunk-WRS7AFM2.js";
6
+ } from "./chunk-FNB7OPJI.js";
7
7
  import {
8
8
  Box,
9
9
  Text,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-LUHEVXPD.js";
12
12
  import {
13
13
  useFunkitTranslation
14
- } from "./chunk-F6P4CN27.js";
14
+ } from "./chunk-JD2J5K6S.js";
15
15
  import {
16
16
  POLYMARKET_PERPS_ROUTING_ID,
17
17
  POLYMARKET_PREDICTIONS_ROUTING_ID
@@ -4,201 +4,15 @@ import {
4
4
  Text,
5
5
  themeVars
6
6
  } from "./chunk-LUHEVXPD.js";
7
- import {
8
- useFunkitTranslation
9
- } from "./chunk-F6P4CN27.js";
10
-
11
- // src/providers/FunkitConfigContext.tsx
12
- import {
13
- createContext,
14
- useContext,
15
- useMemo
16
- } from "react";
17
- var DEFAULT_TEXT_CUSTOMIZATIONS = {
18
- virtualFiat: "Deposit with SEPA",
19
- brokerageOrExchange: "Connect Exchange",
20
- debitOrCredit: "Deposit with Card",
21
- accountBalance: "Wallet",
22
- selectAccount: "Select an exchange",
23
- perpsTransferTitle: "Transfer",
24
- sourceMethodTitle: "Your source",
25
- tokensListTitle: "Your tokens",
26
- transferTokens: "Transfer Crypto",
27
- bitcoinLightning: "Bitcoin Lightning",
28
- cashAppLightning: "Cash App",
29
- receiveDropdownTitle: "",
30
- // Default to empty
31
- receiveDropdownLabel: "Asset to Receive",
32
- confirmationScreen: {
33
- payAmountLabel: "You send",
34
- receiveAmountLabel: "You receive"
35
- },
36
- paymentMethodSubtitles: {}
37
- };
38
- var DEFAULT_UI_CUSTOMIZATIONS = {
39
- alignTitle: "center",
40
- alwaysShowTopDivider: false,
41
- showModalTitle: true,
42
- callToActionsUppercase: false,
43
- enableCompactList: false,
44
- checkoutHistory: {
45
- showGetHelpAsAlert: true,
46
- simplifiedUi: false
47
- },
48
- confirmationScreen: {
49
- autoExpandFeesSummary: false,
50
- preferDestinationWhenSame: false,
51
- showAmountSummaryAbovePaymentMethod: false,
52
- showDisclaimerAsAlert: true,
53
- showInstantTimeEstimate: false,
54
- showLeftAlignedDollarValueWithLabel: false,
55
- showPaymentAmountUsd: false,
56
- showReceiveAmountUsd: false,
57
- showSelectedRoute: false,
58
- stepIndicatorType: "spinner",
59
- showTokenAmount: true,
60
- showTransactionDigest: "none"
61
- },
62
- sourceChangeScreen: {
63
- bottomBarCloseButton: {
64
- enabled: false,
65
- labelKey: "common.close"
66
- },
67
- showTargetAssetSelection: false,
68
- showWalletOnInsufficientBalance: false,
69
- showWalletConnect: true,
70
- showCustomTopComponentDivider: false,
71
- paymentMethodIcons: {}
72
- },
73
- inputAmountScreen: {
74
- allowTokenAmountInput: true
75
- },
76
- selectAssetScreen: {
77
- isSecondaryTokenSymbolVisible: true,
78
- navigateOnAssetClick: false
79
- },
80
- transferCryptoScreen: {
81
- showYouSendYouReceive: false
82
- },
83
- withdrawalScreen: {
84
- autoExpandFeesSummary: false
85
- },
86
- selectBrokerageScreen: {},
87
- connectExchangeScreen: {},
88
- customIcons: {},
89
- customFontFamily: {
90
- primary: "",
91
- secondary: "",
92
- tertiary: ""
93
- }
94
- };
95
- var DEFAULT_FUNKIT_CONFIG = {
96
- apiKey: "",
97
- appName: "",
98
- textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
99
- uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
100
- };
101
- var FunkitConfigContext = createContext(
102
- DEFAULT_FUNKIT_CONFIG
103
- );
104
- function useFunkitConfig() {
105
- const originalFunkitConfig = useContext(FunkitConfigContext);
106
- const { t } = useFunkitTranslation();
107
- const translatedDefaults = useMemo(() => {
108
- return {
109
- virtualFiat: t("textCustomizations.virtualFiat"),
110
- brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
111
- debitOrCredit: t("textCustomizations.debitOrCredit"),
112
- accountBalance: t("textCustomizations.accountBalance"),
113
- selectAccount: t("textCustomizations.selectAccount"),
114
- perpsTransferTitle: t("perpsTransfer.title"),
115
- sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
116
- tokensListTitle: t("textCustomizations.tokensListTitle"),
117
- transferTokens: t("textCustomizations.transferTokens"),
118
- bitcoinLightning: t("textCustomizations.bitcoinLightning"),
119
- cashAppLightning: t("textCustomizations.cashAppLightning"),
120
- receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
121
- receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
122
- confirmationScreen: {
123
- payAmountLabel: t("textCustomizations.payAmountLabel"),
124
- receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
125
- },
126
- paymentMethodSubtitles: {}
127
- };
128
- }, [t]);
129
- const finalFunkitConfig = useMemo(() => {
130
- return {
131
- ...DEFAULT_FUNKIT_CONFIG,
132
- ...originalFunkitConfig,
133
- textCustomizations: {
134
- ...translatedDefaults,
135
- ...originalFunkitConfig.textCustomizations,
136
- confirmationScreen: {
137
- ...translatedDefaults.confirmationScreen,
138
- ...originalFunkitConfig.textCustomizations?.confirmationScreen
139
- },
140
- paymentMethodSubtitles: {
141
- ...translatedDefaults.paymentMethodSubtitles,
142
- ...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
143
- }
144
- },
145
- uiCustomizations: {
146
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
147
- ...originalFunkitConfig.uiCustomizations,
148
- checkoutHistory: {
149
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
150
- ...originalFunkitConfig.uiCustomizations?.checkoutHistory
151
- },
152
- confirmationScreen: {
153
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
154
- ...originalFunkitConfig.uiCustomizations?.confirmationScreen
155
- },
156
- connectExchangeScreen: {
157
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
158
- ...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
159
- },
160
- inputAmountScreen: {
161
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
162
- ...originalFunkitConfig.uiCustomizations?.inputAmountScreen
163
- },
164
- selectAssetScreen: {
165
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
166
- ...originalFunkitConfig.uiCustomizations?.selectAssetScreen
167
- },
168
- selectBrokerageScreen: {
169
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
170
- ...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
171
- },
172
- sourceChangeScreen: {
173
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
174
- ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
175
- bottomBarCloseButton: {
176
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
177
- ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
178
- }
179
- },
180
- transferCryptoScreen: {
181
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
182
- ...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
183
- },
184
- withdrawalScreen: {
185
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
186
- ...originalFunkitConfig.uiCustomizations?.withdrawalScreen
187
- }
188
- }
189
- };
190
- }, [originalFunkitConfig, translatedDefaults]);
191
- return finalFunkitConfig;
192
- }
193
7
 
194
8
  // src/components/FunTooltip/FunTooltip.tsx
195
9
  import * as Tooltip from "@radix-ui/react-tooltip";
196
10
  import React, {
197
- createContext as createContext2,
198
- useContext as useContext2,
11
+ createContext,
12
+ useContext,
199
13
  useState
200
14
  } from "react";
201
- var TooltipAnchorRefContext = createContext2(null);
15
+ var TooltipAnchorRefContext = createContext(null);
202
16
 
203
17
  // src/components/FunInput/FunInput.tsx
204
18
  import React5, {
@@ -209,7 +23,7 @@ import React5, {
209
23
  import clsx from "clsx";
210
24
 
211
25
  // src/providers/FunkitThemeProvider.tsx
212
- import React2, { createContext as createContext3, useContext as useContext3, useEffect, useState as useState2 } from "react";
26
+ import React2, { createContext as createContext2, useContext as useContext2, useEffect, useState as useState2 } from "react";
213
27
 
214
28
  // src/themes/baseTheme.ts
215
29
  var systemFontStack = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
@@ -1079,8 +893,8 @@ var DEFAULT_THEME_SET = {
1079
893
  darkTheme: darkTheme()
1080
894
  };
1081
895
  var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
1082
- var ThemeIdContext = createContext3(void 0);
1083
- var ThemeContext = createContext3({
896
+ var ThemeIdContext = createContext2(void 0);
897
+ var ThemeContext = createContext2({
1084
898
  activeTheme: DEFAULT_THEME,
1085
899
  lightTheme: void 0,
1086
900
  darkTheme: void 0,
@@ -1100,7 +914,7 @@ var useActiveTheme = () => {
1100
914
  darkTheme: darkTheme2,
1101
915
  toggleTheme,
1102
916
  themeColorScheme
1103
- } = useContext3(ThemeContext);
917
+ } = useContext2(ThemeContext);
1104
918
  return {
1105
919
  activeTheme,
1106
920
  /** Overrides the currently active `theme` with disregard to the `theme` provided to the `FunkitProvider`, ie. `toggleTheme` will switch to the `theme` provided to the `FunkitProvider`, not the theme set by `setTheme` */
@@ -1481,22 +1295,21 @@ var groupChainsById = (chains) => {
1481
1295
 
1482
1296
  // src/providers/FunkitConnectChainContext.tsx
1483
1297
  import React6, {
1484
- createContext as createContext4,
1485
- useContext as useContext4,
1486
- useMemo as useMemo2
1298
+ createContext as createContext3,
1299
+ useContext as useContext3,
1300
+ useMemo
1487
1301
  } from "react";
1488
- var FunkitConnectChainContext = createContext4(
1302
+ var FunkitConnectChainContext = createContext3(
1489
1303
  {
1490
1304
  chains: []
1491
1305
  }
1492
1306
  );
1493
- var useFunkitConnectChains = () => useContext4(FunkitConnectChainContext).chains;
1307
+ var useFunkitConnectChains = () => useContext3(FunkitConnectChainContext).chains;
1494
1308
  var useFunkitConnectChainsById = () => groupChainsById(useFunkitConnectChains());
1495
1309
 
1496
1310
  export {
1497
1311
  chainMetadataById,
1498
1312
  useFunkitConnectChainsById,
1499
- useFunkitConfig,
1500
1313
  TooltipAnchorRefContext,
1501
1314
  FunSkeletonBlock,
1502
1315
  FunInput
@@ -225,6 +225,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
225
225
  };
226
226
 
227
227
  export {
228
+ sanitizeUrl,
228
229
  preloadRemoteImages,
229
230
  AsyncImage
230
231
  };