@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/types/index.d.ts
CHANGED
|
@@ -65,8 +65,9 @@
|
|
|
65
65
|
*/
|
|
66
66
|
export * from './codes';
|
|
67
67
|
export * from './error';
|
|
68
|
-
export * from './json-rpc-error';
|
|
69
68
|
export * from './instruction-error';
|
|
69
|
+
export * from './json-rpc-error';
|
|
70
|
+
export * from './simulation-errors';
|
|
70
71
|
export * from './stack-trace';
|
|
71
72
|
export * from './transaction-error';
|
|
72
73
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the underlying cause from a simulation-related error.
|
|
3
|
+
*
|
|
4
|
+
* When a transaction simulation fails, the error is often wrapped in a
|
|
5
|
+
* simulation-specific {@link SolanaError}. This function unwraps such errors
|
|
6
|
+
* by returning the `cause` property, giving you access to the actual error
|
|
7
|
+
* that triggered the simulation failure.
|
|
8
|
+
*
|
|
9
|
+
* If the provided error is not a simulation-related error, it is returned unchanged.
|
|
10
|
+
*
|
|
11
|
+
* The following error codes are considered simulation errors:
|
|
12
|
+
* - {@link SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE}
|
|
13
|
+
* - {@link SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT}
|
|
14
|
+
*
|
|
15
|
+
* @param error - The error to unwrap.
|
|
16
|
+
* @return The underlying cause if the error is a simulation error, otherwise the original error.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* Unwrapping a preflight failure to access the root cause.
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { unwrapSimulationError } from '@solana/errors';
|
|
22
|
+
*
|
|
23
|
+
* try {
|
|
24
|
+
* await sendTransaction(signedTransaction);
|
|
25
|
+
* } catch (e) {
|
|
26
|
+
* const cause = unwrapSimulationError(e);
|
|
27
|
+
* console.log('Send transaction failed due to:', cause);
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function unwrapSimulationError(error: unknown): unknown;
|
|
32
|
+
//# sourceMappingURL=simulation-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulation-errors.d.ts","sourceRoot":"","sources":["../../src/simulation-errors.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS7D"}
|
package/package.json
CHANGED