@solana/errors 5.5.0 → 5.5.1-canary-20260128113732

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/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import { Command, InvalidArgumentError } from 'commander';
4
4
  // src/cli.ts
5
5
 
6
6
  // package.json
7
- var version = "5.5.0";
7
+ var version = "5.5.1-canary-20260128113732";
8
8
 
9
9
  // src/context.ts
10
10
  function decodeEncodedContext(encodedContext) {
@@ -926,6 +926,18 @@ function isRpcErrorResponse(value) {
926
926
  return typeof value === "object" && value !== null && "code" in value && "message" in value && (typeof value.code === "number" || typeof value.code === "bigint") && typeof value.message === "string";
927
927
  }
928
928
 
929
+ // src/simulation-errors.ts
930
+ function unwrapSimulationError(error) {
931
+ const simulationCodes = [
932
+ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,
933
+ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT
934
+ ];
935
+ if (isSolanaError(error) && !!error.cause && simulationCodes.includes(error.context.__code)) {
936
+ return error.cause;
937
+ }
938
+ return error;
939
+ }
940
+
929
941
  exports.SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND;
930
942
  exports.SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED;
931
943
  exports.SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT;
@@ -1195,5 +1207,6 @@ exports.getSolanaErrorFromJsonRpcError = getSolanaErrorFromJsonRpcError;
1195
1207
  exports.getSolanaErrorFromTransactionError = getSolanaErrorFromTransactionError;
1196
1208
  exports.isSolanaError = isSolanaError;
1197
1209
  exports.safeCaptureStackTrace = safeCaptureStackTrace;
1210
+ exports.unwrapSimulationError = unwrapSimulationError;
1198
1211
  //# sourceMappingURL=index.browser.cjs.map
1199
1212
  //# sourceMappingURL=index.browser.cjs.map