import { X402RelayWsConfig, X402IntegritasConfig, X402NetworkSelectionMode, X402FetchInit } from '../client.cjs'; import { W as WalletSet, R as RelaiNetwork } from '../types-DjEveKgt.cjs'; /** * React Hook for RelAI x402 Payments * * Single hook that auto-detects the network from the 402 response and uses * the correct signing method. Supports all RelAI facilitator networks: * Solana, Base, Avalanche, SKALE Base. * * @example * ```tsx * import { useRelaiPayment } from '@relai-fi/x402/react'; * * function PayButton() { * const { * fetch, * isLoading, * status, * error, * transactionUrl, * connectedChains, * } = useRelaiPayment({ * wallets: { solana: solanaWallet, evm: evmWalletClient }, * }); * * return ( * * ); * } * ``` */ type PaymentStatus = 'idle' | 'pending' | 'success' | 'error'; interface ConnectedChains { solana: boolean; evm: boolean; } interface UseRelaiPaymentConfig { /** Wallets — pass both Solana + EVM and the hook picks automatically */ wallets?: WalletSet; /** Optional Relay WebSocket transport for /relay/:apiId endpoints */ relayWs?: X402RelayWsConfig; /** Default Integritas behavior for outgoing requests */ integritas?: boolean | X402IntegritasConfig; /** Preferred network when multiple options available */ preferredNetwork?: RelaiNetwork; /** Preferred-network handling mode when multiple accepts are returned */ networkSelectionMode?: X402NetworkSelectionMode; /** Custom Solana RPC URL */ solanaRpcUrl?: string; /** Custom facilitator URL (default: RelAI) */ facilitatorUrl?: string; /** Maximum payment in atomic units (safety guard) */ maxAmountAtomic?: string; /** Verbose console logging */ verbose?: boolean; } interface UseRelaiPaymentReturn { /** Fetch with automatic x402 payment handling */ fetch: (input: string | URL | Request, init?: X402FetchInit) => Promise; /** Payment in progress */ isLoading: boolean; /** Current status */ status: PaymentStatus; /** Error on failure */ error: Error | null; /** Transaction hash/signature on success */ transactionId: string | null; /** Network the payment was made on */ transactionNetwork: RelaiNetwork | null; /** Human-readable network label */ transactionNetworkLabel: string | null; /** Block explorer URL for the transaction */ transactionUrl: string | null; /** Which chain types have connected wallets */ connectedChains: ConnectedChains; /** Whether any wallet is connected */ isConnected: boolean; /** Reset hook state to idle */ reset: () => void; } declare function useRelaiPayment(config?: UseRelaiPaymentConfig): UseRelaiPaymentReturn; export { type ConnectedChains, type PaymentStatus, type UseRelaiPaymentConfig, type UseRelaiPaymentReturn, useRelaiPayment };