@agent-fuel/sdk 0.1.1 → 0.2.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.
@@ -7,6 +7,202 @@ var metadata = {
7
7
  repository: "https://github.com/TODO/agent_fuel"
8
8
  };
9
9
  var instructions = [
10
+ {
11
+ name: "approve_spend",
12
+ discriminator: [
13
+ 248,
14
+ 201,
15
+ 151,
16
+ 15,
17
+ 28,
18
+ 162,
19
+ 112,
20
+ 90
21
+ ],
22
+ accounts: [
23
+ {
24
+ name: "owner",
25
+ writable: true,
26
+ signer: true,
27
+ relations: [
28
+ "vault"
29
+ ]
30
+ },
31
+ {
32
+ name: "vault",
33
+ writable: true,
34
+ pda: {
35
+ seeds: [
36
+ {
37
+ kind: "const",
38
+ value: [
39
+ 118,
40
+ 97,
41
+ 117,
42
+ 108,
43
+ 116
44
+ ]
45
+ },
46
+ {
47
+ kind: "account",
48
+ path: "owner"
49
+ },
50
+ {
51
+ kind: "account",
52
+ path: "vault.agent",
53
+ account: "CreditVault"
54
+ }
55
+ ]
56
+ }
57
+ },
58
+ {
59
+ name: "policy",
60
+ writable: true,
61
+ pda: {
62
+ seeds: [
63
+ {
64
+ kind: "const",
65
+ value: [
66
+ 112,
67
+ 111,
68
+ 108,
69
+ 105,
70
+ 99,
71
+ 121
72
+ ]
73
+ },
74
+ {
75
+ kind: "account",
76
+ path: "vault"
77
+ }
78
+ ]
79
+ }
80
+ },
81
+ {
82
+ name: "pending_spend",
83
+ writable: true,
84
+ pda: {
85
+ seeds: [
86
+ {
87
+ kind: "const",
88
+ value: [
89
+ 112,
90
+ 101,
91
+ 110,
92
+ 100,
93
+ 105,
94
+ 110,
95
+ 103
96
+ ]
97
+ },
98
+ {
99
+ kind: "account",
100
+ path: "vault"
101
+ },
102
+ {
103
+ kind: "account",
104
+ path: "pending_spend.nonce",
105
+ account: "PendingSpend"
106
+ }
107
+ ]
108
+ }
109
+ },
110
+ {
111
+ name: "vault_token_account",
112
+ writable: true
113
+ },
114
+ {
115
+ name: "service_token_account",
116
+ writable: true
117
+ },
118
+ {
119
+ name: "token_program",
120
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
121
+ }
122
+ ],
123
+ args: [
124
+ ]
125
+ },
126
+ {
127
+ name: "cancel_spend",
128
+ discriminator: [
129
+ 122,
130
+ 254,
131
+ 101,
132
+ 132,
133
+ 241,
134
+ 232,
135
+ 205,
136
+ 179
137
+ ],
138
+ accounts: [
139
+ {
140
+ name: "owner",
141
+ writable: true,
142
+ signer: true,
143
+ relations: [
144
+ "vault"
145
+ ]
146
+ },
147
+ {
148
+ name: "vault",
149
+ pda: {
150
+ seeds: [
151
+ {
152
+ kind: "const",
153
+ value: [
154
+ 118,
155
+ 97,
156
+ 117,
157
+ 108,
158
+ 116
159
+ ]
160
+ },
161
+ {
162
+ kind: "account",
163
+ path: "owner"
164
+ },
165
+ {
166
+ kind: "account",
167
+ path: "vault.agent",
168
+ account: "CreditVault"
169
+ }
170
+ ]
171
+ }
172
+ },
173
+ {
174
+ name: "pending_spend",
175
+ writable: true,
176
+ pda: {
177
+ seeds: [
178
+ {
179
+ kind: "const",
180
+ value: [
181
+ 112,
182
+ 101,
183
+ 110,
184
+ 100,
185
+ 105,
186
+ 110,
187
+ 103
188
+ ]
189
+ },
190
+ {
191
+ kind: "account",
192
+ path: "vault"
193
+ },
194
+ {
195
+ kind: "account",
196
+ path: "pending_spend.nonce",
197
+ account: "PendingSpend"
198
+ }
199
+ ]
200
+ }
201
+ }
202
+ ],
203
+ args: [
204
+ ]
205
+ },
10
206
  {
11
207
  name: "claim",
12
208
  discriminator: [
@@ -414,6 +610,104 @@ var instructions = [
414
610
  args: [
415
611
  ]
416
612
  },
613
+ {
614
+ name: "request_spend",
615
+ discriminator: [
616
+ 127,
617
+ 12,
618
+ 23,
619
+ 75,
620
+ 137,
621
+ 178,
622
+ 148,
623
+ 71
624
+ ],
625
+ accounts: [
626
+ {
627
+ name: "agent",
628
+ writable: true,
629
+ signer: true,
630
+ relations: [
631
+ "vault"
632
+ ]
633
+ },
634
+ {
635
+ name: "vault",
636
+ writable: true,
637
+ pda: {
638
+ seeds: [
639
+ {
640
+ kind: "const",
641
+ value: [
642
+ 118,
643
+ 97,
644
+ 117,
645
+ 108,
646
+ 116
647
+ ]
648
+ },
649
+ {
650
+ kind: "account",
651
+ path: "vault.owner",
652
+ account: "CreditVault"
653
+ },
654
+ {
655
+ kind: "account",
656
+ path: "vault.agent",
657
+ account: "CreditVault"
658
+ }
659
+ ]
660
+ }
661
+ },
662
+ {
663
+ name: "service_token_account",
664
+ docs: [
665
+ "The recipient token account. We only need it for its `owner` field",
666
+ "(the service pubkey we record in PendingSpend); mint constraint is",
667
+ "belt-and-suspenders since `approve_spend` re-checks both."
668
+ ]
669
+ },
670
+ {
671
+ name: "pending_spend",
672
+ writable: true,
673
+ pda: {
674
+ seeds: [
675
+ {
676
+ kind: "const",
677
+ value: [
678
+ 112,
679
+ 101,
680
+ 110,
681
+ 100,
682
+ 105,
683
+ 110,
684
+ 103
685
+ ]
686
+ },
687
+ {
688
+ kind: "account",
689
+ path: "vault"
690
+ },
691
+ {
692
+ kind: "account",
693
+ path: "vault.pending_count",
694
+ account: "CreditVault"
695
+ }
696
+ ]
697
+ }
698
+ },
699
+ {
700
+ name: "system_program",
701
+ address: "11111111111111111111111111111111"
702
+ }
703
+ ],
704
+ args: [
705
+ {
706
+ name: "amount_usdc",
707
+ type: "u64"
708
+ }
709
+ ]
710
+ },
417
711
  {
418
712
  name: "spend",
419
713
  discriminator: [
@@ -740,6 +1034,19 @@ var accounts = [
740
1034
  70
741
1035
  ]
742
1036
  },
1037
+ {
1038
+ name: "PendingSpend",
1039
+ discriminator: [
1040
+ 193,
1041
+ 205,
1042
+ 85,
1043
+ 66,
1044
+ 25,
1045
+ 3,
1046
+ 67,
1047
+ 134
1048
+ ]
1049
+ },
743
1050
  {
744
1051
  name: "SpendPolicy",
745
1052
  discriminator: [
@@ -794,6 +1101,32 @@ var events = [
794
1101
  161
795
1102
  ]
796
1103
  },
1104
+ {
1105
+ name: "SpendRejected",
1106
+ discriminator: [
1107
+ 22,
1108
+ 233,
1109
+ 208,
1110
+ 109,
1111
+ 202,
1112
+ 231,
1113
+ 175,
1114
+ 22
1115
+ ]
1116
+ },
1117
+ {
1118
+ name: "SpendRequested",
1119
+ discriminator: [
1120
+ 144,
1121
+ 207,
1122
+ 254,
1123
+ 247,
1124
+ 81,
1125
+ 146,
1126
+ 84,
1127
+ 87
1128
+ ]
1129
+ },
797
1130
  {
798
1131
  name: "Spent",
799
1132
  discriminator: [
@@ -910,6 +1243,16 @@ var errors = [
910
1243
  code: 6009,
911
1244
  name: "PostPayDisabled",
912
1245
  msg: "Post-pay claims are disabled for this vault"
1246
+ },
1247
+ {
1248
+ code: 6010,
1249
+ name: "PendingSpendVaultMismatch",
1250
+ msg: "Pending spend belongs to a different vault"
1251
+ },
1252
+ {
1253
+ code: 6011,
1254
+ name: "PendingNonceOverflow",
1255
+ msg: "Pending spend counter would overflow"
913
1256
  }
914
1257
  ];
915
1258
  var types = [
@@ -998,12 +1341,22 @@ var types = [
998
1341
  name: "bump",
999
1342
  type: "u8"
1000
1343
  },
1344
+ {
1345
+ name: "pending_count",
1346
+ docs: [
1347
+ "Monotonic counter used as a PDA seed for PendingSpend accounts so",
1348
+ "every approval request gets a unique deterministic address.",
1349
+ "Borrowed 8 bytes from the original 64-byte padding so the account",
1350
+ "size stays at `ACCOUNT_SIZE` and existing vaults need no migration."
1351
+ ],
1352
+ type: "u64"
1353
+ },
1001
1354
  {
1002
1355
  name: "_padding",
1003
1356
  type: {
1004
1357
  array: [
1005
1358
  "u8",
1006
- 64
1359
+ 56
1007
1360
  ]
1008
1361
  }
1009
1362
  }
@@ -1038,6 +1391,65 @@ var types = [
1038
1391
  ]
1039
1392
  }
1040
1393
  },
1394
+ {
1395
+ name: "PendingSpend",
1396
+ docs: [
1397
+ "A spend request that exceeded one of the policy's rate limits. The agent",
1398
+ "creates this account by calling `request_spend`; the owner reviews from",
1399
+ "the mobile Alerts tab and either calls `approve_spend` (PDA-signed CPI",
1400
+ "transfer, account closed) or `cancel_spend` (account closed, no transfer).",
1401
+ "",
1402
+ "Seeded by `[\"pending\", vault, nonce_le]` where `nonce` is the value of",
1403
+ "`vault.pending_count` at request time, so each request has a unique",
1404
+ "deterministic address that both the agent and the owner can derive."
1405
+ ],
1406
+ type: {
1407
+ kind: "struct",
1408
+ fields: [
1409
+ {
1410
+ name: "vault",
1411
+ type: "pubkey"
1412
+ },
1413
+ {
1414
+ name: "agent",
1415
+ type: "pubkey"
1416
+ },
1417
+ {
1418
+ name: "service",
1419
+ docs: [
1420
+ "Owner of the destination token account (mirrors how `Spent` records",
1421
+ "service: `service_token_account.owner`)."
1422
+ ],
1423
+ type: "pubkey"
1424
+ },
1425
+ {
1426
+ name: "amount_usdc",
1427
+ type: "u64"
1428
+ },
1429
+ {
1430
+ name: "requested_slot",
1431
+ type: "u64"
1432
+ },
1433
+ {
1434
+ name: "nonce",
1435
+ type: "u64"
1436
+ },
1437
+ {
1438
+ name: "bump",
1439
+ type: "u8"
1440
+ },
1441
+ {
1442
+ name: "_padding",
1443
+ type: {
1444
+ array: [
1445
+ "u8",
1446
+ 31
1447
+ ]
1448
+ }
1449
+ }
1450
+ ]
1451
+ }
1452
+ },
1041
1453
  {
1042
1454
  name: "PolicyUpdated",
1043
1455
  type: {
@@ -1141,6 +1553,70 @@ var types = [
1141
1553
  ]
1142
1554
  }
1143
1555
  },
1556
+ {
1557
+ name: "SpendRejected",
1558
+ type: {
1559
+ kind: "struct",
1560
+ fields: [
1561
+ {
1562
+ name: "vault",
1563
+ type: "pubkey"
1564
+ },
1565
+ {
1566
+ name: "owner",
1567
+ type: "pubkey"
1568
+ },
1569
+ {
1570
+ name: "pending_spend",
1571
+ type: "pubkey"
1572
+ },
1573
+ {
1574
+ name: "nonce",
1575
+ type: "u64"
1576
+ },
1577
+ {
1578
+ name: "slot",
1579
+ type: "u64"
1580
+ }
1581
+ ]
1582
+ }
1583
+ },
1584
+ {
1585
+ name: "SpendRequested",
1586
+ type: {
1587
+ kind: "struct",
1588
+ fields: [
1589
+ {
1590
+ name: "vault",
1591
+ type: "pubkey"
1592
+ },
1593
+ {
1594
+ name: "agent",
1595
+ type: "pubkey"
1596
+ },
1597
+ {
1598
+ name: "service",
1599
+ type: "pubkey"
1600
+ },
1601
+ {
1602
+ name: "pending_spend",
1603
+ type: "pubkey"
1604
+ },
1605
+ {
1606
+ name: "amount_usdc",
1607
+ type: "u64"
1608
+ },
1609
+ {
1610
+ name: "nonce",
1611
+ type: "u64"
1612
+ },
1613
+ {
1614
+ name: "slot",
1615
+ type: "u64"
1616
+ }
1617
+ ]
1618
+ }
1619
+ },
1144
1620
  {
1145
1621
  name: "Spent",
1146
1622
  type: {