export type ErrorCode = number; export type ErrorOrigin = 'phoebe' | 'forgeton' | 'atlas' | 'tvm' | 'unknown'; export interface ErrorExplanation { code: ErrorCode; origin: ErrorOrigin; /** Symbolic name (e.g. 'InvalidBlsSignature', 'StaleSnapshot'). */ name: string; /** One-line description suitable for surfacing in UI/logs. */ message: string; /** * Optional hint on how to fix it. Present when the error has an obvious * remediation; absent for "this is a bug, file an issue" cases. */ hint?: string; } /** * Return a structured explanation for an exit code. * * - Phoebe codes (100+) from phoebe/contracts/errors.tolk are looked up first. * - TVM codes (0-99 + 0xFFFF) get generic descriptions. * - Codes in forgeton / atlas ranges get forwarded hints. * - Anything else returns origin: 'unknown'. * * Pass `forceOrigin` to override the lookup order when you know the revert * came from a peer contract (e.g. a bounce message with sender == forgeton). * * @example * const e = explainError(161); * // → { code: 161, origin: 'phoebe', name: 'InvalidBlsSignature', message: '…', hint: '…' } */ export declare function explainError(code: ErrorCode, forceOrigin?: ErrorOrigin): ErrorExplanation; /** * Exception thrown by SDK helpers when they detect a contract revert. * * @example * try { ... } catch (e) { * if (e instanceof PhoebeError) { * console.error(`exit ${e.code}: ${e.message}`); * if (e.hint) console.error(`hint: ${e.hint}`); * } * } */ export declare class PhoebeError extends Error { readonly code: ErrorCode; readonly origin: ErrorOrigin; readonly hint?: string; constructor(code: ErrorCode, contextHint?: string); }