import { Keypair } from "@solana/web3.js"; import { PacificaClient, type Network } from "../pacifica/index.js"; import type { ExchangeAdapter, ExchangeMarketInfo, ExchangePosition, ExchangeOrder, ExchangeBalance, ExchangeTrade, ExchangeFundingPayment, ExchangeKline } from "./interface.js"; import type { SolanaSigner } from "../signer/index.js"; import type { AgentMeta } from "../settings.js"; export declare class PacificaAdapter implements ExchangeAdapter { readonly name = "pacifica"; readonly chain = "solana"; readonly aliases: readonly ["pac"]; private client; /** Tier 3: PK direct (constructor-supplied keypair). */ private _solanaSigner; /** Tier 2: OWS master signer (set via setSigner). */ private _masterSigner?; /** Tier 1: agent OWS signer (Phase 2c). */ private _agentSigner?; /** Tier 1 metadata. */ private _agentMeta?; /** --no-agent bypass flag. */ private _useNoAgent; /** True when adapter was constructed without a real PK (read-only). */ private _hasRealKey; /** Public Solana base58 of the active signer (`_resolveSigner().address`). */ private account; /** Bound `signMessage` for the active signer (Phase 2c routes through `_resolveSigner`). */ private signMessage; private _marketsCache; private _marketsCacheTime; private static readonly CACHE_TTL; constructor(keypair: Keypair, network?: Network, builderCode?: string, hasRealKey?: boolean); private ensureSigner; /** * Inject an external Solana signer (Tier 2 — OWS master). * Backward-compatible: existing callers (e.g. `perp -e pacifica --ows ...` * in `_initWithOws`) continue to work; the master signer is what * `_resolveSigner()` falls back to when no agent is registered. */ setSigner(signer: SolanaSigner): void; /** Tier 1: inject agent OWS Solana signer (Phase 2c). */ setAgentSigner(meta: AgentMeta, signer: SolanaSigner): void; /** Bypass Tier 1 (agent) — used for `--no-agent` flag. */ setNoAgent(noAgent: boolean): void; /** True only when ALL THREE tiers are unconfigured. */ get isReadOnly(): boolean; /** Which signer tier is currently active (for debug/diagnostics). */ get activeSignerTier(): "agent" | "master" | "pk" | null; /** Resolve the active signer across three tiers. Mirrors AsterAdapter._resolveSigner. */ private _resolveSigner; /** Access the underlying Keypair (only available with LocalSolanaSigner). */ get keypair(): Keypair; private _getPrices; private _getPositions; get publicKey(): string; get sdk(): PacificaClient; get signer(): (msg: Uint8Array) => Promise; getMarkets(): Promise; getOrderbook(symbol: string): Promise<{ bids: [string, string][]; asks: [string, string][]; }>; getBalance(): Promise; getPositions(): Promise; getOpenOrders(): Promise; marketOrder(symbol: string, side: "buy" | "sell", size: string, opts?: { reduceOnly?: boolean; }): Promise; limitOrder(symbol: string, side: "buy" | "sell", price: string, size: string, opts?: { reduceOnly?: boolean; tif?: string; }): Promise; cancelOrder(symbol: string, orderId: string): Promise; cancelAllOrders(symbol?: string): Promise; editOrder(symbol: string, orderId: string, price: string, size: string): Promise; setLeverage(symbol: string, leverage: number, marginMode?: "cross" | "isolated"): Promise<{ symbol: string; leverage: number; marginMode: "cross" | "isolated"; }>; stopOrder(symbol: string, side: "buy" | "sell", size: string, triggerPrice: string, opts?: { limitPrice?: string; reduceOnly?: boolean; }): Promise; withdraw(amount: string, destination: string, _opts?: { assetId?: number; routeType?: number; }): Promise; getRecentTrades(symbol: string, _limit?: number): Promise; getFundingHistory(symbol: string, limit?: number): Promise<{ time: number; rate: string; price: string | null; }[]>; getKlines(symbol: string, interval: string, startTime: number, endTime: number): Promise; getOrderHistory(limit?: number): Promise; getTradeHistory(limit?: number): Promise; getFundingPayments(limit?: number): Promise; }