UNPKG

solana-dex-parser

Version:
34 lines (33 loc) 1.43 kB
import { DexInfo, TradeInfo, TradeType } from './types'; /** * Get instruction data */ export declare const getInstructionData: (instruction: any) => Buffer; export declare const decodeInstructionData: (data: any) => Buffer; /** * Get the name of a program by its ID * @param programId - The program ID to look up * @returns The name of the program or 'Unknown' if not found */ export declare const getProgramName: (programId: string) => string; /** * Convert a hex string to Uint8Array * @param hex - Hex string to convert * @returns Uint8Array representation of the hex string */ export declare const hexToUint8Array: (hex: string) => Uint8Array; export declare const absBigInt: (value: bigint) => bigint; export declare const getTradeType: (inMint: string, outMint: string) => TradeType; export declare const getAMMs: (transferActionKeys: string[]) => string[]; export declare const getTranferTokenMint: (token1?: string, token2?: string) => string | undefined; export declare const getPubkeyString: (value: any) => string; /** * Sort an array of TradeInfo objects by their idx field * The idx format is 'main-sub', such as '1-0', '2-1', etc. * @param items The TradeInfo array to be sorted * @returns The sorted TradeInfo array */ export declare const sortByIdx: <T extends { idx: string; }>(items: T[]) => T[]; export declare const getFinalSwap: (trades: TradeInfo[], dexInfo?: DexInfo) => TradeInfo | null;