@funkit/connect 9.11.0-next.0 → 9.12.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 (108) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/__generated__/default_feature_gates.d.ts +2 -0
  3. package/dist/clients/fanatics.css +1 -1
  4. package/dist/clients/fanatics.js +1 -1
  5. package/dist/clients/lighter.css +1 -1
  6. package/dist/clients/lighter.d.ts +0 -18
  7. package/dist/clients/lighter.js +5 -100
  8. package/dist/clients/polymarket.d.ts +97 -9
  9. package/dist/clients/polymarket.js +255 -37
  10. package/dist/components/Dialog/DialogContent.css.d.ts +1 -1
  11. package/dist/components/FunNotificationBanner/FunNotificationBanner.d.ts +1 -1
  12. package/dist/components/FunSelectBrokerage/FunSelectBrokerage.d.ts +5 -4
  13. package/dist/components/TransactionStatus/AnimatedText.d.ts +4 -0
  14. package/dist/consts/bluvo.d.ts +27 -0
  15. package/dist/domains/swapped.d.ts +1 -1
  16. package/dist/hooks/queries/useErc20Asset.d.ts +2 -1
  17. package/dist/hooks/useAssetPrice.d.ts +6 -2
  18. package/dist/hooks/useCheckoutDirectExecution.d.ts +7 -1
  19. package/dist/hooks/useTokenTransfer.d.ts +2 -1
  20. package/dist/index.css +11 -11
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1541 -1070
  23. package/dist/modals/CheckoutModal/Brokerage/SelectBrokerage.d.ts +1 -1
  24. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +1 -1
  25. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +16 -0
  26. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  27. package/dist/providers/FunkitCheckoutContext/types.d.ts +21 -1
  28. package/dist/providers/FunkitStatsigProvider.d.ts +1 -0
  29. package/dist/wallets/Wallet.d.ts +11 -0
  30. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  31. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  32. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  35. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  39. package/dist/wallets/walletConnectors/index.js +68 -68
  40. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  41. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  42. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  43. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  44. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  49. package/package.json +16 -16
  50. package/dist/chunk-64NZSUGQ.js +0 -368
  51. package/dist/chunk-B2B6HDIE.js +0 -238
  52. package/dist/chunk-OQNN7EMQ.js +0 -238
  53. package/dist/chunk-S65TG73G.js +0 -247
  54. package/dist/chunk-VLAOBEJN.js +0 -247
  55. package/dist/clients/chunk-3LSYVQXK.js +0 -289
  56. package/dist/clients/chunk-5HU2XDR2.js +0 -289
  57. package/dist/clients/chunk-DKWYHSW3.js +0 -225
  58. package/dist/clients/chunk-IPK5DVIL.js +0 -229
  59. package/dist/clients/chunk-PVOHWTSR.js +0 -289
  60. package/dist/clients/chunk-SBQ2UUPK.js +0 -214
  61. package/dist/components/Dropdown/TokenAndChainDropdown.css.d.ts +0 -1
  62. package/dist/hooks/track/CheckoutTrackingContext.d.ts +0 -60
  63. package/dist/hooks/useTokenChain.d.ts +0 -21
  64. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeContainer.d.ts +0 -17
  65. package/dist/modals/WithdrwalModal/WithdrawalCallbackSuccess.d.ts +0 -10
  66. package/dist/modals/WithdrwalModal/WithdrawalContent.d.ts +0 -11
  67. package/dist/modals/WithdrwalModal/WithdrawalModal.d.ts +0 -9
  68. package/dist/modals/WithdrwalModal/WithdrawalSuccess.d.ts +0 -15
  69. package/dist/modals/WithdrwalModal/types.d.ts +0 -5
  70. package/dist/modals/WithdrwalModal/useWithdrawal.d.ts +0 -24
  71. package/dist/wallets/walletConnectors/chunk-3ZJN3PXP.js +0 -87
  72. package/dist/wallets/walletConnectors/chunk-4C7ER452.js +0 -93
  73. package/dist/wallets/walletConnectors/chunk-53VYSPXK.js +0 -66
  74. package/dist/wallets/walletConnectors/chunk-55VS2NKG.js +0 -95
  75. package/dist/wallets/walletConnectors/chunk-6UCI7GM6.js +0 -98
  76. package/dist/wallets/walletConnectors/chunk-6YO27XOM.js +0 -96
  77. package/dist/wallets/walletConnectors/chunk-7IEUTLHY.js +0 -98
  78. package/dist/wallets/walletConnectors/chunk-7OARWILZ.js +0 -92
  79. package/dist/wallets/walletConnectors/chunk-AZYMJ4C6.js +0 -70
  80. package/dist/wallets/walletConnectors/chunk-CJJT7LMT.js +0 -96
  81. package/dist/wallets/walletConnectors/chunk-EKJHJFRN.js +0 -69
  82. package/dist/wallets/walletConnectors/chunk-FWM4KTOV.js +0 -106
  83. package/dist/wallets/walletConnectors/chunk-GH4M6FTK.js +0 -95
  84. package/dist/wallets/walletConnectors/chunk-GSHSWVEG.js +0 -70
  85. package/dist/wallets/walletConnectors/chunk-GVOQTORD.js +0 -87
  86. package/dist/wallets/walletConnectors/chunk-HETS3KKI.js +0 -218
  87. package/dist/wallets/walletConnectors/chunk-HOPH3TQ3.js +0 -99
  88. package/dist/wallets/walletConnectors/chunk-IICWJWGZ.js +0 -110
  89. package/dist/wallets/walletConnectors/chunk-IMNI4AGV.js +0 -99
  90. package/dist/wallets/walletConnectors/chunk-IRHK6SOW.js +0 -218
  91. package/dist/wallets/walletConnectors/chunk-J3PJOMO7.js +0 -96
  92. package/dist/wallets/walletConnectors/chunk-KO56HCTI.js +0 -106
  93. package/dist/wallets/walletConnectors/chunk-LEAZMT5Y.js +0 -92
  94. package/dist/wallets/walletConnectors/chunk-LI6QY2B5.js +0 -94
  95. package/dist/wallets/walletConnectors/chunk-OD6B2ISG.js +0 -69
  96. package/dist/wallets/walletConnectors/chunk-OSOB6QYX.js +0 -92
  97. package/dist/wallets/walletConnectors/chunk-PKMAPNN6.js +0 -92
  98. package/dist/wallets/walletConnectors/chunk-RZQ4B4Z7.js +0 -96
  99. package/dist/wallets/walletConnectors/chunk-TTHM3WUR.js +0 -100
  100. package/dist/wallets/walletConnectors/chunk-UFYNHHDU.js +0 -100
  101. package/dist/wallets/walletConnectors/chunk-UYW6MV74.js +0 -93
  102. package/dist/wallets/walletConnectors/chunk-VMMROPXK.js +0 -110
  103. package/dist/wallets/walletConnectors/chunk-XBLHZICW.js +0 -103
  104. package/dist/wallets/walletConnectors/chunk-YGMU5VWD.js +0 -66
  105. package/dist/wallets/walletConnectors/chunk-ZJJWGKB6.js +0 -103
  106. package/dist/wallets/walletConnectors/chunk-ZL6XCMV5.js +0 -94
  107. /package/dist/clients/{chunk-GCAV3VTB.js → chunk-LMEQD56M.js} +0 -0
  108. /package/dist/{hooks → utils}/statsig/checkFeatureGate.d.ts +0 -0
@@ -1,15 +1,23 @@
1
1
  /**
2
2
  * Polymarket V2 PMCT withdrawal.
3
3
  *
4
- * Withdrawal flow:
5
- * 1. Generate a UDA (User Deposit Address) for the withdrawal via api-base
6
- * 2. Transfer PMCT from user's Polymarket proxy to the UDA
7
- * 3. Backend handles: unwrap PMCT → USDC via PermissionedRamp + route to user
4
+ * Two flows are supported, dispatched on input shape:
8
5
  *
9
- * The callback conforms to CustomWithdrawalConfig.withdrawCallback.
6
+ * 1. **UDA / PMCT transfer** (legacy) — caller supplies `userId` +
7
+ * `sendPmctTransfer`. The backend handles the unwrap/route via
8
+ * PermissionedRamp. Returns a {@link CustomWithdrawalConfig}.
9
+ *
10
+ * 2. **Wallet unwrap** — caller supplies `proxyAddress`, a `publicClient`,
11
+ * and a batched `sendTransactions` primitive. `preWithdrawalAction`
12
+ * reads the pUSD allowance and returns the approve (when needed) +
13
+ * `unwrap()` to USDCe as an array of {@link WithdrawalTransaction}s.
14
+ * The SDK prepends those to the withdrawal txn and atomically broadcasts
15
+ * the batch via the integrator's `sendTransactions`. Returns a
16
+ * {@link WalletWithdrawalConfig}.
10
17
  */
11
- import type { Address } from 'viem';
12
- import type { CustomWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
18
+ import { type Address, type PublicClient, type TransactionReceipt } from 'viem';
19
+ import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
20
+ import type { WithdrawalTransaction } from '../wallets/Wallet';
13
21
  export interface PolymarketWithdrawalCallbackConfig {
14
22
  userId: string;
15
23
  modalTitle?: string;
@@ -31,9 +39,69 @@ export interface PolymarketWithdrawalCallbackConfig {
31
39
  }) => Promise<void>;
32
40
  }
33
41
  /**
34
- * Creates a full CustomWithdrawalConfig for Polymarket V2 PMCT withdrawals.
42
+ * Caller-supplied batched submitter. Receives the full ordered list of txs
43
+ * (helper-injected approve+unwrap, then the SDK's withdrawal txn). Must
44
+ * broadcast them atomically in a single user signature and return a tx hash
45
+ * that {@link WithdrawalClient.confirmTransaction} can wait on.
46
+ */
47
+ export type PolymarketSendTransactions = (txs: WithdrawalTransaction[]) => Promise<string>;
48
+ export interface PolymarketWalletUnwrapWithdrawalConfig {
49
+ /** Polymarket proxy that holds pUSD and signs the batched tx. */
50
+ proxyAddress: Address;
51
+ /** Polygon public client used for the pre-flight allowance read. */
52
+ publicClient: PublicClient;
53
+ /**
54
+ * Batched send primitive. The SDK passes the full ordered list of txs —
55
+ * helper-emitted `approve(pUSD → offramp)` (only when allowance is
56
+ * insufficient) and `offramp.unwrap(USDCe, proxy, amount)` from
57
+ * `preWithdrawalAction`, followed by the withdrawal txn — and the
58
+ * integrator broadcasts them atomically in a single user signature.
59
+ */
60
+ sendTransactions: PolymarketSendTransactions;
61
+ /**
62
+ * Optional override for waiting on a tx receipt. Defaults to
63
+ * `publicClient.waitForTransactionReceipt`.
64
+ */
65
+ confirmTransaction?: (txHash: string, chainId: number) => Promise<TransactionReceipt>;
66
+ modalTitle?: string;
67
+ disableConnectedWallet?: boolean;
68
+ sourceTokenSymbol?: string;
69
+ sourceTokenAddress?: Address;
70
+ defaultReceiveToken?: string;
71
+ iconSrc?: string;
72
+ }
73
+ /**
74
+ * Combined input — supplies params for both flows. The runtime path is
75
+ * chosen at call time via the `enable-polymarket-wallet-withdrawal`
76
+ * Statsig gate (read synchronously through {@link checkFeatureGate}, so
77
+ * this stays a regular function callable from event handlers).
78
+ */
79
+ export interface PolymarketWithdrawalConfig extends PolymarketWithdrawalCallbackConfig, PolymarketWalletUnwrapWithdrawalConfig {
80
+ }
81
+ /**
82
+ * Combined / gated entry point. Returns a {@link CustomWithdrawalConfig}
83
+ * (UDA path) or {@link WalletWithdrawalConfig} (wallet-unwrap path)
84
+ * depending on the gate value at call time.
85
+ *
86
+ * ```ts
87
+ * const withdrawalConfig = createPolymarketWithdrawalConfig({
88
+ * userId: walletAddress,
89
+ * sendPmctTransfer: async ({ udaAddress, amountBaseUnit }) => { ... },
90
+ * proxyAddress,
91
+ * publicClient,
92
+ * sendTransactions: async (txs) => myBatchedSend(txs),
93
+ * })
94
+ * ```
95
+ */
96
+ export declare function createPolymarketWithdrawalConfig(config: PolymarketWithdrawalConfig): FunkitWithdrawalConfig;
97
+ /**
98
+ * Legacy UDA / PMCT transfer flow. Returns a {@link CustomWithdrawalConfig}.
99
+ *
100
+ * @deprecated Pass the combined {@link PolymarketWithdrawalConfig} instead so
101
+ * the wallet-unwrap rollout can be staged via the
102
+ * `enable-polymarket-wallet-withdrawal` Statsig gate. Direct callers of this
103
+ * single-flow overload bypass the gate.
35
104
  *
36
- * Usage:
37
105
  * ```ts
38
106
  * const withdrawalConfig = createPolymarketWithdrawalConfig({
39
107
  * userId: walletAddress,
@@ -42,3 +110,23 @@ export interface PolymarketWithdrawalCallbackConfig {
42
110
  * ```
43
111
  */
44
112
  export declare function createPolymarketWithdrawalConfig(config: PolymarketWithdrawalCallbackConfig): CustomWithdrawalConfig;
113
+ /**
114
+ * Wallet-flow with embedded pUSD → USDCe unwrap. Returns a
115
+ * {@link WalletWithdrawalConfig} whose `preWithdrawalAction` and `wallet`
116
+ * coordinate via a closure-scoped queue, so the integrator only sees the
117
+ * batched `sendTransactions` primitive.
118
+ *
119
+ * @deprecated Pass the combined {@link PolymarketWithdrawalConfig} instead so
120
+ * the wallet-unwrap rollout can be staged via the
121
+ * `enable-polymarket-wallet-withdrawal` Statsig gate. Direct callers of this
122
+ * single-flow overload bypass the gate.
123
+ *
124
+ * ```ts
125
+ * const withdrawalConfig = createPolymarketWithdrawalConfig({
126
+ * proxyAddress,
127
+ * publicClient,
128
+ * sendTransactions: async (txs) => myBatchedSend(txs),
129
+ * })
130
+ * ```
131
+ */
132
+ export declare function createPolymarketWithdrawalConfig(config: PolymarketWalletUnwrapWithdrawalConfig): WalletWithdrawalConfig;
@@ -8,14 +8,22 @@ import {
8
8
  POLYMARKET_API_KEY,
9
9
  initializeCheckoutTokenTransferAddress
10
10
  } from "@funkit/api-base";
11
+ import {
12
+ encodeFunctionData,
13
+ erc20Abi,
14
+ getAddress
15
+ } from "viem";
11
16
  import { polygon } from "viem/chains";
12
17
 
13
18
  // src/domains/paymentMethods.ts
14
19
  import { exhaustiveCheck, formatAddress } from "@funkit/utils";
15
20
 
16
21
  // src/consts/bluvo.tsx
17
- import { ETHEREAL_API_KEY } from "@funkit/api-base";
18
- import React6 from "react";
22
+ import {
23
+ ETHEREAL_API_KEY,
24
+ FormOfPaymentType
25
+ } from "@funkit/api-base";
26
+ import React7 from "react";
19
27
 
20
28
  // src/components/Icons/BinanceIcon.tsx
21
29
  import React from "react";
@@ -47,10 +55,51 @@ var BinanceIcon = ({ size = 24 }) => {
47
55
  );
48
56
  };
49
57
 
50
- // src/components/Icons/CoinbaseIcon.tsx
58
+ // src/components/Icons/BybitIcon.tsx
51
59
  import React2 from "react";
52
- var CoinbaseIcon = ({ size = 24 }) => {
60
+ var BybitIcon = ({ size = 24 }) => {
53
61
  return /* @__PURE__ */ React2.createElement(
62
+ "svg",
63
+ {
64
+ width: size,
65
+ height: size,
66
+ viewBox: "0 0 20 20",
67
+ fill: "none",
68
+ xmlns: "http://www.w3.org/2000/svg"
69
+ },
70
+ /* @__PURE__ */ React2.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#0B0E11" }),
71
+ /* @__PURE__ */ React2.createElement("g", { transform: "translate(2 6.78) scale(0.184)" }, /* @__PURE__ */ React2.createElement("path", { d: "M62.0083 25.3572V3H66.5022V25.3572H62.0083Z", fill: "#F7A600" }), /* @__PURE__ */ React2.createElement(
72
+ "path",
73
+ {
74
+ d: "M9.63407 31.9983H0V9.64111H9.24666C13.7406 9.64111 16.3591 12.0903 16.3591 15.9214C16.3591 18.4013 14.6774 20.0039 13.5134 20.5375C14.9028 21.1652 16.6813 22.5779 16.6813 25.5624C16.6813 29.7373 13.7406 31.9983 9.63407 31.9983ZM8.89096 13.5355H4.4939V18.6852H8.89096C10.7981 18.6852 11.8652 17.6488 11.8652 16.1095C11.8652 14.5719 10.7981 13.5355 8.89096 13.5355ZM9.18151 22.6104H4.4939V28.1056H9.18151C11.2189 28.1056 12.1874 26.8503 12.1874 25.3418C12.1874 23.835 11.2171 22.6104 9.18151 22.6104Z",
75
+ fill: "white"
76
+ }
77
+ ), /* @__PURE__ */ React2.createElement(
78
+ "path",
79
+ {
80
+ d: "M30.3882 22.8293V31.9983H25.926V22.8293L19.0073 9.64111H23.8886L28.1888 18.6527L32.4239 9.64111H37.3052L30.3882 22.8293Z",
81
+ fill: "white"
82
+ }
83
+ ), /* @__PURE__ */ React2.createElement(
84
+ "path",
85
+ {
86
+ d: "M50.0457 31.9983H40.4116V9.64111H49.6583C54.1522 9.64111 56.7707 12.0903 56.7707 15.9214C56.7707 18.4013 55.089 20.0039 53.925 20.5375C55.3144 21.1652 57.093 22.5779 57.093 25.5624C57.093 29.7373 54.1522 31.9983 50.0457 31.9983ZM49.3026 13.5355H44.9055V18.6852H49.3026C51.2097 18.6852 52.2768 17.6488 52.2768 16.1095C52.2768 14.5719 51.2097 13.5355 49.3026 13.5355ZM49.5931 22.6104H44.9055V28.1056H49.5931C51.6305 28.1056 52.599 26.8503 52.599 25.3418C52.599 23.835 51.6305 22.6104 49.5931 22.6104Z",
87
+ fill: "white"
88
+ }
89
+ ), /* @__PURE__ */ React2.createElement(
90
+ "path",
91
+ {
92
+ d: "M80.986 13.5355V32H76.4921V13.5355H70.4785V9.64111H86.9996V13.5355H80.986Z",
93
+ fill: "white"
94
+ }
95
+ ))
96
+ );
97
+ };
98
+
99
+ // src/components/Icons/CoinbaseIcon.tsx
100
+ import React3 from "react";
101
+ var CoinbaseIcon = ({ size = 24 }) => {
102
+ return /* @__PURE__ */ React3.createElement(
54
103
  "svg",
55
104
  {
56
105
  xmlns: "http://www.w3.org/2000/svg",
@@ -59,8 +108,8 @@ var CoinbaseIcon = ({ size = 24 }) => {
59
108
  viewBox: "0 0 20 20",
60
109
  fill: "none"
61
110
  },
62
- /* @__PURE__ */ React2.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#2C5FF6" }),
63
- /* @__PURE__ */ React2.createElement(
111
+ /* @__PURE__ */ React3.createElement("rect", { width: "20", height: "20", rx: "4", fill: "#2C5FF6" }),
112
+ /* @__PURE__ */ React3.createElement(
64
113
  "path",
65
114
  {
66
115
  d: "M9.99 13.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5c1.76 0 3.22 1.305 3.46 3h3.52A7.005 7.005 0 0 0 9.99 3c-3.86 0-7 3.14-7 7s3.14 7 7 7c3.69 0 6.725-2.87 6.98-6.5h-3.52c-.24 1.695-1.7 3-3.46 3Z",
@@ -71,9 +120,9 @@ var CoinbaseIcon = ({ size = 24 }) => {
71
120
  };
72
121
 
73
122
  // src/components/Icons/GateIoIcon.tsx
74
- import React3 from "react";
123
+ import React4 from "react";
75
124
  var GateIoIcon = ({ size = 24 }) => {
76
- return /* @__PURE__ */ React3.createElement(
125
+ return /* @__PURE__ */ React4.createElement(
77
126
  "svg",
78
127
  {
79
128
  width: size,
@@ -82,8 +131,8 @@ var GateIoIcon = ({ size = 24 }) => {
82
131
  fill: "none",
83
132
  xmlns: "http://www.w3.org/2000/svg"
84
133
  },
85
- /* @__PURE__ */ React3.createElement("rect", { width: "25", height: "25", rx: "5.357", fill: "#fff" }),
86
- /* @__PURE__ */ React3.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ React3.createElement(
134
+ /* @__PURE__ */ React4.createElement("rect", { width: "25", height: "25", rx: "5.357", fill: "#fff" }),
135
+ /* @__PURE__ */ React4.createElement("g", { clipPath: "url(#a)" }, /* @__PURE__ */ React4.createElement(
87
136
  "mask",
88
137
  {
89
138
  id: "b",
@@ -94,8 +143,8 @@ var GateIoIcon = ({ size = 24 }) => {
94
143
  height: "15",
95
144
  style: { maskType: "luminance" }
96
145
  },
97
- /* @__PURE__ */ React3.createElement("path", { d: "M5 5h15v15H5V5Z", fill: "#fff" })
98
- ), /* @__PURE__ */ React3.createElement("g", { mask: "url(#b)" }, /* @__PURE__ */ React3.createElement(
146
+ /* @__PURE__ */ React4.createElement("path", { d: "M5 5h15v15H5V5Z", fill: "#fff" })
147
+ ), /* @__PURE__ */ React4.createElement("g", { mask: "url(#b)" }, /* @__PURE__ */ React4.createElement(
99
148
  "path",
100
149
  {
101
150
  fillRule: "evenodd",
@@ -103,7 +152,7 @@ var GateIoIcon = ({ size = 24 }) => {
103
152
  d: "M12.5 16.625a4.125 4.125 0 0 1 0-8.25V5a7.5 7.5 0 1 0 7.5 7.5h-3.375a4.125 4.125 0 0 1-4.125 4.125Z",
104
153
  fill: "#2354E6"
105
154
  }
106
- )), /* @__PURE__ */ React3.createElement(
155
+ )), /* @__PURE__ */ React4.createElement(
107
156
  "path",
108
157
  {
109
158
  fillRule: "evenodd",
@@ -112,14 +161,14 @@ var GateIoIcon = ({ size = 24 }) => {
112
161
  fill: "#17E6A1"
113
162
  }
114
163
  )),
115
- /* @__PURE__ */ React3.createElement("defs", null, /* @__PURE__ */ React3.createElement("clipPath", { id: "a" }, /* @__PURE__ */ React3.createElement("path", { fill: "#fff", transform: "translate(5 5)", d: "M0 0h15v15H0z" })))
164
+ /* @__PURE__ */ React4.createElement("defs", null, /* @__PURE__ */ React4.createElement("clipPath", { id: "a" }, /* @__PURE__ */ React4.createElement("path", { fill: "#fff", transform: "translate(5 5)", d: "M0 0h15v15H0z" })))
116
165
  );
117
166
  };
118
167
 
119
168
  // src/components/Icons/GeminiIcon.tsx
120
- import React4 from "react";
169
+ import React5 from "react";
121
170
  var GeminiIcon = ({ size = 24 }) => {
122
- return /* @__PURE__ */ React4.createElement(
171
+ return /* @__PURE__ */ React5.createElement(
123
172
  "svg",
124
173
  {
125
174
  width: size,
@@ -128,14 +177,14 @@ var GeminiIcon = ({ size = 24 }) => {
128
177
  fill: "none",
129
178
  xmlns: "http://www.w3.org/2000/svg"
130
179
  },
131
- /* @__PURE__ */ React4.createElement(
180
+ /* @__PURE__ */ React5.createElement(
132
181
  "path",
133
182
  {
134
183
  d: "M16 0H4a4 4 0 0 0-4 4v12a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4",
135
184
  fill: "#58C8E6"
136
185
  }
137
186
  ),
138
- /* @__PURE__ */ React4.createElement(
187
+ /* @__PURE__ */ React5.createElement(
139
188
  "path",
140
189
  {
141
190
  d: "M15.025 7.686H8.661a3.21 3.21 0 0 1 3.182-2.746 3.21 3.21 0 0 1 3.182 2.746m-3.653.94v2.746H8.626V8.626zm-.035 3.686a3.21 3.21 0 0 1-3.182 2.746 3.21 3.21 0 0 1-3.183-2.746zm-6.365-.94A3.23 3.23 0 0 1 7.686 8.66v2.71zm10.053-2.746a3.23 3.23 0 0 1-2.711 2.71v-2.71zM11.843 4C9.734 4 7.937 5.624 7.712 7.712A4.18 4.18 0 0 0 4 11.843 4.16 4.16 0 0 0 8.157 16c2.109 0 3.909-1.624 4.131-3.712C14.376 12.063 16 10.266 16 8.157A4.16 4.16 0 0 0 11.843 4",
@@ -146,9 +195,9 @@ var GeminiIcon = ({ size = 24 }) => {
146
195
  };
147
196
 
148
197
  // src/components/Icons/KrakenIcon.tsx
149
- import React5 from "react";
198
+ import React6 from "react";
150
199
  var KrakenIcon = ({ size = 24 }) => {
151
- return /* @__PURE__ */ React5.createElement(
200
+ return /* @__PURE__ */ React6.createElement(
152
201
  "svg",
153
202
  {
154
203
  width: size,
@@ -157,14 +206,14 @@ var KrakenIcon = ({ size = 24 }) => {
157
206
  fill: "none",
158
207
  xmlns: "http://www.w3.org/2000/svg"
159
208
  },
160
- /* @__PURE__ */ React5.createElement(
209
+ /* @__PURE__ */ React6.createElement(
161
210
  "path",
162
211
  {
163
212
  d: "M16 0H4a4 4 0 0 0-4 4v12a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V4a4 4 0 0 0-4-4",
164
213
  fill: "#5741D9"
165
214
  }
166
215
  ),
167
- /* @__PURE__ */ React5.createElement(
216
+ /* @__PURE__ */ React6.createElement(
168
217
  "path",
169
218
  {
170
219
  d: "M4 11.78v-.67a6.4 6.4 0 0 1 .83-3.26 6 6 0 0 1 2.64-2.3A6 6 0 0 1 9.89 5q1.84-.02 3.4.96a5.6 5.6 0 0 1 2.64 4.18q.1.9.07 1.82l-.01.98q0 .22-.05.43c-.15.54-.8.8-1.27.49a.8.8 0 0 1-.35-.57l-.04-.48v-1.98q0-.4-.26-.68a.83.83 0 0 0-1.17-.04 1 1 0 0 0-.32.65v.28l-.01 2.19c0 .41-.33.73-.76.76a1 1 0 0 1-.56-.17.8.8 0 0 1-.3-.48l-.03-.33v-2.2a1 1 0 0 0-.26-.65.84.84 0 0 0-1.25.02 1 1 0 0 0-.24.64V13q0 .28-.1.54a1 1 0 0 1-.32.34.8.8 0 0 1-1.17-.4 1 1 0 0 1-.07-.38V11q.01-.24-.05-.47a.9.9 0 0 0-.72-.62c-.37-.06-.65.11-.85.4q-.14.22-.14.46v2q.02.3-.04.59a.84.84 0 0 1-.87.63.9.9 0 0 1-.74-.63A1 1 0 0 1 4 13z",
@@ -180,29 +229,32 @@ var BLUVO_MIN_DEPOSIT_BY_CUSTOMER = {
180
229
  };
181
230
  var BLUVO_EXCHANGES = {
182
231
  coinbase: {
183
- icon: (size) => /* @__PURE__ */ React6.createElement(CoinbaseIcon, { size }),
232
+ icon: (size) => /* @__PURE__ */ React7.createElement(CoinbaseIcon, { size }),
184
233
  name: "Coinbase"
185
234
  },
186
235
  binance: {
187
- icon: (size) => /* @__PURE__ */ React6.createElement(BinanceIcon, { size }),
236
+ icon: (size) => /* @__PURE__ */ React7.createElement(BinanceIcon, { size }),
188
237
  name: "Binance"
189
238
  },
190
239
  gemini: {
191
- icon: (size) => /* @__PURE__ */ React6.createElement(GeminiIcon, { size }),
240
+ icon: (size) => /* @__PURE__ */ React7.createElement(GeminiIcon, { size }),
192
241
  name: "Gemini"
193
242
  },
194
243
  kraken: {
195
- icon: (size) => /* @__PURE__ */ React6.createElement(KrakenIcon, { size }),
244
+ icon: (size) => /* @__PURE__ */ React7.createElement(KrakenIcon, { size }),
196
245
  name: "Kraken"
197
246
  },
198
247
  gate: {
199
- icon: (size) => /* @__PURE__ */ React6.createElement(GateIoIcon, { size }),
248
+ icon: (size) => /* @__PURE__ */ React7.createElement(GateIoIcon, { size }),
200
249
  name: "Gate"
201
250
  }
202
251
  };
203
252
  function getExchangeName(brokerType) {
204
253
  return BLUVO_EXCHANGES[brokerType].name;
205
254
  }
255
+ var FOP_COMPONENT_ICONS = {
256
+ [FormOfPaymentType.BYBIT]: (size) => /* @__PURE__ */ React7.createElement(BybitIcon, { size })
257
+ };
206
258
 
207
259
  // src/domains/paymentMethods.ts
208
260
  function createPaymentMethodInfo(params) {
@@ -276,9 +328,71 @@ function generateClientMetadataForTokenTransfer() {
276
328
  };
277
329
  }
278
330
 
331
+ // src/utils/statsig/checkFeatureGate.ts
332
+ import { StatsigClient } from "@statsig/react-bindings";
333
+
334
+ // src/providers/FunkitStatsigProvider.tsx
335
+ import { datadogLogs } from "@datadog/browser-logs";
336
+ import {
337
+ LogEventCompressionMode,
338
+ LogLevel,
339
+ StatsigProvider,
340
+ useClientAsyncInit
341
+ } from "@statsig/react-bindings";
342
+ import React8, { useEffect } from "react";
343
+ var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
344
+
345
+ // src/__generated__/default_feature_gates.ts
346
+ var default_feature_gates_default = {
347
+ "compliance-review-blocker": false,
348
+ "enable-across-wallet-flow": false,
349
+ "enable-empty-withdrawal-selection": false,
350
+ "enable-permit-toggle": false,
351
+ "enable-polymarket-wallet-withdrawal": false,
352
+ "enable-swapped-exchanges": false,
353
+ "exact-in": false,
354
+ "faster-notifications": false,
355
+ "new-token-transfer-config": false,
356
+ "new-withdrawal-config": false,
357
+ "polymarket-pusd-migration": false,
358
+ "saved-card-defaults-to-fiat-tab": false,
359
+ "test-testing-gate": false,
360
+ "wallet-flow-enable-exact-input-with-actions": false,
361
+ "you-receive-remove-swap-impact": false
362
+ };
363
+
364
+ // src/utils/statsig/checkFeatureGate.ts
365
+ function checkFeatureGate(name) {
366
+ try {
367
+ return StatsigClient.instance(STATSIG_CLIENT_KEY).checkGate(name);
368
+ } catch (err) {
369
+ logger.warn("checkFeatureGate:error", { name, err });
370
+ return default_feature_gates_default[name];
371
+ }
372
+ }
373
+
279
374
  // src/clients/polymarket.tsx
280
375
  var PMCT_WITHDRAW_ACTION_TYPE = "PMCT_WITHDRAW";
281
376
  var POLYGON_USDCE = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
377
+ var PUSD_TOKEN = {
378
+ address: getAddress("0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB"),
379
+ symbol: "pUSD",
380
+ iconSrc: "https://sdk-cdn.fun.xyz/images/pusd.svg"
381
+ };
382
+ var PUSD_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
383
+ var PUSD_OFFRAMP_ABI = [
384
+ {
385
+ name: "unwrap",
386
+ type: "function",
387
+ inputs: [
388
+ { name: "_asset", type: "address" },
389
+ { name: "_to", type: "address" },
390
+ { name: "_amount", type: "uint256" }
391
+ ],
392
+ outputs: [],
393
+ stateMutability: "nonpayable"
394
+ }
395
+ ];
282
396
  function createPolymarketWithdrawalCallback(config) {
283
397
  const { userId, sendPmctTransfer } = config;
284
398
  return async (param) => {
@@ -304,24 +418,20 @@ function createPolymarketWithdrawalCallback(config) {
304
418
  });
305
419
  const udaAddress = transferInit.depositAddr;
306
420
  logger.info("polymarket:withdrawal:udaGenerated", { udaAddress });
307
- const quote = funQuote;
308
- const amountStr = quote?.baseQuote?.estTotalFromAmountBaseUnit;
309
- if (!amountStr) {
310
- logger.error("polymarket:withdrawal:missingAmountInQuote", { quote });
311
- throw new Error("Missing withdrawal amount in quote");
312
- }
313
- const amount = BigInt(amountStr);
421
+ const amountBaseUnit = extractWithdrawalAmount(funQuote);
314
422
  await sendPmctTransfer({
315
423
  udaAddress,
316
- amountBaseUnit: amount
424
+ amountBaseUnit
317
425
  });
318
426
  logger.info("polymarket:withdrawal:transferSubmitted", {
319
427
  udaAddress,
320
- amountBaseUnit: amountStr
428
+ amountBaseUnit: amountBaseUnit.toString()
321
429
  });
430
+ return void 0;
322
431
  };
323
432
  }
324
- function createPolymarketWithdrawalConfig(config) {
433
+ function buildUdaWithdrawalConfig(config) {
434
+ logger.info("polymarket:withdrawal:flow", { flow: "uda" });
325
435
  return {
326
436
  modalTitle: config.modalTitle ?? "Withdraw",
327
437
  disableConnectedWallet: config.disableConnectedWallet,
@@ -334,6 +444,114 @@ function createPolymarketWithdrawalConfig(config) {
334
444
  getMinWithdrawalUSD: () => 3
335
445
  };
336
446
  }
447
+ function buildWalletUnwrapWithdrawalConfig(config) {
448
+ logger.info("polymarket:withdrawal:flow", { flow: "wallet-unwrap" });
449
+ const {
450
+ proxyAddress,
451
+ publicClient,
452
+ sendTransactions: callerSendTransactions,
453
+ confirmTransaction
454
+ } = config;
455
+ const wallet = {
456
+ address: () => proxyAddress,
457
+ getChainId: async () => polygon.id,
458
+ switchChain: async (chainId) => {
459
+ if (chainId !== polygon.id) {
460
+ throw new Error(
461
+ `Cannot switch chain: Polymarket withdrawal is fixed to ${polygon.id}, requested ${chainId}`
462
+ );
463
+ }
464
+ },
465
+ sendTransaction: async (_chainId, transaction) => callerSendTransactions([transaction]),
466
+ sendTransactions: async (_chainId, txs) => callerSendTransactions(txs),
467
+ confirmTransaction: confirmTransaction ?? (async (txHash) => publicClient.waitForTransactionReceipt({ hash: txHash }))
468
+ };
469
+ const preWithdrawalAction = async ({
470
+ funQuote
471
+ }) => {
472
+ logger.info("polymarket:withdrawal:wallet:start", { proxyAddress });
473
+ try {
474
+ const amountBaseUnit = extractWithdrawalAmount(funQuote);
475
+ const currentAllowance = await publicClient.readContract({
476
+ address: PUSD_TOKEN.address,
477
+ abi: erc20Abi,
478
+ functionName: "allowance",
479
+ args: [proxyAddress, PUSD_OFFRAMP_ADDRESS]
480
+ });
481
+ const needsApprovalTx = currentAllowance < amountBaseUnit;
482
+ logger.info("polymarket:withdrawal:wallet:allowanceChecked", {
483
+ proxyAddress,
484
+ amountBaseUnit: amountBaseUnit.toString(),
485
+ currentAllowance: currentAllowance.toString(),
486
+ needsApprovalTx
487
+ });
488
+ const txs = [];
489
+ if (needsApprovalTx) {
490
+ txs.push({
491
+ to: PUSD_TOKEN.address,
492
+ data: encodeFunctionData({
493
+ abi: erc20Abi,
494
+ functionName: "approve",
495
+ args: [PUSD_OFFRAMP_ADDRESS, amountBaseUnit]
496
+ }),
497
+ value: "0"
498
+ });
499
+ }
500
+ txs.push({
501
+ to: PUSD_OFFRAMP_ADDRESS,
502
+ data: encodeFunctionData({
503
+ abi: PUSD_OFFRAMP_ABI,
504
+ functionName: "unwrap",
505
+ args: [POLYGON_USDCE, proxyAddress, amountBaseUnit]
506
+ }),
507
+ value: "0"
508
+ });
509
+ logger.info("polymarket:withdrawal:wallet:txsStaged", {
510
+ proxyAddress,
511
+ txCount: txs.length,
512
+ needsApprovalTx
513
+ });
514
+ return txs;
515
+ } catch (err) {
516
+ logger.error("polymarket:withdrawal:wallet:error", err, {
517
+ phase: "preWithdrawal",
518
+ proxyAddress
519
+ });
520
+ throw err;
521
+ }
522
+ };
523
+ return {
524
+ modalTitle: config.modalTitle ?? "Withdraw",
525
+ disableConnectedWallet: config.disableConnectedWallet,
526
+ sourceChainId: polygon.id.toString(),
527
+ sourceTokenSymbol: config.sourceTokenSymbol ?? PUSD_TOKEN.symbol,
528
+ sourceTokenAddress: config.sourceTokenAddress ?? POLYGON_USDCE,
529
+ defaultReceiveToken: config.defaultReceiveToken ?? "USDC",
530
+ iconSrc: config.iconSrc ?? PUSD_TOKEN.iconSrc,
531
+ getMinWithdrawalUSD: () => 0,
532
+ wallet,
533
+ preWithdrawalAction
534
+ };
535
+ }
536
+ function extractWithdrawalAmount(funQuote) {
537
+ const quote = funQuote;
538
+ const amountStr = quote?.baseQuote?.estTotalFromAmountBaseUnit;
539
+ if (!amountStr) {
540
+ logger.error("polymarket:withdrawal:missingAmountInQuote", { quote });
541
+ throw new Error("Missing withdrawal amount in quote");
542
+ }
543
+ return BigInt(amountStr);
544
+ }
545
+ function createPolymarketWithdrawalConfig(config) {
546
+ if ("sendPmctTransfer" in config && "sendTransactions" in config) {
547
+ const walletUnwrapEnabled = checkFeatureGate(
548
+ "enable-polymarket-wallet-withdrawal"
549
+ );
550
+ logger.info("polymarket:withdrawal:gate", { walletUnwrapEnabled });
551
+ return walletUnwrapEnabled ? buildWalletUnwrapWithdrawalConfig(config) : buildUdaWithdrawalConfig(config);
552
+ }
553
+ return "sendPmctTransfer" in config ? buildUdaWithdrawalConfig(config) : buildWalletUnwrapWithdrawalConfig(config);
554
+ }
337
555
  export {
338
556
  createPolymarketWithdrawalConfig
339
557
  };
@@ -1,6 +1,6 @@
1
1
  export declare const DIALOG_WIDTH_WIDE = "450px";
2
2
  export declare const DIALOG_HEIGHT = 525;
3
- export declare const DIALOG_HEIGHT_SWAPPED_IFRAME = 580;
3
+ export declare const DIALOG_HEIGHT_SWAPPED_IFRAME = 525;
4
4
  export declare const DIALOG_INNER_PADDING_X = 12;
5
5
  export declare const SCROLL_BAR_WIDTH = 6;
6
6
  export declare const DIALOG_BOTTOM_PADDING = "15";
@@ -1,7 +1,7 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { type FunNotificationBannerIconProps } from './FunNotificationBannerIcon';
3
3
  interface FunNotificationBannerProps extends FunNotificationBannerIconProps {
4
- title: ReactNode;
4
+ title: string;
5
5
  description: ReactNode;
6
6
  /** Additional text-like content clarifying the description */
7
7
  disclaimer?: ReactNode;
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { type BluvoExchangeType } from '../../consts/bluvo';
2
+ import { type BrokerageOption } from '../../consts/bluvo';
3
3
  interface FunSelectBrokerageProps {
4
4
  isDisabled?: boolean;
5
- onSelect: (value: BluvoExchangeType) => void;
6
- selectedValue: BluvoExchangeType | undefined;
5
+ options: ReadonlyArray<BrokerageOption>;
6
+ onSelect: (option: BrokerageOption) => void;
7
+ selectedKey: string | undefined;
7
8
  }
8
- export declare function FunSelectBrokerage({ isDisabled, onSelect, selectedValue, }: FunSelectBrokerageProps): React.JSX.Element;
9
+ export declare function FunSelectBrokerage({ isDisabled, options, onSelect, selectedKey, }: FunSelectBrokerageProps): React.JSX.Element;
9
10
  export {};
@@ -1,10 +1,14 @@
1
+ import { type Easing } from 'motion/react';
1
2
  import { type FC } from 'react';
2
3
  import { type TextProps } from '../Text/Text';
3
4
  export interface AnimatedTextProps extends TextProps {
4
5
  animationDelay?: number;
6
+ animationDirection?: number;
5
7
  animationDuration?: number;
8
+ animationEase?: Easing | Easing[];
6
9
  animationMaxBlur?: number;
7
10
  animationMaxDistance?: number;
11
+ animationMode?: 'wait' | 'popLayout';
8
12
  textKey: number | string;
9
13
  }
10
14
  export declare const AnimatedText: FC<AnimatedTextProps>;
@@ -1,4 +1,5 @@
1
1
  import type { UseBluvoFlowHook } from '@bluvo/react';
2
+ import { type GenericFormOfPayment } from '@funkit/api-base';
2
3
  import React from 'react';
3
4
  export type BluvoQuote = UseBluvoFlowHook['quote'];
4
5
  export type BluvoWithdrawableBalance = UseBluvoFlowHook['walletBalances'];
@@ -44,3 +45,29 @@ export declare const SUPPORTED_EXCHANGES: readonly [{
44
45
  export declare const BLUVO_EXCHANGES: Readonly<Record<BluvoExchangeType, BluvoExchangeInfo>>;
45
46
  export declare function getExchangeIcon(brokerType: BluvoExchangeType, size: number): React.JSX.Element | null;
46
47
  export declare function getExchangeName(brokerType: BluvoExchangeType): string;
48
+ export declare enum BrokerageKind {
49
+ BLUVO = "bluvo",
50
+ SWAPPED = "swapped"
51
+ }
52
+ export type BrokerageOption = {
53
+ name: string;
54
+ icon: React.ReactNode;
55
+ status: BluvoExchangeStatus;
56
+ hasActiveConnection: boolean;
57
+ } & ({
58
+ kind: BrokerageKind.BLUVO;
59
+ exchange: BluvoExchangeType;
60
+ } | {
61
+ kind: BrokerageKind.SWAPPED;
62
+ fop: GenericFormOfPayment;
63
+ });
64
+ export interface BluvoExchangeOptionInput {
65
+ exchange: BluvoExchangeType;
66
+ exchangeName: string;
67
+ exchangeIcon: React.ReactNode;
68
+ status: BluvoExchangeStatus;
69
+ hasActiveConnection: boolean;
70
+ }
71
+ export declare function bluvoExchangeToBrokerageOption(option: BluvoExchangeOptionInput): BrokerageOption;
72
+ export declare function fopToBrokerageOption(fop: GenericFormOfPayment, iconSize: number): BrokerageOption;
73
+ export declare function brokerageOptionKey(option: BrokerageOption): string;
@@ -4,7 +4,7 @@ export declare const FOPS_STALE_TIME: number;
4
4
  * Validates FOPs by checking icon URL, embedded flow URL, and payment group.
5
5
  * Deduplicates generic FOPs whose fopType already appears in saved FOPs.
6
6
  */
7
- export declare function validateFops(res: GetFopsResponse, logTag: 'useFops' | 'useWithdrawFops'): GetFopsResponse;
7
+ export declare function validateFops(res: GetFopsResponse, logTag: 'useFops' | 'useWithdrawFops' | 'useSwappedExchanges'): GetFopsResponse;
8
8
  /**
9
9
  * Sorts fops by a priority order list (array of fopType strings, index = priority).
10
10
  * Fops not in the list are sorted by max checkout limit descending.