/** * Error classes for the NEAR client library. * * @remarks * All errors in this module extend {@link NearError}, which carries a stable * `code` string and optional `data` field. Many errors also expose a * `retryable` flag to indicate whether the operation is safe to retry. */ /** * Base error class for all NEAR-related errors. * * Provides a stable `code` and optional `data` payload for structured error * handling. Concrete error subclasses in this module narrow down specific * failure scenarios (network issues, contract panics, invalid transactions, etc.). */ export declare class NearError extends Error { code: string; data?: unknown; constructor(message: string, code: string, data?: unknown); } /** * Thrown when an account has insufficient balance for an operation */ export declare class InsufficientBalanceError extends NearError { required: string; available: string; constructor(required: string, available: string); } /** * Thrown when a contract function call fails */ export declare class FunctionCallError extends NearError { panic?: string; methodName?: string; contractId: string; logs: string[]; constructor(contractId: string, methodName: string | undefined, panic?: string, logs?: string[]); } /** * Thrown when a network request fails */ export declare class NetworkError extends NearError { statusCode?: number; retryable: boolean; constructor(message: string, statusCode?: number, retryable?: boolean); } /** * Thrown when a key is invalid or malformed */ export declare class InvalidKeyError extends NearError { constructor(message: string); } /** * Thrown when an account does not exist */ export declare class AccountDoesNotExistError extends NearError { accountId: string; constructor(accountId: string); } /** * Thrown when an access key does not exist */ export declare class AccessKeyDoesNotExistError extends NearError { accountId: string; publicKey: string; constructor(accountId: string, publicKey: string); } /** * Thrown when an account ID is invalid */ export declare class InvalidAccountIdError extends NearError { accountId: string; constructor(accountId: string, reason?: string); } /** * Thrown when transaction signing fails */ export declare class SignatureError extends NearError { constructor(message: string); } /** * Thrown when gas limit is exceeded */ export declare class GasLimitExceededError extends NearError { gasUsed: string; gasLimit: string; constructor(gasUsed: string, gasLimit: string); } /** * Thrown when a transaction times out */ export declare class TransactionTimeoutError extends NearError { transactionHash: string; constructor(transactionHash: string); } /** * Thrown when wallet operations fail */ export declare class WalletError extends NearError { constructor(message: string); } /** * Thrown when a requested block cannot be found * Suggests using an archival node for old blocks */ export declare class UnknownBlockError extends NearError { blockReference: string; constructor(blockReference: string); } /** * Thrown when account ID format is invalid */ export declare class InvalidAccountError extends NearError { accountId: string; constructor(accountId: string); } /** * Thrown when the requested shard is not available on this node */ export declare class ShardUnavailableError extends NearError { retryable: boolean; constructor(message?: string); } /** * Thrown when the node is still syncing */ export declare class NodeNotSyncedError extends NearError { retryable: boolean; constructor(message?: string); } /** * Thrown when an account has no contract deployed */ export declare class ContractNotDeployedError extends NearError { accountId: string; constructor(accountId: string); } /** * Thrown when a global contract is not found in the on-chain registry. * * The `identifier` mirrors how the contract was looked up: by immutable code * hash (base58) or by the publishing account ID. */ export declare class GlobalContractNotFoundError extends NearError { identifier: { codeHash: string; } | { accountId: string; }; constructor(identifier: { codeHash: string; } | { accountId: string; }); } /** * Thrown when contract state is too large to return */ export declare class ContractStateTooLargeError extends NearError { accountId: string; constructor(accountId: string); } /** * Thrown when a view function call execution fails */ export declare class ContractExecutionError extends NearError { contractId: string; methodName?: string; details?: unknown; constructor(contractId: string, methodName?: string, details?: unknown); } /** * Thrown when a chunk cannot be found */ export declare class UnknownChunkError extends NearError { chunkReference: string; constructor(chunkReference: string); } /** * Thrown when an invalid shard ID is provided */ export declare class InvalidShardIdError extends NearError { shardId: number | string; constructor(shardId: number | string); } /** * Thrown when an epoch cannot be found */ export declare class UnknownEpochError extends NearError { blockReference: string; constructor(blockReference: string); } /** * Thrown when transaction nonce is invalid * This happens when a transaction uses a nonce that has already been used */ export declare class InvalidNonceError extends NearError { txNonce: number; akNonce: number; retryable: boolean; constructor(txNonce: number, akNonce: number); } /** * Thrown when a transaction is invalid * Check details for specific reasons like ShardCongested or ShardStuck */ export declare class InvalidTransactionError extends NearError { retryable: boolean; shardCongested: boolean; shardStuck: boolean; details?: unknown; constructor(message: string, details?: unknown); } /** * Thrown when a receipt cannot be found */ export declare class UnknownReceiptError extends NearError { receiptId: string; constructor(receiptId: string); } /** * Thrown when request parameters cannot be parsed */ export declare class ParseError extends NearError { constructor(message: string, details?: unknown); } /** * Thrown when a request times out (408) * This is always retryable - resubmit the identical transaction */ export declare class TimeoutError extends NearError { retryable: boolean; transactionHash?: string; constructor(message?: string, transactionHash?: string); } /** * Thrown when the RPC server encounters an internal error (500) * This is always retryable */ export declare class InternalServerError extends NearError { retryable: boolean; constructor(message?: string, details?: unknown); } //# sourceMappingURL=index.d.ts.map