@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 +1 -1
- package/dist/index.browser.cjs +13 -0
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs +13 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.native.mjs +13 -1
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs +13 -0
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +13 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/simulation-errors.d.ts +32 -0
- package/dist/types/simulation-errors.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
package/dist/index.browser.cjs
CHANGED
|
@@ -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
|