@agent-fuel/sdk 0.1.1 → 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.
- package/CHANGELOG.md +26 -0
- package/README.md +36 -1
- package/dist/cli.cjs +4530 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +4528 -0
- package/dist/cli.js.map +1 -0
- package/dist/idl/credit-vault.cjs +475 -1
- package/dist/idl/credit-vault.cjs.map +1 -1
- package/dist/idl/credit-vault.d.cts +477 -1
- package/dist/idl/credit-vault.d.ts +477 -1
- package/dist/idl/credit-vault.js +475 -1
- package/dist/idl/credit-vault.js.map +1 -1
- package/dist/index.cjs +723 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -1
- package/dist/index.d.ts +87 -1
- package/dist/index.js +722 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -11,6 +11,200 @@ var credit_vault_default = {
|
|
|
11
11
|
repository: "https://github.com/TODO/agent_fuel"
|
|
12
12
|
},
|
|
13
13
|
instructions: [
|
|
14
|
+
{
|
|
15
|
+
name: "approve_spend",
|
|
16
|
+
discriminator: [
|
|
17
|
+
248,
|
|
18
|
+
201,
|
|
19
|
+
151,
|
|
20
|
+
15,
|
|
21
|
+
28,
|
|
22
|
+
162,
|
|
23
|
+
112,
|
|
24
|
+
90
|
|
25
|
+
],
|
|
26
|
+
accounts: [
|
|
27
|
+
{
|
|
28
|
+
name: "owner",
|
|
29
|
+
writable: true,
|
|
30
|
+
signer: true,
|
|
31
|
+
relations: [
|
|
32
|
+
"vault"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "vault",
|
|
37
|
+
writable: true,
|
|
38
|
+
pda: {
|
|
39
|
+
seeds: [
|
|
40
|
+
{
|
|
41
|
+
kind: "const",
|
|
42
|
+
value: [
|
|
43
|
+
118,
|
|
44
|
+
97,
|
|
45
|
+
117,
|
|
46
|
+
108,
|
|
47
|
+
116
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
kind: "account",
|
|
52
|
+
path: "owner"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
kind: "account",
|
|
56
|
+
path: "vault.agent",
|
|
57
|
+
account: "CreditVault"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "policy",
|
|
64
|
+
writable: true,
|
|
65
|
+
pda: {
|
|
66
|
+
seeds: [
|
|
67
|
+
{
|
|
68
|
+
kind: "const",
|
|
69
|
+
value: [
|
|
70
|
+
112,
|
|
71
|
+
111,
|
|
72
|
+
108,
|
|
73
|
+
105,
|
|
74
|
+
99,
|
|
75
|
+
121
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
kind: "account",
|
|
80
|
+
path: "vault"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "pending_spend",
|
|
87
|
+
writable: true,
|
|
88
|
+
pda: {
|
|
89
|
+
seeds: [
|
|
90
|
+
{
|
|
91
|
+
kind: "const",
|
|
92
|
+
value: [
|
|
93
|
+
112,
|
|
94
|
+
101,
|
|
95
|
+
110,
|
|
96
|
+
100,
|
|
97
|
+
105,
|
|
98
|
+
110,
|
|
99
|
+
103
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
kind: "account",
|
|
104
|
+
path: "vault"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
kind: "account",
|
|
108
|
+
path: "pending_spend.nonce",
|
|
109
|
+
account: "PendingSpend"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "vault_token_account",
|
|
116
|
+
writable: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "service_token_account",
|
|
120
|
+
writable: true
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "token_program",
|
|
124
|
+
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
args: []
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "cancel_spend",
|
|
131
|
+
discriminator: [
|
|
132
|
+
122,
|
|
133
|
+
254,
|
|
134
|
+
101,
|
|
135
|
+
132,
|
|
136
|
+
241,
|
|
137
|
+
232,
|
|
138
|
+
205,
|
|
139
|
+
179
|
|
140
|
+
],
|
|
141
|
+
accounts: [
|
|
142
|
+
{
|
|
143
|
+
name: "owner",
|
|
144
|
+
writable: true,
|
|
145
|
+
signer: true,
|
|
146
|
+
relations: [
|
|
147
|
+
"vault"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "vault",
|
|
152
|
+
pda: {
|
|
153
|
+
seeds: [
|
|
154
|
+
{
|
|
155
|
+
kind: "const",
|
|
156
|
+
value: [
|
|
157
|
+
118,
|
|
158
|
+
97,
|
|
159
|
+
117,
|
|
160
|
+
108,
|
|
161
|
+
116
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
kind: "account",
|
|
166
|
+
path: "owner"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
kind: "account",
|
|
170
|
+
path: "vault.agent",
|
|
171
|
+
account: "CreditVault"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "pending_spend",
|
|
178
|
+
writable: true,
|
|
179
|
+
pda: {
|
|
180
|
+
seeds: [
|
|
181
|
+
{
|
|
182
|
+
kind: "const",
|
|
183
|
+
value: [
|
|
184
|
+
112,
|
|
185
|
+
101,
|
|
186
|
+
110,
|
|
187
|
+
100,
|
|
188
|
+
105,
|
|
189
|
+
110,
|
|
190
|
+
103
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
kind: "account",
|
|
195
|
+
path: "vault"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
kind: "account",
|
|
199
|
+
path: "pending_spend.nonce",
|
|
200
|
+
account: "PendingSpend"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
args: []
|
|
207
|
+
},
|
|
14
208
|
{
|
|
15
209
|
name: "claim",
|
|
16
210
|
discriminator: [
|
|
@@ -417,6 +611,104 @@ var credit_vault_default = {
|
|
|
417
611
|
],
|
|
418
612
|
args: []
|
|
419
613
|
},
|
|
614
|
+
{
|
|
615
|
+
name: "request_spend",
|
|
616
|
+
discriminator: [
|
|
617
|
+
127,
|
|
618
|
+
12,
|
|
619
|
+
23,
|
|
620
|
+
75,
|
|
621
|
+
137,
|
|
622
|
+
178,
|
|
623
|
+
148,
|
|
624
|
+
71
|
|
625
|
+
],
|
|
626
|
+
accounts: [
|
|
627
|
+
{
|
|
628
|
+
name: "agent",
|
|
629
|
+
writable: true,
|
|
630
|
+
signer: true,
|
|
631
|
+
relations: [
|
|
632
|
+
"vault"
|
|
633
|
+
]
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: "vault",
|
|
637
|
+
writable: true,
|
|
638
|
+
pda: {
|
|
639
|
+
seeds: [
|
|
640
|
+
{
|
|
641
|
+
kind: "const",
|
|
642
|
+
value: [
|
|
643
|
+
118,
|
|
644
|
+
97,
|
|
645
|
+
117,
|
|
646
|
+
108,
|
|
647
|
+
116
|
|
648
|
+
]
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
kind: "account",
|
|
652
|
+
path: "vault.owner",
|
|
653
|
+
account: "CreditVault"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
kind: "account",
|
|
657
|
+
path: "vault.agent",
|
|
658
|
+
account: "CreditVault"
|
|
659
|
+
}
|
|
660
|
+
]
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: "service_token_account",
|
|
665
|
+
docs: [
|
|
666
|
+
"The recipient token account. We only need it for its `owner` field",
|
|
667
|
+
"(the service pubkey we record in PendingSpend); mint constraint is",
|
|
668
|
+
"belt-and-suspenders since `approve_spend` re-checks both."
|
|
669
|
+
]
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: "pending_spend",
|
|
673
|
+
writable: true,
|
|
674
|
+
pda: {
|
|
675
|
+
seeds: [
|
|
676
|
+
{
|
|
677
|
+
kind: "const",
|
|
678
|
+
value: [
|
|
679
|
+
112,
|
|
680
|
+
101,
|
|
681
|
+
110,
|
|
682
|
+
100,
|
|
683
|
+
105,
|
|
684
|
+
110,
|
|
685
|
+
103
|
|
686
|
+
]
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
kind: "account",
|
|
690
|
+
path: "vault"
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
kind: "account",
|
|
694
|
+
path: "vault.pending_count",
|
|
695
|
+
account: "CreditVault"
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "system_program",
|
|
702
|
+
address: "11111111111111111111111111111111"
|
|
703
|
+
}
|
|
704
|
+
],
|
|
705
|
+
args: [
|
|
706
|
+
{
|
|
707
|
+
name: "amount_usdc",
|
|
708
|
+
type: "u64"
|
|
709
|
+
}
|
|
710
|
+
]
|
|
711
|
+
},
|
|
420
712
|
{
|
|
421
713
|
name: "spend",
|
|
422
714
|
discriminator: [
|
|
@@ -742,6 +1034,19 @@ var credit_vault_default = {
|
|
|
742
1034
|
70
|
|
743
1035
|
]
|
|
744
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
|
+
},
|
|
745
1050
|
{
|
|
746
1051
|
name: "SpendPolicy",
|
|
747
1052
|
discriminator: [
|
|
@@ -796,6 +1101,32 @@ var credit_vault_default = {
|
|
|
796
1101
|
161
|
|
797
1102
|
]
|
|
798
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
|
+
},
|
|
799
1130
|
{
|
|
800
1131
|
name: "Spent",
|
|
801
1132
|
discriminator: [
|
|
@@ -912,6 +1243,16 @@ var credit_vault_default = {
|
|
|
912
1243
|
code: 6009,
|
|
913
1244
|
name: "PostPayDisabled",
|
|
914
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"
|
|
915
1256
|
}
|
|
916
1257
|
],
|
|
917
1258
|
types: [
|
|
@@ -1000,12 +1341,22 @@ var credit_vault_default = {
|
|
|
1000
1341
|
name: "bump",
|
|
1001
1342
|
type: "u8"
|
|
1002
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
|
+
},
|
|
1003
1354
|
{
|
|
1004
1355
|
name: "_padding",
|
|
1005
1356
|
type: {
|
|
1006
1357
|
array: [
|
|
1007
1358
|
"u8",
|
|
1008
|
-
|
|
1359
|
+
56
|
|
1009
1360
|
]
|
|
1010
1361
|
}
|
|
1011
1362
|
}
|
|
@@ -1040,6 +1391,65 @@ var credit_vault_default = {
|
|
|
1040
1391
|
]
|
|
1041
1392
|
}
|
|
1042
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
|
+
},
|
|
1043
1453
|
{
|
|
1044
1454
|
name: "PolicyUpdated",
|
|
1045
1455
|
type: {
|
|
@@ -1143,6 +1553,70 @@ var credit_vault_default = {
|
|
|
1143
1553
|
]
|
|
1144
1554
|
}
|
|
1145
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
|
+
},
|
|
1146
1620
|
{
|
|
1147
1621
|
name: "Spent",
|
|
1148
1622
|
type: {
|