@solana/errors 6.10.0-canary-20260514084615 → 6.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/messages.ts CHANGED
@@ -156,10 +156,12 @@ import {
156
156
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE,
157
157
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET,
158
158
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE,
159
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_FILTER_TRANSACTION_NOT_FOUND,
159
160
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX,
160
161
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED,
161
162
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE,
162
163
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED,
164
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY,
163
165
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT,
164
166
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY,
165
167
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
@@ -252,7 +254,9 @@ import {
252
254
  SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING,
253
255
  SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND,
254
256
  SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,
257
+ SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT,
255
258
  SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,
259
+ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS,
256
260
  SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING,
257
261
  SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING,
258
262
  SOLANA_ERROR__TRANSACTION__INSTRUCTION_HEADERS_PAYLOADS_MISMATCH,
@@ -312,6 +316,7 @@ import {
312
316
  SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT,
313
317
  SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT,
314
318
  SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT,
319
+ SOLANA_ERROR__WALLET__ACCOUNT_NOT_AVAILABLE,
315
320
  SOLANA_ERROR__WALLET__NO_SIGNER_CONNECTED,
316
321
  SOLANA_ERROR__WALLET__NOT_CONNECTED,
317
322
  SOLANA_ERROR__WALLET__SIGNER_NOT_AVAILABLE,
@@ -569,12 +574,14 @@ export const SolanaErrorMessages: Readonly<{
569
574
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: '$__serverMessage',
570
575
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE]:
571
576
  'Epoch rewards period still active at slot $slot',
577
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_FILTER_TRANSACTION_NOT_FOUND]: '$__serverMessage',
572
578
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: '$__serverMessage',
573
579
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: '$__serverMessage',
574
580
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE]:
575
581
  'Failed to query long-term storage; please try again',
576
582
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: 'Minimum context slot has not been reached',
577
583
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: 'Node is unhealthy; behind by $numSlotsBehind slots',
584
+ [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SLOT_HISTORY]: 'No slot history',
578
585
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: 'No snapshot',
579
586
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: 'Transaction simulation failed',
580
587
  [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]:
@@ -813,11 +820,20 @@ export const SolanaErrorMessages: Readonly<{
813
820
  'Failed to estimate the compute unit consumption for this transaction message. This is ' +
814
821
  'likely because simulating the transaction failed. Inspect the `cause` property of this ' +
815
822
  'error to learn more',
823
+ [SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]:
824
+ 'Failed to estimate the loaded accounts data size for this transaction message. The RPC ' +
825
+ 'did not return a `loadedAccountsDataSize` value from simulation. This value is required ' +
826
+ 'for version 1 transactions',
816
827
  [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]:
817
828
  'Transaction failed when it was simulated in order to estimate the compute unit consumption. ' +
818
829
  'The compute unit estimate provided is for a transaction that failed when simulated and may not ' +
819
830
  'be representative of the compute units this transaction would consume if successful. Inspect the ' +
820
831
  '`cause` property of this error to learn more',
832
+ [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS]:
833
+ 'Transaction failed when it was simulated in order to estimate its resource limits. The ' +
834
+ 'resource limit estimates provided are for a transaction that failed when simulated and may ' +
835
+ 'not be representative of the resources this transaction would consume if successful. Inspect ' +
836
+ 'the `cause` property of this error to learn more',
821
837
  [SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: 'Transaction is missing a fee payer.',
822
838
  [SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]:
823
839
  "Could not determine this transaction's signature. Make sure that the transaction has " +
@@ -869,4 +885,5 @@ export const SolanaErrorMessages: Readonly<{
869
885
  [SOLANA_ERROR__WALLET__NOT_CONNECTED]: 'Cannot $operation: no wallet connected',
870
886
  [SOLANA_ERROR__WALLET__NO_SIGNER_CONNECTED]: 'No signing wallet connected (status: $status)',
871
887
  [SOLANA_ERROR__WALLET__SIGNER_NOT_AVAILABLE]: 'Connected wallet does not support signing',
888
+ [SOLANA_ERROR__WALLET__ACCOUNT_NOT_AVAILABLE]: 'Account $address is not available in wallet "$walletName"',
872
889
  };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
3
3
  SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,
4
+ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS,
4
5
  SolanaErrorCode,
5
6
  } from './codes';
6
7
  import { isSolanaError } from './error';
@@ -18,6 +19,7 @@ import { isSolanaError } from './error';
18
19
  * The following error codes are considered simulation errors:
19
20
  * - {@link SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE}
20
21
  * - {@link SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT}
22
+ * - {@link SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS}
21
23
  *
22
24
  * @param error - The error to unwrap.
23
25
  * @return The underlying cause if the error is a simulation error, otherwise the original error.
@@ -39,6 +41,7 @@ export function unwrapSimulationError(error: unknown): unknown {
39
41
  const simulationCodes: SolanaErrorCode[] = [
40
42
  SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
41
43
  SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,
44
+ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS,
42
45
  ];
43
46
  if (isSolanaError(error) && !!error.cause && simulationCodes.includes(error.context.__code)) {
44
47
  return error.cause;