@solana/errors 2.0.0-experimental.7712fc3 → 2.0.0-experimental.8541c2e
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.js +3 -193
- package/dist/index.browser.cjs +52 -429
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +53 -334
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +53 -334
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +52 -429
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +53 -334
- package/dist/index.node.js.map +1 -1
- package/dist/types/codes.d.ts +3 -98
- package/dist/types/codes.d.ts.map +1 -1
- package/dist/types/context.d.ts +15 -106
- package/dist/types/context.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transaction-error.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/instruction-error.d.ts +0 -5
- package/dist/types/instruction-error.d.ts.map +0 -1
- package/dist/types/rpc-enum-errors.d.ts +0 -31
- package/dist/types/rpc-enum-errors.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACH
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mCAAmC,EACnC,mCAAmC,EACnC,qCAAqC,EACrC,2BAA2B,EAC3B,kCAAkC,EAClC,qDAAqD,EACrD,2DAA2D,EAC3D,wEAAwE,EACxE,uCAAuC,EACvC,4CAA4C,EAC5C,eAAe,EAClB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,yCAAyC,CAAC,CAAC,IAAI;KACtD,CAAC,IAAI,eAAe,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CA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@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EA6CH,eAAe,EAClB,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC;KAGtC,CAAC,IAAI,eAAe,GAAG,MAAM;CACjC,CAyEA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-error.d.ts","sourceRoot":"","sources":["../../src/transaction-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction-error.d.ts","sourceRoot":"","sources":["../../src/transaction-error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoDtC,wBAAgB,kCAAkC,CAAC,gBAAgB,EAAE,MAAM,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,WAAW,CAoDrH"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-error.d.ts","sourceRoot":"","sources":["../../src/instruction-error.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA+DtC,wBAAgB,kCAAkC,CAC9C,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GACtD,WAAW,CA6Bb"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { SolanaErrorCode } from './codes.js';
|
|
2
|
-
import { SolanaErrorContext } from './context.js';
|
|
3
|
-
import { SolanaError } from './error.js';
|
|
4
|
-
type Config = Readonly<{
|
|
5
|
-
/**
|
|
6
|
-
* Oh, hello. You might wonder what in tarnation is going on here. Allow us to explain.
|
|
7
|
-
*
|
|
8
|
-
* One of the goals of `@solana/errors` is to allow errors that are not interesting to your
|
|
9
|
-
* application to shake out of your app bundle in production. This means that we must never
|
|
10
|
-
* export large hardcoded maps of error codes/messages.
|
|
11
|
-
*
|
|
12
|
-
* Unfortunately, where instruction and transaction errors from the RPC are concerned, we have
|
|
13
|
-
* no choice but to keep a map between the RPC `rpcEnumError` enum name and its corresponding
|
|
14
|
-
* `SolanaError` code. In the interest of implementing that map in as few bytes of source code
|
|
15
|
-
* as possible, we do the following:
|
|
16
|
-
*
|
|
17
|
-
* 1. Reserve a block of sequential error codes for the enum in question
|
|
18
|
-
* 2. Hardcode the list of enum names in that same order
|
|
19
|
-
* 3. Match the enum error name from the RPC with its index in that list, and reconstruct the
|
|
20
|
-
* `SolanaError` code by adding the `errorCodeBaseOffset` to that index
|
|
21
|
-
*/
|
|
22
|
-
errorCodeBaseOffset: number;
|
|
23
|
-
getErrorContext: (errorCode: SolanaErrorCode, rpcErrorName: string, rpcErrorContext?: unknown) => SolanaErrorContext[SolanaErrorCode];
|
|
24
|
-
orderedErrorNames: string[];
|
|
25
|
-
rpcEnumError: string | {
|
|
26
|
-
[key: string]: unknown;
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
29
|
-
export declare function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }: Config, constructorOpt: Function): SolanaError;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=rpc-enum-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-enum-errors.d.ts","sourceRoot":"","sources":["../../src/rpc-enum-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,KAAK,MAAM,GAAG,QAAQ,CAAC;IACnB;;;;;;;;;;;;;;;;OAgBG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,CACb,SAAS,EAAE,eAAe,EAC1B,YAAY,EAAE,MAAM,EACpB,eAAe,CAAC,EAAE,OAAO,KACxB,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACrD,CAAC,CAAC;AAEH,wBAAgB,0BAA0B,CACtC,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,EAAE,MAAM,EAEjF,cAAc,EAAE,QAAQ,GACzB,WAAW,CAiBb"}
|