@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
@@ -1,9 +1,9 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { BN, Program } from "@coral-xyz/anchor";
3
- import type { AgentShield, InitializeVaultParams, UpdatePolicyParams, AuthorizeParams } from "./types";
3
+ import type { AgentShield, InitializeVaultParams, UpdatePolicyParams, QueuePolicyUpdateParams, AgentTransferParams, AuthorizeParams } from "./types";
4
4
  export declare function buildInitializeVault(program: Program<AgentShield>, owner: PublicKey, params: InitializeVaultParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
5
5
  name: "initializeVault";
6
- docs: ["Initialize a new agent vault with policy configuration.", "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA."];
6
+ docs: ["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)."];
7
7
  discriminator: [48, 191, 163, 44, 71, 129, 63, 164];
8
8
  accounts: [{
9
9
  "name": "owner";
@@ -59,15 +59,19 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
59
59
  "name": "vaultId";
60
60
  "type": "u64";
61
61
  }, {
62
- "name": "dailySpendingCap";
62
+ "name": "dailySpendingCapUsd";
63
63
  "type": "u64";
64
64
  }, {
65
- "name": "maxTransactionSize";
65
+ "name": "maxTransactionSizeUsd";
66
66
  "type": "u64";
67
67
  }, {
68
68
  "name": "allowedTokens";
69
69
  "type": {
70
- "vec": "pubkey";
70
+ "vec": {
71
+ "defined": {
72
+ "name": "allowedToken";
73
+ };
74
+ };
71
75
  };
72
76
  }, {
73
77
  "name": "allowedProtocols";
@@ -83,6 +87,17 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
83
87
  }, {
84
88
  "name": "developerFeeRate";
85
89
  "type": "u16";
90
+ }, {
91
+ "name": "timelockDuration";
92
+ "type": "u64";
93
+ }, {
94
+ "name": "allowedDestinations";
95
+ "type": {
96
+ "vec": "pubkey";
97
+ };
98
+ }, {
99
+ "name": "trackerTier";
100
+ "type": "u8";
86
101
  }];
87
102
  } & {
88
103
  name: "initializeVault";
@@ -156,8 +171,8 @@ export declare function buildDepositFunds(program: Program<AgentShield>, owner:
156
171
  "path": "owner";
157
172
  }, {
158
173
  "kind": "account";
159
- "path": "vault.vaultId";
160
- "account": "AgentVault";
174
+ "path": "vault.vault_id";
175
+ "account": "agentVault";
161
176
  }];
162
177
  };
163
178
  }, {
@@ -234,8 +249,8 @@ export declare function buildDepositFunds(program: Program<AgentShield>, owner:
234
249
  "path": "owner";
235
250
  }, {
236
251
  "kind": "account";
237
- "path": "vault.vaultId";
238
- "account": "AgentVault";
252
+ "path": "vault.vault_id";
253
+ "account": "agentVault";
239
254
  }];
240
255
  };
241
256
  } | {
@@ -310,8 +325,8 @@ export declare function buildRegisterAgent(program: Program<AgentShield>, owner:
310
325
  "path": "owner";
311
326
  }, {
312
327
  "kind": "account";
313
- "path": "vault.vaultId";
314
- "account": "AgentVault";
328
+ "path": "vault.vault_id";
329
+ "account": "agentVault";
315
330
  }];
316
331
  };
317
332
  }];
@@ -337,14 +352,14 @@ export declare function buildRegisterAgent(program: Program<AgentShield>, owner:
337
352
  "path": "owner";
338
353
  }, {
339
354
  "kind": "account";
340
- "path": "vault.vaultId";
341
- "account": "AgentVault";
355
+ "path": "vault.vault_id";
356
+ "account": "agentVault";
342
357
  }];
343
358
  };
344
359
  }>;
345
360
  export declare function buildUpdatePolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey, params: UpdatePolicyParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
346
361
  name: "updatePolicy";
347
- docs: ["Update the policy configuration for a vault.", "Only the owner can call this. Cannot be called by the agent."];
362
+ docs: ["Update the policy configuration for a vault.", "Only the owner can call this. Cannot be called by the agent.", "Blocked when timelock_duration > 0 \u2014 use queue_policy_update instead."];
348
363
  discriminator: [212, 245, 246, 7, 163, 151, 18, 57];
349
364
  accounts: [{
350
365
  "name": "owner";
@@ -361,11 +376,11 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
361
376
  "path": "owner";
362
377
  }, {
363
378
  "kind": "account";
364
- "path": "vault.vaultId";
365
- "account": "AgentVault";
379
+ "path": "vault.vault_id";
380
+ "account": "agentVault";
366
381
  }];
367
382
  };
368
- "relations": ["policy"];
383
+ "relations": ["policy", "tracker"];
369
384
  }, {
370
385
  "name": "policy";
371
386
  "writable": true;
@@ -378,14 +393,26 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
378
393
  "path": "vault";
379
394
  }];
380
395
  };
396
+ }, {
397
+ "name": "tracker";
398
+ "writable": true;
399
+ "pda": {
400
+ "seeds": [{
401
+ "kind": "const";
402
+ "value": [116, 114, 97, 99, 107, 101, 114];
403
+ }, {
404
+ "kind": "account";
405
+ "path": "vault";
406
+ }];
407
+ };
381
408
  }];
382
409
  args: [{
383
- "name": "dailySpendingCap";
410
+ "name": "dailySpendingCapUsd";
384
411
  "type": {
385
412
  "option": "u64";
386
413
  };
387
414
  }, {
388
- "name": "maxTransactionSize";
415
+ "name": "maxTransactionSizeUsd";
389
416
  "type": {
390
417
  "option": "u64";
391
418
  };
@@ -393,7 +420,11 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
393
420
  "name": "allowedTokens";
394
421
  "type": {
395
422
  "option": {
396
- "vec": "pubkey";
423
+ "vec": {
424
+ "defined": {
425
+ "name": "allowedToken";
426
+ };
427
+ };
397
428
  };
398
429
  };
399
430
  }, {
@@ -423,6 +454,18 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
423
454
  "type": {
424
455
  "option": "u16";
425
456
  };
457
+ }, {
458
+ "name": "timelockDuration";
459
+ "type": {
460
+ "option": "u64";
461
+ };
462
+ }, {
463
+ "name": "allowedDestinations";
464
+ "type": {
465
+ "option": {
466
+ "vec": "pubkey";
467
+ };
468
+ };
426
469
  }];
427
470
  } & {
428
471
  name: "updatePolicy";
@@ -441,11 +484,11 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
441
484
  "path": "owner";
442
485
  }, {
443
486
  "kind": "account";
444
- "path": "vault.vaultId";
445
- "account": "AgentVault";
487
+ "path": "vault.vault_id";
488
+ "account": "agentVault";
446
489
  }];
447
490
  };
448
- relations: ["policy"];
491
+ relations: ["policy", "tracker"];
449
492
  } | {
450
493
  name: "policy";
451
494
  writable: true;
@@ -458,10 +501,22 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
458
501
  "path": "vault";
459
502
  }];
460
503
  };
504
+ } | {
505
+ name: "tracker";
506
+ writable: true;
507
+ pda: {
508
+ "seeds": [{
509
+ "kind": "const";
510
+ "value": [116, 114, 97, 99, 107, 101, 114];
511
+ }, {
512
+ "kind": "account";
513
+ "path": "vault";
514
+ }];
515
+ };
461
516
  }>;
462
- export declare function buildValidateAndAuthorize(program: Program<AgentShield>, agent: PublicKey, vault: PublicKey, params: AuthorizeParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
517
+ export declare function buildValidateAndAuthorize(program: Program<AgentShield>, agent: PublicKey, vault: PublicKey, vaultTokenAccount: PublicKey, params: AuthorizeParams, oracleFeedAccount?: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
463
518
  name: "validateAndAuthorize";
464
- docs: ["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)."];
519
+ docs: ["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)."];
465
520
  discriminator: [22, 183, 48, 222, 218, 11, 197, 152];
466
521
  accounts: [{
467
522
  "name": "agent";
@@ -477,11 +532,11 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
477
532
  }, {
478
533
  "kind": "account";
479
534
  "path": "vault.owner";
480
- "account": "AgentVault";
535
+ "account": "agentVault";
481
536
  }, {
482
537
  "kind": "account";
483
- "path": "vault.vaultId";
484
- "account": "AgentVault";
538
+ "path": "vault.vault_id";
539
+ "account": "agentVault";
485
540
  }];
486
541
  };
487
542
  "relations": ["policy", "tracker"];
@@ -510,7 +565,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
510
565
  };
511
566
  }, {
512
567
  "name": "session";
513
- "docs": ["Ephemeral session PDA \u2014 `init` ensures no double-authorization"];
568
+ "docs": ["Ephemeral session PDA \u2014 `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
514
569
  "writable": true;
515
570
  "pda": {
516
571
  "seeds": [{
@@ -522,8 +577,21 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
522
577
  }, {
523
578
  "kind": "account";
524
579
  "path": "agent";
580
+ }, {
581
+ "kind": "arg";
582
+ "path": "tokenMint";
525
583
  }];
526
584
  };
585
+ }, {
586
+ "name": "vaultTokenAccount";
587
+ "docs": ["Vault's PDA-owned token account for the spend token (delegation source)"];
588
+ "writable": true;
589
+ }, {
590
+ "name": "tokenMintAccount";
591
+ "docs": ["The token mint being spent"];
592
+ }, {
593
+ "name": "tokenProgram";
594
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
527
595
  }, {
528
596
  "name": "systemProgram";
529
597
  "address": "11111111111111111111111111111111";
@@ -532,7 +600,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
532
600
  "name": "actionType";
533
601
  "type": {
534
602
  "defined": {
535
- "name": "ActionType";
603
+ "name": "actionType";
536
604
  };
537
605
  };
538
606
  }, {
@@ -566,11 +634,11 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
566
634
  }, {
567
635
  "kind": "account";
568
636
  "path": "vault.owner";
569
- "account": "AgentVault";
637
+ "account": "agentVault";
570
638
  }, {
571
639
  "kind": "account";
572
- "path": "vault.vaultId";
573
- "account": "AgentVault";
640
+ "path": "vault.vault_id";
641
+ "account": "agentVault";
574
642
  }];
575
643
  };
576
644
  relations: ["policy", "tracker"];
@@ -599,7 +667,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
599
667
  };
600
668
  } | {
601
669
  name: "session";
602
- docs: ["Ephemeral session PDA \u2014 `init` ensures no double-authorization"];
670
+ docs: ["Ephemeral session PDA \u2014 `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
603
671
  writable: true;
604
672
  pda: {
605
673
  "seeds": [{
@@ -611,15 +679,28 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
611
679
  }, {
612
680
  "kind": "account";
613
681
  "path": "agent";
682
+ }, {
683
+ "kind": "arg";
684
+ "path": "tokenMint";
614
685
  }];
615
686
  };
687
+ } | {
688
+ name: "vaultTokenAccount";
689
+ docs: ["Vault's PDA-owned token account for the spend token (delegation source)"];
690
+ writable: true;
691
+ } | {
692
+ name: "tokenMintAccount";
693
+ docs: ["The token mint being spent"];
694
+ } | {
695
+ name: "tokenProgram";
696
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
616
697
  } | {
617
698
  name: "systemProgram";
618
699
  address: "11111111111111111111111111111111";
619
700
  }>;
620
- export declare function buildFinalizeSession(program: Program<AgentShield>, payer: PublicKey, vault: PublicKey, agent: PublicKey, success: boolean, vaultTokenAccount?: PublicKey | null, feeDestinationTokenAccount?: PublicKey | null, protocolTreasuryTokenAccount?: PublicKey | null): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
701
+ export declare function buildFinalizeSession(program: Program<AgentShield>, payer: PublicKey, vault: PublicKey, agent: PublicKey, tokenMint: PublicKey, success: boolean, vaultTokenAccount: PublicKey, feeDestinationTokenAccount?: PublicKey | null, protocolTreasuryTokenAccount?: PublicKey | null): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
621
702
  name: "finalizeSession";
622
- docs: ["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)."];
703
+ docs: ["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)."];
623
704
  discriminator: [34, 148, 144, 47, 37, 130, 206, 161];
624
705
  accounts: [{
625
706
  "name": "payer";
@@ -635,11 +716,11 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
635
716
  }, {
636
717
  "kind": "account";
637
718
  "path": "vault.owner";
638
- "account": "AgentVault";
719
+ "account": "agentVault";
639
720
  }, {
640
721
  "kind": "account";
641
- "path": "vault.vaultId";
642
- "account": "AgentVault";
722
+ "path": "vault.vault_id";
723
+ "account": "agentVault";
643
724
  }];
644
725
  };
645
726
  "relations": ["policy", "tracker", "session"];
@@ -668,7 +749,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
668
749
  };
669
750
  }, {
670
751
  "name": "session";
671
- "docs": ["Session rent is returned to the session's agent (who paid for it),", "not the arbitrary payer, to prevent rent theft."];
752
+ "docs": ["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."];
672
753
  "writable": true;
673
754
  "pda": {
674
755
  "seeds": [{
@@ -680,7 +761,11 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
680
761
  }, {
681
762
  "kind": "account";
682
763
  "path": "session.agent";
683
- "account": "SessionAuthority";
764
+ "account": "sessionAuthority";
765
+ }, {
766
+ "kind": "account";
767
+ "path": "session.authorized_token";
768
+ "account": "sessionAuthority";
684
769
  }];
685
770
  };
686
771
  }, {
@@ -689,7 +774,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
689
774
  "writable": true;
690
775
  }, {
691
776
  "name": "vaultTokenAccount";
692
- "docs": ["Vault's PDA token account for the session's token (fee source)"];
777
+ "docs": ["Vault's PDA token account for the session's token (fee source + delegation revocation)"];
693
778
  "writable": true;
694
779
  "optional": true;
695
780
  }, {
@@ -729,11 +814,11 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
729
814
  }, {
730
815
  "kind": "account";
731
816
  "path": "vault.owner";
732
- "account": "AgentVault";
817
+ "account": "agentVault";
733
818
  }, {
734
819
  "kind": "account";
735
- "path": "vault.vaultId";
736
- "account": "AgentVault";
820
+ "path": "vault.vault_id";
821
+ "account": "agentVault";
737
822
  }];
738
823
  };
739
824
  relations: ["policy", "tracker", "session"];
@@ -762,7 +847,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
762
847
  };
763
848
  } | {
764
849
  name: "session";
765
- docs: ["Session rent is returned to the session's agent (who paid for it),", "not the arbitrary payer, to prevent rent theft."];
850
+ docs: ["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."];
766
851
  writable: true;
767
852
  pda: {
768
853
  "seeds": [{
@@ -774,7 +859,11 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
774
859
  }, {
775
860
  "kind": "account";
776
861
  "path": "session.agent";
777
- "account": "SessionAuthority";
862
+ "account": "sessionAuthority";
863
+ }, {
864
+ "kind": "account";
865
+ "path": "session.authorized_token";
866
+ "account": "sessionAuthority";
778
867
  }];
779
868
  };
780
869
  } | {
@@ -783,7 +872,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
783
872
  writable: true;
784
873
  } | {
785
874
  name: "vaultTokenAccount";
786
- docs: ["Vault's PDA token account for the session's token (fee source)"];
875
+ docs: ["Vault's PDA token account for the session's token (fee source + delegation revocation)"];
787
876
  writable: true;
788
877
  optional: true;
789
878
  } | {
@@ -823,8 +912,8 @@ export declare function buildRevokeAgent(program: Program<AgentShield>, owner: P
823
912
  "path": "owner";
824
913
  }, {
825
914
  "kind": "account";
826
- "path": "vault.vaultId";
827
- "account": "AgentVault";
915
+ "path": "vault.vault_id";
916
+ "account": "agentVault";
828
917
  }];
829
918
  };
830
919
  }];
@@ -847,8 +936,8 @@ export declare function buildRevokeAgent(program: Program<AgentShield>, owner: P
847
936
  "path": "owner";
848
937
  }, {
849
938
  "kind": "account";
850
- "path": "vault.vaultId";
851
- "account": "AgentVault";
939
+ "path": "vault.vault_id";
940
+ "account": "agentVault";
852
941
  }];
853
942
  };
854
943
  }>;
@@ -872,8 +961,8 @@ export declare function buildReactivateVault(program: Program<AgentShield>, owne
872
961
  "path": "owner";
873
962
  }, {
874
963
  "kind": "account";
875
- "path": "vault.vaultId";
876
- "account": "AgentVault";
964
+ "path": "vault.vault_id";
965
+ "account": "agentVault";
877
966
  }];
878
967
  };
879
968
  }];
@@ -901,8 +990,8 @@ export declare function buildReactivateVault(program: Program<AgentShield>, owne
901
990
  "path": "owner";
902
991
  }, {
903
992
  "kind": "account";
904
- "path": "vault.vaultId";
905
- "account": "AgentVault";
993
+ "path": "vault.vault_id";
994
+ "account": "agentVault";
906
995
  }];
907
996
  };
908
997
  }>;
@@ -926,8 +1015,8 @@ export declare function buildWithdrawFunds(program: Program<AgentShield>, owner:
926
1015
  "path": "owner";
927
1016
  }, {
928
1017
  "kind": "account";
929
- "path": "vault.vaultId";
930
- "account": "AgentVault";
1018
+ "path": "vault.vault_id";
1019
+ "account": "agentVault";
931
1020
  }];
932
1021
  };
933
1022
  }, {
@@ -998,8 +1087,8 @@ export declare function buildWithdrawFunds(program: Program<AgentShield>, owner:
998
1087
  "path": "owner";
999
1088
  }, {
1000
1089
  "kind": "account";
1001
- "path": "vault.vaultId";
1002
- "account": "AgentVault";
1090
+ "path": "vault.vault_id";
1091
+ "account": "agentVault";
1003
1092
  }];
1004
1093
  };
1005
1094
  } | {
@@ -1069,8 +1158,8 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
1069
1158
  "path": "owner";
1070
1159
  }, {
1071
1160
  "kind": "account";
1072
- "path": "vault.vaultId";
1073
- "account": "AgentVault";
1161
+ "path": "vault.vault_id";
1162
+ "account": "agentVault";
1074
1163
  }];
1075
1164
  };
1076
1165
  "relations": ["policy", "tracker"];
@@ -1122,8 +1211,8 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
1122
1211
  "path": "owner";
1123
1212
  }, {
1124
1213
  "kind": "account";
1125
- "path": "vault.vaultId";
1126
- "account": "AgentVault";
1214
+ "path": "vault.vault_id";
1215
+ "account": "agentVault";
1127
1216
  }];
1128
1217
  };
1129
1218
  relations: ["policy", "tracker"];
@@ -1155,4 +1244,509 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
1155
1244
  name: "systemProgram";
1156
1245
  address: "11111111111111111111111111111111";
1157
1246
  }>;
1247
+ export declare function buildQueuePolicyUpdate(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey, params: QueuePolicyUpdateParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
1248
+ name: "queuePolicyUpdate";
1249
+ docs: ["Queue a policy update when timelock is active.", "Creates a PendingPolicyUpdate PDA that becomes executable after", "the timelock period expires."];
1250
+ discriminator: [149, 18, 76, 197, 179, 193, 91, 77];
1251
+ accounts: [{
1252
+ "name": "owner";
1253
+ "writable": true;
1254
+ "signer": true;
1255
+ "relations": ["vault"];
1256
+ }, {
1257
+ "name": "vault";
1258
+ "pda": {
1259
+ "seeds": [{
1260
+ "kind": "const";
1261
+ "value": [118, 97, 117, 108, 116];
1262
+ }, {
1263
+ "kind": "account";
1264
+ "path": "owner";
1265
+ }, {
1266
+ "kind": "account";
1267
+ "path": "vault.vault_id";
1268
+ "account": "agentVault";
1269
+ }];
1270
+ };
1271
+ "relations": ["policy"];
1272
+ }, {
1273
+ "name": "policy";
1274
+ "pda": {
1275
+ "seeds": [{
1276
+ "kind": "const";
1277
+ "value": [112, 111, 108, 105, 99, 121];
1278
+ }, {
1279
+ "kind": "account";
1280
+ "path": "vault";
1281
+ }];
1282
+ };
1283
+ }, {
1284
+ "name": "pendingPolicy";
1285
+ "writable": true;
1286
+ "pda": {
1287
+ "seeds": [{
1288
+ "kind": "const";
1289
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1290
+ }, {
1291
+ "kind": "account";
1292
+ "path": "vault";
1293
+ }];
1294
+ };
1295
+ }, {
1296
+ "name": "systemProgram";
1297
+ "address": "11111111111111111111111111111111";
1298
+ }];
1299
+ args: [{
1300
+ "name": "dailySpendingCapUsd";
1301
+ "type": {
1302
+ "option": "u64";
1303
+ };
1304
+ }, {
1305
+ "name": "maxTransactionAmountUsd";
1306
+ "type": {
1307
+ "option": "u64";
1308
+ };
1309
+ }, {
1310
+ "name": "allowedTokens";
1311
+ "type": {
1312
+ "option": {
1313
+ "vec": {
1314
+ "defined": {
1315
+ "name": "allowedToken";
1316
+ };
1317
+ };
1318
+ };
1319
+ };
1320
+ }, {
1321
+ "name": "allowedProtocols";
1322
+ "type": {
1323
+ "option": {
1324
+ "vec": "pubkey";
1325
+ };
1326
+ };
1327
+ }, {
1328
+ "name": "maxLeverageBps";
1329
+ "type": {
1330
+ "option": "u16";
1331
+ };
1332
+ }, {
1333
+ "name": "canOpenPositions";
1334
+ "type": {
1335
+ "option": "bool";
1336
+ };
1337
+ }, {
1338
+ "name": "maxConcurrentPositions";
1339
+ "type": {
1340
+ "option": "u8";
1341
+ };
1342
+ }, {
1343
+ "name": "developerFeeRate";
1344
+ "type": {
1345
+ "option": "u16";
1346
+ };
1347
+ }, {
1348
+ "name": "timelockDuration";
1349
+ "type": {
1350
+ "option": "u64";
1351
+ };
1352
+ }, {
1353
+ "name": "allowedDestinations";
1354
+ "type": {
1355
+ "option": {
1356
+ "vec": "pubkey";
1357
+ };
1358
+ };
1359
+ }];
1360
+ } & {
1361
+ name: "queuePolicyUpdate";
1362
+ }, {
1363
+ name: "owner";
1364
+ writable: true;
1365
+ signer: true;
1366
+ relations: ["vault"];
1367
+ } | {
1368
+ name: "vault";
1369
+ pda: {
1370
+ "seeds": [{
1371
+ "kind": "const";
1372
+ "value": [118, 97, 117, 108, 116];
1373
+ }, {
1374
+ "kind": "account";
1375
+ "path": "owner";
1376
+ }, {
1377
+ "kind": "account";
1378
+ "path": "vault.vault_id";
1379
+ "account": "agentVault";
1380
+ }];
1381
+ };
1382
+ relations: ["policy"];
1383
+ } | {
1384
+ name: "policy";
1385
+ pda: {
1386
+ "seeds": [{
1387
+ "kind": "const";
1388
+ "value": [112, 111, 108, 105, 99, 121];
1389
+ }, {
1390
+ "kind": "account";
1391
+ "path": "vault";
1392
+ }];
1393
+ };
1394
+ } | {
1395
+ name: "pendingPolicy";
1396
+ writable: true;
1397
+ pda: {
1398
+ "seeds": [{
1399
+ "kind": "const";
1400
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1401
+ }, {
1402
+ "kind": "account";
1403
+ "path": "vault";
1404
+ }];
1405
+ };
1406
+ } | {
1407
+ name: "systemProgram";
1408
+ address: "11111111111111111111111111111111";
1409
+ }>;
1410
+ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
1411
+ name: "applyPendingPolicy";
1412
+ docs: ["Apply a queued policy update after the timelock period has expired.", "Closes the PendingPolicyUpdate PDA and returns rent to the owner."];
1413
+ discriminator: [114, 212, 19, 227, 89, 199, 74, 62];
1414
+ accounts: [{
1415
+ "name": "owner";
1416
+ "writable": true;
1417
+ "signer": true;
1418
+ "relations": ["vault"];
1419
+ }, {
1420
+ "name": "vault";
1421
+ "pda": {
1422
+ "seeds": [{
1423
+ "kind": "const";
1424
+ "value": [118, 97, 117, 108, 116];
1425
+ }, {
1426
+ "kind": "account";
1427
+ "path": "owner";
1428
+ }, {
1429
+ "kind": "account";
1430
+ "path": "vault.vault_id";
1431
+ "account": "agentVault";
1432
+ }];
1433
+ };
1434
+ "relations": ["policy", "tracker", "pendingPolicy"];
1435
+ }, {
1436
+ "name": "policy";
1437
+ "writable": true;
1438
+ "pda": {
1439
+ "seeds": [{
1440
+ "kind": "const";
1441
+ "value": [112, 111, 108, 105, 99, 121];
1442
+ }, {
1443
+ "kind": "account";
1444
+ "path": "vault";
1445
+ }];
1446
+ };
1447
+ }, {
1448
+ "name": "tracker";
1449
+ "writable": true;
1450
+ "pda": {
1451
+ "seeds": [{
1452
+ "kind": "const";
1453
+ "value": [116, 114, 97, 99, 107, 101, 114];
1454
+ }, {
1455
+ "kind": "account";
1456
+ "path": "vault";
1457
+ }];
1458
+ };
1459
+ }, {
1460
+ "name": "pendingPolicy";
1461
+ "writable": true;
1462
+ "pda": {
1463
+ "seeds": [{
1464
+ "kind": "const";
1465
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1466
+ }, {
1467
+ "kind": "account";
1468
+ "path": "vault";
1469
+ }];
1470
+ };
1471
+ }];
1472
+ args: [];
1473
+ } & {
1474
+ name: "applyPendingPolicy";
1475
+ }, {
1476
+ name: "owner";
1477
+ writable: true;
1478
+ signer: true;
1479
+ relations: ["vault"];
1480
+ } | {
1481
+ name: "vault";
1482
+ pda: {
1483
+ "seeds": [{
1484
+ "kind": "const";
1485
+ "value": [118, 97, 117, 108, 116];
1486
+ }, {
1487
+ "kind": "account";
1488
+ "path": "owner";
1489
+ }, {
1490
+ "kind": "account";
1491
+ "path": "vault.vault_id";
1492
+ "account": "agentVault";
1493
+ }];
1494
+ };
1495
+ relations: ["policy", "tracker", "pendingPolicy"];
1496
+ } | {
1497
+ name: "policy";
1498
+ writable: true;
1499
+ pda: {
1500
+ "seeds": [{
1501
+ "kind": "const";
1502
+ "value": [112, 111, 108, 105, 99, 121];
1503
+ }, {
1504
+ "kind": "account";
1505
+ "path": "vault";
1506
+ }];
1507
+ };
1508
+ } | {
1509
+ name: "tracker";
1510
+ writable: true;
1511
+ pda: {
1512
+ "seeds": [{
1513
+ "kind": "const";
1514
+ "value": [116, 114, 97, 99, 107, 101, 114];
1515
+ }, {
1516
+ "kind": "account";
1517
+ "path": "vault";
1518
+ }];
1519
+ };
1520
+ } | {
1521
+ name: "pendingPolicy";
1522
+ writable: true;
1523
+ pda: {
1524
+ "seeds": [{
1525
+ "kind": "const";
1526
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1527
+ }, {
1528
+ "kind": "account";
1529
+ "path": "vault";
1530
+ }];
1531
+ };
1532
+ }>;
1533
+ export declare function buildCancelPendingPolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
1534
+ name: "cancelPendingPolicy";
1535
+ docs: ["Cancel a queued policy update. Closes the PendingPolicyUpdate PDA", "and returns rent to the owner."];
1536
+ discriminator: [153, 36, 104, 200, 50, 94, 207, 33];
1537
+ accounts: [{
1538
+ "name": "owner";
1539
+ "writable": true;
1540
+ "signer": true;
1541
+ "relations": ["vault"];
1542
+ }, {
1543
+ "name": "vault";
1544
+ "pda": {
1545
+ "seeds": [{
1546
+ "kind": "const";
1547
+ "value": [118, 97, 117, 108, 116];
1548
+ }, {
1549
+ "kind": "account";
1550
+ "path": "owner";
1551
+ }, {
1552
+ "kind": "account";
1553
+ "path": "vault.vault_id";
1554
+ "account": "agentVault";
1555
+ }];
1556
+ };
1557
+ "relations": ["pendingPolicy"];
1558
+ }, {
1559
+ "name": "pendingPolicy";
1560
+ "writable": true;
1561
+ "pda": {
1562
+ "seeds": [{
1563
+ "kind": "const";
1564
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1565
+ }, {
1566
+ "kind": "account";
1567
+ "path": "vault";
1568
+ }];
1569
+ };
1570
+ }];
1571
+ args: [];
1572
+ } & {
1573
+ name: "cancelPendingPolicy";
1574
+ }, {
1575
+ name: "owner";
1576
+ writable: true;
1577
+ signer: true;
1578
+ relations: ["vault"];
1579
+ } | {
1580
+ name: "vault";
1581
+ pda: {
1582
+ "seeds": [{
1583
+ "kind": "const";
1584
+ "value": [118, 97, 117, 108, 116];
1585
+ }, {
1586
+ "kind": "account";
1587
+ "path": "owner";
1588
+ }, {
1589
+ "kind": "account";
1590
+ "path": "vault.vault_id";
1591
+ "account": "agentVault";
1592
+ }];
1593
+ };
1594
+ relations: ["pendingPolicy"];
1595
+ } | {
1596
+ name: "pendingPolicy";
1597
+ writable: true;
1598
+ pda: {
1599
+ "seeds": [{
1600
+ "kind": "const";
1601
+ "value": [112, 101, 110, 100, 105, 110, 103, 95, 112, 111, 108, 105, 99, 121];
1602
+ }, {
1603
+ "kind": "account";
1604
+ "path": "vault";
1605
+ }];
1606
+ };
1607
+ }>;
1608
+ export declare function buildAgentTransfer(program: Program<AgentShield>, agent: PublicKey, vault: PublicKey, params: AgentTransferParams, oracleFeedAccount?: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
1609
+ name: "agentTransfer";
1610
+ docs: ["Transfer tokens from the vault to an allowed destination.", "Only the agent can call this. Respects destination allowlist,", "spending caps, and per-token limits."];
1611
+ discriminator: [199, 111, 151, 49, 124, 13, 150, 44];
1612
+ accounts: [{
1613
+ "name": "agent";
1614
+ "writable": true;
1615
+ "signer": true;
1616
+ }, {
1617
+ "name": "vault";
1618
+ "writable": true;
1619
+ "pda": {
1620
+ "seeds": [{
1621
+ "kind": "const";
1622
+ "value": [118, 97, 117, 108, 116];
1623
+ }, {
1624
+ "kind": "account";
1625
+ "path": "vault.owner";
1626
+ "account": "agentVault";
1627
+ }, {
1628
+ "kind": "account";
1629
+ "path": "vault.vault_id";
1630
+ "account": "agentVault";
1631
+ }];
1632
+ };
1633
+ "relations": ["policy", "tracker"];
1634
+ }, {
1635
+ "name": "policy";
1636
+ "pda": {
1637
+ "seeds": [{
1638
+ "kind": "const";
1639
+ "value": [112, 111, 108, 105, 99, 121];
1640
+ }, {
1641
+ "kind": "account";
1642
+ "path": "vault";
1643
+ }];
1644
+ };
1645
+ }, {
1646
+ "name": "tracker";
1647
+ "writable": true;
1648
+ "pda": {
1649
+ "seeds": [{
1650
+ "kind": "const";
1651
+ "value": [116, 114, 97, 99, 107, 101, 114];
1652
+ }, {
1653
+ "kind": "account";
1654
+ "path": "vault";
1655
+ }];
1656
+ };
1657
+ }, {
1658
+ "name": "vaultTokenAccount";
1659
+ "docs": ["Vault's PDA-owned token account (source)"];
1660
+ "writable": true;
1661
+ }, {
1662
+ "name": "destinationTokenAccount";
1663
+ "docs": ["Destination token account (must be in allowed destinations if configured)"];
1664
+ "writable": true;
1665
+ }, {
1666
+ "name": "feeDestinationTokenAccount";
1667
+ "docs": ["Developer fee destination token account \u2014 must match vault.fee_destination"];
1668
+ "writable": true;
1669
+ "optional": true;
1670
+ }, {
1671
+ "name": "protocolTreasuryTokenAccount";
1672
+ "docs": ["Protocol treasury token account"];
1673
+ "writable": true;
1674
+ "optional": true;
1675
+ }, {
1676
+ "name": "tokenProgram";
1677
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1678
+ }];
1679
+ args: [{
1680
+ "name": "amount";
1681
+ "type": "u64";
1682
+ }];
1683
+ } & {
1684
+ name: "agentTransfer";
1685
+ }, {
1686
+ name: "agent";
1687
+ writable: true;
1688
+ signer: true;
1689
+ } | {
1690
+ name: "vault";
1691
+ writable: true;
1692
+ pda: {
1693
+ "seeds": [{
1694
+ "kind": "const";
1695
+ "value": [118, 97, 117, 108, 116];
1696
+ }, {
1697
+ "kind": "account";
1698
+ "path": "vault.owner";
1699
+ "account": "agentVault";
1700
+ }, {
1701
+ "kind": "account";
1702
+ "path": "vault.vault_id";
1703
+ "account": "agentVault";
1704
+ }];
1705
+ };
1706
+ relations: ["policy", "tracker"];
1707
+ } | {
1708
+ name: "policy";
1709
+ pda: {
1710
+ "seeds": [{
1711
+ "kind": "const";
1712
+ "value": [112, 111, 108, 105, 99, 121];
1713
+ }, {
1714
+ "kind": "account";
1715
+ "path": "vault";
1716
+ }];
1717
+ };
1718
+ } | {
1719
+ name: "tracker";
1720
+ writable: true;
1721
+ pda: {
1722
+ "seeds": [{
1723
+ "kind": "const";
1724
+ "value": [116, 114, 97, 99, 107, 101, 114];
1725
+ }, {
1726
+ "kind": "account";
1727
+ "path": "vault";
1728
+ }];
1729
+ };
1730
+ } | {
1731
+ name: "vaultTokenAccount";
1732
+ docs: ["Vault's PDA-owned token account (source)"];
1733
+ writable: true;
1734
+ } | {
1735
+ name: "destinationTokenAccount";
1736
+ docs: ["Destination token account (must be in allowed destinations if configured)"];
1737
+ writable: true;
1738
+ } | {
1739
+ name: "feeDestinationTokenAccount";
1740
+ docs: ["Developer fee destination token account \u2014 must match vault.fee_destination"];
1741
+ writable: true;
1742
+ optional: true;
1743
+ } | {
1744
+ name: "protocolTreasuryTokenAccount";
1745
+ docs: ["Protocol treasury token account"];
1746
+ writable: true;
1747
+ optional: true;
1748
+ } | {
1749
+ name: "tokenProgram";
1750
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1751
+ }>;
1158
1752
  //# sourceMappingURL=instructions.d.ts.map