export interface EncodeTxParams { /** Transaction type name, e.g. 'TransferV2Tx' */ type: string; /** Transaction data — same shape as client.encodeXxxTx({ tx }) */ tx: { itx: any; from?: string; pk?: string; nonce?: number; chainId?: string; signature?: Uint8Array | Buffer; signatures?: any[]; signaturesList?: any[]; delegator?: string; }; /** Wallet { address, publicKey|pk } */ wallet: { address: string; publicKey?: string; pk?: string }; /** Delegator address */ delegator?: string; /** Chain ID (from getChainInfo) */ chainId?: string; /** Fee config [{ typeUrl, fee }] (from getForgeState) */ feeConfig?: Array<{ typeUrl: string; fee: string }>; } export interface EncodeTxResult { object: Record; buffer: Buffer; } export interface ChainContext { chainId: string; txFee: Array<{ typeUrl: string; fee: string }>; } export type TxEncoder = (params: { type: string; data: any; wallet: any; chainHost: string; }) => Promise; /** * Encode a transaction to protobuf binary. * Pure function — no network IO. */ export function encodeTx(params: EncodeTxParams): EncodeTxResult; /** * Create a TxEncoder compatible with WalletAuthenticator.txEncoder. * Automatically fetches and caches chain context per endpoint. */ export function createTxEncoder(): TxEncoder; /** * Fetch minimal chain context (chainId + fee config) from an endpoint. * Results are cached — call clearContextCache() to invalidate. */ export function fetchContext(chainHost: string): Promise; /** Clear the context cache. */ export function clearContextCache(): void;