/** * Capability sub-interfaces for exchange-specific features. * Use type guard functions (isTwapCapable, hasPacificaSdk, etc.) instead of instanceof checks. */ import type { ExchangeAdapter } from "./interface.js"; export interface WithdrawCapable { withdraw(amount: string, destination: string, opts?: { assetId?: number; routeType?: number; }): Promise; } export interface TwapCapable { twapOrder(symbol: string, side: "buy" | "sell", size: string, duration: number, opts?: { reduceOnly?: boolean; }): Promise; twapCancel(symbol: string, twapId: number): Promise; } export interface TpSlCapable { setTpSl(symbol: string, side: "buy" | "sell", opts: { tp?: string; tpLimit?: string; sl?: string; size?: string; }): Promise; } export interface TriggerOrderCapable { triggerOrder(symbol: string, side: "buy" | "sell", size: string, triggerPrice: string, type: string, opts?: Record): Promise; } export interface DexCapable { readonly dex: string; setDex(dex: string): void; listDeployedDexes(): Promise<{ name: string; deployer: string; assets: string[]; }[]>; } export interface SubAccountCapable { createSubAccount(name: string): Promise; subAccountTransfer(subAccountUser: string, isDeposit: boolean, amount: number): Promise; } export interface PacificaSdkCapable { readonly sdk: unknown; readonly publicKey: string; readonly signer: (msg: Uint8Array) => Promise; } export interface LighterAccountCapable { readonly accountIndex: number; readonly address: string; setupApiKey(apiKeyIndex?: number): Promise<{ privateKey: string; publicKey: string; }>; } export interface EvmAddressCapable { readonly address: string; } export interface QueryOrderCapable { queryOrder(orderId: number): Promise; } export interface UsdTransferCapable { usdTransfer(amount: number, destination: string): Promise; } export declare function isWithdrawCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & WithdrawCapable; export declare function isTwapCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & TwapCapable; export declare function isTpSlCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & TpSlCapable; export declare function isTriggerOrderCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & TriggerOrderCapable; export declare function isDexCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & DexCapable; export declare function isSubAccountCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & SubAccountCapable; export declare function hasPacificaSdk(adapter: ExchangeAdapter): adapter is ExchangeAdapter & PacificaSdkCapable; export declare function hasLighterAccount(adapter: ExchangeAdapter): adapter is ExchangeAdapter & LighterAccountCapable; export declare function hasEvmAddress(adapter: ExchangeAdapter): adapter is ExchangeAdapter & EvmAddressCapable; export declare function isQueryOrderCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & QueryOrderCapable; export declare function isUsdTransferCapable(adapter: ExchangeAdapter): adapter is ExchangeAdapter & UsdTransferCapable;