@agent-shield/sdk 0.1.6 → 0.3.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 +24 -5
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +73 -9
  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 +731 -33
  14. package/dist/idl-json.d.ts.map +1 -1
  15. package/dist/idl-json.js +1258 -54
  16. package/dist/idl-json.js.map +1 -1
  17. package/dist/idl.d.ts +1363 -159
  18. package/dist/idl.d.ts.map +1 -1
  19. package/dist/index.d.ts +7 -4
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +26 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/instructions.d.ts +658 -64
  24. package/dist/instructions.d.ts.map +1 -1
  25. package/dist/instructions.js +78 -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 +109 -13
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/types.js +15 -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 +13 -2
@@ -7,6 +7,183 @@ 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", "tracker", "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: "tracker";
123
+ readonly writable: true;
124
+ readonly pda: {
125
+ readonly seeds: readonly [{
126
+ readonly kind: "const";
127
+ readonly value: readonly [116, 114, 97, 99, 107, 101, 114];
128
+ }, {
129
+ readonly kind: "account";
130
+ readonly path: "vault";
131
+ }];
132
+ };
133
+ }, {
134
+ readonly name: "pending_policy";
135
+ readonly writable: true;
136
+ readonly pda: {
137
+ readonly seeds: readonly [{
138
+ readonly kind: "const";
139
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
140
+ }, {
141
+ readonly kind: "account";
142
+ readonly path: "vault";
143
+ }];
144
+ };
145
+ }];
146
+ readonly args: readonly [];
147
+ }, {
148
+ readonly name: "cancel_pending_policy";
149
+ readonly docs: readonly ["Cancel a queued policy update. Closes the PendingPolicyUpdate PDA", "and returns rent to the owner."];
150
+ readonly discriminator: readonly [153, 36, 104, 200, 50, 94, 207, 33];
151
+ readonly accounts: readonly [{
152
+ readonly name: "owner";
153
+ readonly writable: true;
154
+ readonly signer: true;
155
+ readonly relations: readonly ["vault"];
156
+ }, {
157
+ readonly name: "vault";
158
+ readonly pda: {
159
+ readonly seeds: readonly [{
160
+ readonly kind: "const";
161
+ readonly value: readonly [118, 97, 117, 108, 116];
162
+ }, {
163
+ readonly kind: "account";
164
+ readonly path: "owner";
165
+ }, {
166
+ readonly kind: "account";
167
+ readonly path: "vault.vault_id";
168
+ readonly account: "AgentVault";
169
+ }];
170
+ };
171
+ readonly relations: readonly ["pending_policy"];
172
+ }, {
173
+ readonly name: "pending_policy";
174
+ readonly writable: true;
175
+ readonly pda: {
176
+ readonly seeds: readonly [{
177
+ readonly kind: "const";
178
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
179
+ }, {
180
+ readonly kind: "account";
181
+ readonly path: "vault";
182
+ }];
183
+ };
184
+ }];
185
+ readonly args: readonly [];
186
+ }, {
10
187
  readonly name: "close_vault";
11
188
  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
189
  readonly discriminator: readonly [141, 103, 17, 126, 72, 75, 29, 29];
@@ -143,7 +320,7 @@ export declare const IDL: {
143
320
  }];
144
321
  }, {
145
322
  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)."];
323
+ 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
324
  readonly discriminator: readonly [34, 148, 144, 47, 37, 130, 206, 161];
148
325
  readonly accounts: readonly [{
149
326
  readonly name: "payer";
@@ -192,7 +369,7 @@ export declare const IDL: {
192
369
  };
193
370
  }, {
194
371
  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."];
372
+ 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
373
  readonly writable: true;
197
374
  readonly pda: {
198
375
  readonly seeds: readonly [{
@@ -205,6 +382,10 @@ export declare const IDL: {
205
382
  readonly kind: "account";
206
383
  readonly path: "session.agent";
207
384
  readonly account: "SessionAuthority";
385
+ }, {
386
+ readonly kind: "account";
387
+ readonly path: "session.authorized_token";
388
+ readonly account: "SessionAuthority";
208
389
  }];
209
390
  };
210
391
  }, {
@@ -213,7 +394,7 @@ export declare const IDL: {
213
394
  readonly writable: true;
214
395
  }, {
215
396
  readonly name: "vault_token_account";
216
- readonly docs: readonly ["Vault's PDA token account for the session's token (fee source)"];
397
+ readonly docs: readonly ["Vault's PDA token account for the session's token (fee source + delegation revocation)"];
217
398
  readonly writable: true;
218
399
  readonly optional: true;
219
400
  }, {
@@ -239,7 +420,7 @@ export declare const IDL: {
239
420
  }];
240
421
  }, {
241
422
  readonly name: "initialize_vault";
242
- readonly docs: readonly ["Initialize a new agent vault with policy configuration.", "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA."];
423
+ readonly docs: readonly ["Initialize a new agent vault with policy configuration.", "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA.", "`tracker_tier`: 0 = Standard (200 entries), 1 = Pro (500), 2 = Max (1000)."];
243
424
  readonly discriminator: readonly [48, 191, 163, 44, 71, 129, 63, 164];
244
425
  readonly accounts: readonly [{
245
426
  readonly name: "owner";
@@ -295,15 +476,19 @@ export declare const IDL: {
295
476
  readonly name: "vault_id";
296
477
  readonly type: "u64";
297
478
  }, {
298
- readonly name: "daily_spending_cap";
479
+ readonly name: "daily_spending_cap_usd";
299
480
  readonly type: "u64";
300
481
  }, {
301
- readonly name: "max_transaction_size";
482
+ readonly name: "max_transaction_size_usd";
302
483
  readonly type: "u64";
303
484
  }, {
304
485
  readonly name: "allowed_tokens";
305
486
  readonly type: {
306
- readonly vec: "pubkey";
487
+ readonly vec: {
488
+ readonly defined: {
489
+ readonly name: "AllowedToken";
490
+ };
491
+ };
307
492
  };
308
493
  }, {
309
494
  readonly name: "allowed_protocols";
@@ -314,11 +499,135 @@ export declare const IDL: {
314
499
  readonly name: "max_leverage_bps";
315
500
  readonly type: "u16";
316
501
  }, {
317
- readonly name: "max_concurrent_positions";
318
- readonly type: "u8";
502
+ readonly name: "max_concurrent_positions";
503
+ readonly type: "u8";
504
+ }, {
505
+ readonly name: "developer_fee_rate";
506
+ readonly type: "u16";
507
+ }, {
508
+ readonly name: "timelock_duration";
509
+ readonly type: "u64";
510
+ }, {
511
+ readonly name: "allowed_destinations";
512
+ readonly type: {
513
+ readonly vec: "pubkey";
514
+ };
515
+ }, {
516
+ readonly name: "tracker_tier";
517
+ readonly type: "u8";
518
+ }];
519
+ }, {
520
+ readonly name: "queue_policy_update";
521
+ readonly docs: readonly ["Queue a policy update when timelock is active.", "Creates a PendingPolicyUpdate PDA that becomes executable after", "the timelock period expires."];
522
+ readonly discriminator: readonly [149, 18, 76, 197, 179, 193, 91, 77];
523
+ readonly accounts: readonly [{
524
+ readonly name: "owner";
525
+ readonly writable: true;
526
+ readonly signer: true;
527
+ readonly relations: readonly ["vault"];
528
+ }, {
529
+ readonly name: "vault";
530
+ readonly pda: {
531
+ readonly seeds: readonly [{
532
+ readonly kind: "const";
533
+ readonly value: readonly [118, 97, 117, 108, 116];
534
+ }, {
535
+ readonly kind: "account";
536
+ readonly path: "owner";
537
+ }, {
538
+ readonly kind: "account";
539
+ readonly path: "vault.vault_id";
540
+ readonly account: "AgentVault";
541
+ }];
542
+ };
543
+ readonly relations: readonly ["policy"];
544
+ }, {
545
+ readonly name: "policy";
546
+ readonly pda: {
547
+ readonly seeds: readonly [{
548
+ readonly kind: "const";
549
+ readonly value: readonly [112, 111, 108, 105, 99, 121];
550
+ }, {
551
+ readonly kind: "account";
552
+ readonly path: "vault";
553
+ }];
554
+ };
555
+ }, {
556
+ readonly name: "pending_policy";
557
+ readonly writable: true;
558
+ readonly pda: {
559
+ readonly seeds: readonly [{
560
+ readonly kind: "const";
561
+ readonly value: readonly [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
562
+ }, {
563
+ readonly kind: "account";
564
+ readonly path: "vault";
565
+ }];
566
+ };
567
+ }, {
568
+ readonly name: "system_program";
569
+ readonly address: "11111111111111111111111111111111";
570
+ }];
571
+ readonly args: readonly [{
572
+ readonly name: "daily_spending_cap_usd";
573
+ readonly type: {
574
+ readonly option: "u64";
575
+ };
576
+ }, {
577
+ readonly name: "max_transaction_amount_usd";
578
+ readonly type: {
579
+ readonly option: "u64";
580
+ };
581
+ }, {
582
+ readonly name: "allowed_tokens";
583
+ readonly type: {
584
+ readonly option: {
585
+ readonly vec: {
586
+ readonly defined: {
587
+ readonly name: "AllowedToken";
588
+ };
589
+ };
590
+ };
591
+ };
592
+ }, {
593
+ readonly name: "allowed_protocols";
594
+ readonly type: {
595
+ readonly option: {
596
+ readonly vec: "pubkey";
597
+ };
598
+ };
599
+ }, {
600
+ readonly name: "max_leverage_bps";
601
+ readonly type: {
602
+ readonly option: "u16";
603
+ };
604
+ }, {
605
+ readonly name: "can_open_positions";
606
+ readonly type: {
607
+ readonly option: "bool";
608
+ };
609
+ }, {
610
+ readonly name: "max_concurrent_positions";
611
+ readonly type: {
612
+ readonly option: "u8";
613
+ };
614
+ }, {
615
+ readonly name: "developer_fee_rate";
616
+ readonly type: {
617
+ readonly option: "u16";
618
+ };
619
+ }, {
620
+ readonly name: "timelock_duration";
621
+ readonly type: {
622
+ readonly option: "u64";
623
+ };
319
624
  }, {
320
- readonly name: "developer_fee_rate";
321
- readonly type: "u16";
625
+ readonly name: "allowed_destinations";
626
+ readonly type: {
627
+ readonly option: {
628
+ readonly vec: "pubkey";
629
+ };
630
+ };
322
631
  }];
323
632
  }, {
324
633
  readonly name: "reactivate_vault";
@@ -408,7 +717,7 @@ export declare const IDL: {
408
717
  readonly args: readonly [];
409
718
  }, {
410
719
  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."];
720
+ 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
721
  readonly discriminator: readonly [212, 245, 246, 7, 163, 151, 18, 57];
413
722
  readonly accounts: readonly [{
414
723
  readonly name: "owner";
@@ -429,7 +738,7 @@ export declare const IDL: {
429
738
  readonly account: "AgentVault";
430
739
  }];
431
740
  };
432
- readonly relations: readonly ["policy"];
741
+ readonly relations: readonly ["policy", "tracker"];
433
742
  }, {
434
743
  readonly name: "policy";
435
744
  readonly writable: true;
@@ -442,14 +751,26 @@ export declare const IDL: {
442
751
  readonly path: "vault";
443
752
  }];
444
753
  };
754
+ }, {
755
+ readonly name: "tracker";
756
+ readonly writable: true;
757
+ readonly pda: {
758
+ readonly seeds: readonly [{
759
+ readonly kind: "const";
760
+ readonly value: readonly [116, 114, 97, 99, 107, 101, 114];
761
+ }, {
762
+ readonly kind: "account";
763
+ readonly path: "vault";
764
+ }];
765
+ };
445
766
  }];
446
767
  readonly args: readonly [{
447
- readonly name: "daily_spending_cap";
768
+ readonly name: "daily_spending_cap_usd";
448
769
  readonly type: {
449
770
  readonly option: "u64";
450
771
  };
451
772
  }, {
452
- readonly name: "max_transaction_size";
773
+ readonly name: "max_transaction_size_usd";
453
774
  readonly type: {
454
775
  readonly option: "u64";
455
776
  };
@@ -457,7 +778,11 @@ export declare const IDL: {
457
778
  readonly name: "allowed_tokens";
458
779
  readonly type: {
459
780
  readonly option: {
460
- readonly vec: "pubkey";
781
+ readonly vec: {
782
+ readonly defined: {
783
+ readonly name: "AllowedToken";
784
+ };
785
+ };
461
786
  };
462
787
  };
463
788
  }, {
@@ -487,10 +812,22 @@ export declare const IDL: {
487
812
  readonly type: {
488
813
  readonly option: "u16";
489
814
  };
815
+ }, {
816
+ readonly name: "timelock_duration";
817
+ readonly type: {
818
+ readonly option: "u64";
819
+ };
820
+ }, {
821
+ readonly name: "allowed_destinations";
822
+ readonly type: {
823
+ readonly option: {
824
+ readonly vec: "pubkey";
825
+ };
826
+ };
490
827
  }];
491
828
  }, {
492
829
  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)."];
830
+ 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
831
  readonly discriminator: readonly [22, 183, 48, 222, 218, 11, 197, 152];
495
832
  readonly accounts: readonly [{
496
833
  readonly name: "agent";
@@ -539,7 +876,7 @@ export declare const IDL: {
539
876
  };
540
877
  }, {
541
878
  readonly name: "session";
542
- readonly docs: readonly ["Ephemeral session PDA — `init` ensures no double-authorization"];
879
+ readonly docs: readonly ["Ephemeral session PDA — `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
543
880
  readonly writable: true;
544
881
  readonly pda: {
545
882
  readonly seeds: readonly [{
@@ -551,8 +888,21 @@ export declare const IDL: {
551
888
  }, {
552
889
  readonly kind: "account";
553
890
  readonly path: "agent";
891
+ }, {
892
+ readonly kind: "arg";
893
+ readonly path: "token_mint";
554
894
  }];
555
895
  };
896
+ }, {
897
+ readonly name: "vault_token_account";
898
+ readonly docs: readonly ["Vault's PDA-owned token account for the spend token (delegation source)"];
899
+ readonly writable: true;
900
+ }, {
901
+ readonly name: "token_mint_account";
902
+ readonly docs: readonly ["The token mint being spent"];
903
+ }, {
904
+ readonly name: "token_program";
905
+ readonly address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
556
906
  }, {
557
907
  readonly name: "system_program";
558
908
  readonly address: "11111111111111111111111111111111";
@@ -657,6 +1007,9 @@ export declare const IDL: {
657
1007
  readonly accounts: readonly [{
658
1008
  readonly name: "AgentVault";
659
1009
  readonly discriminator: readonly [232, 220, 237, 164, 157, 9, 215, 194];
1010
+ }, {
1011
+ readonly name: "PendingPolicyUpdate";
1012
+ readonly discriminator: readonly [77, 255, 2, 51, 79, 237, 183, 239];
660
1013
  }, {
661
1014
  readonly name: "PolicyConfig";
662
1015
  readonly discriminator: readonly [219, 7, 79, 84, 175, 51, 148, 146];
@@ -679,6 +1032,12 @@ export declare const IDL: {
679
1032
  }, {
680
1033
  readonly name: "AgentRevoked";
681
1034
  readonly discriminator: readonly [12, 251, 249, 166, 122, 83, 162, 116];
1035
+ }, {
1036
+ readonly name: "AgentTransferExecuted";
1037
+ readonly discriminator: readonly [88, 52, 117, 69, 112, 152, 167, 40];
1038
+ }, {
1039
+ readonly name: "DelegationRevoked";
1040
+ readonly discriminator: readonly [59, 158, 142, 49, 164, 116, 220, 8];
682
1041
  }, {
683
1042
  readonly name: "FeesCollected";
684
1043
  readonly discriminator: readonly [233, 23, 117, 225, 107, 178, 254, 8];
@@ -688,6 +1047,15 @@ export declare const IDL: {
688
1047
  }, {
689
1048
  readonly name: "FundsWithdrawn";
690
1049
  readonly discriminator: readonly [56, 130, 230, 154, 35, 92, 11, 118];
1050
+ }, {
1051
+ readonly name: "PolicyChangeApplied";
1052
+ readonly discriminator: readonly [104, 89, 5, 100, 180, 202, 52, 73];
1053
+ }, {
1054
+ readonly name: "PolicyChangeCancelled";
1055
+ readonly discriminator: readonly [200, 158, 226, 255, 25, 211, 30, 151];
1056
+ }, {
1057
+ readonly name: "PolicyChangeQueued";
1058
+ readonly discriminator: readonly [73, 231, 182, 136, 141, 120, 32, 79];
691
1059
  }, {
692
1060
  readonly name: "PolicyUpdated";
693
1061
  readonly discriminator: readonly [225, 112, 112, 67, 95, 236, 245, 161];
@@ -816,6 +1184,78 @@ export declare const IDL: {
816
1184
  readonly code: 6027;
817
1185
  readonly name: "Overflow";
818
1186
  readonly msg: "Arithmetic overflow";
1187
+ }, {
1188
+ readonly code: 6028;
1189
+ readonly name: "DelegationFailed";
1190
+ readonly msg: "Token delegation approval failed";
1191
+ }, {
1192
+ readonly code: 6029;
1193
+ readonly name: "RevocationFailed";
1194
+ readonly msg: "Token delegation revocation failed";
1195
+ }, {
1196
+ readonly code: 6030;
1197
+ readonly name: "OracleFeedStale";
1198
+ readonly msg: "Oracle feed value is too stale";
1199
+ }, {
1200
+ readonly code: 6031;
1201
+ readonly name: "OracleFeedInvalid";
1202
+ readonly msg: "Cannot parse oracle feed data";
1203
+ }, {
1204
+ readonly code: 6032;
1205
+ readonly name: "TokenSpendBlocked";
1206
+ readonly msg: "Unpriced token cannot be spent (receive-only)";
1207
+ }, {
1208
+ readonly code: 6033;
1209
+ readonly name: "InvalidTokenAccount";
1210
+ readonly msg: "Token account does not belong to vault or has wrong mint";
1211
+ }, {
1212
+ readonly code: 6034;
1213
+ readonly name: "OracleAccountMissing";
1214
+ readonly msg: "Oracle-priced token requires feed account in remaining_accounts";
1215
+ }, {
1216
+ readonly code: 6035;
1217
+ readonly name: "PerTokenCapExceeded";
1218
+ readonly msg: "Per-token daily spending cap would be exceeded";
1219
+ }, {
1220
+ readonly code: 6036;
1221
+ readonly name: "PerTokenTxLimitExceeded";
1222
+ readonly msg: "Per-token single transaction limit exceeded";
1223
+ }, {
1224
+ readonly code: 6037;
1225
+ readonly name: "OracleConfidenceTooWide";
1226
+ readonly msg: "Oracle price confidence interval too wide";
1227
+ }, {
1228
+ readonly code: 6038;
1229
+ readonly name: "OracleUnsupportedType";
1230
+ readonly msg: "Oracle account owner is not a recognized oracle program";
1231
+ }, {
1232
+ readonly code: 6039;
1233
+ readonly name: "OracleNotVerified";
1234
+ readonly msg: "Pyth price update not fully verified by Wormhole";
1235
+ }, {
1236
+ readonly code: 6040;
1237
+ readonly name: "TimelockNotExpired";
1238
+ readonly msg: "Timelock period has not expired yet";
1239
+ }, {
1240
+ readonly code: 6041;
1241
+ readonly name: "TimelockActive";
1242
+ readonly msg: "Vault has timelock active — use queue_policy_update instead";
1243
+ }, {
1244
+ readonly code: 6042;
1245
+ readonly name: "NoTimelockConfigured";
1246
+ readonly msg: "No timelock configured on this vault";
1247
+ }, {
1248
+ readonly code: 6043;
1249
+ readonly name: "DestinationNotAllowed";
1250
+ readonly msg: "Destination not in allowed list";
1251
+ }, {
1252
+ readonly code: 6044;
1253
+ readonly name: "TooManyDestinations";
1254
+ readonly msg: "Too many destinations (max 10)";
1255
+ }, {
1256
+ readonly code: 6045;
1257
+ readonly name: "InvalidTrackerTier";
1258
+ readonly msg: "Invalid tracker tier (must be 0, 1, or 2)";
819
1259
  }];
820
1260
  readonly types: readonly [{
821
1261
  readonly name: "ActionAuthorized";
@@ -840,15 +1280,31 @@ export declare const IDL: {
840
1280
  }, {
841
1281
  readonly name: "amount";
842
1282
  readonly type: "u64";
1283
+ }, {
1284
+ readonly name: "usd_amount";
1285
+ readonly type: "u64";
843
1286
  }, {
844
1287
  readonly name: "protocol";
845
1288
  readonly type: "pubkey";
846
1289
  }, {
847
- readonly name: "rolling_spend_after";
1290
+ readonly name: "rolling_spend_usd_after";
848
1291
  readonly type: "u64";
849
1292
  }, {
850
- readonly name: "daily_cap";
1293
+ readonly name: "daily_cap_usd";
851
1294
  readonly type: "u64";
1295
+ }, {
1296
+ readonly name: "delegated";
1297
+ readonly type: "bool";
1298
+ }, {
1299
+ readonly name: "oracle_price";
1300
+ readonly type: {
1301
+ readonly option: "i128";
1302
+ };
1303
+ }, {
1304
+ readonly name: "oracle_source";
1305
+ readonly type: {
1306
+ readonly option: "u8";
1307
+ };
852
1308
  }, {
853
1309
  readonly name: "timestamp";
854
1310
  readonly type: "i64";
@@ -891,6 +1347,8 @@ export declare const IDL: {
891
1347
  readonly name: "Deposit";
892
1348
  }, {
893
1349
  readonly name: "Withdraw";
1350
+ }, {
1351
+ readonly name: "Transfer";
894
1352
  }];
895
1353
  };
896
1354
  }, {
@@ -923,6 +1381,24 @@ export declare const IDL: {
923
1381
  readonly type: "i64";
924
1382
  }];
925
1383
  };
1384
+ }, {
1385
+ readonly name: "AgentTransferExecuted";
1386
+ readonly type: {
1387
+ readonly kind: "struct";
1388
+ readonly fields: readonly [{
1389
+ readonly name: "vault";
1390
+ readonly type: "pubkey";
1391
+ }, {
1392
+ readonly name: "destination";
1393
+ readonly type: "pubkey";
1394
+ }, {
1395
+ readonly name: "amount";
1396
+ readonly type: "u64";
1397
+ }, {
1398
+ readonly name: "mint";
1399
+ readonly type: "pubkey";
1400
+ }];
1401
+ };
926
1402
  }, {
927
1403
  readonly name: "AgentVault";
928
1404
  readonly type: {
@@ -937,7 +1413,7 @@ export declare const IDL: {
937
1413
  readonly type: "pubkey";
938
1414
  }, {
939
1415
  readonly name: "fee_destination";
940
- readonly docs: readonly ["Developer fee destination — the wallet that receives developer fees", "on every finalized transaction. Set at vault creation, immutable after", "initialization. Protocol fees go to PROTOCOL_TREASURY separately."];
1416
+ readonly docs: readonly ["Developer fee destination — the wallet that receives developer fees", "on every finalized transaction. IMMUTABLE after initialization — only", "`initialize_vault` writes this field. This prevents a compromised owner", "key from redirecting fees. Protocol fees go to PROTOCOL_TREASURY separately."];
941
1417
  readonly type: "pubkey";
942
1418
  }, {
943
1419
  readonly name: "vault_id";
@@ -975,6 +1451,56 @@ export declare const IDL: {
975
1451
  readonly name: "total_fees_collected";
976
1452
  readonly docs: readonly ["Cumulative developer fees collected from this vault (token base units).", "Protocol fees are tracked separately via events."];
977
1453
  readonly type: "u64";
1454
+ }, {
1455
+ readonly name: "tracker_tier";
1456
+ readonly docs: readonly ["Tracker capacity tier chosen at vault creation"];
1457
+ readonly type: {
1458
+ readonly defined: {
1459
+ readonly name: "TrackerTier";
1460
+ };
1461
+ };
1462
+ }];
1463
+ };
1464
+ }, {
1465
+ readonly name: "AllowedToken";
1466
+ 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)"];
1467
+ readonly type: {
1468
+ readonly kind: "struct";
1469
+ readonly fields: readonly [{
1470
+ readonly name: "mint";
1471
+ readonly docs: readonly ["Token mint address"];
1472
+ readonly type: "pubkey";
1473
+ }, {
1474
+ readonly name: "oracle_feed";
1475
+ 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)."];
1476
+ readonly type: "pubkey";
1477
+ }, {
1478
+ readonly name: "decimals";
1479
+ readonly docs: readonly ["Token decimals (e.g., 6 for USDC, 9 for SOL)"];
1480
+ readonly type: "u8";
1481
+ }, {
1482
+ readonly name: "daily_cap_base";
1483
+ readonly docs: readonly ["Per-token daily cap in base units (0 = no per-token limit,", "only the aggregate USD cap applies)"];
1484
+ readonly type: "u64";
1485
+ }, {
1486
+ readonly name: "max_tx_base";
1487
+ readonly docs: readonly ["Per-token max single transaction in base units", "(0 = no per-token tx limit, only USD tx limit applies)"];
1488
+ readonly type: "u64";
1489
+ }];
1490
+ };
1491
+ }, {
1492
+ readonly name: "DelegationRevoked";
1493
+ readonly type: {
1494
+ readonly kind: "struct";
1495
+ readonly fields: readonly [{
1496
+ readonly name: "vault";
1497
+ readonly type: "pubkey";
1498
+ }, {
1499
+ readonly name: "token_account";
1500
+ readonly type: "pubkey";
1501
+ }, {
1502
+ readonly name: "timestamp";
1503
+ readonly type: "i64";
978
1504
  }];
979
1505
  };
980
1506
  }, {
@@ -1055,6 +1581,122 @@ export declare const IDL: {
1055
1581
  readonly type: "i64";
1056
1582
  }];
1057
1583
  };
1584
+ }, {
1585
+ readonly name: "PendingPolicyUpdate";
1586
+ 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()]`"];
1587
+ readonly type: {
1588
+ readonly kind: "struct";
1589
+ readonly fields: readonly [{
1590
+ readonly name: "vault";
1591
+ readonly docs: readonly ["Associated vault pubkey"];
1592
+ readonly type: "pubkey";
1593
+ }, {
1594
+ readonly name: "queued_at";
1595
+ readonly docs: readonly ["Unix timestamp when this update was queued"];
1596
+ readonly type: "i64";
1597
+ }, {
1598
+ readonly name: "executes_at";
1599
+ readonly docs: readonly ["Unix timestamp when this update becomes executable"];
1600
+ readonly type: "i64";
1601
+ }, {
1602
+ readonly name: "daily_spending_cap_usd";
1603
+ readonly type: {
1604
+ readonly option: "u64";
1605
+ };
1606
+ }, {
1607
+ readonly name: "max_transaction_amount_usd";
1608
+ readonly type: {
1609
+ readonly option: "u64";
1610
+ };
1611
+ }, {
1612
+ readonly name: "allowed_tokens";
1613
+ readonly type: {
1614
+ readonly option: {
1615
+ readonly vec: {
1616
+ readonly defined: {
1617
+ readonly name: "AllowedToken";
1618
+ };
1619
+ };
1620
+ };
1621
+ };
1622
+ }, {
1623
+ readonly name: "allowed_protocols";
1624
+ readonly type: {
1625
+ readonly option: {
1626
+ readonly vec: "pubkey";
1627
+ };
1628
+ };
1629
+ }, {
1630
+ readonly name: "max_leverage_bps";
1631
+ readonly type: {
1632
+ readonly option: "u16";
1633
+ };
1634
+ }, {
1635
+ readonly name: "can_open_positions";
1636
+ readonly type: {
1637
+ readonly option: "bool";
1638
+ };
1639
+ }, {
1640
+ readonly name: "max_concurrent_positions";
1641
+ readonly type: {
1642
+ readonly option: "u8";
1643
+ };
1644
+ }, {
1645
+ readonly name: "developer_fee_rate";
1646
+ readonly type: {
1647
+ readonly option: "u16";
1648
+ };
1649
+ }, {
1650
+ readonly name: "timelock_duration";
1651
+ readonly type: {
1652
+ readonly option: "u64";
1653
+ };
1654
+ }, {
1655
+ readonly name: "allowed_destinations";
1656
+ readonly type: {
1657
+ readonly option: {
1658
+ readonly vec: "pubkey";
1659
+ };
1660
+ };
1661
+ }, {
1662
+ readonly name: "bump";
1663
+ readonly docs: readonly ["Bump seed for PDA"];
1664
+ readonly type: "u8";
1665
+ }];
1666
+ };
1667
+ }, {
1668
+ readonly name: "PolicyChangeApplied";
1669
+ readonly type: {
1670
+ readonly kind: "struct";
1671
+ readonly fields: readonly [{
1672
+ readonly name: "vault";
1673
+ readonly type: "pubkey";
1674
+ }, {
1675
+ readonly name: "applied_at";
1676
+ readonly type: "i64";
1677
+ }];
1678
+ };
1679
+ }, {
1680
+ readonly name: "PolicyChangeCancelled";
1681
+ readonly type: {
1682
+ readonly kind: "struct";
1683
+ readonly fields: readonly [{
1684
+ readonly name: "vault";
1685
+ readonly type: "pubkey";
1686
+ }];
1687
+ };
1688
+ }, {
1689
+ readonly name: "PolicyChangeQueued";
1690
+ readonly type: {
1691
+ readonly kind: "struct";
1692
+ readonly fields: readonly [{
1693
+ readonly name: "vault";
1694
+ readonly type: "pubkey";
1695
+ }, {
1696
+ readonly name: "executes_at";
1697
+ readonly type: "i64";
1698
+ }];
1699
+ };
1058
1700
  }, {
1059
1701
  readonly name: "PolicyConfig";
1060
1702
  readonly type: {
@@ -1064,18 +1706,22 @@ export declare const IDL: {
1064
1706
  readonly docs: readonly ["Associated vault pubkey"];
1065
1707
  readonly type: "pubkey";
1066
1708
  }, {
1067
- readonly name: "daily_spending_cap";
1068
- readonly docs: readonly ["Maximum spend per rolling 24h period (in token base units)"];
1709
+ readonly name: "daily_spending_cap_usd";
1710
+ 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
1711
  readonly type: "u64";
1070
1712
  }, {
1071
- readonly name: "max_transaction_size";
1072
- readonly docs: readonly ["Maximum single transaction size (in token base units)"];
1713
+ readonly name: "max_transaction_size_usd";
1714
+ readonly docs: readonly ["Maximum single transaction size in USD (6 decimals)."];
1073
1715
  readonly type: "u64";
1074
1716
  }, {
1075
1717
  readonly name: "allowed_tokens";
1076
- readonly docs: readonly ["Allowed token mints the agent can interact with", "Bounded to MAX_ALLOWED_TOKENS entries"];
1718
+ readonly docs: readonly ["Allowed token mints with oracle feeds and per-token caps.", "Bounded to MAX_ALLOWED_TOKENS entries."];
1077
1719
  readonly type: {
1078
- readonly vec: "pubkey";
1720
+ readonly vec: {
1721
+ readonly defined: {
1722
+ readonly name: "AllowedToken";
1723
+ };
1724
+ };
1079
1725
  };
1080
1726
  }, {
1081
1727
  readonly name: "allowed_protocols";
@@ -1099,6 +1745,16 @@ export declare const IDL: {
1099
1745
  readonly name: "developer_fee_rate";
1100
1746
  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
1747
  readonly type: "u16";
1748
+ }, {
1749
+ readonly name: "timelock_duration";
1750
+ 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."];
1751
+ readonly type: "u64";
1752
+ }, {
1753
+ readonly name: "allowed_destinations";
1754
+ readonly docs: readonly ["Allowed destination addresses for agent transfers.", "Empty = any destination allowed. Bounded to MAX_ALLOWED_DESTINATIONS."];
1755
+ readonly type: {
1756
+ readonly vec: "pubkey";
1757
+ };
1102
1758
  }, {
1103
1759
  readonly name: "bump";
1104
1760
  readonly docs: readonly ["Bump seed for PDA"];
@@ -1113,10 +1769,10 @@ export declare const IDL: {
1113
1769
  readonly name: "vault";
1114
1770
  readonly type: "pubkey";
1115
1771
  }, {
1116
- readonly name: "daily_cap";
1772
+ readonly name: "daily_cap_usd";
1117
1773
  readonly type: "u64";
1118
1774
  }, {
1119
- readonly name: "max_transaction_size";
1775
+ readonly name: "max_transaction_size_usd";
1120
1776
  readonly type: "u64";
1121
1777
  }, {
1122
1778
  readonly name: "allowed_tokens_count";
@@ -1173,6 +1829,14 @@ export declare const IDL: {
1173
1829
  readonly name: "expires_at_slot";
1174
1830
  readonly docs: readonly ["Slot-based expiry: session is valid until this slot"];
1175
1831
  readonly type: "u64";
1832
+ }, {
1833
+ readonly name: "delegated";
1834
+ readonly docs: readonly ["Whether token delegation was set up (approve CPI)"];
1835
+ readonly type: "bool";
1836
+ }, {
1837
+ readonly name: "delegation_token_account";
1838
+ readonly docs: readonly ["The vault's token account that was delegated to the agent", "(only meaningful when delegated == true)"];
1839
+ readonly type: "pubkey";
1176
1840
  }, {
1177
1841
  readonly name: "bump";
1178
1842
  readonly docs: readonly ["Bump seed for PDA"];
@@ -1192,6 +1856,9 @@ export declare const IDL: {
1192
1856
  }, {
1193
1857
  readonly name: "success";
1194
1858
  readonly type: "bool";
1859
+ }, {
1860
+ readonly name: "is_expired";
1861
+ readonly type: "bool";
1195
1862
  }, {
1196
1863
  readonly name: "timestamp";
1197
1864
  readonly type: "i64";
@@ -1202,10 +1869,16 @@ export declare const IDL: {
1202
1869
  readonly type: {
1203
1870
  readonly kind: "struct";
1204
1871
  readonly fields: readonly [{
1205
- readonly name: "token_mint";
1206
- readonly type: "pubkey";
1872
+ readonly name: "token_index";
1873
+ readonly docs: readonly ["Index into PolicyConfig.allowed_tokens[] (0-9).", "Compact representation — avoids storing full 32-byte Pubkey per entry.", "Invalidated when token list changes (rolling_spends is cleared)."];
1874
+ readonly type: "u8";
1207
1875
  }, {
1208
- readonly name: "amount_spent";
1876
+ readonly name: "usd_amount";
1877
+ readonly docs: readonly ["USD value of this spend (6 decimals, e.g., $500 = 500_000_000)"];
1878
+ readonly type: "u64";
1879
+ }, {
1880
+ readonly name: "base_amount";
1881
+ readonly docs: readonly ["Original amount in token base units (for per-token cap checks)"];
1209
1882
  readonly type: "u64";
1210
1883
  }, {
1211
1884
  readonly name: "timestamp";
@@ -1220,9 +1893,21 @@ export declare const IDL: {
1220
1893
  readonly name: "vault";
1221
1894
  readonly docs: readonly ["Associated vault pubkey"];
1222
1895
  readonly type: "pubkey";
1896
+ }, {
1897
+ readonly name: "tracker_tier";
1898
+ readonly docs: readonly ["Tracker capacity tier (Standard/Pro/Max)"];
1899
+ readonly type: {
1900
+ readonly defined: {
1901
+ readonly name: "TrackerTier";
1902
+ };
1903
+ };
1904
+ }, {
1905
+ readonly name: "max_spend_entries";
1906
+ readonly docs: readonly ["Maximum spend entries for this tracker (derived from tier at init)"];
1907
+ readonly type: "u32";
1223
1908
  }, {
1224
1909
  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"];
1910
+ 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
1911
  readonly type: {
1227
1912
  readonly vec: {
1228
1913
  readonly defined: {
@@ -1246,6 +1931,19 @@ export declare const IDL: {
1246
1931
  readonly type: "u8";
1247
1932
  }];
1248
1933
  };
1934
+ }, {
1935
+ readonly name: "TrackerTier";
1936
+ readonly docs: readonly ["Tracker capacity tiers — chosen at vault creation, determines", "max rolling spend entries and SpendTracker account size."];
1937
+ readonly type: {
1938
+ readonly kind: "enum";
1939
+ readonly variants: readonly [{
1940
+ readonly name: "Standard";
1941
+ }, {
1942
+ readonly name: "Pro";
1943
+ }, {
1944
+ readonly name: "Max";
1945
+ }];
1946
+ };
1249
1947
  }, {
1250
1948
  readonly name: "TransactionRecord";
1251
1949
  readonly type: {