@usesigil/kit 0.15.0 → 0.16.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/dist/agent-bootstrap.d.ts +118 -0
- package/dist/agent-bootstrap.d.ts.map +1 -0
- package/dist/agent-bootstrap.js +211 -0
- package/dist/agent-bootstrap.js.map +1 -0
- package/dist/agent-errors.d.ts +3 -3
- package/dist/agent-errors.d.ts.map +1 -1
- package/dist/agent-errors.js +227 -142
- package/dist/agent-errors.js.map +1 -1
- package/dist/build-unsigned.d.ts +152 -0
- package/dist/build-unsigned.d.ts.map +1 -0
- package/dist/build-unsigned.js +152 -0
- package/dist/build-unsigned.js.map +1 -0
- package/dist/constraints/index.d.ts +23 -0
- package/dist/constraints/index.d.ts.map +1 -0
- package/dist/constraints/index.js +24 -0
- package/dist/constraints/index.js.map +1 -0
- package/dist/create-vault.d.ts +10 -1
- package/dist/create-vault.d.ts.map +1 -1
- package/dist/create-vault.js +10 -2
- package/dist/create-vault.js.map +1 -1
- package/dist/dashboard/constraint-builders.d.ts +82 -0
- package/dist/dashboard/constraint-builders.d.ts.map +1 -0
- package/dist/dashboard/constraint-builders.js +204 -0
- package/dist/dashboard/constraint-builders.js.map +1 -0
- package/dist/dashboard/errors.d.ts +37 -0
- package/dist/dashboard/errors.d.ts.map +1 -1
- package/dist/dashboard/errors.js +76 -0
- package/dist/dashboard/errors.js.map +1 -1
- package/dist/dashboard/from-json.d.ts.map +1 -1
- package/dist/dashboard/from-json.js +1 -2
- package/dist/dashboard/from-json.js.map +1 -1
- package/dist/dashboard/index.d.ts +29 -3
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +36 -1
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/mutations.d.ts +60 -1
- package/dist/dashboard/mutations.d.ts.map +1 -1
- package/dist/dashboard/mutations.js +127 -20
- package/dist/dashboard/mutations.js.map +1 -1
- package/dist/dashboard/post-assertion-validation.d.ts +88 -0
- package/dist/dashboard/post-assertion-validation.d.ts.map +1 -0
- package/dist/dashboard/post-assertion-validation.js +191 -0
- package/dist/dashboard/post-assertion-validation.js.map +1 -0
- package/dist/dashboard/reads.d.ts +93 -1
- package/dist/dashboard/reads.d.ts.map +1 -1
- package/dist/dashboard/reads.js +238 -9
- package/dist/dashboard/reads.js.map +1 -1
- package/dist/dashboard/types.d.ts +147 -11
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/errors/codes.js +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +2 -1
- package/dist/events.js.map +1 -1
- package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts +12 -0
- package/dist/generated/accounts/pendingAgentPermissionsUpdate.d.ts.map +1 -1
- package/dist/generated/accounts/pendingAgentPermissionsUpdate.js +3 -1
- package/dist/generated/accounts/pendingAgentPermissionsUpdate.js.map +1 -1
- package/dist/generated/accounts/pendingCloseConstraints.d.ts +12 -0
- package/dist/generated/accounts/pendingCloseConstraints.d.ts.map +1 -1
- package/dist/generated/accounts/pendingCloseConstraints.js +4 -2
- package/dist/generated/accounts/pendingCloseConstraints.js.map +1 -1
- package/dist/generated/accounts/pendingConstraintsUpdate.d.ts +14 -0
- package/dist/generated/accounts/pendingConstraintsUpdate.d.ts.map +1 -1
- package/dist/generated/accounts/pendingConstraintsUpdate.js +4 -2
- package/dist/generated/accounts/pendingConstraintsUpdate.js.map +1 -1
- package/dist/generated/accounts/pendingPolicyUpdate.d.ts +24 -4
- package/dist/generated/accounts/pendingPolicyUpdate.d.ts.map +1 -1
- package/dist/generated/accounts/pendingPolicyUpdate.js +6 -4
- package/dist/generated/accounts/pendingPolicyUpdate.js.map +1 -1
- package/dist/generated/accounts/policyConfig.d.ts +28 -10
- package/dist/generated/accounts/policyConfig.d.ts.map +1 -1
- package/dist/generated/accounts/policyConfig.js +4 -4
- package/dist/generated/accounts/policyConfig.js.map +1 -1
- package/dist/generated/accounts/sessionAuthority.d.ts +18 -4
- package/dist/generated/accounts/sessionAuthority.d.ts.map +1 -1
- package/dist/generated/accounts/sessionAuthority.js +3 -3
- package/dist/generated/accounts/sessionAuthority.js.map +1 -1
- package/dist/generated/errors/sigil.d.ts +95 -81
- package/dist/generated/errors/sigil.d.ts.map +1 -1
- package/dist/generated/errors/sigil.js +107 -86
- package/dist/generated/errors/sigil.js.map +1 -1
- package/dist/generated/event-discriminators.d.ts.map +1 -1
- package/dist/generated/event-discriminators.js +2 -1
- package/dist/generated/event-discriminators.js.map +1 -1
- package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts +67 -0
- package/dist/generated/instructions/cleanupOrphanConstraintsPda.d.ts.map +1 -0
- package/dist/generated/instructions/cleanupOrphanConstraintsPda.js +120 -0
- package/dist/generated/instructions/cleanupOrphanConstraintsPda.js.map +1 -0
- package/dist/generated/instructions/freezeVault.d.ts +8 -5
- package/dist/generated/instructions/freezeVault.d.ts.map +1 -1
- package/dist/generated/instructions/freezeVault.js +14 -3
- package/dist/generated/instructions/freezeVault.js.map +1 -1
- package/dist/generated/instructions/index.d.ts +1 -0
- package/dist/generated/instructions/index.d.ts.map +1 -1
- package/dist/generated/instructions/index.js +1 -0
- package/dist/generated/instructions/index.js.map +1 -1
- package/dist/generated/instructions/initializeVault.d.ts +0 -4
- package/dist/generated/instructions/initializeVault.d.ts.map +1 -1
- package/dist/generated/instructions/initializeVault.js +0 -2
- package/dist/generated/instructions/initializeVault.js.map +1 -1
- package/dist/generated/instructions/queuePolicyUpdate.d.ts +8 -8
- package/dist/generated/instructions/queuePolicyUpdate.d.ts.map +1 -1
- package/dist/generated/instructions/queuePolicyUpdate.js +4 -4
- package/dist/generated/instructions/queuePolicyUpdate.js.map +1 -1
- package/dist/generated/programs/sigil.d.ts +29 -25
- package/dist/generated/programs/sigil.d.ts.map +1 -1
- package/dist/generated/programs/sigil.js +37 -25
- package/dist/generated/programs/sigil.js.map +1 -1
- package/dist/generated/types/accountConstraint.d.ts +16 -1
- package/dist/generated/types/accountConstraint.d.ts.map +1 -1
- package/dist/generated/types/accountConstraint.js +2 -0
- package/dist/generated/types/accountConstraint.js.map +1 -1
- package/dist/generated/types/accountConstraintZC.d.ts +7 -0
- package/dist/generated/types/accountConstraintZC.d.ts.map +1 -1
- package/dist/generated/types/accountConstraintZC.js +4 -2
- package/dist/generated/types/accountConstraintZC.js.map +1 -1
- package/dist/generated/types/constraintEntry.d.ts +0 -4
- package/dist/generated/types/constraintEntry.d.ts.map +1 -1
- package/dist/generated/types/constraintEntry.js +1 -3
- package/dist/generated/types/constraintEntry.js.map +1 -1
- package/dist/generated/types/constraintEntryZC.d.ts +17 -12
- package/dist/generated/types/constraintEntryZC.d.ts.map +1 -1
- package/dist/generated/types/constraintEntryZC.js +2 -2
- package/dist/generated/types/constraintEntryZC.js.map +1 -1
- package/dist/generated/types/index.d.ts +1 -0
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +1 -0
- package/dist/generated/types/index.js.map +1 -1
- package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts +22 -0
- package/dist/generated/types/orphanConstraintsPdaCleaned.d.ts.map +1 -0
- package/dist/generated/types/orphanConstraintsPdaCleaned.js +26 -0
- package/dist/generated/types/orphanConstraintsPdaCleaned.js.map +1 -0
- package/dist/generated/types/vaultFrozen.d.ts +12 -0
- package/dist/generated/types/vaultFrozen.d.ts.map +1 -1
- package/dist/generated/types/vaultFrozen.js +3 -1
- package/dist/generated/types/vaultFrozen.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/inscribe.d.ts +0 -4
- package/dist/inscribe.d.ts.map +1 -1
- package/dist/inscribe.js +0 -1
- package/dist/inscribe.js.map +1 -1
- package/dist/kit-adapter.d.ts +1 -1
- package/dist/kit-adapter.d.ts.map +1 -1
- package/dist/kit-adapter.js +1 -1
- package/dist/kit-adapter.js.map +1 -1
- package/dist/logger.d.ts +48 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +36 -0
- package/dist/logger.js.map +1 -1
- package/dist/owner-transaction.d.ts +8 -0
- package/dist/owner-transaction.d.ts.map +1 -1
- package/dist/owner-transaction.js +1 -0
- package/dist/owner-transaction.js.map +1 -1
- package/dist/post-assertions/cross-field-lte.d.ts +134 -0
- package/dist/post-assertions/cross-field-lte.d.ts.map +1 -0
- package/dist/post-assertions/cross-field-lte.js +129 -0
- package/dist/post-assertions/cross-field-lte.js.map +1 -0
- package/dist/post-assertions/index.d.ts +28 -0
- package/dist/post-assertions/index.d.ts.map +1 -0
- package/dist/post-assertions/index.js +28 -0
- package/dist/post-assertions/index.js.map +1 -0
- package/dist/post-assertions/presets/flash-trade.d.ts +139 -0
- package/dist/post-assertions/presets/flash-trade.d.ts.map +1 -0
- package/dist/post-assertions/presets/flash-trade.js +154 -0
- package/dist/post-assertions/presets/flash-trade.js.map +1 -0
- package/dist/presets.d.ts +1 -7
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js +0 -5
- package/dist/presets.js.map +1 -1
- package/dist/preview-create-vault.d.ts +280 -0
- package/dist/preview-create-vault.d.ts.map +1 -0
- package/dist/preview-create-vault.js +477 -0
- package/dist/preview-create-vault.js.map +1 -0
- package/dist/protocol-registry/annotations/drift.json +7 -0
- package/dist/protocol-registry/annotations/flash-trade.json +7 -0
- package/dist/protocol-registry/annotations/jupiter-borrow.json +7 -0
- package/dist/protocol-registry/annotations/jupiter-earn.json +7 -0
- package/dist/protocol-registry/annotations/jupiter-lend.json +7 -0
- package/dist/protocol-registry/annotations/jupiter.json +7 -0
- package/dist/protocol-registry/annotations/kamino.json +7 -0
- package/dist/protocol-registry/index.d.ts +45 -0
- package/dist/protocol-registry/index.d.ts.map +1 -0
- package/dist/protocol-registry/index.js +76 -0
- package/dist/protocol-registry/index.js.map +1 -0
- package/dist/protocol-tier.d.ts +157 -0
- package/dist/protocol-tier.d.ts.map +1 -0
- package/dist/protocol-tier.js +104 -0
- package/dist/protocol-tier.js.map +1 -0
- package/dist/seal.d.ts.map +1 -1
- package/dist/seal.js +26 -2
- package/dist/seal.js.map +1 -1
- package/dist/sigil.d.ts +0 -4
- package/dist/sigil.d.ts.map +1 -1
- package/dist/simulation.d.ts.map +1 -1
- package/dist/simulation.js +72 -91
- package/dist/simulation.js.map +1 -1
- package/dist/testing/devnet.d.ts.map +1 -1
- package/dist/testing/devnet.js +0 -1
- package/dist/testing/devnet.js.map +1 -1
- package/dist/testing/errors/expect.d.ts +137 -0
- package/dist/testing/errors/expect.d.ts.map +1 -0
- package/dist/testing/errors/expect.js +372 -0
- package/dist/testing/errors/expect.js.map +1 -0
- package/dist/testing/errors/index.d.ts +3 -0
- package/dist/testing/errors/index.d.ts.map +1 -0
- package/dist/testing/errors/index.js +8 -0
- package/dist/testing/errors/index.js.map +1 -0
- package/dist/testing/errors/names.generated.d.ts +188 -0
- package/dist/testing/errors/names.generated.d.ts.map +1 -0
- package/dist/testing/errors/names.generated.js +183 -0
- package/dist/testing/errors/names.generated.js.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/mock-rpc.d.ts +8 -0
- package/dist/testing/mock-rpc.d.ts.map +1 -1
- package/dist/testing/mock-rpc.js +14 -0
- package/dist/testing/mock-rpc.js.map +1 -1
- package/dist/testing/mock-state.js +2 -2
- package/dist/testing/mock-state.js.map +1 -1
- package/package.json +15 -3
- package/dist/integrations/protocol-handler.d.ts +0 -59
- package/dist/integrations/protocol-handler.d.ts.map +0 -1
- package/dist/integrations/protocol-handler.js +0 -9
- package/dist/integrations/protocol-handler.js.map +0 -1
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict error-assertion helpers for Sigil tests.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the legacy `expectError(err, ...keywords)` and variadic
|
|
5
|
+
* `expectSigilError(errString, ...names)` helpers.
|
|
6
|
+
*
|
|
7
|
+
* Council decision: 7-0 STRICT (2026-04-20). See:
|
|
8
|
+
* MEMORY/WORK/20260420-201121_test-assertion-precision-council/COUNCIL_DECISION.md
|
|
9
|
+
*
|
|
10
|
+
* Design tenets:
|
|
11
|
+
* 1. Coupled {name, code} pairs via IDL-generated types.
|
|
12
|
+
* A typo on the name fails tsc.
|
|
13
|
+
* 2. No substring matching on error names. Match against structured
|
|
14
|
+
* Anchor error log formats.
|
|
15
|
+
* 3. CPI-origin guard (MIKE G-1): assertions never pass for Anchor errors
|
|
16
|
+
* thrown by CPI callees (e.g., Jupiter) that happen to share a code
|
|
17
|
+
* number with a Sigil error. Extract origin from the Solana runtime's
|
|
18
|
+
* `Program <id> invoke|failed` log lines (NOT the Anchor error line —
|
|
19
|
+
* those do not carry program id per anchor-lang-0.32.1/src/error.rs).
|
|
20
|
+
* 4. @solana/kit log-fetch awareness (MIKE G-2): SendTransactionError
|
|
21
|
+
* from kit simulation has `logs === undefined` until `.getLogs()` is
|
|
22
|
+
* awaited. Diagnostic output calls this out explicitly.
|
|
23
|
+
* 5. Diagnostic failure messages. When an assertion fails, the message
|
|
24
|
+
* says exactly what was expected, what was received, and where to
|
|
25
|
+
* look for the logs.
|
|
26
|
+
*/
|
|
27
|
+
import { ANCHOR_FRAMEWORK_ERRORS, SIGIL_ERRORS, } from "./names.generated.js";
|
|
28
|
+
// ────────────────────────────────────────────────────────────────
|
|
29
|
+
// Sigil program ID — canonical mainnet/devnet/localnet address.
|
|
30
|
+
// Used for CPI-origin guard (G-1).
|
|
31
|
+
// ────────────────────────────────────────────────────────────────
|
|
32
|
+
export const SIGIL_PROGRAM_ID_BASE58 = "4ZeVCqnjUgUtFrHHPG7jELUxvJeoVGHhGNgPrhBPwrHL";
|
|
33
|
+
/**
|
|
34
|
+
* Real Anchor 0.32.1 emits EXACTLY three log shapes for an AnchorError.
|
|
35
|
+
* Source: https://github.com/coral-xyz/anchor/blob/v0.32.1/lang/src/error.rs#L499-L541
|
|
36
|
+
*
|
|
37
|
+
* 1. ErrorOrigin::None → "AnchorError occurred. Error Code: X. Error Number: N. Error Message: Y."
|
|
38
|
+
* 2. ErrorOrigin::Source → "AnchorError thrown in <file>:<line>. Error Code: X. Error Number: N. Error Message: Y."
|
|
39
|
+
* 3. ErrorOrigin::AccountName → "AnchorError caused by account: <name>. Error Code: X. Error Number: N. Error Message: Y."
|
|
40
|
+
*
|
|
41
|
+
* The Solana runtime wraps the error in `Program <base58> failed: ...`
|
|
42
|
+
* so we extract origin from those lines separately.
|
|
43
|
+
*/
|
|
44
|
+
// ReDoS-hardened patterns. Every unbounded repetition is constrained to
|
|
45
|
+
// either (a) a character class that excludes whitespace (so no backtracking
|
|
46
|
+
// over log-line boundaries) OR (b) a {min,max} length bound (so worst-case
|
|
47
|
+
// is linear). The filename portion of format #2 is bounded at 256 chars —
|
|
48
|
+
// longer than any realistic Rust source path — to kill polynomial
|
|
49
|
+
// backtracking on adversarial `err.logs` input (CodeQL js/polynomial-redos).
|
|
50
|
+
const ANCHOR_ERROR_RES = [
|
|
51
|
+
// Source variant — produced by `error!()` / `require!()` (most common).
|
|
52
|
+
// `[^:\s]{1,256}` = non-whitespace, non-colon filename, max 256 chars.
|
|
53
|
+
/AnchorError thrown in [^:\s]{1,256}:\d{1,10}\.\s{0,8}Error Code:\s{0,8}(\w{1,64})\.\s{0,8}Error Number:\s{0,8}(\d{1,10})\./,
|
|
54
|
+
// AccountName variant — produced by `#[account(..., constraint = ... @ E)]`.
|
|
55
|
+
/AnchorError caused by account:\s{0,8}\w{1,64}\.\s{0,8}Error Code:\s{0,8}(\w{1,64})\.\s{0,8}Error Number:\s{0,8}(\d{1,10})\./,
|
|
56
|
+
// None variant.
|
|
57
|
+
/AnchorError occurred\.\s{0,8}Error Code:\s{0,8}(\w{1,64})\.\s{0,8}Error Number:\s{0,8}(\d{1,10})\./,
|
|
58
|
+
];
|
|
59
|
+
/** `Program <base58> invoke [<depth>]` — Solana runtime CPI log. */
|
|
60
|
+
const PROGRAM_INVOKE_RE = /Program ([1-9A-HJ-NP-Za-km-z]{32,44}) invoke \[(\d+)\]/;
|
|
61
|
+
/**
|
|
62
|
+
* `Program <base58> failed: ...` — Solana runtime failure log. The LAST
|
|
63
|
+
* occurrence before the Anchor error identifies the program that
|
|
64
|
+
* actually emitted the error.
|
|
65
|
+
*/
|
|
66
|
+
const PROGRAM_FAILED_RE = /Program ([1-9A-HJ-NP-Za-km-z]{32,44}) failed:/;
|
|
67
|
+
/** Raw hex custom program error (fallback when logs are missing). */
|
|
68
|
+
const CUSTOM_PROGRAM_ERROR_RE = /custom program error:\s*0x([0-9a-f]+)/i;
|
|
69
|
+
/**
|
|
70
|
+
* Extract structured {code, name, originProgramId} from a thrown error
|
|
71
|
+
* or error-string. Returns null if the error is not parseable as an
|
|
72
|
+
* Anchor/Sigil error.
|
|
73
|
+
*
|
|
74
|
+
* Safe to call with any thrown value — string, Error, SendTransactionError,
|
|
75
|
+
* AnchorError, unknown. Never throws.
|
|
76
|
+
*/
|
|
77
|
+
export function parseAnchorError(err) {
|
|
78
|
+
if (err === null || err === undefined)
|
|
79
|
+
return null;
|
|
80
|
+
// Stage 1: collect all strings we can probe.
|
|
81
|
+
const logs = [];
|
|
82
|
+
const textSources = [];
|
|
83
|
+
const anyErr = err;
|
|
84
|
+
if (Array.isArray(anyErr.logs)) {
|
|
85
|
+
for (const l of anyErr.logs) {
|
|
86
|
+
if (typeof l === "string")
|
|
87
|
+
logs.push(l);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (typeof anyErr.message === "string")
|
|
91
|
+
textSources.push(anyErr.message);
|
|
92
|
+
if (typeof anyErr.toString === "function") {
|
|
93
|
+
try {
|
|
94
|
+
const s = anyErr.toString();
|
|
95
|
+
if (typeof s === "string" && s.length > 0)
|
|
96
|
+
textSources.push(s);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Exotic objects can throw from toString.
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (typeof err === "string")
|
|
103
|
+
textSources.push(err);
|
|
104
|
+
const haystack = [...logs, ...textSources].join("\n");
|
|
105
|
+
// Stage 2: identify the origin program from Solana runtime logs.
|
|
106
|
+
// Walk lines in order; remember the last `Program X failed:` (that is
|
|
107
|
+
// the program that actually threw). Fall back to the deepest-invoked
|
|
108
|
+
// program if no explicit failure line is present.
|
|
109
|
+
let originProgramId;
|
|
110
|
+
let deepestInvoke;
|
|
111
|
+
for (const line of logs) {
|
|
112
|
+
const failed = line.match(PROGRAM_FAILED_RE);
|
|
113
|
+
if (failed) {
|
|
114
|
+
originProgramId = failed[1];
|
|
115
|
+
}
|
|
116
|
+
const invoked = line.match(PROGRAM_INVOKE_RE);
|
|
117
|
+
if (invoked) {
|
|
118
|
+
const depth = Number(invoked[2]);
|
|
119
|
+
if (!deepestInvoke || depth > deepestInvoke.depth) {
|
|
120
|
+
deepestInvoke = { programId: invoked[1], depth };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (originProgramId === undefined && deepestInvoke) {
|
|
125
|
+
originProgramId = deepestInvoke.programId;
|
|
126
|
+
}
|
|
127
|
+
// Stage 3: match any of the three real Anchor error formats.
|
|
128
|
+
for (const re of ANCHOR_ERROR_RES) {
|
|
129
|
+
const match = haystack.match(re);
|
|
130
|
+
if (match) {
|
|
131
|
+
return {
|
|
132
|
+
name: match[1],
|
|
133
|
+
code: Number(match[2]),
|
|
134
|
+
originProgramId,
|
|
135
|
+
logs,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Stage 4: fall back to raw custom hex code. Resolve name by code.
|
|
140
|
+
const hex = haystack.match(CUSTOM_PROGRAM_ERROR_RE);
|
|
141
|
+
if (hex) {
|
|
142
|
+
const code = parseInt(hex[1], 16);
|
|
143
|
+
const name = nameForCode(code);
|
|
144
|
+
return {
|
|
145
|
+
code,
|
|
146
|
+
name: name ?? "UnknownCustomError",
|
|
147
|
+
originProgramId,
|
|
148
|
+
logs,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
function nameForCode(code) {
|
|
154
|
+
// Check Sigil range first (6000+) — no overlap with Anchor framework (≤5999),
|
|
155
|
+
// but we assert the range to be explicit if that ever changes.
|
|
156
|
+
if (code >= 6000) {
|
|
157
|
+
for (const [name, c] of Object.entries(SIGIL_ERRORS)) {
|
|
158
|
+
if (c === code)
|
|
159
|
+
return name;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
for (const [name, c] of Object.entries(ANCHOR_FRAMEWORK_ERRORS)) {
|
|
164
|
+
if (c === code)
|
|
165
|
+
return name;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Enforce that a parsed error originated from the Sigil program, not a
|
|
172
|
+
* CPI callee. Throws {@link SigilAssertionError} on CPI origin mismatch.
|
|
173
|
+
*
|
|
174
|
+
* If the origin could not be resolved (unparseable logs, raw hex-only
|
|
175
|
+
* fallback), we do NOT fail the assertion — the guard is best-effort,
|
|
176
|
+
* not fail-closed — but the diagnostic notes the unverified state.
|
|
177
|
+
*/
|
|
178
|
+
function assertSigilOrigin(parsed, contextExpected, err) {
|
|
179
|
+
if (parsed.originProgramId !== undefined &&
|
|
180
|
+
parsed.originProgramId !== SIGIL_PROGRAM_ID_BASE58) {
|
|
181
|
+
throw new SigilAssertionError(`${contextExpected} thrown by ${SIGIL_PROGRAM_ID_BASE58}; ` +
|
|
182
|
+
`got error from CPI callee ${parsed.originProgramId} ` +
|
|
183
|
+
`(${parsed.name} / ${parsed.code}).\n` +
|
|
184
|
+
formatErrorForDiagnostic(err));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// ────────────────────────────────────────────────────────────────
|
|
188
|
+
// Public helpers
|
|
189
|
+
// ────────────────────────────────────────────────────────────────
|
|
190
|
+
/**
|
|
191
|
+
* Assert that `err` is a Sigil program error matching the given name
|
|
192
|
+
* (and optionally code).
|
|
193
|
+
*
|
|
194
|
+
* @param err The thrown error — any shape. Raw Error, AnchorError,
|
|
195
|
+
* SendTransactionError, string, unknown.
|
|
196
|
+
* @param expected.name Sigil error name. Typed — typos fail tsc.
|
|
197
|
+
* @param expected.code Optional numeric code. If passed, must match
|
|
198
|
+
* the name's canonical code. Lets authors document intent;
|
|
199
|
+
* CI drift-check ensures name↔code coupling.
|
|
200
|
+
*
|
|
201
|
+
* Throws {@link SigilAssertionError} if:
|
|
202
|
+
* - error is unparseable as an Anchor/Sigil error
|
|
203
|
+
* - error name does not match
|
|
204
|
+
* - error code does not match (when provided)
|
|
205
|
+
* - error was thrown by a CPI callee (not Sigil program) — G-1 guard
|
|
206
|
+
*/
|
|
207
|
+
export function expectSigilError(err, expected) {
|
|
208
|
+
const parsed = parseAnchorError(err);
|
|
209
|
+
if (!parsed) {
|
|
210
|
+
throw new SigilAssertionError(`expected Sigil error '${expected.name}' (${SIGIL_ERRORS[expected.name]}); ` +
|
|
211
|
+
`error is not parseable as an Anchor/Sigil error.\n` +
|
|
212
|
+
formatErrorForDiagnostic(err));
|
|
213
|
+
}
|
|
214
|
+
const canonicalCode = SIGIL_ERRORS[expected.name];
|
|
215
|
+
const claimedCode = expected.code ?? canonicalCode;
|
|
216
|
+
if (claimedCode !== canonicalCode) {
|
|
217
|
+
// Author passed an explicit code that disagrees with the name.
|
|
218
|
+
// This is a programming error — fail loudly even before touching `err`.
|
|
219
|
+
throw new SigilAssertionError(`helper misuse: expected.name '${expected.name}' maps to code ` +
|
|
220
|
+
`${canonicalCode}, but expected.code was ${claimedCode}. ` +
|
|
221
|
+
`Drop expected.code or fix the value.`);
|
|
222
|
+
}
|
|
223
|
+
// G-1 CPI-origin guard — check BEFORE name match so a Jupiter
|
|
224
|
+
// coincidentally-coded UnauthorizedAgent doesn't silently pass.
|
|
225
|
+
assertSigilOrigin(parsed, `expected Sigil error '${expected.name}'`, err);
|
|
226
|
+
if (parsed.name !== expected.name || parsed.code !== canonicalCode) {
|
|
227
|
+
throw new SigilAssertionError(`expected Sigil error '${expected.name}' (${canonicalCode}); ` +
|
|
228
|
+
`got '${parsed.name}' (${parsed.code}).\n` +
|
|
229
|
+
formatErrorForDiagnostic(err));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Assert that `err` is an Anchor framework error (2000-5999) matching
|
|
234
|
+
* the given name, and was thrown by the Sigil program (not a CPI callee).
|
|
235
|
+
*
|
|
236
|
+
* Only for tests that *intentionally* verify framework-layer behavior —
|
|
237
|
+
* seed derivation, account init, has_one constraints, etc. If the test
|
|
238
|
+
* is about Sigil business logic, use {@link expectSigilError} instead.
|
|
239
|
+
*/
|
|
240
|
+
export function expectAnchorError(err, expected) {
|
|
241
|
+
const parsed = parseAnchorError(err);
|
|
242
|
+
if (!parsed) {
|
|
243
|
+
throw new SigilAssertionError(`expected Anchor framework error '${expected.name}' (${ANCHOR_FRAMEWORK_ERRORS[expected.name]}); ` +
|
|
244
|
+
`error is not parseable.\n` +
|
|
245
|
+
formatErrorForDiagnostic(err));
|
|
246
|
+
}
|
|
247
|
+
const canonicalCode = ANCHOR_FRAMEWORK_ERRORS[expected.name];
|
|
248
|
+
const claimedCode = expected.code ?? canonicalCode;
|
|
249
|
+
if (claimedCode !== canonicalCode) {
|
|
250
|
+
throw new SigilAssertionError(`helper misuse: expected.name '${expected.name}' maps to Anchor code ` +
|
|
251
|
+
`${canonicalCode}, but expected.code was ${claimedCode}.`);
|
|
252
|
+
}
|
|
253
|
+
// G-1 applies to framework errors too — Anchor codes are emitted by
|
|
254
|
+
// every Anchor program, so Jupiter's `ConstraintSeeds` would otherwise
|
|
255
|
+
// satisfy a Sigil-scoped assertion.
|
|
256
|
+
assertSigilOrigin(parsed, `expected Anchor framework error '${expected.name}'`, err);
|
|
257
|
+
if (parsed.name !== expected.name || parsed.code !== canonicalCode) {
|
|
258
|
+
throw new SigilAssertionError(`expected Anchor framework error '${expected.name}' (${canonicalCode}); ` +
|
|
259
|
+
`got '${parsed.name}' (${parsed.code}).\n` +
|
|
260
|
+
formatErrorForDiagnostic(err));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export function expectOneOfSigilErrors(err, names) {
|
|
264
|
+
const parsed = parseAnchorError(err);
|
|
265
|
+
if (!parsed) {
|
|
266
|
+
throw new SigilAssertionError(`expected one of [${names.join(", ")}]; error is not parseable.\n` +
|
|
267
|
+
formatErrorForDiagnostic(err));
|
|
268
|
+
}
|
|
269
|
+
assertSigilOrigin(parsed, `expected one of [${names.join(", ")}]`, err);
|
|
270
|
+
for (const name of names) {
|
|
271
|
+
if (parsed.name === name && parsed.code === SIGIL_ERRORS[name])
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const expected = names.map((n) => `${n} (${SIGIL_ERRORS[n]})`).join(" | ");
|
|
275
|
+
throw new SigilAssertionError(`expected one of [${expected}]; got '${parsed.name}' (${parsed.code}).\n` +
|
|
276
|
+
formatErrorForDiagnostic(err));
|
|
277
|
+
}
|
|
278
|
+
export function expectOneOfAnchorErrors(err, names) {
|
|
279
|
+
const parsed = parseAnchorError(err);
|
|
280
|
+
if (!parsed) {
|
|
281
|
+
throw new SigilAssertionError(`expected one of Anchor framework errors [${names.join(", ")}]; ` +
|
|
282
|
+
`error is not parseable.\n` +
|
|
283
|
+
formatErrorForDiagnostic(err));
|
|
284
|
+
}
|
|
285
|
+
assertSigilOrigin(parsed, `expected one of Anchor framework errors [${names.join(", ")}]`, err);
|
|
286
|
+
for (const name of names) {
|
|
287
|
+
if (parsed.name === name && parsed.code === ANCHOR_FRAMEWORK_ERRORS[name]) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
const expected = names
|
|
292
|
+
.map((n) => `${n} (${ANCHOR_FRAMEWORK_ERRORS[n]})`)
|
|
293
|
+
.join(" | ");
|
|
294
|
+
throw new SigilAssertionError(`expected one of [${expected}]; got '${parsed.name}' (${parsed.code}).\n` +
|
|
295
|
+
formatErrorForDiagnostic(err));
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Assert that `err` is a raw Solana/system-program error with the given
|
|
299
|
+
* numeric code. For cases where no Anchor wrapper is involved — system
|
|
300
|
+
* program, SPL Token, ComputeBudget, or explicit `custom program error:
|
|
301
|
+
* 0x...` patterns.
|
|
302
|
+
*
|
|
303
|
+
* Matches against structured parse first (hex code or Anchor-parsed
|
|
304
|
+
* numeric code). Only falls back to WORD-BOUNDED decimal/hex match in
|
|
305
|
+
* the raw message, never to substring match — to avoid `code 1` matching
|
|
306
|
+
* `instruction 1` or `index 1`.
|
|
307
|
+
*/
|
|
308
|
+
export function expectSystemError(err, code) {
|
|
309
|
+
const parsed = parseAnchorError(err);
|
|
310
|
+
if (parsed && parsed.code === code)
|
|
311
|
+
return;
|
|
312
|
+
const text = String(err ?? "");
|
|
313
|
+
const hexCode = `0x${code.toString(16).toLowerCase()}`;
|
|
314
|
+
const hexRe = new RegExp(`custom program error:\\s*${hexCode.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "i");
|
|
315
|
+
if (hexRe.test(text))
|
|
316
|
+
return;
|
|
317
|
+
throw new SigilAssertionError(`expected system/program error with code ${code} (${hexCode}); ` +
|
|
318
|
+
`did not match.\n` +
|
|
319
|
+
formatErrorForDiagnostic(err));
|
|
320
|
+
}
|
|
321
|
+
// ────────────────────────────────────────────────────────────────
|
|
322
|
+
// Helper error type + diagnostic formatter
|
|
323
|
+
// ────────────────────────────────────────────────────────────────
|
|
324
|
+
/**
|
|
325
|
+
* Thrown by the `expect*Error` helpers when an assertion fails.
|
|
326
|
+
* A distinct class so test runners can format it specially if desired.
|
|
327
|
+
* Preserves `cause` with the original error for root-cause triage.
|
|
328
|
+
*/
|
|
329
|
+
export class SigilAssertionError extends Error {
|
|
330
|
+
constructor(message, cause) {
|
|
331
|
+
// @ts-ignore — ErrorOptions is ES2022+ but our target is ES2022.
|
|
332
|
+
super(message, cause !== undefined ? { cause } : undefined);
|
|
333
|
+
this.name = "SigilAssertionError";
|
|
334
|
+
if (cause !== undefined && this.cause === undefined) {
|
|
335
|
+
// Polyfill for runtimes that ignore ErrorOptions.
|
|
336
|
+
Object.defineProperty(this, "cause", {
|
|
337
|
+
value: cause,
|
|
338
|
+
writable: true,
|
|
339
|
+
configurable: true,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
function formatErrorForDiagnostic(err) {
|
|
345
|
+
if (err === null)
|
|
346
|
+
return " (actual: null)";
|
|
347
|
+
if (err === undefined)
|
|
348
|
+
return " (actual: undefined)";
|
|
349
|
+
const parts = [];
|
|
350
|
+
const anyErr = err;
|
|
351
|
+
if (typeof anyErr.name === "string")
|
|
352
|
+
parts.push(` name: ${anyErr.name}`);
|
|
353
|
+
if (typeof anyErr.message === "string") {
|
|
354
|
+
const msg = anyErr.message.slice(0, 400);
|
|
355
|
+
parts.push(` message: ${msg}`);
|
|
356
|
+
}
|
|
357
|
+
if (Array.isArray(anyErr.logs)) {
|
|
358
|
+
const logs = anyErr.logs
|
|
359
|
+
.filter((l) => typeof l === "string")
|
|
360
|
+
.slice(0, 20);
|
|
361
|
+
if (logs.length > 0)
|
|
362
|
+
parts.push(` logs:\n ${logs.join("\n ")}`);
|
|
363
|
+
}
|
|
364
|
+
else if (anyErr.logs === undefined) {
|
|
365
|
+
parts.push(` logs: undefined — for @solana/kit SendTransactionError, call ` +
|
|
366
|
+
`\`await err.getLogs(rpc)\` before assertion (G-2)`);
|
|
367
|
+
}
|
|
368
|
+
if (parts.length === 0)
|
|
369
|
+
parts.push(` raw: ${String(err).slice(0, 200)}`);
|
|
370
|
+
return `received:\n${parts.join("\n")}`;
|
|
371
|
+
}
|
|
372
|
+
//# sourceMappingURL=expect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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expectSystemError, parseAnchorError, SIGIL_PROGRAM_ID_BASE58, SigilAssertionError, type OneOfAnchorErrors, type OneOfSigilErrors, } from "./expect.js";
|
|
2
|
+
export { ANCHOR_FRAMEWORK_ERRORS, SIGIL_ERROR_COUNT, SIGIL_ERROR_MAX, SIGIL_ERROR_MIN, SIGIL_ERRORS, type AnchorFrameworkCodeFor, type AnchorFrameworkName, type SigilErrorCode, type SigilErrorCodeFor, type SigilErrorName, } from "./names.generated.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/errors/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @usesigil/kit/testing/errors
|
|
2
|
+
//
|
|
3
|
+
// Strict error-assertion helpers for Sigil tests.
|
|
4
|
+
//
|
|
5
|
+
// See: MEMORY/WORK/20260420-201121_test-assertion-precision-council/COUNCIL_DECISION.md
|
|
6
|
+
export { expectAnchorError, expectOneOfAnchorErrors, expectOneOfSigilErrors, expectSigilError, expectSystemError, parseAnchorError, SIGIL_PROGRAM_ID_BASE58, SigilAssertionError, } from "./expect.js";
|
|
7
|
+
export { ANCHOR_FRAMEWORK_ERRORS, SIGIL_ERROR_COUNT, SIGIL_ERROR_MAX, SIGIL_ERROR_MIN, SIGIL_ERRORS, } from "./names.generated.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/errors/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,wFAAwF;AAExF,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,GAMb,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Regenerate with: `pnpm --filter @usesigil/kit run gen:error-types`
|
|
5
|
+
* Source of truth: target/idl/sigil.json (errors[])
|
|
6
|
+
* Verified in CI by: scripts/verify-error-drift.ts
|
|
7
|
+
*
|
|
8
|
+
* This file is the compile-time coupling between:
|
|
9
|
+
* - Rust `#[error_code]` enum in programs/sigil/src/errors.rs
|
|
10
|
+
* - Anchor-generated IDL in target/idl/sigil.json
|
|
11
|
+
* - TypeScript assertion helpers in ./expect.ts
|
|
12
|
+
*
|
|
13
|
+
* If any of the three drift, CI fails.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SIGIL_ERRORS: {
|
|
16
|
+
readonly VaultNotActive: 6000;
|
|
17
|
+
readonly UnauthorizedAgent: 6001;
|
|
18
|
+
readonly UnauthorizedOwner: 6002;
|
|
19
|
+
readonly UnsupportedToken: 6003;
|
|
20
|
+
readonly ProtocolNotAllowed: 6004;
|
|
21
|
+
readonly TransactionTooLarge: 6005;
|
|
22
|
+
readonly SpendingCapExceeded: 6006;
|
|
23
|
+
readonly SessionNotAuthorized: 6007;
|
|
24
|
+
readonly InvalidSession: 6008;
|
|
25
|
+
readonly TooManyAllowedProtocols: 6009;
|
|
26
|
+
readonly AgentAlreadyRegistered: 6010;
|
|
27
|
+
readonly NoAgentRegistered: 6011;
|
|
28
|
+
readonly VaultNotFrozen: 6012;
|
|
29
|
+
readonly VaultAlreadyClosed: 6013;
|
|
30
|
+
readonly InsufficientBalance: 6014;
|
|
31
|
+
readonly DeveloperFeeTooHigh: 6015;
|
|
32
|
+
readonly InvalidFeeDestination: 6016;
|
|
33
|
+
readonly InvalidProtocolTreasury: 6017;
|
|
34
|
+
readonly InvalidAgentKey: 6018;
|
|
35
|
+
readonly AgentIsOwner: 6019;
|
|
36
|
+
readonly Overflow: 6020;
|
|
37
|
+
readonly InvalidTokenAccount: 6021;
|
|
38
|
+
readonly TimelockNotExpired: 6022;
|
|
39
|
+
readonly NoTimelockConfigured: 6023;
|
|
40
|
+
readonly DestinationNotAllowed: 6024;
|
|
41
|
+
readonly TooManyDestinations: 6025;
|
|
42
|
+
readonly InvalidProtocolMode: 6026;
|
|
43
|
+
readonly CpiCallNotAllowed: 6027;
|
|
44
|
+
readonly MissingFinalizeInstruction: 6028;
|
|
45
|
+
readonly NonTrackedSwapMustReturnStablecoin: 6029;
|
|
46
|
+
readonly SwapSlippageExceeded: 6030;
|
|
47
|
+
readonly InvalidJupiterInstruction: 6031;
|
|
48
|
+
readonly UnauthorizedTokenTransfer: 6032;
|
|
49
|
+
readonly SlippageBpsTooHigh: 6033;
|
|
50
|
+
readonly ProtocolMismatch: 6034;
|
|
51
|
+
readonly TooManyDeFiInstructions: 6035;
|
|
52
|
+
readonly MaxAgentsReached: 6036;
|
|
53
|
+
readonly InsufficientPermissions: 6037;
|
|
54
|
+
readonly InvalidPermissions: 6038;
|
|
55
|
+
readonly EscrowNotActive: 6039;
|
|
56
|
+
readonly EscrowExpired: 6040;
|
|
57
|
+
readonly EscrowNotExpired: 6041;
|
|
58
|
+
readonly InvalidEscrowVault: 6042;
|
|
59
|
+
readonly EscrowConditionsNotMet: 6043;
|
|
60
|
+
readonly EscrowDurationExceeded: 6044;
|
|
61
|
+
readonly InvalidConstraintConfig: 6045;
|
|
62
|
+
readonly ConstraintViolated: 6046;
|
|
63
|
+
readonly InvalidConstraintsPda: 6047;
|
|
64
|
+
readonly InvalidPendingConstraintsPda: 6048;
|
|
65
|
+
readonly AgentSpendLimitExceeded: 6049;
|
|
66
|
+
readonly OverlaySlotExhausted: 6050;
|
|
67
|
+
readonly AgentSlotNotFound: 6051;
|
|
68
|
+
readonly UnauthorizedTokenApproval: 6052;
|
|
69
|
+
readonly InvalidSessionExpiry: 6053;
|
|
70
|
+
readonly UnconstrainedProgramBlocked: 6054;
|
|
71
|
+
readonly ProtocolCapExceeded: 6055;
|
|
72
|
+
readonly ProtocolCapsMismatch: 6056;
|
|
73
|
+
readonly ActiveEscrowsExist: 6057;
|
|
74
|
+
readonly ConstraintsNotClosed: 6058;
|
|
75
|
+
readonly PendingPolicyExists: 6059;
|
|
76
|
+
readonly AgentPaused: 6060;
|
|
77
|
+
readonly AgentAlreadyPaused: 6061;
|
|
78
|
+
readonly AgentNotPaused: 6062;
|
|
79
|
+
readonly UnauthorizedPostFinalizeInstruction: 6063;
|
|
80
|
+
readonly UnexpectedBalanceDecrease: 6064;
|
|
81
|
+
readonly TimelockTooShort: 6065;
|
|
82
|
+
readonly PolicyVersionMismatch: 6066;
|
|
83
|
+
readonly ActiveSessionsExist: 6067;
|
|
84
|
+
readonly PostAssertionFailed: 6068;
|
|
85
|
+
readonly InvalidPostAssertionIndex: 6069;
|
|
86
|
+
readonly UnauthorizedPreValidateInstruction: 6070;
|
|
87
|
+
readonly SnapshotNotCaptured: 6071;
|
|
88
|
+
readonly InvalidConstraintOperator: 6072;
|
|
89
|
+
readonly ConstraintsVaultMismatch: 6073;
|
|
90
|
+
readonly BlockedSplOpcode: 6074;
|
|
91
|
+
readonly QueuedUpdateExpired: 6075;
|
|
92
|
+
readonly AccountWritabilityMismatch: 6076;
|
|
93
|
+
readonly SysvarScanBoundExceeded: 6077;
|
|
94
|
+
readonly AsyncFulfillmentNotPermitted: 6078;
|
|
95
|
+
readonly ConstraintsAlreadyPopulated: 6079;
|
|
96
|
+
readonly OrphanPdaWrongOwner: 6080;
|
|
97
|
+
readonly OrphanPdaPopulated: 6081;
|
|
98
|
+
readonly ConfidentialTransferBlocked: 6082;
|
|
99
|
+
readonly PermanentDelegateBlocked: 6083;
|
|
100
|
+
readonly TransferHookBlocked: 6084;
|
|
101
|
+
readonly LamportDrainBlocked: 6085;
|
|
102
|
+
readonly BatchInstructionBlocked: 6086;
|
|
103
|
+
readonly InvalidDestinationMode: 6087;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Union of valid Sigil error names.
|
|
107
|
+
*
|
|
108
|
+
* A typo on the author's side (`expectSigilError(err, { name: 'UnuthorizedAgent' })`)
|
|
109
|
+
* fails tsc. This is the compile-time safety net.
|
|
110
|
+
*/
|
|
111
|
+
export type SigilErrorName = keyof typeof SIGIL_ERRORS;
|
|
112
|
+
/**
|
|
113
|
+
* Union of valid Sigil error codes.
|
|
114
|
+
*/
|
|
115
|
+
export type SigilErrorCode = (typeof SIGIL_ERRORS)[SigilErrorName];
|
|
116
|
+
/**
|
|
117
|
+
* Conditional type: given a name, produce its code.
|
|
118
|
+
* Used to couple `{name, code}` at the type level.
|
|
119
|
+
*/
|
|
120
|
+
export type SigilErrorCodeFor<N extends SigilErrorName> = (typeof SIGIL_ERRORS)[N];
|
|
121
|
+
export declare const ANCHOR_FRAMEWORK_ERRORS: {
|
|
122
|
+
readonly InstructionMissing: 100;
|
|
123
|
+
readonly InstructionFallbackNotFound: 101;
|
|
124
|
+
readonly InstructionDidNotDeserialize: 102;
|
|
125
|
+
readonly InstructionDidNotSerialize: 103;
|
|
126
|
+
readonly IdlInstructionStub: 1000;
|
|
127
|
+
readonly IdlInstructionInvalidProgram: 1001;
|
|
128
|
+
readonly IdlAccountNotEmpty: 1002;
|
|
129
|
+
readonly ConstraintMut: 2000;
|
|
130
|
+
readonly ConstraintHasOne: 2001;
|
|
131
|
+
readonly ConstraintSigner: 2002;
|
|
132
|
+
readonly ConstraintRaw: 2003;
|
|
133
|
+
readonly ConstraintOwner: 2004;
|
|
134
|
+
readonly ConstraintRentExempt: 2005;
|
|
135
|
+
readonly ConstraintSeeds: 2006;
|
|
136
|
+
readonly ConstraintExecutable: 2007;
|
|
137
|
+
readonly ConstraintState: 2008;
|
|
138
|
+
readonly ConstraintAssociated: 2009;
|
|
139
|
+
readonly ConstraintAssociatedInit: 2010;
|
|
140
|
+
readonly ConstraintClose: 2011;
|
|
141
|
+
readonly ConstraintAddress: 2012;
|
|
142
|
+
readonly ConstraintZero: 2013;
|
|
143
|
+
readonly ConstraintTokenMint: 2014;
|
|
144
|
+
readonly ConstraintTokenOwner: 2015;
|
|
145
|
+
readonly ConstraintMintMintAuthority: 2016;
|
|
146
|
+
readonly ConstraintMintFreezeAuthority: 2017;
|
|
147
|
+
readonly ConstraintMintDecimals: 2018;
|
|
148
|
+
readonly ConstraintSpace: 2019;
|
|
149
|
+
readonly ConstraintAccountIsNone: 2020;
|
|
150
|
+
readonly ConstraintTokenTokenProgram: 2021;
|
|
151
|
+
readonly ConstraintMintTokenProgram: 2022;
|
|
152
|
+
readonly ConstraintAssociatedTokenTokenProgram: 2023;
|
|
153
|
+
readonly AccountDiscriminatorAlreadySet: 3000;
|
|
154
|
+
readonly AccountDiscriminatorNotFound: 3001;
|
|
155
|
+
readonly AccountDiscriminatorMismatch: 3002;
|
|
156
|
+
readonly AccountDidNotDeserialize: 3003;
|
|
157
|
+
readonly AccountDidNotSerialize: 3004;
|
|
158
|
+
readonly AccountNotEnoughKeys: 3005;
|
|
159
|
+
readonly AccountNotMutable: 3006;
|
|
160
|
+
readonly AccountOwnedByWrongProgram: 3007;
|
|
161
|
+
readonly InvalidProgramId: 3008;
|
|
162
|
+
readonly InvalidProgramExecutable: 3009;
|
|
163
|
+
readonly AccountNotSigner: 3010;
|
|
164
|
+
readonly AccountNotSystemOwned: 3011;
|
|
165
|
+
readonly AccountNotInitialized: 3012;
|
|
166
|
+
readonly AccountNotProgramData: 3013;
|
|
167
|
+
readonly AccountNotAssociatedTokenAccount: 3014;
|
|
168
|
+
readonly AccountSysvarMismatch: 3015;
|
|
169
|
+
readonly AccountReallocExceedsLimit: 3016;
|
|
170
|
+
readonly AccountDuplicateReallocs: 3017;
|
|
171
|
+
readonly StateInvalidAddress: 4000;
|
|
172
|
+
readonly DeclaredProgramIdMismatch: 4100;
|
|
173
|
+
readonly TryingToInitPayerAsProgramAccount: 4101;
|
|
174
|
+
readonly InvalidNumericConversion: 4102;
|
|
175
|
+
readonly Deprecated: 5000;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Union of Anchor framework error names (the commonly-asserted subset).
|
|
179
|
+
*/
|
|
180
|
+
export type AnchorFrameworkName = keyof typeof ANCHOR_FRAMEWORK_ERRORS;
|
|
181
|
+
export type AnchorFrameworkCodeFor<N extends AnchorFrameworkName> = (typeof ANCHOR_FRAMEWORK_ERRORS)[N];
|
|
182
|
+
/** Total number of Sigil error codes. */
|
|
183
|
+
export declare const SIGIL_ERROR_COUNT: number;
|
|
184
|
+
/** First (inclusive) Sigil error code. */
|
|
185
|
+
export declare const SIGIL_ERROR_MIN: number;
|
|
186
|
+
/** Last (inclusive) Sigil error code currently defined. */
|
|
187
|
+
export declare const SIGIL_ERROR_MAX: number;
|
|
188
|
+
//# sourceMappingURL=names.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.generated.d.ts","sourceRoot":"","sources":["../../../src/testing/errors/names.generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFf,CAAC;AAEX;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,YAAY,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,cAAc,CAAC,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,IACpD,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;AAO3B,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmE1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAEvE,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,mBAAmB,IAC9D,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;AAMtC,yCAAyC;AACzC,eAAO,MAAM,iBAAiB,EAAE,MAAyC,CAAC;AAE1E,0CAA0C;AAC1C,eAAO,MAAM,eAAe,EAAE,MAAa,CAAC;AAE5C,2DAA2D;AAC3D,eAAO,MAAM,eAAe,EAAE,MAAiD,CAAC"}
|