import { Contract, TransactionReceipt } from 'ethers'; import { BaseSigner } from '../signers/base'; /** * Delegation RPC * Handles delegation functionality for the Trading contract. * Allows one address to execute trades on behalf of another. */ export declare class DelegationRPC { private tradingContract; private signer?; constructor(tradingContract: Contract, signer?: BaseSigner | undefined); /** * Set a delegate wallet that can perform trade actions on behalf of caller * @param delegate - Address to authorize as delegate (use 0x0 to revoke) * @returns Transaction receipt */ setDelegate(delegate: string): Promise; /** * Remove the current delegate for the caller * @returns Transaction receipt */ removeDelegate(): Promise; /** * Get the delegate wallet for a given owner * @param owner - Owner address to check * @returns Delegate address (0x0 if none set) */ getDelegateFor(owner: string): Promise; /** * Execute a delegated action on behalf of a trader * @param trader - Address of the trader to act on behalf of * @param callData - ABI-encoded function data for the action * @param value - ETH value to send (for execution fees) * @returns Transaction receipt */ delegatedAction(trader: string, callData: string, value?: bigint): Promise; /** * Helper: Create call data for openTrade to be used with delegatedAction * @param tradeStruct - Trade struct with blockchain values * @param orderType - Order type (0-3) * @param slippageP - Slippage percentage in blockchain units * @returns Encoded call data */ encodeOpenTrade(tradeStruct: any, orderType: number, slippageP: bigint): string; /** * Helper: Create call data for closeTradeMarket to be used with delegatedAction * @param pairIndex - Trading pair index * @param index - Trade index * @param amount - Amount to close in blockchain units * @returns Encoded call data */ encodeCloseTradeMarket(pairIndex: number, index: number, amount: bigint): string; /** * Helper: Create call data for updateTpAndSl to be used with delegatedAction * @param pairIndex - Trading pair index * @param index - Trade index * @param newSl - New stop loss in blockchain units * @param newTp - New take profit in blockchain units * @param priceUpdateData - Price update data * @returns Encoded call data */ encodeUpdateTpAndSl(pairIndex: number, index: number, newSl: bigint, newTp: bigint, priceUpdateData: string[]): string; /** * Helper: Create call data for updateMargin to be used with delegatedAction * @param pairIndex - Trading pair index * @param index - Trade index * @param updateType - 0 for DEPOSIT, 1 for WITHDRAW * @param amount - Amount in blockchain units * @param priceUpdateData - Price update data * @returns Encoded call data */ encodeUpdateMargin(pairIndex: number, index: number, updateType: number, amount: bigint, priceUpdateData: string[]): string; /** * Helper method to sign and send transactions */ private signAndSend; /** * Set signer for transactions */ setSigner(signer: BaseSigner): void; }