@agent-shield/sdk 0.1.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 (41) hide show
  1. package/dist/accounts.d.ts +15 -0
  2. package/dist/accounts.d.ts.map +1 -0
  3. package/dist/accounts.js +59 -0
  4. package/dist/accounts.js.map +1 -0
  5. package/dist/client.d.ts +85 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +233 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/composer.d.ts +21 -0
  10. package/dist/composer.d.ts.map +1 -0
  11. package/dist/composer.js +51 -0
  12. package/dist/composer.js.map +1 -0
  13. package/dist/idl-json.d.ts +1299 -0
  14. package/dist/idl-json.d.ts.map +1 -0
  15. package/dist/idl-json.js +2486 -0
  16. package/dist/idl-json.js.map +1 -0
  17. package/dist/idl.d.ts +2475 -0
  18. package/dist/idl.d.ts.map +1 -0
  19. package/dist/idl.js +3 -0
  20. package/dist/idl.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +63 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/instructions.d.ts +1130 -0
  26. package/dist/instructions.d.ts.map +1 -0
  27. package/dist/instructions.js +127 -0
  28. package/dist/instructions.js.map +1 -0
  29. package/dist/integrations/flash-trade.d.ts +130 -0
  30. package/dist/integrations/flash-trade.d.ts.map +1 -0
  31. package/dist/integrations/flash-trade.js +170 -0
  32. package/dist/integrations/flash-trade.js.map +1 -0
  33. package/dist/integrations/jupiter.d.ts +131 -0
  34. package/dist/integrations/jupiter.d.ts.map +1 -0
  35. package/dist/integrations/jupiter.js +178 -0
  36. package/dist/integrations/jupiter.js.map +1 -0
  37. package/dist/types.d.ts +129 -0
  38. package/dist/types.d.ts.map +1 -0
  39. package/dist/types.js +6 -0
  40. package/dist/types.js.map +1 -0
  41. package/package.json +36 -0
package/dist/idl.d.ts ADDED
@@ -0,0 +1,2475 @@
1
+ /**
2
+ * Program IDL in camelCase format in order to be used in JS/TS.
3
+ *
4
+ * Note that this is only a type helper and is not the actual IDL. The original
5
+ * IDL can be found at `target/idl/agent_shield.json`.
6
+ */
7
+ export type AgentShield = {
8
+ "address": "4ZeVCqnjUgUtFrHHPG7jELUxvJeoVGHhGNgPrhBPwrHL";
9
+ "metadata": {
10
+ "name": "agentShield";
11
+ "version": "0.1.0";
12
+ "spec": "0.1.0";
13
+ "description": "AI Agent Financial Middleware for Solana - Permission controls, spending limits, and audit infrastructure for autonomous agents";
14
+ };
15
+ "instructions": [
16
+ {
17
+ "name": "closeVault";
18
+ "docs": [
19
+ "Close the vault entirely. Withdraws all remaining funds and closes all PDAs.",
20
+ "Reclaims rent. Vault must have no open positions. Only the owner can call this."
21
+ ];
22
+ "discriminator": [
23
+ 141,
24
+ 103,
25
+ 17,
26
+ 126,
27
+ 72,
28
+ 75,
29
+ 29,
30
+ 29
31
+ ];
32
+ "accounts": [
33
+ {
34
+ "name": "owner";
35
+ "writable": true;
36
+ "signer": true;
37
+ "relations": [
38
+ "vault"
39
+ ];
40
+ },
41
+ {
42
+ "name": "vault";
43
+ "writable": true;
44
+ "pda": {
45
+ "seeds": [
46
+ {
47
+ "kind": "const";
48
+ "value": [
49
+ 118,
50
+ 97,
51
+ 117,
52
+ 108,
53
+ 116
54
+ ];
55
+ },
56
+ {
57
+ "kind": "account";
58
+ "path": "owner";
59
+ },
60
+ {
61
+ "kind": "account";
62
+ "path": "vault.vault_id";
63
+ "account": "agentVault";
64
+ }
65
+ ];
66
+ };
67
+ "relations": [
68
+ "policy",
69
+ "tracker"
70
+ ];
71
+ },
72
+ {
73
+ "name": "policy";
74
+ "writable": true;
75
+ "pda": {
76
+ "seeds": [
77
+ {
78
+ "kind": "const";
79
+ "value": [
80
+ 112,
81
+ 111,
82
+ 108,
83
+ 105,
84
+ 99,
85
+ 121
86
+ ];
87
+ },
88
+ {
89
+ "kind": "account";
90
+ "path": "vault";
91
+ }
92
+ ];
93
+ };
94
+ },
95
+ {
96
+ "name": "tracker";
97
+ "writable": true;
98
+ "pda": {
99
+ "seeds": [
100
+ {
101
+ "kind": "const";
102
+ "value": [
103
+ 116,
104
+ 114,
105
+ 97,
106
+ 99,
107
+ 107,
108
+ 101,
109
+ 114
110
+ ];
111
+ },
112
+ {
113
+ "kind": "account";
114
+ "path": "vault";
115
+ }
116
+ ];
117
+ };
118
+ },
119
+ {
120
+ "name": "systemProgram";
121
+ "address": "11111111111111111111111111111111";
122
+ }
123
+ ];
124
+ "args": [];
125
+ },
126
+ {
127
+ "name": "depositFunds";
128
+ "docs": [
129
+ "Deposit SPL tokens into the vault's PDA-controlled token account.",
130
+ "Only the owner can call this."
131
+ ];
132
+ "discriminator": [
133
+ 202,
134
+ 39,
135
+ 52,
136
+ 211,
137
+ 53,
138
+ 20,
139
+ 250,
140
+ 88
141
+ ];
142
+ "accounts": [
143
+ {
144
+ "name": "owner";
145
+ "writable": true;
146
+ "signer": true;
147
+ "relations": [
148
+ "vault"
149
+ ];
150
+ },
151
+ {
152
+ "name": "vault";
153
+ "pda": {
154
+ "seeds": [
155
+ {
156
+ "kind": "const";
157
+ "value": [
158
+ 118,
159
+ 97,
160
+ 117,
161
+ 108,
162
+ 116
163
+ ];
164
+ },
165
+ {
166
+ "kind": "account";
167
+ "path": "owner";
168
+ },
169
+ {
170
+ "kind": "account";
171
+ "path": "vault.vault_id";
172
+ "account": "agentVault";
173
+ }
174
+ ];
175
+ };
176
+ },
177
+ {
178
+ "name": "mint";
179
+ },
180
+ {
181
+ "name": "ownerTokenAccount";
182
+ "docs": [
183
+ "Owner's token account to transfer from"
184
+ ];
185
+ "writable": true;
186
+ "pda": {
187
+ "seeds": [
188
+ {
189
+ "kind": "account";
190
+ "path": "owner";
191
+ },
192
+ {
193
+ "kind": "const";
194
+ "value": [
195
+ 6,
196
+ 221,
197
+ 246,
198
+ 225,
199
+ 215,
200
+ 101,
201
+ 161,
202
+ 147,
203
+ 217,
204
+ 203,
205
+ 225,
206
+ 70,
207
+ 206,
208
+ 235,
209
+ 121,
210
+ 172,
211
+ 28,
212
+ 180,
213
+ 133,
214
+ 237,
215
+ 95,
216
+ 91,
217
+ 55,
218
+ 145,
219
+ 58,
220
+ 140,
221
+ 245,
222
+ 133,
223
+ 126,
224
+ 255,
225
+ 0,
226
+ 169
227
+ ];
228
+ },
229
+ {
230
+ "kind": "account";
231
+ "path": "mint";
232
+ }
233
+ ];
234
+ "program": {
235
+ "kind": "const";
236
+ "value": [
237
+ 140,
238
+ 151,
239
+ 37,
240
+ 143,
241
+ 78,
242
+ 36,
243
+ 137,
244
+ 241,
245
+ 187,
246
+ 61,
247
+ 16,
248
+ 41,
249
+ 20,
250
+ 142,
251
+ 13,
252
+ 131,
253
+ 11,
254
+ 90,
255
+ 19,
256
+ 153,
257
+ 218,
258
+ 255,
259
+ 16,
260
+ 132,
261
+ 4,
262
+ 142,
263
+ 123,
264
+ 216,
265
+ 219,
266
+ 233,
267
+ 248,
268
+ 89
269
+ ];
270
+ };
271
+ };
272
+ },
273
+ {
274
+ "name": "vaultTokenAccount";
275
+ "docs": [
276
+ "Vault's PDA-controlled token account"
277
+ ];
278
+ "writable": true;
279
+ "pda": {
280
+ "seeds": [
281
+ {
282
+ "kind": "account";
283
+ "path": "vault";
284
+ },
285
+ {
286
+ "kind": "const";
287
+ "value": [
288
+ 6,
289
+ 221,
290
+ 246,
291
+ 225,
292
+ 215,
293
+ 101,
294
+ 161,
295
+ 147,
296
+ 217,
297
+ 203,
298
+ 225,
299
+ 70,
300
+ 206,
301
+ 235,
302
+ 121,
303
+ 172,
304
+ 28,
305
+ 180,
306
+ 133,
307
+ 237,
308
+ 95,
309
+ 91,
310
+ 55,
311
+ 145,
312
+ 58,
313
+ 140,
314
+ 245,
315
+ 133,
316
+ 126,
317
+ 255,
318
+ 0,
319
+ 169
320
+ ];
321
+ },
322
+ {
323
+ "kind": "account";
324
+ "path": "mint";
325
+ }
326
+ ];
327
+ "program": {
328
+ "kind": "const";
329
+ "value": [
330
+ 140,
331
+ 151,
332
+ 37,
333
+ 143,
334
+ 78,
335
+ 36,
336
+ 137,
337
+ 241,
338
+ 187,
339
+ 61,
340
+ 16,
341
+ 41,
342
+ 20,
343
+ 142,
344
+ 13,
345
+ 131,
346
+ 11,
347
+ 90,
348
+ 19,
349
+ 153,
350
+ 218,
351
+ 255,
352
+ 16,
353
+ 132,
354
+ 4,
355
+ 142,
356
+ 123,
357
+ 216,
358
+ 219,
359
+ 233,
360
+ 248,
361
+ 89
362
+ ];
363
+ };
364
+ };
365
+ },
366
+ {
367
+ "name": "tokenProgram";
368
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
369
+ },
370
+ {
371
+ "name": "associatedTokenProgram";
372
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
373
+ },
374
+ {
375
+ "name": "systemProgram";
376
+ "address": "11111111111111111111111111111111";
377
+ }
378
+ ];
379
+ "args": [
380
+ {
381
+ "name": "amount";
382
+ "type": "u64";
383
+ }
384
+ ];
385
+ },
386
+ {
387
+ "name": "finalizeSession";
388
+ "docs": [
389
+ "Finalize a session after the DeFi action completes.",
390
+ "Closes the SessionAuthority PDA and records the transaction in the audit log.",
391
+ "Can be called by the agent or permissionlessly (for cleanup of expired sessions)."
392
+ ];
393
+ "discriminator": [
394
+ 34,
395
+ 148,
396
+ 144,
397
+ 47,
398
+ 37,
399
+ 130,
400
+ 206,
401
+ 161
402
+ ];
403
+ "accounts": [
404
+ {
405
+ "name": "payer";
406
+ "writable": true;
407
+ "signer": true;
408
+ },
409
+ {
410
+ "name": "vault";
411
+ "writable": true;
412
+ "pda": {
413
+ "seeds": [
414
+ {
415
+ "kind": "const";
416
+ "value": [
417
+ 118,
418
+ 97,
419
+ 117,
420
+ 108,
421
+ 116
422
+ ];
423
+ },
424
+ {
425
+ "kind": "account";
426
+ "path": "vault.owner";
427
+ "account": "agentVault";
428
+ },
429
+ {
430
+ "kind": "account";
431
+ "path": "vault.vault_id";
432
+ "account": "agentVault";
433
+ }
434
+ ];
435
+ };
436
+ "relations": [
437
+ "policy",
438
+ "tracker",
439
+ "session"
440
+ ];
441
+ },
442
+ {
443
+ "name": "policy";
444
+ "pda": {
445
+ "seeds": [
446
+ {
447
+ "kind": "const";
448
+ "value": [
449
+ 112,
450
+ 111,
451
+ 108,
452
+ 105,
453
+ 99,
454
+ 121
455
+ ];
456
+ },
457
+ {
458
+ "kind": "account";
459
+ "path": "vault";
460
+ }
461
+ ];
462
+ };
463
+ },
464
+ {
465
+ "name": "tracker";
466
+ "writable": true;
467
+ "pda": {
468
+ "seeds": [
469
+ {
470
+ "kind": "const";
471
+ "value": [
472
+ 116,
473
+ 114,
474
+ 97,
475
+ 99,
476
+ 107,
477
+ 101,
478
+ 114
479
+ ];
480
+ },
481
+ {
482
+ "kind": "account";
483
+ "path": "vault";
484
+ }
485
+ ];
486
+ };
487
+ },
488
+ {
489
+ "name": "session";
490
+ "writable": true;
491
+ "pda": {
492
+ "seeds": [
493
+ {
494
+ "kind": "const";
495
+ "value": [
496
+ 115,
497
+ 101,
498
+ 115,
499
+ 115,
500
+ 105,
501
+ 111,
502
+ 110
503
+ ];
504
+ },
505
+ {
506
+ "kind": "account";
507
+ "path": "vault";
508
+ },
509
+ {
510
+ "kind": "account";
511
+ "path": "session.agent";
512
+ "account": "sessionAuthority";
513
+ }
514
+ ];
515
+ };
516
+ },
517
+ {
518
+ "name": "vaultTokenAccount";
519
+ "docs": [
520
+ "Vault's PDA token account for the session's token (fee source)"
521
+ ];
522
+ "writable": true;
523
+ "optional": true;
524
+ },
525
+ {
526
+ "name": "feeDestinationTokenAccount";
527
+ "docs": [
528
+ "Fee destination token account — must match vault.fee_destination"
529
+ ];
530
+ "writable": true;
531
+ "optional": true;
532
+ },
533
+ {
534
+ "name": "tokenProgram";
535
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
536
+ },
537
+ {
538
+ "name": "systemProgram";
539
+ "address": "11111111111111111111111111111111";
540
+ }
541
+ ];
542
+ "args": [
543
+ {
544
+ "name": "success";
545
+ "type": "bool";
546
+ }
547
+ ];
548
+ },
549
+ {
550
+ "name": "initializeVault";
551
+ "docs": [
552
+ "Initialize a new agent vault with policy configuration.",
553
+ "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA."
554
+ ];
555
+ "discriminator": [
556
+ 48,
557
+ 191,
558
+ 163,
559
+ 44,
560
+ 71,
561
+ 129,
562
+ 63,
563
+ 164
564
+ ];
565
+ "accounts": [
566
+ {
567
+ "name": "owner";
568
+ "writable": true;
569
+ "signer": true;
570
+ },
571
+ {
572
+ "name": "vault";
573
+ "writable": true;
574
+ "pda": {
575
+ "seeds": [
576
+ {
577
+ "kind": "const";
578
+ "value": [
579
+ 118,
580
+ 97,
581
+ 117,
582
+ 108,
583
+ 116
584
+ ];
585
+ },
586
+ {
587
+ "kind": "account";
588
+ "path": "owner";
589
+ },
590
+ {
591
+ "kind": "arg";
592
+ "path": "vaultId";
593
+ }
594
+ ];
595
+ };
596
+ },
597
+ {
598
+ "name": "policy";
599
+ "writable": true;
600
+ "pda": {
601
+ "seeds": [
602
+ {
603
+ "kind": "const";
604
+ "value": [
605
+ 112,
606
+ 111,
607
+ 108,
608
+ 105,
609
+ 99,
610
+ 121
611
+ ];
612
+ },
613
+ {
614
+ "kind": "account";
615
+ "path": "vault";
616
+ }
617
+ ];
618
+ };
619
+ },
620
+ {
621
+ "name": "tracker";
622
+ "writable": true;
623
+ "pda": {
624
+ "seeds": [
625
+ {
626
+ "kind": "const";
627
+ "value": [
628
+ 116,
629
+ 114,
630
+ 97,
631
+ 99,
632
+ 107,
633
+ 101,
634
+ 114
635
+ ];
636
+ },
637
+ {
638
+ "kind": "account";
639
+ "path": "vault";
640
+ }
641
+ ];
642
+ };
643
+ },
644
+ {
645
+ "name": "feeDestination";
646
+ "docs": [
647
+ "The protocol treasury that receives fees"
648
+ ];
649
+ },
650
+ {
651
+ "name": "systemProgram";
652
+ "address": "11111111111111111111111111111111";
653
+ }
654
+ ];
655
+ "args": [
656
+ {
657
+ "name": "vaultId";
658
+ "type": "u64";
659
+ },
660
+ {
661
+ "name": "dailySpendingCap";
662
+ "type": "u64";
663
+ },
664
+ {
665
+ "name": "maxTransactionSize";
666
+ "type": "u64";
667
+ },
668
+ {
669
+ "name": "allowedTokens";
670
+ "type": {
671
+ "vec": "pubkey";
672
+ };
673
+ },
674
+ {
675
+ "name": "allowedProtocols";
676
+ "type": {
677
+ "vec": "pubkey";
678
+ };
679
+ },
680
+ {
681
+ "name": "maxLeverageBps";
682
+ "type": "u16";
683
+ },
684
+ {
685
+ "name": "maxConcurrentPositions";
686
+ "type": "u8";
687
+ }
688
+ ];
689
+ },
690
+ {
691
+ "name": "reactivateVault";
692
+ "docs": [
693
+ "Reactivate a frozen vault. Optionally rotate the agent key.",
694
+ "Only the owner can call this."
695
+ ];
696
+ "discriminator": [
697
+ 245,
698
+ 50,
699
+ 143,
700
+ 70,
701
+ 114,
702
+ 220,
703
+ 25,
704
+ 251
705
+ ];
706
+ "accounts": [
707
+ {
708
+ "name": "owner";
709
+ "signer": true;
710
+ "relations": [
711
+ "vault"
712
+ ];
713
+ },
714
+ {
715
+ "name": "vault";
716
+ "writable": true;
717
+ "pda": {
718
+ "seeds": [
719
+ {
720
+ "kind": "const";
721
+ "value": [
722
+ 118,
723
+ 97,
724
+ 117,
725
+ 108,
726
+ 116
727
+ ];
728
+ },
729
+ {
730
+ "kind": "account";
731
+ "path": "owner";
732
+ },
733
+ {
734
+ "kind": "account";
735
+ "path": "vault.vault_id";
736
+ "account": "agentVault";
737
+ }
738
+ ];
739
+ };
740
+ }
741
+ ];
742
+ "args": [
743
+ {
744
+ "name": "newAgent";
745
+ "type": {
746
+ "option": "pubkey";
747
+ };
748
+ }
749
+ ];
750
+ },
751
+ {
752
+ "name": "registerAgent";
753
+ "docs": [
754
+ "Register an agent's signing key to this vault.",
755
+ "Only the owner can call this. One agent per vault."
756
+ ];
757
+ "discriminator": [
758
+ 135,
759
+ 157,
760
+ 66,
761
+ 195,
762
+ 2,
763
+ 113,
764
+ 175,
765
+ 30
766
+ ];
767
+ "accounts": [
768
+ {
769
+ "name": "owner";
770
+ "signer": true;
771
+ "relations": [
772
+ "vault"
773
+ ];
774
+ },
775
+ {
776
+ "name": "vault";
777
+ "writable": true;
778
+ "pda": {
779
+ "seeds": [
780
+ {
781
+ "kind": "const";
782
+ "value": [
783
+ 118,
784
+ 97,
785
+ 117,
786
+ 108,
787
+ 116
788
+ ];
789
+ },
790
+ {
791
+ "kind": "account";
792
+ "path": "owner";
793
+ },
794
+ {
795
+ "kind": "account";
796
+ "path": "vault.vault_id";
797
+ "account": "agentVault";
798
+ }
799
+ ];
800
+ };
801
+ }
802
+ ];
803
+ "args": [
804
+ {
805
+ "name": "agent";
806
+ "type": "pubkey";
807
+ }
808
+ ];
809
+ },
810
+ {
811
+ "name": "revokeAgent";
812
+ "docs": [
813
+ "Kill switch. Immediately freezes the vault, preventing all agent actions.",
814
+ "Only the owner can call this. Funds can still be withdrawn by the owner."
815
+ ];
816
+ "discriminator": [
817
+ 227,
818
+ 60,
819
+ 209,
820
+ 125,
821
+ 240,
822
+ 117,
823
+ 163,
824
+ 73
825
+ ];
826
+ "accounts": [
827
+ {
828
+ "name": "owner";
829
+ "signer": true;
830
+ "relations": [
831
+ "vault"
832
+ ];
833
+ },
834
+ {
835
+ "name": "vault";
836
+ "writable": true;
837
+ "pda": {
838
+ "seeds": [
839
+ {
840
+ "kind": "const";
841
+ "value": [
842
+ 118,
843
+ 97,
844
+ 117,
845
+ 108,
846
+ 116
847
+ ];
848
+ },
849
+ {
850
+ "kind": "account";
851
+ "path": "owner";
852
+ },
853
+ {
854
+ "kind": "account";
855
+ "path": "vault.vault_id";
856
+ "account": "agentVault";
857
+ }
858
+ ];
859
+ };
860
+ }
861
+ ];
862
+ "args": [];
863
+ },
864
+ {
865
+ "name": "updatePolicy";
866
+ "docs": [
867
+ "Update the policy configuration for a vault.",
868
+ "Only the owner can call this. Cannot be called by the agent."
869
+ ];
870
+ "discriminator": [
871
+ 212,
872
+ 245,
873
+ 246,
874
+ 7,
875
+ 163,
876
+ 151,
877
+ 18,
878
+ 57
879
+ ];
880
+ "accounts": [
881
+ {
882
+ "name": "owner";
883
+ "signer": true;
884
+ "relations": [
885
+ "vault"
886
+ ];
887
+ },
888
+ {
889
+ "name": "vault";
890
+ "pda": {
891
+ "seeds": [
892
+ {
893
+ "kind": "const";
894
+ "value": [
895
+ 118,
896
+ 97,
897
+ 117,
898
+ 108,
899
+ 116
900
+ ];
901
+ },
902
+ {
903
+ "kind": "account";
904
+ "path": "owner";
905
+ },
906
+ {
907
+ "kind": "account";
908
+ "path": "vault.vault_id";
909
+ "account": "agentVault";
910
+ }
911
+ ];
912
+ };
913
+ "relations": [
914
+ "policy"
915
+ ];
916
+ },
917
+ {
918
+ "name": "policy";
919
+ "writable": true;
920
+ "pda": {
921
+ "seeds": [
922
+ {
923
+ "kind": "const";
924
+ "value": [
925
+ 112,
926
+ 111,
927
+ 108,
928
+ 105,
929
+ 99,
930
+ 121
931
+ ];
932
+ },
933
+ {
934
+ "kind": "account";
935
+ "path": "vault";
936
+ }
937
+ ];
938
+ };
939
+ }
940
+ ];
941
+ "args": [
942
+ {
943
+ "name": "dailySpendingCap";
944
+ "type": {
945
+ "option": "u64";
946
+ };
947
+ },
948
+ {
949
+ "name": "maxTransactionSize";
950
+ "type": {
951
+ "option": "u64";
952
+ };
953
+ },
954
+ {
955
+ "name": "allowedTokens";
956
+ "type": {
957
+ "option": {
958
+ "vec": "pubkey";
959
+ };
960
+ };
961
+ },
962
+ {
963
+ "name": "allowedProtocols";
964
+ "type": {
965
+ "option": {
966
+ "vec": "pubkey";
967
+ };
968
+ };
969
+ },
970
+ {
971
+ "name": "maxLeverageBps";
972
+ "type": {
973
+ "option": "u16";
974
+ };
975
+ },
976
+ {
977
+ "name": "canOpenPositions";
978
+ "type": {
979
+ "option": "bool";
980
+ };
981
+ },
982
+ {
983
+ "name": "maxConcurrentPositions";
984
+ "type": {
985
+ "option": "u8";
986
+ };
987
+ }
988
+ ];
989
+ },
990
+ {
991
+ "name": "validateAndAuthorize";
992
+ "docs": [
993
+ "Core permission check. Called by the agent before a DeFi action.",
994
+ "Validates the action against all policy constraints.",
995
+ "If approved, creates a SessionAuthority PDA and updates spend tracking.",
996
+ "If denied, reverts the entire transaction (including subsequent DeFi instructions)."
997
+ ];
998
+ "discriminator": [
999
+ 22,
1000
+ 183,
1001
+ 48,
1002
+ 222,
1003
+ 218,
1004
+ 11,
1005
+ 197,
1006
+ 152
1007
+ ];
1008
+ "accounts": [
1009
+ {
1010
+ "name": "agent";
1011
+ "writable": true;
1012
+ "signer": true;
1013
+ },
1014
+ {
1015
+ "name": "vault";
1016
+ "writable": true;
1017
+ "pda": {
1018
+ "seeds": [
1019
+ {
1020
+ "kind": "const";
1021
+ "value": [
1022
+ 118,
1023
+ 97,
1024
+ 117,
1025
+ 108,
1026
+ 116
1027
+ ];
1028
+ },
1029
+ {
1030
+ "kind": "account";
1031
+ "path": "vault.owner";
1032
+ "account": "agentVault";
1033
+ },
1034
+ {
1035
+ "kind": "account";
1036
+ "path": "vault.vault_id";
1037
+ "account": "agentVault";
1038
+ }
1039
+ ];
1040
+ };
1041
+ "relations": [
1042
+ "policy",
1043
+ "tracker"
1044
+ ];
1045
+ },
1046
+ {
1047
+ "name": "policy";
1048
+ "pda": {
1049
+ "seeds": [
1050
+ {
1051
+ "kind": "const";
1052
+ "value": [
1053
+ 112,
1054
+ 111,
1055
+ 108,
1056
+ 105,
1057
+ 99,
1058
+ 121
1059
+ ];
1060
+ },
1061
+ {
1062
+ "kind": "account";
1063
+ "path": "vault";
1064
+ }
1065
+ ];
1066
+ };
1067
+ },
1068
+ {
1069
+ "name": "tracker";
1070
+ "writable": true;
1071
+ "pda": {
1072
+ "seeds": [
1073
+ {
1074
+ "kind": "const";
1075
+ "value": [
1076
+ 116,
1077
+ 114,
1078
+ 97,
1079
+ 99,
1080
+ 107,
1081
+ 101,
1082
+ 114
1083
+ ];
1084
+ },
1085
+ {
1086
+ "kind": "account";
1087
+ "path": "vault";
1088
+ }
1089
+ ];
1090
+ };
1091
+ },
1092
+ {
1093
+ "name": "session";
1094
+ "docs": [
1095
+ "Ephemeral session PDA — `init` ensures no double-authorization"
1096
+ ];
1097
+ "writable": true;
1098
+ "pda": {
1099
+ "seeds": [
1100
+ {
1101
+ "kind": "const";
1102
+ "value": [
1103
+ 115,
1104
+ 101,
1105
+ 115,
1106
+ 115,
1107
+ 105,
1108
+ 111,
1109
+ 110
1110
+ ];
1111
+ },
1112
+ {
1113
+ "kind": "account";
1114
+ "path": "vault";
1115
+ },
1116
+ {
1117
+ "kind": "account";
1118
+ "path": "agent";
1119
+ }
1120
+ ];
1121
+ };
1122
+ },
1123
+ {
1124
+ "name": "systemProgram";
1125
+ "address": "11111111111111111111111111111111";
1126
+ }
1127
+ ];
1128
+ "args": [
1129
+ {
1130
+ "name": "actionType";
1131
+ "type": {
1132
+ "defined": {
1133
+ "name": "actionType";
1134
+ };
1135
+ };
1136
+ },
1137
+ {
1138
+ "name": "tokenMint";
1139
+ "type": "pubkey";
1140
+ },
1141
+ {
1142
+ "name": "amount";
1143
+ "type": "u64";
1144
+ },
1145
+ {
1146
+ "name": "targetProtocol";
1147
+ "type": "pubkey";
1148
+ },
1149
+ {
1150
+ "name": "leverageBps";
1151
+ "type": {
1152
+ "option": "u16";
1153
+ };
1154
+ }
1155
+ ];
1156
+ },
1157
+ {
1158
+ "name": "withdrawFunds";
1159
+ "docs": [
1160
+ "Withdraw tokens from the vault back to the owner.",
1161
+ "Works in any vault status (Active or Frozen). Only the owner can call this."
1162
+ ];
1163
+ "discriminator": [
1164
+ 241,
1165
+ 36,
1166
+ 29,
1167
+ 111,
1168
+ 208,
1169
+ 31,
1170
+ 104,
1171
+ 217
1172
+ ];
1173
+ "accounts": [
1174
+ {
1175
+ "name": "owner";
1176
+ "writable": true;
1177
+ "signer": true;
1178
+ "relations": [
1179
+ "vault"
1180
+ ];
1181
+ },
1182
+ {
1183
+ "name": "vault";
1184
+ "pda": {
1185
+ "seeds": [
1186
+ {
1187
+ "kind": "const";
1188
+ "value": [
1189
+ 118,
1190
+ 97,
1191
+ 117,
1192
+ 108,
1193
+ 116
1194
+ ];
1195
+ },
1196
+ {
1197
+ "kind": "account";
1198
+ "path": "owner";
1199
+ },
1200
+ {
1201
+ "kind": "account";
1202
+ "path": "vault.vault_id";
1203
+ "account": "agentVault";
1204
+ }
1205
+ ];
1206
+ };
1207
+ },
1208
+ {
1209
+ "name": "mint";
1210
+ },
1211
+ {
1212
+ "name": "vaultTokenAccount";
1213
+ "docs": [
1214
+ "Vault's PDA-controlled token account"
1215
+ ];
1216
+ "writable": true;
1217
+ "pda": {
1218
+ "seeds": [
1219
+ {
1220
+ "kind": "account";
1221
+ "path": "vault";
1222
+ },
1223
+ {
1224
+ "kind": "const";
1225
+ "value": [
1226
+ 6,
1227
+ 221,
1228
+ 246,
1229
+ 225,
1230
+ 215,
1231
+ 101,
1232
+ 161,
1233
+ 147,
1234
+ 217,
1235
+ 203,
1236
+ 225,
1237
+ 70,
1238
+ 206,
1239
+ 235,
1240
+ 121,
1241
+ 172,
1242
+ 28,
1243
+ 180,
1244
+ 133,
1245
+ 237,
1246
+ 95,
1247
+ 91,
1248
+ 55,
1249
+ 145,
1250
+ 58,
1251
+ 140,
1252
+ 245,
1253
+ 133,
1254
+ 126,
1255
+ 255,
1256
+ 0,
1257
+ 169
1258
+ ];
1259
+ },
1260
+ {
1261
+ "kind": "account";
1262
+ "path": "mint";
1263
+ }
1264
+ ];
1265
+ "program": {
1266
+ "kind": "const";
1267
+ "value": [
1268
+ 140,
1269
+ 151,
1270
+ 37,
1271
+ 143,
1272
+ 78,
1273
+ 36,
1274
+ 137,
1275
+ 241,
1276
+ 187,
1277
+ 61,
1278
+ 16,
1279
+ 41,
1280
+ 20,
1281
+ 142,
1282
+ 13,
1283
+ 131,
1284
+ 11,
1285
+ 90,
1286
+ 19,
1287
+ 153,
1288
+ 218,
1289
+ 255,
1290
+ 16,
1291
+ 132,
1292
+ 4,
1293
+ 142,
1294
+ 123,
1295
+ 216,
1296
+ 219,
1297
+ 233,
1298
+ 248,
1299
+ 89
1300
+ ];
1301
+ };
1302
+ };
1303
+ },
1304
+ {
1305
+ "name": "ownerTokenAccount";
1306
+ "docs": [
1307
+ "Owner's token account to receive funds"
1308
+ ];
1309
+ "writable": true;
1310
+ "pda": {
1311
+ "seeds": [
1312
+ {
1313
+ "kind": "account";
1314
+ "path": "owner";
1315
+ },
1316
+ {
1317
+ "kind": "const";
1318
+ "value": [
1319
+ 6,
1320
+ 221,
1321
+ 246,
1322
+ 225,
1323
+ 215,
1324
+ 101,
1325
+ 161,
1326
+ 147,
1327
+ 217,
1328
+ 203,
1329
+ 225,
1330
+ 70,
1331
+ 206,
1332
+ 235,
1333
+ 121,
1334
+ 172,
1335
+ 28,
1336
+ 180,
1337
+ 133,
1338
+ 237,
1339
+ 95,
1340
+ 91,
1341
+ 55,
1342
+ 145,
1343
+ 58,
1344
+ 140,
1345
+ 245,
1346
+ 133,
1347
+ 126,
1348
+ 255,
1349
+ 0,
1350
+ 169
1351
+ ];
1352
+ },
1353
+ {
1354
+ "kind": "account";
1355
+ "path": "mint";
1356
+ }
1357
+ ];
1358
+ "program": {
1359
+ "kind": "const";
1360
+ "value": [
1361
+ 140,
1362
+ 151,
1363
+ 37,
1364
+ 143,
1365
+ 78,
1366
+ 36,
1367
+ 137,
1368
+ 241,
1369
+ 187,
1370
+ 61,
1371
+ 16,
1372
+ 41,
1373
+ 20,
1374
+ 142,
1375
+ 13,
1376
+ 131,
1377
+ 11,
1378
+ 90,
1379
+ 19,
1380
+ 153,
1381
+ 218,
1382
+ 255,
1383
+ 16,
1384
+ 132,
1385
+ 4,
1386
+ 142,
1387
+ 123,
1388
+ 216,
1389
+ 219,
1390
+ 233,
1391
+ 248,
1392
+ 89
1393
+ ];
1394
+ };
1395
+ };
1396
+ },
1397
+ {
1398
+ "name": "tokenProgram";
1399
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1400
+ }
1401
+ ];
1402
+ "args": [
1403
+ {
1404
+ "name": "amount";
1405
+ "type": "u64";
1406
+ }
1407
+ ];
1408
+ }
1409
+ ];
1410
+ "accounts": [
1411
+ {
1412
+ "name": "agentVault";
1413
+ "discriminator": [
1414
+ 232,
1415
+ 220,
1416
+ 237,
1417
+ 164,
1418
+ 157,
1419
+ 9,
1420
+ 215,
1421
+ 194
1422
+ ];
1423
+ },
1424
+ {
1425
+ "name": "policyConfig";
1426
+ "discriminator": [
1427
+ 219,
1428
+ 7,
1429
+ 79,
1430
+ 84,
1431
+ 175,
1432
+ 51,
1433
+ 148,
1434
+ 146
1435
+ ];
1436
+ },
1437
+ {
1438
+ "name": "sessionAuthority";
1439
+ "discriminator": [
1440
+ 48,
1441
+ 9,
1442
+ 30,
1443
+ 120,
1444
+ 134,
1445
+ 35,
1446
+ 172,
1447
+ 170
1448
+ ];
1449
+ },
1450
+ {
1451
+ "name": "spendTracker";
1452
+ "discriminator": [
1453
+ 180,
1454
+ 17,
1455
+ 195,
1456
+ 180,
1457
+ 162,
1458
+ 207,
1459
+ 239,
1460
+ 205
1461
+ ];
1462
+ }
1463
+ ];
1464
+ "events": [
1465
+ {
1466
+ "name": "actionAuthorized";
1467
+ "discriminator": [
1468
+ 85,
1469
+ 90,
1470
+ 59,
1471
+ 218,
1472
+ 126,
1473
+ 8,
1474
+ 179,
1475
+ 63
1476
+ ];
1477
+ },
1478
+ {
1479
+ "name": "actionDenied";
1480
+ "discriminator": [
1481
+ 243,
1482
+ 239,
1483
+ 240,
1484
+ 51,
1485
+ 151,
1486
+ 100,
1487
+ 10,
1488
+ 100
1489
+ ];
1490
+ },
1491
+ {
1492
+ "name": "agentRegistered";
1493
+ "discriminator": [
1494
+ 191,
1495
+ 78,
1496
+ 217,
1497
+ 54,
1498
+ 232,
1499
+ 100,
1500
+ 189,
1501
+ 85
1502
+ ];
1503
+ },
1504
+ {
1505
+ "name": "agentRevoked";
1506
+ "discriminator": [
1507
+ 12,
1508
+ 251,
1509
+ 249,
1510
+ 166,
1511
+ 122,
1512
+ 83,
1513
+ 162,
1514
+ 116
1515
+ ];
1516
+ },
1517
+ {
1518
+ "name": "feesCollected";
1519
+ "discriminator": [
1520
+ 233,
1521
+ 23,
1522
+ 117,
1523
+ 225,
1524
+ 107,
1525
+ 178,
1526
+ 254,
1527
+ 8
1528
+ ];
1529
+ },
1530
+ {
1531
+ "name": "fundsDeposited";
1532
+ "discriminator": [
1533
+ 157,
1534
+ 209,
1535
+ 100,
1536
+ 95,
1537
+ 59,
1538
+ 100,
1539
+ 3,
1540
+ 68
1541
+ ];
1542
+ },
1543
+ {
1544
+ "name": "fundsWithdrawn";
1545
+ "discriminator": [
1546
+ 56,
1547
+ 130,
1548
+ 230,
1549
+ 154,
1550
+ 35,
1551
+ 92,
1552
+ 11,
1553
+ 118
1554
+ ];
1555
+ },
1556
+ {
1557
+ "name": "policyUpdated";
1558
+ "discriminator": [
1559
+ 225,
1560
+ 112,
1561
+ 112,
1562
+ 67,
1563
+ 95,
1564
+ 236,
1565
+ 245,
1566
+ 161
1567
+ ];
1568
+ },
1569
+ {
1570
+ "name": "sessionFinalized";
1571
+ "discriminator": [
1572
+ 33,
1573
+ 12,
1574
+ 242,
1575
+ 91,
1576
+ 206,
1577
+ 42,
1578
+ 163,
1579
+ 235
1580
+ ];
1581
+ },
1582
+ {
1583
+ "name": "vaultClosed";
1584
+ "discriminator": [
1585
+ 238,
1586
+ 129,
1587
+ 38,
1588
+ 228,
1589
+ 227,
1590
+ 118,
1591
+ 249,
1592
+ 215
1593
+ ];
1594
+ },
1595
+ {
1596
+ "name": "vaultCreated";
1597
+ "discriminator": [
1598
+ 117,
1599
+ 25,
1600
+ 120,
1601
+ 254,
1602
+ 75,
1603
+ 236,
1604
+ 78,
1605
+ 115
1606
+ ];
1607
+ },
1608
+ {
1609
+ "name": "vaultReactivated";
1610
+ "discriminator": [
1611
+ 197,
1612
+ 52,
1613
+ 160,
1614
+ 147,
1615
+ 159,
1616
+ 89,
1617
+ 90,
1618
+ 28
1619
+ ];
1620
+ }
1621
+ ];
1622
+ "errors": [
1623
+ {
1624
+ "code": 6000;
1625
+ "name": "vaultNotActive";
1626
+ "msg": "Vault is not active";
1627
+ },
1628
+ {
1629
+ "code": 6001;
1630
+ "name": "unauthorizedAgent";
1631
+ "msg": "Unauthorized: signer is not the registered agent";
1632
+ },
1633
+ {
1634
+ "code": 6002;
1635
+ "name": "unauthorizedOwner";
1636
+ "msg": "Unauthorized: signer is not the vault owner";
1637
+ },
1638
+ {
1639
+ "code": 6003;
1640
+ "name": "tokenNotAllowed";
1641
+ "msg": "Token not in allowed list";
1642
+ },
1643
+ {
1644
+ "code": 6004;
1645
+ "name": "protocolNotAllowed";
1646
+ "msg": "Protocol not in allowed list";
1647
+ },
1648
+ {
1649
+ "code": 6005;
1650
+ "name": "transactionTooLarge";
1651
+ "msg": "Transaction exceeds maximum single transaction size";
1652
+ },
1653
+ {
1654
+ "code": 6006;
1655
+ "name": "dailyCapExceeded";
1656
+ "msg": "Daily spending cap would be exceeded";
1657
+ },
1658
+ {
1659
+ "code": 6007;
1660
+ "name": "leverageTooHigh";
1661
+ "msg": "Leverage exceeds maximum allowed";
1662
+ },
1663
+ {
1664
+ "code": 6008;
1665
+ "name": "tooManyPositions";
1666
+ "msg": "Maximum concurrent open positions reached";
1667
+ },
1668
+ {
1669
+ "code": 6009;
1670
+ "name": "positionOpeningDisallowed";
1671
+ "msg": "Cannot open new positions (policy disallows)";
1672
+ },
1673
+ {
1674
+ "code": 6010;
1675
+ "name": "sessionExpired";
1676
+ "msg": "Session has expired";
1677
+ },
1678
+ {
1679
+ "code": 6011;
1680
+ "name": "sessionNotAuthorized";
1681
+ "msg": "Session not authorized";
1682
+ },
1683
+ {
1684
+ "code": 6012;
1685
+ "name": "invalidSession";
1686
+ "msg": "Invalid session: does not belong to this vault";
1687
+ },
1688
+ {
1689
+ "code": 6013;
1690
+ "name": "openPositionsExist";
1691
+ "msg": "Vault has open positions, cannot close";
1692
+ },
1693
+ {
1694
+ "code": 6014;
1695
+ "name": "tooManyAllowedTokens";
1696
+ "msg": "Policy configuration invalid: too many allowed tokens";
1697
+ },
1698
+ {
1699
+ "code": 6015;
1700
+ "name": "tooManyAllowedProtocols";
1701
+ "msg": "Policy configuration invalid: too many allowed protocols";
1702
+ },
1703
+ {
1704
+ "code": 6016;
1705
+ "name": "agentAlreadyRegistered";
1706
+ "msg": "Agent already registered for this vault";
1707
+ },
1708
+ {
1709
+ "code": 6017;
1710
+ "name": "noAgentRegistered";
1711
+ "msg": "No agent registered for this vault";
1712
+ },
1713
+ {
1714
+ "code": 6018;
1715
+ "name": "vaultNotFrozen";
1716
+ "msg": "Vault is not frozen (expected frozen for reactivation)";
1717
+ },
1718
+ {
1719
+ "code": 6019;
1720
+ "name": "vaultAlreadyClosed";
1721
+ "msg": "Vault is already closed";
1722
+ },
1723
+ {
1724
+ "code": 6020;
1725
+ "name": "insufficientBalance";
1726
+ "msg": "Insufficient vault balance for withdrawal";
1727
+ },
1728
+ {
1729
+ "code": 6021;
1730
+ "name": "feeBpsTooHigh";
1731
+ "msg": "Fee basis points exceed maximum (500 bps / 5%)";
1732
+ },
1733
+ {
1734
+ "code": 6022;
1735
+ "name": "invalidFeeDestination";
1736
+ "msg": "Fee destination account invalid";
1737
+ },
1738
+ {
1739
+ "code": 6023;
1740
+ "name": "overflow";
1741
+ "msg": "Arithmetic overflow";
1742
+ }
1743
+ ];
1744
+ "types": [
1745
+ {
1746
+ "name": "actionAuthorized";
1747
+ "type": {
1748
+ "kind": "struct";
1749
+ "fields": [
1750
+ {
1751
+ "name": "vault";
1752
+ "type": "pubkey";
1753
+ },
1754
+ {
1755
+ "name": "agent";
1756
+ "type": "pubkey";
1757
+ },
1758
+ {
1759
+ "name": "actionType";
1760
+ "type": {
1761
+ "defined": {
1762
+ "name": "actionType";
1763
+ };
1764
+ };
1765
+ },
1766
+ {
1767
+ "name": "tokenMint";
1768
+ "type": "pubkey";
1769
+ },
1770
+ {
1771
+ "name": "amount";
1772
+ "type": "u64";
1773
+ },
1774
+ {
1775
+ "name": "protocol";
1776
+ "type": "pubkey";
1777
+ },
1778
+ {
1779
+ "name": "rollingSpendAfter";
1780
+ "type": "u64";
1781
+ },
1782
+ {
1783
+ "name": "dailyCap";
1784
+ "type": "u64";
1785
+ },
1786
+ {
1787
+ "name": "timestamp";
1788
+ "type": "i64";
1789
+ }
1790
+ ];
1791
+ };
1792
+ },
1793
+ {
1794
+ "name": "actionDenied";
1795
+ "type": {
1796
+ "kind": "struct";
1797
+ "fields": [
1798
+ {
1799
+ "name": "vault";
1800
+ "type": "pubkey";
1801
+ },
1802
+ {
1803
+ "name": "agent";
1804
+ "type": "pubkey";
1805
+ },
1806
+ {
1807
+ "name": "reason";
1808
+ "type": "string";
1809
+ },
1810
+ {
1811
+ "name": "timestamp";
1812
+ "type": "i64";
1813
+ }
1814
+ ];
1815
+ };
1816
+ },
1817
+ {
1818
+ "name": "actionType";
1819
+ "docs": [
1820
+ "Action types that agents can request"
1821
+ ];
1822
+ "type": {
1823
+ "kind": "enum";
1824
+ "variants": [
1825
+ {
1826
+ "name": "swap";
1827
+ },
1828
+ {
1829
+ "name": "openPosition";
1830
+ },
1831
+ {
1832
+ "name": "closePosition";
1833
+ },
1834
+ {
1835
+ "name": "increasePosition";
1836
+ },
1837
+ {
1838
+ "name": "decreasePosition";
1839
+ },
1840
+ {
1841
+ "name": "deposit";
1842
+ },
1843
+ {
1844
+ "name": "withdraw";
1845
+ }
1846
+ ];
1847
+ };
1848
+ },
1849
+ {
1850
+ "name": "agentRegistered";
1851
+ "type": {
1852
+ "kind": "struct";
1853
+ "fields": [
1854
+ {
1855
+ "name": "vault";
1856
+ "type": "pubkey";
1857
+ },
1858
+ {
1859
+ "name": "agent";
1860
+ "type": "pubkey";
1861
+ },
1862
+ {
1863
+ "name": "timestamp";
1864
+ "type": "i64";
1865
+ }
1866
+ ];
1867
+ };
1868
+ },
1869
+ {
1870
+ "name": "agentRevoked";
1871
+ "type": {
1872
+ "kind": "struct";
1873
+ "fields": [
1874
+ {
1875
+ "name": "vault";
1876
+ "type": "pubkey";
1877
+ },
1878
+ {
1879
+ "name": "agent";
1880
+ "type": "pubkey";
1881
+ },
1882
+ {
1883
+ "name": "timestamp";
1884
+ "type": "i64";
1885
+ }
1886
+ ];
1887
+ };
1888
+ },
1889
+ {
1890
+ "name": "agentVault";
1891
+ "type": {
1892
+ "kind": "struct";
1893
+ "fields": [
1894
+ {
1895
+ "name": "owner";
1896
+ "docs": [
1897
+ "The owner who created this vault (has full authority)"
1898
+ ];
1899
+ "type": "pubkey";
1900
+ },
1901
+ {
1902
+ "name": "agent";
1903
+ "docs": [
1904
+ "The registered agent's signing key (Pubkey::default() if not yet registered)"
1905
+ ];
1906
+ "type": "pubkey";
1907
+ },
1908
+ {
1909
+ "name": "feeDestination";
1910
+ "docs": [
1911
+ "Protocol fee destination — the AgentShield treasury wallet that receives",
1912
+ "basis-point fees on every finalized transaction. Set at vault creation,",
1913
+ "immutable after initialization."
1914
+ ];
1915
+ "type": "pubkey";
1916
+ },
1917
+ {
1918
+ "name": "vaultId";
1919
+ "docs": [
1920
+ "Unique vault identifier (allows one owner to have multiple vaults)"
1921
+ ];
1922
+ "type": "u64";
1923
+ },
1924
+ {
1925
+ "name": "status";
1926
+ "docs": [
1927
+ "Vault status: Active, Frozen, or Closed"
1928
+ ];
1929
+ "type": {
1930
+ "defined": {
1931
+ "name": "vaultStatus";
1932
+ };
1933
+ };
1934
+ },
1935
+ {
1936
+ "name": "bump";
1937
+ "docs": [
1938
+ "Bump seed for PDA derivation"
1939
+ ];
1940
+ "type": "u8";
1941
+ },
1942
+ {
1943
+ "name": "createdAt";
1944
+ "docs": [
1945
+ "Unix timestamp of vault creation"
1946
+ ];
1947
+ "type": "i64";
1948
+ },
1949
+ {
1950
+ "name": "totalTransactions";
1951
+ "docs": [
1952
+ "Total number of agent transactions executed through this vault"
1953
+ ];
1954
+ "type": "u64";
1955
+ },
1956
+ {
1957
+ "name": "totalVolume";
1958
+ "docs": [
1959
+ "Total volume processed in token base units"
1960
+ ];
1961
+ "type": "u64";
1962
+ },
1963
+ {
1964
+ "name": "openPositions";
1965
+ "docs": [
1966
+ "Number of currently open positions (for perps tracking)"
1967
+ ];
1968
+ "type": "u8";
1969
+ },
1970
+ {
1971
+ "name": "totalFeesCollected";
1972
+ "docs": [
1973
+ "Cumulative protocol fees collected from this vault (token base units)"
1974
+ ];
1975
+ "type": "u64";
1976
+ }
1977
+ ];
1978
+ };
1979
+ },
1980
+ {
1981
+ "name": "feesCollected";
1982
+ "type": {
1983
+ "kind": "struct";
1984
+ "fields": [
1985
+ {
1986
+ "name": "vault";
1987
+ "type": "pubkey";
1988
+ },
1989
+ {
1990
+ "name": "tokenMint";
1991
+ "type": "pubkey";
1992
+ },
1993
+ {
1994
+ "name": "feeAmount";
1995
+ "type": "u64";
1996
+ },
1997
+ {
1998
+ "name": "feeBps";
1999
+ "type": "u16";
2000
+ },
2001
+ {
2002
+ "name": "transactionAmount";
2003
+ "type": "u64";
2004
+ },
2005
+ {
2006
+ "name": "feeDestination";
2007
+ "type": "pubkey";
2008
+ },
2009
+ {
2010
+ "name": "cumulativeFees";
2011
+ "type": "u64";
2012
+ },
2013
+ {
2014
+ "name": "timestamp";
2015
+ "type": "i64";
2016
+ }
2017
+ ];
2018
+ };
2019
+ },
2020
+ {
2021
+ "name": "fundsDeposited";
2022
+ "type": {
2023
+ "kind": "struct";
2024
+ "fields": [
2025
+ {
2026
+ "name": "vault";
2027
+ "type": "pubkey";
2028
+ },
2029
+ {
2030
+ "name": "tokenMint";
2031
+ "type": "pubkey";
2032
+ },
2033
+ {
2034
+ "name": "amount";
2035
+ "type": "u64";
2036
+ },
2037
+ {
2038
+ "name": "timestamp";
2039
+ "type": "i64";
2040
+ }
2041
+ ];
2042
+ };
2043
+ },
2044
+ {
2045
+ "name": "fundsWithdrawn";
2046
+ "type": {
2047
+ "kind": "struct";
2048
+ "fields": [
2049
+ {
2050
+ "name": "vault";
2051
+ "type": "pubkey";
2052
+ },
2053
+ {
2054
+ "name": "tokenMint";
2055
+ "type": "pubkey";
2056
+ },
2057
+ {
2058
+ "name": "amount";
2059
+ "type": "u64";
2060
+ },
2061
+ {
2062
+ "name": "destination";
2063
+ "type": "pubkey";
2064
+ },
2065
+ {
2066
+ "name": "timestamp";
2067
+ "type": "i64";
2068
+ }
2069
+ ];
2070
+ };
2071
+ },
2072
+ {
2073
+ "name": "policyConfig";
2074
+ "type": {
2075
+ "kind": "struct";
2076
+ "fields": [
2077
+ {
2078
+ "name": "vault";
2079
+ "docs": [
2080
+ "Associated vault pubkey"
2081
+ ];
2082
+ "type": "pubkey";
2083
+ },
2084
+ {
2085
+ "name": "dailySpendingCap";
2086
+ "docs": [
2087
+ "Maximum spend per rolling 24h period (in token base units)"
2088
+ ];
2089
+ "type": "u64";
2090
+ },
2091
+ {
2092
+ "name": "maxTransactionSize";
2093
+ "docs": [
2094
+ "Maximum single transaction size (in token base units)"
2095
+ ];
2096
+ "type": "u64";
2097
+ },
2098
+ {
2099
+ "name": "allowedTokens";
2100
+ "docs": [
2101
+ "Allowed token mints the agent can interact with",
2102
+ "Bounded to MAX_ALLOWED_TOKENS entries"
2103
+ ];
2104
+ "type": {
2105
+ "vec": "pubkey";
2106
+ };
2107
+ },
2108
+ {
2109
+ "name": "allowedProtocols";
2110
+ "docs": [
2111
+ "Allowed program IDs the agent can call (Jupiter, Flash Trade, etc.)",
2112
+ "Bounded to MAX_ALLOWED_PROTOCOLS entries"
2113
+ ];
2114
+ "type": {
2115
+ "vec": "pubkey";
2116
+ };
2117
+ },
2118
+ {
2119
+ "name": "maxLeverageBps";
2120
+ "docs": [
2121
+ "Maximum leverage multiplier in basis points (e.g., 10000 = 100x, 1000 = 10x)",
2122
+ "Set to 0 to disallow leveraged positions entirely"
2123
+ ];
2124
+ "type": "u16";
2125
+ },
2126
+ {
2127
+ "name": "canOpenPositions";
2128
+ "docs": [
2129
+ "Whether the agent can open new positions (vs only close existing)"
2130
+ ];
2131
+ "type": "bool";
2132
+ },
2133
+ {
2134
+ "name": "maxConcurrentPositions";
2135
+ "docs": [
2136
+ "Maximum number of concurrent open positions"
2137
+ ];
2138
+ "type": "u8";
2139
+ },
2140
+ {
2141
+ "name": "feeBps";
2142
+ "docs": [
2143
+ "Protocol fee in basis points (1 bps = 0.01%). Applied to every finalized",
2144
+ "transaction. Fee deducted from vault, transferred to fee_destination.",
2145
+ "Max MAX_FEE_BPS (500 = 5%). Set to 0 for no fee."
2146
+ ];
2147
+ "type": "u16";
2148
+ },
2149
+ {
2150
+ "name": "bump";
2151
+ "docs": [
2152
+ "Bump seed for PDA"
2153
+ ];
2154
+ "type": "u8";
2155
+ }
2156
+ ];
2157
+ };
2158
+ },
2159
+ {
2160
+ "name": "policyUpdated";
2161
+ "type": {
2162
+ "kind": "struct";
2163
+ "fields": [
2164
+ {
2165
+ "name": "vault";
2166
+ "type": "pubkey";
2167
+ },
2168
+ {
2169
+ "name": "dailyCap";
2170
+ "type": "u64";
2171
+ },
2172
+ {
2173
+ "name": "maxTransactionSize";
2174
+ "type": "u64";
2175
+ },
2176
+ {
2177
+ "name": "allowedTokensCount";
2178
+ "type": "u8";
2179
+ },
2180
+ {
2181
+ "name": "allowedProtocolsCount";
2182
+ "type": "u8";
2183
+ },
2184
+ {
2185
+ "name": "maxLeverageBps";
2186
+ "type": "u16";
2187
+ },
2188
+ {
2189
+ "name": "timestamp";
2190
+ "type": "i64";
2191
+ }
2192
+ ];
2193
+ };
2194
+ },
2195
+ {
2196
+ "name": "sessionAuthority";
2197
+ "type": {
2198
+ "kind": "struct";
2199
+ "fields": [
2200
+ {
2201
+ "name": "vault";
2202
+ "docs": [
2203
+ "Associated vault"
2204
+ ];
2205
+ "type": "pubkey";
2206
+ },
2207
+ {
2208
+ "name": "agent";
2209
+ "docs": [
2210
+ "The agent who initiated this session"
2211
+ ];
2212
+ "type": "pubkey";
2213
+ },
2214
+ {
2215
+ "name": "authorized";
2216
+ "docs": [
2217
+ "Whether this session has been authorized by the permission check"
2218
+ ];
2219
+ "type": "bool";
2220
+ },
2221
+ {
2222
+ "name": "authorizedAmount";
2223
+ "docs": [
2224
+ "Authorized action details (for verification in finalize)"
2225
+ ];
2226
+ "type": "u64";
2227
+ },
2228
+ {
2229
+ "name": "authorizedToken";
2230
+ "type": "pubkey";
2231
+ },
2232
+ {
2233
+ "name": "authorizedProtocol";
2234
+ "type": "pubkey";
2235
+ },
2236
+ {
2237
+ "name": "expiresAtSlot";
2238
+ "docs": [
2239
+ "Slot-based expiry: session is valid until this slot"
2240
+ ];
2241
+ "type": "u64";
2242
+ },
2243
+ {
2244
+ "name": "bump";
2245
+ "docs": [
2246
+ "Bump seed for PDA"
2247
+ ];
2248
+ "type": "u8";
2249
+ }
2250
+ ];
2251
+ };
2252
+ },
2253
+ {
2254
+ "name": "sessionFinalized";
2255
+ "type": {
2256
+ "kind": "struct";
2257
+ "fields": [
2258
+ {
2259
+ "name": "vault";
2260
+ "type": "pubkey";
2261
+ },
2262
+ {
2263
+ "name": "agent";
2264
+ "type": "pubkey";
2265
+ },
2266
+ {
2267
+ "name": "success";
2268
+ "type": "bool";
2269
+ },
2270
+ {
2271
+ "name": "timestamp";
2272
+ "type": "i64";
2273
+ }
2274
+ ];
2275
+ };
2276
+ },
2277
+ {
2278
+ "name": "spendEntry";
2279
+ "type": {
2280
+ "kind": "struct";
2281
+ "fields": [
2282
+ {
2283
+ "name": "tokenMint";
2284
+ "type": "pubkey";
2285
+ },
2286
+ {
2287
+ "name": "amountSpent";
2288
+ "type": "u64";
2289
+ },
2290
+ {
2291
+ "name": "timestamp";
2292
+ "type": "i64";
2293
+ }
2294
+ ];
2295
+ };
2296
+ },
2297
+ {
2298
+ "name": "spendTracker";
2299
+ "type": {
2300
+ "kind": "struct";
2301
+ "fields": [
2302
+ {
2303
+ "name": "vault";
2304
+ "docs": [
2305
+ "Associated vault pubkey"
2306
+ ];
2307
+ "type": "pubkey";
2308
+ },
2309
+ {
2310
+ "name": "rollingSpends";
2311
+ "docs": [
2312
+ "Rolling spend entries: (token_mint, amount, timestamp)",
2313
+ "Entries older than ROLLING_WINDOW_SECONDS are pruned on each access"
2314
+ ];
2315
+ "type": {
2316
+ "vec": {
2317
+ "defined": {
2318
+ "name": "spendEntry";
2319
+ };
2320
+ };
2321
+ };
2322
+ },
2323
+ {
2324
+ "name": "recentTransactions";
2325
+ "docs": [
2326
+ "Recent transaction log for on-chain audit trail",
2327
+ "Bounded to MAX_RECENT_TRANSACTIONS, oldest entries evicted (ring buffer)"
2328
+ ];
2329
+ "type": {
2330
+ "vec": {
2331
+ "defined": {
2332
+ "name": "transactionRecord";
2333
+ };
2334
+ };
2335
+ };
2336
+ },
2337
+ {
2338
+ "name": "bump";
2339
+ "docs": [
2340
+ "Bump seed for PDA"
2341
+ ];
2342
+ "type": "u8";
2343
+ }
2344
+ ];
2345
+ };
2346
+ },
2347
+ {
2348
+ "name": "transactionRecord";
2349
+ "type": {
2350
+ "kind": "struct";
2351
+ "fields": [
2352
+ {
2353
+ "name": "timestamp";
2354
+ "type": "i64";
2355
+ },
2356
+ {
2357
+ "name": "actionType";
2358
+ "type": {
2359
+ "defined": {
2360
+ "name": "actionType";
2361
+ };
2362
+ };
2363
+ },
2364
+ {
2365
+ "name": "tokenMint";
2366
+ "type": "pubkey";
2367
+ },
2368
+ {
2369
+ "name": "amount";
2370
+ "type": "u64";
2371
+ },
2372
+ {
2373
+ "name": "protocol";
2374
+ "type": "pubkey";
2375
+ },
2376
+ {
2377
+ "name": "success";
2378
+ "type": "bool";
2379
+ },
2380
+ {
2381
+ "name": "slot";
2382
+ "type": "u64";
2383
+ }
2384
+ ];
2385
+ };
2386
+ },
2387
+ {
2388
+ "name": "vaultClosed";
2389
+ "type": {
2390
+ "kind": "struct";
2391
+ "fields": [
2392
+ {
2393
+ "name": "vault";
2394
+ "type": "pubkey";
2395
+ },
2396
+ {
2397
+ "name": "owner";
2398
+ "type": "pubkey";
2399
+ },
2400
+ {
2401
+ "name": "timestamp";
2402
+ "type": "i64";
2403
+ }
2404
+ ];
2405
+ };
2406
+ },
2407
+ {
2408
+ "name": "vaultCreated";
2409
+ "type": {
2410
+ "kind": "struct";
2411
+ "fields": [
2412
+ {
2413
+ "name": "vault";
2414
+ "type": "pubkey";
2415
+ },
2416
+ {
2417
+ "name": "owner";
2418
+ "type": "pubkey";
2419
+ },
2420
+ {
2421
+ "name": "vaultId";
2422
+ "type": "u64";
2423
+ },
2424
+ {
2425
+ "name": "timestamp";
2426
+ "type": "i64";
2427
+ }
2428
+ ];
2429
+ };
2430
+ },
2431
+ {
2432
+ "name": "vaultReactivated";
2433
+ "type": {
2434
+ "kind": "struct";
2435
+ "fields": [
2436
+ {
2437
+ "name": "vault";
2438
+ "type": "pubkey";
2439
+ },
2440
+ {
2441
+ "name": "newAgent";
2442
+ "type": {
2443
+ "option": "pubkey";
2444
+ };
2445
+ },
2446
+ {
2447
+ "name": "timestamp";
2448
+ "type": "i64";
2449
+ }
2450
+ ];
2451
+ };
2452
+ },
2453
+ {
2454
+ "name": "vaultStatus";
2455
+ "docs": [
2456
+ "Vault status enum"
2457
+ ];
2458
+ "type": {
2459
+ "kind": "enum";
2460
+ "variants": [
2461
+ {
2462
+ "name": "active";
2463
+ },
2464
+ {
2465
+ "name": "frozen";
2466
+ },
2467
+ {
2468
+ "name": "closed";
2469
+ }
2470
+ ];
2471
+ };
2472
+ }
2473
+ ];
2474
+ };
2475
+ //# sourceMappingURL=idl.d.ts.map