/** * Nado gateway error type and the codes the SDK branches on. * * @see {@link https://docs.nado.xyz/developer-resources/api/errors | Nado error codes (full table)} */ /** * Codes are shared across all Nado executes and queries, not just * withdrawals — keep this module flow-agnostic. */ export declare const NADO_ERROR_CODES: { /** Amount would open a borrow with `spot_leverage: "false"`. */ readonly SPOT_EXECUTE_EXCEEDS_BORROW_LIMIT: 2017; /** Gateway-level nonce rejection. A consumed `tx_nonce` reverts in the EVM * instead — see `EVM_REVERT`. */ readonly INVALID_NONCE: 2022; /** Subaccount has never deposited, so it doesn't exist on Nado yet. */ readonly NO_PRIOR_DEPOSIT: 2024; /** Withdrawal tx not found at the given submission index. */ readonly INVALID_WITHDRAWAL_IDX: 3004; /** Fast-withdrawal validator signatures not aggregated yet. */ readonly NOT_ENOUGH_FAST_WITHDRAWAL_SIGNATURES: 3005; /** Protocol 24h withdrawal limit exceeded. */ readonly WITHDRAW_RISK: 4004; /** Catch-all EVM revert — the reason lives in the message, not the code. * A consumed `tx_nonce` lands here (see `parseNadoExpectedNonce`). */ readonly EVM_REVERT: 4003; }; export type NadoErrorCode = (typeof NADO_ERROR_CODES)[keyof typeof NADO_ERROR_CODES]; /** * Stamped at the throw site — retry logic must never infer the failure kind * from which fields happen to be missing. * - `api`: Nado answered `{status:'failure'}` (or a malformed success) * - `http`: non-2xx response * - `timeout`: our 30s backstop fired — the caller already waited * - `transport`: request never completed (network drop, garbled body) */ export type NadoErrorKind = 'api' | 'http' | 'timeout' | 'transport'; /** A failed Nado gateway call, classified by `kind`. */ export declare class NadoGatewayError extends Error { readonly kind: NadoErrorKind; /** Nado's application error code — set only for `api`-kind failures. */ readonly errorCode: number | undefined; /** HTTP status, kept for diagnostics (present on `http` and bad-JSON 2xx). */ readonly httpStatus: number | undefined; constructor(message: string, options: { kind: NadoErrorKind; errorCode?: number; httpStatus?: number; }); } /** * A submit went unanswered and its replay didn't settle the question — the * withdrawal may or may not have landed. Distinct from a plain failure because * the user must not be told to retry: a fresh nonce would withdraw twice. */ export declare class NadoWithdrawalUnconfirmedError extends Error { constructor(message?: string); } /** Request never completed — safe to retry. Excludes timeouts: a retry after * a 30s stall would hold the user another 30s. */ export declare function isNadoTransportError(error: unknown): boolean; /** Maps a gateway failure response to a NadoGatewayError. */ export declare function createNadoGatewayError(response: { error?: string; error_code?: number; }, fallbackMessage: string): NadoGatewayError; export declare function isNadoErrorCode(error: unknown, code: NadoErrorCode): boolean; export declare function parseNadoExpectedNonce(error: unknown): bigint | undefined; //# sourceMappingURL=errors.d.ts.map