@agent-shield/sdk 0.1.6 → 0.2.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.
Files changed (49) hide show
  1. package/README.md +14 -12
  2. package/dist/accounts.d.ts +5 -3
  3. package/dist/accounts.d.ts.map +1 -1
  4. package/dist/accounts.js +23 -4
  5. package/dist/accounts.js.map +1 -1
  6. package/dist/client.d.ts +16 -4
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +48 -7
  9. package/dist/client.js.map +1 -1
  10. package/dist/composer.d.ts.map +1 -1
  11. package/dist/composer.js +3 -3
  12. package/dist/composer.js.map +1 -1
  13. package/dist/idl-json.d.ts +655 -24
  14. package/dist/idl-json.d.ts.map +1 -1
  15. package/dist/idl-json.js +1174 -87
  16. package/dist/idl-json.js.map +1 -1
  17. package/dist/idl.d.ts +1283 -196
  18. package/dist/idl.d.ts.map +1 -1
  19. package/dist/index.d.ts +6 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +25 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/instructions.d.ts +604 -61
  24. package/dist/instructions.d.ts.map +1 -1
  25. package/dist/instructions.js +76 -8
  26. package/dist/instructions.js.map +1 -1
  27. package/dist/integrations/flash-trade.d.ts.map +1 -1
  28. package/dist/integrations/flash-trade.js +14 -6
  29. package/dist/integrations/flash-trade.js.map +1 -1
  30. package/dist/integrations/jupiter.d.ts.map +1 -1
  31. package/dist/integrations/jupiter.js +4 -1
  32. package/dist/integrations/jupiter.js.map +1 -1
  33. package/dist/oracle.d.ts +31 -0
  34. package/dist/oracle.d.ts.map +1 -0
  35. package/dist/oracle.js +57 -0
  36. package/dist/oracle.js.map +1 -0
  37. package/dist/rewriter.d.ts +21 -0
  38. package/dist/rewriter.d.ts.map +1 -0
  39. package/dist/rewriter.js +33 -0
  40. package/dist/rewriter.js.map +1 -0
  41. package/dist/types.d.ts +82 -12
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/types.js +5 -1
  44. package/dist/types.js.map +1 -1
  45. package/dist/wrap.d.ts +60 -0
  46. package/dist/wrap.d.ts.map +1 -0
  47. package/dist/wrap.js +88 -0
  48. package/dist/wrap.js.map +1 -0
  49. package/package.json +9 -11
@@ -7,6 +7,171 @@ export declare const IDL: {
7
7
  readonly description: "AI Agent Financial Middleware for Solana - Permission controls, spending limits, and audit infrastructure for autonomous agents";
8
8
  };
9
9
  readonly instructions: readonly [{
10
+ readonly name: "agent_transfer";
11
+ readonly docs: readonly ["Transfer tokens from the vault to an allowed destination.", "Only the agent can call this. Respects destination allowlist,", "spending caps, and per-token limits."];
12
+ readonly discriminator: readonly [199, 111, 151, 49, 124, 13, 150, 44];
13
+ readonly accounts: readonly [{
14
+ readonly name: "agent";
15
+ readonly writable: true;
16
+ readonly signer: true;
17
+ }, {
18
+ readonly name: "vault";
19
+ readonly writable: true;
20
+ readonly pda: {
21
+ readonly seeds: readonly [{
22
+ readonly kind: "const";
23
+ readonly value: readonly [118, 97, 117, 108, 116];
24
+ }, {
25
+ readonly kind: "account";
26
+ readonly path: "vault.owner";
27
+ readonly account: "AgentVault";
28
+ }, {
29
+ readonly kind: "account";
30
+ readonly path: "vault.vault_id";
31
+ readonly account: "AgentVault";
32
+ }];
33
+ };
34
+ readonly relations: readonly ["policy", "tracker"];
35
+ }, {
36
+ readonly name: "policy";
37
+ readonly pda: {
38
+ readonly seeds: readonly [{
39
+ readonly kind: "const";
40
+ readonly value: readonly [112, 111, 108, 105, 99, 121];
41
+ }, {
42
+ readonly kind: "account";
43
+ readonly path: "vault";
44
+ }];
45
+ };
46
+ }, {
47
+ readonly name: "tracker";
48
+ readonly writable: true;
49
+ readonly pda: {
50
+ readonly seeds: readonly [{
51
+ readonly kind: "const";
52
+ readonly value: readonly [116, 114, 97, 99, 107, 101, 114];
53
+ }, {
54
+ readonly kind: "account";
55
+ readonly path: "vault";
56
+ }];
57
+ };
58
+ }, {
59
+ readonly name: "vault_token_account";
60
+ readonly docs: readonly ["Vault's PDA-owned token account (source)"];
61
+ readonly writable: true;
62
+ }, {
63
+ readonly name: "destination_token_account";
64
+ readonly docs: readonly ["Destination token account (must be in allowed destinations if configured)"];
65
+ readonly writable: true;
66
+ }, {
67
+ readonly name: "fee_destination_token_account";
68
+ readonly docs: readonly ["Developer fee destination token account — must match vault.fee_destination"];
69
+ readonly writable: true;
70
+ readonly optional: true;
71
+ }, {
72
+ readonly name: "protocol_treasury_token_account";
73
+ readonly docs: readonly ["Protocol treasury token account"];
74
+ readonly writable: true;
75
+ readonly optional: true;
76
+ }, {
77
+ readonly name: "token_program";
78
+ readonly address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
79
+ }];
80
+ readonly args: readonly [{
81
+ readonly name: "amount";
82
+ readonly type: "u64";
83
+ }];
84
+ }, {
85
+ readonly name: "apply_pending_policy";
86
+ readonly docs: readonly ["Apply a queued policy update after the timelock period has expired.", "Closes the PendingPolicyUpdate PDA and returns rent to the owner."];
87
+ readonly discriminator: readonly [114, 212, 19, 227, 89, 199, 74, 62];
88
+ readonly accounts: readonly [{
89
+ readonly name: "owner";
90
+ readonly writable: true;
91
+ readonly signer: true;
92
+ readonly relations: readonly ["vault"];
93
+ }, {
94
+ readonly name: "vault";
95
+ readonly pda: {
96
+ readonly seeds: readonly [{
97
+ readonly kind: "const";
98
+ readonly value: readonly [118, 97, 117, 108, 116];
99
+ }, {
100
+ readonly kind: "account";
101
+ readonly path: "owner";
102
+ }, {
103
+ readonly kind: "account";
104
+ readonly path: "vault.vault_id";
105
+ readonly account: "AgentVault";
106
+ }];
107
+ };
108
+ readonly relations: readonly ["policy", "pending_policy"];
109
+ }, {
110
+ readonly name: "policy";
111
+ readonly writable: true;
112
+ readonly pda: {
113
+ readonly seeds: readonly [{
114
+ readonly kind: "const";
115
+ readonly value: readonly [112, 111, 108, 105, 99, 121];
116
+ }, {
117
+ readonly kind: "account";
118
+ readonly path: "vault";
119
+ }];
120
+ };
121
+ }, {
122
+ readonly name: "pending_policy";
123
+ readonly writable: true;
124
+ readonly pda: {
125
+ readonly seeds: readonly [{
126
+ readonly kind: "const";
127
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
128
+ }, {
129
+ readonly kind: "account";
130
+ readonly path: "vault";
131
+ }];
132
+ };
133
+ }];
134
+ readonly args: readonly [];
135
+ }, {
136
+ readonly name: "cancel_pending_policy";
137
+ readonly docs: readonly ["Cancel a queued policy update. Closes the PendingPolicyUpdate PDA", "and returns rent to the owner."];
138
+ readonly discriminator: readonly [153, 36, 104, 200, 50, 94, 207, 33];
139
+ readonly accounts: readonly [{
140
+ readonly name: "owner";
141
+ readonly writable: true;
142
+ readonly signer: true;
143
+ readonly relations: readonly ["vault"];
144
+ }, {
145
+ readonly name: "vault";
146
+ readonly pda: {
147
+ readonly seeds: readonly [{
148
+ readonly kind: "const";
149
+ readonly value: readonly [118, 97, 117, 108, 116];
150
+ }, {
151
+ readonly kind: "account";
152
+ readonly path: "owner";
153
+ }, {
154
+ readonly kind: "account";
155
+ readonly path: "vault.vault_id";
156
+ readonly account: "AgentVault";
157
+ }];
158
+ };
159
+ readonly relations: readonly ["pending_policy"];
160
+ }, {
161
+ readonly name: "pending_policy";
162
+ readonly writable: true;
163
+ readonly pda: {
164
+ readonly seeds: readonly [{
165
+ readonly kind: "const";
166
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
167
+ }, {
168
+ readonly kind: "account";
169
+ readonly path: "vault";
170
+ }];
171
+ };
172
+ }];
173
+ readonly args: readonly [];
174
+ }, {
10
175
  readonly name: "close_vault";
11
176
  readonly docs: readonly ["Close the vault entirely. Withdraws all remaining funds and closes all PDAs.", "Reclaims rent. Vault must have no open positions. Only the owner can call this."];
12
177
  readonly discriminator: readonly [141, 103, 17, 126, 72, 75, 29, 29];
@@ -143,7 +308,7 @@ export declare const IDL: {
143
308
  }];
144
309
  }, {
145
310
  readonly name: "finalize_session";
146
- readonly docs: readonly ["Finalize a session after the DeFi action completes.", "Closes the SessionAuthority PDA and records the transaction in the audit log.", "Can be called by the agent or permissionlessly (for cleanup of expired sessions)."];
311
+ readonly docs: readonly ["Finalize a session after the DeFi action completes.", "Revokes token delegation, collects fees, closes the SessionAuthority PDA,", "and records the transaction in the audit log.", "Can be called by the agent or permissionlessly (for cleanup of expired sessions)."];
147
312
  readonly discriminator: readonly [34, 148, 144, 47, 37, 130, 206, 161];
148
313
  readonly accounts: readonly [{
149
314
  readonly name: "payer";
@@ -192,7 +357,7 @@ export declare const IDL: {
192
357
  };
193
358
  }, {
194
359
  readonly name: "session";
195
- readonly docs: readonly ["Session rent is returned to the session's agent (who paid for it),", "not the arbitrary payer, to prevent rent theft."];
360
+ readonly docs: readonly ["Session rent is returned to the session's agent (who paid for it),", "not the arbitrary payer, to prevent rent theft.", "Seeds include token_mint for per-token concurrent sessions."];
196
361
  readonly writable: true;
197
362
  readonly pda: {
198
363
  readonly seeds: readonly [{
@@ -205,6 +370,10 @@ export declare const IDL: {
205
370
  readonly kind: "account";
206
371
  readonly path: "session.agent";
207
372
  readonly account: "SessionAuthority";
373
+ }, {
374
+ readonly kind: "account";
375
+ readonly path: "session.authorized_token";
376
+ readonly account: "SessionAuthority";
208
377
  }];
209
378
  };
210
379
  }, {
@@ -213,7 +382,7 @@ export declare const IDL: {
213
382
  readonly writable: true;
214
383
  }, {
215
384
  readonly name: "vault_token_account";
216
- readonly docs: readonly ["Vault's PDA token account for the session's token (fee source)"];
385
+ readonly docs: readonly ["Vault's PDA token account for the session's token (fee source + delegation revocation)"];
217
386
  readonly writable: true;
218
387
  readonly optional: true;
219
388
  }, {
@@ -295,15 +464,19 @@ export declare const IDL: {
295
464
  readonly name: "vault_id";
296
465
  readonly type: "u64";
297
466
  }, {
298
- readonly name: "daily_spending_cap";
467
+ readonly name: "daily_spending_cap_usd";
299
468
  readonly type: "u64";
300
469
  }, {
301
- readonly name: "max_transaction_size";
470
+ readonly name: "max_transaction_size_usd";
302
471
  readonly type: "u64";
303
472
  }, {
304
473
  readonly name: "allowed_tokens";
305
474
  readonly type: {
306
- readonly vec: "pubkey";
475
+ readonly vec: {
476
+ readonly defined: {
477
+ readonly name: "AllowedToken";
478
+ };
479
+ };
307
480
  };
308
481
  }, {
309
482
  readonly name: "allowed_protocols";
@@ -319,6 +492,127 @@ export declare const IDL: {
319
492
  }, {
320
493
  readonly name: "developer_fee_rate";
321
494
  readonly type: "u16";
495
+ }, {
496
+ readonly name: "timelock_duration";
497
+ readonly type: "u64";
498
+ }, {
499
+ readonly name: "allowed_destinations";
500
+ readonly type: {
501
+ readonly vec: "pubkey";
502
+ };
503
+ }];
504
+ }, {
505
+ readonly name: "queue_policy_update";
506
+ readonly docs: readonly ["Queue a policy update when timelock is active.", "Creates a PendingPolicyUpdate PDA that becomes executable after", "the timelock period expires."];
507
+ readonly discriminator: readonly [149, 18, 76, 197, 179, 193, 91, 77];
508
+ readonly accounts: readonly [{
509
+ readonly name: "owner";
510
+ readonly writable: true;
511
+ readonly signer: true;
512
+ readonly relations: readonly ["vault"];
513
+ }, {
514
+ readonly name: "vault";
515
+ readonly pda: {
516
+ readonly seeds: readonly [{
517
+ readonly kind: "const";
518
+ readonly value: readonly [118, 97, 117, 108, 116];
519
+ }, {
520
+ readonly kind: "account";
521
+ readonly path: "owner";
522
+ }, {
523
+ readonly kind: "account";
524
+ readonly path: "vault.vault_id";
525
+ readonly account: "AgentVault";
526
+ }];
527
+ };
528
+ readonly relations: readonly ["policy"];
529
+ }, {
530
+ readonly name: "policy";
531
+ readonly pda: {
532
+ readonly seeds: readonly [{
533
+ readonly kind: "const";
534
+ readonly value: readonly [112, 111, 108, 105, 99, 121];
535
+ }, {
536
+ readonly kind: "account";
537
+ readonly path: "vault";
538
+ }];
539
+ };
540
+ }, {
541
+ readonly name: "pending_policy";
542
+ readonly writable: true;
543
+ readonly pda: {
544
+ readonly seeds: readonly [{
545
+ readonly kind: "const";
546
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
547
+ }, {
548
+ readonly kind: "account";
549
+ readonly path: "vault";
550
+ }];
551
+ };
552
+ }, {
553
+ readonly name: "system_program";
554
+ readonly address: "11111111111111111111111111111111";
555
+ }];
556
+ readonly args: readonly [{
557
+ readonly name: "daily_spending_cap_usd";
558
+ readonly type: {
559
+ readonly option: "u64";
560
+ };
561
+ }, {
562
+ readonly name: "max_transaction_amount_usd";
563
+ readonly type: {
564
+ readonly option: "u64";
565
+ };
566
+ }, {
567
+ readonly name: "allowed_tokens";
568
+ readonly type: {
569
+ readonly option: {
570
+ readonly vec: {
571
+ readonly defined: {
572
+ readonly name: "AllowedToken";
573
+ };
574
+ };
575
+ };
576
+ };
577
+ }, {
578
+ readonly name: "allowed_protocols";
579
+ readonly type: {
580
+ readonly option: {
581
+ readonly vec: "pubkey";
582
+ };
583
+ };
584
+ }, {
585
+ readonly name: "max_leverage_bps";
586
+ readonly type: {
587
+ readonly option: "u16";
588
+ };
589
+ }, {
590
+ readonly name: "can_open_positions";
591
+ readonly type: {
592
+ readonly option: "bool";
593
+ };
594
+ }, {
595
+ readonly name: "max_concurrent_positions";
596
+ readonly type: {
597
+ readonly option: "u8";
598
+ };
599
+ }, {
600
+ readonly name: "developer_fee_rate";
601
+ readonly type: {
602
+ readonly option: "u16";
603
+ };
604
+ }, {
605
+ readonly name: "timelock_duration";
606
+ readonly type: {
607
+ readonly option: "u64";
608
+ };
609
+ }, {
610
+ readonly name: "allowed_destinations";
611
+ readonly type: {
612
+ readonly option: {
613
+ readonly vec: "pubkey";
614
+ };
615
+ };
322
616
  }];
323
617
  }, {
324
618
  readonly name: "reactivate_vault";
@@ -408,7 +702,7 @@ export declare const IDL: {
408
702
  readonly args: readonly [];
409
703
  }, {
410
704
  readonly name: "update_policy";
411
- readonly docs: readonly ["Update the policy configuration for a vault.", "Only the owner can call this. Cannot be called by the agent."];
705
+ readonly docs: readonly ["Update the policy configuration for a vault.", "Only the owner can call this. Cannot be called by the agent.", "Blocked when timelock_duration > 0 — use queue_policy_update instead."];
412
706
  readonly discriminator: readonly [212, 245, 246, 7, 163, 151, 18, 57];
413
707
  readonly accounts: readonly [{
414
708
  readonly name: "owner";
@@ -444,12 +738,12 @@ export declare const IDL: {
444
738
  };
445
739
  }];
446
740
  readonly args: readonly [{
447
- readonly name: "daily_spending_cap";
741
+ readonly name: "daily_spending_cap_usd";
448
742
  readonly type: {
449
743
  readonly option: "u64";
450
744
  };
451
745
  }, {
452
- readonly name: "max_transaction_size";
746
+ readonly name: "max_transaction_size_usd";
453
747
  readonly type: {
454
748
  readonly option: "u64";
455
749
  };
@@ -457,7 +751,11 @@ export declare const IDL: {
457
751
  readonly name: "allowed_tokens";
458
752
  readonly type: {
459
753
  readonly option: {
460
- readonly vec: "pubkey";
754
+ readonly vec: {
755
+ readonly defined: {
756
+ readonly name: "AllowedToken";
757
+ };
758
+ };
461
759
  };
462
760
  };
463
761
  }, {
@@ -487,10 +785,22 @@ export declare const IDL: {
487
785
  readonly type: {
488
786
  readonly option: "u16";
489
787
  };
788
+ }, {
789
+ readonly name: "timelock_duration";
790
+ readonly type: {
791
+ readonly option: "u64";
792
+ };
793
+ }, {
794
+ readonly name: "allowed_destinations";
795
+ readonly type: {
796
+ readonly option: {
797
+ readonly vec: "pubkey";
798
+ };
799
+ };
490
800
  }];
491
801
  }, {
492
802
  readonly name: "validate_and_authorize";
493
- readonly docs: readonly ["Core permission check. Called by the agent before a DeFi action.", "Validates the action against all policy constraints.", "If approved, creates a SessionAuthority PDA and updates spend tracking.", "If denied, reverts the entire transaction (including subsequent DeFi instructions)."];
803
+ readonly docs: readonly ["Core permission check. Called by the agent before a DeFi action.", "Validates the action against all policy constraints (USD caps, per-token caps).", "If approved, creates a SessionAuthority PDA, delegates tokens to agent,", "and updates spend tracking.", "If denied, reverts the entire transaction (including subsequent DeFi instructions)."];
494
804
  readonly discriminator: readonly [22, 183, 48, 222, 218, 11, 197, 152];
495
805
  readonly accounts: readonly [{
496
806
  readonly name: "agent";
@@ -539,7 +849,7 @@ export declare const IDL: {
539
849
  };
540
850
  }, {
541
851
  readonly name: "session";
542
- readonly docs: readonly ["Ephemeral session PDA — `init` ensures no double-authorization"];
852
+ readonly docs: readonly ["Ephemeral session PDA — `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
543
853
  readonly writable: true;
544
854
  readonly pda: {
545
855
  readonly seeds: readonly [{
@@ -551,8 +861,21 @@ export declare const IDL: {
551
861
  }, {
552
862
  readonly kind: "account";
553
863
  readonly path: "agent";
864
+ }, {
865
+ readonly kind: "arg";
866
+ readonly path: "token_mint";
554
867
  }];
555
868
  };
869
+ }, {
870
+ readonly name: "vault_token_account";
871
+ readonly docs: readonly ["Vault's PDA-owned token account for the spend token (delegation source)"];
872
+ readonly writable: true;
873
+ }, {
874
+ readonly name: "token_mint_account";
875
+ readonly docs: readonly ["The token mint being spent"];
876
+ }, {
877
+ readonly name: "token_program";
878
+ readonly address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
556
879
  }, {
557
880
  readonly name: "system_program";
558
881
  readonly address: "11111111111111111111111111111111";
@@ -657,6 +980,9 @@ export declare const IDL: {
657
980
  readonly accounts: readonly [{
658
981
  readonly name: "AgentVault";
659
982
  readonly discriminator: readonly [232, 220, 237, 164, 157, 9, 215, 194];
983
+ }, {
984
+ readonly name: "PendingPolicyUpdate";
985
+ readonly discriminator: readonly [77, 255, 2, 51, 79, 237, 183, 239];
660
986
  }, {
661
987
  readonly name: "PolicyConfig";
662
988
  readonly discriminator: readonly [219, 7, 79, 84, 175, 51, 148, 146];
@@ -679,6 +1005,12 @@ export declare const IDL: {
679
1005
  }, {
680
1006
  readonly name: "AgentRevoked";
681
1007
  readonly discriminator: readonly [12, 251, 249, 166, 122, 83, 162, 116];
1008
+ }, {
1009
+ readonly name: "AgentTransferExecuted";
1010
+ readonly discriminator: readonly [88, 52, 117, 69, 112, 152, 167, 40];
1011
+ }, {
1012
+ readonly name: "DelegationRevoked";
1013
+ readonly discriminator: readonly [59, 158, 142, 49, 164, 116, 220, 8];
682
1014
  }, {
683
1015
  readonly name: "FeesCollected";
684
1016
  readonly discriminator: readonly [233, 23, 117, 225, 107, 178, 254, 8];
@@ -688,6 +1020,15 @@ export declare const IDL: {
688
1020
  }, {
689
1021
  readonly name: "FundsWithdrawn";
690
1022
  readonly discriminator: readonly [56, 130, 230, 154, 35, 92, 11, 118];
1023
+ }, {
1024
+ readonly name: "PolicyChangeApplied";
1025
+ readonly discriminator: readonly [104, 89, 5, 100, 180, 202, 52, 73];
1026
+ }, {
1027
+ readonly name: "PolicyChangeCancelled";
1028
+ readonly discriminator: readonly [200, 158, 226, 255, 25, 211, 30, 151];
1029
+ }, {
1030
+ readonly name: "PolicyChangeQueued";
1031
+ readonly discriminator: readonly [73, 231, 182, 136, 141, 120, 32, 79];
691
1032
  }, {
692
1033
  readonly name: "PolicyUpdated";
693
1034
  readonly discriminator: readonly [225, 112, 112, 67, 95, 236, 245, 161];
@@ -816,6 +1157,74 @@ export declare const IDL: {
816
1157
  readonly code: 6027;
817
1158
  readonly name: "Overflow";
818
1159
  readonly msg: "Arithmetic overflow";
1160
+ }, {
1161
+ readonly code: 6028;
1162
+ readonly name: "DelegationFailed";
1163
+ readonly msg: "Token delegation approval failed";
1164
+ }, {
1165
+ readonly code: 6029;
1166
+ readonly name: "RevocationFailed";
1167
+ readonly msg: "Token delegation revocation failed";
1168
+ }, {
1169
+ readonly code: 6030;
1170
+ readonly name: "OracleFeedStale";
1171
+ readonly msg: "Oracle feed value is too stale";
1172
+ }, {
1173
+ readonly code: 6031;
1174
+ readonly name: "OracleFeedInvalid";
1175
+ readonly msg: "Cannot parse oracle feed data";
1176
+ }, {
1177
+ readonly code: 6032;
1178
+ readonly name: "TokenSpendBlocked";
1179
+ readonly msg: "Unpriced token cannot be spent (receive-only)";
1180
+ }, {
1181
+ readonly code: 6033;
1182
+ readonly name: "InvalidTokenAccount";
1183
+ readonly msg: "Token account does not belong to vault or has wrong mint";
1184
+ }, {
1185
+ readonly code: 6034;
1186
+ readonly name: "OracleAccountMissing";
1187
+ readonly msg: "Oracle-priced token requires feed account in remaining_accounts";
1188
+ }, {
1189
+ readonly code: 6035;
1190
+ readonly name: "PerTokenCapExceeded";
1191
+ readonly msg: "Per-token daily spending cap would be exceeded";
1192
+ }, {
1193
+ readonly code: 6036;
1194
+ readonly name: "PerTokenTxLimitExceeded";
1195
+ readonly msg: "Per-token single transaction limit exceeded";
1196
+ }, {
1197
+ readonly code: 6037;
1198
+ readonly name: "OracleConfidenceTooWide";
1199
+ readonly msg: "Oracle price confidence interval too wide";
1200
+ }, {
1201
+ readonly code: 6038;
1202
+ readonly name: "OracleUnsupportedType";
1203
+ readonly msg: "Oracle account owner is not a recognized oracle program";
1204
+ }, {
1205
+ readonly code: 6039;
1206
+ readonly name: "OracleNotVerified";
1207
+ readonly msg: "Pyth price update not fully verified by Wormhole";
1208
+ }, {
1209
+ readonly code: 6040;
1210
+ readonly name: "TimelockNotExpired";
1211
+ readonly msg: "Timelock period has not expired yet";
1212
+ }, {
1213
+ readonly code: 6041;
1214
+ readonly name: "TimelockActive";
1215
+ readonly msg: "Vault has timelock active — use queue_policy_update instead";
1216
+ }, {
1217
+ readonly code: 6042;
1218
+ readonly name: "NoTimelockConfigured";
1219
+ readonly msg: "No timelock configured on this vault";
1220
+ }, {
1221
+ readonly code: 6043;
1222
+ readonly name: "DestinationNotAllowed";
1223
+ readonly msg: "Destination not in allowed list";
1224
+ }, {
1225
+ readonly code: 6044;
1226
+ readonly name: "TooManyDestinations";
1227
+ readonly msg: "Too many destinations (max 10)";
819
1228
  }];
820
1229
  readonly types: readonly [{
821
1230
  readonly name: "ActionAuthorized";
@@ -840,15 +1249,31 @@ export declare const IDL: {
840
1249
  }, {
841
1250
  readonly name: "amount";
842
1251
  readonly type: "u64";
1252
+ }, {
1253
+ readonly name: "usd_amount";
1254
+ readonly type: "u64";
843
1255
  }, {
844
1256
  readonly name: "protocol";
845
1257
  readonly type: "pubkey";
846
1258
  }, {
847
- readonly name: "rolling_spend_after";
1259
+ readonly name: "rolling_spend_usd_after";
848
1260
  readonly type: "u64";
849
1261
  }, {
850
- readonly name: "daily_cap";
1262
+ readonly name: "daily_cap_usd";
851
1263
  readonly type: "u64";
1264
+ }, {
1265
+ readonly name: "delegated";
1266
+ readonly type: "bool";
1267
+ }, {
1268
+ readonly name: "oracle_price";
1269
+ readonly type: {
1270
+ readonly option: "i128";
1271
+ };
1272
+ }, {
1273
+ readonly name: "oracle_source";
1274
+ readonly type: {
1275
+ readonly option: "u8";
1276
+ };
852
1277
  }, {
853
1278
  readonly name: "timestamp";
854
1279
  readonly type: "i64";
@@ -891,6 +1316,8 @@ export declare const IDL: {
891
1316
  readonly name: "Deposit";
892
1317
  }, {
893
1318
  readonly name: "Withdraw";
1319
+ }, {
1320
+ readonly name: "Transfer";
894
1321
  }];
895
1322
  };
896
1323
  }, {
@@ -923,6 +1350,24 @@ export declare const IDL: {
923
1350
  readonly type: "i64";
924
1351
  }];
925
1352
  };
1353
+ }, {
1354
+ readonly name: "AgentTransferExecuted";
1355
+ readonly type: {
1356
+ readonly kind: "struct";
1357
+ readonly fields: readonly [{
1358
+ readonly name: "vault";
1359
+ readonly type: "pubkey";
1360
+ }, {
1361
+ readonly name: "destination";
1362
+ readonly type: "pubkey";
1363
+ }, {
1364
+ readonly name: "amount";
1365
+ readonly type: "u64";
1366
+ }, {
1367
+ readonly name: "mint";
1368
+ readonly type: "pubkey";
1369
+ }];
1370
+ };
926
1371
  }, {
927
1372
  readonly name: "AgentVault";
928
1373
  readonly type: {
@@ -977,6 +1422,48 @@ export declare const IDL: {
977
1422
  readonly type: "u64";
978
1423
  }];
979
1424
  };
1425
+ }, {
1426
+ readonly name: "AllowedToken";
1427
+ readonly docs: readonly ["Per-token configuration including oracle feed and per-token caps.", "Replaces the old `Vec<Pubkey>` allowed_tokens with richer metadata.", "", "Oracle feed classification:", "- `Pubkey::default()` = stablecoin (1:1 USD, no oracle needed)", "- `UNPRICED_SENTINEL` ([0xFF; 32]) = unpriced token (receive-only)", "- Any other pubkey = Oracle feed account (Pyth PriceUpdateV2 or Switchboard PullFeed)"];
1428
+ readonly type: {
1429
+ readonly kind: "struct";
1430
+ readonly fields: readonly [{
1431
+ readonly name: "mint";
1432
+ readonly docs: readonly ["Token mint address"];
1433
+ readonly type: "pubkey";
1434
+ }, {
1435
+ readonly name: "oracle_feed";
1436
+ readonly docs: readonly ["Oracle feed account (Pyth PriceUpdateV2 or Switchboard PullFeed) for USD pricing.", "`Pubkey::default()` = stablecoin (1:1 USD).", "`UNPRICED_SENTINEL` = unpriced (receive-only, cannot be spent)."];
1437
+ readonly type: "pubkey";
1438
+ }, {
1439
+ readonly name: "decimals";
1440
+ readonly docs: readonly ["Token decimals (e.g., 6 for USDC, 9 for SOL)"];
1441
+ readonly type: "u8";
1442
+ }, {
1443
+ readonly name: "daily_cap_base";
1444
+ readonly docs: readonly ["Per-token daily cap in base units (0 = no per-token limit,", "only the aggregate USD cap applies)"];
1445
+ readonly type: "u64";
1446
+ }, {
1447
+ readonly name: "max_tx_base";
1448
+ readonly docs: readonly ["Per-token max single transaction in base units", "(0 = no per-token tx limit, only USD tx limit applies)"];
1449
+ readonly type: "u64";
1450
+ }];
1451
+ };
1452
+ }, {
1453
+ readonly name: "DelegationRevoked";
1454
+ readonly type: {
1455
+ readonly kind: "struct";
1456
+ readonly fields: readonly [{
1457
+ readonly name: "vault";
1458
+ readonly type: "pubkey";
1459
+ }, {
1460
+ readonly name: "token_account";
1461
+ readonly type: "pubkey";
1462
+ }, {
1463
+ readonly name: "timestamp";
1464
+ readonly type: "i64";
1465
+ }];
1466
+ };
980
1467
  }, {
981
1468
  readonly name: "FeesCollected";
982
1469
  readonly type: {
@@ -1055,6 +1542,122 @@ export declare const IDL: {
1055
1542
  readonly type: "i64";
1056
1543
  }];
1057
1544
  };
1545
+ }, {
1546
+ readonly name: "PendingPolicyUpdate";
1547
+ readonly docs: readonly ["Queued policy update that becomes executable after a timelock period.", "Created by `queue_policy_update`, applied by `apply_pending_policy`,", "or cancelled by `cancel_pending_policy`.", "", "PDA seeds: `[b\"pending_policy\", vault.key().as_ref()]`"];
1548
+ readonly type: {
1549
+ readonly kind: "struct";
1550
+ readonly fields: readonly [{
1551
+ readonly name: "vault";
1552
+ readonly docs: readonly ["Associated vault pubkey"];
1553
+ readonly type: "pubkey";
1554
+ }, {
1555
+ readonly name: "queued_at";
1556
+ readonly docs: readonly ["Unix timestamp when this update was queued"];
1557
+ readonly type: "i64";
1558
+ }, {
1559
+ readonly name: "executes_at";
1560
+ readonly docs: readonly ["Unix timestamp when this update becomes executable"];
1561
+ readonly type: "i64";
1562
+ }, {
1563
+ readonly name: "daily_spending_cap_usd";
1564
+ readonly type: {
1565
+ readonly option: "u64";
1566
+ };
1567
+ }, {
1568
+ readonly name: "max_transaction_amount_usd";
1569
+ readonly type: {
1570
+ readonly option: "u64";
1571
+ };
1572
+ }, {
1573
+ readonly name: "allowed_tokens";
1574
+ readonly type: {
1575
+ readonly option: {
1576
+ readonly vec: {
1577
+ readonly defined: {
1578
+ readonly name: "AllowedToken";
1579
+ };
1580
+ };
1581
+ };
1582
+ };
1583
+ }, {
1584
+ readonly name: "allowed_protocols";
1585
+ readonly type: {
1586
+ readonly option: {
1587
+ readonly vec: "pubkey";
1588
+ };
1589
+ };
1590
+ }, {
1591
+ readonly name: "max_leverage_bps";
1592
+ readonly type: {
1593
+ readonly option: "u16";
1594
+ };
1595
+ }, {
1596
+ readonly name: "can_open_positions";
1597
+ readonly type: {
1598
+ readonly option: "bool";
1599
+ };
1600
+ }, {
1601
+ readonly name: "max_concurrent_positions";
1602
+ readonly type: {
1603
+ readonly option: "u8";
1604
+ };
1605
+ }, {
1606
+ readonly name: "developer_fee_rate";
1607
+ readonly type: {
1608
+ readonly option: "u16";
1609
+ };
1610
+ }, {
1611
+ readonly name: "timelock_duration";
1612
+ readonly type: {
1613
+ readonly option: "u64";
1614
+ };
1615
+ }, {
1616
+ readonly name: "allowed_destinations";
1617
+ readonly type: {
1618
+ readonly option: {
1619
+ readonly vec: "pubkey";
1620
+ };
1621
+ };
1622
+ }, {
1623
+ readonly name: "bump";
1624
+ readonly docs: readonly ["Bump seed for PDA"];
1625
+ readonly type: "u8";
1626
+ }];
1627
+ };
1628
+ }, {
1629
+ readonly name: "PolicyChangeApplied";
1630
+ readonly type: {
1631
+ readonly kind: "struct";
1632
+ readonly fields: readonly [{
1633
+ readonly name: "vault";
1634
+ readonly type: "pubkey";
1635
+ }, {
1636
+ readonly name: "applied_at";
1637
+ readonly type: "i64";
1638
+ }];
1639
+ };
1640
+ }, {
1641
+ readonly name: "PolicyChangeCancelled";
1642
+ readonly type: {
1643
+ readonly kind: "struct";
1644
+ readonly fields: readonly [{
1645
+ readonly name: "vault";
1646
+ readonly type: "pubkey";
1647
+ }];
1648
+ };
1649
+ }, {
1650
+ readonly name: "PolicyChangeQueued";
1651
+ readonly type: {
1652
+ readonly kind: "struct";
1653
+ readonly fields: readonly [{
1654
+ readonly name: "vault";
1655
+ readonly type: "pubkey";
1656
+ }, {
1657
+ readonly name: "executes_at";
1658
+ readonly type: "i64";
1659
+ }];
1660
+ };
1058
1661
  }, {
1059
1662
  readonly name: "PolicyConfig";
1060
1663
  readonly type: {
@@ -1064,18 +1667,22 @@ export declare const IDL: {
1064
1667
  readonly docs: readonly ["Associated vault pubkey"];
1065
1668
  readonly type: "pubkey";
1066
1669
  }, {
1067
- readonly name: "daily_spending_cap";
1068
- readonly docs: readonly ["Maximum spend per rolling 24h period (in token base units)"];
1670
+ readonly name: "daily_spending_cap_usd";
1671
+ readonly docs: readonly ["Maximum aggregate spend per rolling 24h period in USD (6 decimals).", "$500 = 500_000_000. This is the primary spending cap."];
1069
1672
  readonly type: "u64";
1070
1673
  }, {
1071
- readonly name: "max_transaction_size";
1072
- readonly docs: readonly ["Maximum single transaction size (in token base units)"];
1674
+ readonly name: "max_transaction_size_usd";
1675
+ readonly docs: readonly ["Maximum single transaction size in USD (6 decimals)."];
1073
1676
  readonly type: "u64";
1074
1677
  }, {
1075
1678
  readonly name: "allowed_tokens";
1076
- readonly docs: readonly ["Allowed token mints the agent can interact with", "Bounded to MAX_ALLOWED_TOKENS entries"];
1679
+ readonly docs: readonly ["Allowed token mints with oracle feeds and per-token caps.", "Bounded to MAX_ALLOWED_TOKENS entries."];
1077
1680
  readonly type: {
1078
- readonly vec: "pubkey";
1681
+ readonly vec: {
1682
+ readonly defined: {
1683
+ readonly name: "AllowedToken";
1684
+ };
1685
+ };
1079
1686
  };
1080
1687
  }, {
1081
1688
  readonly name: "allowed_protocols";
@@ -1099,6 +1706,16 @@ export declare const IDL: {
1099
1706
  readonly name: "developer_fee_rate";
1100
1707
  readonly docs: readonly ["Developer fee rate (rate / 1,000,000). Applied to every finalized", "transaction. Fee deducted from vault, transferred to vault's", "fee_destination. Max MAX_DEVELOPER_FEE_RATE (50 = 0.5 BPS).", "Set to 0 for no developer fee. Protocol fee is always applied", "separately at PROTOCOL_FEE_RATE."];
1101
1708
  readonly type: "u16";
1709
+ }, {
1710
+ readonly name: "timelock_duration";
1711
+ readonly docs: readonly ["Timelock duration in seconds for policy changes. 0 = no timelock", "(immediate updates allowed). When > 0, policy changes must go", "through queue_policy_update → apply_pending_policy."];
1712
+ readonly type: "u64";
1713
+ }, {
1714
+ readonly name: "allowed_destinations";
1715
+ readonly docs: readonly ["Allowed destination addresses for agent transfers.", "Empty = any destination allowed. Bounded to MAX_ALLOWED_DESTINATIONS."];
1716
+ readonly type: {
1717
+ readonly vec: "pubkey";
1718
+ };
1102
1719
  }, {
1103
1720
  readonly name: "bump";
1104
1721
  readonly docs: readonly ["Bump seed for PDA"];
@@ -1113,10 +1730,10 @@ export declare const IDL: {
1113
1730
  readonly name: "vault";
1114
1731
  readonly type: "pubkey";
1115
1732
  }, {
1116
- readonly name: "daily_cap";
1733
+ readonly name: "daily_cap_usd";
1117
1734
  readonly type: "u64";
1118
1735
  }, {
1119
- readonly name: "max_transaction_size";
1736
+ readonly name: "max_transaction_size_usd";
1120
1737
  readonly type: "u64";
1121
1738
  }, {
1122
1739
  readonly name: "allowed_tokens_count";
@@ -1173,6 +1790,14 @@ export declare const IDL: {
1173
1790
  readonly name: "expires_at_slot";
1174
1791
  readonly docs: readonly ["Slot-based expiry: session is valid until this slot"];
1175
1792
  readonly type: "u64";
1793
+ }, {
1794
+ readonly name: "delegated";
1795
+ readonly docs: readonly ["Whether token delegation was set up (approve CPI)"];
1796
+ readonly type: "bool";
1797
+ }, {
1798
+ readonly name: "delegation_token_account";
1799
+ readonly docs: readonly ["The vault's token account that was delegated to the agent", "(only meaningful when delegated == true)"];
1800
+ readonly type: "pubkey";
1176
1801
  }, {
1177
1802
  readonly name: "bump";
1178
1803
  readonly docs: readonly ["Bump seed for PDA"];
@@ -1203,9 +1828,15 @@ export declare const IDL: {
1203
1828
  readonly kind: "struct";
1204
1829
  readonly fields: readonly [{
1205
1830
  readonly name: "token_mint";
1831
+ readonly docs: readonly ["Token mint for audit trail"];
1206
1832
  readonly type: "pubkey";
1207
1833
  }, {
1208
- readonly name: "amount_spent";
1834
+ readonly name: "usd_amount";
1835
+ readonly docs: readonly ["USD value of this spend (6 decimals, e.g., $500 = 500_000_000)"];
1836
+ readonly type: "u64";
1837
+ }, {
1838
+ readonly name: "base_amount";
1839
+ readonly docs: readonly ["Original amount in token base units (for per-token cap checks)"];
1209
1840
  readonly type: "u64";
1210
1841
  }, {
1211
1842
  readonly name: "timestamp";
@@ -1222,7 +1853,7 @@ export declare const IDL: {
1222
1853
  readonly type: "pubkey";
1223
1854
  }, {
1224
1855
  readonly name: "rolling_spends";
1225
- readonly docs: readonly ["Rolling spend entries: (token_mint, amount, timestamp)", "Entries older than ROLLING_WINDOW_SECONDS are pruned on each access"];
1856
+ readonly docs: readonly ["Rolling spend entries: (token_mint, usd_amount, base_amount, timestamp)", "Entries older than ROLLING_WINDOW_SECONDS are pruned on each access"];
1226
1857
  readonly type: {
1227
1858
  readonly vec: {
1228
1859
  readonly defined: {