@funkit/connect 9.20.0 → 9.21.1-next.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.
- package/CHANGELOG.md +47 -0
- package/dist/__generated__/default_configs.d.ts +901 -0
- package/dist/__generated__/default_feature_gates.d.ts +20 -0
- package/dist/chunk-36KVHK22.js +252 -0
- package/dist/chunk-4YEAUICE.js +380 -0
- package/dist/chunk-67BKQQNG.js +252 -0
- package/dist/clients/chunk-25ICASD7.js +2371 -0
- package/dist/clients/{chunk-47AQXZQE.js → chunk-4HCOSF4M.js} +1 -1
- package/dist/clients/chunk-7GWX2ZS4.js +69 -0
- package/dist/clients/{chunk-CSONEKIF.js → chunk-7HNGV6JU.js} +1 -1
- package/dist/clients/chunk-EGMA6ATZ.js +2371 -0
- package/dist/clients/chunk-GGXTLJ7J.js +290 -0
- package/dist/clients/chunk-HRWCNZJA.js +230 -0
- package/dist/clients/chunk-JD3FIVZ7.js +69 -0
- package/dist/clients/chunk-JTGKAPID.js +2382 -0
- package/dist/clients/chunk-L7PABCF2.js +54 -0
- package/dist/clients/{chunk-JOM2J5WB.js → chunk-NCUPPJ2Z.js} +21 -10
- package/dist/clients/{chunk-UNCVGPTD.js → chunk-NUJ6ZM5F.js} +1 -1
- package/dist/clients/chunk-OJLDTEKB.js +54 -0
- package/dist/clients/chunk-SSSQQ32F.js +186 -0
- package/dist/clients/chunk-UVWNEQMD.js +186 -0
- package/dist/clients/chunk-YLZ7COFH.js +230 -0
- package/dist/clients/chunk-ZEFHAWRH.js +69 -0
- package/dist/clients/fanatics.css +2891 -2702
- package/dist/clients/fanatics.js +5 -5
- package/dist/clients/lighter.css +2891 -2702
- package/dist/clients/lighter.js +3 -3
- package/dist/clients/nado.d.ts +78 -0
- package/dist/clients/nado.js +107 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +2909 -2717
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
- package/dist/clients/polymarket/index.css +2909 -2717
- package/dist/clients/polymarket/index.js +4 -4
- package/dist/clients/polymarket.d.ts +161 -0
- package/dist/clients/polymarket.js +688 -0
- package/dist/components/Box/Box.d.ts +21 -21
- package/dist/components/FunButton/FunButton.css.d.ts +1 -0
- package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
- package/dist/css/sprinkles.css.d.ts +33 -21
- package/dist/hooks/useTokenTransferConfig.d.ts +7 -0
- package/dist/index.css +2909 -2717
- package/dist/index.js +227 -349
- package/dist/interfaces/logTransport.d.ts +51 -0
- package/dist/interfaces/swapped-transport.d.ts +78 -0
- package/dist/modals/CheckoutModal/SourceChange/EmptyFormOfPaymentsMessage.d.ts +4 -0
- package/dist/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.d.ts +4 -0
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +6 -0
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +7 -0
- package/dist/providers/FunkitThemeProvider.d.ts +18 -0
- package/dist/themes/baseTheme.d.ts +3 -1
- package/dist/themes/baseTheme.js +1 -1
- package/dist/themes/darkTheme.js +2 -2
- package/dist/themes/lightTheme.js +2 -2
- package/dist/utils/flags/resolver.d.ts +34 -0
- package/dist/utils/tokenTransfer/disabledList.d.ts +1 -14
- package/dist/utils/tokenTransfer/types.d.ts +5 -30
- package/dist/wallets/walletConnectors/chunk-2VP2F6EK.js +70 -0
- package/dist/wallets/walletConnectors/chunk-4T6ZSRJF.js +69 -0
- package/dist/wallets/walletConnectors/chunk-6BW3HLBG.js +96 -0
- package/dist/wallets/walletConnectors/chunk-CCQV2ZET.js +218 -0
- package/dist/wallets/walletConnectors/chunk-CPI4TD43.js +99 -0
- package/dist/wallets/walletConnectors/chunk-F5XEEVG6.js +98 -0
- package/dist/wallets/walletConnectors/chunk-HNRB7KJU.js +92 -0
- package/dist/wallets/walletConnectors/chunk-HTHAK6XB.js +93 -0
- package/dist/wallets/walletConnectors/chunk-MIQTHJ6X.js +66 -0
- package/dist/wallets/walletConnectors/chunk-RB3HR4R2.js +95 -0
- package/dist/wallets/walletConnectors/chunk-RVOY537T.js +100 -0
- package/dist/wallets/walletConnectors/chunk-STVVP43G.js +94 -0
- package/dist/wallets/walletConnectors/chunk-UK7C2JXW.js +87 -0
- package/dist/wallets/walletConnectors/chunk-VAPGUPHO.js +92 -0
- package/dist/wallets/walletConnectors/chunk-VTM6EECM.js +110 -0
- package/dist/wallets/walletConnectors/chunk-X6CGV36L.js +103 -0
- package/dist/wallets/walletConnectors/chunk-YEZM4CK4.js +96 -0
- package/dist/wallets/walletConnectors/chunk-ZNX4EMPB.js +106 -0
- package/dist/wallets/walletConnectors/index.js +54 -54
- package/package.json +3 -3
- package/dist/clients/chunk-JVTKIEOP.js +0 -69
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-NCUPPJ2Z.js";
|
|
5
5
|
import {
|
|
6
6
|
POLYMARKET_PERPS_ROUTING_ID,
|
|
7
7
|
POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
8
8
|
createPolymarketDepositConfig,
|
|
9
9
|
createPredictionsGenerateActionParams
|
|
10
10
|
} from "../chunk-4752IYY6.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-7HNGV6JU.js";
|
|
12
|
+
import "../chunk-UVWNEQMD.js";
|
|
13
|
+
import "../chunk-JD3FIVZ7.js";
|
|
14
14
|
import {
|
|
15
15
|
AMOUNT_PLACEHOLDER,
|
|
16
16
|
COLLATERAL_ONRAMP_ABI,
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polymarket V2 PMCT withdrawal.
|
|
3
|
+
*
|
|
4
|
+
* Two flows are supported, dispatched on input shape:
|
|
5
|
+
*
|
|
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}.
|
|
17
|
+
*/
|
|
18
|
+
import { type Address, type PublicClient, type TransactionReceipt } from 'viem';
|
|
19
|
+
import type { CustomWithdrawalConfig, FunkitCheckoutActionParams, FunkitWithdrawalConfig, WalletWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
|
|
20
|
+
import type { WithdrawalTransaction } from '../wallets/Wallet';
|
|
21
|
+
export interface PolymarketWithdrawalCallbackConfig {
|
|
22
|
+
userId: string;
|
|
23
|
+
modalTitle?: string;
|
|
24
|
+
disableConnectedWallet?: boolean;
|
|
25
|
+
sourceTokenSymbol?: string;
|
|
26
|
+
defaultReceiveToken?: string;
|
|
27
|
+
sourceTokenAddress?: Address;
|
|
28
|
+
iconSrc?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Execute the ERC-20 transfer of PMCT from the user's proxy to the UDA.
|
|
31
|
+
* Called after the UDA address is generated.
|
|
32
|
+
* Should return when the transaction has been submitted (not necessarily confirmed).
|
|
33
|
+
*/
|
|
34
|
+
sendPmctTransfer: (params: {
|
|
35
|
+
/** The UDA address to send PMCT to */
|
|
36
|
+
udaAddress: Address;
|
|
37
|
+
/** Amount in base units (from the quote) */
|
|
38
|
+
amountBaseUnit: bigint;
|
|
39
|
+
}) => Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
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.
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* const withdrawalConfig = createPolymarketWithdrawalConfig({
|
|
107
|
+
* userId: walletAddress,
|
|
108
|
+
* sendPmctTransfer: async ({ udaAddress, amountBaseUnit }) => { ... },
|
|
109
|
+
* })
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
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;
|
|
133
|
+
export interface PolymarketPerpsDepositConfig {
|
|
134
|
+
/**
|
|
135
|
+
* Polymarket Perps account credited with the deposit
|
|
136
|
+
*/
|
|
137
|
+
recipientAddress: Address;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Builds the `generateActionsParams` callback for a Polymarket Perps deposit.
|
|
141
|
+
*
|
|
142
|
+
* Both legs run inside a single Relay Router V3 `cleanupErc20sViaCall` sweep,
|
|
143
|
+
* each mediated by the VaultDepositor proxy so the flow composes with
|
|
144
|
+
* EXACT_INPUT quoting — the VaultDepositor pulls msg.sender's full balance and
|
|
145
|
+
* substitutes AMOUNT_PLACEHOLDER at exec time, so arrival amounts don't need to
|
|
146
|
+
* be known at quote time:
|
|
147
|
+
* 1. USDC.e → pUSD via `CollateralOnramp.wrap`, attributing pUSD to Relay
|
|
148
|
+
* Router V3.
|
|
149
|
+
* 2. pUSD → `POLYMARKET_PERPS_ADDRESS.deposit`, crediting `recipientAddress`.
|
|
150
|
+
*
|
|
151
|
+
* Usage:
|
|
152
|
+
* ```ts
|
|
153
|
+
* const checkoutConfig: FunkitCheckoutConfig = {
|
|
154
|
+
* // ...
|
|
155
|
+
* generateActionsParams: createPerpsGenerateActionParams({
|
|
156
|
+
* recipientAddress: proxyAddress,
|
|
157
|
+
* }),
|
|
158
|
+
* }
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export declare function createPerpsGenerateActionParams(config: PolymarketPerpsDepositConfig): () => Promise<FunkitCheckoutActionParams[]>;
|