export { C as ClaimUtxoError, a as ClaimUtxoStage, b as ComputationMonitorError, c as ComputationMonitorStage, d as ConversionError, e as ConversionStage, f as CreateUtxoError, g as CreateUtxoStage, E as EncryptedDepositError, h as EncryptedDepositStage, i as EncryptedWithdrawalError, j as EncryptedWithdrawalStage, F as FetchUtxosError, k as FetchUtxosStage, Q as QueryError, l as QueryStage, R as RegistrationError, m as RegistrationStage, n as isClaimUtxoError, o as isComputationMonitorError, p as isConversionError, q as isCreateUtxoError, r as isEncryptedDepositError, s as isEncryptedWithdrawalError, t as isFetchUtxosError, u as isQueryError, v as isRegistrationError } from '../errors-DPNMfyh0.js';
import { U as UmbraError } from '../errors-B9EoPeWV.js';
export { C as CryptographyAssertionError, M as MathematicsAssertionError, S as SolanaAssertionError, T as TemporalAssertionError, i as isUmbraError } from '../errors-B9EoPeWV.js';

/**
 * Cryptography Error Classes
 *
 * This module provides error classes for cryptographic operation failures
 * in the Umbra SDK.
 *
 * @module crypto/errors
 */

/**
 * Error thrown when a cryptographic operation fails.
 *
 * This includes key derivation failures, encryption/decryption errors,
 * hash computation failures, and ZK proof generation errors.
 *
 * @example
 * ```typescript
 * try {
 *   const commitment = await generateUserCommitment(mvk, index, seed);
 * } catch (error) {
 *   if (error instanceof CryptographyError) {
 *     console.log('Crypto operation failed:', error.operation);
 *   }
 * }
 * ```
 */
declare class CryptographyError extends UmbraError {
    /**
     * The cryptographic operation that failed.
     */
    readonly operation?: string;
    constructor(message: string, options?: {
        code?: string;
        operation?: string;
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Type guard to check if an error is a CryptographyError.
 */
declare function isCryptographyError(error: unknown): error is CryptographyError;

/**
 * Solana-Specific Error Classes.
 *
 * This module defines the structured error hierarchy for Solana-related failures
 * in the Umbra SDK. All classes extend `UmbraError` from `../common/errors` and
 * carry structured context that makes programmatic error handling and logging
 * straightforward.
 *
 * @remarks
 * The error hierarchy is:
 * ```
 * UmbraError (base)
 * ├── InstructionError        — instruction build/validation failures
 * ├── RpcError                — JSON-RPC request failures
 * └── TransactionError        — transaction lifecycle failures
 *     ├── TransactionSigningError        — signing-phase failures
 *     │   └── MasterSeedSigningRejectedError  — master seed derivation rejection
 * ```
 *
 * **Type guards** — Each concrete error class has a matching `is*` type guard
 * function ({@link isInstructionError}, {@link isRpcError},
 * {@link isTransactionError}, {@link isTransactionSigningError}). Prefer these
 * over `instanceof` checks in code that may cross module or bundle boundaries,
 * where `instanceof` can fail due to different class references.
 *
 * **Recovery strategies by error type:**
 *
 * - `InstructionError` — inspect `instructionName` and `context` to determine
 *   which account is missing or which parameter is invalid; fix the call site.
 *
 * - `RpcError` — check `statusCode` (HTTP) and `rpcErrorCode` (JSON-RPC) to
 *   distinguish rate limiting (429), node overload (503), or invalid request
 *   (400). Transient errors are typically retryable.
 *
 * - `TransactionError` — check `simulationLogs` for program error messages that
 *   identify the on-chain failure. If `signature` is set, the transaction landed
 *   on-chain but was reverted.
 *
 * - `TransactionSigningError` — check `wasRejected` to distinguish a deliberate
 *   user rejection from a hardware wallet communication failure.
 *
 * - `MasterSeedSigningRejectedError` — the user declined the master seed
 *   derivation message; prompt the user and retry with `getUmbraClient`.
 *
 * @packageDocumentation
 */

/**
 * Error thrown when building or validating a Solana instruction fails.
 *
 * This error is raised during the instruction-construction phase — before any
 * RPC or network interaction occurs. Common causes include missing required
 * accounts, invalid parameter values, PDA derivation failures, and instruction
 * serialization errors.
 *
 * @remarks
 * The `instructionName` field identifies which instruction failed, which is
 * particularly useful when a single SDK operation constructs multiple
 * instructions. The `context` field (inherited from `UmbraError`) carries
 * arbitrary key-value pairs for additional diagnostic information, such as
 * the list of missing accounts or the conflicting parameter values.
 *
 * **Default error code** — `"INSTRUCTION_ERROR"`. Sub-classes or callers may
 * override this via the `code` option.
 *
 * @example
 * Catching and inspecting an instruction build failure:
 * ```typescript
 * import { isInstructionError } from "@umbra-privacy/sdk";
 *
 * try {
 *   const instruction = buildRegisterInstruction(params);
 * } catch (error) {
 *   if (isInstructionError(error)) {
 *     console.error(`Instruction "${error.instructionName}" failed: ${error.message}`);
 *     console.error("Context:", error.context);
 *   }
 * }
 * ```
 *
 * @example
 * Throwing an `InstructionError` from a builder:
 * ```typescript
 * import { InstructionError } from "@umbra-privacy/sdk";
 *
 * throw new InstructionError("Required account 'poolConfig' not found", {
 *   instructionName: "encryptedDeposit",
 *   context: { missingAccounts: ["poolConfig"], providedMint: mint.toString() },
 * });
 * ```
 *
 * @see {@link isInstructionError} for the corresponding type guard
 * @public
 */
declare class InstructionError extends UmbraError {
    /**
     * The name of the instruction that failed during construction or validation.
     *
     * @remarks
     * Matches the Anchor instruction name (camelCase), e.g. `"encryptedDeposit"`,
     * `"initUserAccount"`. May be `undefined` if the failing instruction could
     * not be identified at the throw site.
     */
    readonly instructionName?: string;
    /**
     * Creates a new `InstructionError`.
     *
     * @param message - Human-readable description of the instruction failure.
     * @param options - Optional structured metadata.
     * @param options.code - Error code string. Defaults to `"INSTRUCTION_ERROR"`.
     * @param options.instructionName - The name of the failing instruction.
     * @param options.context - Arbitrary key-value pairs for diagnostic context.
     * @param options.cause - The underlying error that caused this failure, if any.
     */
    constructor(message: string, options?: {
        code?: string;
        instructionName?: string;
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Error thrown when a Solana JSON-RPC request fails.
 *
 * This error covers all network-level and protocol-level failures that occur
 * while communicating with a Solana RPC node: unreachable endpoints, HTTP
 * errors, rate limiting, malformed responses, and JSON-RPC error objects
 * returned by the node.
 *
 * @remarks
 * **HTTP errors** — Use `statusCode` to check for common HTTP failure modes:
 * - `429` — rate limited; back off and retry with exponential delay
 * - `503` — node overloaded or temporarily unavailable; retry after a pause
 * - `400` — malformed request; usually a client bug, not retryable
 *
 * **JSON-RPC errors** — Use `rpcErrorCode` to distinguish Solana-specific
 * error codes returned in the `error.code` field of an RPC response body.
 * Common codes: `-32002` (transaction not found), `-32005` (node behind),
 * `-32007` (slot skipped).
 *
 * **Retryability** — `statusCode >= 500` or `statusCode === 429` generally
 * indicates a transient error. Client-side errors (`statusCode === 400`) are
 * not retryable without fixing the request.
 *
 * **Default error code** — `"RPC_ERROR"`.
 *
 * @example
 * Distinguishing rate-limit errors from other RPC failures:
 * ```typescript
 * import { isRpcError } from "@umbra-privacy/sdk";
 *
 * try {
 *   const account = await rpc.getAccountInfo(address);
 * } catch (error) {
 *   if (isRpcError(error)) {
 *     if (error.statusCode === 429) {
 *       console.warn("Rate limited — retry after delay");
 *     } else {
 *       console.error(`RPC failure at ${error.endpoint}: ${error.message}`);
 *     }
 *   }
 * }
 * ```
 *
 * @example
 * Constructing an `RpcError`:
 * ```typescript
 * import { RpcError } from "@umbra-privacy/sdk";
 *
 * throw new RpcError("Failed to fetch account", {
 *   endpoint: "https://api.mainnet-beta.solana.com",
 *   statusCode: 503,
 *   cause: originalError,
 * });
 * ```
 *
 * @see {@link isRpcError} for the corresponding type guard
 * @public
 */
declare class RpcError extends UmbraError {
    /**
     * The RPC endpoint URL that was called when the error occurred.
     *
     * @remarks
     * May be `undefined` if the endpoint was not known at the throw site (e.g.,
     * when the error originates deep within `@solana/kit` internals).
     */
    readonly endpoint?: string;
    /**
     * The HTTP status code returned by the RPC node, if applicable.
     *
     * @remarks
     * `undefined` for network-level failures (e.g., DNS resolution failure,
     * connection refused) where no HTTP response was received.
     */
    readonly statusCode?: number;
    /**
     * The JSON-RPC error code from the response body, if any.
     *
     * @remarks
     * Set when the RPC node returns a well-formed JSON-RPC error object with a
     * numeric `code` field. `undefined` for HTTP-level failures or when the node
     * returns a malformed response body.
     */
    readonly rpcErrorCode?: number;
    /**
     * Creates a new `RpcError`.
     *
     * @param message - Human-readable description of the RPC failure.
     * @param options - Optional structured metadata.
     * @param options.code - Error code string. Defaults to `"RPC_ERROR"`.
     * @param options.endpoint - The RPC endpoint URL that was called.
     * @param options.statusCode - HTTP status code from the response, if any.
     * @param options.rpcErrorCode - JSON-RPC error code from the response, if any.
     * @param options.context - Arbitrary key-value pairs for diagnostic context.
     * @param options.cause - The underlying error that caused this failure, if any.
     */
    constructor(message: string, options?: {
        code?: string;
        endpoint?: string;
        statusCode?: number;
        rpcErrorCode?: number;
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Error thrown when a transaction operation fails.
 *
 * This error covers failures across the full transaction lifecycle: building the
 * transaction message, running preflight simulation, submitting to the network,
 * and waiting for confirmation. It is the base class for more specific
 * transaction-related errors.
 *
 * @remarks
 * **Simulation logs** — When available, `simulationLogs` contain the program
 * log output from a failed preflight simulation. These logs often include the
 * Anchor error code and a human-readable message describing why the on-chain
 * program rejected the transaction.
 *
 * **Signature** — When `signature` is present, the transaction was accepted by
 * the network and executed but the execution itself failed (on-chain error).
 * When `signature` is absent, the transaction was rejected before reaching the
 * network (e.g., preflight failure, malformed transaction).
 *
 * **Default error code** — `"TRANSACTION_ERROR"`.
 *
 * @example
 * Inspecting simulation logs on failure:
 * ```typescript
 * import { isTransactionError } from "@umbra-privacy/sdk";
 *
 * try {
 *   const signatures = await forwarder.forwardSequentially([signedTx]);
 * } catch (error) {
 *   if (isTransactionError(error)) {
 *     console.error("Transaction failed:", error.message);
 *     if (error.simulationLogs) {
 *       console.error("Simulation logs:");
 *       for (const log of error.simulationLogs) {
 *         console.error(" ", log);
 *       }
 *     }
 *     if (error.signature) {
 *       console.error("Failed signature:", error.signature);
 *     }
 *   }
 * }
 * ```
 *
 * @example
 * Constructing a `TransactionError`:
 * ```typescript
 * import { TransactionError } from "@umbra-privacy/sdk";
 *
 * throw new TransactionError("Transaction simulation failed", {
 *   simulationLogs: ["Program log: AnchorError: Error Code: 6001"],
 *   cause: originalError,
 * });
 * ```
 *
 * @see {@link isTransactionError} for the corresponding type guard
 * @see {@link TransactionSigningError} for signing-phase failures
 * @public
 */
declare class TransactionError extends UmbraError {
    /**
     * The transaction signature, if available.
     *
     * @remarks
     * Base58-encoded signature string. Present when the transaction was submitted
     * to the network but failed during execution. Use this to look up the failed
     * transaction in a block explorer.
     */
    readonly signature?: string;
    /**
     * Simulation log output from the transaction preflight, if available.
     *
     * @remarks
     * Each entry in the array is one line of program log output (e.g.,
     * `"Program log: ..."` or `"Program <address> failed: ..."`). Anchor programs
     * emit error codes and names here when constraints are violated.
     */
    readonly simulationLogs?: string[];
    /**
     * Creates a new `TransactionError`.
     *
     * @param message - Human-readable description of the transaction failure.
     * @param options - Optional structured metadata.
     * @param options.code - Error code string. Defaults to `"TRANSACTION_ERROR"`.
     * @param options.signature - Base58-encoded transaction signature, if available.
     * @param options.simulationLogs - Program log output from preflight simulation.
     * @param options.context - Arbitrary key-value pairs for diagnostic context.
     * @param options.cause - The underlying error that caused this failure, if any.
     */
    constructor(message: string, options?: {
        code?: string;
        signature?: string;
        simulationLogs?: string[];
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Error thrown when transaction signing fails.
 *
 * This is a specific sub-class of {@link TransactionError} that occurs during
 * the signing phase — after the transaction is built but before it is submitted
 * to the network. Common causes include explicit user rejection in a wallet UI,
 * hardware wallet disconnection or timeout, and missing key material.
 *
 * @remarks
 * **User rejection** — When `wasRejected` is `true`, the user deliberately
 * declined to sign in the wallet prompt. This is not an error condition in the
 * traditional sense — the user made an intentional choice. UIs should catch this
 * and show a user-friendly cancellation message rather than an error dialog.
 *
 * **Hardware wallet issues** — When `wasRejected` is `false`, the failure was
 * not deliberate. It may indicate a disconnected Ledger, a timeout waiting for
 * the user to confirm on-device, or an incompatible app version on the device.
 *
 * **Signer address** — `signerAddress` identifies which signer's key was needed
 * at the time of failure. In multi-signer flows this helps identify which party
 * must re-sign.
 *
 * **Default error code** — `"TRANSACTION_SIGNING_ERROR"`.
 *
 * @example
 * Handling user rejection gracefully:
 * ```typescript
 * import { isTransactionSigningError } from "@umbra-privacy/sdk";
 *
 * try {
 *   const signedTx = await walletSigner.signTransaction(tx);
 * } catch (error) {
 *   if (isTransactionSigningError(error)) {
 *     if (error.wasRejected) {
 *       showToast("Transaction cancelled by user");
 *     } else {
 *       showToast(`Signing failed: ${error.message}`);
 *     }
 *   }
 * }
 * ```
 *
 * @example
 * Constructing a `TransactionSigningError`:
 * ```typescript
 * import { TransactionSigningError } from "@umbra-privacy/sdk";
 *
 * throw new TransactionSigningError("User rejected the transaction", {
 *   wasRejected: true,
 *   signerAddress: wallet.publicKey.toString(),
 * });
 * ```
 *
 * @see {@link isTransactionSigningError} for the corresponding type guard
 * @see {@link MasterSeedSigningRejectedError} for the master seed rejection sub-class
 * @public
 */
declare class TransactionSigningError extends TransactionError {
    /**
     * Whether the signing was explicitly rejected by the user.
     *
     * @remarks
     * `true` when the wallet UI presented a sign request and the user actively
     * clicked "Reject" or equivalent. `false` when the failure was due to a
     * technical issue (disconnected device, timeout, missing key).
     *
     * @defaultValue `false`
     */
    readonly wasRejected: boolean;
    /**
     * The address of the signer that failed to produce a signature.
     *
     * @remarks
     * Base58-encoded public key string. May be `undefined` if the failing signer
     * could not be identified at the throw site.
     */
    readonly signerAddress?: string;
    /**
     * Creates a new `TransactionSigningError`.
     *
     * @param message - Human-readable description of the signing failure.
     * @param options - Optional structured metadata.
     * @param options.code - Error code string. Defaults to `"TRANSACTION_SIGNING_ERROR"`.
     * @param options.wasRejected - Whether the user deliberately rejected. Defaults to `false`.
     * @param options.signerAddress - Base58 address of the signer that failed.
     * @param options.signature - Transaction signature, if the transaction was partially signed.
     * @param options.context - Arbitrary key-value pairs for diagnostic context.
     * @param options.cause - The underlying error that caused this failure, if any.
     */
    constructor(message: string, options?: {
        code?: string;
        wasRejected?: boolean;
        signerAddress?: string;
        signature?: string;
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Error thrown when master seed signing is rejected by the user.
 *
 * The Umbra privacy protocol derives a deterministic master seed by asking the
 * user's wallet to sign a fixed message. This seed is the root of the key
 * hierarchy used for encrypting and decrypting confidential balances. If the
 * user declines to sign this message, no Umbra operations that require private
 * key material can proceed.
 *
 * @remarks
 * This error always has `wasRejected: true` because it is only thrown when the
 * user deliberately declines — hardware wallet failures or timeouts during the
 * seed derivation flow produce a generic {@link TransactionSigningError} instead.
 *
 * **Recovery** — Prompt the user to explain that the Umbra seed derivation
 * signature is used only to derive encryption keys locally and is never
 * broadcast to the network. Then call `getUmbraClient` again.
 *
 * **Default error code** — `"MASTER_SEED_SIGNING_REJECTED"`.
 *
 * @example
 * Distinguishing master seed rejection from other signing errors:
 * ```typescript
 * import {
 *   MasterSeedSigningRejectedError,
 *   isTransactionSigningError,
 * } from "@umbra-privacy/sdk";
 *
 * try {
 *   const client = await getUmbraClient({ signer });
 * } catch (error) {
 *   if (error instanceof MasterSeedSigningRejectedError) {
 *     showModal(
 *       "Umbra needs a signature to derive your private keys locally. " +
 *       "This signature is never sent to the network.",
 *     );
 *   } else if (isTransactionSigningError(error)) {
 *     showToast(`Signing error: ${error.message}`);
 *   }
 * }
 * ```
 *
 * @see {@link TransactionSigningError} for the parent class
 * @public
 */
declare class MasterSeedSigningRejectedError extends TransactionSigningError {
    /**
     * Creates a new `MasterSeedSigningRejectedError`.
     *
     * @param message - Human-readable description. Defaults to a standard rejection
     *   message explaining that the user declined the required derivation signature.
     * @param options - Optional structured metadata.
     * @param options.signerAddress - Base58 address of the wallet that rejected.
     * @param options.context - Arbitrary key-value pairs for diagnostic context.
     * @param options.cause - The underlying error that caused this failure, if any.
     */
    constructor(message?: string, options?: {
        signerAddress?: string;
        context?: Record<string, unknown>;
        cause?: unknown;
    });
}
/**
 * Type guard to check whether an unknown value is an {@link InstructionError}.
 *
 * @remarks
 * Prefer this function over `instanceof InstructionError` in code that may
 * cross module or bundle boundaries where the class reference might differ.
 *
 * @param error - The value to test.
 * @returns `true` if `error` is an instance of `InstructionError`, narrowing
 *   the type accordingly.
 *
 * @example
 * ```typescript
 * if (isInstructionError(error)) {
 *   console.error("Instruction:", error.instructionName);
 * }
 * ```
 *
 * @see {@link InstructionError}
 * @public
 */
declare function isInstructionError(error: unknown): error is InstructionError;
/**
 * Type guard to check whether an unknown value is an {@link RpcError}.
 *
 * @remarks
 * Prefer this function over `instanceof RpcError` in code that may cross
 * module or bundle boundaries where the class reference might differ.
 *
 * @param error - The value to test.
 * @returns `true` if `error` is an instance of `RpcError`, narrowing the type
 *   accordingly.
 *
 * @example
 * ```typescript
 * if (isRpcError(error) && error.statusCode === 429) {
 *   await sleep(backoffMs);
 *   return retry();
 * }
 * ```
 *
 * @see {@link RpcError}
 * @public
 */
declare function isRpcError(error: unknown): error is RpcError;
/**
 * Type guard to check whether an unknown value is a {@link TransactionError}.
 *
 * @remarks
 * Because {@link TransactionSigningError} and {@link MasterSeedSigningRejectedError}
 * extend `TransactionError`, this guard returns `true` for those sub-classes as
 * well. Use the more specific guards ({@link isTransactionSigningError}) when the
 * sub-type matters.
 *
 * @param error - The value to test.
 * @returns `true` if `error` is an instance of `TransactionError` or any of its
 *   sub-classes, narrowing the type accordingly.
 *
 * @example
 * ```typescript
 * if (isTransactionError(error) && error.simulationLogs) {
 *   console.error("Simulation logs:", error.simulationLogs.join("\n"));
 * }
 * ```
 *
 * @see {@link TransactionError}
 * @see {@link isTransactionSigningError}
 * @public
 */
declare function isTransactionError(error: unknown): error is TransactionError;
/**
 * Type guard to check whether an unknown value is a {@link TransactionSigningError}.
 *
 * @remarks
 * Because {@link MasterSeedSigningRejectedError} extends `TransactionSigningError`,
 * this guard returns `true` for that sub-class as well.
 *
 * @param error - The value to test.
 * @returns `true` if `error` is an instance of `TransactionSigningError` or any
 *   of its sub-classes, narrowing the type accordingly.
 *
 * @example
 * ```typescript
 * if (isTransactionSigningError(error) && error.wasRejected) {
 *   showCancellationMessage();
 * }
 * ```
 *
 * @see {@link TransactionSigningError}
 * @see {@link MasterSeedSigningRejectedError}
 * @public
 */
declare function isTransactionSigningError(error: unknown): error is TransactionSigningError;

export { CryptographyError, InstructionError, MasterSeedSigningRejectedError, RpcError, TransactionError, TransactionSigningError, UmbraError, isCryptographyError, isInstructionError, isRpcError, isTransactionError, isTransactionSigningError };
