import type { FC, ReactElement, ReactNode } from 'react'; import type { RelayClientOptions, paths } from '@relayprotocol/relay-sdk'; import type { RelayKitTheme } from '../themes/index.js'; export type AppFees = paths['/quote/v2']['post']['requestBody']['content']['application/json']['appFees']; /** * Haptic feedback intensity/type for UI interactions. * * - `light` — Subtle tap for minor interactions: token selection, chain starring, toggle switches, max button clicks * - `medium` — Noticeable tap for deliberate actions: swap CTA button press * - `heavy` — Strong tap for emphatic interactions: long-press actions * - `selection` — Ultra-light discrete tick for picker-like interactions: tab switches, chain filter selection * - `success` — Distinct success pattern: swap completed, onramp completed * - `error` — Distinct error pattern: swap failed, approval failed, onramp failed * - `warning` — Alert pattern: unverified token modal shown */ export type HapticEventType = 'light' | 'medium' | 'heavy' | 'selection' | 'success' | 'error' | 'warning'; type RelayKitProviderOptions = { /** * The name of the application */ appName?: string; /** * An array of fee objects composing of a recipient address and the fee in BPS */ appFees?: AppFees; duneConfig?: { /** * The base url for the dune api, if omitted the default will be used. Override this config to protect your api key via a proxy. */ apiBaseUrl?: string; /** * This key is used to fetch token balances, to improve the general UX and suggest relevant tokens * Can be omitted and the ui will continue to function. Refer to the dune docs on how to get an api key */ apiKey?: string; }; /** * An objecting mapping either a VM type (evm, svm, bvm) or a chain id to a connector key (metamask, backpacksol, etc). * Connector keys are used for differentiating which wallet maps to which vm/chain. * Only relevant for eclipse/solana at the moment. */ vmConnectorKeyOverrides?: { [key in number | 'evm' | 'svm' | 'bvm']?: string[]; }; /** * An array of private chain ids to be used when querying the chains api within relay kit. */ privateChainIds?: string[]; /** * The icon theme to use for the chain icons. Defaults to light. */ themeScheme?: 'dark' | 'light'; /** * The loader to use for the loading spinner. Defaults to relay. */ loader?: (options?: { width?: number | string; height?: number | string; fill?: string; }) => ReactElement; /** * The secure base url for the relay api, if omitted the default will be used. Override this config to protect your api key via a proxy. * Currently only relevant for the quote api in the SwapWidget */ secureBaseUrl?: string; /** * Optional callback for haptic feedback on UI interactions. * Relay Kit does not bundle any haptics library — integrators provide their own implementation. * * @example * ```tsx * import { useWebHaptics } from 'web-haptics/react' * * function App() { * const { trigger } = useWebHaptics() * * return ( * { * // Map Relay Kit types to your haptics library * const map = { light: 'nudge', medium: 'buzz', heavy: 'buzz', success: 'success', error: 'error', warning: 'error' } * trigger(map[type] ?? type) * } * }} * > * * * ) * } * ``` */ onHapticEvent?: (type: HapticEventType) => void; }; export interface RelayKitProviderProps { children: ReactNode; options: RelayClientOptions & RelayKitProviderOptions; theme?: RelayKitTheme; } export declare const ProviderOptionsContext: import("react").Context; export type ThemeOverridesMap = { [key: string]: string | ThemeOverridesMap; }; export declare const themeOverrides: ThemeOverridesMap; export declare const RelayKitProvider: FC; /** * Hook that returns a stable haptic event callback from the RelayKitProvider context. * Wraps the integrator's callback in a try-catch to prevent haptic errors from breaking the UI. */ export declare function useHapticEvent(): (type: HapticEventType) => void; export {}; //# sourceMappingURL=RelayKitProvider.d.ts.map