@funkit/connect 10.0.0 → 10.1.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 (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/clients/lighter.d.ts +12 -2
  3. package/dist/clients/lighter.js +18 -6
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +150 -116
  6. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +32 -5
  7. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -3
  8. package/dist/providers/FunkitCheckoutContext/types.d.ts +20 -2
  9. package/dist/utils/checkout.d.ts +1 -1
  10. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  11. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  12. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  13. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  14. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  15. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  16. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  17. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  18. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  19. package/dist/wallets/walletConnectors/index.js +41 -41
  20. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  27. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  28. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  29. package/package.json +4 -4
  30. package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
  31. package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
  32. package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
  33. package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
  34. package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
  35. package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
  36. package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
  37. package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
  38. package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
  39. package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
  40. package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
  41. package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
  42. package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
  43. package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
  44. package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
  45. package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
  46. package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
  47. package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b3f7e3e: Allow customRecipient and generateActionsParams to be set together in the checkout config
8
+ - 1c74a2b: Add USDC Spot to Lighter Secure withdrawal via a required `routeType` on the Secure callback params
9
+ - 803bcbc: Move `WithdrawalParam.lighterAssetIndex` into a discriminated `customerData` object (`{ customerName: 'lighter', assetIndex }`)
10
+
11
+ ### Patch Changes
12
+
13
+ - 7636095: Gate Cash App Lightning via dynamic config instead of a hardcoded US check
14
+ - Updated dependencies [7636095]
15
+ - @funkit/connect-core@1.6.2
16
+
3
17
  ## 10.0.0
4
18
 
5
19
  ### Major Changes
@@ -14,7 +14,9 @@
14
14
  * caller provides the actual on-chain implementation.
15
15
  */
16
16
  import { type Address } from 'viem';
17
- import type { CustomWithdrawalConfig, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
17
+ import type { CustomWithdrawalConfig, LighterRouteType, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
18
+ export { LIGHTER_ROUTE_TYPE } from '../modals/WithdrawalModal/LighterWithdrawal';
19
+ export type { LighterRouteType } from '../providers/FunkitCheckoutContext/types';
18
20
  export type LighterTransferParams = {
19
21
  toAccountIndex: number;
20
22
  assetIndex: number;
@@ -54,6 +56,8 @@ export interface LighterWithdrawalConfig {
54
56
  sendLighterSecureWithdrawal: LighterSecureWithdrawalExec;
55
57
  /**
56
58
  * Returns the minimum Secure withdrawal amount in token units for the given symbol.
59
+ * Spot USDC is passed as `USDC (Spot)` (perps collateral is plain `USDC`);
60
+ * return `undefined` to fall back to the per-base-symbol defaults.
57
61
  *
58
62
  * ```ts
59
63
  * getSecureMinWithdrawalAmount: (symbol) => ({ USDC: 1, ETH: 0.001 }[symbol] ?? 0)
@@ -85,6 +89,13 @@ export interface LighterSecureWithdrawalCallbackParams {
85
89
  amountTokenUnits: string;
86
90
  /** The Lighter asset index (e.g. 1 for ETH, 3 for USDC). */
87
91
  assetIndex: number;
92
+ /**
93
+ * Lighter L2 route type ({@link LIGHTER_ROUTE_TYPE}: 0 = perps / USDC
94
+ * collateral, 1 = spot). Pass it through to `client.withdraw({ routeType })`
95
+ * — USDC shares asset index 3 across both routes, so the route type is what
96
+ * selects Perps vs Spot.
97
+ */
98
+ routeType: LighterRouteType;
88
99
  }
89
100
  type LighterSecureWithdrawalExec = (params: LighterSecureWithdrawalCallbackParams) => Promise<string>;
90
101
  export interface LighterSecureWithdrawalConfig {
@@ -169,4 +180,3 @@ export declare function createLighterSecureWithdrawalConfig(config: LighterSecur
169
180
  * ```
170
181
  */
171
182
  export declare function useLighterWithdrawalConfig(config: LighterWithdrawalConfig | null): MultiMethodWithdrawalConfig | null;
172
- export {};
@@ -149,6 +149,13 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
149
149
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
150
150
  var LIGHTER_FAST_METHOD_ID = "lighter-fast";
151
151
  var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
152
+ var LIGHTER_ROUTE_TYPE = {
153
+ PERPS: 0,
154
+ SPOT: 1
155
+ };
156
+ function getLighterBaseSymbol(symbol) {
157
+ return symbol.replace(/\s*\((?:spot|perps)\)\s*$/i, "");
158
+ }
152
159
  var LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3e6;
153
160
 
154
161
  // src/clients/lighter.tsx
@@ -415,15 +422,16 @@ function buildSecureWithdrawalCallback({
415
422
  }) {
416
423
  return async (param) => {
417
424
  const { targetAssetAddress, destinationAddress } = param;
418
- const assetIndex = param.lighterAssetIndex;
419
- if (assetIndex === void 0) {
425
+ const customerData = param.customerData?.customerName === "lighter" ? param.customerData : void 0;
426
+ if (!customerData) {
420
427
  logger.error(
421
- "lighter:withdrawal:secure:missingAssetIndex",
422
- new Error("Missing lighterAssetIndex for Secure withdrawal"),
428
+ "lighter:withdrawal:secure:missingCustomerData",
429
+ new Error("Missing Lighter customerData for Secure withdrawal"),
423
430
  { targetAssetAddress, destinationAddress }
424
431
  );
425
432
  return;
426
433
  }
434
+ const { assetIndex, routeType } = customerData;
427
435
  const amountTokenUnits = param.userInputAmount;
428
436
  if (!amountTokenUnits) {
429
437
  logger.error(
@@ -436,17 +444,20 @@ function buildSecureWithdrawalCallback({
436
444
  const withdrawalUSD = param.withdrawalUSD ?? "0";
437
445
  logger.info("lighter:withdrawal:secure:start", {
438
446
  assetIndex,
447
+ routeType,
439
448
  amountTokenUnits,
440
449
  targetAssetAddress,
441
450
  destinationAddress
442
451
  });
443
452
  const txHash = await exec({
444
453
  amountTokenUnits,
445
- assetIndex
454
+ assetIndex,
455
+ routeType
446
456
  });
447
457
  logger.info("lighter:withdrawal:secure:submitted", {
448
458
  amountTokenUnits,
449
459
  assetIndex,
460
+ routeType,
450
461
  txHash
451
462
  });
452
463
  void trackLighterSecureWithdrawal({
@@ -586,7 +597,7 @@ function buildLighterMultiMethodConfig({
586
597
  if (userMin !== void 0) {
587
598
  return userMin;
588
599
  }
589
- return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS[symbol.toUpperCase()] ?? 0;
600
+ return LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS[getLighterBaseSymbol(symbol).toUpperCase()] ?? 0;
590
601
  }
591
602
  });
592
603
  const fast = {
@@ -637,6 +648,7 @@ function useLighterWithdrawalConfig(config) {
637
648
  }
638
649
  export {
639
650
  LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
651
+ LIGHTER_ROUTE_TYPE,
640
652
  createLighterSecureWithdrawalConfig,
641
653
  trackLighterSecureWithdrawal,
642
654
  useLighterWithdrawalConfig
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { createAuthenticationAdapter, FunkitConnectAuthenticationProvider, } fro
20
20
  export type { AuthenticationAdapter, FunkitConnectAuthenticationProviderProps, } from './providers/AuthenticationContext';
21
21
  export type { AvatarComponent } from './providers/AvatarContext';
22
22
  export type { CheckoutBlockedReason } from './modals/CheckoutModal/CheckoutBlockedReason';
23
- export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, } from './providers/FunkitCheckoutContext';
23
+ export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, } from './providers/FunkitCheckoutContext';
24
24
  export { useFunkitCheckout, FunCheckoutStartingStep, } from './providers/FunkitCheckoutContext';
25
25
  export type { FunkitCheckoutQuoteResult } from './domains/quote';
26
26
  export type { FunkitConfig, FunkitUiCustomizationsConfig, FunkitTextCustomizationsConfig, } from './providers/FunkitConfigContext';
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import {
3
- darkTheme
4
- } from "./chunk-36KVHK22.js";
5
2
  import {
6
3
  lightTheme
7
4
  } from "./chunk-67BKQQNG.js";
5
+ import {
6
+ darkTheme
7
+ } from "./chunk-36KVHK22.js";
8
8
  import {
9
9
  systemFontStack
10
10
  } from "./chunk-4YEAUICE.js";
@@ -1004,66 +1004,6 @@ import {
1004
1004
  import * as dnum12 from "dnum";
1005
1005
  import { erc20Abi as erc20Abi9, formatUnits as formatUnits5, isAddress } from "viem";
1006
1006
 
1007
- // src/consts/customers.ts
1008
- import {
1009
- AAVE_API_KEY,
1010
- AVANTIS_API_KEY,
1011
- BASED_API_KEY,
1012
- BSX_API_KEY,
1013
- ETHEREAL_API_KEY,
1014
- FANATICS_API_KEY,
1015
- HYENA_API_KEY,
1016
- HYPERDASH_API_KEY,
1017
- LIGHTERXYZ_API_KEY,
1018
- MALLARD_API_KEY,
1019
- MONAD_API_KEY,
1020
- MONKEY_TILT_API_KEY,
1021
- NADO_API_KEY,
1022
- OSTIUM_API_KEY,
1023
- PERPL_API_KEY,
1024
- POLYMARKET_API_KEY
1025
- } from "@funkit/api-base";
1026
- import { mainnet as mainnet2 } from "viem/chains";
1027
- function isPolymarketCustomer(apiKey) {
1028
- return apiKey === POLYMARKET_API_KEY;
1029
- }
1030
- function isOstiumCustomer(apiKey) {
1031
- return apiKey === OSTIUM_API_KEY;
1032
- }
1033
- function isEtherealCustomer(apiKey) {
1034
- return apiKey === ETHEREAL_API_KEY;
1035
- }
1036
- function isMonadCustomer(apiKey) {
1037
- return apiKey === MONAD_API_KEY;
1038
- }
1039
- function isHyenaCustomer(apiKey) {
1040
- return apiKey === HYENA_API_KEY;
1041
- }
1042
- function isLighterxyzCustomer(apiKey) {
1043
- return apiKey === LIGHTERXYZ_API_KEY;
1044
- }
1045
- function isFanaticsCustomer(apiKey) {
1046
- return apiKey === FANATICS_API_KEY;
1047
- }
1048
- function isAaveCustomer(apiKey) {
1049
- return apiKey === AAVE_API_KEY;
1050
- }
1051
- function isNadoCustomer(apiKey) {
1052
- return apiKey === NADO_API_KEY;
1053
- }
1054
- function isMallardCustomer(apiKey) {
1055
- return apiKey === MALLARD_API_KEY;
1056
- }
1057
- function isCustomerNativeFastPathEnabled(apiKey) {
1058
- return isAaveCustomer(apiKey);
1059
- }
1060
- function isLighterSpot(apiKey, checkoutConfig) {
1061
- return !!checkoutConfig && isLighterxyzCustomer(apiKey) && (checkoutConfig.dynamicRoutingId ?? "").includes("SPOT");
1062
- }
1063
- function isLighterSlowDeposit(apiKey, checkoutConfig) {
1064
- return !!checkoutConfig && isLighterxyzCustomer(apiKey) && checkoutConfig.targetChain === mainnet2.id.toString();
1065
- }
1066
-
1067
1007
  // src/wagmi/actions.ts
1068
1008
  import { erc20Abi, formatUnits } from "viem";
1069
1009
  import {
@@ -1137,6 +1077,66 @@ import React300, {
1137
1077
  import { flushSync as flushSync2 } from "react-dom";
1138
1078
  import { v4 as uuid2 } from "uuid";
1139
1079
 
1080
+ // src/consts/customers.ts
1081
+ import {
1082
+ AAVE_API_KEY,
1083
+ AVANTIS_API_KEY,
1084
+ BASED_API_KEY,
1085
+ BSX_API_KEY,
1086
+ ETHEREAL_API_KEY,
1087
+ FANATICS_API_KEY,
1088
+ HYENA_API_KEY,
1089
+ HYPERDASH_API_KEY,
1090
+ LIGHTERXYZ_API_KEY,
1091
+ MALLARD_API_KEY,
1092
+ MONAD_API_KEY,
1093
+ MONKEY_TILT_API_KEY,
1094
+ NADO_API_KEY,
1095
+ OSTIUM_API_KEY,
1096
+ PERPL_API_KEY,
1097
+ POLYMARKET_API_KEY
1098
+ } from "@funkit/api-base";
1099
+ import { mainnet as mainnet2 } from "viem/chains";
1100
+ function isPolymarketCustomer(apiKey) {
1101
+ return apiKey === POLYMARKET_API_KEY;
1102
+ }
1103
+ function isOstiumCustomer(apiKey) {
1104
+ return apiKey === OSTIUM_API_KEY;
1105
+ }
1106
+ function isEtherealCustomer(apiKey) {
1107
+ return apiKey === ETHEREAL_API_KEY;
1108
+ }
1109
+ function isMonadCustomer(apiKey) {
1110
+ return apiKey === MONAD_API_KEY;
1111
+ }
1112
+ function isHyenaCustomer(apiKey) {
1113
+ return apiKey === HYENA_API_KEY;
1114
+ }
1115
+ function isLighterxyzCustomer(apiKey) {
1116
+ return apiKey === LIGHTERXYZ_API_KEY;
1117
+ }
1118
+ function isFanaticsCustomer(apiKey) {
1119
+ return apiKey === FANATICS_API_KEY;
1120
+ }
1121
+ function isAaveCustomer(apiKey) {
1122
+ return apiKey === AAVE_API_KEY;
1123
+ }
1124
+ function isNadoCustomer(apiKey) {
1125
+ return apiKey === NADO_API_KEY;
1126
+ }
1127
+ function isMallardCustomer(apiKey) {
1128
+ return apiKey === MALLARD_API_KEY;
1129
+ }
1130
+ function isCustomerNativeFastPathEnabled(apiKey) {
1131
+ return isAaveCustomer(apiKey);
1132
+ }
1133
+ function isLighterSpot(apiKey, checkoutConfig) {
1134
+ return !!checkoutConfig && isLighterxyzCustomer(apiKey) && (checkoutConfig.dynamicRoutingId ?? "").includes("SPOT");
1135
+ }
1136
+ function isLighterSlowDeposit(apiKey, checkoutConfig) {
1137
+ return !!checkoutConfig && isLighterxyzCustomer(apiKey) && checkoutConfig.targetChain === mainnet2.id.toString();
1138
+ }
1139
+
1140
1140
  // src/consts/funkit.ts
1141
1141
  import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/chains";
1142
1142
  var NATIVE_TOKEN = FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS;
@@ -1687,7 +1687,7 @@ function setFunkitConnectVersion({ version }) {
1687
1687
  localStorage.setItem(storageKey, version);
1688
1688
  }
1689
1689
  function getCurrentSdkVersion() {
1690
- return "10.0.0";
1690
+ return "10.1.0";
1691
1691
  }
1692
1692
  function useFingerprint() {
1693
1693
  const fingerprint = useCallback3(() => {
@@ -3394,12 +3394,6 @@ function useIsMeldEnabled() {
3394
3394
  return meldEnabled && !!meldCurrencyCode;
3395
3395
  }
3396
3396
 
3397
- // src/hooks/useIsUsUser.ts
3398
- function useIsUsUser() {
3399
- const { userIpInfo } = useFunkitUserIp();
3400
- return userIpInfo?.alpha2 === "US";
3401
- }
3402
-
3403
3397
  // src/hooks/useFrogAccount.ts
3404
3398
  import {
3405
3399
  createBridgeBankAccount,
@@ -4251,14 +4245,16 @@ function usePaymentMethodEnablement() {
4251
4245
  const isBrokerageFlagEnabled = useDynamicConfig("enablebluvobrokerage");
4252
4246
  const isSwappedFlagEnabled = useDynamicConfig("enableswappeddeposit");
4253
4247
  const isLightningFlagEnabled = useDynamicConfig("enablebitcoinlightning");
4248
+ const isCashAppLightningFlagEnabled = useDynamicConfig(
4249
+ "enablecashapplightning"
4250
+ );
4254
4251
  const isFiatEnabled = isFiatFlagEnabled;
4255
4252
  const isTokenTransferEnabled = isTokenTransferFlagEnabled;
4256
4253
  const isMeldEnabled = isMeldFlagEnabled && isTokenTransferEnabled;
4257
4254
  const isSwappedEnabled = isSwappedFlagEnabled && (isTokenTransferEnabled || isTokenTransferComingSoon || isTokenTransferGeoblocked);
4258
4255
  const isBrokerageEnabled = isBrokerageFlagEnabled && isTokenTransferEnabled;
4259
4256
  const isLightningEnabled = isLightningFlagEnabled && isTokenTransferEnabled;
4260
- const isUsUser = useIsUsUser();
4261
- const isCashAppLightningEnabled = isLightningEnabled && isUsUser;
4257
+ const isCashAppLightningEnabled = isCashAppLightningFlagEnabled && isTokenTransferEnabled;
4262
4258
  return {
4263
4259
  isSwappedEnabled,
4264
4260
  isFiatEnabled,
@@ -19096,6 +19092,17 @@ var getTokenIconUrl = (symbol, tokens) => {
19096
19092
 
19097
19093
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
19098
19094
  var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
19095
+ var LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
19096
+ var LIGHTER_ROUTE_TYPE = {
19097
+ PERPS: 0,
19098
+ SPOT: 1
19099
+ };
19100
+ function getLighterBaseSymbol(symbol) {
19101
+ return symbol.replace(/\s*\((?:spot|perps)\)\s*$/i, "");
19102
+ }
19103
+ function resolveLighterSecureRouteType(selectedSourceToken) {
19104
+ return selectedSourceToken.toUpperCase() === "USDC" ? LIGHTER_ROUTE_TYPE.PERPS : LIGHTER_ROUTE_TYPE.SPOT;
19105
+ }
19099
19106
  var LIGHTER_SECURE_MAINNET_ADDRESS = {
19100
19107
  ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
19101
19108
  LIT: "0x232CE3bd40fCd6f80f3d55A522d03f25Df784Ee2",
@@ -19108,7 +19115,7 @@ var LIGHTER_SECURE_MAINNET_ADDRESS = {
19108
19115
  AZTEC: "0xA27EC0006e59f245217Ff08CD52A7E8b169E62D2"
19109
19116
  };
19110
19117
  function getLighterSecureMainnetAddress(symbol) {
19111
- return LIGHTER_SECURE_MAINNET_ADDRESS[symbol.toUpperCase()];
19118
+ return LIGHTER_SECURE_MAINNET_ADDRESS[getLighterBaseSymbol(symbol).toUpperCase()];
19112
19119
  }
19113
19120
  var LIGHTER_FAST_MAX_WITHDRAWAL_LABEL = "$3M";
19114
19121
  function LighterFastMaxExceededMessage({
@@ -19191,10 +19198,8 @@ function useLighterWithdrawalBalances({
19191
19198
  const result = {};
19192
19199
  for (const asset of account.assets) {
19193
19200
  const symbol = asset.symbol.toUpperCase();
19194
- if (symbol === "USDC") {
19195
- continue;
19196
- }
19197
- result[symbol] = freeBalance(asset.balance, asset.locked_balance);
19201
+ const key = symbol === "USDC" ? LIGHTER_USDC_SPOT_SYMBOL.toUpperCase() : symbol;
19202
+ result[key] = freeBalance(asset.balance, asset.locked_balance);
19198
19203
  }
19199
19204
  result.USDC = account.total_asset_value;
19200
19205
  logger.info("lighter:withdrawal:balances:resolved", {
@@ -19214,7 +19219,7 @@ function useLighterWithdrawalBalances({
19214
19219
  }
19215
19220
  var LIGHTER_USDC_ASSET_INDEX = 3;
19216
19221
  function resolveLighterAssetIndex(lighterAssets, selectedSourceToken) {
19217
- const selectedSymbol = selectedSourceToken.toUpperCase();
19222
+ const selectedSymbol = getLighterBaseSymbol(selectedSourceToken).toUpperCase();
19218
19223
  const lookupAssetId = lighterAssets.find(
19219
19224
  (asset) => asset.symbol.toUpperCase() === selectedSymbol
19220
19225
  )?.asset_id;
@@ -19231,17 +19236,26 @@ function buildLighterSourceTokenOptions(config, lighterAssets) {
19231
19236
  }
19232
19237
  ];
19233
19238
  }
19234
- const usdcOption = {
19239
+ const usdcPerpsOption = {
19235
19240
  symbol: "USDC",
19236
- label: "USDC",
19241
+ label: "USDC (Perps)",
19237
19242
  iconSrc: getTokenIconUrl("USDC")
19238
19243
  };
19239
- const nonUsdcOptions = lighterAssets.filter((asset) => asset.symbol.toUpperCase() !== "USDC").map((asset) => ({
19240
- symbol: asset.symbol,
19241
- label: asset.symbol,
19242
- iconSrc: getTokenIconUrl(asset.symbol)
19243
- }));
19244
- return [usdcOption, ...nonUsdcOptions];
19244
+ const spotOptions = lighterAssets.map((asset) => {
19245
+ if (asset.symbol.toUpperCase() === "USDC") {
19246
+ return {
19247
+ symbol: LIGHTER_USDC_SPOT_SYMBOL,
19248
+ label: LIGHTER_USDC_SPOT_SYMBOL,
19249
+ iconSrc: getTokenIconUrl("USDC")
19250
+ };
19251
+ }
19252
+ return {
19253
+ symbol: asset.symbol,
19254
+ label: asset.symbol,
19255
+ iconSrc: getTokenIconUrl(asset.symbol)
19256
+ };
19257
+ });
19258
+ return [usdcPerpsOption, ...spotOptions];
19245
19259
  }
19246
19260
  function useLighterWithdrawal(config, setRecipientAddress) {
19247
19261
  const { apiKey } = useFunkitConfig();
@@ -19353,9 +19367,10 @@ function LighterSecureAddressDisplay({ address }) {
19353
19367
  ));
19354
19368
  }
19355
19369
  function LighterSecureReceiveDisplay({
19356
- sourceTokenSymbol
19370
+ sourceTokenSymbol: rawSourceTokenSymbol
19357
19371
  }) {
19358
19372
  const { t } = useFunkitTranslation();
19373
+ const sourceTokenSymbol = getLighterBaseSymbol(rawSourceTokenSymbol);
19359
19374
  return /* @__PURE__ */ React83.createElement(Box, { width: "full", display: "flex", gap: "12" }, /* @__PURE__ */ React83.createElement(Box, { width: "full", display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React83.createElement(Text, { size: "inputLabel", weight: "inputLabel", color: "inputLabel" }, t("withdrawal.receiveToken")), /* @__PURE__ */ React83.createElement(
19360
19375
  LighterSecureLockedField,
19361
19376
  {
@@ -19394,8 +19409,9 @@ function LighterSecureReceiveDisplay({
19394
19409
  }
19395
19410
  function LighterSecureReceiveAmountValue({
19396
19411
  amount,
19397
- tokenSymbol
19412
+ tokenSymbol: rawTokenSymbol
19398
19413
  }) {
19414
+ const tokenSymbol = getLighterBaseSymbol(rawTokenSymbol);
19399
19415
  return /* @__PURE__ */ React83.createElement(
19400
19416
  Text,
19401
19417
  {
@@ -19415,10 +19431,11 @@ function LighterSecureWithdrawalSuccess({
19415
19431
  onClose,
19416
19432
  onNewWithdrawal,
19417
19433
  amount,
19418
- tokenSymbol,
19434
+ tokenSymbol: rawTokenSymbol,
19419
19435
  txHash
19420
19436
  }) {
19421
19437
  const { t } = useFunkitTranslation();
19438
+ const tokenSymbol = getLighterBaseSymbol(rawTokenSymbol);
19422
19439
  const bottomSectionRef = useBottomSectionRef("withdrawal");
19423
19440
  const isSyntheticHash = txHash === "0x0000000000000000000000000000000000000001";
19424
19441
  const hasRealTxHash = !!txHash && !isSyntheticHash;
@@ -25067,7 +25084,12 @@ function WithdrawAmountInput({
25067
25084
  const isLighter = isLighterxyzCustomer(apiKey);
25068
25085
  const isLighterFast = isLighter && config.sourceChainId === RELAY_LIGHTER_CHAIN_ID3;
25069
25086
  const activeSymbol = selectedSourceToken ?? config.sourceTokenSymbol;
25070
- const chipLabel = isLighterFast ? "USDC (Perps)" : activeSymbol;
25087
+ const selectedOption = sourceTokenOptions?.find(
25088
+ (opt) => opt.symbol === activeSymbol
25089
+ );
25090
+ const chipLabel = selectedOption?.label ?? (isLighterFast ? "USDC (Perps)" : activeSymbol);
25091
+ const chipIconSrc = selectedOption?.iconSrc ?? getTokenIconUrl(getLighterBaseSymbol(activeSymbol));
25092
+ const displaySymbol = getLighterBaseSymbol(activeSymbol);
25071
25093
  const chipTooltip = isLighterFast ? t("withdrawal.lighterFastTokenTooltip") : void 0;
25072
25094
  const [amountInputTouched, setAmountInputTouched] = useState38(false);
25073
25095
  const handleAmountChange = (e) => {
@@ -25082,15 +25104,16 @@ function WithdrawAmountInput({
25082
25104
  };
25083
25105
  const isSolelyOverCap = isWithdrawAmountTooHigh && !isWithdrawAmountAboveBalance;
25084
25106
  const showAmountError = amountInputTouched && withdrawalInputAmount !== "" && !isWithdrawAmountValid && !isSolelyOverCap;
25085
- const minAmountDisplay = isLighter ? `${minWithdrawalDisplayValue} ${activeSymbol}` : formatCurrencyAndStringify5(minWithdrawalDisplayValue);
25107
+ const minAmountDisplay = isLighter ? `${minWithdrawalDisplayValue} ${displaySymbol}` : formatCurrencyAndStringify5(minWithdrawalDisplayValue);
25086
25108
  const errorText = showAmountError ? isWithdrawAmountTooLow ? t("withdrawal.minimumWithdrawAmount", { amount: minAmountDisplay }) : t("withdrawal.insufficientBalance") : void 0;
25087
25109
  return /* @__PURE__ */ React131.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React131.createElement(Text, { size: "inputLabel", weight: "inputLabel", color: "inputLabel" }, t("withdrawal.amount")), /* @__PURE__ */ React131.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, isLighter ? /* @__PURE__ */ React131.createElement(
25088
25110
  LighterCompoundAmountInput,
25089
25111
  {
25090
25112
  value: withdrawalInputAmount,
25091
25113
  onChange: handleAmountChange,
25092
- activeSymbol,
25114
+ activeSymbol: displaySymbol,
25093
25115
  chipLabel,
25116
+ chipIconSrc,
25094
25117
  chipTooltip,
25095
25118
  sourceTokenBalance,
25096
25119
  onMax: setMaxAmount,
@@ -25116,7 +25139,7 @@ function WithdrawAmountInput({
25116
25139
  suffix: /* @__PURE__ */ React131.createElement(
25117
25140
  AmountInputSuffix,
25118
25141
  {
25119
- symbol: activeSymbol,
25142
+ symbol: displaySymbol,
25120
25143
  sourceTokenBalance,
25121
25144
  onMax: setMaxAmount
25122
25145
  }
@@ -25127,7 +25150,7 @@ function WithdrawAmountInput({
25127
25150
  { minBeforeUseScientific: 0 }
25128
25151
  )), Number(sourceTokenBalance) > 0 && /* @__PURE__ */ React131.createElement(Text, { size: "12", color: "secondaryText" }, t("withdrawal.balance", {
25129
25152
  amount: formatCryptoAndStringify2(Number(sourceTokenBalance)),
25130
- symbol: activeSymbol
25153
+ symbol: displaySymbol
25131
25154
  })))));
25132
25155
  }
25133
25156
  function AmountInputSuffix({
@@ -25151,6 +25174,7 @@ function LighterCompoundAmountInput({
25151
25174
  onChange,
25152
25175
  activeSymbol,
25153
25176
  chipLabel,
25177
+ chipIconSrc,
25154
25178
  chipTooltip,
25155
25179
  sourceTokenBalance,
25156
25180
  onMax,
@@ -25185,8 +25209,8 @@ function LighterCompoundAmountInput({
25185
25209
  /* @__PURE__ */ React131.createElement(
25186
25210
  LighterSourceTokenDropdown,
25187
25211
  {
25188
- activeSymbol,
25189
25212
  chipLabel,
25213
+ chipIconSrc,
25190
25214
  tooltip: chipTooltip,
25191
25215
  options: sourceTokenOptions,
25192
25216
  onSelect: onSourceTokenChange
@@ -25229,8 +25253,8 @@ function LighterAmountInputField({
25229
25253
  ));
25230
25254
  }
25231
25255
  function LighterSourceTokenDropdown({
25232
- activeSymbol,
25233
25256
  chipLabel,
25257
+ chipIconSrc,
25234
25258
  tooltip,
25235
25259
  options,
25236
25260
  onSelect
@@ -25260,7 +25284,7 @@ function LighterSourceTokenDropdown({
25260
25284
  /* @__PURE__ */ React131.createElement(
25261
25285
  AsyncImage,
25262
25286
  {
25263
- src: getTokenIconUrl(activeSymbol),
25287
+ src: chipIconSrc,
25264
25288
  alt: chipLabel,
25265
25289
  width: 20,
25266
25290
  height: 20,
@@ -25295,7 +25319,11 @@ function LighterSourceTokenDropdown({
25295
25319
  className: "funkit-dropdown-content",
25296
25320
  style: {
25297
25321
  zIndex: "calc(var(--rk-modal-z-index, 2147483646) + 1)",
25298
- width: "var(--radix-dropdown-menu-trigger-width)"
25322
+ // Track the chip width as a floor only — a short selection (e.g.
25323
+ // "LIT") must not squeeze longer labels ("USDC (Perps)") into
25324
+ // wrapping; the menu grows to its widest item instead.
25325
+ minWidth: "var(--radix-dropdown-menu-trigger-width)",
25326
+ width: "max-content"
25299
25327
  },
25300
25328
  onCloseAutoFocus: (e) => e.preventDefault()
25301
25329
  },
@@ -25342,7 +25370,16 @@ function LighterSourceTokenDropdown({
25342
25370
  borderRadius: "full"
25343
25371
  }
25344
25372
  ),
25345
- /* @__PURE__ */ React131.createElement(Text, { size: "13", weight: "medium", color: "primaryText" }, opt.label)
25373
+ /* @__PURE__ */ React131.createElement(
25374
+ Text,
25375
+ {
25376
+ size: "13",
25377
+ weight: "medium",
25378
+ color: "primaryText",
25379
+ style: { whiteSpace: "nowrap" }
25380
+ },
25381
+ opt.label
25382
+ )
25346
25383
  )
25347
25384
  ))
25348
25385
  )
@@ -25628,7 +25665,7 @@ function useWithdrawal({
25628
25665
  targetAssetAddress: formData.tokenAddress,
25629
25666
  targetChainId: formData.chainId,
25630
25667
  destinationAddress: formData.destinationAddress,
25631
- lighterAssetIndex: formData.lighterAssetIndex,
25668
+ customerData: formData.customerData,
25632
25669
  userInputAmount: formData.userInputAmount,
25633
25670
  withdrawalUSD: formData.withdrawalUSD
25634
25671
  });
@@ -25664,7 +25701,7 @@ function useWithdrawal({
25664
25701
  targetAssetAddress: formData.tokenAddress,
25665
25702
  targetChainId: formData.chainId,
25666
25703
  destinationAddress: formData.destinationAddress,
25667
- lighterAssetIndex: formData.lighterAssetIndex,
25704
+ customerData: formData.customerData,
25668
25705
  userInputAmount: formData.userInputAmount,
25669
25706
  withdrawalUSD: formData.withdrawalUSD
25670
25707
  });
@@ -26090,7 +26127,13 @@ var WithdrawContent = ({
26090
26127
  // submit button is gated on `lighterAssetIndex` but not on this asset.
26091
26128
  tokenAddress: lighterSecureMainnetAddress ?? "0x",
26092
26129
  chainId: mainnet7.id,
26093
- lighterAssetIndex,
26130
+ customerData: {
26131
+ customerName: "lighter",
26132
+ assetIndex: lighterAssetIndex,
26133
+ // Perps vs spot route — disambiguates USDC, which shares asset
26134
+ // index 3 across both routes.
26135
+ routeType: resolveLighterSecureRouteType(selectedSourceToken)
26136
+ },
26094
26137
  userInputAmount: withdrawalInputAmount
26095
26138
  });
26096
26139
  };
@@ -48360,13 +48403,10 @@ function useFunkitCheckout(props) {
48360
48403
  if (!isCheckoutActivated) {
48361
48404
  return { isActivated: false };
48362
48405
  }
48363
- const validationResult = await validateCheckoutConfig(
48364
- {
48365
- ...props.config,
48366
- ...inputConfig
48367
- },
48368
- apiKey
48369
- );
48406
+ const validationResult = await validateCheckoutConfig({
48407
+ ...props.config,
48408
+ ...inputConfig
48409
+ });
48370
48410
  onValidation?.(validationResult);
48371
48411
  if (!validationResult.isValid) {
48372
48412
  onErrorWrapper?.({
@@ -48452,7 +48492,7 @@ var DUMMY_TRANSFER_PARAMS = {
48452
48492
  toAddress: "0x000000000000000000000000000000000000dEaD",
48453
48493
  tokenAmount: 5
48454
48494
  };
48455
- async function validateCheckoutConfig(config, apiKey) {
48495
+ async function validateCheckoutConfig(config) {
48456
48496
  logger.log("validateCheckoutConfig_input", config);
48457
48497
  if (!config.checkoutItemTitle) {
48458
48498
  return {
@@ -48508,12 +48548,6 @@ async function validateCheckoutConfig(config, apiKey) {
48508
48548
  message: "Invalid customRecipient configuration: Has to be a valid address."
48509
48549
  };
48510
48550
  }
48511
- if (config.customRecipient && !!config.generateActionsParams && !isPolymarketCustomer(apiKey)) {
48512
- return {
48513
- isValid: false,
48514
- message: "Invalid configuration: Not allowed to specify both customRecipient and generateActionsParams at the same time."
48515
- };
48516
- }
48517
48551
  if (config.modalTitleMeta && typeof config.modalTitleMeta !== "string") {
48518
48552
  return {
48519
48553
  isValid: false,