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