@usesigil/kit 0.13.0 → 0.15.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/advanced-analytics.d.ts +3 -1
- package/dist/advanced-analytics.d.ts.map +1 -1
- package/dist/advanced-analytics.js +4 -6
- package/dist/advanced-analytics.js.map +1 -1
- package/dist/agent-errors.d.ts +3 -3
- package/dist/agent-errors.d.ts.map +1 -1
- package/dist/agent-errors.js +79 -140
- package/dist/agent-errors.js.map +1 -1
- package/dist/create-vault.d.ts +0 -1
- package/dist/create-vault.d.ts.map +1 -1
- package/dist/create-vault.js +0 -1
- package/dist/create-vault.js.map +1 -1
- package/dist/dashboard/from-json.d.ts.map +1 -1
- package/dist/dashboard/from-json.js +0 -3
- package/dist/dashboard/from-json.js.map +1 -1
- package/dist/dashboard/index.d.ts +2 -7
- package/dist/dashboard/index.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -9
- package/dist/dashboard/index.js.map +1 -1
- package/dist/dashboard/mutations.d.ts +0 -2
- package/dist/dashboard/mutations.d.ts.map +1 -1
- package/dist/dashboard/mutations.js +2 -12
- package/dist/dashboard/mutations.js.map +1 -1
- package/dist/dashboard/reads.d.ts.map +1 -1
- package/dist/dashboard/reads.js +6 -31
- package/dist/dashboard/reads.js.map +1 -1
- package/dist/dashboard/types.d.ts +2 -10
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/event-analytics.d.ts +1 -3
- package/dist/event-analytics.d.ts.map +1 -1
- package/dist/event-analytics.js +4 -9
- package/dist/event-analytics.js.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +1 -2
- package/dist/events.js.map +1 -1
- package/dist/generated/accounts/agentVault.d.ts +0 -20
- package/dist/generated/accounts/agentVault.d.ts.map +1 -1
- package/dist/generated/accounts/agentVault.js +0 -2
- package/dist/generated/accounts/agentVault.js.map +1 -1
- package/dist/generated/accounts/pendingPolicyUpdate.d.ts +0 -4
- package/dist/generated/accounts/pendingPolicyUpdate.d.ts.map +1 -1
- package/dist/generated/accounts/pendingPolicyUpdate.js +0 -4
- package/dist/generated/accounts/pendingPolicyUpdate.js.map +1 -1
- package/dist/generated/accounts/policyConfig.d.ts +0 -8
- package/dist/generated/accounts/policyConfig.d.ts.map +1 -1
- package/dist/generated/accounts/policyConfig.js +0 -4
- package/dist/generated/accounts/policyConfig.js.map +1 -1
- package/dist/generated/accounts/sessionAuthority.d.ts +0 -4
- package/dist/generated/accounts/sessionAuthority.d.ts.map +1 -1
- package/dist/generated/accounts/sessionAuthority.js +1 -3
- package/dist/generated/accounts/sessionAuthority.js.map +1 -1
- package/dist/generated/errors/sigil.d.ts +74 -82
- package/dist/generated/errors/sigil.d.ts.map +1 -1
- package/dist/generated/errors/sigil.js +73 -85
- 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 +1 -2
- package/dist/generated/event-discriminators.js.map +1 -1
- package/dist/generated/instructions/index.d.ts +0 -1
- package/dist/generated/instructions/index.d.ts.map +1 -1
- package/dist/generated/instructions/index.js +0 -1
- 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 +0 -8
- package/dist/generated/instructions/queuePolicyUpdate.d.ts.map +1 -1
- package/dist/generated/instructions/queuePolicyUpdate.js +0 -4
- package/dist/generated/instructions/queuePolicyUpdate.js.map +1 -1
- package/dist/generated/programs/sigil.d.ts +4 -8
- package/dist/generated/programs/sigil.d.ts.map +1 -1
- package/dist/generated/programs/sigil.js +4 -16
- package/dist/generated/programs/sigil.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 +0 -2
- package/dist/generated/types/constraintEntry.js.map +1 -1
- package/dist/generated/types/constraintEntryZC.d.ts +9 -19
- package/dist/generated/types/constraintEntryZC.d.ts.map +1 -1
- package/dist/generated/types/constraintEntryZC.js +2 -4
- package/dist/generated/types/constraintEntryZC.js.map +1 -1
- package/dist/generated/types/index.d.ts +0 -1
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +0 -1
- package/dist/generated/types/index.js.map +1 -1
- package/dist/generated/types/sessionFinalized.d.ts +0 -4
- package/dist/generated/types/sessionFinalized.d.ts.map +1 -1
- package/dist/generated/types/sessionFinalized.js +1 -3
- package/dist/generated/types/sessionFinalized.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -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/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/seal.d.ts.map +1 -1
- package/dist/seal.js +4 -10
- 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 +146 -78
- 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/mock-state.d.ts +0 -2
- package/dist/testing/mock-state.d.ts.map +1 -1
- package/dist/testing/mock-state.js +0 -3
- package/dist/testing/mock-state.js.map +1 -1
- package/dist/types.d.ts +1 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -9
- package/dist/types.js.map +1 -1
- package/dist/vault-analytics.d.ts +0 -1
- package/dist/vault-analytics.d.ts.map +1 -1
- package/dist/vault-analytics.js +0 -1
- package/dist/vault-analytics.js.map +1 -1
- package/package.json +1 -1
- package/dist/generated/instructions/syncPositions.d.ts +0 -44
- package/dist/generated/instructions/syncPositions.d.ts.map +0 -1
- package/dist/generated/instructions/syncPositions.js +0 -72
- package/dist/generated/instructions/syncPositions.js.map +0 -1
- package/dist/generated/types/positionsSynced.d.ts +0 -24
- package/dist/generated/types/positionsSynced.d.ts.map +0 -1
- package/dist/generated/types/positionsSynced.js +0 -28
- package/dist/generated/types/positionsSynced.js.map +0 -1
package/dist/agent-errors.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Every error includes a category, retryability flag, and
|
|
6
6
|
* recovery actions that tell the agent exactly what to do next.
|
|
7
7
|
*
|
|
8
|
-
* Maps all
|
|
8
|
+
* Maps all 81 on-chain error codes (6000-6080) plus 34 SDK
|
|
9
9
|
* error codes (7000-7033) to AgentError with machine-readable metadata.
|
|
10
10
|
*
|
|
11
11
|
* Zero dependency on @solana/web3.js or @coral-xyz/anchor.
|
|
@@ -147,32 +147,6 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
147
147
|
],
|
|
148
148
|
},
|
|
149
149
|
6008: {
|
|
150
|
-
name: "TooManyPositions",
|
|
151
|
-
message: "Maximum concurrent open positions reached",
|
|
152
|
-
category: "RESOURCE_NOT_FOUND",
|
|
153
|
-
retryable: false,
|
|
154
|
-
recovery_actions: [
|
|
155
|
-
{
|
|
156
|
-
action: "close_position",
|
|
157
|
-
description: "Close an existing position before opening a new one",
|
|
158
|
-
tool: "sigil_close_position",
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
6009: {
|
|
163
|
-
name: "PositionOpeningDisallowed",
|
|
164
|
-
message: "Vault policy does not allow opening new positions",
|
|
165
|
-
category: "POLICY_VIOLATION",
|
|
166
|
-
retryable: false,
|
|
167
|
-
recovery_actions: [
|
|
168
|
-
{
|
|
169
|
-
action: "check_policy",
|
|
170
|
-
description: "Verify canOpenPositions is enabled in vault policy",
|
|
171
|
-
tool: "sigil_check_vault",
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
},
|
|
175
|
-
6010: {
|
|
176
150
|
name: "SessionNotAuthorized",
|
|
177
151
|
message: "Session authority not authorized for this action",
|
|
178
152
|
category: "PERMISSION",
|
|
@@ -184,7 +158,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
184
158
|
},
|
|
185
159
|
],
|
|
186
160
|
},
|
|
187
|
-
|
|
161
|
+
6009: {
|
|
188
162
|
name: "InvalidSession",
|
|
189
163
|
message: "Session does not belong to this vault or is invalid",
|
|
190
164
|
category: "PERMISSION",
|
|
@@ -196,20 +170,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
196
170
|
},
|
|
197
171
|
],
|
|
198
172
|
},
|
|
199
|
-
|
|
200
|
-
name: "OpenPositionsExist",
|
|
201
|
-
message: "Vault has open positions and cannot be closed",
|
|
202
|
-
category: "RESOURCE_NOT_FOUND",
|
|
203
|
-
retryable: false,
|
|
204
|
-
recovery_actions: [
|
|
205
|
-
{
|
|
206
|
-
action: "close_positions",
|
|
207
|
-
description: "Close all open positions before closing the vault",
|
|
208
|
-
tool: "sigil_close_position",
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
},
|
|
212
|
-
6013: {
|
|
173
|
+
6010: {
|
|
213
174
|
name: "TooManyAllowedProtocols",
|
|
214
175
|
message: "Policy configuration has too many allowed protocols (max 10)",
|
|
215
176
|
category: "INPUT_VALIDATION",
|
|
@@ -221,7 +182,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
221
182
|
},
|
|
222
183
|
],
|
|
223
184
|
},
|
|
224
|
-
|
|
185
|
+
6011: {
|
|
225
186
|
name: "AgentAlreadyRegistered",
|
|
226
187
|
message: "Agent is already registered on this vault",
|
|
227
188
|
category: "INPUT_VALIDATION",
|
|
@@ -234,7 +195,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
234
195
|
},
|
|
235
196
|
],
|
|
236
197
|
},
|
|
237
|
-
|
|
198
|
+
6012: {
|
|
238
199
|
name: "NoAgentRegistered",
|
|
239
200
|
message: "No agent registered on this vault",
|
|
240
201
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -247,7 +208,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
247
208
|
},
|
|
248
209
|
],
|
|
249
210
|
},
|
|
250
|
-
|
|
211
|
+
6013: {
|
|
251
212
|
name: "VaultNotFrozen",
|
|
252
213
|
message: "Vault is not frozen (expected frozen for reactivation)",
|
|
253
214
|
category: "INPUT_VALIDATION",
|
|
@@ -260,7 +221,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
260
221
|
},
|
|
261
222
|
],
|
|
262
223
|
},
|
|
263
|
-
|
|
224
|
+
6014: {
|
|
264
225
|
name: "VaultAlreadyClosed",
|
|
265
226
|
message: "Vault is permanently closed",
|
|
266
227
|
category: "INPUT_VALIDATION",
|
|
@@ -273,7 +234,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
273
234
|
},
|
|
274
235
|
],
|
|
275
236
|
},
|
|
276
|
-
|
|
237
|
+
6015: {
|
|
277
238
|
name: "InsufficientBalance",
|
|
278
239
|
message: "Insufficient vault balance for this operation",
|
|
279
240
|
category: "SPENDING_CAP",
|
|
@@ -294,7 +255,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
294
255
|
},
|
|
295
256
|
],
|
|
296
257
|
},
|
|
297
|
-
|
|
258
|
+
6016: {
|
|
298
259
|
name: "DeveloperFeeTooHigh",
|
|
299
260
|
message: "Developer fee rate exceeds maximum (500 / 1,000,000 = 5 BPS)",
|
|
300
261
|
category: "INPUT_VALIDATION",
|
|
@@ -306,7 +267,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
306
267
|
},
|
|
307
268
|
],
|
|
308
269
|
},
|
|
309
|
-
|
|
270
|
+
6017: {
|
|
310
271
|
name: "InvalidFeeDestination",
|
|
311
272
|
message: "Fee destination account is invalid",
|
|
312
273
|
category: "INPUT_VALIDATION",
|
|
@@ -318,7 +279,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
318
279
|
},
|
|
319
280
|
],
|
|
320
281
|
},
|
|
321
|
-
|
|
282
|
+
6018: {
|
|
322
283
|
name: "InvalidProtocolTreasury",
|
|
323
284
|
message: "Protocol treasury account does not match expected address",
|
|
324
285
|
category: "INPUT_VALIDATION",
|
|
@@ -330,7 +291,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
330
291
|
},
|
|
331
292
|
],
|
|
332
293
|
},
|
|
333
|
-
|
|
294
|
+
6019: {
|
|
334
295
|
name: "InvalidAgentKey",
|
|
335
296
|
message: "Agent cannot be the zero address",
|
|
336
297
|
category: "INPUT_VALIDATION",
|
|
@@ -342,7 +303,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
342
303
|
},
|
|
343
304
|
],
|
|
344
305
|
},
|
|
345
|
-
|
|
306
|
+
6020: {
|
|
346
307
|
name: "AgentIsOwner",
|
|
347
308
|
message: "Agent cannot be the vault owner",
|
|
348
309
|
category: "INPUT_VALIDATION",
|
|
@@ -354,7 +315,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
354
315
|
},
|
|
355
316
|
],
|
|
356
317
|
},
|
|
357
|
-
|
|
318
|
+
6021: {
|
|
358
319
|
name: "Overflow",
|
|
359
320
|
message: "Arithmetic overflow in on-chain computation",
|
|
360
321
|
category: "FATAL",
|
|
@@ -366,7 +327,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
366
327
|
},
|
|
367
328
|
],
|
|
368
329
|
},
|
|
369
|
-
|
|
330
|
+
6022: {
|
|
370
331
|
name: "InvalidTokenAccount",
|
|
371
332
|
message: "Token account does not belong to vault or has wrong mint",
|
|
372
333
|
category: "INPUT_VALIDATION",
|
|
@@ -379,7 +340,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
379
340
|
],
|
|
380
341
|
},
|
|
381
342
|
// --- Timelock + Destination errors ---
|
|
382
|
-
|
|
343
|
+
6023: {
|
|
383
344
|
name: "TimelockNotExpired",
|
|
384
345
|
message: "Timelock period has not expired yet",
|
|
385
346
|
category: "POLICY_VIOLATION",
|
|
@@ -392,7 +353,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
392
353
|
},
|
|
393
354
|
],
|
|
394
355
|
},
|
|
395
|
-
|
|
356
|
+
6024: {
|
|
396
357
|
name: "NoTimelockConfigured",
|
|
397
358
|
message: "No timelock configured on this vault",
|
|
398
359
|
category: "INPUT_VALIDATION",
|
|
@@ -404,7 +365,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
404
365
|
},
|
|
405
366
|
],
|
|
406
367
|
},
|
|
407
|
-
|
|
368
|
+
6025: {
|
|
408
369
|
name: "DestinationNotAllowed",
|
|
409
370
|
message: "Destination address not in vault's allowed destinations list",
|
|
410
371
|
category: "POLICY_VIOLATION",
|
|
@@ -421,7 +382,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
421
382
|
},
|
|
422
383
|
],
|
|
423
384
|
},
|
|
424
|
-
|
|
385
|
+
6026: {
|
|
425
386
|
name: "TooManyDestinations",
|
|
426
387
|
message: "Too many destinations in allowlist (max 10)",
|
|
427
388
|
category: "INPUT_VALIDATION",
|
|
@@ -433,7 +394,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
433
394
|
},
|
|
434
395
|
],
|
|
435
396
|
},
|
|
436
|
-
|
|
397
|
+
6027: {
|
|
437
398
|
name: "InvalidProtocolMode",
|
|
438
399
|
message: "Invalid protocol mode (must be 0=all, 1=allowlist, or 2=denylist)",
|
|
439
400
|
category: "INPUT_VALIDATION",
|
|
@@ -446,7 +407,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
446
407
|
],
|
|
447
408
|
},
|
|
448
409
|
// --- Flash Trade expansion errors ---
|
|
449
|
-
|
|
410
|
+
6028: {
|
|
450
411
|
name: "InvalidNonSpendingAmount",
|
|
451
412
|
message: "Non-spending action must have amount = 0",
|
|
452
413
|
category: "INPUT_VALIDATION",
|
|
@@ -458,20 +419,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
458
419
|
},
|
|
459
420
|
],
|
|
460
421
|
},
|
|
461
|
-
|
|
462
|
-
name: "NoPositionsToClose",
|
|
463
|
-
message: "No open positions to close or cancel",
|
|
464
|
-
category: "RESOURCE_NOT_FOUND",
|
|
465
|
-
retryable: false,
|
|
466
|
-
recovery_actions: [
|
|
467
|
-
{
|
|
468
|
-
action: "check_positions",
|
|
469
|
-
description: "Verify you have open positions before closing",
|
|
470
|
-
tool: "sigil_check_vault",
|
|
471
|
-
},
|
|
472
|
-
],
|
|
473
|
-
},
|
|
474
|
-
6033: {
|
|
422
|
+
6029: {
|
|
475
423
|
name: "CpiCallNotAllowed",
|
|
476
424
|
message: "Instruction must be top-level (CPI calls not allowed for validate/finalize)",
|
|
477
425
|
category: "FATAL",
|
|
@@ -483,7 +431,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
483
431
|
},
|
|
484
432
|
],
|
|
485
433
|
},
|
|
486
|
-
|
|
434
|
+
6030: {
|
|
487
435
|
name: "MissingFinalizeInstruction",
|
|
488
436
|
message: "Transaction must include finalize_session after validate_and_authorize",
|
|
489
437
|
category: "INPUT_VALIDATION",
|
|
@@ -496,7 +444,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
496
444
|
],
|
|
497
445
|
},
|
|
498
446
|
// --- Stablecoin-only enforcement errors ---
|
|
499
|
-
|
|
447
|
+
6031: {
|
|
500
448
|
name: "NonTrackedSwapMustReturnStablecoin",
|
|
501
449
|
message: "Non-stablecoin swap must return stablecoin (vault stablecoin balance did not increase)",
|
|
502
450
|
category: "INPUT_VALIDATION",
|
|
@@ -508,7 +456,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
508
456
|
},
|
|
509
457
|
],
|
|
510
458
|
},
|
|
511
|
-
|
|
459
|
+
6032: {
|
|
512
460
|
name: "SwapSlippageExceeded",
|
|
513
461
|
message: "Swap slippage exceeds policy max_slippage_bps or quoted output is zero",
|
|
514
462
|
category: "POLICY_VIOLATION",
|
|
@@ -525,7 +473,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
525
473
|
},
|
|
526
474
|
],
|
|
527
475
|
},
|
|
528
|
-
|
|
476
|
+
6033: {
|
|
529
477
|
name: "InvalidJupiterInstruction",
|
|
530
478
|
message: "Cannot parse Jupiter swap instruction data",
|
|
531
479
|
category: "INPUT_VALIDATION",
|
|
@@ -537,7 +485,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
537
485
|
},
|
|
538
486
|
],
|
|
539
487
|
},
|
|
540
|
-
|
|
488
|
+
6034: {
|
|
541
489
|
name: "UnauthorizedTokenTransfer",
|
|
542
490
|
message: "Top-level SPL Token transfer not allowed between validate and finalize",
|
|
543
491
|
category: "POLICY_VIOLATION",
|
|
@@ -549,7 +497,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
549
497
|
},
|
|
550
498
|
],
|
|
551
499
|
},
|
|
552
|
-
|
|
500
|
+
6035: {
|
|
553
501
|
name: "SlippageBpsTooHigh",
|
|
554
502
|
message: "Slippage BPS exceeds maximum allowed (5000 = 50%)",
|
|
555
503
|
category: "INPUT_VALIDATION",
|
|
@@ -561,7 +509,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
561
509
|
},
|
|
562
510
|
],
|
|
563
511
|
},
|
|
564
|
-
|
|
512
|
+
6036: {
|
|
565
513
|
name: "ProtocolMismatch",
|
|
566
514
|
message: "DeFi instruction program does not match the declared target_protocol",
|
|
567
515
|
category: "INPUT_VALIDATION",
|
|
@@ -573,7 +521,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
573
521
|
},
|
|
574
522
|
],
|
|
575
523
|
},
|
|
576
|
-
|
|
524
|
+
6037: {
|
|
577
525
|
name: "TooManyDeFiInstructions",
|
|
578
526
|
message: "Non-stablecoin swap allows exactly one DeFi instruction",
|
|
579
527
|
category: "INPUT_VALIDATION",
|
|
@@ -586,7 +534,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
586
534
|
],
|
|
587
535
|
},
|
|
588
536
|
// --- Multi-Agent errors ---
|
|
589
|
-
|
|
537
|
+
6038: {
|
|
590
538
|
name: "MaxAgentsReached",
|
|
591
539
|
message: "Maximum agents per vault reached (limit: 10)",
|
|
592
540
|
category: "INPUT_VALIDATION",
|
|
@@ -599,7 +547,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
599
547
|
},
|
|
600
548
|
],
|
|
601
549
|
},
|
|
602
|
-
|
|
550
|
+
6039: {
|
|
603
551
|
name: "InsufficientPermissions",
|
|
604
552
|
message: "Agent lacks permission for this action type",
|
|
605
553
|
category: "PERMISSION",
|
|
@@ -616,7 +564,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
616
564
|
},
|
|
617
565
|
],
|
|
618
566
|
},
|
|
619
|
-
|
|
567
|
+
6040: {
|
|
620
568
|
name: "InvalidPermissions",
|
|
621
569
|
message: "Capability exceeds the on-chain maximum (valid values: 0 = Disabled, 1 = Observer, 2 = Operator)",
|
|
622
570
|
category: "INPUT_VALIDATION",
|
|
@@ -629,7 +577,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
629
577
|
],
|
|
630
578
|
},
|
|
631
579
|
// --- Escrow errors ---
|
|
632
|
-
|
|
580
|
+
6041: {
|
|
633
581
|
name: "EscrowNotActive",
|
|
634
582
|
message: "Escrow is not in Active status",
|
|
635
583
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -641,7 +589,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
641
589
|
},
|
|
642
590
|
],
|
|
643
591
|
},
|
|
644
|
-
|
|
592
|
+
6042: {
|
|
645
593
|
name: "EscrowExpired",
|
|
646
594
|
message: "Escrow has expired — can only be refunded now",
|
|
647
595
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -654,7 +602,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
654
602
|
},
|
|
655
603
|
],
|
|
656
604
|
},
|
|
657
|
-
|
|
605
|
+
6043: {
|
|
658
606
|
name: "EscrowNotExpired",
|
|
659
607
|
message: "Escrow has not expired yet — cannot refund before expiry",
|
|
660
608
|
category: "INPUT_VALIDATION",
|
|
@@ -671,7 +619,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
671
619
|
},
|
|
672
620
|
],
|
|
673
621
|
},
|
|
674
|
-
|
|
622
|
+
6044: {
|
|
675
623
|
name: "InvalidEscrowVault",
|
|
676
624
|
message: "Invalid escrow vault — source or destination vault mismatch",
|
|
677
625
|
category: "INPUT_VALIDATION",
|
|
@@ -683,7 +631,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
683
631
|
},
|
|
684
632
|
],
|
|
685
633
|
},
|
|
686
|
-
|
|
634
|
+
6045: {
|
|
687
635
|
name: "EscrowConditionsNotMet",
|
|
688
636
|
message: "Escrow settlement conditions not met (SHA-256 proof invalid)",
|
|
689
637
|
category: "INPUT_VALIDATION",
|
|
@@ -695,7 +643,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
695
643
|
},
|
|
696
644
|
],
|
|
697
645
|
},
|
|
698
|
-
|
|
646
|
+
6046: {
|
|
699
647
|
name: "EscrowDurationExceeded",
|
|
700
648
|
message: "Escrow duration exceeds maximum (30 days)",
|
|
701
649
|
category: "INPUT_VALIDATION",
|
|
@@ -708,7 +656,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
708
656
|
],
|
|
709
657
|
},
|
|
710
658
|
// --- Instruction constraints errors ---
|
|
711
|
-
|
|
659
|
+
6047: {
|
|
712
660
|
name: "InvalidConstraintConfig",
|
|
713
661
|
message: "Invalid constraint configuration: bounds exceeded",
|
|
714
662
|
category: "INPUT_VALIDATION",
|
|
@@ -720,7 +668,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
720
668
|
},
|
|
721
669
|
],
|
|
722
670
|
},
|
|
723
|
-
|
|
671
|
+
6048: {
|
|
724
672
|
name: "ConstraintViolated",
|
|
725
673
|
message: "Instruction violated a configured constraint",
|
|
726
674
|
category: "POLICY_VIOLATION",
|
|
@@ -737,7 +685,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
737
685
|
},
|
|
738
686
|
],
|
|
739
687
|
},
|
|
740
|
-
|
|
688
|
+
6049: {
|
|
741
689
|
name: "InvalidConstraintsPda",
|
|
742
690
|
message: "Invalid constraints PDA: wrong owner or vault",
|
|
743
691
|
category: "INPUT_VALIDATION",
|
|
@@ -749,7 +697,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
749
697
|
},
|
|
750
698
|
],
|
|
751
699
|
},
|
|
752
|
-
|
|
700
|
+
6050: {
|
|
753
701
|
name: "InvalidPendingConstraintsPda",
|
|
754
702
|
message: "Invalid pending constraints PDA: wrong owner or vault",
|
|
755
703
|
category: "INPUT_VALIDATION",
|
|
@@ -762,7 +710,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
762
710
|
],
|
|
763
711
|
},
|
|
764
712
|
// --- Per-agent spend limit errors ---
|
|
765
|
-
|
|
713
|
+
6051: {
|
|
766
714
|
name: "AgentSpendLimitExceeded",
|
|
767
715
|
message: "Agent's rolling 24h spend exceeds their individual spending limit",
|
|
768
716
|
category: "SPENDING_CAP",
|
|
@@ -784,7 +732,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
784
732
|
},
|
|
785
733
|
],
|
|
786
734
|
},
|
|
787
|
-
|
|
735
|
+
6052: {
|
|
788
736
|
name: "OverlaySlotExhausted",
|
|
789
737
|
message: "Per-agent overlay is full — cannot register agent with spending limit",
|
|
790
738
|
category: "INPUT_VALIDATION",
|
|
@@ -797,7 +745,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
797
745
|
},
|
|
798
746
|
],
|
|
799
747
|
},
|
|
800
|
-
|
|
748
|
+
6053: {
|
|
801
749
|
name: "AgentSlotNotFound",
|
|
802
750
|
message: "Agent has per-agent spending limit but no overlay tracking slot",
|
|
803
751
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -809,7 +757,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
809
757
|
},
|
|
810
758
|
],
|
|
811
759
|
},
|
|
812
|
-
|
|
760
|
+
6054: {
|
|
813
761
|
name: "UnauthorizedTokenApproval",
|
|
814
762
|
message: "Unauthorized SPL Token Approve detected between validate and finalize",
|
|
815
763
|
category: "POLICY_VIOLATION",
|
|
@@ -821,7 +769,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
821
769
|
},
|
|
822
770
|
],
|
|
823
771
|
},
|
|
824
|
-
|
|
772
|
+
6055: {
|
|
825
773
|
name: "InvalidSessionExpiry",
|
|
826
774
|
message: "Session expiry slots out of range (10-450)",
|
|
827
775
|
category: "INPUT_VALIDATION",
|
|
@@ -833,7 +781,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
833
781
|
},
|
|
834
782
|
],
|
|
835
783
|
},
|
|
836
|
-
|
|
784
|
+
6056: {
|
|
837
785
|
name: "UnconstrainedProgramBlocked",
|
|
838
786
|
message: "Program has no constraint entry and strict mode is enabled",
|
|
839
787
|
category: "POLICY_VIOLATION",
|
|
@@ -851,7 +799,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
851
799
|
],
|
|
852
800
|
},
|
|
853
801
|
// --- Per-protocol spend cap errors ---
|
|
854
|
-
|
|
802
|
+
6057: {
|
|
855
803
|
name: "ProtocolCapExceeded",
|
|
856
804
|
message: "Per-protocol rolling 24h spending cap would be exceeded",
|
|
857
805
|
category: "SPENDING_CAP",
|
|
@@ -872,7 +820,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
872
820
|
},
|
|
873
821
|
],
|
|
874
822
|
},
|
|
875
|
-
|
|
823
|
+
6058: {
|
|
876
824
|
name: "ProtocolCapsMismatch",
|
|
877
825
|
message: "protocol_caps length must match protocols length when has_protocol_caps is true",
|
|
878
826
|
category: "INPUT_VALIDATION",
|
|
@@ -885,7 +833,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
885
833
|
],
|
|
886
834
|
},
|
|
887
835
|
// --- Vault closure guard errors ---
|
|
888
|
-
|
|
836
|
+
6059: {
|
|
889
837
|
name: "ActiveEscrowsExist",
|
|
890
838
|
message: "Active escrow deposits exist — close them before closing vault",
|
|
891
839
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -897,7 +845,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
897
845
|
},
|
|
898
846
|
],
|
|
899
847
|
},
|
|
900
|
-
|
|
848
|
+
6060: {
|
|
901
849
|
name: "ConstraintsNotClosed",
|
|
902
850
|
message: "Instruction constraints PDA still exists — close it before closing vault",
|
|
903
851
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -909,7 +857,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
909
857
|
},
|
|
910
858
|
],
|
|
911
859
|
},
|
|
912
|
-
|
|
860
|
+
6061: {
|
|
913
861
|
name: "PendingPolicyExists",
|
|
914
862
|
message: "A pending policy update exists — apply or cancel it before closing vault",
|
|
915
863
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -922,7 +870,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
922
870
|
],
|
|
923
871
|
},
|
|
924
872
|
// --- Agent pause errors ---
|
|
925
|
-
|
|
873
|
+
6062: {
|
|
926
874
|
name: "AgentPaused",
|
|
927
875
|
message: "Agent is paused — unpause before executing actions",
|
|
928
876
|
category: "PERMISSION",
|
|
@@ -934,7 +882,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
934
882
|
},
|
|
935
883
|
],
|
|
936
884
|
},
|
|
937
|
-
|
|
885
|
+
6063: {
|
|
938
886
|
name: "AgentAlreadyPaused",
|
|
939
887
|
message: "Agent is already paused",
|
|
940
888
|
category: "INPUT_VALIDATION",
|
|
@@ -946,7 +894,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
946
894
|
},
|
|
947
895
|
],
|
|
948
896
|
},
|
|
949
|
-
|
|
897
|
+
6064: {
|
|
950
898
|
name: "AgentNotPaused",
|
|
951
899
|
message: "Agent is not paused — cannot unpause",
|
|
952
900
|
category: "INPUT_VALIDATION",
|
|
@@ -958,7 +906,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
958
906
|
},
|
|
959
907
|
],
|
|
960
908
|
},
|
|
961
|
-
|
|
909
|
+
6065: {
|
|
962
910
|
name: "UnauthorizedPostFinalizeInstruction",
|
|
963
911
|
message: "Instructions after finalize_session must be ComputeBudget or SystemProgram only",
|
|
964
912
|
category: "POLICY_VIOLATION",
|
|
@@ -970,7 +918,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
970
918
|
},
|
|
971
919
|
],
|
|
972
920
|
},
|
|
973
|
-
|
|
921
|
+
6066: {
|
|
974
922
|
name: "UnexpectedBalanceDecrease",
|
|
975
923
|
message: "Vault stablecoin balance decreased more than the session authorized amount. " +
|
|
976
924
|
"This indicates a compromised DeFi program attempted to drain vault tokens via CPI.",
|
|
@@ -990,7 +938,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
990
938
|
],
|
|
991
939
|
},
|
|
992
940
|
// --- TOCTOU + timelock hardening errors ---
|
|
993
|
-
|
|
941
|
+
6067: {
|
|
994
942
|
name: "TimelockTooShort",
|
|
995
943
|
message: "Timelock duration is below the minimum (1800 seconds / 30 minutes).",
|
|
996
944
|
category: "INPUT_VALIDATION",
|
|
@@ -1002,7 +950,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1002
950
|
},
|
|
1003
951
|
],
|
|
1004
952
|
},
|
|
1005
|
-
|
|
953
|
+
6068: {
|
|
1006
954
|
name: "PolicyVersionMismatch",
|
|
1007
955
|
message: "Policy version changed since agent's last RPC read. Re-resolve vault state and retry.",
|
|
1008
956
|
category: "TRANSIENT",
|
|
@@ -1015,7 +963,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1015
963
|
},
|
|
1016
964
|
],
|
|
1017
965
|
},
|
|
1018
|
-
|
|
966
|
+
6069: {
|
|
1019
967
|
name: "PendingAgentPermsExists",
|
|
1020
968
|
message: "A pending agent permissions update already exists for this agent.",
|
|
1021
969
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -1027,7 +975,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1027
975
|
},
|
|
1028
976
|
],
|
|
1029
977
|
},
|
|
1030
|
-
|
|
978
|
+
6070: {
|
|
1031
979
|
name: "PendingCloseConstraintsExists",
|
|
1032
980
|
message: "A pending close constraints operation already exists for this vault.",
|
|
1033
981
|
category: "RESOURCE_NOT_FOUND",
|
|
@@ -1039,7 +987,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1039
987
|
},
|
|
1040
988
|
],
|
|
1041
989
|
},
|
|
1042
|
-
|
|
990
|
+
6071: {
|
|
1043
991
|
name: "ActiveSessionsExist",
|
|
1044
992
|
message: "Cannot close vault with active sessions. Finalize all pending sessions first.",
|
|
1045
993
|
category: "POLICY_VIOLATION",
|
|
@@ -1053,7 +1001,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1053
1001
|
],
|
|
1054
1002
|
},
|
|
1055
1003
|
// --- Post-execution assertions (Phase B scaffolding) ---
|
|
1056
|
-
|
|
1004
|
+
6072: {
|
|
1057
1005
|
name: "PostAssertionFailed",
|
|
1058
1006
|
message: "Post-execution assertion failed: account state did not satisfy constraint.",
|
|
1059
1007
|
category: "POLICY_VIOLATION",
|
|
@@ -1065,7 +1013,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1065
1013
|
},
|
|
1066
1014
|
],
|
|
1067
1015
|
},
|
|
1068
|
-
|
|
1016
|
+
6073: {
|
|
1069
1017
|
name: "InvalidPostAssertionIndex",
|
|
1070
1018
|
message: "Post-assertion references an invalid instruction index.",
|
|
1071
1019
|
category: "INPUT_VALIDATION",
|
|
@@ -1077,7 +1025,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1077
1025
|
},
|
|
1078
1026
|
],
|
|
1079
1027
|
},
|
|
1080
|
-
|
|
1028
|
+
6074: {
|
|
1081
1029
|
name: "UnauthorizedPreValidateInstruction",
|
|
1082
1030
|
message: "Non-infrastructure instruction detected before validate_and_authorize.",
|
|
1083
1031
|
category: "PERMISSION",
|
|
@@ -1089,7 +1037,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1089
1037
|
},
|
|
1090
1038
|
],
|
|
1091
1039
|
},
|
|
1092
|
-
|
|
1040
|
+
6075: {
|
|
1093
1041
|
name: "SnapshotNotCaptured",
|
|
1094
1042
|
message: "Delta assertion snapshot was not captured in validate_and_authorize.",
|
|
1095
1043
|
category: "INPUT_VALIDATION",
|
|
@@ -1101,7 +1049,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1101
1049
|
},
|
|
1102
1050
|
],
|
|
1103
1051
|
},
|
|
1104
|
-
|
|
1052
|
+
6076: {
|
|
1105
1053
|
name: "ConstraintIndexOutOfBounds",
|
|
1106
1054
|
message: "Constraint entry index out of bounds for zero-copy array.",
|
|
1107
1055
|
category: "INPUT_VALIDATION",
|
|
@@ -1113,7 +1061,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1113
1061
|
},
|
|
1114
1062
|
],
|
|
1115
1063
|
},
|
|
1116
|
-
|
|
1064
|
+
6077: {
|
|
1117
1065
|
name: "InvalidConstraintOperator",
|
|
1118
1066
|
message: "Constraint operator value is not a valid ConstraintOperator discriminant.",
|
|
1119
1067
|
category: "INPUT_VALIDATION",
|
|
@@ -1125,7 +1073,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1125
1073
|
},
|
|
1126
1074
|
],
|
|
1127
1075
|
},
|
|
1128
|
-
|
|
1076
|
+
6078: {
|
|
1129
1077
|
name: "ConstraintsVaultMismatch",
|
|
1130
1078
|
message: "Zero-copy constraints account has wrong vault.",
|
|
1131
1079
|
category: "INPUT_VALIDATION",
|
|
@@ -1137,7 +1085,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1137
1085
|
},
|
|
1138
1086
|
],
|
|
1139
1087
|
},
|
|
1140
|
-
|
|
1088
|
+
6079: {
|
|
1141
1089
|
name: "ConstraintEntryCountExceeded",
|
|
1142
1090
|
message: "Cannot pack entries: entry count exceeds MAX_CONSTRAINT_ENTRIES (64).",
|
|
1143
1091
|
category: "INPUT_VALIDATION",
|
|
@@ -1149,7 +1097,7 @@ export const ON_CHAIN_ERROR_MAP = {
|
|
|
1149
1097
|
},
|
|
1150
1098
|
],
|
|
1151
1099
|
},
|
|
1152
|
-
|
|
1100
|
+
6080: {
|
|
1153
1101
|
name: "BlockedSplOpcode",
|
|
1154
1102
|
message: "SPL opcode is blocked at runtime and cannot be used in constraints.",
|
|
1155
1103
|
category: "INPUT_VALIDATION",
|
|
@@ -1661,7 +1609,7 @@ const SDK_ERRORS = {
|
|
|
1661
1609
|
* Convert any error into a structured AgentError.
|
|
1662
1610
|
*
|
|
1663
1611
|
* Handles:
|
|
1664
|
-
* - On-chain Anchor errors (code 6000-
|
|
1612
|
+
* - On-chain Anchor errors (code 6000-6080)
|
|
1665
1613
|
* - SDK errors (code 7000-7033)
|
|
1666
1614
|
* - Network/RPC errors (from message patterns)
|
|
1667
1615
|
* - Unknown errors (wrapped as FATAL)
|
|
@@ -1963,7 +1911,7 @@ function extractErrorCode(error) {
|
|
|
1963
1911
|
return null;
|
|
1964
1912
|
const e = error;
|
|
1965
1913
|
// Direct code property
|
|
1966
|
-
if (typeof e.code === "number" && e.code >= 6000 && e.code <=
|
|
1914
|
+
if (typeof e.code === "number" && e.code >= 6000 && e.code <= 6080)
|
|
1967
1915
|
return e.code;
|
|
1968
1916
|
// Anchor error structure
|
|
1969
1917
|
if (e.error && typeof e.error === "object") {
|
|
@@ -1979,7 +1927,7 @@ function extractErrorCode(error) {
|
|
|
1979
1927
|
const match = e.message.match(/custom program error: 0x([0-9a-fA-F]+)/);
|
|
1980
1928
|
if (match) {
|
|
1981
1929
|
const code = parseInt(match[1], 16);
|
|
1982
|
-
if (code >= 6000 && code <=
|
|
1930
|
+
if (code >= 6000 && code <= 6080)
|
|
1983
1931
|
return code;
|
|
1984
1932
|
}
|
|
1985
1933
|
}
|
|
@@ -2101,17 +2049,8 @@ const SDK_ERROR_PATTERNS = [
|
|
|
2101
2049
|
},
|
|
2102
2050
|
],
|
|
2103
2051
|
},
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
category: "POLICY_VIOLATION",
|
|
2107
|
-
retryable: true,
|
|
2108
|
-
recovery_actions: [
|
|
2109
|
-
{
|
|
2110
|
-
action: "close_position",
|
|
2111
|
-
description: "Close an existing position before opening a new one.",
|
|
2112
|
-
},
|
|
2113
|
-
],
|
|
2114
|
-
},
|
|
2052
|
+
// "Position limit reached" pattern DELETED — position counter system removed
|
|
2053
|
+
// per council decision (9-1 vote, 2026-04-19).
|
|
2115
2054
|
{
|
|
2116
2055
|
pattern: /Spending action .+ requires amount > 0/,
|
|
2117
2056
|
category: "INPUT_VALIDATION",
|
|
@@ -2205,7 +2144,7 @@ export class SigilSdkError extends Error {
|
|
|
2205
2144
|
* Returns a SigilSdkError (extends Error) so instanceof Error checks still work.
|
|
2206
2145
|
*
|
|
2207
2146
|
* Processing order:
|
|
2208
|
-
* 1. Try on-chain error extraction via toAgentError() (numeric codes 6000-
|
|
2147
|
+
* 1. Try on-chain error extraction via toAgentError() (numeric codes 6000-6080)
|
|
2209
2148
|
* 2. Pattern-match SDK error messages (11 patterns from seal.ts throw sites)
|
|
2210
2149
|
* 3. Fallback to UNKNOWN/FATAL
|
|
2211
2150
|
*/
|