export type MoveAbort = { packageId: string; module: string; function: string; instruction: number; code: number; command: number; }; export type ErrorInfo = { /** Error constant name. */ symbol: string; /** Custom error message. */ msg?: string; }; export type ErrorsByPackage = Record>; /** * Attempts to convert any kind of value into a readable string. */ export declare function anyToStr(val: unknown): string | null; /** * Parse a Move abort string into its different parts. * * Based on `sui/crates/sui/src/clever_error_rendering.rs`. * * Example error string: * `MoveAbort(MoveLocation { module: ModuleId { address: 0x123, name: Identifier("the_module") }, function: 1, instruction: 29, function_name: Some("the_function") }, 5008) in command 2` */ export declare function parseMoveAbort(error: string): MoveAbort | null; /** * Parse transaction errors and convert them into user-friendly messages. */ export declare class TxErrorParser { readonly errsByPkg: ErrorsByPackage; constructor(errorsByPackage: ErrorsByPackage); /** * Convert a transaction error into a user-friendly message. * @param err The error object/string to parse * @param defaultMsg Default message if error can't be parsed or is not a known error * @param customMsgs Optional map of error symbols to custom messages * @returns User-friendly error message or null if user rejected */ errToStr(err: unknown, defaultMsg: string, customMsgs?: Record): string | null; } export type ErrorInfos = Record; /** * Parse transaction errors and convert them into user-friendly messages. * * @param packageId The package ID of the transaction. * @param errCodes A map of numeric error codes to string error symbols (constant names). * @deprecated Use `TxErrorParser` instead. */ export declare class TxErrorParserDeprecated { readonly packageId: string; readonly errInfos: ErrorInfos; constructor(packageId: string, errInfos: ErrorInfos); /** * Convert a transaction error into a user-friendly message. * @param err The error object/string to parse * @param defaultMsg Default message if error can't be parsed or is not a known error * @param customMsgs Optional map of error symbols to custom messages * @returns User-friendly error message or null if user rejected */ errToStr(err: unknown, defaultMsg: string, customMsgs?: Record): string | null; }