@agent-shield/sdk 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -13
- package/dist/accounts.d.ts +3 -1
- package/dist/accounts.d.ts.map +1 -1
- package/dist/accounts.js +9 -0
- package/dist/accounts.js.map +1 -1
- package/dist/client.d.ts +5 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -0
- package/dist/client.js.map +1 -1
- package/dist/idl-json.d.ts +1054 -2004
- package/dist/idl-json.d.ts.map +1 -1
- package/dist/idl-json.js +407 -455
- package/dist/idl-json.js.map +1 -1
- package/dist/idl.d.ts +458 -451
- package/dist/idl.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts +213 -147
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +65 -17
- package/dist/instructions.js.map +1 -1
- package/dist/types.d.ts +48 -66
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -13
- package/dist/types.js.map +1 -1
- package/dist/wrap.d.ts +2 -10
- package/dist/wrap.d.ts.map +1 -1
- package/dist/wrap.js +1 -32
- package/dist/wrap.js.map +1 -1
- package/dist/wrapper/harden.d.ts +5 -7
- package/dist/wrapper/harden.d.ts.map +1 -1
- package/dist/wrapper/harden.js +11 -35
- package/dist/wrapper/harden.js.map +1 -1
- package/dist/wrapper/index.d.ts +2 -1
- package/dist/wrapper/index.d.ts.map +1 -1
- package/dist/wrapper/index.js +4 -2
- package/dist/wrapper/index.js.map +1 -1
- package/package.json +4 -4
package/dist/instructions.d.ts
CHANGED
|
@@ -1,9 +1,106 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { BN, Program } from "@coral-xyz/anchor";
|
|
3
|
-
import type { AgentShield, InitializeVaultParams, UpdatePolicyParams, QueuePolicyUpdateParams, AgentTransferParams, AuthorizeParams } from "./types";
|
|
3
|
+
import type { AgentShield, InitializeVaultParams, UpdatePolicyParams, QueuePolicyUpdateParams, AgentTransferParams, AuthorizeParams, InitializeOracleRegistryParams, UpdateOracleRegistryParams } from "./types";
|
|
4
|
+
export declare function buildInitializeOracleRegistry(program: Program<AgentShield>, authority: PublicKey, params: InitializeOracleRegistryParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
5
|
+
name: "initializeOracleRegistry";
|
|
6
|
+
docs: ["Initialize the protocol-level oracle registry.", "Only called once. The authority becomes the registry admin."];
|
|
7
|
+
discriminator: [190, 92, 228, 114, 56, 71, 101, 220];
|
|
8
|
+
accounts: [{
|
|
9
|
+
name: "authority";
|
|
10
|
+
writable: true;
|
|
11
|
+
signer: true;
|
|
12
|
+
}, {
|
|
13
|
+
name: "oracleRegistry";
|
|
14
|
+
writable: true;
|
|
15
|
+
pda: {
|
|
16
|
+
seeds: [{
|
|
17
|
+
kind: "const";
|
|
18
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
19
|
+
}];
|
|
20
|
+
};
|
|
21
|
+
}, {
|
|
22
|
+
name: "systemProgram";
|
|
23
|
+
address: "11111111111111111111111111111111";
|
|
24
|
+
}];
|
|
25
|
+
args: [{
|
|
26
|
+
name: "entries";
|
|
27
|
+
type: {
|
|
28
|
+
vec: {
|
|
29
|
+
defined: {
|
|
30
|
+
name: "oracleEntry";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}];
|
|
35
|
+
} & {
|
|
36
|
+
name: "initializeOracleRegistry";
|
|
37
|
+
}, {
|
|
38
|
+
name: "authority";
|
|
39
|
+
writable: true;
|
|
40
|
+
signer: true;
|
|
41
|
+
} | {
|
|
42
|
+
name: "oracleRegistry";
|
|
43
|
+
writable: true;
|
|
44
|
+
pda: {
|
|
45
|
+
seeds: [{
|
|
46
|
+
kind: "const";
|
|
47
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
48
|
+
}];
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
name: "systemProgram";
|
|
52
|
+
address: "11111111111111111111111111111111";
|
|
53
|
+
}>;
|
|
54
|
+
export declare function buildUpdateOracleRegistry(program: Program<AgentShield>, authority: PublicKey, params: UpdateOracleRegistryParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
55
|
+
name: "updateOracleRegistry";
|
|
56
|
+
docs: ["Add or remove entries from the oracle registry.", "Only the registry authority can call this."];
|
|
57
|
+
discriminator: [184, 234, 19, 21, 41, 240, 100, 14];
|
|
58
|
+
accounts: [{
|
|
59
|
+
name: "authority";
|
|
60
|
+
signer: true;
|
|
61
|
+
}, {
|
|
62
|
+
name: "oracleRegistry";
|
|
63
|
+
writable: true;
|
|
64
|
+
pda: {
|
|
65
|
+
seeds: [{
|
|
66
|
+
kind: "const";
|
|
67
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
}];
|
|
71
|
+
args: [{
|
|
72
|
+
name: "entriesToAdd";
|
|
73
|
+
type: {
|
|
74
|
+
vec: {
|
|
75
|
+
defined: {
|
|
76
|
+
name: "oracleEntry";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
name: "mintsToRemove";
|
|
82
|
+
type: {
|
|
83
|
+
vec: "pubkey";
|
|
84
|
+
};
|
|
85
|
+
}];
|
|
86
|
+
} & {
|
|
87
|
+
name: "updateOracleRegistry";
|
|
88
|
+
}, {
|
|
89
|
+
name: "authority";
|
|
90
|
+
signer: true;
|
|
91
|
+
} | {
|
|
92
|
+
name: "oracleRegistry";
|
|
93
|
+
writable: true;
|
|
94
|
+
pda: {
|
|
95
|
+
seeds: [{
|
|
96
|
+
kind: "const";
|
|
97
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
98
|
+
}];
|
|
99
|
+
};
|
|
100
|
+
}>;
|
|
4
101
|
export declare function buildInitializeVault(program: Program<AgentShield>, owner: PublicKey, params: InitializeVaultParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
5
102
|
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."
|
|
103
|
+
docs: ["Initialize a new agent vault with policy configuration.", "Only the owner can call this. Creates vault PDA, policy PDA,", "and zero-copy spend tracker PDA."];
|
|
7
104
|
discriminator: [48, 191, 163, 44, 71, 129, 63, 164];
|
|
8
105
|
accounts: [{
|
|
9
106
|
name: "owner";
|
|
@@ -38,6 +135,7 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
38
135
|
};
|
|
39
136
|
}, {
|
|
40
137
|
name: "tracker";
|
|
138
|
+
docs: ["Zero-copy SpendTracker \u2014 2,352 bytes fixed size"];
|
|
41
139
|
writable: true;
|
|
42
140
|
pda: {
|
|
43
141
|
seeds: [{
|
|
@@ -50,7 +148,6 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
50
148
|
};
|
|
51
149
|
}, {
|
|
52
150
|
name: "feeDestination";
|
|
53
|
-
docs: ["The protocol treasury that receives fees"];
|
|
54
151
|
}, {
|
|
55
152
|
name: "systemProgram";
|
|
56
153
|
address: "11111111111111111111111111111111";
|
|
@@ -65,16 +162,10 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
65
162
|
name: "maxTransactionSizeUsd";
|
|
66
163
|
type: "u64";
|
|
67
164
|
}, {
|
|
68
|
-
name: "
|
|
69
|
-
type:
|
|
70
|
-
vec: {
|
|
71
|
-
defined: {
|
|
72
|
-
name: "allowedToken";
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
};
|
|
165
|
+
name: "protocolMode";
|
|
166
|
+
type: "u8";
|
|
76
167
|
}, {
|
|
77
|
-
name: "
|
|
168
|
+
name: "protocols";
|
|
78
169
|
type: {
|
|
79
170
|
vec: "pubkey";
|
|
80
171
|
};
|
|
@@ -95,9 +186,6 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
95
186
|
type: {
|
|
96
187
|
vec: "pubkey";
|
|
97
188
|
};
|
|
98
|
-
}, {
|
|
99
|
-
name: "trackerTier";
|
|
100
|
-
type: "u8";
|
|
101
189
|
}];
|
|
102
190
|
} & {
|
|
103
191
|
name: "initializeVault";
|
|
@@ -134,6 +222,7 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
134
222
|
};
|
|
135
223
|
} | {
|
|
136
224
|
name: "tracker";
|
|
225
|
+
docs: ["Zero-copy SpendTracker \u2014 2,352 bytes fixed size"];
|
|
137
226
|
writable: true;
|
|
138
227
|
pda: {
|
|
139
228
|
seeds: [{
|
|
@@ -146,7 +235,6 @@ export declare function buildInitializeVault(program: Program<AgentShield>, owne
|
|
|
146
235
|
};
|
|
147
236
|
} | {
|
|
148
237
|
name: "feeDestination";
|
|
149
|
-
docs: ["The protocol treasury that receives fees"];
|
|
150
238
|
} | {
|
|
151
239
|
name: "systemProgram";
|
|
152
240
|
address: "11111111111111111111111111111111";
|
|
@@ -359,7 +447,7 @@ export declare function buildRegisterAgent(program: Program<AgentShield>, owner:
|
|
|
359
447
|
}>;
|
|
360
448
|
export declare function buildUpdatePolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey, params: UpdatePolicyParams): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
361
449
|
name: "updatePolicy";
|
|
362
|
-
docs: ["Update the policy configuration for a vault.", "Only the owner can call this.
|
|
450
|
+
docs: ["Update the policy configuration for a vault.", "Only the owner can call this. Blocked when timelock > 0."];
|
|
363
451
|
discriminator: [212, 245, 246, 7, 163, 151, 18, 57];
|
|
364
452
|
accounts: [{
|
|
365
453
|
name: "owner";
|
|
@@ -380,7 +468,7 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
|
|
|
380
468
|
account: "agentVault";
|
|
381
469
|
}];
|
|
382
470
|
};
|
|
383
|
-
relations: ["policy"
|
|
471
|
+
relations: ["policy"];
|
|
384
472
|
}, {
|
|
385
473
|
name: "policy";
|
|
386
474
|
writable: true;
|
|
@@ -393,18 +481,6 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
|
|
|
393
481
|
path: "vault";
|
|
394
482
|
}];
|
|
395
483
|
};
|
|
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
|
-
};
|
|
408
484
|
}];
|
|
409
485
|
args: [{
|
|
410
486
|
name: "dailySpendingCapUsd";
|
|
@@ -417,18 +493,12 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
|
|
|
417
493
|
option: "u64";
|
|
418
494
|
};
|
|
419
495
|
}, {
|
|
420
|
-
name: "
|
|
496
|
+
name: "protocolMode";
|
|
421
497
|
type: {
|
|
422
|
-
option:
|
|
423
|
-
vec: {
|
|
424
|
-
defined: {
|
|
425
|
-
name: "allowedToken";
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
|
-
};
|
|
498
|
+
option: "u8";
|
|
429
499
|
};
|
|
430
500
|
}, {
|
|
431
|
-
name: "
|
|
501
|
+
name: "protocols";
|
|
432
502
|
type: {
|
|
433
503
|
option: {
|
|
434
504
|
vec: "pubkey";
|
|
@@ -488,7 +558,7 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
|
|
|
488
558
|
account: "agentVault";
|
|
489
559
|
}];
|
|
490
560
|
};
|
|
491
|
-
relations: ["policy"
|
|
561
|
+
relations: ["policy"];
|
|
492
562
|
} | {
|
|
493
563
|
name: "policy";
|
|
494
564
|
writable: true;
|
|
@@ -501,22 +571,18 @@ export declare function buildUpdatePolicy(program: Program<AgentShield>, owner:
|
|
|
501
571
|
path: "vault";
|
|
502
572
|
}];
|
|
503
573
|
};
|
|
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
|
-
};
|
|
516
574
|
}>;
|
|
517
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Build a validate_and_authorize instruction.
|
|
577
|
+
*
|
|
578
|
+
* @param oracleFeedAccount - Required for non-stablecoin tokens. Omitting this
|
|
579
|
+
* for tokens that have an oracle feed in the registry will cause an on-chain
|
|
580
|
+
* `OracleAccountMissing` error (6032). Use `resolveOracleFeed()` to look up
|
|
581
|
+
* the correct feed account for a given token mint.
|
|
582
|
+
*/
|
|
583
|
+
export declare function buildValidateAndAuthorize(program: Program<AgentShield>, agent: PublicKey, vault: PublicKey, vaultTokenAccount: PublicKey, params: AuthorizeParams, oracleFeedAccount?: PublicKey, fallbackOracleFeedAccount?: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
518
584
|
name: "validateAndAuthorize";
|
|
519
|
-
docs: ["Core permission check. Called by the agent before a DeFi action.", "Validates
|
|
585
|
+
docs: ["Core permission check. Called by the agent before a DeFi action.", "Validates against policy constraints + oracle registry.", "Creates a SessionAuthority PDA, delegates tokens to agent."];
|
|
520
586
|
discriminator: [22, 183, 48, 222, 218, 11, 197, 152];
|
|
521
587
|
accounts: [{
|
|
522
588
|
name: "agent";
|
|
@@ -539,7 +605,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
539
605
|
account: "agentVault";
|
|
540
606
|
}];
|
|
541
607
|
};
|
|
542
|
-
relations: ["policy"
|
|
608
|
+
relations: ["policy"];
|
|
543
609
|
}, {
|
|
544
610
|
name: "policy";
|
|
545
611
|
pda: {
|
|
@@ -553,6 +619,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
553
619
|
};
|
|
554
620
|
}, {
|
|
555
621
|
name: "tracker";
|
|
622
|
+
docs: ["Zero-copy SpendTracker"];
|
|
556
623
|
writable: true;
|
|
557
624
|
pda: {
|
|
558
625
|
seeds: [{
|
|
@@ -563,6 +630,15 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
563
630
|
path: "vault";
|
|
564
631
|
}];
|
|
565
632
|
};
|
|
633
|
+
}, {
|
|
634
|
+
name: "oracleRegistry";
|
|
635
|
+
docs: ["Protocol-level oracle registry (shared across all vaults)"];
|
|
636
|
+
pda: {
|
|
637
|
+
seeds: [{
|
|
638
|
+
kind: "const";
|
|
639
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
640
|
+
}];
|
|
641
|
+
};
|
|
566
642
|
}, {
|
|
567
643
|
name: "session";
|
|
568
644
|
docs: ["Ephemeral session PDA \u2014 `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
|
|
@@ -584,7 +660,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
584
660
|
};
|
|
585
661
|
}, {
|
|
586
662
|
name: "vaultTokenAccount";
|
|
587
|
-
docs: ["Vault's PDA-owned token account for the spend token
|
|
663
|
+
docs: ["Vault's PDA-owned token account for the spend token"];
|
|
588
664
|
writable: true;
|
|
589
665
|
}, {
|
|
590
666
|
name: "tokenMintAccount";
|
|
@@ -641,7 +717,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
641
717
|
account: "agentVault";
|
|
642
718
|
}];
|
|
643
719
|
};
|
|
644
|
-
relations: ["policy"
|
|
720
|
+
relations: ["policy"];
|
|
645
721
|
} | {
|
|
646
722
|
name: "policy";
|
|
647
723
|
pda: {
|
|
@@ -655,6 +731,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
655
731
|
};
|
|
656
732
|
} | {
|
|
657
733
|
name: "tracker";
|
|
734
|
+
docs: ["Zero-copy SpendTracker"];
|
|
658
735
|
writable: true;
|
|
659
736
|
pda: {
|
|
660
737
|
seeds: [{
|
|
@@ -665,6 +742,15 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
665
742
|
path: "vault";
|
|
666
743
|
}];
|
|
667
744
|
};
|
|
745
|
+
} | {
|
|
746
|
+
name: "oracleRegistry";
|
|
747
|
+
docs: ["Protocol-level oracle registry (shared across all vaults)"];
|
|
748
|
+
pda: {
|
|
749
|
+
seeds: [{
|
|
750
|
+
kind: "const";
|
|
751
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
752
|
+
}];
|
|
753
|
+
};
|
|
668
754
|
} | {
|
|
669
755
|
name: "session";
|
|
670
756
|
docs: ["Ephemeral session PDA \u2014 `init` ensures no double-authorization.", "Seeds include token_mint for per-token concurrent sessions."];
|
|
@@ -686,7 +772,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
686
772
|
};
|
|
687
773
|
} | {
|
|
688
774
|
name: "vaultTokenAccount";
|
|
689
|
-
docs: ["Vault's PDA-owned token account for the spend token
|
|
775
|
+
docs: ["Vault's PDA-owned token account for the spend token"];
|
|
690
776
|
writable: true;
|
|
691
777
|
} | {
|
|
692
778
|
name: "tokenMintAccount";
|
|
@@ -700,7 +786,7 @@ export declare function buildValidateAndAuthorize(program: Program<AgentShield>,
|
|
|
700
786
|
}>;
|
|
701
787
|
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, {
|
|
702
788
|
name: "finalizeSession";
|
|
703
|
-
docs: ["Finalize a session after the DeFi action completes.", "Revokes
|
|
789
|
+
docs: ["Finalize a session after the DeFi action completes.", "Revokes delegation, collects fees, closes the SessionAuthority PDA."];
|
|
704
790
|
discriminator: [34, 148, 144, 47, 37, 130, 206, 161];
|
|
705
791
|
accounts: [{
|
|
706
792
|
name: "payer";
|
|
@@ -723,7 +809,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
723
809
|
account: "agentVault";
|
|
724
810
|
}];
|
|
725
811
|
};
|
|
726
|
-
relations: ["policy", "
|
|
812
|
+
relations: ["policy", "session"];
|
|
727
813
|
}, {
|
|
728
814
|
name: "policy";
|
|
729
815
|
pda: {
|
|
@@ -735,21 +821,9 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
735
821
|
path: "vault";
|
|
736
822
|
}];
|
|
737
823
|
};
|
|
738
|
-
}, {
|
|
739
|
-
name: "tracker";
|
|
740
|
-
writable: true;
|
|
741
|
-
pda: {
|
|
742
|
-
seeds: [{
|
|
743
|
-
kind: "const";
|
|
744
|
-
value: [116, 114, 97, 99, 107, 101, 114];
|
|
745
|
-
}, {
|
|
746
|
-
kind: "account";
|
|
747
|
-
path: "vault";
|
|
748
|
-
}];
|
|
749
|
-
};
|
|
750
824
|
}, {
|
|
751
825
|
name: "session";
|
|
752
|
-
docs: ["Session rent is returned to the session's agent (who paid for it)
|
|
826
|
+
docs: ["Session rent is returned to the session's agent (who paid for it).", "Seeds include token_mint for per-token concurrent sessions."];
|
|
753
827
|
writable: true;
|
|
754
828
|
pda: {
|
|
755
829
|
seeds: [{
|
|
@@ -770,21 +844,20 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
770
844
|
};
|
|
771
845
|
}, {
|
|
772
846
|
name: "sessionRentRecipient";
|
|
773
|
-
docs: ["Validated in handler to equal session.agent."];
|
|
774
847
|
writable: true;
|
|
775
848
|
}, {
|
|
776
849
|
name: "vaultTokenAccount";
|
|
777
|
-
docs: ["Vault's PDA token account for the session's token
|
|
850
|
+
docs: ["Vault's PDA token account for the session's token"];
|
|
778
851
|
writable: true;
|
|
779
852
|
optional: true;
|
|
780
853
|
}, {
|
|
781
854
|
name: "feeDestinationTokenAccount";
|
|
782
|
-
docs: ["Developer fee destination token account
|
|
855
|
+
docs: ["Developer fee destination token account"];
|
|
783
856
|
writable: true;
|
|
784
857
|
optional: true;
|
|
785
858
|
}, {
|
|
786
859
|
name: "protocolTreasuryTokenAccount";
|
|
787
|
-
docs: ["Protocol treasury token account
|
|
860
|
+
docs: ["Protocol treasury token account"];
|
|
788
861
|
writable: true;
|
|
789
862
|
optional: true;
|
|
790
863
|
}, {
|
|
@@ -821,7 +894,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
821
894
|
account: "agentVault";
|
|
822
895
|
}];
|
|
823
896
|
};
|
|
824
|
-
relations: ["policy", "
|
|
897
|
+
relations: ["policy", "session"];
|
|
825
898
|
} | {
|
|
826
899
|
name: "policy";
|
|
827
900
|
pda: {
|
|
@@ -833,21 +906,9 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
833
906
|
path: "vault";
|
|
834
907
|
}];
|
|
835
908
|
};
|
|
836
|
-
} | {
|
|
837
|
-
name: "tracker";
|
|
838
|
-
writable: true;
|
|
839
|
-
pda: {
|
|
840
|
-
seeds: [{
|
|
841
|
-
kind: "const";
|
|
842
|
-
value: [116, 114, 97, 99, 107, 101, 114];
|
|
843
|
-
}, {
|
|
844
|
-
kind: "account";
|
|
845
|
-
path: "vault";
|
|
846
|
-
}];
|
|
847
|
-
};
|
|
848
909
|
} | {
|
|
849
910
|
name: "session";
|
|
850
|
-
docs: ["Session rent is returned to the session's agent (who paid for it)
|
|
911
|
+
docs: ["Session rent is returned to the session's agent (who paid for it).", "Seeds include token_mint for per-token concurrent sessions."];
|
|
851
912
|
writable: true;
|
|
852
913
|
pda: {
|
|
853
914
|
seeds: [{
|
|
@@ -868,21 +929,20 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
868
929
|
};
|
|
869
930
|
} | {
|
|
870
931
|
name: "sessionRentRecipient";
|
|
871
|
-
docs: ["Validated in handler to equal session.agent."];
|
|
872
932
|
writable: true;
|
|
873
933
|
} | {
|
|
874
934
|
name: "vaultTokenAccount";
|
|
875
|
-
docs: ["Vault's PDA token account for the session's token
|
|
935
|
+
docs: ["Vault's PDA token account for the session's token"];
|
|
876
936
|
writable: true;
|
|
877
937
|
optional: true;
|
|
878
938
|
} | {
|
|
879
939
|
name: "feeDestinationTokenAccount";
|
|
880
|
-
docs: ["Developer fee destination token account
|
|
940
|
+
docs: ["Developer fee destination token account"];
|
|
881
941
|
writable: true;
|
|
882
942
|
optional: true;
|
|
883
943
|
} | {
|
|
884
944
|
name: "protocolTreasuryTokenAccount";
|
|
885
|
-
docs: ["Protocol treasury token account
|
|
945
|
+
docs: ["Protocol treasury token account"];
|
|
886
946
|
writable: true;
|
|
887
947
|
optional: true;
|
|
888
948
|
} | {
|
|
@@ -894,7 +954,7 @@ export declare function buildFinalizeSession(program: Program<AgentShield>, paye
|
|
|
894
954
|
}>;
|
|
895
955
|
export declare function buildRevokeAgent(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
896
956
|
name: "revokeAgent";
|
|
897
|
-
docs: ["Kill switch. Immediately freezes the vault
|
|
957
|
+
docs: ["Kill switch. Immediately freezes the vault.", "Only the owner can call this."];
|
|
898
958
|
discriminator: [227, 60, 209, 125, 240, 117, 163, 73];
|
|
899
959
|
accounts: [{
|
|
900
960
|
name: "owner";
|
|
@@ -943,7 +1003,7 @@ export declare function buildRevokeAgent(program: Program<AgentShield>, owner: P
|
|
|
943
1003
|
}>;
|
|
944
1004
|
export declare function buildReactivateVault(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey, newAgent?: PublicKey | null): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
945
1005
|
name: "reactivateVault";
|
|
946
|
-
docs: ["Reactivate a frozen vault. Optionally rotate the agent key."
|
|
1006
|
+
docs: ["Reactivate a frozen vault. Optionally rotate the agent key."];
|
|
947
1007
|
discriminator: [245, 50, 143, 70, 114, 220, 25, 251];
|
|
948
1008
|
accounts: [{
|
|
949
1009
|
name: "owner";
|
|
@@ -997,7 +1057,7 @@ export declare function buildReactivateVault(program: Program<AgentShield>, owne
|
|
|
997
1057
|
}>;
|
|
998
1058
|
export declare function buildWithdrawFunds(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey, mint: PublicKey, amount: BN): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
999
1059
|
name: "withdrawFunds";
|
|
1000
|
-
docs: ["Withdraw tokens from the vault back to the owner."
|
|
1060
|
+
docs: ["Withdraw tokens from the vault back to the owner."];
|
|
1001
1061
|
discriminator: [241, 36, 29, 111, 208, 31, 104, 217];
|
|
1002
1062
|
accounts: [{
|
|
1003
1063
|
name: "owner";
|
|
@@ -1139,7 +1199,7 @@ export declare function buildWithdrawFunds(program: Program<AgentShield>, owner:
|
|
|
1139
1199
|
}>;
|
|
1140
1200
|
export declare function buildCloseVault(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
1141
1201
|
name: "closeVault";
|
|
1142
|
-
docs: ["Close the vault entirely.
|
|
1202
|
+
docs: ["Close the vault entirely. Reclaims rent from all PDAs."];
|
|
1143
1203
|
discriminator: [141, 103, 17, 126, 72, 75, 29, 29];
|
|
1144
1204
|
accounts: [{
|
|
1145
1205
|
name: "owner";
|
|
@@ -1162,7 +1222,7 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
|
|
|
1162
1222
|
account: "agentVault";
|
|
1163
1223
|
}];
|
|
1164
1224
|
};
|
|
1165
|
-
relations: ["policy"
|
|
1225
|
+
relations: ["policy"];
|
|
1166
1226
|
}, {
|
|
1167
1227
|
name: "policy";
|
|
1168
1228
|
writable: true;
|
|
@@ -1177,6 +1237,7 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
|
|
|
1177
1237
|
};
|
|
1178
1238
|
}, {
|
|
1179
1239
|
name: "tracker";
|
|
1240
|
+
docs: ["Zero-copy SpendTracker \u2014 close returns rent to owner"];
|
|
1180
1241
|
writable: true;
|
|
1181
1242
|
pda: {
|
|
1182
1243
|
seeds: [{
|
|
@@ -1215,7 +1276,7 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
|
|
|
1215
1276
|
account: "agentVault";
|
|
1216
1277
|
}];
|
|
1217
1278
|
};
|
|
1218
|
-
relations: ["policy"
|
|
1279
|
+
relations: ["policy"];
|
|
1219
1280
|
} | {
|
|
1220
1281
|
name: "policy";
|
|
1221
1282
|
writable: true;
|
|
@@ -1230,6 +1291,7 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
|
|
|
1230
1291
|
};
|
|
1231
1292
|
} | {
|
|
1232
1293
|
name: "tracker";
|
|
1294
|
+
docs: ["Zero-copy SpendTracker \u2014 close returns rent to owner"];
|
|
1233
1295
|
writable: true;
|
|
1234
1296
|
pda: {
|
|
1235
1297
|
seeds: [{
|
|
@@ -1246,7 +1308,7 @@ export declare function buildCloseVault(program: Program<AgentShield>, owner: Pu
|
|
|
1246
1308
|
}>;
|
|
1247
1309
|
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
1310
|
name: "queuePolicyUpdate";
|
|
1249
|
-
docs: ["Queue a policy update when timelock is active."
|
|
1311
|
+
docs: ["Queue a policy update when timelock is active."];
|
|
1250
1312
|
discriminator: [149, 18, 76, 197, 179, 193, 91, 77];
|
|
1251
1313
|
accounts: [{
|
|
1252
1314
|
name: "owner";
|
|
@@ -1307,18 +1369,12 @@ export declare function buildQueuePolicyUpdate(program: Program<AgentShield>, ow
|
|
|
1307
1369
|
option: "u64";
|
|
1308
1370
|
};
|
|
1309
1371
|
}, {
|
|
1310
|
-
name: "
|
|
1372
|
+
name: "protocolMode";
|
|
1311
1373
|
type: {
|
|
1312
|
-
option:
|
|
1313
|
-
vec: {
|
|
1314
|
-
defined: {
|
|
1315
|
-
name: "allowedToken";
|
|
1316
|
-
};
|
|
1317
|
-
};
|
|
1318
|
-
};
|
|
1374
|
+
option: "u8";
|
|
1319
1375
|
};
|
|
1320
1376
|
}, {
|
|
1321
|
-
name: "
|
|
1377
|
+
name: "protocols";
|
|
1322
1378
|
type: {
|
|
1323
1379
|
option: {
|
|
1324
1380
|
vec: "pubkey";
|
|
@@ -1409,7 +1465,7 @@ export declare function buildQueuePolicyUpdate(program: Program<AgentShield>, ow
|
|
|
1409
1465
|
}>;
|
|
1410
1466
|
export declare function buildApplyPendingPolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
1411
1467
|
name: "applyPendingPolicy";
|
|
1412
|
-
docs: ["Apply a queued policy update after the timelock
|
|
1468
|
+
docs: ["Apply a queued policy update after the timelock expires."];
|
|
1413
1469
|
discriminator: [114, 212, 19, 227, 89, 199, 74, 62];
|
|
1414
1470
|
accounts: [{
|
|
1415
1471
|
name: "owner";
|
|
@@ -1431,7 +1487,7 @@ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, o
|
|
|
1431
1487
|
account: "agentVault";
|
|
1432
1488
|
}];
|
|
1433
1489
|
};
|
|
1434
|
-
relations: ["policy", "
|
|
1490
|
+
relations: ["policy", "pendingPolicy"];
|
|
1435
1491
|
}, {
|
|
1436
1492
|
name: "policy";
|
|
1437
1493
|
writable: true;
|
|
@@ -1444,18 +1500,6 @@ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, o
|
|
|
1444
1500
|
path: "vault";
|
|
1445
1501
|
}];
|
|
1446
1502
|
};
|
|
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
1503
|
}, {
|
|
1460
1504
|
name: "pendingPolicy";
|
|
1461
1505
|
writable: true;
|
|
@@ -1492,7 +1536,7 @@ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, o
|
|
|
1492
1536
|
account: "agentVault";
|
|
1493
1537
|
}];
|
|
1494
1538
|
};
|
|
1495
|
-
relations: ["policy", "
|
|
1539
|
+
relations: ["policy", "pendingPolicy"];
|
|
1496
1540
|
} | {
|
|
1497
1541
|
name: "policy";
|
|
1498
1542
|
writable: true;
|
|
@@ -1505,18 +1549,6 @@ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, o
|
|
|
1505
1549
|
path: "vault";
|
|
1506
1550
|
}];
|
|
1507
1551
|
};
|
|
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
1552
|
} | {
|
|
1521
1553
|
name: "pendingPolicy";
|
|
1522
1554
|
writable: true;
|
|
@@ -1532,7 +1564,7 @@ export declare function buildApplyPendingPolicy(program: Program<AgentShield>, o
|
|
|
1532
1564
|
}>;
|
|
1533
1565
|
export declare function buildCancelPendingPolicy(program: Program<AgentShield>, owner: PublicKey, vault: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
1534
1566
|
name: "cancelPendingPolicy";
|
|
1535
|
-
docs: ["Cancel a queued policy update.
|
|
1567
|
+
docs: ["Cancel a queued policy update."];
|
|
1536
1568
|
discriminator: [153, 36, 104, 200, 50, 94, 207, 33];
|
|
1537
1569
|
accounts: [{
|
|
1538
1570
|
name: "owner";
|
|
@@ -1605,9 +1637,17 @@ export declare function buildCancelPendingPolicy(program: Program<AgentShield>,
|
|
|
1605
1637
|
}];
|
|
1606
1638
|
};
|
|
1607
1639
|
}>;
|
|
1608
|
-
|
|
1640
|
+
/**
|
|
1641
|
+
* Build an agent_transfer instruction.
|
|
1642
|
+
*
|
|
1643
|
+
* @param oracleFeedAccount - Required for non-stablecoin tokens. Omitting this
|
|
1644
|
+
* for tokens that have an oracle feed in the registry will cause an on-chain
|
|
1645
|
+
* `OracleAccountMissing` error (6032). Use `resolveOracleFeed()` to look up
|
|
1646
|
+
* the correct feed account for a given token mint.
|
|
1647
|
+
*/
|
|
1648
|
+
export declare function buildAgentTransfer(program: Program<AgentShield>, agent: PublicKey, vault: PublicKey, params: AgentTransferParams, oracleFeedAccount?: PublicKey, fallbackOracleFeedAccount?: PublicKey): import("@coral-xyz/anchor/dist/cjs/program/namespace/methods").MethodsBuilder<AgentShield, {
|
|
1609
1649
|
name: "agentTransfer";
|
|
1610
|
-
docs: ["Transfer tokens from the vault to an allowed destination.", "Only the agent can call this.
|
|
1650
|
+
docs: ["Transfer tokens from the vault to an allowed destination.", "Only the agent can call this."];
|
|
1611
1651
|
discriminator: [199, 111, 151, 49, 124, 13, 150, 44];
|
|
1612
1652
|
accounts: [{
|
|
1613
1653
|
name: "agent";
|
|
@@ -1630,7 +1670,7 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1630
1670
|
account: "agentVault";
|
|
1631
1671
|
}];
|
|
1632
1672
|
};
|
|
1633
|
-
relations: ["policy"
|
|
1673
|
+
relations: ["policy"];
|
|
1634
1674
|
}, {
|
|
1635
1675
|
name: "policy";
|
|
1636
1676
|
pda: {
|
|
@@ -1644,6 +1684,7 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1644
1684
|
};
|
|
1645
1685
|
}, {
|
|
1646
1686
|
name: "tracker";
|
|
1687
|
+
docs: ["Zero-copy SpendTracker"];
|
|
1647
1688
|
writable: true;
|
|
1648
1689
|
pda: {
|
|
1649
1690
|
seeds: [{
|
|
@@ -1654,17 +1695,29 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1654
1695
|
path: "vault";
|
|
1655
1696
|
}];
|
|
1656
1697
|
};
|
|
1698
|
+
}, {
|
|
1699
|
+
name: "oracleRegistry";
|
|
1700
|
+
docs: ["Protocol-level oracle registry"];
|
|
1701
|
+
pda: {
|
|
1702
|
+
seeds: [{
|
|
1703
|
+
kind: "const";
|
|
1704
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
1705
|
+
}];
|
|
1706
|
+
};
|
|
1657
1707
|
}, {
|
|
1658
1708
|
name: "vaultTokenAccount";
|
|
1659
1709
|
docs: ["Vault's PDA-owned token account (source)"];
|
|
1660
1710
|
writable: true;
|
|
1711
|
+
}, {
|
|
1712
|
+
name: "tokenMintAccount";
|
|
1713
|
+
docs: ["Token mint account for decimals validation"];
|
|
1661
1714
|
}, {
|
|
1662
1715
|
name: "destinationTokenAccount";
|
|
1663
|
-
docs: ["Destination token account (must be in allowed destinations
|
|
1716
|
+
docs: ["Destination token account (must be in allowed destinations)"];
|
|
1664
1717
|
writable: true;
|
|
1665
1718
|
}, {
|
|
1666
1719
|
name: "feeDestinationTokenAccount";
|
|
1667
|
-
docs: ["Developer fee destination token account
|
|
1720
|
+
docs: ["Developer fee destination token account"];
|
|
1668
1721
|
writable: true;
|
|
1669
1722
|
optional: true;
|
|
1670
1723
|
}, {
|
|
@@ -1703,7 +1756,7 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1703
1756
|
account: "agentVault";
|
|
1704
1757
|
}];
|
|
1705
1758
|
};
|
|
1706
|
-
relations: ["policy"
|
|
1759
|
+
relations: ["policy"];
|
|
1707
1760
|
} | {
|
|
1708
1761
|
name: "policy";
|
|
1709
1762
|
pda: {
|
|
@@ -1717,6 +1770,7 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1717
1770
|
};
|
|
1718
1771
|
} | {
|
|
1719
1772
|
name: "tracker";
|
|
1773
|
+
docs: ["Zero-copy SpendTracker"];
|
|
1720
1774
|
writable: true;
|
|
1721
1775
|
pda: {
|
|
1722
1776
|
seeds: [{
|
|
@@ -1727,17 +1781,29 @@ export declare function buildAgentTransfer(program: Program<AgentShield>, agent:
|
|
|
1727
1781
|
path: "vault";
|
|
1728
1782
|
}];
|
|
1729
1783
|
};
|
|
1784
|
+
} | {
|
|
1785
|
+
name: "oracleRegistry";
|
|
1786
|
+
docs: ["Protocol-level oracle registry"];
|
|
1787
|
+
pda: {
|
|
1788
|
+
seeds: [{
|
|
1789
|
+
kind: "const";
|
|
1790
|
+
value: [111, 114, 97, 99, 108, 101, 95, 114, 101, 103, 105, 115, 116, 114, 121];
|
|
1791
|
+
}];
|
|
1792
|
+
};
|
|
1730
1793
|
} | {
|
|
1731
1794
|
name: "vaultTokenAccount";
|
|
1732
1795
|
docs: ["Vault's PDA-owned token account (source)"];
|
|
1733
1796
|
writable: true;
|
|
1797
|
+
} | {
|
|
1798
|
+
name: "tokenMintAccount";
|
|
1799
|
+
docs: ["Token mint account for decimals validation"];
|
|
1734
1800
|
} | {
|
|
1735
1801
|
name: "destinationTokenAccount";
|
|
1736
|
-
docs: ["Destination token account (must be in allowed destinations
|
|
1802
|
+
docs: ["Destination token account (must be in allowed destinations)"];
|
|
1737
1803
|
writable: true;
|
|
1738
1804
|
} | {
|
|
1739
1805
|
name: "feeDestinationTokenAccount";
|
|
1740
|
-
docs: ["Developer fee destination token account
|
|
1806
|
+
docs: ["Developer fee destination token account"];
|
|
1741
1807
|
writable: true;
|
|
1742
1808
|
optional: true;
|
|
1743
1809
|
} | {
|