diff --git a/.changeset/weak-lamps-help.md b/.changeset/weak-lamps-help.md new file mode 100644 index 000000000..e84febaa1 --- /dev/null +++ b/.changeset/weak-lamps-help.md @@ -0,0 +1,5 @@ +--- +"@solana/errors": patch +--- + +Add NO_SLOT_HISTORY error diff --git a/packages/errors/src/__tests__/json-rpc-error-test.ts b/packages/errors/src/__tests__/json-rpc-error-test.ts index 56bc6e88d..1b8e8fe04 100644 --- a/packages/errors/src/__tests__/json-rpc-error-test.ts +++ b/packages/errors/src/__tests__/json-rpc-error-test.ts @@ -13,6 +13,7 @@ import { SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED, + SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, @@ -107,6 +108,7 @@ describe('getSolanaErrorFromJsonRpcError', () => { describe.each([ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED, + SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE, diff --git a/packages/errors/src/codes.ts b/packages/errors/src/codes.ts index cbb5c7610..b2260667d 100644 --- a/packages/errors/src/codes.ts +++ b/packages/errors/src/codes.ts @@ -46,6 +46,7 @@ export const SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR = -32603; export const SOLANA_ERROR__JSON_RPC__INVALID_PARAMS = -32602; export const SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND = -32601; export const SOLANA_ERROR__JSON_RPC__INVALID_REQUEST = -32600; +export const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY = -32021; export const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE = -32019; export const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY = -32018; export const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE = -32017; @@ -576,6 +577,7 @@ export type SolanaErrorCode = | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED + | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE diff --git a/packages/errors/src/messages.ts b/packages/errors/src/messages.ts index dd9c925ed..341b9aec8 100644 --- a/packages/errors/src/messages.ts +++ b/packages/errors/src/messages.ts @@ -160,6 +160,7 @@ import { SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED, + SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, @@ -575,6 +576,7 @@ export const SolanaErrorMessages: Readonly<{ 'Failed to query long-term storage; please try again', [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: 'Minimum context slot has not been reached', [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: 'Node is unhealthy; behind by $numSlotsBehind slots', + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY]: 'No slot history', [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: 'No snapshot', [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: 'Transaction simulation failed', [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]: