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