aavegotchi-cli 0.2.2 → 0.2.5
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 +40 -0
- package/README.md +28 -3
- package/dist/command-catalog.js +7 -5
- package/dist/command-runner.js +13 -0
- package/dist/commands/auction-bid.js +815 -0
- package/dist/commands/bootstrap.js +5 -0
- package/dist/commands/mapped-defaults.js +242 -0
- package/dist/commands/mapped.js +14 -1
- package/dist/commands/onchain.js +33 -4
- package/dist/commands/profile.js +1 -0
- package/dist/commands/signer.js +3 -0
- package/dist/commands/tx.js +3 -0
- package/dist/output.js +86 -11
- package/dist/profile-env.js +172 -0
- package/dist/schemas.js +1 -0
- package/dist/signer.js +1 -6
- package/dist/subgraph/sources.js +4 -1
- package/dist/tx-engine.js +56 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ const args_1 = require("../args");
|
|
|
5
5
|
const chains_1 = require("../chains");
|
|
6
6
|
const config_1 = require("../config");
|
|
7
7
|
const errors_1 = require("../errors");
|
|
8
|
+
const profile_env_1 = require("../profile-env");
|
|
8
9
|
const rpc_1 = require("../rpc");
|
|
9
10
|
const signer_1 = require("../signer");
|
|
10
11
|
function getRequiredProfileName(ctx) {
|
|
@@ -51,12 +52,14 @@ async function runBootstrapCommand(ctx) {
|
|
|
51
52
|
const chainInput = (0, args_1.getFlagString)(ctx.args.flags, "chain");
|
|
52
53
|
const rpcFlag = (0, args_1.getFlagString)(ctx.args.flags, "rpc-url");
|
|
53
54
|
const signerInput = (0, args_1.getFlagString)(ctx.args.flags, "signer") || "readonly";
|
|
55
|
+
const envFile = (0, args_1.getFlagString)(ctx.args.flags, "env-file");
|
|
54
56
|
const policyName = (0, args_1.getFlagString)(ctx.args.flags, "policy") || "default";
|
|
55
57
|
const skipSignerCheck = (0, args_1.getFlagBoolean)(ctx.args.flags, "skip-signer-check");
|
|
56
58
|
const chain = (0, chains_1.resolveChain)(chainInput);
|
|
57
59
|
const rpcUrl = (0, chains_1.resolveRpcUrl)(chain, rpcFlag);
|
|
58
60
|
const preflight = await (0, rpc_1.runRpcPreflight)(chain, rpcUrl);
|
|
59
61
|
const signer = buildSignerConfig(ctx, signerInput);
|
|
62
|
+
const environment = (0, profile_env_1.applySignerEnvironment)(signer, { envFile });
|
|
60
63
|
let signerSummary = {
|
|
61
64
|
signerType: signer.type,
|
|
62
65
|
backendStatus: "not-checked",
|
|
@@ -74,6 +77,7 @@ async function runBootstrapCommand(ctx) {
|
|
|
74
77
|
chainId: preflight.chainId,
|
|
75
78
|
rpcUrl,
|
|
76
79
|
signer,
|
|
80
|
+
...(envFile ? { envFile } : {}),
|
|
77
81
|
policy: policyName,
|
|
78
82
|
createdAt: existingProfile?.createdAt || now,
|
|
79
83
|
updatedAt: now,
|
|
@@ -101,6 +105,7 @@ async function runBootstrapCommand(ctx) {
|
|
|
101
105
|
chainName: preflight.chainName,
|
|
102
106
|
},
|
|
103
107
|
signer: signerSummary,
|
|
108
|
+
environment,
|
|
104
109
|
configPath,
|
|
105
110
|
};
|
|
106
111
|
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMappedWriteDefaults = getMappedWriteDefaults;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const sources_1 = require("../subgraph/sources");
|
|
6
|
+
const AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)([
|
|
7
|
+
"function addGotchiLending(uint32,uint96,uint32,uint8[3],address,address,uint32,address[],uint256)",
|
|
8
|
+
"function agreeGotchiLending(uint32,uint32,uint96,uint32,uint8[3])",
|
|
9
|
+
"function batchDropClaimXPDrop(bytes32[],address[],uint256[][],bytes32[][],uint256[][],uint256[][])",
|
|
10
|
+
"function batchExecuteERC1155Listing((uint256,address,uint256,uint256,uint256,address)[])",
|
|
11
|
+
"function cancelERC1155Listing(uint256)",
|
|
12
|
+
"function cancelERC721Listing(uint256)",
|
|
13
|
+
"function cancelGotchiLending(uint32)",
|
|
14
|
+
"function claimAavegotchi(uint256,uint256)",
|
|
15
|
+
"function claimAndEndGotchiLending(uint32)",
|
|
16
|
+
"function createWhitelist(string,address[])",
|
|
17
|
+
"function decreaseAndDestroy(uint256,uint256)",
|
|
18
|
+
"function equipDelegatedWearables(uint256,uint16[16],uint256[16])",
|
|
19
|
+
"function openPortals(uint256[])",
|
|
20
|
+
"function spendSkillPoints(uint256,int16[4])",
|
|
21
|
+
"function transferEscrow(uint256,address,address,uint256)",
|
|
22
|
+
"function updateERC1155ListingPriceAndQuantity(uint256,uint256,uint256)",
|
|
23
|
+
"function updateWhitelist(uint32,address[])",
|
|
24
|
+
"function useConsumables(uint256,uint256[],uint256[])",
|
|
25
|
+
]);
|
|
26
|
+
const GBM_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)([
|
|
27
|
+
"function buyNow(uint256)",
|
|
28
|
+
"function cancelAuction(uint256)",
|
|
29
|
+
"function commitBid(uint256,uint256,uint256,address,uint256,uint256,bytes)",
|
|
30
|
+
"function createAuction((uint80,uint80,uint56,uint8,bytes4,uint256,uint96,uint96),address,uint256)",
|
|
31
|
+
"function swapAndBuyNow((address,uint256,uint256,uint256,address,uint256))",
|
|
32
|
+
"function swapAndCommitBid((address,uint256,uint256,uint256,address,uint256,uint256,uint256,address,uint256,uint256,bytes))",
|
|
33
|
+
]);
|
|
34
|
+
const FORGE_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)([
|
|
35
|
+
"function claimForgeQueueItems(uint256[])",
|
|
36
|
+
"function forgeWearables(uint256[],uint256[],uint40[])",
|
|
37
|
+
"function reduceQueueTime(uint256[],uint40[])",
|
|
38
|
+
"function smeltWearables(uint256[],uint256[])",
|
|
39
|
+
]);
|
|
40
|
+
const GLTR_STAKING_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function batchHarvest(uint256[])"]);
|
|
41
|
+
const WRAP_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function enterWithUnderlying(uint256)", "function leaveToUnderlying(uint256)"]);
|
|
42
|
+
const GHST_STAKING_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function withdrawFromPool(address,uint256)"]);
|
|
43
|
+
const SOCKET_VAULT_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function bridge(address,uint256,uint256,address,bytes,bytes)"]);
|
|
44
|
+
const MERKLE_DISTRIBUTOR_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function claim(uint256,bytes32[])"]);
|
|
45
|
+
const GOTCHI_POINTS_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function convertAlchemica(address,uint256,uint256,uint256,uint256)"]);
|
|
46
|
+
const ERC20_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)(["function approve(address,uint256)"]);
|
|
47
|
+
const ERC1155_MAPPED_WRITE_ABI = (0, viem_1.parseAbi)([
|
|
48
|
+
"function safeTransferFrom(address,address,uint256,uint256,bytes)",
|
|
49
|
+
"function setApprovalForAll(address,bool)",
|
|
50
|
+
]);
|
|
51
|
+
const MAPPED_WRITE_DEFAULTS = {
|
|
52
|
+
"lending create": {
|
|
53
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
54
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
55
|
+
source: "base.aavegotchi-diamond",
|
|
56
|
+
},
|
|
57
|
+
"lending agree": {
|
|
58
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
59
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
60
|
+
source: "base.aavegotchi-diamond",
|
|
61
|
+
},
|
|
62
|
+
"token approve": {
|
|
63
|
+
abi: ERC20_MAPPED_WRITE_ABI,
|
|
64
|
+
source: "canonical.erc20",
|
|
65
|
+
},
|
|
66
|
+
"gotchi xp claim-batch": {
|
|
67
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
68
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
69
|
+
source: "base.aavegotchi-diamond",
|
|
70
|
+
},
|
|
71
|
+
"baazaar listing batch-execute": {
|
|
72
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
73
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
74
|
+
source: "base.aavegotchi-diamond",
|
|
75
|
+
},
|
|
76
|
+
"realm harvest batch": {
|
|
77
|
+
address: sources_1.BASE_GLTR_STAKING,
|
|
78
|
+
abi: GLTR_STAKING_MAPPED_WRITE_ABI,
|
|
79
|
+
source: "base.gltr-staking",
|
|
80
|
+
},
|
|
81
|
+
"token bridge": {
|
|
82
|
+
abi: SOCKET_VAULT_MAPPED_WRITE_ABI,
|
|
83
|
+
source: "canonical.socket-vault",
|
|
84
|
+
},
|
|
85
|
+
"baazaar buy-now": {
|
|
86
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
87
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
88
|
+
source: "base.gbm-diamond",
|
|
89
|
+
},
|
|
90
|
+
"auction buy-now": {
|
|
91
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
92
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
93
|
+
source: "base.gbm-diamond",
|
|
94
|
+
},
|
|
95
|
+
"auction cancel": {
|
|
96
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
97
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
98
|
+
source: "base.gbm-diamond",
|
|
99
|
+
},
|
|
100
|
+
"baazaar cancel-erc1155": {
|
|
101
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
102
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
103
|
+
source: "base.aavegotchi-diamond",
|
|
104
|
+
},
|
|
105
|
+
"baazaar cancel-erc721": {
|
|
106
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
107
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
108
|
+
source: "base.aavegotchi-diamond",
|
|
109
|
+
},
|
|
110
|
+
"lending cancel": {
|
|
111
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
112
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
113
|
+
source: "base.aavegotchi-diamond",
|
|
114
|
+
},
|
|
115
|
+
"forge claim": {
|
|
116
|
+
address: sources_1.BASE_MERKLE_DISTRIBUTOR,
|
|
117
|
+
abi: MERKLE_DISTRIBUTOR_MAPPED_WRITE_ABI,
|
|
118
|
+
source: "base.merkle-distributor",
|
|
119
|
+
},
|
|
120
|
+
"portal claim": {
|
|
121
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
122
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
123
|
+
source: "base.aavegotchi-diamond",
|
|
124
|
+
},
|
|
125
|
+
"lending claim-end": {
|
|
126
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
127
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
128
|
+
source: "base.aavegotchi-diamond",
|
|
129
|
+
},
|
|
130
|
+
"forge queue claim": {
|
|
131
|
+
address: sources_1.BASE_FORGE_DIAMOND,
|
|
132
|
+
abi: FORGE_MAPPED_WRITE_ABI,
|
|
133
|
+
source: "base.forge-diamond",
|
|
134
|
+
},
|
|
135
|
+
"auction bid": {
|
|
136
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
137
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
138
|
+
source: "base.gbm-diamond",
|
|
139
|
+
},
|
|
140
|
+
"gotchi-points convert-alchemica": {
|
|
141
|
+
abi: GOTCHI_POINTS_MAPPED_WRITE_ABI,
|
|
142
|
+
source: "canonical.gotchi-points",
|
|
143
|
+
},
|
|
144
|
+
"auction create": {
|
|
145
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
146
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
147
|
+
source: "base.gbm-diamond",
|
|
148
|
+
},
|
|
149
|
+
"lending whitelist create": {
|
|
150
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
151
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
152
|
+
source: "base.aavegotchi-diamond",
|
|
153
|
+
},
|
|
154
|
+
"staking unstake-destroy": {
|
|
155
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
156
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
157
|
+
source: "base.aavegotchi-diamond",
|
|
158
|
+
},
|
|
159
|
+
"staking enter-underlying": {
|
|
160
|
+
abi: WRAP_MAPPED_WRITE_ABI,
|
|
161
|
+
source: "canonical.wrap",
|
|
162
|
+
},
|
|
163
|
+
"gotchi equip-delegated": {
|
|
164
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
165
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
166
|
+
source: "base.aavegotchi-diamond",
|
|
167
|
+
},
|
|
168
|
+
"forge craft": {
|
|
169
|
+
address: sources_1.BASE_FORGE_DIAMOND,
|
|
170
|
+
abi: FORGE_MAPPED_WRITE_ABI,
|
|
171
|
+
source: "base.forge-diamond",
|
|
172
|
+
},
|
|
173
|
+
"staking leave-underlying": {
|
|
174
|
+
abi: WRAP_MAPPED_WRITE_ABI,
|
|
175
|
+
source: "canonical.wrap",
|
|
176
|
+
},
|
|
177
|
+
"portal open": {
|
|
178
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
179
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
180
|
+
source: "base.aavegotchi-diamond",
|
|
181
|
+
},
|
|
182
|
+
"forge speedup": {
|
|
183
|
+
address: sources_1.BASE_FORGE_DIAMOND,
|
|
184
|
+
abi: FORGE_MAPPED_WRITE_ABI,
|
|
185
|
+
source: "base.forge-diamond",
|
|
186
|
+
},
|
|
187
|
+
"inventory transfer": {
|
|
188
|
+
abi: ERC1155_MAPPED_WRITE_ABI,
|
|
189
|
+
source: "canonical.erc1155",
|
|
190
|
+
},
|
|
191
|
+
"token set-approval-for-all": {
|
|
192
|
+
abi: ERC1155_MAPPED_WRITE_ABI,
|
|
193
|
+
source: "canonical.erc1155",
|
|
194
|
+
},
|
|
195
|
+
"forge smelt": {
|
|
196
|
+
address: sources_1.BASE_FORGE_DIAMOND,
|
|
197
|
+
abi: FORGE_MAPPED_WRITE_ABI,
|
|
198
|
+
source: "base.forge-diamond",
|
|
199
|
+
},
|
|
200
|
+
"gotchi spend-skill-points": {
|
|
201
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
202
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
203
|
+
source: "base.aavegotchi-diamond",
|
|
204
|
+
},
|
|
205
|
+
"baazaar swap-buy-now": {
|
|
206
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
207
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
208
|
+
source: "base.gbm-diamond",
|
|
209
|
+
},
|
|
210
|
+
"auction swap-bid": {
|
|
211
|
+
address: sources_1.BASE_GBM_DIAMOND,
|
|
212
|
+
abi: GBM_MAPPED_WRITE_ABI,
|
|
213
|
+
source: "base.gbm-diamond",
|
|
214
|
+
},
|
|
215
|
+
"lending transfer-escrow": {
|
|
216
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
217
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
218
|
+
source: "base.aavegotchi-diamond",
|
|
219
|
+
},
|
|
220
|
+
"baazaar update-erc1155": {
|
|
221
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
222
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
223
|
+
source: "base.aavegotchi-diamond",
|
|
224
|
+
},
|
|
225
|
+
"lending whitelist update": {
|
|
226
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
227
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
228
|
+
source: "base.aavegotchi-diamond",
|
|
229
|
+
},
|
|
230
|
+
"gotchi feed": {
|
|
231
|
+
address: sources_1.BASE_AAVEGOTCHI_DIAMOND,
|
|
232
|
+
abi: AAVEGOTCHI_DIAMOND_MAPPED_WRITE_ABI,
|
|
233
|
+
source: "base.aavegotchi-diamond",
|
|
234
|
+
},
|
|
235
|
+
"staking withdraw-pool": {
|
|
236
|
+
abi: GHST_STAKING_MAPPED_WRITE_ABI,
|
|
237
|
+
source: "canonical.ghst-staking",
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
function getMappedWriteDefaults(commandPath) {
|
|
241
|
+
return MAPPED_WRITE_DEFAULTS[commandPath.join(" ")];
|
|
242
|
+
}
|
package/dist/commands/mapped.js
CHANGED
|
@@ -6,6 +6,7 @@ exports.listMappedCommandsForRoot = listMappedCommandsForRoot;
|
|
|
6
6
|
exports.getMappedCommandEntries = getMappedCommandEntries;
|
|
7
7
|
exports.runMappedDomainCommand = runMappedDomainCommand;
|
|
8
8
|
const errors_1 = require("../errors");
|
|
9
|
+
const mapped_defaults_1 = require("./mapped-defaults");
|
|
9
10
|
const onchain_1 = require("./onchain");
|
|
10
11
|
const MAPPED_WRITE_COMMANDS = {
|
|
11
12
|
"lending create": "addGotchiLending",
|
|
@@ -71,9 +72,21 @@ async function runMappedDomainCommand(ctx) {
|
|
|
71
72
|
availableForRoot: candidates,
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
+
const defaults = (0, mapped_defaults_1.getMappedWriteDefaults)(ctx.commandPath);
|
|
76
|
+
const result = await (0, onchain_1.runOnchainSendWithFunction)(ctx, method, key, {
|
|
77
|
+
abi: defaults?.abi,
|
|
78
|
+
address: defaults?.address,
|
|
79
|
+
source: defaults?.source,
|
|
80
|
+
});
|
|
75
81
|
return {
|
|
76
82
|
mappedMethod: method,
|
|
83
|
+
defaults: defaults
|
|
84
|
+
? {
|
|
85
|
+
source: defaults.source,
|
|
86
|
+
address: defaults.address || null,
|
|
87
|
+
abi: defaults.abi ? "available" : "none",
|
|
88
|
+
}
|
|
89
|
+
: null,
|
|
77
90
|
result,
|
|
78
91
|
};
|
|
79
92
|
}
|
package/dist/commands/onchain.js
CHANGED
|
@@ -9,6 +9,7 @@ const abi_1 = require("../abi");
|
|
|
9
9
|
const chains_1 = require("../chains");
|
|
10
10
|
const config_1 = require("../config");
|
|
11
11
|
const errors_1 = require("../errors");
|
|
12
|
+
const profile_env_1 = require("../profile-env");
|
|
12
13
|
const rpc_1 = require("../rpc");
|
|
13
14
|
const tx_engine_1 = require("../tx-engine");
|
|
14
15
|
function requireFlag(value, name) {
|
|
@@ -102,16 +103,38 @@ async function runOnchainCallCommand(ctx) {
|
|
|
102
103
|
result: decoded,
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
async function runOnchainSendWithFunction(ctx, forcedFunctionName, commandOverride) {
|
|
106
|
+
async function runOnchainSendWithFunction(ctx, forcedFunctionName, commandOverride, defaults) {
|
|
106
107
|
const config = (0, config_1.loadConfig)();
|
|
107
108
|
const profileName = (0, args_1.getFlagString)(ctx.args.flags, "profile") || ctx.globals.profile;
|
|
108
109
|
const profile = (0, config_1.getProfileOrThrow)(config, profileName);
|
|
109
110
|
const policy = (0, config_1.getPolicyOrThrow)(config, profile.policy);
|
|
111
|
+
const environment = (0, profile_env_1.applyProfileEnvironment)(profile);
|
|
110
112
|
const chain = (0, chains_1.resolveChain)(profile.chain);
|
|
111
113
|
const rpcUrl = (0, chains_1.resolveRpcUrl)(chain, (0, args_1.getFlagString)(ctx.args.flags, "rpc-url") || profile.rpcUrl);
|
|
112
|
-
const abiFile =
|
|
113
|
-
const abi =
|
|
114
|
-
|
|
114
|
+
const abiFile = (0, args_1.getFlagString)(ctx.args.flags, "abi-file");
|
|
115
|
+
const abi = abiFile
|
|
116
|
+
? (0, abi_1.parseAbiFile)(abiFile)
|
|
117
|
+
: defaults?.abi ||
|
|
118
|
+
(() => {
|
|
119
|
+
throw new errors_1.CliError("MISSING_ARGUMENT", "--abi-file is required.", 2, {
|
|
120
|
+
command: commandOverride || ctx.commandPath.join(" "),
|
|
121
|
+
hint: forcedFunctionName
|
|
122
|
+
? "This mapped command has no built-in ABI metadata yet. Provide --abi-file."
|
|
123
|
+
: "Provide --abi-file <path>.",
|
|
124
|
+
});
|
|
125
|
+
})();
|
|
126
|
+
const addressInput = (0, args_1.getFlagString)(ctx.args.flags, "address");
|
|
127
|
+
const address = addressInput
|
|
128
|
+
? parseAddress(addressInput, "--address")
|
|
129
|
+
: defaults?.address ||
|
|
130
|
+
(() => {
|
|
131
|
+
throw new errors_1.CliError("MISSING_ARGUMENT", "--address is required.", 2, {
|
|
132
|
+
command: commandOverride || ctx.commandPath.join(" "),
|
|
133
|
+
hint: forcedFunctionName
|
|
134
|
+
? "This mapped command has no built-in contract address yet. Provide --address."
|
|
135
|
+
: "Provide --address <0x...>.",
|
|
136
|
+
});
|
|
137
|
+
})();
|
|
115
138
|
const functionName = forcedFunctionName || requireFlag((0, args_1.getFlagString)(ctx.args.flags, "function"), "--function");
|
|
116
139
|
const args = parseArgsJson((0, args_1.getFlagString)(ctx.args.flags, "args-json"));
|
|
117
140
|
const valueWei = parseValueWei((0, args_1.getFlagString)(ctx.args.flags, "value-wei"));
|
|
@@ -160,6 +183,12 @@ async function runOnchainSendWithFunction(ctx, forcedFunctionName, commandOverri
|
|
|
160
183
|
address,
|
|
161
184
|
functionName,
|
|
162
185
|
args,
|
|
186
|
+
defaults: {
|
|
187
|
+
abi: abiFile ? "flag" : defaults?.abi ? "mapped-default" : "none",
|
|
188
|
+
address: addressInput ? "flag" : defaults?.address ? "mapped-default" : "none",
|
|
189
|
+
source: defaults?.source || null,
|
|
190
|
+
},
|
|
191
|
+
environment,
|
|
163
192
|
result,
|
|
164
193
|
};
|
|
165
194
|
}
|
package/dist/commands/profile.js
CHANGED
package/dist/commands/signer.js
CHANGED
|
@@ -9,12 +9,14 @@ const chains_1 = require("../chains");
|
|
|
9
9
|
const config_1 = require("../config");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
11
|
const keychain_1 = require("../keychain");
|
|
12
|
+
const profile_env_1 = require("../profile-env");
|
|
12
13
|
const rpc_1 = require("../rpc");
|
|
13
14
|
const signer_1 = require("../signer");
|
|
14
15
|
async function runSignerCheckCommand(ctx) {
|
|
15
16
|
const config = (0, config_1.loadConfig)();
|
|
16
17
|
const profileName = (0, args_1.getFlagString)(ctx.args.flags, "profile") || ctx.globals.profile;
|
|
17
18
|
const profile = (0, config_1.getProfileOrThrow)(config, profileName);
|
|
19
|
+
const environment = (0, profile_env_1.applyProfileEnvironment)(profile);
|
|
18
20
|
const chain = (0, chains_1.resolveChain)(profile.chain);
|
|
19
21
|
const rpcUrl = (0, chains_1.resolveRpcUrl)(chain, (0, args_1.getFlagString)(ctx.args.flags, "rpc-url") || profile.rpcUrl);
|
|
20
22
|
const preflight = await (0, rpc_1.runRpcPreflight)(chain, rpcUrl);
|
|
@@ -22,6 +24,7 @@ async function runSignerCheckCommand(ctx) {
|
|
|
22
24
|
return {
|
|
23
25
|
profile: profile.name,
|
|
24
26
|
chainId: chain.chainId,
|
|
27
|
+
environment,
|
|
25
28
|
signer: runtime.summary,
|
|
26
29
|
};
|
|
27
30
|
}
|
package/dist/commands/tx.js
CHANGED
|
@@ -8,6 +8,7 @@ const args_1 = require("../args");
|
|
|
8
8
|
const chains_1 = require("../chains");
|
|
9
9
|
const config_1 = require("../config");
|
|
10
10
|
const errors_1 = require("../errors");
|
|
11
|
+
const profile_env_1 = require("../profile-env");
|
|
11
12
|
const tx_engine_1 = require("../tx-engine");
|
|
12
13
|
function parseNoncePolicy(value) {
|
|
13
14
|
if (!value) {
|
|
@@ -65,6 +66,7 @@ async function runTxSendCommand(ctx) {
|
|
|
65
66
|
const requestedProfile = (0, args_1.getFlagString)(ctx.args.flags, "profile") || ctx.globals.profile;
|
|
66
67
|
const profile = (0, config_1.getProfileOrThrow)(config, requestedProfile);
|
|
67
68
|
const policy = (0, config_1.getPolicyOrThrow)(config, profile.policy);
|
|
69
|
+
const environment = (0, profile_env_1.applyProfileEnvironment)(profile);
|
|
68
70
|
const chain = (0, chains_1.resolveChain)(profile.chain);
|
|
69
71
|
const rpcUrl = (0, chains_1.resolveRpcUrl)(chain, (0, args_1.getFlagString)(ctx.args.flags, "rpc-url") || profile.rpcUrl);
|
|
70
72
|
const to = requireHexAddress((0, args_1.getFlagString)(ctx.args.flags, "to"), "--to");
|
|
@@ -105,6 +107,7 @@ async function runTxSendCommand(ctx) {
|
|
|
105
107
|
profile: profile.name,
|
|
106
108
|
policy: policy.name,
|
|
107
109
|
chainId: chain.chainId,
|
|
110
|
+
environment,
|
|
108
111
|
...result,
|
|
109
112
|
};
|
|
110
113
|
}
|
package/dist/output.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.outputHelp = outputHelp;
|
|
|
7
7
|
const args_1 = require("./args");
|
|
8
8
|
const abi_1 = require("./abi");
|
|
9
9
|
const command_catalog_1 = require("./command-catalog");
|
|
10
|
+
const mapped_defaults_1 = require("./commands/mapped-defaults");
|
|
10
11
|
const mapped_1 = require("./commands/mapped");
|
|
11
12
|
const stubs_1 = require("./commands/stubs");
|
|
12
13
|
function stringifyWithBigInt(input) {
|
|
@@ -59,6 +60,7 @@ Power-user commands:
|
|
|
59
60
|
Subgraph wrappers:
|
|
60
61
|
baazaar listing get|active|mine
|
|
61
62
|
auction get|active|mine|bids|bids-mine
|
|
63
|
+
auction bid|bid-unbid
|
|
62
64
|
|
|
63
65
|
Domain namespaces:
|
|
64
66
|
gotchi, portal, wearables, items, inventory, baazaar, auction, lending, staking, gotchi-points, realm, alchemica, forge, token
|
|
@@ -83,7 +85,7 @@ Examples:
|
|
|
83
85
|
const STATIC_HELP = {
|
|
84
86
|
bootstrap: `
|
|
85
87
|
Usage:
|
|
86
|
-
ag bootstrap --profile <name> [--chain <base|base-sepolia|id>] [--rpc-url <url>] [--signer <config>] [--policy <name>] [--skip-signer-check] [--json]
|
|
88
|
+
ag bootstrap --profile <name> [--chain <base|base-sepolia|id>] [--rpc-url <url>] [--signer <config>] [--env-file <path>] [--policy <name>] [--skip-signer-check] [--json]
|
|
87
89
|
|
|
88
90
|
Required:
|
|
89
91
|
--profile <name>
|
|
@@ -280,6 +282,8 @@ Usage:
|
|
|
280
282
|
ag auction mine --seller <0x...> [--first <n>] [--skip <n>] [--at-time <unixSec>] [--json]
|
|
281
283
|
ag auction bids --auction-id <auctionId> [--first <n>] [--skip <n>] [--json]
|
|
282
284
|
ag auction bids-mine --bidder <0x...> [--first <n>] [--skip <n>] [--json]
|
|
285
|
+
ag auction bid --auction-id <auctionId> --amount-ghst <amount> [--dry-run] [--auto-approve] [--json]
|
|
286
|
+
ag auction bid-unbid --amount-ghst <amount> --max-total-ghst <amount> [--dry-run] [--auto-approve] [--json]
|
|
283
287
|
ag auction <mapped-write> --help
|
|
284
288
|
`,
|
|
285
289
|
"auction get": `
|
|
@@ -301,6 +305,24 @@ Usage:
|
|
|
301
305
|
"auction bids-mine": `
|
|
302
306
|
Usage:
|
|
303
307
|
ag auction bids-mine --bidder <0x...> [--first <n>] [--skip <n>] [--json]
|
|
308
|
+
`,
|
|
309
|
+
"auction bid": `
|
|
310
|
+
Usage:
|
|
311
|
+
ag auction bid --auction-id <auctionId> (--amount-ghst <amount> | --amount-wei <wei>) [--require-unbid] [--expected-highest-bid-ghst <amount> | --expected-highest-bid-wei <wei>] [--auto-approve] [--auto-approve-max-ghst <amount> | --auto-approve-max-wei <wei>] [--nonce-policy <safe|replace|manual>] [--nonce <n>] [--dry-run] [--wait] [--timeout-ms <ms>] [--idempotency-key <key>] [--json]
|
|
312
|
+
|
|
313
|
+
Notes:
|
|
314
|
+
- Resolves GBM diamond + ABI internally (no manual ABI/address flags).
|
|
315
|
+
- Runs preflight checks (auction state, min bid, GHST balance, GHST allowance).
|
|
316
|
+
- Rechecks auction state immediately before submit to prevent stale-state sends.
|
|
317
|
+
- --dry-run with --auto-approve simulates approval and skips bid simulation because allowance state is unchanged on-chain.
|
|
318
|
+
`,
|
|
319
|
+
"auction bid-unbid": `
|
|
320
|
+
Usage:
|
|
321
|
+
ag auction bid-unbid (--amount-ghst <amount> | --amount-wei <wei>) (--max-total-ghst <amount> | --max-total-wei <wei>) [--first <n>] [--skip <n>] [--auto-approve] [--dry-run] [--wait] [--timeout-ms <ms>] [--idempotency-key <key>] [--json]
|
|
322
|
+
|
|
323
|
+
Behavior:
|
|
324
|
+
- Scans active auctions, selects unbid auctions, and skips those above your target amount.
|
|
325
|
+
- Emits per-auction status plus clear skip reasons in one JSON report.
|
|
304
326
|
`,
|
|
305
327
|
};
|
|
306
328
|
function buildDomainRootHelp(root) {
|
|
@@ -320,6 +342,7 @@ function buildMappedCommandHelp(commandPath, flags) {
|
|
|
320
342
|
if (!method) {
|
|
321
343
|
return "";
|
|
322
344
|
}
|
|
345
|
+
const defaults = (0, mapped_defaults_1.getMappedWriteDefaults)(commandPath);
|
|
323
346
|
const abiFile = (0, args_1.getFlagString)(flags, "abi-file");
|
|
324
347
|
const signatureLines = [];
|
|
325
348
|
const inputLines = [];
|
|
@@ -342,24 +365,76 @@ function buildMappedCommandHelp(commandPath, flags) {
|
|
|
342
365
|
signatureLines.push(`Could not inspect ABI file '${abiFile}': ${message}`);
|
|
343
366
|
}
|
|
344
367
|
}
|
|
368
|
+
else if (defaults?.abi) {
|
|
369
|
+
const entries = (0, abi_1.getAbiFunctionEntries)(defaults.abi, method);
|
|
370
|
+
if (entries.length === 0) {
|
|
371
|
+
signatureLines.push("Built-in ABI defaults are available, but no matching function entry was found.");
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
for (const entry of entries) {
|
|
375
|
+
signatureLines.push((0, abi_1.formatAbiFunctionSignature)(entry));
|
|
376
|
+
inputLines.push(...(0, abi_1.formatAbiFunctionInputs)(entry));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
345
380
|
else {
|
|
346
381
|
signatureLines.push("Pass --abi-file <path> with --help to print exact ABI-derived signature and input names.");
|
|
347
382
|
}
|
|
383
|
+
const requiredFlags = ["--args-json", "--profile (or active profile)"];
|
|
384
|
+
const optionalOverrides = [];
|
|
385
|
+
if (!defaults?.abi) {
|
|
386
|
+
requiredFlags.unshift("--abi-file");
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
optionalOverrides.push("--abi-file (override built-in ABI)");
|
|
390
|
+
}
|
|
391
|
+
if (!defaults?.address) {
|
|
392
|
+
requiredFlags.unshift("--address");
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
optionalOverrides.push("--address (override default)");
|
|
396
|
+
}
|
|
397
|
+
const usageParts = [`ag ${command}`, "--profile <name>"];
|
|
398
|
+
if (!defaults?.abi) {
|
|
399
|
+
usageParts.push("--abi-file <path>");
|
|
400
|
+
}
|
|
401
|
+
if (!defaults?.address) {
|
|
402
|
+
usageParts.push("--address <0x...>");
|
|
403
|
+
}
|
|
404
|
+
usageParts.push("--args-json '[...]'", "[--value-wei <wei>]", "[--nonce-policy <safe|replace|manual>]", "[--nonce <n>]", "[--dry-run]", "[--wait]", "[--json]");
|
|
405
|
+
const usage = ` ${usageParts.join(" ")}`;
|
|
406
|
+
const defaultLines = [
|
|
407
|
+
defaults?.address ? `address: ${defaults.address}` : "address: none",
|
|
408
|
+
defaults?.abi ? "abi: available" : "abi: none",
|
|
409
|
+
`source: ${defaults?.source || "none"}`,
|
|
410
|
+
];
|
|
411
|
+
const dryRunParts = [`ag ${command}`, "--profile prod"];
|
|
412
|
+
if (!defaults?.abi) {
|
|
413
|
+
dryRunParts.push("--abi-file ./abi.json");
|
|
414
|
+
}
|
|
415
|
+
if (!defaults?.address) {
|
|
416
|
+
dryRunParts.push("--address 0xabc...");
|
|
417
|
+
}
|
|
418
|
+
dryRunParts.push("--args-json '[<arg0>,<arg1>]'", "--dry-run", "--json");
|
|
419
|
+
const dryRunExample = ` ${dryRunParts.join(" ")}`;
|
|
348
420
|
return `
|
|
349
421
|
Usage:
|
|
350
|
-
|
|
422
|
+
${usage}
|
|
351
423
|
|
|
352
424
|
Mapped to onchain function:
|
|
353
425
|
${method}
|
|
354
426
|
|
|
355
427
|
Required flags:
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
428
|
+
${toLines(requiredFlags)}
|
|
429
|
+
|
|
430
|
+
Mapped defaults:
|
|
431
|
+
${toLines(defaultLines)}
|
|
432
|
+
|
|
433
|
+
Optional overrides:
|
|
434
|
+
${toLines(optionalOverrides)}
|
|
360
435
|
|
|
361
436
|
Dry-run example:
|
|
362
|
-
|
|
437
|
+
${dryRunExample}
|
|
363
438
|
|
|
364
439
|
ABI signature info:
|
|
365
440
|
${toLines(signatureLines)}
|
|
@@ -387,14 +462,14 @@ function buildHelpText(commandPath = [], flags = {}) {
|
|
|
387
462
|
if (target.length === 0) {
|
|
388
463
|
return buildGlobalHelpText().trim();
|
|
389
464
|
}
|
|
390
|
-
const mappedHelp = buildMappedCommandHelp(target, flags);
|
|
391
|
-
if (mappedHelp) {
|
|
392
|
-
return mappedHelp.trim();
|
|
393
|
-
}
|
|
394
465
|
const key = target.join(" ");
|
|
395
466
|
if (STATIC_HELP[key]) {
|
|
396
467
|
return STATIC_HELP[key].trim();
|
|
397
468
|
}
|
|
469
|
+
const mappedHelp = buildMappedCommandHelp(target, flags);
|
|
470
|
+
if (mappedHelp) {
|
|
471
|
+
return mappedHelp.trim();
|
|
472
|
+
}
|
|
398
473
|
if (target.length === 1 && (0, stubs_1.isDomainStubRoot)(target[0])) {
|
|
399
474
|
return buildDomainRootHelp(target[0]).trim();
|
|
400
475
|
}
|