import { type PerpsProviderPlugin, type StorageAdapter } from '@lifi/perps-sdk'; import { type Address, type Hex } from 'viem'; import { type HyperliquidAgent } from './signers/HyperliquidAgentStore.js'; /** * Options for {@link hyperliquidProvider}. * * @public */ export interface HyperliquidProviderOptions { /** * Base URL for the Hyperliquid REST surface. Defaults to * `https://api.hyperliquid.xyz`. Override to point at a custom or * third-party endpoint — e.g. a reverse proxy, a self-hosted mirror, or a * rate-limit-managed gateway in front of Hyperliquid. */ apiUrl?: string; /** * Storage adapter for the user's per-address Hyperliquid agent keypair. * Defaults to browser `localStorage`. Pass a custom adapter for SSR / * non-browser hosts or encrypted storage. */ storage?: StorageAdapter; } /** * Hyperliquid provider plugin extended with agent-keypair lifecycle methods. * Hyperliquid signs trading actions with a per-user agent wallet the user * approves via `APPROVE_AGENT`; the plugin owns that keypair's generation, * persistence, and revocation. The base {@link PerpsProviderPlugin} contract * stays provider-agnostic — this extension is opt-in for callers that * explicitly type against it (e.g. to surface a "revoke agent" affordance). * @public */ export interface HyperliquidPerpsProvider extends PerpsProviderPlugin { /** * Resolve the stored agent wallet address for a user. * @throws {PerpsError} With `AgentNotFound` when no agent has been created. */ getAgentAddress(address: Address): Promise
; /** Return whether a persisted agent keypair exists for the user address. */ hasAgent(address: Address): Promise; /** * Remove the user's persisted agent keypair and local authorization. * This does not submit an on-chain `APPROVE_AGENT` revocation. */ removeAgent(address: Address): Promise; /** * Validate, persist, and return an existing agent private key for a user. * The returned private key is stored by the configured {@link StorageAdapter}. */ importAgent(address: Address, privateKey: Hex): Promise; } /** * Factory for the Hyperliquid {@link PerpsProviderPlugin}. * * Account-specific state is read direct from `${apiUrl}/info`; enriched asset * metadata and public/shared data come from the LI.FI backend (Valkey-cached). * Pass to `createPerpsClient({ providers: [hyperliquidProvider()] })` and look * up via `client.getProvider('hyperliquid')`. * * Write actions are EIP-712 typed data signed by the user's Hyperliquid agent * keypair; the plugin owns that keypair (generation, storage, revocation) and * dispatches the agent-signed arm via `signActions`. * * @example * ```ts * const client = createPerpsClient({ * apiKey: 'your-api-key', * providers: [hyperliquidProvider()], * }) * ``` * @public */ export declare function hyperliquidProvider(options?: HyperliquidProviderOptions): HyperliquidPerpsProvider; //# sourceMappingURL=HyperliquidProvider.d.ts.map