@funkit/connect 10.4.0 → 10.5.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 (71) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/clients/{chunk-APQYFP6X.js → chunk-A4WQS6QG.js} +1 -1
  3. package/dist/clients/{chunk-HOORQPSY.js → chunk-F6P4CN27.js} +24 -8
  4. package/dist/clients/{chunk-KNHO756P.js → chunk-FJ6GCMJ4.js} +1 -0
  5. package/dist/clients/{chunk-M6C7MBQN.js → chunk-QHS5N7GP.js} +2 -2
  6. package/dist/clients/{chunk-RCMAGKMG.js → chunk-WRS7AFM2.js} +1 -1
  7. package/dist/clients/fanatics.js +1 -1
  8. package/dist/clients/internal/nado/hooks.js +2 -2
  9. package/dist/clients/internal/nado/products.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalConfig.d.ts +11 -0
  11. package/dist/clients/internal/nado/withdrawalConfig.js +17 -0
  12. package/dist/clients/internal/nado/withdrawalTypes.d.ts +30 -0
  13. package/dist/clients/internal/nado/withdrawalTypes.js +1 -0
  14. package/dist/clients/lighter.d.ts +1 -0
  15. package/dist/clients/lighter.js +88 -20
  16. package/dist/clients/mallard.js +2 -2
  17. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +3 -3
  18. package/dist/clients/polymarket/index.js +3 -3
  19. package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +2 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +1637 -1308
  22. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +46 -2
  23. package/dist/modals/WithdrawalModal/useFiatWithdrawal.d.ts +1 -1
  24. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -15
  25. package/dist/providers/FunkitCheckoutContext/types.d.ts +42 -4
  26. package/dist/providers/FunkitConfigContext.d.ts +7 -0
  27. package/dist/providers/GeneralWalletProvider.d.ts +1 -4
  28. package/dist/utils/lighter.d.ts +68 -1
  29. package/dist/utils/purifyCheckoutHistoryItem.d.ts +2 -41
  30. package/dist/utils/swapped.d.ts +1 -1
  31. package/dist/utils/userInfo.d.ts +8 -0
  32. package/dist/utils/withdrawal.d.ts +2 -1
  33. package/dist/wagmi/actions.d.ts +1 -1
  34. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  39. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  40. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  41. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  42. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  43. package/dist/wallets/walletConnectors/index.js +39 -39
  44. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  49. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  50. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  51. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  52. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  53. package/package.json +2 -2
  54. package/dist/wallets/walletConnectors/{chunk-W2LCLDPX.js → chunk-2VP2F6EK.js} +3 -3
  55. package/dist/wallets/walletConnectors/{chunk-IULPZP2Q.js → chunk-4T6ZSRJF.js} +3 -3
  56. package/dist/wallets/walletConnectors/{chunk-WAHGI5L7.js → chunk-6BW3HLBG.js} +3 -3
  57. package/dist/wallets/walletConnectors/{chunk-YO2K4MBH.js → chunk-CCQV2ZET.js} +3 -3
  58. package/dist/wallets/walletConnectors/{chunk-TKB2OY6G.js → chunk-CPI4TD43.js} +3 -3
  59. package/dist/wallets/walletConnectors/{chunk-OX37G4YT.js → chunk-F5XEEVG6.js} +3 -3
  60. package/dist/wallets/walletConnectors/{chunk-JPN6TWIT.js → chunk-HNRB7KJU.js} +3 -3
  61. package/dist/wallets/walletConnectors/{chunk-WKNQMP4A.js → chunk-HTHAK6XB.js} +3 -3
  62. package/dist/wallets/walletConnectors/{chunk-GUQM4QSL.js → chunk-MIQTHJ6X.js} +3 -3
  63. package/dist/wallets/walletConnectors/{chunk-4NV5BYRP.js → chunk-RB3HR4R2.js} +3 -3
  64. package/dist/wallets/walletConnectors/{chunk-SWFF3TWJ.js → chunk-RVOY537T.js} +3 -3
  65. package/dist/wallets/walletConnectors/{chunk-KI5Y2BBF.js → chunk-STVVP43G.js} +3 -3
  66. package/dist/wallets/walletConnectors/{chunk-OEEGYENV.js → chunk-UK7C2JXW.js} +3 -3
  67. package/dist/wallets/walletConnectors/{chunk-YQFGVZGR.js → chunk-VAPGUPHO.js} +3 -3
  68. package/dist/wallets/walletConnectors/{chunk-XCNHV3HS.js → chunk-VTM6EECM.js} +3 -3
  69. package/dist/wallets/walletConnectors/{chunk-NR2OGDHQ.js → chunk-X6CGV36L.js} +3 -3
  70. package/dist/wallets/walletConnectors/{chunk-AVDUNQUW.js → chunk-YEZM4CK4.js} +3 -3
  71. package/dist/wallets/walletConnectors/{chunk-KCRO2AGO.js → chunk-ZNX4EMPB.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 10.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - abd36bd: Add an optional `source` to `funkitConfig` to attribute your onchain activity and silence the automatic-source console warning.
8
+ - a6c1fbc: Add explicit L1 on-chain withdrawal fallback for Lighter Secure when the L2 withdraw is rate-limited (error 23004)
9
+ - 0d75178: Add Lighter L1 on-chain withdrawal helpers (withdraw ABI, calldata builder, base-unit conversion, rate-limit detector)
10
+ - 85e73fc: Add Nado withdrawal support to the withdrawal config types.
11
+ - 565d999: `onWithdrawalConfirmation` now receives the withdrawal's form data (destination chain, token, recipient, amounts) as a second argument.
12
+
13
+ ### Patch Changes
14
+
15
+ - 3a2e779: Share the form-of-payment display-name logic and harden the saved-card guard.
16
+ - edf9e78: fix(connect): fix undefined walletAddress
17
+ - 8ad34fe: Pass Mallard externalUserId through as userId unprefixed (no apiKey prefix), matching connect-rn
18
+ - 186c230: test(connect): test ConfirmationStep
19
+ - 8ac239a: refactor(connect-core): promote checkout-history purify layer into core
20
+ - 4b2180b: fix(connect): require wagmi address for web3 isUserLoggedIn
21
+ - 88a1485: Clamp Swapped fiat withdrawals to the user's available balance (EXACT_IN fallback) instead of failing on-chain.
22
+ - Updated dependencies [3a2e779]
23
+ - Updated dependencies [8ac239a]
24
+ - @funkit/connect-core@2.2.0
25
+
3
26
  ## 10.4.0
4
27
 
5
28
  ### Minor Changes
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-II5CZTBC.js";
9
9
  import {
10
10
  multicall
11
- } from "./chunk-KNHO756P.js";
11
+ } from "./chunk-FJ6GCMJ4.js";
12
12
  import {
13
13
  logger
14
14
  } from "./chunk-AHYOV7AV.js";
@@ -417,7 +417,9 @@ var en_default = {
417
417
  lighterSecureAddressTooltip: "You can only withdraw to your connected wallet",
418
418
  lighterSecureTokenTooltip: "You can only receive the token you are choosing to withdraw",
419
419
  lighterSecureChainTooltip: "Secure withdrawals are only available on Ethereum",
420
- lighterFastTokenTooltip: "Fast withdrawals are only available for your USDC (Perps) balance"
420
+ lighterFastTokenTooltip: "Fast withdrawals are only available for your USDC (Perps) balance",
421
+ lighterWithdrawOnChain: "Withdraw on-chain",
422
+ lighterL1FallbackNotice: "You've reached Lighter's secure withdrawal rate limit. You can withdraw directly on-chain instead."
421
423
  },
422
424
  directExecution: {
423
425
  fillStatus: "Fill status",
@@ -982,7 +984,9 @@ var es_default = {
982
984
  lighterSecureAddressTooltip: "Solo puedes retirar a tu billetera conectada",
983
985
  lighterSecureTokenTooltip: "Solo puedes recibir el token que eliges retirar",
984
986
  lighterSecureChainTooltip: "Los retiros seguros solo est\xE1n disponibles en Ethereum",
985
- lighterFastTokenTooltip: "Los retiros r\xE1pidos solo est\xE1n disponibles para tu saldo de USDC (Perps)"
987
+ lighterFastTokenTooltip: "Los retiros r\xE1pidos solo est\xE1n disponibles para tu saldo de USDC (Perps)",
988
+ lighterWithdrawOnChain: "Retirar on-chain",
989
+ lighterL1FallbackNotice: "Has alcanzado el l\xEDmite de retiros seguros de Lighter. Puedes retirar directamente on-chain."
986
990
  },
987
991
  directExecution: {
988
992
  fillStatus: "Estado de completado",
@@ -1547,7 +1551,9 @@ var fr_default = {
1547
1551
  lighterSecureAddressTooltip: "Vous ne pouvez retirer que vers votre portefeuille connect\xE9",
1548
1552
  lighterSecureTokenTooltip: "Vous ne pouvez recevoir que le jeton que vous choisissez de retirer",
1549
1553
  lighterSecureChainTooltip: "Les retraits s\xE9curis\xE9s ne sont disponibles que sur Ethereum",
1550
- lighterFastTokenTooltip: "Les retraits rapides ne sont disponibles que pour votre solde USDC (Perps)"
1554
+ lighterFastTokenTooltip: "Les retraits rapides ne sont disponibles que pour votre solde USDC (Perps)",
1555
+ lighterWithdrawOnChain: "Retirer on-chain",
1556
+ lighterL1FallbackNotice: "Vous avez atteint la limite de retraits s\xE9curis\xE9s de Lighter. Vous pouvez retirer directement on-chain."
1551
1557
  },
1552
1558
  directExecution: {
1553
1559
  fillStatus: "Statut d'ex\xE9cution",
@@ -2112,7 +2118,9 @@ var ja_default = {
2112
2118
  lighterSecureAddressTooltip: "\u63A5\u7D9A\u4E2D\u306E\u30A6\u30A9\u30EC\u30C3\u30C8\u306B\u306E\u307F\u51FA\u91D1\u3067\u304D\u307E\u3059",
2113
2119
  lighterSecureTokenTooltip: "\u51FA\u91D1\u3059\u308B\u901A\u8CA8\u306E\u307F\u53D7\u3051\u53D6\u308C\u307E\u3059",
2114
2120
  lighterSecureChainTooltip: "\u30BB\u30AD\u30E5\u30A2\u51FA\u91D1\u306F\u30A4\u30FC\u30B5\u30EA\u30A2\u30E0\u3067\u306E\u307F\u5229\u7528\u3067\u304D\u307E\u3059",
2115
- lighterFastTokenTooltip: "\u9AD8\u901F\u51FA\u91D1\u306FUSDC (Perps)\u6B8B\u9AD8\u3067\u306E\u307F\u5229\u7528\u3067\u304D\u307E\u3059"
2121
+ lighterFastTokenTooltip: "\u9AD8\u901F\u51FA\u91D1\u306FUSDC (Perps)\u6B8B\u9AD8\u3067\u306E\u307F\u5229\u7528\u3067\u304D\u307E\u3059",
2122
+ lighterWithdrawOnChain: "\u30AA\u30F3\u30C1\u30A7\u30FC\u30F3\u3067\u51FA\u91D1",
2123
+ lighterL1FallbackNotice: "Lighter\u306E\u30BB\u30AD\u30E5\u30A2\u51FA\u91D1\u306E\u30EC\u30FC\u30C8\u5236\u9650\u306B\u9054\u3057\u307E\u3057\u305F\u3002\u4EE3\u308F\u308A\u306B\u30AA\u30F3\u30C1\u30A7\u30FC\u30F3\u3067\u76F4\u63A5\u51FA\u91D1\u3067\u304D\u307E\u3059\u3002"
2116
2124
  },
2117
2125
  directExecution: {
2118
2126
  fillStatus: "\u51E6\u7406\u72B6\u6CC1",
@@ -2677,7 +2685,9 @@ var ko_default = {
2677
2685
  lighterSecureAddressTooltip: "\uC5F0\uACB0\uB41C \uC9C0\uAC11\uC73C\uB85C\uB9CC \uCD9C\uAE08\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4",
2678
2686
  lighterSecureTokenTooltip: "\uCD9C\uAE08\uD558\uB824\uB294 \uD1A0\uD070\uB9CC \uBC1B\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4",
2679
2687
  lighterSecureChainTooltip: "\uBCF4\uC548 \uCD9C\uAE08\uC740 \uC774\uB354\uB9AC\uC6C0\uC5D0\uC11C\uB9CC \uAC00\uB2A5\uD569\uB2C8\uB2E4",
2680
- lighterFastTokenTooltip: "\uBE60\uB978 \uCD9C\uAE08\uC740 USDC (Perps) \uC794\uC561\uC5D0\uC11C\uB9CC \uC774\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4"
2688
+ lighterFastTokenTooltip: "\uBE60\uB978 \uCD9C\uAE08\uC740 USDC (Perps) \uC794\uC561\uC5D0\uC11C\uB9CC \uC774\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4",
2689
+ lighterWithdrawOnChain: "\uC628\uCCB4\uC778\uC73C\uB85C \uCD9C\uAE08",
2690
+ lighterL1FallbackNotice: "Lighter\uC758 \uBCF4\uC548 \uCD9C\uAE08 \uD55C\uB3C4\uC5D0 \uB3C4\uB2EC\uD588\uC2B5\uB2C8\uB2E4. \uB300\uC2E0 \uC628\uCCB4\uC778\uC5D0\uC11C \uC9C1\uC811 \uCD9C\uAE08\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
2681
2691
  },
2682
2692
  directExecution: {
2683
2693
  fillStatus: "\uCC98\uB9AC \uC0C1\uD0DC",
@@ -3242,7 +3252,9 @@ var ru_default = {
3242
3252
  lighterSecureAddressTooltip: "\u0412\u044B\u0432\u043E\u0434 \u0432\u043E\u0437\u043C\u043E\u0436\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0451\u043D\u043D\u044B\u0439 \u043A\u043E\u0448\u0435\u043B\u0451\u043A",
3243
3253
  lighterSecureTokenTooltip: "\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0442\u043E\u0442 \u0442\u043E\u043A\u0435\u043D, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0432\u044B\u0432\u043E\u0434\u0438\u0442\u0435",
3244
3254
  lighterSecureChainTooltip: "\u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0439 \u0432\u044B\u0432\u043E\u0434 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0432 \u0441\u0435\u0442\u0438 Ethereum",
3245
- lighterFastTokenTooltip: "\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u0432\u044B\u0432\u043E\u0434 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0432\u0430\u0448\u0435\u0433\u043E \u0431\u0430\u043B\u0430\u043D\u0441\u0430 USDC (Perps)"
3255
+ lighterFastTokenTooltip: "\u0411\u044B\u0441\u0442\u0440\u044B\u0439 \u0432\u044B\u0432\u043E\u0434 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0442\u043E\u043B\u044C\u043A\u043E \u0434\u043B\u044F \u0432\u0430\u0448\u0435\u0433\u043E \u0431\u0430\u043B\u0430\u043D\u0441\u0430 USDC (Perps)",
3256
+ lighterWithdrawOnChain: "\u0412\u044B\u0432\u0435\u0441\u0442\u0438 \u0432 \u0441\u0435\u0442\u0438",
3257
+ lighterL1FallbackNotice: "\u0412\u044B \u0434\u043E\u0441\u0442\u0438\u0433\u043B\u0438 \u043B\u0438\u043C\u0438\u0442\u0430 \u0431\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u044B\u0445 \u0432\u044B\u0432\u043E\u0434\u043E\u0432 Lighter. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0432\u044B\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043D\u0430\u043F\u0440\u044F\u043C\u0443\u044E \u0432 \u0441\u0435\u0442\u0438."
3246
3258
  },
3247
3259
  directExecution: {
3248
3260
  fillStatus: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F",
@@ -3807,7 +3819,9 @@ var tr_default = {
3807
3819
  lighterSecureAddressTooltip: "Yaln\u0131zca ba\u011Fl\u0131 c\xFCzdan\u0131n\u0131za para \xE7ekebilirsiniz",
3808
3820
  lighterSecureTokenTooltip: "Yaln\u0131zca \xE7ekmeyi se\xE7ti\u011Finiz tokeni alabilirsiniz",
3809
3821
  lighterSecureChainTooltip: "G\xFCvenli \xE7ekimler yaln\u0131zca Ethereum'da kullan\u0131labilir",
3810
- lighterFastTokenTooltip: "H\u0131zl\u0131 \xE7ekimler yaln\u0131zca USDC (Perps) bakiyeniz i\xE7in kullan\u0131labilir"
3822
+ lighterFastTokenTooltip: "H\u0131zl\u0131 \xE7ekimler yaln\u0131zca USDC (Perps) bakiyeniz i\xE7in kullan\u0131labilir",
3823
+ lighterWithdrawOnChain: "Zincir \xFCzerinde \xE7ek",
3824
+ lighterL1FallbackNotice: "Lighter'\u0131n g\xFCvenli \xE7ekim h\u0131z s\u0131n\u0131r\u0131na ula\u015Ft\u0131n\u0131z. Bunun yerine do\u011Frudan zincir \xFCzerinden \xE7ekebilirsiniz."
3811
3825
  },
3812
3826
  directExecution: {
3813
3827
  fillStatus: "\u0130\u015Flem durumu",
@@ -4372,7 +4386,9 @@ var zh_default = {
4372
4386
  lighterSecureAddressTooltip: "\u60A8\u53EA\u80FD\u63D0\u73B0\u5230\u5DF2\u8FDE\u63A5\u7684\u94B1\u5305",
4373
4387
  lighterSecureTokenTooltip: "\u60A8\u53EA\u80FD\u63A5\u6536\u6240\u9009\u62E9\u63D0\u73B0\u7684\u4EE3\u5E01",
4374
4388
  lighterSecureChainTooltip: "\u5B89\u5168\u63D0\u73B0\u4EC5\u652F\u6301\u4EE5\u592A\u574A",
4375
- lighterFastTokenTooltip: "\u5FEB\u901F\u63D0\u73B0\u4EC5\u652F\u6301\u60A8\u7684 USDC (Perps) \u4F59\u989D"
4389
+ lighterFastTokenTooltip: "\u5FEB\u901F\u63D0\u73B0\u4EC5\u652F\u6301\u60A8\u7684 USDC (Perps) \u4F59\u989D",
4390
+ lighterWithdrawOnChain: "\u94FE\u4E0A\u63D0\u73B0",
4391
+ lighterL1FallbackNotice: "\u60A8\u5DF2\u8FBE\u5230 Lighter \u7684\u5B89\u5168\u63D0\u73B0\u9891\u7387\u9650\u5236\u3002\u60A8\u53EF\u4EE5\u6539\u4E3A\u76F4\u63A5\u5728\u94FE\u4E0A\u63D0\u73B0\u3002"
4376
4392
  },
4377
4393
  directExecution: {
4378
4394
  fillStatus: "\u586B\u5145\u72B6\u6001",
@@ -15,6 +15,7 @@ import {
15
15
  multicall,
16
16
  readContract,
17
17
  sendTransaction,
18
+ signTypedData,
18
19
  switchChain,
19
20
  waitForTransactionReceipt
20
21
  } from "wagmi/actions";
@@ -3,7 +3,7 @@ import {
3
3
  FunInput,
4
4
  FunSkeletonBlock,
5
5
  TooltipAnchorRefContext
6
- } from "./chunk-RCMAGKMG.js";
6
+ } from "./chunk-WRS7AFM2.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-HOORQPSY.js";
14
+ } from "./chunk-F6P4CN27.js";
15
15
  import {
16
16
  POLYMARKET_PERPS_ROUTING_ID,
17
17
  POLYMARKET_PREDICTIONS_ROUTING_ID
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-LUHEVXPD.js";
7
7
  import {
8
8
  useFunkitTranslation
9
- } from "./chunk-HOORQPSY.js";
9
+ } from "./chunk-F6P4CN27.js";
10
10
 
11
11
  // src/providers/FunkitConfigContext.tsx
12
12
  import {
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-LUHEVXPD.js";
10
10
  import {
11
11
  useFunkitTranslation
12
- } from "./chunk-HOORQPSY.js";
12
+ } from "./chunk-F6P4CN27.js";
13
13
  import "./chunk-AHYOV7AV.js";
14
14
 
15
15
  // src/clients/fanatics.tsx
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  NADO_SUPPORTED_PRODUCTS,
4
4
  fetchNadoProducts
5
- } from "../../chunk-APQYFP6X.js";
5
+ } from "../../chunk-A4WQS6QG.js";
6
6
  import {
7
7
  getNadoFeeRates,
8
8
  getNadoMaxWithdrawable,
@@ -17,7 +17,7 @@ import "../../chunk-L2KSNS7H.js";
17
17
  import {
18
18
  NadoGatewayError
19
19
  } from "../../chunk-2YWQL3AO.js";
20
- import "../../chunk-KNHO756P.js";
20
+ import "../../chunk-FJ6GCMJ4.js";
21
21
  import {
22
22
  useConfig
23
23
  } from "../../chunk-UPZNKPYU.js";
@@ -4,12 +4,12 @@ import {
4
4
  NADO_XSTOCK_WITHDRAWALS_ENABLED,
5
5
  fetchNadoProducts,
6
6
  isWithdrawableNadoProduct
7
- } from "../../chunk-APQYFP6X.js";
7
+ } from "../../chunk-A4WQS6QG.js";
8
8
  import "../../chunk-OZ3KD24N.js";
9
9
  import "../../chunk-II5CZTBC.js";
10
10
  import "../../chunk-L2KSNS7H.js";
11
11
  import "../../chunk-2YWQL3AO.js";
12
- import "../../chunk-KNHO756P.js";
12
+ import "../../chunk-FJ6GCMJ4.js";
13
13
  import "../../chunk-AHYOV7AV.js";
14
14
  export {
15
15
  NADO_SUPPORTED_PRODUCTS,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Nado withdrawal config type + guard. SDK-private — the `clients/internal/*`
3
+ * exports map blocks consumer imports; the public `clients/nado.tsx` module
4
+ * re-exports `NadoWithdrawalConfig` for integrators.
5
+ */
6
+ import type { CustomWithdrawalConfig, FunkitWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
7
+ import type { NadoWithdrawalCustomerConfig } from './withdrawalTypes';
8
+ export interface NadoWithdrawalConfig extends CustomWithdrawalConfig {
9
+ customerConfig: NadoWithdrawalCustomerConfig;
10
+ }
11
+ export declare function isNadoWithdrawalConfig(config: FunkitWithdrawalConfig | null | undefined): config is NadoWithdrawalConfig;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import "../../chunk-AHYOV7AV.js";
3
+
4
+ // src/utils/withdrawal.ts
5
+ import { isEVMAddressEquivalent, isTokenEquivalent } from "@funkit/utils";
6
+ import { parseUnits } from "viem";
7
+ function isCustomWithdrawalConfig(config) {
8
+ return "withdrawCallback" in config;
9
+ }
10
+
11
+ // src/clients/internal/nado/withdrawalConfig.ts
12
+ function isNadoWithdrawalConfig(config) {
13
+ return !!config && isCustomWithdrawalConfig(config) && config.customerConfig?.customerName === "nado";
14
+ }
15
+ export {
16
+ isNadoWithdrawalConfig
17
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Nado-specific members of the shared withdrawal discriminated unions. Kept in
3
+ * `clients/internal/nado/` (customer-isolated) and imported by the shared
4
+ * `WithdrawalCustomerData` / `WithdrawalCustomerConfig` aliases in
5
+ * `providers/FunkitCheckoutContext`. viem-only imports — no provider deps — so
6
+ * the shared→customer reference stays cycle-free.
7
+ */
8
+ import type { Address, Hex } from 'viem';
9
+ /**
10
+ * Nado per-submission form selections threaded to the withdrawal callback (the
11
+ * static config can't know them). `spotLeverage` must be explicit — Nado treats
12
+ * an absent value as borrowing, so `false` fails instead of opening a borrow.
13
+ */
14
+ export interface NadoWithdrawalCustomerData {
15
+ customerName: 'nado';
16
+ productId: number;
17
+ spotLeverage: boolean;
18
+ }
19
+ /**
20
+ * Nado config-level identity — the hook's **output**, not integrator input.
21
+ * `useNadoWithdrawalConfig` takes a `subaccountName` string and packs it into
22
+ * `subaccount` (Hex); consumers never author this.
23
+ */
24
+ export interface NadoWithdrawalCustomerConfig {
25
+ customerName: 'nado';
26
+ /** Connected wallet — must be the signer (Nado rejects linked signers). */
27
+ owner: Address;
28
+ /** Packed id of the active subaccount (`buildNadoSubaccountId`); the EIP-712/execute `sender`. */
29
+ subaccount: Hex;
30
+ }
@@ -0,0 +1 @@
1
+ "use client";
@@ -17,6 +17,7 @@ import { type Address } from 'viem';
17
17
  import type { CustomWithdrawalConfig, LighterRouteType, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
18
18
  export { LIGHTER_ROUTE_TYPE } from '../modals/WithdrawalModal/LighterWithdrawal';
19
19
  export type { LighterRouteType } from '../providers/FunkitCheckoutContext/types';
20
+ export { LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError, lighterWithdrawBaseUnits, } from '../utils/lighter';
20
21
  export type LighterTransferParams = {
21
22
  toAccountIndex: number;
22
23
  assetIndex: number;
@@ -2,27 +2,28 @@
2
2
  import {
3
3
  AsyncImage
4
4
  } from "./chunk-2NBYHUIW.js";
5
+ import "./chunk-FJ6GCMJ4.js";
5
6
  import {
6
7
  chainMetadataById,
7
8
  useFunkitConfig,
8
9
  useFunkitConnectChainsById
9
- } from "./chunk-RCMAGKMG.js";
10
+ } from "./chunk-WRS7AFM2.js";
10
11
  import {
11
12
  Box
12
13
  } from "./chunk-LUHEVXPD.js";
13
14
  import "./chunk-UPZNKPYU.js";
14
15
  import {
15
16
  useFunkitTranslation
16
- } from "./chunk-HOORQPSY.js";
17
+ } from "./chunk-F6P4CN27.js";
17
18
  import {
18
19
  logger
19
20
  } from "./chunk-AHYOV7AV.js";
20
21
 
21
22
  // src/clients/lighter.tsx
22
23
  import {
23
- DirectExecutionType,
24
+ DirectExecutionType as DirectExecutionType2,
24
25
  LIGHTERXYZ_API_KEY as LIGHTERXYZ_API_KEY2,
25
- createDirectExecution
26
+ createDirectExecution as createDirectExecution2
26
27
  } from "@funkit/api-base";
27
28
  import { LIGHTER_CHAIN_ID, SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
28
29
  import { RELAY_LIGHTER_CHAIN_ID as RELAY_LIGHTER_CHAIN_ID2 } from "@funkit/fun-relay";
@@ -30,8 +31,8 @@ import { retry } from "@lifeomic/attempt";
30
31
  import { useQuery as useQuery3 } from "@tanstack/react-query";
31
32
  import i18next from "i18next";
32
33
  import React4, { useMemo as useMemo2 } from "react";
33
- import { v4 as uuid } from "uuid";
34
- import { pad, parseUnits, toHex } from "viem";
34
+ import { v4 as uuid2 } from "uuid";
35
+ import { pad, parseUnits as parseUnits3, toHex } from "viem";
35
36
  import { arbitrum, base, bsc, mainnet as mainnet3, optimism } from "viem/chains";
36
37
 
37
38
  // src/components/ChainIcon/ChainIcon.tsx
@@ -148,11 +149,23 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React2.createElement(
148
149
  );
149
150
 
150
151
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
152
+ import {
153
+ DirectExecutionType,
154
+ createDirectExecution
155
+ } from "@funkit/api-base";
151
156
  import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
152
157
  import { formatAddress, formatCryptoAndStringify } from "@funkit/utils";
153
158
  import * as dnum from "dnum";
154
- import React3, { useEffect, useMemo } from "react";
159
+ import { v4 as uuid } from "uuid";
160
+ import React3, {
161
+ useCallback as useCallback3,
162
+ useEffect,
163
+ useMemo,
164
+ useRef,
165
+ useState
166
+ } from "react";
155
167
  import { createPortal } from "react-dom";
168
+ import { parseUnits as parseUnits2 } from "viem";
156
169
  import { mainnet as mainnet2 } from "viem/chains";
157
170
 
158
171
  // src/utils/customer.ts
@@ -229,6 +242,65 @@ function useLighterAccounts({
229
242
  };
230
243
  }
231
244
 
245
+ // src/utils/lighter.ts
246
+ import {
247
+ encodeFunctionData,
248
+ getAddress,
249
+ parseUnits
250
+ } from "viem";
251
+ var LIGHTER_DEPOSIT_ADDRESS = getAddress(
252
+ "0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7"
253
+ );
254
+ var LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS = 60 * 2;
255
+ var LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF = 60 * 5;
256
+ var LIGHTER_USDC_ASSET_INDEX = 3;
257
+ var LIGHTER_WITHDRAW_ABI = [
258
+ {
259
+ type: "function",
260
+ name: "withdraw",
261
+ stateMutability: "nonpayable",
262
+ inputs: [
263
+ { name: "accountIndex", type: "uint48" },
264
+ { name: "assetIndex", type: "uint16" },
265
+ { name: "routeType", type: "uint8" },
266
+ { name: "amount", type: "uint64" }
267
+ ],
268
+ outputs: []
269
+ }
270
+ ];
271
+ function truncateToDecimals(amount, decimals) {
272
+ const [whole = "0", frac = ""] = amount.split(".");
273
+ if (frac.length <= decimals) {
274
+ return amount;
275
+ }
276
+ const truncated = frac.slice(0, decimals);
277
+ return truncated ? `${whole}.${truncated}` : whole;
278
+ }
279
+ function lighterWithdrawBaseUnits(assetIndex, amountTokenUnits) {
280
+ const decimals = assetIndex === LIGHTER_USDC_ASSET_INDEX ? 6 : 8;
281
+ return parseUnits(truncateToDecimals(amountTokenUnits, decimals), decimals);
282
+ }
283
+ function buildLighterL1WithdrawTransaction(params) {
284
+ const { accountIndex, assetIndex, routeType, amountBaseUnit } = params;
285
+ const data = encodeFunctionData({
286
+ abi: LIGHTER_WITHDRAW_ABI,
287
+ functionName: "withdraw",
288
+ args: [accountIndex, assetIndex, routeType, amountBaseUnit]
289
+ });
290
+ return { to: LIGHTER_DEPOSIT_ADDRESS, data, value: 0n };
291
+ }
292
+ function isLighterWithdrawalRateLimitError(error) {
293
+ if (error && typeof error === "object" && "code" in error) {
294
+ const code = error.code;
295
+ if (code === 23004 || code === 23005) {
296
+ return true;
297
+ }
298
+ }
299
+ const raw = error instanceof Error ? error.message : typeof error === "string" ? error : error && typeof error === "object" && "message" in error ? String(error.message) : "";
300
+ const message = raw.toLowerCase();
301
+ return message.includes("23004") || message.includes("23005") || message.includes("rate limit") || message.includes("ratelimit");
302
+ }
303
+
232
304
  // src/utils/timeFormat.ts
233
305
  import { formatSecondsToReadableForm } from "@funkit/utils";
234
306
  function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSeconds = false) {
@@ -432,14 +504,6 @@ var LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS = {
432
504
  LDO: 2,
433
505
  AZTEC: 100
434
506
  };
435
- function truncateAmountToDecimals(amount, decimals) {
436
- const [whole = "0", frac = ""] = amount.split(".");
437
- if (frac.length <= decimals) {
438
- return amount;
439
- }
440
- const truncated = frac.slice(0, decimals);
441
- return truncated ? `${whole}.${truncated}` : whole;
442
- }
443
507
  async function trackLighterSecureWithdrawal({
444
508
  apiKey,
445
509
  userId,
@@ -461,17 +525,17 @@ async function trackLighterSecureWithdrawal({
461
525
  }
462
526
  const { symbol, decimals } = assetMeta;
463
527
  const estTotalUsd = Number(withdrawalUSD);
464
- const safeAmount = truncateAmountToDecimals(amountTokenUnits, decimals);
465
- const baseUnitAmount = parseUnits(safeAmount, decimals).toString();
528
+ const safeAmount = truncateToDecimals(amountTokenUnits, decimals);
529
+ const baseUnitAmount = parseUnits3(safeAmount, decimals).toString();
466
530
  const fromTokenAddress = pad(toHex(assetIndex), { size: 20 });
467
- await createDirectExecution({
531
+ await createDirectExecution2({
468
532
  apiKey,
469
533
  logger,
470
534
  // Lighter L2 tx hashes are not 0x-prefixed EVM hashes — they're the L2's
471
535
  // own format. We cast here for convenience to satisfy the DE row type;
472
536
  // the backend stores the literal string and we never use it as an EVM hash.
473
537
  txHash,
474
- type: DirectExecutionType.EXTERNALLY_FULFILLED,
538
+ type: DirectExecutionType2.EXTERNALLY_FULFILLED,
475
539
  userId,
476
540
  recipientAddr,
477
541
  fromChainId: LIGHTER_CHAIN_ID.toString(),
@@ -485,7 +549,7 @@ async function trackLighterSecureWithdrawal({
485
549
  // L1 owner of that account is the recipient (Secure locks to connected wallet).
486
550
  sourceOfFund: `balance|lighter-secure|${recipientAddr}`,
487
551
  clientMetadata: {
488
- id: uuid(),
552
+ id: uuid2(),
489
553
  startTimestampMs: Date.now(),
490
554
  finalDollarValue: estTotalUsd,
491
555
  latestQuote: null,
@@ -736,7 +800,11 @@ function useLighterWithdrawalConfig(config) {
736
800
  export {
737
801
  LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
738
802
  LIGHTER_ROUTE_TYPE,
803
+ LIGHTER_WITHDRAW_ABI,
804
+ buildLighterL1WithdrawTransaction,
739
805
  createLighterSecureWithdrawalConfig,
806
+ isLighterWithdrawalRateLimitError,
807
+ lighterWithdrawBaseUnits,
740
808
  trackLighterSecureWithdrawal,
741
809
  useLighterWithdrawalConfig
742
810
  };
@@ -4,14 +4,14 @@ import {
4
4
  sendTransaction,
5
5
  switchChain,
6
6
  waitForTransactionReceipt
7
- } from "./chunk-KNHO756P.js";
7
+ } from "./chunk-FJ6GCMJ4.js";
8
8
  import {
9
9
  useAccount,
10
10
  useConfig
11
11
  } from "./chunk-UPZNKPYU.js";
12
12
  import {
13
13
  useFunkitTranslation
14
- } from "./chunk-HOORQPSY.js";
14
+ } from "./chunk-F6P4CN27.js";
15
15
  import {
16
16
  logger
17
17
  } from "./chunk-AHYOV7AV.js";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-M6C7MBQN.js";
5
- import "../chunk-RCMAGKMG.js";
4
+ } from "../chunk-QHS5N7GP.js";
5
+ import "../chunk-WRS7AFM2.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
- import "../chunk-HOORQPSY.js";
8
+ import "../chunk-F6P4CN27.js";
9
9
  import "../chunk-YFHTV7DT.js";
10
10
  import "../chunk-6PIIYPQK.js";
11
11
  import "../chunk-AHYOV7AV.js";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  PolymarketDepositAccountDropdown
4
- } from "../chunk-M6C7MBQN.js";
5
- import "../chunk-RCMAGKMG.js";
4
+ } from "../chunk-QHS5N7GP.js";
5
+ import "../chunk-WRS7AFM2.js";
6
6
  import "../chunk-LUHEVXPD.js";
7
7
  import "../chunk-UPZNKPYU.js";
8
- import "../chunk-HOORQPSY.js";
8
+ import "../chunk-F6P4CN27.js";
9
9
  import {
10
10
  POLYMARKET_PERPS_ROUTING_ID,
11
11
  POLYMARKET_PREDICTIONS_ROUTING_ID,
@@ -1,6 +1,7 @@
1
1
  import { CheckoutRefundState, CheckoutState, type DirectExecution, RelayExecutionStatus } from '@funkit/api-base';
2
+ import { mapRelayExecutionStatusToCheckoutState } from '@funkit/connect-core';
2
3
  import type { MergedMultiStepDirectExecution } from '../domains/checkoutNotifications';
3
- export declare function mapRelayExecutionStatusToCheckoutState(status: RelayExecutionStatus): CheckoutState;
4
+ export { mapRelayExecutionStatusToCheckoutState };
4
5
  export declare function mapRelayExecutionStatusToRefundState(status: RelayExecutionStatus): CheckoutRefundState | undefined;
5
6
  export declare function useCheckoutDirectExecutionHistory({ initDirectExecution, disabled, }: {
6
7
  initDirectExecution?: DirectExecution;
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, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, } from './providers/FunkitCheckoutContext';
23
+ export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, NadoWithdrawalCustomerData, WithdrawalCustomerConfig, NadoWithdrawalCustomerConfig, 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';