import * as react_jsx_runtime from 'react/jsx-runtime'; import React from 'react'; import { QueryClient } from '@tanstack/react-query'; import { ChainType, SuggestedAmounts, DepositConfirmationMode, DepositMethod, DepositModalInitialScreen, ThemeMode, DepositMenuLayout, DepositMenuLayoutType, ThemeConfig, FontConfig, ComponentConfig, WithdrawModalInitialScreen, WithdrawTransactionInfo, AllowedCountryResult } from '@unifold/ui-react'; export { AllowedCountryResult, BrowserWalletAmountQuickSelect, Button, ButtonProps, ButtonTokens, CardTokens, ComponentConfig, ComponentTokens, ConfirmingView, ContainerTokens, CustomThemeColors, DepositConfirmationMode, DepositModalInitialScreen as DepositInitialScreen, DepositMenuLayout, DepositMenuLayoutType, DepositMethod, DepositTab, FontConfig, HeaderTokens, I18nContextValue, I18nProvider, I18nProviderProps, InputTokens, ListTokens, LocaleCode, SUPPORTED_LOCALES, SearchTokens, SuggestedAmountCurrency, SuggestedAmounts, ThemeColors, ThemeConfig, ThemeMode, UseSupportedDepositTokensOptions, WithdrawModalInitialScreen as WithdrawInitialScreen, WithdrawTransactionInfo, detectBrowserLocale, interpolate, normalizeLocale, useI18n, useSupportedDepositTokens } from '@unifold/ui-react'; import { CheckoutMethod, CheckoutPaymentIntent, CheckoutEvent, EvmContractCall, DirectExecutionSucceededEvent, DepositEvent, WithdrawDirectExecutionSucceededEvent, WithdrawEvent } from '@unifold/core'; export { ActionType, AutoSwapRequest, AutoSwapResponse, ChainType, CheckoutEvent, CheckoutEventType, CheckoutMethod, CheckoutPaymentIntent, CheckoutPaymentIntentData, CheckoutPaymentIntentSucceededEvent, CreateDepositAddressRequest, DefaultTokenChain, DefaultTokenMetadata, DefaultTokenResponse, DepositAddressResponse, DepositEvent, DepositEventType, DepositQuote, DepositQuoteRequest, DestinationToken, DestinationTokenChain, DirectExecution, DirectExecutionResponse, ExecutionStatus, FeaturedToken, FiatCurrenciesResponse, FiatCurrency, I18nStrings, IconUrl, IpAddressResponse, LockedQuoteLimits, LockedQuotePreview, LockedQuotePreviewRequest, OnrampQuote, OnrampQuotesRequest, OnrampQuotesResponse, OnrampSessionCreatedData, OnrampSessionCreatedEvent, OnrampSessionRequest, OnrampSessionResponse, PaymentIntent, PaymentIntentDepositAddress, PaymentIntentStatus, PaymentIntentType, PaymentNetwork, ProjectConfigResponse, QueryExecutionsRequest, QueryExecutionsResponse, SOLANA_USDC_ADDRESS, SendSolanaTransactionRequest, SendSolanaTransactionResponse, SourceToken, SourceTokenNetwork, StripeAccessTokenResponse, StripeAuthIntentResponse, StripeConfigResponse, StripeConfirmRequest, StripeConsumerWallet, StripeCreateSessionRequest, StripeCryptoCustomer, StripeCustomerVerification, StripeDefaultTokenResponse, StripeListResponse, StripeOnrampSession, StripeOnrampTransactionDetails, StripePaymentToken, StripeQuoteRequest, StripeQuotesResponse, SupportedChain, SupportedDepositTokensResponse, SupportedDestinationTokensResponse, SupportedSourceTokensQuery, SupportedSourceTokensResponse, SupportedToken, TokenChain, TokenChainIconUrl, TokenChainsResponse, UserIpInfo, Wallet, WithdrawDirectExecutionSucceededEvent, WithdrawEvent, WithdrawEventType, createDepositAddress, createOnrampSession, generatePrefixedKSUID, getApiBaseUrl, getChainName, getDefaultOnrampToken, getDepositQuote, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getWalletByChainType, i18n, queryExecutions, retrievePaymentIntent, sendSolanaTransaction, setApiConfig, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp } from '@unifold/core'; interface UnifoldConnectProviderConfig { publishableKey: string; /** * Bring your own TanStack QueryClient. When provided, UnifoldProvider uses * this client instance instead of creating its own, so Unifold hooks share the * same cache, devtools, and default options as the rest of the app (no second * client is created). * * UnifoldProvider always mounts its own QueryClientProvider with the resolved * client (passing a client does not imply a provider already exists), so the * SDK works even when its UI renders in a detached React root. */ queryClient?: QueryClient; config?: { /** * UI language as a BCP-47 tag (e.g. "en", "zh", "fr", "ja", "ko", "th"). * When omitted, the browser locale is auto-detected. Unsupported locales * fall back to English. */ locale?: string; modalTitle?: string; /** Custom title for the withdraw modal. @default `"Withdraw"` */ withdrawModalTitle?: string; hideDepositTracker?: boolean; /** Show balance in deposit modal header. Defaults to true */ showBalanceHeader?: boolean; /** Theme appearance: 'light', 'dark', or 'auto' (system preference). Defaults to 'dark' */ appearance?: ThemeMode | 'auto'; /** Transfer input variant: 'single_input' or 'double_input'. Defaults to 'double_input' */ transferInputVariant?: 'single_input' | 'double_input'; /** * Deposit menu layout, and the options belonging to it: * * ```ts * layout: { type: 'tabs', tabOrder: ['cash', 'crypto'] } * ``` * * `layout.type` takes precedence over the superseded `displayMode`. A * `layout` that omits `type` still falls back to it, so the layout's * options can be adopted without changing how the layout is selected. */ layout?: DepositMenuLayout; /** * Deposit menu layout: 'tabs' (default, options grouped under "Use Crypto" * / "Use Cash" tabs) or 'stacked' (every option in a single list). * * @deprecated Use `layout` instead, which also carries the layout's own * options. `displayMode: 'stacked'` becomes `layout: { type: 'stacked' }`. */ displayMode?: DepositMenuLayoutType; /** Enable "Transfer Crypto" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enableTransferCrypto?: boolean; /** Enable browser wallet connection option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enableConnectWallet?: boolean; /** Enable "Pay with Exchange" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enablePayWithExchange?: boolean; /** Enable the fiat on-ramp option (shown as "Deposit with Card"). Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enableFiatOnramp?: boolean; /** Enable "Connect Exchange" option for direct Coinbase Connect integration. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enableConnectExchange?: boolean; /** Enable "Pay with Cash App" option. Overrides dashboard default. Resolves as flag ?? dashboard value ?? true. */ enableCashApp?: boolean; /** * Enable the "Pay with Interac" option (CAD e-Transfer, Canada). Opt-in * like Stripe Link: resolves as flag ?? dashboard `interac.enabled` ?? false. * The platform `interac.is_hidden` hard hide (project whitelist + Canada-only) * always wins. */ enableInterac?: boolean; /** * Enable the "Bank Transfer" option. Resolves as flag ?? dashboard * `bank_transfer.enabled` ?? false. The platform `bank_transfer.is_hidden` * hard hide always wins. */ enableBankTransfer?: boolean; /** Enable "Pay with Link" headless onramp option. Defaults to false. */ enableStripeLink?: boolean; /** * Notification UI feature flags grouped by concern. */ notifications?: { /** * Opt in to showing the in-product incident banner UI. * Defaults to false. */ incidentBanner?: boolean; }; /** * Display preferences for specific deposit surfaces. */ display?: { transferCrypto?: { /** * Show the reference exchange-rate row on Transfer Crypto screens. * Defaults to false. */ exchangeRate?: boolean; }; }; /** * Enable "Pay with Apple Pay" (headless Coinbase) option. Overrides * dashboard default. Resolves as flag ?? dashboard `apple_pay.enabled` ?? * true. The server still gates per-region (US-only, NY excluded at * launch) at order-creation time. */ enableApplePay?: boolean; /** Main menu — Apple Pay row title. @default `"Pay with Apple Pay"` (localized when omitted) */ applePayTitle?: string; /** Main menu — Apple Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */ applePaySubTitle?: string; /** * Enable "Pay with Google Pay" (headless Coinbase) option. Overrides * dashboard default. Resolves as flag ?? dashboard `google_pay.enabled` ?? * true. The server still gates per-region (US-only, NY excluded at * launch) at order-creation time. */ enableGooglePay?: boolean; /** Main menu — Google Pay row title. @default `"Pay with Google Pay"` (localized when omitted) */ googlePayTitle?: string; /** Main menu — Google Pay row subtitle. @default `"Instant • Debit card only"` (localized when omitted) */ googlePaySubTitle?: string; /** Simple accent/primary color override (applies to both light and dark modes) */ accentColor?: string; /** Full theme color customization per mode */ theme?: ThemeConfig; /** Single font family for all text (host app must load the font) */ fontFamily?: string; /** Granular font family configuration for different weights */ fonts?: FontConfig; /** Component-specific token overrides */ components?: ComponentConfig; /** Default `initialScreen` for `beginDeposit()` when the call omits it */ defaultInitialScreen?: DepositModalInitialScreen; /** * Default `showMenuFromInitialScreen` for `beginDeposit()` when the call * omits it. See the per-call `showMenuFromInitialScreen` on the deposit * config for what it does. */ defaultShowMenuFromInitialScreen?: boolean; /** Main menu — Transfer Crypto row title. @default `"Transfer Crypto"` (from package i18n when omitted) */ transferCryptoTitle?: string; /** Main menu — Deposit with Card row title. @default `"Deposit with Card"` */ depositWithCardTitle?: string; /** Main menu — Pay with Exchange row title. @default `"Pay with Exchange"` */ payWithExchangeTitle?: string; /** Main menu — Deposit Tracker row title. @default `"Deposit Tracker"` */ depositTrackerTitle?: string; /** Main menu — Deposit Tracker row description. @default `"Track your deposit progress"` */ depositTrackerSubTitle?: string; /** Deposit with Card onramp: hide You use / You buy / You receive. @default false */ hideDepositFlowInfo?: boolean; /** Deposit with Card onramp: hide wallet address disclaimer. @default false */ hideDisplayDescription?: boolean; /** Connect Wallet → Enter amount: `percentage` (10%, 25%, 50%, 75%, MAX) or `usd` ($25…). @default `percentage` */ browserWalletAmountQuickSelect?: 'usd' | 'percentage'; }; } interface DepositResult { message: string; transaction?: unknown; executionId?: string; execution?: DirectExecutionSucceededEvent; method?: DepositMethod; } interface DepositError { message: string; error?: unknown; code?: string; method?: DepositMethod; } interface DepositConfig { externalUserId: string; destinationChainType: ChainType; destinationChainId: string; destinationTokenAddress: string; destinationTokenSymbol: string; /** Address that receives the deposited funds. */ recipientAddress: string; /** * The host platform's signed-in user. Currently used to pre-fill and pre-trust * the user's email across onramp flows: * * - **Stripe Link / other onramp providers (Banxa, etc.):** `user.email` pre-fills * the email screen and auto-submits, skipping manual entry. * - **Apple Pay (headless Coinbase):** `user.email` pre-fills the contact * form. Email OTP is not required (default `required_factors` is phone). * Phone OTP is still required (Coinbase mandates phone re-verification * every 60 days). */ user?: { /** User's email address. Pre-fills Stripe Link / onramp flows and acts as the pre-trusted email for Apple Pay (headless Coinbase). */ email?: string; }; /** * Array of contract calls to execute on the destination chain when delivering funds. * Each entry specifies a target contract address, hex-encoded data, and optional value in wei (defaults to "0"). * Only supported when destinationChainType is "ethereum" and * destinationChainId is one of: "1", "8453", "42161", "4326". */ contractCalls?: EvmContractCall[]; /** * Prefer a source token/chain in Transfer Crypto, Wallet Connect, and Connect Exchange flows. * All four props are optional. To match a specific token, provide `chainType` + `chainId` + (`symbol` OR `tokenAddress`). * If omitted or no match is found in `/supported_deposit_tokens`, each flow uses its normal ordering. */ defaultSourceChainType?: ChainType; /** Source chain ID (e.g. `"mainnet"`, `"137"`). Must be paired with `defaultSourceChainType` and a symbol or token address. */ defaultSourceChainId?: string; /** Source token contract address. Must be paired with `defaultSourceChainType` + `defaultSourceChainId` to match. */ defaultSourceTokenAddress?: string; /** Source token symbol (e.g. `"USDC"`). Must be paired with `defaultSourceChainType` + `defaultSourceChainId` to match. */ defaultSourceSymbol?: string; /** * Pre-fill USD amount inputs in deposit flows as initial typed input. * Useful for "deposit mode" flows that skip Payment Intent and still want a * suggested amount. */ prefilledAmountUsd?: string; /** * Quick-amount chips on amount-entry screens, keyed by lowercase currency * code, in major units (`25` = $25.00): * * ```ts * suggestedAmounts: { usd: [20, 50, 100], cad: [100, 250, 500] } * ``` * * Each flow reads the entry for the currency it shows: `usd` for Deposit with * Card (while USD is selected), Apple Pay / Google Pay, Stripe Link, Cash App, * Connect Exchange, Pay with Exchange, and Connect Wallet's fixed-amount chips * (`browserWalletAmountQuickSelect: 'usd'`); `cad` for Interac; `eur` / * `gbp` for Deposit with Card in those currencies. * * - No entry for the currency: the flow keeps its built-in chips. * - `[]`: the chips are hidden. * - Otherwise chips show in the order given. Values outside the flow's * min/max and duplicates are dropped, then the first four are used. If * none are left, the flow keeps its built-in chips. */ suggestedAmounts?: SuggestedAmounts; /** * Fiat on-ramp ("Deposit with Card") options, scoped to that flow so they can * be added/removed independently of the rest of the deposit config. */ fiatOnramp?: { /** * Fixed crypto (destination) amount to buy. When set, the card flow's fiat * input is locked (view-only, shown as the USD→local-currency conversion) and * the onramp is quoted/charged by this crypto amount with provider fees added * on top. Only providers that support a fixed destination amount are shown, * and only stablecoin destinations are supported. */ destinationAmount?: string; }; /** How to confirm deposit: 'auto_ui' (default), 'auto_silent', or 'manual' */ depositConfirmationMode?: DepositConfirmationMode; onSuccess?: (data: DepositResult) => void; onError?: (error: DepositError) => void; /** Called when the user dismisses the deposit dialog (X button, Escape key, or programmatic close) */ onClose?: () => void; /** * Called once after the deposit dialog has fully left the DOM — i.e. after * the exit animation completes and React unmounts the modal subtree, which is * also when the SDK's bundled Radix scroll lock / `body.style.pointerEvents` * are restored. Unlike {@link onClose} (which fires the instant a close is * *triggered*), this is the deterministic "unmount complete" signal. * * Use it to sequence a host-app modal that sits behind the Unifold dialog: * close Unifold → wait for `onUnmount` → remount your modal. This removes any * dependence on guessing exit-animation timing and is safe under * `prefers-reduced-motion` (fires immediately when animations are disabled). */ onUnmount?: () => void; /** Called when deposit lifecycle events occur. Use {@link DepositEventType} to narrow the event type. See {@link DepositEvent} for the full union. */ onEvent?: (event: DepositEvent) => void; /** * Which screen opens first. One of: `main` (menu, default), `transfer`, `card`, `cashapp`, * `tracker`, `pay_with_exchange` (Pay with Exchange), `exchange_connect` (Connect Exchange), or * `wallet_connect` (Connect Wallet). * `transfer` and `card` run the same geo / recipient checks as the menu before the flow. `tracker` does not * (deposit history is always reachable). A screen falls back to `main` when its feature flag is disabled * (e.g. `cashapp` without `enableCashApp`, `exchange_connect` without `enableConnectExchange`). * If not `main`, the header back control is hidden at the flow's root (nothing to return to); inner steps * (card quotes/onramp, tracker detail, exchange pending, cashapp payment, etc.) still show back for inner navigation. * Set {@link showMenuFromInitialScreen} to override that root behavior and add a back button to the menu. */ initialScreen?: DepositModalInitialScreen; /** * Opt-in override of the deep-link root behavior described on * {@link initialScreen}. The two are mutually exclusive — pick one: * * - **`false` (default):** a non-`main` `initialScreen` is a self-contained * flow with no back control at its root, and no way to reach the other * funding methods. * - **`true`:** the flow still opens on `initialScreen`, but its root gains a * back button that returns to the full deposit menu, from which every other * enabled method is reachable. * * No effect when `initialScreen` is `main`. Only enable it when exposing the * full menu to a deep-linked user is intended. * * @default false */ showMenuFromInitialScreen?: boolean; } interface CheckoutResult { paymentIntentId: string; status: string; method?: CheckoutMethod; /** * Full payment intent details at the time of success, mapped to SDK camelCase. * Mirrors the `DepositResult.execution` field on the deposit side. * Always populated for the terminal `succeeded` callback; may be undefined for * intermediate `processing` callbacks fired right after a wallet confirmation. */ paymentIntent?: CheckoutPaymentIntent; } interface CheckoutError { message: string; error?: unknown; code?: string; method?: CheckoutMethod; } interface WithdrawResult { message: string; transaction?: unknown; executionId?: string; execution?: WithdrawDirectExecutionSucceededEvent; } interface WithdrawError { message: string; error?: unknown; code?: string; } interface CheckoutConfig { /** The client_secret from a PaymentIntent created on your server */ clientSecret: string; /** * Your own id for the payer, echoed onto every `onEvent` envelope so a * shared handler can attribute events by user. Optional and purely a * passthrough — a checkout is identified by its payment intent, which every * envelope already carries as `paymentIntentId`. */ externalUserId?: string; /** * Prefer a source token/chain in Transfer Crypto and Wallet Connect flows. * All four props are optional. To match a specific token, provide `chainType` + `chainId` + (`symbol` OR `tokenAddress`). * If omitted or no match is found in `/supported_deposit_tokens`, each flow uses its normal ordering. */ defaultSourceChainType?: ChainType; /** Source chain ID (e.g. `"mainnet"`, `"137"`). Must be paired with `defaultSourceChainType` + symbol or token address. */ defaultSourceChainId?: string; /** Source token contract address. Must be paired with `defaultSourceChainType` + `defaultSourceChainId`. */ defaultSourceTokenAddress?: string; /** Source token symbol (e.g. `"USDC"`). Must be paired with `defaultSourceChainType` + `defaultSourceChainId`. */ defaultSourceSymbol?: string; /** Optional callbacks (fired immediately when events occur) */ onSuccess?: (data: CheckoutResult) => void; onError?: (error: CheckoutError) => void; /** Called when checkout lifecycle events occur. */ onEvent?: (event: CheckoutEvent) => void; /** Called when the user dismisses the checkout dialog */ onClose?: () => void; } interface WithdrawConfig { /** External user ID — required, same as deposit */ externalUserId: string; /** Source token chain type (e.g. 'ethereum', 'solana'). Must be a supported stablecoin. */ sourceChainType: ChainType; /** Source token chain ID (e.g. '8453', 'mainnet') */ sourceChainId: string; /** Source token contract address */ sourceTokenAddress: string; /** Source token symbol (e.g. 'USDC'). Optional but recommended for display. */ sourceTokenSymbol?: string; /** * Screen the withdraw modal opens on. `main` (default) = the withdrawal * method menu, `crypto` = straight into amount → recipient → review, * `tracker` = the withdrawal history list. Deep links hide the header * **back** at that flow's root; inner steps still show it. * * `crypto` falls back to `main` when the source token turns out not to be * withdrawable, since that's the screen that explains why. */ initialScreen?: WithdrawModalInitialScreen; /** Optional: pre-fill the recipient address the user is withdrawing to */ recipientAddress?: string; /** * Pre-select the destination (receive) token/chain in the withdraw view. * All four props are optional. To match a specific token, provide `chainType` + `chainId` + (`symbol` OR `tokenAddress`). * If omitted or no match is found in `/supported_destination_tokens`, the first available token and chain are used. */ defaultDestinationChainType?: string; /** Destination chain ID (e.g. `"mainnet"`, `"137"`). Must be paired with `defaultDestinationChainType` + symbol or token address. */ defaultDestinationChainId?: string; /** Destination token contract address. Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */ defaultDestinationTokenAddress?: string; /** Destination token symbol (e.g. `"USDC"`). Must be paired with `defaultDestinationChainType` + `defaultDestinationChainId`. */ defaultDestinationSymbol?: string; /** * The user's wallet address (the sender). Used to: * 1. Fetch balance for max / over-balance (unless `balanceInBaseUnit` is provided) * 2. Detect if a matching browser wallet is connected */ senderAddress: string; /** * Sender token balance in smallest units (e.g. `"1500000"` for 1.5 USDC). * When provided, the modal skips `/addresses/balance` and uses this as the * source of truth for max withdraw, over-balance checks, and amount conversion. */ balanceInBaseUnit?: string; /** * USD value of {@link WithdrawConfig.balanceInBaseUnit}. When provided with * `balanceInBaseUnit`, used for fiat display, max, and crypto↔USD conversion * with no extra network calls. When omitted, the modal prices the token * (stablecoins assume $1) to compute USD. */ balanceUsd?: string | number; /** * Source token decimals (e.g. `6` for USDC). Used with `balanceInBaseUnit` * to format the human amount without waiting on the token catalog. Falls * back to catalog decimals when omitted. */ sourceTokenDecimals?: number; /** * Callback invoked with transaction details when the user confirms withdrawal. * The host app is responsible for signing and submitting the transaction — the * SDK does not have access to the user's private key. * * Move `txInfo.amountBaseUnit` to `txInfo.withdrawIntentAddress`. That address * is not always on `sourceChainType`: withdrawing off a chain Unifold can't * monitor (N1) hands back a Solana address to bridge to instead. */ withdraw: (txInfo: WithdrawTransactionInfo) => void | Promise; onSuccess?: (data: WithdrawResult) => void; onError?: (error: WithdrawError) => void; /** Called when withdraw lifecycle events occur. */ onEvent?: (event: WithdrawEvent) => void; onClose?: () => void; } declare function UnifoldProvider({ children, publishableKey, queryClient, config, }: React.PropsWithChildren): react_jsx_runtime.JSX.Element; declare function useUnifold(): { publishableKey: string; beginDeposit: (config: DepositConfig) => Promise; closeDeposit: () => void; beginCheckout: (config: CheckoutConfig) => Promise; closeCheckout: () => void; beginWithdraw: (config: WithdrawConfig) => Promise; closeWithdraw: () => void; }; /** * Convenience wrapper for useAllowedCountry that automatically passes publishableKey from context * * This wrapper makes it easy for developers to check geo-restrictions without manually * passing the publishableKey. * * @returns AllowedCountryResult with isAllowed status and location info * * @example * ```tsx * import { useAllowedCountry } from '@unifold/connect-react'; * * function MyComponent() { * const { isAllowed, isLoading, error } = useAllowedCountry(); * * if (isLoading) return ; * if (!isAllowed) return ; * * return ; * } * ``` */ declare function useAllowedCountry(): AllowedCountryResult; export { type CheckoutConfig, type CheckoutError, type CheckoutResult, type DepositConfig, type DepositError, type DepositResult, type UnifoldConnectProviderConfig, UnifoldProvider, type WithdrawConfig, type WithdrawError, type WithdrawResult, useAllowedCountry, useUnifold };