UNPKG

@funkit/connect

Version:

Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.

41 lines (40 loc) 1.77 kB
import { type Address } from 'viem'; import { type CustomWithdrawalConfig, type FunkitActiveWithdrawalItem, type WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext'; /** * Provider-agnostic fiat off-ramp order: deliver `amount` of the accepted * token to `destinationAddress`. The Swapped controller maps its order payload * onto this shape. */ export interface FiatWithdrawalOrder { orderId: string; destinationAddress: Address; /** Amount (human units) of the target/accepted token the provider expects. */ amount: string; /** * Provider-reported accepted asset, by name (e.g. `'USDC'` / `'base'`). * Informational only — surfaced in the route-decision log for reconciliation, * never used to determine routing (routing comes from config + the Statsig * source override). */ providerCrypto?: string; providerNetwork?: string; } interface UseFiatWithdrawalParams { config: WalletWithdrawalConfig | CustomWithdrawalConfig; withdrawalItem: FunkitActiveWithdrawalItem | null; /** Invoked for unrecoverable failures (the caller tears down the flow). */ onError: () => void; } /** * Owns the order → quote → execute pipeline for a fiat off-ramp withdrawal, * keeping the iframe controller a thin lifecycle/dispatch shell. * * Quoting is **EXACT_OUT** — the provider credits fiat on the exact deposited * amount, so we deliver exactly what it expects. Execution itself is delegated * to {@link useWithdrawal}, which owns preWithdrawalAction + confirmCheckout + * error mapping. */ export declare function useFiatWithdrawal({ config, withdrawalItem, onError, }: UseFiatWithdrawalParams): { processOrder: (order: FiatWithdrawalOrder) => Promise<void>; }; export {};