@funkit/connect 9.19.0 → 9.20.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 +62 -0
- package/dist/clients/argentWallet-2WSTOUAO.js +7 -0
- package/dist/clients/bifrostWallet-5NQVDZ5P.js +7 -0
- package/dist/clients/bitgetWallet-CBQAJOIK.js +7 -0
- package/dist/clients/bitskiWallet-OLIYN3IU.js +7 -0
- package/dist/clients/bitverseWallet-AQMAJ2NN.js +7 -0
- package/dist/clients/bloomWallet-MJRQJYSG.js +7 -0
- package/dist/clients/braveWallet-T76TVZA6.js +7 -0
- package/dist/clients/bybitWallet-GOPAS32Q.js +7 -0
- package/dist/clients/chunk-4752IYY6.js +94 -0
- package/dist/clients/chunk-47AQXZQE.js +230 -0
- package/dist/clients/chunk-CSONEKIF.js +54 -0
- package/dist/clients/chunk-JOM2J5WB.js +2371 -0
- package/dist/clients/{chunk-GSK3TMI5.js → chunk-JVTKIEOP.js} +2 -223
- package/dist/clients/{polymarket.js → chunk-MOUTRRN3.js} +15 -27
- package/dist/clients/chunk-MRBN4XCA.js +96 -0
- package/dist/clients/chunk-UNCVGPTD.js +186 -0
- package/dist/clients/chunk-UUHGOBKZ.js +51 -0
- package/dist/clients/clvWallet-VVMLP7BK.js +7 -0
- package/dist/clients/coin98Wallet-I5CP5KYZ.js +7 -0
- package/dist/clients/coinbaseWallet-ICYEIYQD.js +7 -0
- package/dist/clients/coreWallet-RFVUHOVE.js +7 -0
- package/dist/clients/dawnWallet-QBFTQLS4.js +7 -0
- package/dist/clients/desigWallet-IBKYOHSY.js +7 -0
- package/dist/clients/enkryptWallet-ZVUZMI7H.js +7 -0
- package/dist/clients/fanatics.js +42 -83
- package/dist/clients/foxWallet-I7D5KIW4.js +7 -0
- package/dist/clients/frameWallet-UDD4OVZX.js +7 -0
- package/dist/clients/frontierWallet-5QV7ZACT.js +7 -0
- package/dist/clients/gateWallet-CJNGQQCV.js +7 -0
- package/dist/clients/imTokenWallet-UPA7ADZ2.js +7 -0
- package/dist/clients/injectedWallet-OIRJSVBZ.js +7 -0
- package/dist/clients/kresusWallet-7ROCNWAU.js +7 -0
- package/dist/clients/ledgerWallet-3FCEIKPD.js +7 -0
- package/dist/clients/lighter.js +10 -180
- package/dist/clients/metaMaskWallet-RMHEKBDR.js +7 -0
- package/dist/clients/mewWallet-ANFGVCZT.js +7 -0
- package/dist/clients/oktoWallet-Q5XCEOTD.js +7 -0
- package/dist/clients/okxWallet-GJMKZIND.js +7 -0
- package/dist/clients/omniWallet-YH4FEL6J.js +7 -0
- package/dist/clients/oneInchWallet-4S73ZPPN.js +7 -0
- package/dist/clients/oneKeyWallet-YVJDPHJS.js +7 -0
- package/dist/clients/phantomWallet-LZDJJ5XR.js +7 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +17293 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +30 -0
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +14 -0
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +54 -0
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +15 -0
- package/dist/clients/polymarket/index.css +17293 -0
- package/dist/clients/polymarket/index.d.ts +8 -0
- package/dist/clients/polymarket/index.js +42 -0
- package/dist/clients/{polymarket.d.ts → polymarket/polymarket.d.ts} +59 -2
- package/dist/clients/polymarket/polymarket.js +24 -0
- package/dist/clients/polymarket/usePolymarketAccountBalances.d.ts +66 -0
- package/dist/clients/polymarket/usePolymarketAccountBalances.js +12 -0
- package/dist/clients/rabbyWallet-TYX2JDHU.js +7 -0
- package/dist/clients/rainbowWallet-MFJQCICF.js +7 -0
- package/dist/clients/ramperWallet-Q2XAH4WA.js +7 -0
- package/dist/clients/rolly.d.ts +2 -0
- package/dist/clients/rolly.js +6 -2
- package/dist/clients/roninWallet-SAB5ESVK.js +7 -0
- package/dist/clients/safeWallet-Y3VPODK2.js +7 -0
- package/dist/clients/safeheronWallet-MCFXLKO5.js +7 -0
- package/dist/clients/safepalWallet-7YULGM2L.js +7 -0
- package/dist/clients/subWallet-5WUZ4IIO.js +7 -0
- package/dist/clients/tahoWallet-U2VWWO76.js +7 -0
- package/dist/clients/talismanWallet-ZYTPIANG.js +7 -0
- package/dist/clients/tokenPocketWallet-FLFG3JUQ.js +7 -0
- package/dist/clients/tokenaryWallet-S3JS2IGK.js +7 -0
- package/dist/clients/trustWallet-2N5TZJGC.js +7 -0
- package/dist/clients/uniswapWallet-NJQBP5VM.js +7 -0
- package/dist/clients/walletConnectWallet-E4OQJ4DC.js +7 -0
- package/dist/clients/xdefiWallet-ZKBEFEOH.js +7 -0
- package/dist/clients/zealWallet-7VO3C4PM.js +7 -0
- package/dist/clients/zerionWallet-SEPREHKH.js +7 -0
- package/dist/components/Dropdown/AccountSelectDropdown.d.ts +45 -0
- package/dist/components/Dropdown/BaseDropdownItem.d.ts +3 -1
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.css.d.ts +15 -0
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +5 -5
- package/dist/components/ModalHeightAnimationLayer/ModalHeightAnimationLayer.d.ts +8 -0
- package/dist/consts/customers.d.ts +13 -0
- package/dist/consts/funkit.d.ts +2 -0
- package/dist/consts/polymarket.d.ts +9 -0
- package/dist/domains/aave.d.ts +28 -0
- package/dist/domains/dynamicRouting.d.ts +13 -1
- package/dist/domains/paymentMethods.d.ts +8 -0
- package/dist/domains/quote.d.ts +2 -2
- package/dist/hooks/statsig/useDynamicConfig.d.ts +2 -5
- package/dist/hooks/statsig/useExperiment.d.ts +1 -33
- package/dist/hooks/statsig/useFeatureGate.d.ts +1 -4
- package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
- package/dist/hooks/useCheckoutTransferInit.d.ts +2 -17
- package/dist/hooks/useExchangeOptions.d.ts +11 -2
- package/dist/hooks/useTokenAndChainDropdown.d.ts +1 -1
- package/dist/hooks/useTokenTransfer.d.ts +3 -8
- package/dist/hooks/useUDAParams.d.ts +2 -10
- package/dist/index.css +1331 -94
- package/dist/index.js +4965 -5413
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -1
- package/dist/modals/CheckoutModal/InputAmount/QuickOptions.d.ts +1 -0
- package/dist/modals/CheckoutModal/InputAmount/aaveClient.d.ts +3 -7
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +25 -1
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +2 -19
- package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +17 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useSourceChangeLayout.d.ts +10 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +27 -1
- package/dist/modals/PolymarketPerpsTransfer/DirectionSwapButton.d.ts +17 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferBottomBar.d.ts +11 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferRows.d.ts +10 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferStep.d.ts +11 -0
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +52 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +34 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.css.d.ts +13 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.d.ts +27 -0
- package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +66 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +63 -3
- package/dist/providers/FunkitConfigContext.d.ts +13 -2
- package/dist/providers/FunkitQuoteContext.d.ts +16 -0
- package/dist/providers/SwappedProvider.d.ts +1 -1
- package/dist/transports/iframeSwappedTransport.d.ts +1 -1
- package/dist/utils/consts.d.ts +1 -2
- package/dist/utils/datadogBrowserLogsTransport.d.ts +1 -1
- package/dist/utils/freeUsdcBanner.d.ts +3 -0
- package/dist/utils/funLogger.d.ts +1 -51
- package/dist/utils/statsig/checkFeatureGate.d.ts +1 -1
- package/dist/utils/swapped.d.ts +2 -2
- package/dist/utils/tokenMath.d.ts +6 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +48 -48
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +8 -7
- package/dist/__generated__/default_configs.d.ts +0 -901
- package/dist/__generated__/default_feature_gates.d.ts +0 -20
- package/dist/clients/chunk-3QHYYLVM.js +0 -240
- package/dist/interfaces/logTransport.d.ts +0 -51
- package/dist/interfaces/swapped-transport.d.ts +0 -78
- package/dist/utils/flags/resolver.d.ts +0 -34
- package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
|
@@ -21,5 +21,6 @@ export declare enum FunCheckoutStep {
|
|
|
21
21
|
CONNECT_EXCHANGE = "connect_exchange",
|
|
22
22
|
BROKERAGE_TWO_FA = "brokerage_two_fa",
|
|
23
23
|
BROKERAGE_SUCCESS = "brokerage_success",
|
|
24
|
-
SWAPPED_IFRAME = "swapped_iframe"
|
|
24
|
+
SWAPPED_IFRAME = "swapped_iframe",
|
|
25
|
+
PERPS_TRANSFER = "perps_transfer"
|
|
25
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Aave V3 client
|
|
2
|
+
* Aave V3 client singleton for the native fast-path supply flow.
|
|
3
3
|
*
|
|
4
4
|
* The PoC uses `@aave/client` (V3 SDK) directly via its action functions, with
|
|
5
5
|
* the viem adapter for signing. We don't mount `<AaveProvider>` because the
|
|
@@ -9,12 +9,8 @@
|
|
|
9
9
|
* (`useAaveNativeSupply.ts`). It does NOT belong in `~/clients/` — that
|
|
10
10
|
* directory is reserved for customer-specific code exported via the
|
|
11
11
|
* `./clients/*` subpath; pulling Aave SDK setup in from there would bloat
|
|
12
|
-
* the main bundle for every customer.
|
|
13
|
-
*
|
|
14
|
-
* `~/integrations/aave.ts` or similar — it's a third-party SDK integration
|
|
15
|
-
* boundary, not a constant (singleton) and not domain logic.
|
|
12
|
+
* the main bundle for every customer. Pure Aave constants and predicates
|
|
13
|
+
* live in `~/domains/aave.ts` (importable without running SDK init).
|
|
16
14
|
*/
|
|
17
15
|
import { AaveClient } from '@aave/client';
|
|
18
|
-
import type { Address } from 'viem';
|
|
19
16
|
export declare const aaveClient: AaveClient;
|
|
20
|
-
export declare const AAVE_MARKET_ADDRESS_BY_CHAIN: Record<string, Address>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Dnum } from 'dnum';
|
|
2
|
+
import type { Address } from 'viem';
|
|
2
3
|
import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
|
|
3
4
|
import type { QuoteBuilder } from '../../../domains/quoteMode/types';
|
|
4
5
|
import type { AssetHoldingsItem } from '../../../utils/assets';
|
|
@@ -139,6 +140,29 @@ export type AmountInputError = {
|
|
|
139
140
|
* Return half the balance and round up to nearest 10, 100, 1000 etc
|
|
140
141
|
*/
|
|
141
142
|
export declare function calcInitialFiatAmount(balance: number): number;
|
|
142
|
-
|
|
143
|
+
/** Minimal source-token identity needed to resolve the default input mode. */
|
|
144
|
+
export interface SourceTokenRef {
|
|
145
|
+
chainId: string;
|
|
146
|
+
address: Address;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Resolves whether the amount screen should open in fiat (`true`) or token
|
|
150
|
+
* (`false`) entry.
|
|
151
|
+
*
|
|
152
|
+
* Precedence: card and BTC Lightning payments always force fiat (ramps are
|
|
153
|
+
* fiat-denominated, and Lightning's amount input only supports fiat today).
|
|
154
|
+
* Lighter **spot** deposits paid with the same asset open in token entry —
|
|
155
|
+
* perps deposits (and every other customer) keep the legacy fiat default.
|
|
156
|
+
* Legacy behavior: token entry only for vault-style deposits (a finalized
|
|
157
|
+
* token set), fiat otherwise. A value preserved from prior navigation
|
|
158
|
+
* (`defaultIsInputInFiat`) is handled by the caller and wins over this.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveDefaultIsInputInFiat({ checkoutConfig, paymentMethodInfo, sourceToken, apiKey, }: {
|
|
161
|
+
checkoutConfig: FunkitCheckoutConfig;
|
|
162
|
+
paymentMethodInfo: PaymentMethodInfo;
|
|
163
|
+
sourceToken: SourceTokenRef | null;
|
|
164
|
+
apiKey: string;
|
|
165
|
+
}): boolean;
|
|
166
|
+
export declare function initializeState({ checkoutConfig, defaultAmount, fiatCurrency, quoteBuilder, locale, maxUsd, minUsd, paymentMethodInfo, quickOptions, sourceHolding, unitPrice: realUnitPrice, meldEnabled, apiKey, defaultAssetAmount, defaultIsInputInFiat, isNativeToken, gasPriceWei, gasUnits, }: AmountInputInitOptions): AmountInputState;
|
|
143
167
|
export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
|
|
144
168
|
export declare function getDerivedState(state: AmountInputState, targetAssetTicker: string): AmountInputDerivedState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Native-supply fast-path: same-token same-chain deposits go straight to the
|
|
3
|
-
* Aave Pool, bypassing Relay.
|
|
4
|
-
*
|
|
3
|
+
* Aave Pool, bypassing Relay. Toggle visibility is gated centrally in
|
|
4
|
+
* `FunkitQuoteContext` (`showApprovalMethodToggle`), not here.
|
|
5
5
|
*/
|
|
6
6
|
import { type ERC712Signature, type SupplyRequest } from '@aave/client';
|
|
7
7
|
import type { ApiFunkitCheckoutConfig } from '@funkit/utils';
|
|
@@ -10,23 +10,6 @@ import { type Address, type Hex, type WalletClient } from 'viem';
|
|
|
10
10
|
import { type CheckoutConfirmationError } from '../../../domains/checkoutErrors';
|
|
11
11
|
import type { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
|
|
12
12
|
import { type Config } from '../../../wagmi/hooks';
|
|
13
|
-
interface AaveNativeSupplyContextArgs {
|
|
14
|
-
apiKey: string;
|
|
15
|
-
sourceAsset: {
|
|
16
|
-
chainId: string | number;
|
|
17
|
-
address: string;
|
|
18
|
-
};
|
|
19
|
-
checkoutConfig: Pick<FunkitCheckoutConfig, 'targetChain' | 'targetAsset'>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* True when the customer has the Aave native fast-path enabled, the
|
|
23
|
-
* checkout's target chain has an Aave market configured (membership in
|
|
24
|
-
* AAVE_MARKET_ADDRESS_BY_CHAIN is the single source of truth for "Aave
|
|
25
|
-
* supported here"), and the source asset matches the target asset
|
|
26
|
-
* (same chain, same token address). Decoupled from the hook so callers
|
|
27
|
-
* can branch their UI before mounting the hook.
|
|
28
|
-
*/
|
|
29
|
-
export declare function isAaveNativeSupplyContext({ apiKey, sourceAsset, checkoutConfig, }: AaveNativeSupplyContextArgs): boolean;
|
|
30
13
|
/**
|
|
31
14
|
* Stringify an amount for Aave's `bigDecimal()`. Prefers the precise
|
|
32
15
|
* base-unit Dnum (carries the token's real decimals) so we don't ship
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PaymentMethod } from '../../../domains/paymentMethods';
|
|
2
|
+
import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
|
|
3
|
+
export interface CheckoutAmountLimitsUsd {
|
|
4
|
+
minUsd: number | undefined;
|
|
5
|
+
maxUsd: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolves the min/max USD bounds for the amount input based on the active
|
|
9
|
+
* payment method:
|
|
10
|
+
* - Bitcoin Lightning and brokerage checkouts carry their own floors/ceilings.
|
|
11
|
+
* - Everything else uses the customer-configured min deposit and the global
|
|
12
|
+
* max-checkout dynamic config.
|
|
13
|
+
*/
|
|
14
|
+
export declare const useCheckoutAmountLimits: ({ checkoutConfig, paymentMethod, }: {
|
|
15
|
+
checkoutConfig: FunkitCheckoutConfig;
|
|
16
|
+
paymentMethod: PaymentMethod;
|
|
17
|
+
}) => CheckoutAmountLimitsUsd;
|
|
@@ -50,4 +50,4 @@ export type SourceChangeNext = {
|
|
|
50
50
|
paymentMethodInfo: ConnectablePaymentMethodInfo;
|
|
51
51
|
};
|
|
52
52
|
export declare const SourceChangeInfo: ModalStepInfo<FunCheckoutStep.SOURCE_CHANGE>;
|
|
53
|
-
export declare function SourceChange({ modalState, onClose, onNext, setModalState, }: ModalStepComponentProps<FunCheckoutStep.SOURCE_CHANGE>): React.JSX.Element;
|
|
53
|
+
export declare function SourceChange({ modalState, onClose, onNext, onStepChange, setModalState, }: ModalStepComponentProps<FunCheckoutStep.SOURCE_CHANGE>): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BoxProps } from '../../../components/Box/Box';
|
|
2
|
+
/**
|
|
3
|
+
* Layout decisions shared between SourceChange and SourceChangeLoading so the
|
|
4
|
+
* loading skeleton can't drift from the loaded screen.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useSourceChangeLayout(): {
|
|
7
|
+
isTargetAssetSelectable: boolean;
|
|
8
|
+
showContentDivider: boolean;
|
|
9
|
+
cryptoCashToggleMarginTop: BoxProps['marginTop'];
|
|
10
|
+
};
|
|
@@ -3,8 +3,9 @@ import { type BridgeCustomerNext, type BridgeCustomerState } from '../../modals/
|
|
|
3
3
|
import { type BridgeKycNext, type BridgeKycState } from '../../modals/CheckoutModal/VirtualFiatAccount/BridgeKyc';
|
|
4
4
|
import { type ErrorScreenState } from '../../modals/CheckoutModal/VirtualFiatAccount/ErrorScreen';
|
|
5
5
|
import { type VirtualFiatAccountNext, type VirtualFiatAccountState } from '../../modals/CheckoutModal/VirtualFiatAccount/VirtualFiatAccount';
|
|
6
|
-
import { FunCheckoutStartingStep, type FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
6
|
+
import { type DynamicTargetAssetCandidate, FunCheckoutStartingStep, type FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
7
7
|
import { type FunkitTextCustomizationsConfig } from '../../providers/FunkitConfigContext';
|
|
8
|
+
import { type PerpsTransferNext, type PerpsTransferState } from '../PolymarketPerpsTransfer/PerpsTransferStep';
|
|
8
9
|
import { type BrokerageSuccessState } from './Brokerage/BrokerageSuccessModal';
|
|
9
10
|
import { type BrokerageTwoFANext, type BrokerageTwoFAState } from './Brokerage/BrokerageTwoFA';
|
|
10
11
|
import { type ConnectExchangeNext, type ConnectExchangeState } from './Brokerage/ConnectExchange';
|
|
@@ -45,8 +46,31 @@ export interface ModalStepComponentProps<S extends FunCheckoutStep = FunCheckout
|
|
|
45
46
|
}): void;
|
|
46
47
|
onAnimationComplete(callback: () => void): void;
|
|
47
48
|
onNext(payload: NextPayload<S>): void;
|
|
49
|
+
/** Navigate directly to an arbitrary step state (animates + pushes history). */
|
|
50
|
+
onStepChange(state: CheckoutModalState): void;
|
|
48
51
|
setModalState(state: SetStateAction<CheckoutModalState<S>>): void;
|
|
49
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Props passed to a `sourceChangeScreen.customTopComponent` so it can navigate
|
|
55
|
+
* the checkout modal (e.g. jump to a different step).
|
|
56
|
+
*/
|
|
57
|
+
export interface SourceChangeTopComponentProps {
|
|
58
|
+
onStepChange: (state: CheckoutModalState) => void;
|
|
59
|
+
modalState: CheckoutModalState;
|
|
60
|
+
/**
|
|
61
|
+
* The active checkout's routing id. Passed in (rather than read via
|
|
62
|
+
* `useCheckoutContext`) because a custom top component may be bundled
|
|
63
|
+
* separately from `@funkit/connect` (e.g. `@funkit/connect/clients/*`), where
|
|
64
|
+
* the checkout context is a different instance and would read as empty.
|
|
65
|
+
*/
|
|
66
|
+
dynamicRoutingId?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Apply a destination candidate (target token + routing id + optional
|
|
69
|
+
* recipient) in one atomic update — the same selection path the
|
|
70
|
+
* SourceChange target-asset dropdown uses.
|
|
71
|
+
*/
|
|
72
|
+
applyDynamicTargetAssetCandidate: (candidate: DynamicTargetAssetCandidate) => void;
|
|
73
|
+
}
|
|
50
74
|
export declare function extractCommonState(state: CheckoutModalState): CheckoutModalCommonState;
|
|
51
75
|
interface ModalStepInput<S extends FunCheckoutStep> {
|
|
52
76
|
state: CheckoutModalState<S>;
|
|
@@ -98,6 +122,7 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
98
122
|
[FunCheckoutStep.BROKERAGE_TWO_FA]: BrokerageTwoFAState;
|
|
99
123
|
[FunCheckoutStep.BROKERAGE_SUCCESS]: BrokerageSuccessState;
|
|
100
124
|
[FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeState;
|
|
125
|
+
[FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferState;
|
|
101
126
|
}[T] & {
|
|
102
127
|
step: T;
|
|
103
128
|
previousStep?: FunCheckoutStep | null;
|
|
@@ -127,6 +152,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
127
152
|
[FunCheckoutStep.BROKERAGE_TWO_FA]: BrokerageTwoFANext;
|
|
128
153
|
[FunCheckoutStep.BROKERAGE_SUCCESS]: null;
|
|
129
154
|
[FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeNext;
|
|
155
|
+
[FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferNext;
|
|
130
156
|
}[S] & {
|
|
131
157
|
/** Whether screen transition should change direction to simulate back transition. Only applies if there is a history entry in the stack*/
|
|
132
158
|
reverseAnimation?: boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DirectionSwapButtonProps {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
testId?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The control sitting between the two account rows. Pressing it swaps which
|
|
8
|
+
* account is the source: the top row is always the "From" account (the amount
|
|
9
|
+
* you send), so a swap just changes the labels on each row. The icon is a
|
|
10
|
+
* static downward arrow (matching the design) — it does not rotate on toggle.
|
|
11
|
+
*
|
|
12
|
+
* Styled per Figma as a 32px outlined circle: white surface with a 1px border
|
|
13
|
+
* (gray/100 → gray/200 on hover) and a faint hover/pressed fill. The Figma
|
|
14
|
+
* border vars map to the nearest funkit stroke tokens (mediumStroke ≈ #efefef,
|
|
15
|
+
* heavyStroke ≈ #ddd); the surface uses the icon-button background defaults.
|
|
16
|
+
*/
|
|
17
|
+
export declare function DirectionSwapButton({ onClick, testId, }: DirectionSwapButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PerpsTransferForm } from './usePerpsTransferForm';
|
|
3
|
+
/**
|
|
4
|
+
* The notice line + Transfer button under the transfer rows, rendered from
|
|
5
|
+
* {@link usePerpsTransferForm} state. The in-modal `PerpsTransferStep` portals
|
|
6
|
+
* this into the modal's bottom section; the standalone screen renders it in
|
|
7
|
+
* its `Dialog.BottomSection`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function PerpsTransferBottomBar({ form }: {
|
|
10
|
+
form: PerpsTransferForm;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PerpsTransferForm } from './usePerpsTransferForm';
|
|
3
|
+
/**
|
|
4
|
+
* The From/To account rows with the direction-swap button between them —
|
|
5
|
+
* the body of the Perps ⇄ Predictions transfer screen, rendered from
|
|
6
|
+
* {@link usePerpsTransferForm} state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function PerpsTransferRows({ form }: {
|
|
9
|
+
form: PerpsTransferForm;
|
|
10
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FunCheckoutStep } from '../CheckoutModal/FunCheckoutStep';
|
|
2
|
+
import type { CheckoutModalCommonState, ModalStepInfo } from '../CheckoutModal/stepTransition';
|
|
3
|
+
/**
|
|
4
|
+
* Per-step state for the perps transfer screen. Balances are not carried in on
|
|
5
|
+
* navigation — the step reads them from the shared balance cache (see
|
|
6
|
+
* {@link usePolymarketAccountBalances}), the same cache the deposit picker
|
|
7
|
+
* populates, so there's no reload flash on entry.
|
|
8
|
+
*/
|
|
9
|
+
export type PerpsTransferState = CheckoutModalCommonState;
|
|
10
|
+
export type PerpsTransferNext = null;
|
|
11
|
+
export declare const PerpsTransferStepInfo: ModalStepInfo<FunCheckoutStep.PERPS_TRANSFER>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type PerpsTransferDirection = 'toPerps' | 'toPredictions';
|
|
3
|
+
export type PerpsTransferStatus = 'idle' | 'processing' | 'success' | 'error';
|
|
4
|
+
export interface PolymarketPerpsTransferScreenProps {
|
|
5
|
+
/** Whether the modal is open. Defaults to true (the screen owns its Dialog). */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Modal title. Defaults to the localized "Transfer". */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Predictions account balance in USD. */
|
|
10
|
+
predictionsBalanceUsd: number;
|
|
11
|
+
/** Perps account balance in USD. */
|
|
12
|
+
perpsBalanceUsd: number;
|
|
13
|
+
/** Minimum pUSD to transfer *into* predictions (USD). Drives the
|
|
14
|
+
* below-minimum notice when the destination is Predictions. */
|
|
15
|
+
predictionsMinTransferUsd?: number;
|
|
16
|
+
/** Minimum pUSD to transfer *into* perps (USD). Drives the below-minimum
|
|
17
|
+
* notice when the destination is Perps (e.g. perps' 10 pUSD minimum). */
|
|
18
|
+
perpsMinTransferUsd?: number;
|
|
19
|
+
/** Initial transfer direction. Defaults to Predictions → Perps. */
|
|
20
|
+
initialDirection?: PerpsTransferDirection;
|
|
21
|
+
/** Initial amount input string (pUSD). */
|
|
22
|
+
initialAmountUsd?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Visual status, controlled by the host so the same screen renders the
|
|
25
|
+
* idle / processing / success / error frames. `error` shows a retry-able
|
|
26
|
+
* Transfer button with an error notice. No transfer logic is wired here — the
|
|
27
|
+
* Transfer button simply reports clicks via {@link onTransfer}.
|
|
28
|
+
*/
|
|
29
|
+
status?: PerpsTransferStatus;
|
|
30
|
+
/**
|
|
31
|
+
* Fired when the (enabled) Transfer button is pressed, with the entered
|
|
32
|
+
* amount and direction — mirrors {@link usePerpsTransferForm}'s callback
|
|
33
|
+
* so a host receives everything it needs to perform the transfer.
|
|
34
|
+
*/
|
|
35
|
+
onTransfer: (params: {
|
|
36
|
+
amountUsd: string;
|
|
37
|
+
direction: PerpsTransferDirection;
|
|
38
|
+
}) => void;
|
|
39
|
+
onClose?: () => void;
|
|
40
|
+
onBack?: () => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Polymarket "Transfer" screen — moves a balance between the Predictions and
|
|
44
|
+
* Perps accounts. Self-contained: it renders its own Dialog so it can be used
|
|
45
|
+
* standalone or in a Storybook story. The in-checkout-modal variant is the
|
|
46
|
+
* `PerpsTransferStep` (which renders the same UI via {@link usePerpsTransferForm}
|
|
47
|
+
* as a registered step instead of a Dialog).
|
|
48
|
+
*
|
|
49
|
+
* UI only: balances are props, and the Transfer button's processing/success
|
|
50
|
+
* states are driven by the {@link status} prop rather than any real transfer.
|
|
51
|
+
*/
|
|
52
|
+
export declare function PolymarketPerpsTransferScreen({ open, title, predictionsBalanceUsd, perpsBalanceUsd, predictionsMinTransferUsd, perpsMinTransferUsd, initialDirection, initialAmountUsd, status, onTransfer, onClose, onBack, }: PolymarketPerpsTransferScreenProps): React.JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PerpsTransferStatus } from './PolymarketPerpsTransferScreen';
|
|
3
|
+
export interface TransferActionButtonProps {
|
|
4
|
+
/** Drives the visual state and the label/icon swap. */
|
|
5
|
+
status: PerpsTransferStatus;
|
|
6
|
+
/** Label shown in the idle state (already translated). */
|
|
7
|
+
idleLabel: string;
|
|
8
|
+
/** Label shown while processing (already translated). */
|
|
9
|
+
processingLabel: string;
|
|
10
|
+
/** Label shown on success (already translated). */
|
|
11
|
+
successLabel: string;
|
|
12
|
+
/** Greys out / blocks the idle button until an amount is entered. */
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
testId?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The bottom-bar transfer button. It morphs across the three flow states:
|
|
19
|
+
*
|
|
20
|
+
* - **idle**: primary (blue) "Transfer".
|
|
21
|
+
* - **processing**: dimmed blue, spinner + "Processing", inert.
|
|
22
|
+
* - **success**: secondary (grey) surface, green check + success label, inert.
|
|
23
|
+
*
|
|
24
|
+
* Two details keep the morph smooth:
|
|
25
|
+
*
|
|
26
|
+
* 1. Each state's content (icon + label) is a single absolutely-positioned,
|
|
27
|
+
* centered layer, and we swap whole layers. Because every layer centres
|
|
28
|
+
* itself, the label never shifts horizontally when the icon appears — the
|
|
29
|
+
* transition is a pure vertical blur/fade (matching the From/To row swap).
|
|
30
|
+
* 2. The grey surface is the always-present base; the blue sits on top as an
|
|
31
|
+
* overlay whose opacity only ever fades *out* toward success. Nothing
|
|
32
|
+
* brightens mid-transition, so there's no blue "flush" as it turns grey.
|
|
33
|
+
*/
|
|
34
|
+
export declare function TransferActionButton({ status, idleLabel, processingLabel, successLabel, isDisabled, onClick, testId, }: TransferActionButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Borderless big-number amount field used inside the editable (source) row.
|
|
3
|
+
* The row's outer Box owns the border/background; this input is transparent so
|
|
4
|
+
* it reads as inline editable text.
|
|
5
|
+
*
|
|
6
|
+
* The 32px size matches the Figma amount type — there is no 32px token in the
|
|
7
|
+
* font scale, so it is set here. The family is the theme `body` font (same as
|
|
8
|
+
* the rest of the modal) — note the customer `header`/`inputAmount` tokens can
|
|
9
|
+
* resolve to `inherit`, so they must not be used here. The placeholder uses
|
|
10
|
+
* `secondaryText` to mirror the greyed-out empty "0.00" treatment in the design.
|
|
11
|
+
*/
|
|
12
|
+
export declare const amountInput: string;
|
|
13
|
+
export declare const transferAmountRowContainer: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TransferAmountRowProps {
|
|
3
|
+
/** "From" / "To" prefix (already translated). */
|
|
4
|
+
relationLabel: string;
|
|
5
|
+
/** Account name, e.g. "Predictions" / "Perps". */
|
|
6
|
+
accountLabel: string;
|
|
7
|
+
/** Account balance in USD; rendered floored to the cent as "$X,XXX.XX". */
|
|
8
|
+
balanceUsd: number;
|
|
9
|
+
/**
|
|
10
|
+
* The source row is the editable side: it owns the input + Max button and
|
|
11
|
+
* gets the active border. The destination row mirrors the amount read-only
|
|
12
|
+
* and has no Max button.
|
|
13
|
+
*/
|
|
14
|
+
isSource: boolean;
|
|
15
|
+
/** Controlled amount string (raw user input; may contain separators). */
|
|
16
|
+
amount: string;
|
|
17
|
+
onAmountChange?: (next: string) => void;
|
|
18
|
+
onMax?: () => void;
|
|
19
|
+
testId?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A single From/To account row in the Perps ⇄ Predictions transfer screen.
|
|
23
|
+
* Top line shows the relation + account name, the account balance, and — on the
|
|
24
|
+
* source row — a Max button; the bottom line shows the (large) amount and, on
|
|
25
|
+
* the source row, the `pUSD` denomination.
|
|
26
|
+
*/
|
|
27
|
+
export declare function TransferAmountRow({ relationLabel, accountLabel, balanceUsd, isSource, amount, onAmountChange, onMax, testId, }: TransferAmountRowProps): React.JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { PerpsTransferDirection, PerpsTransferStatus } from './PolymarketPerpsTransferScreen';
|
|
2
|
+
/**
|
|
3
|
+
* pUSD has 6 on-chain decimals, so balances carry up to 6 decimal places. We
|
|
4
|
+
* render only the decimals actually present, up to 6: capping at 2 rounded
|
|
5
|
+
* `196.867461` *up* to `196.87`, so Max filled a value above the real balance
|
|
6
|
+
* and tripped the insufficient-balance guard. At 6 decimals the value is
|
|
7
|
+
* reproduced exactly. There is no minimum, so trailing zeros are trimmed —
|
|
8
|
+
* a `1.1` balance fills as `1.1`, not `1.100000` (or `1.10`).
|
|
9
|
+
*
|
|
10
|
+
* Not `formatCurrencyAndStringify` — that helper produces a 2-decimal `$`
|
|
11
|
+
* display string, while this fills the editable input with an exact,
|
|
12
|
+
* re-parsable pUSD amount.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatAmountValue(value: number): string;
|
|
15
|
+
export interface PerpsTransferFormProps {
|
|
16
|
+
predictionsBalanceUsd: number;
|
|
17
|
+
perpsBalanceUsd: number;
|
|
18
|
+
/** Minimum pUSD to transfer *into* predictions (USD). */
|
|
19
|
+
predictionsMinTransferUsd?: number;
|
|
20
|
+
/** Minimum pUSD to transfer *into* perps (USD). */
|
|
21
|
+
perpsMinTransferUsd?: number;
|
|
22
|
+
initialDirection?: PerpsTransferDirection;
|
|
23
|
+
/** Initial amount input string (pUSD). */
|
|
24
|
+
initialAmountUsd?: string;
|
|
25
|
+
status?: PerpsTransferStatus;
|
|
26
|
+
onTransfer: (params: {
|
|
27
|
+
/** Exact string the user entered (validated numeric, ≤6 decimals). */
|
|
28
|
+
amountUsd: string;
|
|
29
|
+
direction: PerpsTransferDirection;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface PerpsTransferAccount {
|
|
33
|
+
/** Localized account name ("Predictions" / "Perps"). */
|
|
34
|
+
label: string;
|
|
35
|
+
balanceUsd: number;
|
|
36
|
+
}
|
|
37
|
+
/** Plain form state consumed by `PerpsTransferRows` and `PerpsTransferBottomBar`. */
|
|
38
|
+
export interface PerpsTransferForm {
|
|
39
|
+
/** Raw amount input string (may contain separators). */
|
|
40
|
+
amount: string;
|
|
41
|
+
/** Validated setter — ignores input that isn't numeric with ≤6 decimals. */
|
|
42
|
+
setAmount: (next: string) => void;
|
|
43
|
+
/** Fills the amount with the source balance at full 6-decimal precision. */
|
|
44
|
+
fillMaxAmount: () => void;
|
|
45
|
+
swapDirection: () => void;
|
|
46
|
+
/** The editable "From" account. */
|
|
47
|
+
source: PerpsTransferAccount;
|
|
48
|
+
/** The read-only "To" account mirroring the source. */
|
|
49
|
+
destination: PerpsTransferAccount;
|
|
50
|
+
/** Validation/error notice line; `null` when nothing should be shown. */
|
|
51
|
+
noticeText: string | null;
|
|
52
|
+
/** Status for the action button (`error` is remapped to a retry-able idle). */
|
|
53
|
+
buttonStatus: PerpsTransferStatus;
|
|
54
|
+
isTransferDisabled: boolean;
|
|
55
|
+
/** Reports the entered amount + direction via the host's `onTransfer`. */
|
|
56
|
+
requestTransfer: () => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Owns the Perps ⇄ Predictions transfer form state — amount, direction, and
|
|
60
|
+
* the derived validation/notice/button values — so both the standalone
|
|
61
|
+
* {@link PolymarketPerpsTransferScreen} (Dialog) and the in-modal
|
|
62
|
+
* `PerpsTransferStep` (renders rows inline + portals the bottom bar) share
|
|
63
|
+
* identical behavior. Returns plain values; `PerpsTransferRows` and
|
|
64
|
+
* `PerpsTransferBottomBar` render them.
|
|
65
|
+
*/
|
|
66
|
+
export declare function usePerpsTransferForm({ predictionsBalanceUsd, perpsBalanceUsd, predictionsMinTransferUsd, perpsMinTransferUsd, initialDirection, initialAmountUsd, status, onTransfer, }: PerpsTransferFormProps): PerpsTransferForm;
|
|
@@ -5,7 +5,7 @@ import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
|
5
5
|
import type { AssetHoldingsItem } from '../../utils/assets';
|
|
6
6
|
import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
|
|
7
7
|
import { type FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
|
|
8
|
-
import type { FunkitActiveCheckoutItem, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, FunkitWithdrawalConfig, UseFunkitCheckoutProps, UseFunkitCheckoutPropsWithFullConfig } from './types';
|
|
8
|
+
import type { DynamicTargetAssetCandidate, FunkitActiveCheckoutItem, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, FunkitWithdrawalConfig, UseFunkitCheckoutProps, UseFunkitCheckoutPropsWithFullConfig } from './types';
|
|
9
9
|
export * from './types';
|
|
10
10
|
interface FunkitCheckoutContextInterface {
|
|
11
11
|
checkoutItem: FunkitActiveCheckoutItem | null;
|
|
@@ -45,6 +45,15 @@ interface FunkitCheckoutContextInterface {
|
|
|
45
45
|
resetForNewDeposit(): void;
|
|
46
46
|
applyDynamicRouting(path: ApplyDynamicRoutingPath): void;
|
|
47
47
|
updateDynamicRoutingId(dynamicRoutingId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Apply a selected {@link DynamicTargetAssetCandidate} to the active checkout
|
|
50
|
+
* in one atomic update: target token fields, `dynamicRoutingId`, and (when the
|
|
51
|
+
* candidate carries one) `customRecipient`. The single source of truth for
|
|
52
|
+
* "select a destination candidate", shared by the SourceChange target-asset
|
|
53
|
+
* dropdown and customer account pickers (e.g. Polymarket) so neither has to
|
|
54
|
+
* re-sequence the individual setters.
|
|
55
|
+
*/
|
|
56
|
+
applyDynamicTargetAssetCandidate(candidate: DynamicTargetAssetCandidate): void;
|
|
48
57
|
}
|
|
49
58
|
export type CheckoutProgressStep = 1 | 2;
|
|
50
59
|
export type CheckoutProgress = {
|
|
@@ -36,6 +36,14 @@ export interface DynamicTargetAssetCandidate extends TokenInfo {
|
|
|
36
36
|
*/
|
|
37
37
|
finalizedTokenRate?: number;
|
|
38
38
|
dynamicRoutingId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Recipient to point the checkout at when this candidate is selected. Set when
|
|
41
|
+
* candidates represent destination *accounts* that share a target token but
|
|
42
|
+
* differ by recipient (e.g. Polymarket Predictions vs Perps); selecting one
|
|
43
|
+
* routes funds to its address. Omit for plain token candidates (the recipient
|
|
44
|
+
* is unchanged).
|
|
45
|
+
*/
|
|
46
|
+
customRecipient?: Address;
|
|
39
47
|
}
|
|
40
48
|
/**
|
|
41
49
|
* A token to offer adding to the user's wallet (EIP-747 `wallet_watchAsset`) on
|
|
@@ -60,7 +68,48 @@ export interface AddToWalletToken extends TokenInfo {
|
|
|
60
68
|
export declare enum FunCheckoutStartingStep {
|
|
61
69
|
SOURCE_CHANGE = "source_change",
|
|
62
70
|
CONFIRMATION = "confirmation",
|
|
63
|
-
SELECT_ASSET = "select_asset"
|
|
71
|
+
SELECT_ASSET = "select_asset",
|
|
72
|
+
/**
|
|
73
|
+
* Open directly on the Polymarket perps ⇄ predictions transfer step.
|
|
74
|
+
* Requires {@link FunkitCheckoutConfig.polymarketPerpsTransfer} handles
|
|
75
|
+
* (set by `createPolymarketDepositConfig`) — without them the step renders
|
|
76
|
+
* but cannot transfer.
|
|
77
|
+
*/
|
|
78
|
+
PERPS_TRANSFER = "perps_transfer"
|
|
79
|
+
}
|
|
80
|
+
/** Token a Polymarket account can be topped up with. */
|
|
81
|
+
export type PolymarketTopupToken = 'pUSD';
|
|
82
|
+
/**
|
|
83
|
+
* A Polymarket account in the transfer step. Both accounts share the same shape
|
|
84
|
+
* so each direction is symmetrical and integrator-owned.
|
|
85
|
+
*/
|
|
86
|
+
export interface PolymarketTransferAccount {
|
|
87
|
+
/** Account address (the transfer target when funds move *into* it). */
|
|
88
|
+
address: Address;
|
|
89
|
+
/** Minimum amount (USD) to top this account up with `token` (0 = none). */
|
|
90
|
+
getMinTopupAmount: (token: PolymarketTopupToken) => number;
|
|
91
|
+
/**
|
|
92
|
+
* Transfers funds *from* this account to `toAddress`. Implemented by the
|
|
93
|
+
* integrator (keeps their perps API auth in-house); the SDK invokes the
|
|
94
|
+
* source account's transfer when the user confirms. `amountUsd` is the exact
|
|
95
|
+
* string the user entered (validated numeric, ≤6 decimals) — never a parsed
|
|
96
|
+
* number — so no float precision is lost before the integrator scales it.
|
|
97
|
+
*/
|
|
98
|
+
transfer: (params: {
|
|
99
|
+
toAddress: Address;
|
|
100
|
+
amountUsd: string;
|
|
101
|
+
}) => Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Fetches this account's live balance (USD). The transfer step polls this so
|
|
104
|
+
* the displayed balances reconcile with the real on-chain / perps-API state
|
|
105
|
+
* after a transfer (optimistic updates alone go stale). Integrator-owned.
|
|
106
|
+
*/
|
|
107
|
+
getBalanceUsd: () => Promise<number>;
|
|
108
|
+
}
|
|
109
|
+
/** The two accounts the perps transfer step moves funds between. */
|
|
110
|
+
export interface PolymarketPerpsTransferHandles {
|
|
111
|
+
predictions: PolymarketTransferAccount;
|
|
112
|
+
perps: PolymarketTransferAccount;
|
|
64
113
|
}
|
|
65
114
|
export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta'> {
|
|
66
115
|
/** List of contract action params **/
|
|
@@ -116,11 +165,22 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
|
|
|
116
165
|
********************************/
|
|
117
166
|
/** a list of candidate assets to be chosen dynamically */
|
|
118
167
|
dynamicTargetAssetCandidates?: DynamicTargetAssetCandidate[];
|
|
119
|
-
/**
|
|
120
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Minimal USD needed to deposit. Receives the active `dynamicRoutingId` (like
|
|
170
|
+
* {@link modalTitle}) so the minimum can vary by route when two routes share a
|
|
171
|
+
* target token (e.g. Polymarket predictions vs perps).
|
|
172
|
+
*/
|
|
173
|
+
getMinDepositUSD?: (asset: ModalTitleContext) => number;
|
|
121
174
|
/** For Checkout with Custom Action, QRCode needs special action type
|
|
122
175
|
* to specify the onchain action to execute after deposit */
|
|
123
176
|
qrcodeActionType?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Polymarket-specific handles for the perps ⇄ predictions transfer step. Set
|
|
179
|
+
* by `createPolymarketDepositConfig` and read by the perps transfer step.
|
|
180
|
+
* Lets Polymarket keep their perps API auth in-house (they implement the
|
|
181
|
+
* withdrawal) instead of handing the SDK an API key.
|
|
182
|
+
*/
|
|
183
|
+
polymarketPerpsTransfer?: PolymarketPerpsTransferHandles;
|
|
124
184
|
/** set this if you want enable vault like deposit*/
|
|
125
185
|
finalizedToken?: DynamicTargetAssetCandidate;
|
|
126
186
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type JSX, type ReactNode } from 'react';
|
|
2
2
|
import type { BluvoExchangeType } from '../consts/bluvo';
|
|
3
3
|
import type { PaymentMethod } from '../domains/paymentMethods';
|
|
4
|
+
import type { SourceChangeTopComponentProps } from '../modals/CheckoutModal/stepTransition';
|
|
4
5
|
export interface FunkitTextCustomizationsConfig {
|
|
5
6
|
virtualFiat: string;
|
|
6
7
|
brokerageOrExchange: string;
|
|
@@ -8,6 +9,7 @@ export interface FunkitTextCustomizationsConfig {
|
|
|
8
9
|
accountBalance: string;
|
|
9
10
|
selectAccount: string;
|
|
10
11
|
sourceChangeTitle?: string;
|
|
12
|
+
perpsTransferTitle: string;
|
|
11
13
|
sourceMethodTitle: string;
|
|
12
14
|
tokensListTitle: string;
|
|
13
15
|
transferTokens: string;
|
|
@@ -195,8 +197,17 @@ export interface FunkitUiCustomizationsConfig {
|
|
|
195
197
|
showWalletOnInsufficientBalance?: boolean;
|
|
196
198
|
/** Whether to show the wallet connect payment option - defaults to true */
|
|
197
199
|
showWalletConnect?: boolean;
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Renders custom content before other UIs in the source change screen.
|
|
202
|
+
* Receives modal navigation handles so it can jump to another step (e.g.
|
|
203
|
+
* open a transfer step). Existing zero-arg components remain valid.
|
|
204
|
+
*/
|
|
205
|
+
customTopComponent?: (props?: SourceChangeTopComponentProps) => ReactNode;
|
|
206
|
+
/**
|
|
207
|
+
* Render a full-width divider beneath {@link customTopComponent} (matching
|
|
208
|
+
* the target-asset selector divider). Defaults to false.
|
|
209
|
+
*/
|
|
210
|
+
showCustomTopComponentDivider?: boolean;
|
|
200
211
|
paymentMethodIcons?: {
|
|
201
212
|
primary?: FunkitPaymentMethodIconsConfig;
|
|
202
213
|
/** Custom secondary icon or "value icon" in the context of FunPaymentMethodItem */
|
|
@@ -63,6 +63,22 @@ interface FunkitQuoteContextInterface extends CheckoutQuoteState {
|
|
|
63
63
|
targetAssetPoolAllowance: bigint | undefined;
|
|
64
64
|
setTargetAssetPoolAllowance: (value: bigint | undefined) => void;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Shared preconditions (wallet-executed account-balance flows only), then a
|
|
68
|
+
* per-flow gate. Aave native supply is capability-gated: EIP-2612 support
|
|
69
|
+
* (`undefined` = still loading → show optimistically, `false` = hide) and no
|
|
70
|
+
* covering Pool allowance — never the feature flag (ENG-4070). The Relay
|
|
71
|
+
* flow's source-side Permit2-vs-approve choice stays behind the
|
|
72
|
+
* `enable-permit-toggle` Statsig rollout gate.
|
|
73
|
+
*/
|
|
74
|
+
export declare function shouldShowApprovalMethodToggle({ isPermitToggleGateOn, isDirectExecution, isAccountBalancePayment, isAaveNativeSupplyFlow, targetAssetSupportsPermit, targetAssetAllowanceCoversAmount, }: {
|
|
75
|
+
isPermitToggleGateOn: boolean;
|
|
76
|
+
isDirectExecution: boolean;
|
|
77
|
+
isAccountBalancePayment: boolean;
|
|
78
|
+
isAaveNativeSupplyFlow: boolean;
|
|
79
|
+
targetAssetSupportsPermit: boolean | undefined;
|
|
80
|
+
targetAssetAllowanceCoversAmount: boolean;
|
|
81
|
+
}): boolean;
|
|
66
82
|
export declare function FunkitQuoteProvider({ children }: {
|
|
67
83
|
children: ReactNode;
|
|
68
84
|
}): React.JSX.Element;
|