@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
package/dist/idl.d.ts CHANGED
@@ -13,6 +13,374 @@ export type AgentShield = {
13
13
  "description": "AI Agent Financial Middleware for Solana - Permission controls, spending limits, and audit infrastructure for autonomous agents";
14
14
  };
15
15
  "instructions": [
16
+ {
17
+ "name": "agentTransfer";
18
+ "docs": [
19
+ "Transfer tokens from the vault to an allowed destination.",
20
+ "Only the agent can call this. Respects destination allowlist,",
21
+ "spending caps, and per-token limits."
22
+ ];
23
+ "discriminator": [
24
+ 199,
25
+ 111,
26
+ 151,
27
+ 49,
28
+ 124,
29
+ 13,
30
+ 150,
31
+ 44
32
+ ];
33
+ "accounts": [
34
+ {
35
+ "name": "agent";
36
+ "writable": true;
37
+ "signer": true;
38
+ },
39
+ {
40
+ "name": "vault";
41
+ "writable": true;
42
+ "pda": {
43
+ "seeds": [
44
+ {
45
+ "kind": "const";
46
+ "value": [
47
+ 118,
48
+ 97,
49
+ 117,
50
+ 108,
51
+ 116
52
+ ];
53
+ },
54
+ {
55
+ "kind": "account";
56
+ "path": "vault.owner";
57
+ "account": "agentVault";
58
+ },
59
+ {
60
+ "kind": "account";
61
+ "path": "vault.vault_id";
62
+ "account": "agentVault";
63
+ }
64
+ ];
65
+ };
66
+ "relations": [
67
+ "policy",
68
+ "tracker"
69
+ ];
70
+ },
71
+ {
72
+ "name": "policy";
73
+ "pda": {
74
+ "seeds": [
75
+ {
76
+ "kind": "const";
77
+ "value": [
78
+ 112,
79
+ 111,
80
+ 108,
81
+ 105,
82
+ 99,
83
+ 121
84
+ ];
85
+ },
86
+ {
87
+ "kind": "account";
88
+ "path": "vault";
89
+ }
90
+ ];
91
+ };
92
+ },
93
+ {
94
+ "name": "tracker";
95
+ "writable": true;
96
+ "pda": {
97
+ "seeds": [
98
+ {
99
+ "kind": "const";
100
+ "value": [
101
+ 116,
102
+ 114,
103
+ 97,
104
+ 99,
105
+ 107,
106
+ 101,
107
+ 114
108
+ ];
109
+ },
110
+ {
111
+ "kind": "account";
112
+ "path": "vault";
113
+ }
114
+ ];
115
+ };
116
+ },
117
+ {
118
+ "name": "vaultTokenAccount";
119
+ "docs": [
120
+ "Vault's PDA-owned token account (source)"
121
+ ];
122
+ "writable": true;
123
+ },
124
+ {
125
+ "name": "destinationTokenAccount";
126
+ "docs": [
127
+ "Destination token account (must be in allowed destinations if configured)"
128
+ ];
129
+ "writable": true;
130
+ },
131
+ {
132
+ "name": "feeDestinationTokenAccount";
133
+ "docs": [
134
+ "Developer fee destination token account — must match vault.fee_destination"
135
+ ];
136
+ "writable": true;
137
+ "optional": true;
138
+ },
139
+ {
140
+ "name": "protocolTreasuryTokenAccount";
141
+ "docs": [
142
+ "Protocol treasury token account"
143
+ ];
144
+ "writable": true;
145
+ "optional": true;
146
+ },
147
+ {
148
+ "name": "tokenProgram";
149
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
150
+ }
151
+ ];
152
+ "args": [
153
+ {
154
+ "name": "amount";
155
+ "type": "u64";
156
+ }
157
+ ];
158
+ },
159
+ {
160
+ "name": "applyPendingPolicy";
161
+ "docs": [
162
+ "Apply a queued policy update after the timelock period has expired.",
163
+ "Closes the PendingPolicyUpdate PDA and returns rent to the owner."
164
+ ];
165
+ "discriminator": [
166
+ 114,
167
+ 212,
168
+ 19,
169
+ 227,
170
+ 89,
171
+ 199,
172
+ 74,
173
+ 62
174
+ ];
175
+ "accounts": [
176
+ {
177
+ "name": "owner";
178
+ "writable": true;
179
+ "signer": true;
180
+ "relations": [
181
+ "vault"
182
+ ];
183
+ },
184
+ {
185
+ "name": "vault";
186
+ "pda": {
187
+ "seeds": [
188
+ {
189
+ "kind": "const";
190
+ "value": [
191
+ 118,
192
+ 97,
193
+ 117,
194
+ 108,
195
+ 116
196
+ ];
197
+ },
198
+ {
199
+ "kind": "account";
200
+ "path": "owner";
201
+ },
202
+ {
203
+ "kind": "account";
204
+ "path": "vault.vault_id";
205
+ "account": "agentVault";
206
+ }
207
+ ];
208
+ };
209
+ "relations": [
210
+ "policy",
211
+ "tracker",
212
+ "pendingPolicy"
213
+ ];
214
+ },
215
+ {
216
+ "name": "policy";
217
+ "writable": true;
218
+ "pda": {
219
+ "seeds": [
220
+ {
221
+ "kind": "const";
222
+ "value": [
223
+ 112,
224
+ 111,
225
+ 108,
226
+ 105,
227
+ 99,
228
+ 121
229
+ ];
230
+ },
231
+ {
232
+ "kind": "account";
233
+ "path": "vault";
234
+ }
235
+ ];
236
+ };
237
+ },
238
+ {
239
+ "name": "tracker";
240
+ "writable": true;
241
+ "pda": {
242
+ "seeds": [
243
+ {
244
+ "kind": "const";
245
+ "value": [
246
+ 116,
247
+ 114,
248
+ 97,
249
+ 99,
250
+ 107,
251
+ 101,
252
+ 114
253
+ ];
254
+ },
255
+ {
256
+ "kind": "account";
257
+ "path": "vault";
258
+ }
259
+ ];
260
+ };
261
+ },
262
+ {
263
+ "name": "pendingPolicy";
264
+ "writable": true;
265
+ "pda": {
266
+ "seeds": [
267
+ {
268
+ "kind": "const";
269
+ "value": [
270
+ 112,
271
+ 101,
272
+ 110,
273
+ 100,
274
+ 105,
275
+ 110,
276
+ 103,
277
+ 95,
278
+ 112,
279
+ 111,
280
+ 108,
281
+ 105,
282
+ 99,
283
+ 121
284
+ ];
285
+ },
286
+ {
287
+ "kind": "account";
288
+ "path": "vault";
289
+ }
290
+ ];
291
+ };
292
+ }
293
+ ];
294
+ "args": [];
295
+ },
296
+ {
297
+ "name": "cancelPendingPolicy";
298
+ "docs": [
299
+ "Cancel a queued policy update. Closes the PendingPolicyUpdate PDA",
300
+ "and returns rent to the owner."
301
+ ];
302
+ "discriminator": [
303
+ 153,
304
+ 36,
305
+ 104,
306
+ 200,
307
+ 50,
308
+ 94,
309
+ 207,
310
+ 33
311
+ ];
312
+ "accounts": [
313
+ {
314
+ "name": "owner";
315
+ "writable": true;
316
+ "signer": true;
317
+ "relations": [
318
+ "vault"
319
+ ];
320
+ },
321
+ {
322
+ "name": "vault";
323
+ "pda": {
324
+ "seeds": [
325
+ {
326
+ "kind": "const";
327
+ "value": [
328
+ 118,
329
+ 97,
330
+ 117,
331
+ 108,
332
+ 116
333
+ ];
334
+ },
335
+ {
336
+ "kind": "account";
337
+ "path": "owner";
338
+ },
339
+ {
340
+ "kind": "account";
341
+ "path": "vault.vault_id";
342
+ "account": "agentVault";
343
+ }
344
+ ];
345
+ };
346
+ "relations": [
347
+ "pendingPolicy"
348
+ ];
349
+ },
350
+ {
351
+ "name": "pendingPolicy";
352
+ "writable": true;
353
+ "pda": {
354
+ "seeds": [
355
+ {
356
+ "kind": "const";
357
+ "value": [
358
+ 112,
359
+ 101,
360
+ 110,
361
+ 100,
362
+ 105,
363
+ 110,
364
+ 103,
365
+ 95,
366
+ 112,
367
+ 111,
368
+ 108,
369
+ 105,
370
+ 99,
371
+ 121
372
+ ];
373
+ },
374
+ {
375
+ "kind": "account";
376
+ "path": "vault";
377
+ }
378
+ ];
379
+ };
380
+ }
381
+ ];
382
+ "args": [];
383
+ },
16
384
  {
17
385
  "name": "closeVault";
18
386
  "docs": [
@@ -59,8 +427,8 @@ export type AgentShield = {
59
427
  },
60
428
  {
61
429
  "kind": "account";
62
- "path": "vault.vaultId";
63
- "account": "AgentVault";
430
+ "path": "vault.vault_id";
431
+ "account": "agentVault";
64
432
  }
65
433
  ];
66
434
  };
@@ -168,8 +536,8 @@ export type AgentShield = {
168
536
  },
169
537
  {
170
538
  "kind": "account";
171
- "path": "vault.vaultId";
172
- "account": "AgentVault";
539
+ "path": "vault.vault_id";
540
+ "account": "agentVault";
173
541
  }
174
542
  ];
175
543
  };
@@ -387,7 +755,8 @@ export type AgentShield = {
387
755
  "name": "finalizeSession";
388
756
  "docs": [
389
757
  "Finalize a session after the DeFi action completes.",
390
- "Closes the SessionAuthority PDA and records the transaction in the audit log.",
758
+ "Revokes token delegation, collects fees, closes the SessionAuthority PDA,",
759
+ "and records the transaction in the audit log.",
391
760
  "Can be called by the agent or permissionlessly (for cleanup of expired sessions)."
392
761
  ];
393
762
  "discriminator": [
@@ -424,12 +793,12 @@ export type AgentShield = {
424
793
  {
425
794
  "kind": "account";
426
795
  "path": "vault.owner";
427
- "account": "AgentVault";
796
+ "account": "agentVault";
428
797
  },
429
798
  {
430
799
  "kind": "account";
431
- "path": "vault.vaultId";
432
- "account": "AgentVault";
800
+ "path": "vault.vault_id";
801
+ "account": "agentVault";
433
802
  }
434
803
  ];
435
804
  };
@@ -489,7 +858,8 @@ export type AgentShield = {
489
858
  "name": "session";
490
859
  "docs": [
491
860
  "Session rent is returned to the session's agent (who paid for it),",
492
- "not the arbitrary payer, to prevent rent theft."
861
+ "not the arbitrary payer, to prevent rent theft.",
862
+ "Seeds include token_mint for per-token concurrent sessions."
493
863
  ];
494
864
  "writable": true;
495
865
  "pda": {
@@ -513,7 +883,12 @@ export type AgentShield = {
513
883
  {
514
884
  "kind": "account";
515
885
  "path": "session.agent";
516
- "account": "SessionAuthority";
886
+ "account": "sessionAuthority";
887
+ },
888
+ {
889
+ "kind": "account";
890
+ "path": "session.authorized_token";
891
+ "account": "sessionAuthority";
517
892
  }
518
893
  ];
519
894
  };
@@ -528,7 +903,7 @@ export type AgentShield = {
528
903
  {
529
904
  "name": "vaultTokenAccount";
530
905
  "docs": [
531
- "Vault's PDA token account for the session's token (fee source)"
906
+ "Vault's PDA token account for the session's token (fee source + delegation revocation)"
532
907
  ];
533
908
  "writable": true;
534
909
  "optional": true;
@@ -536,7 +911,7 @@ export type AgentShield = {
536
911
  {
537
912
  "name": "feeDestinationTokenAccount";
538
913
  "docs": [
539
- "Developer fee destination token account \u2014 must match vault.fee_destination"
914
+ "Developer fee destination token account must match vault.fee_destination"
540
915
  ];
541
916
  "writable": true;
542
917
  "optional": true;
@@ -544,7 +919,7 @@ export type AgentShield = {
544
919
  {
545
920
  "name": "protocolTreasuryTokenAccount";
546
921
  "docs": [
547
- "Protocol treasury token account \u2014 must be owned by PROTOCOL_TREASURY"
922
+ "Protocol treasury token account must be owned by PROTOCOL_TREASURY"
548
923
  ];
549
924
  "writable": true;
550
925
  "optional": true;
@@ -569,7 +944,8 @@ export type AgentShield = {
569
944
  "name": "initializeVault";
570
945
  "docs": [
571
946
  "Initialize a new agent vault with policy configuration.",
572
- "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA."
947
+ "Only the owner can call this. Creates vault PDA, policy PDA, and spend tracker PDA.",
948
+ "`tracker_tier`: 0 = Standard (200 entries), 1 = Pro (500), 2 = Max (1000)."
573
949
  ];
574
950
  "discriminator": [
575
951
  48,
@@ -650,7 +1026,183 @@ export type AgentShield = {
650
1026
  99,
651
1027
  107,
652
1028
  101,
653
- 114
1029
+ 114
1030
+ ];
1031
+ },
1032
+ {
1033
+ "kind": "account";
1034
+ "path": "vault";
1035
+ }
1036
+ ];
1037
+ };
1038
+ },
1039
+ {
1040
+ "name": "feeDestination";
1041
+ "docs": [
1042
+ "The protocol treasury that receives fees"
1043
+ ];
1044
+ },
1045
+ {
1046
+ "name": "systemProgram";
1047
+ "address": "11111111111111111111111111111111";
1048
+ }
1049
+ ];
1050
+ "args": [
1051
+ {
1052
+ "name": "vaultId";
1053
+ "type": "u64";
1054
+ },
1055
+ {
1056
+ "name": "dailySpendingCapUsd";
1057
+ "type": "u64";
1058
+ },
1059
+ {
1060
+ "name": "maxTransactionSizeUsd";
1061
+ "type": "u64";
1062
+ },
1063
+ {
1064
+ "name": "allowedTokens";
1065
+ "type": {
1066
+ "vec": {
1067
+ "defined": {
1068
+ "name": "allowedToken";
1069
+ };
1070
+ };
1071
+ };
1072
+ },
1073
+ {
1074
+ "name": "allowedProtocols";
1075
+ "type": {
1076
+ "vec": "pubkey";
1077
+ };
1078
+ },
1079
+ {
1080
+ "name": "maxLeverageBps";
1081
+ "type": "u16";
1082
+ },
1083
+ {
1084
+ "name": "maxConcurrentPositions";
1085
+ "type": "u8";
1086
+ },
1087
+ {
1088
+ "name": "developerFeeRate";
1089
+ "type": "u16";
1090
+ },
1091
+ {
1092
+ "name": "timelockDuration";
1093
+ "type": "u64";
1094
+ },
1095
+ {
1096
+ "name": "allowedDestinations";
1097
+ "type": {
1098
+ "vec": "pubkey";
1099
+ };
1100
+ },
1101
+ {
1102
+ "name": "trackerTier";
1103
+ "type": "u8";
1104
+ }
1105
+ ];
1106
+ },
1107
+ {
1108
+ "name": "queuePolicyUpdate";
1109
+ "docs": [
1110
+ "Queue a policy update when timelock is active.",
1111
+ "Creates a PendingPolicyUpdate PDA that becomes executable after",
1112
+ "the timelock period expires."
1113
+ ];
1114
+ "discriminator": [
1115
+ 149,
1116
+ 18,
1117
+ 76,
1118
+ 197,
1119
+ 179,
1120
+ 193,
1121
+ 91,
1122
+ 77
1123
+ ];
1124
+ "accounts": [
1125
+ {
1126
+ "name": "owner";
1127
+ "writable": true;
1128
+ "signer": true;
1129
+ "relations": [
1130
+ "vault"
1131
+ ];
1132
+ },
1133
+ {
1134
+ "name": "vault";
1135
+ "pda": {
1136
+ "seeds": [
1137
+ {
1138
+ "kind": "const";
1139
+ "value": [
1140
+ 118,
1141
+ 97,
1142
+ 117,
1143
+ 108,
1144
+ 116
1145
+ ];
1146
+ },
1147
+ {
1148
+ "kind": "account";
1149
+ "path": "owner";
1150
+ },
1151
+ {
1152
+ "kind": "account";
1153
+ "path": "vault.vault_id";
1154
+ "account": "agentVault";
1155
+ }
1156
+ ];
1157
+ };
1158
+ "relations": [
1159
+ "policy"
1160
+ ];
1161
+ },
1162
+ {
1163
+ "name": "policy";
1164
+ "pda": {
1165
+ "seeds": [
1166
+ {
1167
+ "kind": "const";
1168
+ "value": [
1169
+ 112,
1170
+ 111,
1171
+ 108,
1172
+ 105,
1173
+ 99,
1174
+ 121
1175
+ ];
1176
+ },
1177
+ {
1178
+ "kind": "account";
1179
+ "path": "vault";
1180
+ }
1181
+ ];
1182
+ };
1183
+ },
1184
+ {
1185
+ "name": "pendingPolicy";
1186
+ "writable": true;
1187
+ "pda": {
1188
+ "seeds": [
1189
+ {
1190
+ "kind": "const";
1191
+ "value": [
1192
+ 112,
1193
+ 101,
1194
+ 110,
1195
+ 100,
1196
+ 105,
1197
+ 110,
1198
+ 103,
1199
+ 95,
1200
+ 112,
1201
+ 111,
1202
+ 108,
1203
+ 105,
1204
+ 99,
1205
+ 121
654
1206
  ];
655
1207
  },
656
1208
  {
@@ -660,12 +1212,6 @@ export type AgentShield = {
660
1212
  ];
661
1213
  };
662
1214
  },
663
- {
664
- "name": "feeDestination";
665
- "docs": [
666
- "The protocol treasury that receives fees"
667
- ];
668
- },
669
1215
  {
670
1216
  "name": "systemProgram";
671
1217
  "address": "11111111111111111111111111111111";
@@ -673,40 +1219,74 @@ export type AgentShield = {
673
1219
  ];
674
1220
  "args": [
675
1221
  {
676
- "name": "vaultId";
677
- "type": "u64";
678
- },
679
- {
680
- "name": "dailySpendingCap";
681
- "type": "u64";
1222
+ "name": "dailySpendingCapUsd";
1223
+ "type": {
1224
+ "option": "u64";
1225
+ };
682
1226
  },
683
1227
  {
684
- "name": "maxTransactionSize";
685
- "type": "u64";
1228
+ "name": "maxTransactionAmountUsd";
1229
+ "type": {
1230
+ "option": "u64";
1231
+ };
686
1232
  },
687
1233
  {
688
1234
  "name": "allowedTokens";
689
1235
  "type": {
690
- "vec": "pubkey";
1236
+ "option": {
1237
+ "vec": {
1238
+ "defined": {
1239
+ "name": "allowedToken";
1240
+ };
1241
+ };
1242
+ };
691
1243
  };
692
1244
  },
693
1245
  {
694
1246
  "name": "allowedProtocols";
695
1247
  "type": {
696
- "vec": "pubkey";
1248
+ "option": {
1249
+ "vec": "pubkey";
1250
+ };
697
1251
  };
698
1252
  },
699
1253
  {
700
1254
  "name": "maxLeverageBps";
701
- "type": "u16";
1255
+ "type": {
1256
+ "option": "u16";
1257
+ };
1258
+ },
1259
+ {
1260
+ "name": "canOpenPositions";
1261
+ "type": {
1262
+ "option": "bool";
1263
+ };
702
1264
  },
703
1265
  {
704
1266
  "name": "maxConcurrentPositions";
705
- "type": "u8";
1267
+ "type": {
1268
+ "option": "u8";
1269
+ };
706
1270
  },
707
1271
  {
708
1272
  "name": "developerFeeRate";
709
- "type": "u16";
1273
+ "type": {
1274
+ "option": "u16";
1275
+ };
1276
+ },
1277
+ {
1278
+ "name": "timelockDuration";
1279
+ "type": {
1280
+ "option": "u64";
1281
+ };
1282
+ },
1283
+ {
1284
+ "name": "allowedDestinations";
1285
+ "type": {
1286
+ "option": {
1287
+ "vec": "pubkey";
1288
+ };
1289
+ };
710
1290
  }
711
1291
  ];
712
1292
  },
@@ -755,8 +1335,8 @@ export type AgentShield = {
755
1335
  },
756
1336
  {
757
1337
  "kind": "account";
758
- "path": "vault.vaultId";
759
- "account": "AgentVault";
1338
+ "path": "vault.vault_id";
1339
+ "account": "agentVault";
760
1340
  }
761
1341
  ];
762
1342
  };
@@ -816,8 +1396,8 @@ export type AgentShield = {
816
1396
  },
817
1397
  {
818
1398
  "kind": "account";
819
- "path": "vault.vaultId";
820
- "account": "AgentVault";
1399
+ "path": "vault.vault_id";
1400
+ "account": "agentVault";
821
1401
  }
822
1402
  ];
823
1403
  };
@@ -875,8 +1455,8 @@ export type AgentShield = {
875
1455
  },
876
1456
  {
877
1457
  "kind": "account";
878
- "path": "vault.vaultId";
879
- "account": "AgentVault";
1458
+ "path": "vault.vault_id";
1459
+ "account": "agentVault";
880
1460
  }
881
1461
  ];
882
1462
  };
@@ -888,7 +1468,8 @@ export type AgentShield = {
888
1468
  "name": "updatePolicy";
889
1469
  "docs": [
890
1470
  "Update the policy configuration for a vault.",
891
- "Only the owner can call this. Cannot be called by the agent."
1471
+ "Only the owner can call this. Cannot be called by the agent.",
1472
+ "Blocked when timelock_duration > 0 — use queue_policy_update instead."
892
1473
  ];
893
1474
  "discriminator": [
894
1475
  212,
@@ -928,13 +1509,14 @@ export type AgentShield = {
928
1509
  },
929
1510
  {
930
1511
  "kind": "account";
931
- "path": "vault.vaultId";
932
- "account": "AgentVault";
1512
+ "path": "vault.vault_id";
1513
+ "account": "agentVault";
933
1514
  }
934
1515
  ];
935
1516
  };
936
1517
  "relations": [
937
- "policy"
1518
+ "policy",
1519
+ "tracker"
938
1520
  ];
939
1521
  },
940
1522
  {
@@ -959,17 +1541,41 @@ export type AgentShield = {
959
1541
  }
960
1542
  ];
961
1543
  };
1544
+ },
1545
+ {
1546
+ "name": "tracker";
1547
+ "writable": true;
1548
+ "pda": {
1549
+ "seeds": [
1550
+ {
1551
+ "kind": "const";
1552
+ "value": [
1553
+ 116,
1554
+ 114,
1555
+ 97,
1556
+ 99,
1557
+ 107,
1558
+ 101,
1559
+ 114
1560
+ ];
1561
+ },
1562
+ {
1563
+ "kind": "account";
1564
+ "path": "vault";
1565
+ }
1566
+ ];
1567
+ };
962
1568
  }
963
1569
  ];
964
1570
  "args": [
965
1571
  {
966
- "name": "dailySpendingCap";
1572
+ "name": "dailySpendingCapUsd";
967
1573
  "type": {
968
1574
  "option": "u64";
969
1575
  };
970
1576
  },
971
1577
  {
972
- "name": "maxTransactionSize";
1578
+ "name": "maxTransactionSizeUsd";
973
1579
  "type": {
974
1580
  "option": "u64";
975
1581
  };
@@ -978,7 +1584,11 @@ export type AgentShield = {
978
1584
  "name": "allowedTokens";
979
1585
  "type": {
980
1586
  "option": {
981
- "vec": "pubkey";
1587
+ "vec": {
1588
+ "defined": {
1589
+ "name": "allowedToken";
1590
+ };
1591
+ };
982
1592
  };
983
1593
  };
984
1594
  },
@@ -1013,6 +1623,20 @@ export type AgentShield = {
1013
1623
  "type": {
1014
1624
  "option": "u16";
1015
1625
  };
1626
+ },
1627
+ {
1628
+ "name": "timelockDuration";
1629
+ "type": {
1630
+ "option": "u64";
1631
+ };
1632
+ },
1633
+ {
1634
+ "name": "allowedDestinations";
1635
+ "type": {
1636
+ "option": {
1637
+ "vec": "pubkey";
1638
+ };
1639
+ };
1016
1640
  }
1017
1641
  ];
1018
1642
  },
@@ -1020,8 +1644,9 @@ export type AgentShield = {
1020
1644
  "name": "validateAndAuthorize";
1021
1645
  "docs": [
1022
1646
  "Core permission check. Called by the agent before a DeFi action.",
1023
- "Validates the action against all policy constraints.",
1024
- "If approved, creates a SessionAuthority PDA and updates spend tracking.",
1647
+ "Validates the action against all policy constraints (USD caps, per-token caps).",
1648
+ "If approved, creates a SessionAuthority PDA, delegates tokens to agent,",
1649
+ "and updates spend tracking.",
1025
1650
  "If denied, reverts the entire transaction (including subsequent DeFi instructions)."
1026
1651
  ];
1027
1652
  "discriminator": [
@@ -1058,12 +1683,12 @@ export type AgentShield = {
1058
1683
  {
1059
1684
  "kind": "account";
1060
1685
  "path": "vault.owner";
1061
- "account": "AgentVault";
1686
+ "account": "agentVault";
1062
1687
  },
1063
1688
  {
1064
1689
  "kind": "account";
1065
- "path": "vault.vaultId";
1066
- "account": "AgentVault";
1690
+ "path": "vault.vault_id";
1691
+ "account": "agentVault";
1067
1692
  }
1068
1693
  ];
1069
1694
  };
@@ -1121,7 +1746,8 @@ export type AgentShield = {
1121
1746
  {
1122
1747
  "name": "session";
1123
1748
  "docs": [
1124
- "Ephemeral session PDA \u2014 `init` ensures no double-authorization"
1749
+ "Ephemeral session PDA `init` ensures no double-authorization.",
1750
+ "Seeds include token_mint for per-token concurrent sessions."
1125
1751
  ];
1126
1752
  "writable": true;
1127
1753
  "pda": {
@@ -1145,10 +1771,31 @@ export type AgentShield = {
1145
1771
  {
1146
1772
  "kind": "account";
1147
1773
  "path": "agent";
1774
+ },
1775
+ {
1776
+ "kind": "arg";
1777
+ "path": "tokenMint";
1148
1778
  }
1149
1779
  ];
1150
1780
  };
1151
1781
  },
1782
+ {
1783
+ "name": "vaultTokenAccount";
1784
+ "docs": [
1785
+ "Vault's PDA-owned token account for the spend token (delegation source)"
1786
+ ];
1787
+ "writable": true;
1788
+ },
1789
+ {
1790
+ "name": "tokenMintAccount";
1791
+ "docs": [
1792
+ "The token mint being spent"
1793
+ ];
1794
+ },
1795
+ {
1796
+ "name": "tokenProgram";
1797
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1798
+ },
1152
1799
  {
1153
1800
  "name": "systemProgram";
1154
1801
  "address": "11111111111111111111111111111111";
@@ -1159,7 +1806,7 @@ export type AgentShield = {
1159
1806
  "name": "actionType";
1160
1807
  "type": {
1161
1808
  "defined": {
1162
- "name": "ActionType";
1809
+ "name": "actionType";
1163
1810
  };
1164
1811
  };
1165
1812
  },
@@ -1228,8 +1875,8 @@ export type AgentShield = {
1228
1875
  },
1229
1876
  {
1230
1877
  "kind": "account";
1231
- "path": "vault.vaultId";
1232
- "account": "AgentVault";
1878
+ "path": "vault.vault_id";
1879
+ "account": "agentVault";
1233
1880
  }
1234
1881
  ];
1235
1882
  };
@@ -1438,7 +2085,7 @@ export type AgentShield = {
1438
2085
  ];
1439
2086
  "accounts": [
1440
2087
  {
1441
- "name": "AgentVault";
2088
+ "name": "agentVault";
1442
2089
  "discriminator": [
1443
2090
  232,
1444
2091
  220,
@@ -1451,7 +2098,20 @@ export type AgentShield = {
1451
2098
  ];
1452
2099
  },
1453
2100
  {
1454
- "name": "PolicyConfig";
2101
+ "name": "pendingPolicyUpdate";
2102
+ "discriminator": [
2103
+ 77,
2104
+ 255,
2105
+ 2,
2106
+ 51,
2107
+ 79,
2108
+ 237,
2109
+ 183,
2110
+ 239
2111
+ ];
2112
+ },
2113
+ {
2114
+ "name": "policyConfig";
1455
2115
  "discriminator": [
1456
2116
  219,
1457
2117
  7,
@@ -1464,7 +2124,7 @@ export type AgentShield = {
1464
2124
  ];
1465
2125
  },
1466
2126
  {
1467
- "name": "SessionAuthority";
2127
+ "name": "sessionAuthority";
1468
2128
  "discriminator": [
1469
2129
  48,
1470
2130
  9,
@@ -1477,7 +2137,7 @@ export type AgentShield = {
1477
2137
  ];
1478
2138
  },
1479
2139
  {
1480
- "name": "SpendTracker";
2140
+ "name": "spendTracker";
1481
2141
  "discriminator": [
1482
2142
  180,
1483
2143
  17,
@@ -1492,7 +2152,7 @@ export type AgentShield = {
1492
2152
  ];
1493
2153
  "events": [
1494
2154
  {
1495
- "name": "ActionAuthorized";
2155
+ "name": "actionAuthorized";
1496
2156
  "discriminator": [
1497
2157
  85,
1498
2158
  90,
@@ -1505,7 +2165,7 @@ export type AgentShield = {
1505
2165
  ];
1506
2166
  },
1507
2167
  {
1508
- "name": "ActionDenied";
2168
+ "name": "actionDenied";
1509
2169
  "discriminator": [
1510
2170
  243,
1511
2171
  239,
@@ -1518,7 +2178,7 @@ export type AgentShield = {
1518
2178
  ];
1519
2179
  },
1520
2180
  {
1521
- "name": "AgentRegistered";
2181
+ "name": "agentRegistered";
1522
2182
  "discriminator": [
1523
2183
  191,
1524
2184
  78,
@@ -1531,7 +2191,7 @@ export type AgentShield = {
1531
2191
  ];
1532
2192
  },
1533
2193
  {
1534
- "name": "AgentRevoked";
2194
+ "name": "agentRevoked";
1535
2195
  "discriminator": [
1536
2196
  12,
1537
2197
  251,
@@ -1544,7 +2204,33 @@ export type AgentShield = {
1544
2204
  ];
1545
2205
  },
1546
2206
  {
1547
- "name": "FeesCollected";
2207
+ "name": "agentTransferExecuted";
2208
+ "discriminator": [
2209
+ 88,
2210
+ 52,
2211
+ 117,
2212
+ 69,
2213
+ 112,
2214
+ 152,
2215
+ 167,
2216
+ 40
2217
+ ];
2218
+ },
2219
+ {
2220
+ "name": "delegationRevoked";
2221
+ "discriminator": [
2222
+ 59,
2223
+ 158,
2224
+ 142,
2225
+ 49,
2226
+ 164,
2227
+ 116,
2228
+ 220,
2229
+ 8
2230
+ ];
2231
+ },
2232
+ {
2233
+ "name": "feesCollected";
1548
2234
  "discriminator": [
1549
2235
  233,
1550
2236
  23,
@@ -1557,7 +2243,7 @@ export type AgentShield = {
1557
2243
  ];
1558
2244
  },
1559
2245
  {
1560
- "name": "FundsDeposited";
2246
+ "name": "fundsDeposited";
1561
2247
  "discriminator": [
1562
2248
  157,
1563
2249
  209,
@@ -1570,7 +2256,7 @@ export type AgentShield = {
1570
2256
  ];
1571
2257
  },
1572
2258
  {
1573
- "name": "FundsWithdrawn";
2259
+ "name": "fundsWithdrawn";
1574
2260
  "discriminator": [
1575
2261
  56,
1576
2262
  130,
@@ -1583,7 +2269,46 @@ export type AgentShield = {
1583
2269
  ];
1584
2270
  },
1585
2271
  {
1586
- "name": "PolicyUpdated";
2272
+ "name": "policyChangeApplied";
2273
+ "discriminator": [
2274
+ 104,
2275
+ 89,
2276
+ 5,
2277
+ 100,
2278
+ 180,
2279
+ 202,
2280
+ 52,
2281
+ 73
2282
+ ];
2283
+ },
2284
+ {
2285
+ "name": "policyChangeCancelled";
2286
+ "discriminator": [
2287
+ 200,
2288
+ 158,
2289
+ 226,
2290
+ 255,
2291
+ 25,
2292
+ 211,
2293
+ 30,
2294
+ 151
2295
+ ];
2296
+ },
2297
+ {
2298
+ "name": "policyChangeQueued";
2299
+ "discriminator": [
2300
+ 73,
2301
+ 231,
2302
+ 182,
2303
+ 136,
2304
+ 141,
2305
+ 120,
2306
+ 32,
2307
+ 79
2308
+ ];
2309
+ },
2310
+ {
2311
+ "name": "policyUpdated";
1587
2312
  "discriminator": [
1588
2313
  225,
1589
2314
  112,
@@ -1596,7 +2321,7 @@ export type AgentShield = {
1596
2321
  ];
1597
2322
  },
1598
2323
  {
1599
- "name": "SessionFinalized";
2324
+ "name": "sessionFinalized";
1600
2325
  "discriminator": [
1601
2326
  33,
1602
2327
  12,
@@ -1609,7 +2334,7 @@ export type AgentShield = {
1609
2334
  ];
1610
2335
  },
1611
2336
  {
1612
- "name": "VaultClosed";
2337
+ "name": "vaultClosed";
1613
2338
  "discriminator": [
1614
2339
  238,
1615
2340
  129,
@@ -1622,7 +2347,7 @@ export type AgentShield = {
1622
2347
  ];
1623
2348
  },
1624
2349
  {
1625
- "name": "VaultCreated";
2350
+ "name": "vaultCreated";
1626
2351
  "discriminator": [
1627
2352
  117,
1628
2353
  25,
@@ -1635,7 +2360,7 @@ export type AgentShield = {
1635
2360
  ];
1636
2361
  },
1637
2362
  {
1638
- "name": "VaultReactivated";
2363
+ "name": "vaultReactivated";
1639
2364
  "discriminator": [
1640
2365
  197,
1641
2366
  52,
@@ -1651,148 +2376,238 @@ export type AgentShield = {
1651
2376
  "errors": [
1652
2377
  {
1653
2378
  "code": 6000;
1654
- "name": "VaultNotActive";
2379
+ "name": "vaultNotActive";
1655
2380
  "msg": "Vault is not active";
1656
2381
  },
1657
2382
  {
1658
2383
  "code": 6001;
1659
- "name": "UnauthorizedAgent";
2384
+ "name": "unauthorizedAgent";
1660
2385
  "msg": "Unauthorized: signer is not the registered agent";
1661
2386
  },
1662
2387
  {
1663
2388
  "code": 6002;
1664
- "name": "UnauthorizedOwner";
2389
+ "name": "unauthorizedOwner";
1665
2390
  "msg": "Unauthorized: signer is not the vault owner";
1666
2391
  },
1667
2392
  {
1668
2393
  "code": 6003;
1669
- "name": "TokenNotAllowed";
2394
+ "name": "tokenNotAllowed";
1670
2395
  "msg": "Token not in allowed list";
1671
2396
  },
1672
2397
  {
1673
2398
  "code": 6004;
1674
- "name": "ProtocolNotAllowed";
2399
+ "name": "protocolNotAllowed";
1675
2400
  "msg": "Protocol not in allowed list";
1676
2401
  },
1677
2402
  {
1678
2403
  "code": 6005;
1679
- "name": "TransactionTooLarge";
2404
+ "name": "transactionTooLarge";
1680
2405
  "msg": "Transaction exceeds maximum single transaction size";
1681
2406
  },
1682
2407
  {
1683
2408
  "code": 6006;
1684
- "name": "DailyCapExceeded";
2409
+ "name": "dailyCapExceeded";
1685
2410
  "msg": "Daily spending cap would be exceeded";
1686
2411
  },
1687
2412
  {
1688
2413
  "code": 6007;
1689
- "name": "LeverageTooHigh";
2414
+ "name": "leverageTooHigh";
1690
2415
  "msg": "Leverage exceeds maximum allowed";
1691
2416
  },
1692
2417
  {
1693
2418
  "code": 6008;
1694
- "name": "TooManyPositions";
2419
+ "name": "tooManyPositions";
1695
2420
  "msg": "Maximum concurrent open positions reached";
1696
2421
  },
1697
2422
  {
1698
2423
  "code": 6009;
1699
- "name": "PositionOpeningDisallowed";
2424
+ "name": "positionOpeningDisallowed";
1700
2425
  "msg": "Cannot open new positions (policy disallows)";
1701
2426
  },
1702
2427
  {
1703
2428
  "code": 6010;
1704
- "name": "SessionExpired";
2429
+ "name": "sessionExpired";
1705
2430
  "msg": "Session has expired";
1706
2431
  },
1707
2432
  {
1708
2433
  "code": 6011;
1709
- "name": "SessionNotAuthorized";
2434
+ "name": "sessionNotAuthorized";
1710
2435
  "msg": "Session not authorized";
1711
2436
  },
1712
2437
  {
1713
2438
  "code": 6012;
1714
- "name": "InvalidSession";
2439
+ "name": "invalidSession";
1715
2440
  "msg": "Invalid session: does not belong to this vault";
1716
2441
  },
1717
2442
  {
1718
2443
  "code": 6013;
1719
- "name": "OpenPositionsExist";
2444
+ "name": "openPositionsExist";
1720
2445
  "msg": "Vault has open positions, cannot close";
1721
2446
  },
1722
2447
  {
1723
2448
  "code": 6014;
1724
- "name": "TooManyAllowedTokens";
2449
+ "name": "tooManyAllowedTokens";
1725
2450
  "msg": "Policy configuration invalid: too many allowed tokens";
1726
2451
  },
1727
2452
  {
1728
2453
  "code": 6015;
1729
- "name": "TooManyAllowedProtocols";
2454
+ "name": "tooManyAllowedProtocols";
1730
2455
  "msg": "Policy configuration invalid: too many allowed protocols";
1731
2456
  },
1732
2457
  {
1733
2458
  "code": 6016;
1734
- "name": "AgentAlreadyRegistered";
2459
+ "name": "agentAlreadyRegistered";
1735
2460
  "msg": "Agent already registered for this vault";
1736
2461
  },
1737
2462
  {
1738
2463
  "code": 6017;
1739
- "name": "NoAgentRegistered";
2464
+ "name": "noAgentRegistered";
1740
2465
  "msg": "No agent registered for this vault";
1741
2466
  },
1742
2467
  {
1743
2468
  "code": 6018;
1744
- "name": "VaultNotFrozen";
2469
+ "name": "vaultNotFrozen";
1745
2470
  "msg": "Vault is not frozen (expected frozen for reactivation)";
1746
2471
  },
1747
2472
  {
1748
2473
  "code": 6019;
1749
- "name": "VaultAlreadyClosed";
2474
+ "name": "vaultAlreadyClosed";
1750
2475
  "msg": "Vault is already closed";
1751
2476
  },
1752
2477
  {
1753
2478
  "code": 6020;
1754
- "name": "InsufficientBalance";
2479
+ "name": "insufficientBalance";
1755
2480
  "msg": "Insufficient vault balance for withdrawal";
1756
2481
  },
1757
2482
  {
1758
2483
  "code": 6021;
1759
- "name": "DeveloperFeeTooHigh";
2484
+ "name": "developerFeeTooHigh";
1760
2485
  "msg": "Developer fee rate exceeds maximum (50 / 1,000,000 = 0.5 BPS)";
1761
2486
  },
1762
2487
  {
1763
2488
  "code": 6022;
1764
- "name": "InvalidFeeDestination";
2489
+ "name": "invalidFeeDestination";
1765
2490
  "msg": "Fee destination account invalid";
1766
2491
  },
1767
2492
  {
1768
2493
  "code": 6023;
1769
- "name": "InvalidProtocolTreasury";
2494
+ "name": "invalidProtocolTreasury";
1770
2495
  "msg": "Protocol treasury account does not match expected address";
1771
2496
  },
1772
2497
  {
1773
2498
  "code": 6024;
1774
- "name": "TooManySpendEntries";
2499
+ "name": "tooManySpendEntries";
1775
2500
  "msg": "Spend entry limit reached (too many active entries in rolling window)";
1776
2501
  },
1777
2502
  {
1778
2503
  "code": 6025;
1779
- "name": "InvalidAgentKey";
2504
+ "name": "invalidAgentKey";
1780
2505
  "msg": "Invalid agent: cannot be the zero address";
1781
2506
  },
1782
2507
  {
1783
2508
  "code": 6026;
1784
- "name": "AgentIsOwner";
2509
+ "name": "agentIsOwner";
1785
2510
  "msg": "Invalid agent: agent cannot be the vault owner";
1786
2511
  },
1787
2512
  {
1788
2513
  "code": 6027;
1789
- "name": "Overflow";
2514
+ "name": "overflow";
1790
2515
  "msg": "Arithmetic overflow";
2516
+ },
2517
+ {
2518
+ "code": 6028;
2519
+ "name": "delegationFailed";
2520
+ "msg": "Token delegation approval failed";
2521
+ },
2522
+ {
2523
+ "code": 6029;
2524
+ "name": "revocationFailed";
2525
+ "msg": "Token delegation revocation failed";
2526
+ },
2527
+ {
2528
+ "code": 6030;
2529
+ "name": "oracleFeedStale";
2530
+ "msg": "Oracle feed value is too stale";
2531
+ },
2532
+ {
2533
+ "code": 6031;
2534
+ "name": "oracleFeedInvalid";
2535
+ "msg": "Cannot parse oracle feed data";
2536
+ },
2537
+ {
2538
+ "code": 6032;
2539
+ "name": "tokenSpendBlocked";
2540
+ "msg": "Unpriced token cannot be spent (receive-only)";
2541
+ },
2542
+ {
2543
+ "code": 6033;
2544
+ "name": "invalidTokenAccount";
2545
+ "msg": "Token account does not belong to vault or has wrong mint";
2546
+ },
2547
+ {
2548
+ "code": 6034;
2549
+ "name": "oracleAccountMissing";
2550
+ "msg": "Oracle-priced token requires feed account in remaining_accounts";
2551
+ },
2552
+ {
2553
+ "code": 6035;
2554
+ "name": "perTokenCapExceeded";
2555
+ "msg": "Per-token daily spending cap would be exceeded";
2556
+ },
2557
+ {
2558
+ "code": 6036;
2559
+ "name": "perTokenTxLimitExceeded";
2560
+ "msg": "Per-token single transaction limit exceeded";
2561
+ },
2562
+ {
2563
+ "code": 6037;
2564
+ "name": "oracleConfidenceTooWide";
2565
+ "msg": "Oracle price confidence interval too wide";
2566
+ },
2567
+ {
2568
+ "code": 6038;
2569
+ "name": "oracleUnsupportedType";
2570
+ "msg": "Oracle account owner is not a recognized oracle program";
2571
+ },
2572
+ {
2573
+ "code": 6039;
2574
+ "name": "oracleNotVerified";
2575
+ "msg": "Pyth price update not fully verified by Wormhole";
2576
+ },
2577
+ {
2578
+ "code": 6040;
2579
+ "name": "timelockNotExpired";
2580
+ "msg": "Timelock period has not expired yet";
2581
+ },
2582
+ {
2583
+ "code": 6041;
2584
+ "name": "timelockActive";
2585
+ "msg": "Vault has timelock active — use queue_policy_update instead";
2586
+ },
2587
+ {
2588
+ "code": 6042;
2589
+ "name": "noTimelockConfigured";
2590
+ "msg": "No timelock configured on this vault";
2591
+ },
2592
+ {
2593
+ "code": 6043;
2594
+ "name": "destinationNotAllowed";
2595
+ "msg": "Destination not in allowed list";
2596
+ },
2597
+ {
2598
+ "code": 6044;
2599
+ "name": "tooManyDestinations";
2600
+ "msg": "Too many destinations (max 10)";
2601
+ },
2602
+ {
2603
+ "code": 6045;
2604
+ "name": "invalidTrackerTier";
2605
+ "msg": "Invalid tracker tier (must be 0, 1, or 2)";
1791
2606
  }
1792
2607
  ];
1793
2608
  "types": [
1794
2609
  {
1795
- "name": "ActionAuthorized";
2610
+ "name": "actionAuthorized";
1796
2611
  "type": {
1797
2612
  "kind": "struct";
1798
2613
  "fields": [
@@ -1808,7 +2623,7 @@ export type AgentShield = {
1808
2623
  "name": "actionType";
1809
2624
  "type": {
1810
2625
  "defined": {
1811
- "name": "ActionType";
2626
+ "name": "actionType";
1812
2627
  };
1813
2628
  };
1814
2629
  },
@@ -1820,18 +2635,38 @@ export type AgentShield = {
1820
2635
  "name": "amount";
1821
2636
  "type": "u64";
1822
2637
  },
2638
+ {
2639
+ "name": "usdAmount";
2640
+ "type": "u64";
2641
+ },
1823
2642
  {
1824
2643
  "name": "protocol";
1825
2644
  "type": "pubkey";
1826
2645
  },
1827
2646
  {
1828
- "name": "rollingSpendAfter";
2647
+ "name": "rollingSpendUsdAfter";
1829
2648
  "type": "u64";
1830
2649
  },
1831
2650
  {
1832
- "name": "dailyCap";
2651
+ "name": "dailyCapUsd";
1833
2652
  "type": "u64";
1834
2653
  },
2654
+ {
2655
+ "name": "delegated";
2656
+ "type": "bool";
2657
+ },
2658
+ {
2659
+ "name": "oraclePrice";
2660
+ "type": {
2661
+ "option": "i128";
2662
+ };
2663
+ },
2664
+ {
2665
+ "name": "oracleSource";
2666
+ "type": {
2667
+ "option": "u8";
2668
+ };
2669
+ },
1835
2670
  {
1836
2671
  "name": "timestamp";
1837
2672
  "type": "i64";
@@ -1840,7 +2675,7 @@ export type AgentShield = {
1840
2675
  };
1841
2676
  },
1842
2677
  {
1843
- "name": "ActionDenied";
2678
+ "name": "actionDenied";
1844
2679
  "type": {
1845
2680
  "kind": "struct";
1846
2681
  "fields": [
@@ -1864,7 +2699,7 @@ export type AgentShield = {
1864
2699
  };
1865
2700
  },
1866
2701
  {
1867
- "name": "ActionType";
2702
+ "name": "actionType";
1868
2703
  "docs": [
1869
2704
  "Action types that agents can request"
1870
2705
  ];
@@ -1872,31 +2707,54 @@ export type AgentShield = {
1872
2707
  "kind": "enum";
1873
2708
  "variants": [
1874
2709
  {
1875
- "name": "Swap";
2710
+ "name": "swap";
2711
+ },
2712
+ {
2713
+ "name": "openPosition";
2714
+ },
2715
+ {
2716
+ "name": "closePosition";
2717
+ },
2718
+ {
2719
+ "name": "increasePosition";
1876
2720
  },
1877
2721
  {
1878
- "name": "OpenPosition";
2722
+ "name": "decreasePosition";
1879
2723
  },
1880
2724
  {
1881
- "name": "ClosePosition";
2725
+ "name": "deposit";
1882
2726
  },
1883
2727
  {
1884
- "name": "IncreasePosition";
2728
+ "name": "withdraw";
1885
2729
  },
1886
2730
  {
1887
- "name": "DecreasePosition";
2731
+ "name": "transfer";
2732
+ }
2733
+ ];
2734
+ };
2735
+ },
2736
+ {
2737
+ "name": "agentRegistered";
2738
+ "type": {
2739
+ "kind": "struct";
2740
+ "fields": [
2741
+ {
2742
+ "name": "vault";
2743
+ "type": "pubkey";
1888
2744
  },
1889
2745
  {
1890
- "name": "Deposit";
2746
+ "name": "agent";
2747
+ "type": "pubkey";
1891
2748
  },
1892
2749
  {
1893
- "name": "Withdraw";
2750
+ "name": "timestamp";
2751
+ "type": "i64";
1894
2752
  }
1895
2753
  ];
1896
2754
  };
1897
2755
  },
1898
2756
  {
1899
- "name": "AgentRegistered";
2757
+ "name": "agentRevoked";
1900
2758
  "type": {
1901
2759
  "kind": "struct";
1902
2760
  "fields": [
@@ -1916,7 +2774,7 @@ export type AgentShield = {
1916
2774
  };
1917
2775
  },
1918
2776
  {
1919
- "name": "AgentRevoked";
2777
+ "name": "agentTransferExecuted";
1920
2778
  "type": {
1921
2779
  "kind": "struct";
1922
2780
  "fields": [
@@ -1925,18 +2783,22 @@ export type AgentShield = {
1925
2783
  "type": "pubkey";
1926
2784
  },
1927
2785
  {
1928
- "name": "agent";
2786
+ "name": "destination";
2787
+ "type": "pubkey";
2788
+ },
2789
+ {
2790
+ "name": "amount";
2791
+ "type": "u64";
2792
+ },
2793
+ {
2794
+ "name": "mint";
1929
2795
  "type": "pubkey";
1930
- },
1931
- {
1932
- "name": "timestamp";
1933
- "type": "i64";
1934
2796
  }
1935
2797
  ];
1936
2798
  };
1937
2799
  },
1938
2800
  {
1939
- "name": "AgentVault";
2801
+ "name": "agentVault";
1940
2802
  "type": {
1941
2803
  "kind": "struct";
1942
2804
  "fields": [
@@ -1957,9 +2819,10 @@ export type AgentShield = {
1957
2819
  {
1958
2820
  "name": "feeDestination";
1959
2821
  "docs": [
1960
- "Developer fee destination \u2014 the wallet that receives developer fees",
1961
- "on every finalized transaction. Set at vault creation, immutable after",
1962
- "initialization. Protocol fees go to PROTOCOL_TREASURY separately."
2822
+ "Developer fee destination the wallet that receives developer fees",
2823
+ "on every finalized transaction. IMMUTABLE after initialization only",
2824
+ "`initialize_vault` writes this field. This prevents a compromised owner",
2825
+ "key from redirecting fees. Protocol fees go to PROTOCOL_TREASURY separately."
1963
2826
  ];
1964
2827
  "type": "pubkey";
1965
2828
  },
@@ -1977,7 +2840,7 @@ export type AgentShield = {
1977
2840
  ];
1978
2841
  "type": {
1979
2842
  "defined": {
1980
- "name": "VaultStatus";
2843
+ "name": "vaultStatus";
1981
2844
  };
1982
2845
  };
1983
2846
  },
@@ -2023,12 +2886,99 @@ export type AgentShield = {
2023
2886
  "Protocol fees are tracked separately via events."
2024
2887
  ];
2025
2888
  "type": "u64";
2889
+ },
2890
+ {
2891
+ "name": "trackerTier";
2892
+ "docs": [
2893
+ "Tracker capacity tier chosen at vault creation"
2894
+ ];
2895
+ "type": {
2896
+ "defined": {
2897
+ "name": "trackerTier";
2898
+ };
2899
+ };
2900
+ }
2901
+ ];
2902
+ };
2903
+ },
2904
+ {
2905
+ "name": "allowedToken";
2906
+ "docs": [
2907
+ "Per-token configuration including oracle feed and per-token caps.",
2908
+ "Replaces the old `Vec<Pubkey>` allowed_tokens with richer metadata.",
2909
+ "",
2910
+ "Oracle feed classification:",
2911
+ "- `Pubkey::default()` = stablecoin (1:1 USD, no oracle needed)",
2912
+ "- `UNPRICED_SENTINEL` ([0xFF; 32]) = unpriced token (receive-only)",
2913
+ "- Any other pubkey = Oracle feed account (Pyth PriceUpdateV2 or Switchboard PullFeed)"
2914
+ ];
2915
+ "type": {
2916
+ "kind": "struct";
2917
+ "fields": [
2918
+ {
2919
+ "name": "mint";
2920
+ "docs": [
2921
+ "Token mint address"
2922
+ ];
2923
+ "type": "pubkey";
2924
+ },
2925
+ {
2926
+ "name": "oracleFeed";
2927
+ "docs": [
2928
+ "Oracle feed account (Pyth PriceUpdateV2 or Switchboard PullFeed) for USD pricing.",
2929
+ "`Pubkey::default()` = stablecoin (1:1 USD).",
2930
+ "`UNPRICED_SENTINEL` = unpriced (receive-only, cannot be spent)."
2931
+ ];
2932
+ "type": "pubkey";
2933
+ },
2934
+ {
2935
+ "name": "decimals";
2936
+ "docs": [
2937
+ "Token decimals (e.g., 6 for USDC, 9 for SOL)"
2938
+ ];
2939
+ "type": "u8";
2940
+ },
2941
+ {
2942
+ "name": "dailyCapBase";
2943
+ "docs": [
2944
+ "Per-token daily cap in base units (0 = no per-token limit,",
2945
+ "only the aggregate USD cap applies)"
2946
+ ];
2947
+ "type": "u64";
2948
+ },
2949
+ {
2950
+ "name": "maxTxBase";
2951
+ "docs": [
2952
+ "Per-token max single transaction in base units",
2953
+ "(0 = no per-token tx limit, only USD tx limit applies)"
2954
+ ];
2955
+ "type": "u64";
2956
+ }
2957
+ ];
2958
+ };
2959
+ },
2960
+ {
2961
+ "name": "delegationRevoked";
2962
+ "type": {
2963
+ "kind": "struct";
2964
+ "fields": [
2965
+ {
2966
+ "name": "vault";
2967
+ "type": "pubkey";
2968
+ },
2969
+ {
2970
+ "name": "tokenAccount";
2971
+ "type": "pubkey";
2972
+ },
2973
+ {
2974
+ "name": "timestamp";
2975
+ "type": "i64";
2026
2976
  }
2027
2977
  ];
2028
2978
  };
2029
2979
  },
2030
2980
  {
2031
- "name": "FeesCollected";
2981
+ "name": "feesCollected";
2032
2982
  "type": {
2033
2983
  "kind": "struct";
2034
2984
  "fields": [
@@ -2080,7 +3030,7 @@ export type AgentShield = {
2080
3030
  };
2081
3031
  },
2082
3032
  {
2083
- "name": "FundsDeposited";
3033
+ "name": "fundsDeposited";
2084
3034
  "type": {
2085
3035
  "kind": "struct";
2086
3036
  "fields": [
@@ -2104,7 +3054,7 @@ export type AgentShield = {
2104
3054
  };
2105
3055
  },
2106
3056
  {
2107
- "name": "FundsWithdrawn";
3057
+ "name": "fundsWithdrawn";
2108
3058
  "type": {
2109
3059
  "kind": "struct";
2110
3060
  "fields": [
@@ -2132,7 +3082,164 @@ export type AgentShield = {
2132
3082
  };
2133
3083
  },
2134
3084
  {
2135
- "name": "PolicyConfig";
3085
+ "name": "pendingPolicyUpdate";
3086
+ "docs": [
3087
+ "Queued policy update that becomes executable after a timelock period.",
3088
+ "Created by `queue_policy_update`, applied by `apply_pending_policy`,",
3089
+ "or cancelled by `cancel_pending_policy`.",
3090
+ "",
3091
+ "PDA seeds: `[b\"pending_policy\", vault.key().as_ref()]`"
3092
+ ];
3093
+ "type": {
3094
+ "kind": "struct";
3095
+ "fields": [
3096
+ {
3097
+ "name": "vault";
3098
+ "docs": [
3099
+ "Associated vault pubkey"
3100
+ ];
3101
+ "type": "pubkey";
3102
+ },
3103
+ {
3104
+ "name": "queuedAt";
3105
+ "docs": [
3106
+ "Unix timestamp when this update was queued"
3107
+ ];
3108
+ "type": "i64";
3109
+ },
3110
+ {
3111
+ "name": "executesAt";
3112
+ "docs": [
3113
+ "Unix timestamp when this update becomes executable"
3114
+ ];
3115
+ "type": "i64";
3116
+ },
3117
+ {
3118
+ "name": "dailySpendingCapUsd";
3119
+ "type": {
3120
+ "option": "u64";
3121
+ };
3122
+ },
3123
+ {
3124
+ "name": "maxTransactionAmountUsd";
3125
+ "type": {
3126
+ "option": "u64";
3127
+ };
3128
+ },
3129
+ {
3130
+ "name": "allowedTokens";
3131
+ "type": {
3132
+ "option": {
3133
+ "vec": {
3134
+ "defined": {
3135
+ "name": "allowedToken";
3136
+ };
3137
+ };
3138
+ };
3139
+ };
3140
+ },
3141
+ {
3142
+ "name": "allowedProtocols";
3143
+ "type": {
3144
+ "option": {
3145
+ "vec": "pubkey";
3146
+ };
3147
+ };
3148
+ },
3149
+ {
3150
+ "name": "maxLeverageBps";
3151
+ "type": {
3152
+ "option": "u16";
3153
+ };
3154
+ },
3155
+ {
3156
+ "name": "canOpenPositions";
3157
+ "type": {
3158
+ "option": "bool";
3159
+ };
3160
+ },
3161
+ {
3162
+ "name": "maxConcurrentPositions";
3163
+ "type": {
3164
+ "option": "u8";
3165
+ };
3166
+ },
3167
+ {
3168
+ "name": "developerFeeRate";
3169
+ "type": {
3170
+ "option": "u16";
3171
+ };
3172
+ },
3173
+ {
3174
+ "name": "timelockDuration";
3175
+ "type": {
3176
+ "option": "u64";
3177
+ };
3178
+ },
3179
+ {
3180
+ "name": "allowedDestinations";
3181
+ "type": {
3182
+ "option": {
3183
+ "vec": "pubkey";
3184
+ };
3185
+ };
3186
+ },
3187
+ {
3188
+ "name": "bump";
3189
+ "docs": [
3190
+ "Bump seed for PDA"
3191
+ ];
3192
+ "type": "u8";
3193
+ }
3194
+ ];
3195
+ };
3196
+ },
3197
+ {
3198
+ "name": "policyChangeApplied";
3199
+ "type": {
3200
+ "kind": "struct";
3201
+ "fields": [
3202
+ {
3203
+ "name": "vault";
3204
+ "type": "pubkey";
3205
+ },
3206
+ {
3207
+ "name": "appliedAt";
3208
+ "type": "i64";
3209
+ }
3210
+ ];
3211
+ };
3212
+ },
3213
+ {
3214
+ "name": "policyChangeCancelled";
3215
+ "type": {
3216
+ "kind": "struct";
3217
+ "fields": [
3218
+ {
3219
+ "name": "vault";
3220
+ "type": "pubkey";
3221
+ }
3222
+ ];
3223
+ };
3224
+ },
3225
+ {
3226
+ "name": "policyChangeQueued";
3227
+ "type": {
3228
+ "kind": "struct";
3229
+ "fields": [
3230
+ {
3231
+ "name": "vault";
3232
+ "type": "pubkey";
3233
+ },
3234
+ {
3235
+ "name": "executesAt";
3236
+ "type": "i64";
3237
+ }
3238
+ ];
3239
+ };
3240
+ },
3241
+ {
3242
+ "name": "policyConfig";
2136
3243
  "type": {
2137
3244
  "kind": "struct";
2138
3245
  "fields": [
@@ -2144,27 +3251,32 @@ export type AgentShield = {
2144
3251
  "type": "pubkey";
2145
3252
  },
2146
3253
  {
2147
- "name": "dailySpendingCap";
3254
+ "name": "dailySpendingCapUsd";
2148
3255
  "docs": [
2149
- "Maximum spend per rolling 24h period (in token base units)"
3256
+ "Maximum aggregate spend per rolling 24h period in USD (6 decimals).",
3257
+ "$500 = 500_000_000. This is the primary spending cap."
2150
3258
  ];
2151
3259
  "type": "u64";
2152
3260
  },
2153
3261
  {
2154
- "name": "maxTransactionSize";
3262
+ "name": "maxTransactionSizeUsd";
2155
3263
  "docs": [
2156
- "Maximum single transaction size (in token base units)"
3264
+ "Maximum single transaction size in USD (6 decimals)."
2157
3265
  ];
2158
3266
  "type": "u64";
2159
3267
  },
2160
3268
  {
2161
3269
  "name": "allowedTokens";
2162
3270
  "docs": [
2163
- "Allowed token mints the agent can interact with",
2164
- "Bounded to MAX_ALLOWED_TOKENS entries"
3271
+ "Allowed token mints with oracle feeds and per-token caps.",
3272
+ "Bounded to MAX_ALLOWED_TOKENS entries."
2165
3273
  ];
2166
3274
  "type": {
2167
- "vec": "pubkey";
3275
+ "vec": {
3276
+ "defined": {
3277
+ "name": "allowedToken";
3278
+ };
3279
+ };
2168
3280
  };
2169
3281
  },
2170
3282
  {
@@ -2210,6 +3322,25 @@ export type AgentShield = {
2210
3322
  ];
2211
3323
  "type": "u16";
2212
3324
  },
3325
+ {
3326
+ "name": "timelockDuration";
3327
+ "docs": [
3328
+ "Timelock duration in seconds for policy changes. 0 = no timelock",
3329
+ "(immediate updates allowed). When > 0, policy changes must go",
3330
+ "through queue_policy_update → apply_pending_policy."
3331
+ ];
3332
+ "type": "u64";
3333
+ },
3334
+ {
3335
+ "name": "allowedDestinations";
3336
+ "docs": [
3337
+ "Allowed destination addresses for agent transfers.",
3338
+ "Empty = any destination allowed. Bounded to MAX_ALLOWED_DESTINATIONS."
3339
+ ];
3340
+ "type": {
3341
+ "vec": "pubkey";
3342
+ };
3343
+ },
2213
3344
  {
2214
3345
  "name": "bump";
2215
3346
  "docs": [
@@ -2221,7 +3352,7 @@ export type AgentShield = {
2221
3352
  };
2222
3353
  },
2223
3354
  {
2224
- "name": "PolicyUpdated";
3355
+ "name": "policyUpdated";
2225
3356
  "type": {
2226
3357
  "kind": "struct";
2227
3358
  "fields": [
@@ -2230,11 +3361,11 @@ export type AgentShield = {
2230
3361
  "type": "pubkey";
2231
3362
  },
2232
3363
  {
2233
- "name": "dailyCap";
3364
+ "name": "dailyCapUsd";
2234
3365
  "type": "u64";
2235
3366
  },
2236
3367
  {
2237
- "name": "maxTransactionSize";
3368
+ "name": "maxTransactionSizeUsd";
2238
3369
  "type": "u64";
2239
3370
  },
2240
3371
  {
@@ -2261,7 +3392,7 @@ export type AgentShield = {
2261
3392
  };
2262
3393
  },
2263
3394
  {
2264
- "name": "SessionAuthority";
3395
+ "name": "sessionAuthority";
2265
3396
  "type": {
2266
3397
  "kind": "struct";
2267
3398
  "fields": [
@@ -2308,7 +3439,7 @@ export type AgentShield = {
2308
3439
  ];
2309
3440
  "type": {
2310
3441
  "defined": {
2311
- "name": "ActionType";
3442
+ "name": "actionType";
2312
3443
  };
2313
3444
  };
2314
3445
  },
@@ -2319,6 +3450,21 @@ export type AgentShield = {
2319
3450
  ];
2320
3451
  "type": "u64";
2321
3452
  },
3453
+ {
3454
+ "name": "delegated";
3455
+ "docs": [
3456
+ "Whether token delegation was set up (approve CPI)"
3457
+ ];
3458
+ "type": "bool";
3459
+ },
3460
+ {
3461
+ "name": "delegationTokenAccount";
3462
+ "docs": [
3463
+ "The vault's token account that was delegated to the agent",
3464
+ "(only meaningful when delegated == true)"
3465
+ ];
3466
+ "type": "pubkey";
3467
+ },
2322
3468
  {
2323
3469
  "name": "bump";
2324
3470
  "docs": [
@@ -2330,7 +3476,7 @@ export type AgentShield = {
2330
3476
  };
2331
3477
  },
2332
3478
  {
2333
- "name": "SessionFinalized";
3479
+ "name": "sessionFinalized";
2334
3480
  "type": {
2335
3481
  "kind": "struct";
2336
3482
  "fields": [
@@ -2346,6 +3492,10 @@ export type AgentShield = {
2346
3492
  "name": "success";
2347
3493
  "type": "bool";
2348
3494
  },
3495
+ {
3496
+ "name": "isExpired";
3497
+ "type": "bool";
3498
+ },
2349
3499
  {
2350
3500
  "name": "timestamp";
2351
3501
  "type": "i64";
@@ -2354,16 +3504,31 @@ export type AgentShield = {
2354
3504
  };
2355
3505
  },
2356
3506
  {
2357
- "name": "SpendEntry";
3507
+ "name": "spendEntry";
2358
3508
  "type": {
2359
3509
  "kind": "struct";
2360
3510
  "fields": [
2361
3511
  {
2362
- "name": "tokenMint";
2363
- "type": "pubkey";
3512
+ "name": "tokenIndex";
3513
+ "docs": [
3514
+ "Index into PolicyConfig.allowed_tokens[] (0-9).",
3515
+ "Compact representation — avoids storing full 32-byte Pubkey per entry.",
3516
+ "Invalidated when token list changes (rolling_spends is cleared)."
3517
+ ];
3518
+ "type": "u8";
3519
+ },
3520
+ {
3521
+ "name": "usdAmount";
3522
+ "docs": [
3523
+ "USD value of this spend (6 decimals, e.g., $500 = 500_000_000)"
3524
+ ];
3525
+ "type": "u64";
2364
3526
  },
2365
3527
  {
2366
- "name": "amountSpent";
3528
+ "name": "baseAmount";
3529
+ "docs": [
3530
+ "Original amount in token base units (for per-token cap checks)"
3531
+ ];
2367
3532
  "type": "u64";
2368
3533
  },
2369
3534
  {
@@ -2374,7 +3539,7 @@ export type AgentShield = {
2374
3539
  };
2375
3540
  },
2376
3541
  {
2377
- "name": "SpendTracker";
3542
+ "name": "spendTracker";
2378
3543
  "type": {
2379
3544
  "kind": "struct";
2380
3545
  "fields": [
@@ -2385,16 +3550,34 @@ export type AgentShield = {
2385
3550
  ];
2386
3551
  "type": "pubkey";
2387
3552
  },
3553
+ {
3554
+ "name": "trackerTier";
3555
+ "docs": [
3556
+ "Tracker capacity tier (Standard/Pro/Max)"
3557
+ ];
3558
+ "type": {
3559
+ "defined": {
3560
+ "name": "trackerTier";
3561
+ };
3562
+ };
3563
+ },
3564
+ {
3565
+ "name": "maxSpendEntries";
3566
+ "docs": [
3567
+ "Maximum spend entries for this tracker (derived from tier at init)"
3568
+ ];
3569
+ "type": "u32";
3570
+ },
2388
3571
  {
2389
3572
  "name": "rollingSpends";
2390
3573
  "docs": [
2391
- "Rolling spend entries: (token_mint, amount, timestamp)",
3574
+ "Rolling spend entries: (token_mint, usd_amount, base_amount, timestamp)",
2392
3575
  "Entries older than ROLLING_WINDOW_SECONDS are pruned on each access"
2393
3576
  ];
2394
3577
  "type": {
2395
3578
  "vec": {
2396
3579
  "defined": {
2397
- "name": "SpendEntry";
3580
+ "name": "spendEntry";
2398
3581
  };
2399
3582
  };
2400
3583
  };
@@ -2408,7 +3591,7 @@ export type AgentShield = {
2408
3591
  "type": {
2409
3592
  "vec": {
2410
3593
  "defined": {
2411
- "name": "TransactionRecord";
3594
+ "name": "transactionRecord";
2412
3595
  };
2413
3596
  };
2414
3597
  };
@@ -2424,7 +3607,28 @@ export type AgentShield = {
2424
3607
  };
2425
3608
  },
2426
3609
  {
2427
- "name": "TransactionRecord";
3610
+ "name": "trackerTier";
3611
+ "docs": [
3612
+ "Tracker capacity tiers — chosen at vault creation, determines",
3613
+ "max rolling spend entries and SpendTracker account size."
3614
+ ];
3615
+ "type": {
3616
+ "kind": "enum";
3617
+ "variants": [
3618
+ {
3619
+ "name": "standard";
3620
+ },
3621
+ {
3622
+ "name": "pro";
3623
+ },
3624
+ {
3625
+ "name": "max";
3626
+ }
3627
+ ];
3628
+ };
3629
+ },
3630
+ {
3631
+ "name": "transactionRecord";
2428
3632
  "type": {
2429
3633
  "kind": "struct";
2430
3634
  "fields": [
@@ -2436,7 +3640,7 @@ export type AgentShield = {
2436
3640
  "name": "actionType";
2437
3641
  "type": {
2438
3642
  "defined": {
2439
- "name": "ActionType";
3643
+ "name": "actionType";
2440
3644
  };
2441
3645
  };
2442
3646
  },
@@ -2464,7 +3668,7 @@ export type AgentShield = {
2464
3668
  };
2465
3669
  },
2466
3670
  {
2467
- "name": "VaultClosed";
3671
+ "name": "vaultClosed";
2468
3672
  "type": {
2469
3673
  "kind": "struct";
2470
3674
  "fields": [
@@ -2484,7 +3688,7 @@ export type AgentShield = {
2484
3688
  };
2485
3689
  },
2486
3690
  {
2487
- "name": "VaultCreated";
3691
+ "name": "vaultCreated";
2488
3692
  "type": {
2489
3693
  "kind": "struct";
2490
3694
  "fields": [
@@ -2508,7 +3712,7 @@ export type AgentShield = {
2508
3712
  };
2509
3713
  },
2510
3714
  {
2511
- "name": "VaultReactivated";
3715
+ "name": "vaultReactivated";
2512
3716
  "type": {
2513
3717
  "kind": "struct";
2514
3718
  "fields": [
@@ -2530,7 +3734,7 @@ export type AgentShield = {
2530
3734
  };
2531
3735
  },
2532
3736
  {
2533
- "name": "VaultStatus";
3737
+ "name": "vaultStatus";
2534
3738
  "docs": [
2535
3739
  "Vault status enum"
2536
3740
  ];
@@ -2538,13 +3742,13 @@ export type AgentShield = {
2538
3742
  "kind": "enum";
2539
3743
  "variants": [
2540
3744
  {
2541
- "name": "Active";
3745
+ "name": "active";
2542
3746
  },
2543
3747
  {
2544
- "name": "Frozen";
3748
+ "name": "frozen";
2545
3749
  },
2546
3750
  {
2547
- "name": "Closed";
3751
+ "name": "closed";
2548
3752
  }
2549
3753
  ];
2550
3754
  };