@sage-protocol/cli 0.8.3 → 0.8.4
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/dist/cli/commands/doctor.js +27 -20
- package/package.json +1 -1
|
@@ -48,9 +48,9 @@ async function runDoctor(opts = {}) {
|
|
|
48
48
|
const rpcUrl = process.env.RPC_URL || 'http://127.0.0.1:8545';
|
|
49
49
|
const chainId = Number(process.env.CHAIN_ID || 84532);
|
|
50
50
|
const addresses = {
|
|
51
|
-
SXXX_TOKEN_ADDRESS: config.resolveAddress('SXXX_TOKEN_ADDRESS')
|
|
52
|
-
LIBRARY_REGISTRY_ADDRESS: config.resolveAddress('LIBRARY_REGISTRY_ADDRESS')
|
|
53
|
-
SUBDAO_FACTORY_ADDRESS: config.resolveAddress('SUBDAO_FACTORY_ADDRESS')
|
|
51
|
+
SXXX_TOKEN_ADDRESS: config.resolveAddress('SXXX_TOKEN_ADDRESS'),
|
|
52
|
+
LIBRARY_REGISTRY_ADDRESS: config.resolveAddress('LIBRARY_REGISTRY_ADDRESS'),
|
|
53
|
+
SUBDAO_FACTORY_ADDRESS: config.resolveAddress('SUBDAO_FACTORY_ADDRESS'),
|
|
54
54
|
};
|
|
55
55
|
ui.info('Sage Doctor Report (test mode)');
|
|
56
56
|
ui.keyValue({ 'RPC': rpcUrl, 'chainId': chainId });
|
|
@@ -257,6 +257,7 @@ async function runDoctor(opts = {}) {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
// 4) Required addresses (config prerequisites)
|
|
260
|
+
// Uses config.resolveAddress() to check profile, env, AND chain defaults
|
|
260
261
|
out.push(c.cyan('⚙️ Config prerequisites'));
|
|
261
262
|
const requiredAddrs = [
|
|
262
263
|
{ key: 'SXXX_TOKEN_ADDRESS', label: 'SXXX token', cliFlag: '--sxxx' },
|
|
@@ -265,9 +266,11 @@ async function runDoctor(opts = {}) {
|
|
|
265
266
|
];
|
|
266
267
|
for (const entry of requiredAddrs) {
|
|
267
268
|
const k = entry.key;
|
|
268
|
-
const v =
|
|
269
|
+
const v = config.resolveAddress(k);
|
|
270
|
+
const isDefault = v && !process.env[k];
|
|
269
271
|
if (v) {
|
|
270
|
-
|
|
272
|
+
const suffix = isDefault ? ' (default)' : '';
|
|
273
|
+
out.push(`✅ ${k}: ${v}${suffix}`);
|
|
271
274
|
} else {
|
|
272
275
|
out.push(`❌ ${k} (missing)`);
|
|
273
276
|
const cliHint = entry.cliFlag ? ` or use "sage config addresses set ${entry.cliFlag} <0x...>"` : '';
|
|
@@ -283,15 +286,18 @@ async function runDoctor(opts = {}) {
|
|
|
283
286
|
}
|
|
284
287
|
|
|
285
288
|
// Optional feature addresses (warn-level): Bounty system, Boost managers, etc.
|
|
289
|
+
// Uses config.resolveAddress() to check profile, env, AND chain defaults
|
|
286
290
|
const featureAddrs = [
|
|
287
291
|
{ key: 'SIMPLE_BOUNTY_SYSTEM_ADDRESS', feature: 'bounty', hint: 'Required for `sage bounty *` commands.' },
|
|
288
292
|
{ key: 'BOOST_MANAGER_ADDRESS', feature: 'boost (merkle)', hint: 'Required for `sage boost fund/status/claim` (Merkle manager).' },
|
|
289
293
|
{ key: 'BOOST_MANAGER_DIRECT_ADDRESS', feature: 'boost (direct)', hint: 'Required for `sage boost create/status/finalize` (direct manager).' }
|
|
290
294
|
];
|
|
291
295
|
for (const entry of featureAddrs) {
|
|
292
|
-
const v =
|
|
296
|
+
const v = config.resolveAddress(entry.key);
|
|
297
|
+
const isDefault = v && !process.env[entry.key];
|
|
293
298
|
if (v) {
|
|
294
|
-
|
|
299
|
+
const suffix = isDefault ? ' (default)' : '';
|
|
300
|
+
out.push(`✅ ${entry.key}: ${v}${suffix}`);
|
|
295
301
|
} else {
|
|
296
302
|
out.push(`ℹ️ ${entry.key} (missing; ${entry.feature} commands will be unavailable)`);
|
|
297
303
|
diagnostics.push({
|
|
@@ -861,24 +867,25 @@ function register(program) {
|
|
|
861
867
|
|
|
862
868
|
if (opts.json) {
|
|
863
869
|
// Build JSON object with key facts
|
|
864
|
-
|
|
865
|
-
|
|
870
|
+
// Use config.resolve* to include chain defaults, not just env vars
|
|
871
|
+
const rpcUrl = config.resolveRpcUrl();
|
|
872
|
+
const chainId = config.resolveChainId();
|
|
866
873
|
const sageHome = _resolveSageHome();
|
|
867
874
|
const out = {
|
|
868
875
|
rpcUrl,
|
|
869
876
|
chainId,
|
|
870
877
|
addresses: {
|
|
871
|
-
SXXX_TOKEN_ADDRESS:
|
|
872
|
-
LIBRARY_REGISTRY_ADDRESS:
|
|
873
|
-
SUBDAO_FACTORY_ADDRESS:
|
|
874
|
-
SIMPLE_BOUNTY_SYSTEM_ADDRESS:
|
|
875
|
-
BOOST_MANAGER_ADDRESS:
|
|
876
|
-
BOOST_MANAGER_DIRECT_ADDRESS:
|
|
877
|
-
PERSONAL_MARKETPLACE_ADDRESS:
|
|
878
|
-
PERSONAL_LICENSE_RECEIPT_ADDRESS:
|
|
879
|
-
SUBDAO:
|
|
880
|
-
GOV:
|
|
881
|
-
TIMELOCK:
|
|
878
|
+
SXXX_TOKEN_ADDRESS: config.resolveAddress('SXXX_TOKEN_ADDRESS'),
|
|
879
|
+
LIBRARY_REGISTRY_ADDRESS: config.resolveAddress('LIBRARY_REGISTRY_ADDRESS'),
|
|
880
|
+
SUBDAO_FACTORY_ADDRESS: config.resolveAddress('SUBDAO_FACTORY_ADDRESS'),
|
|
881
|
+
SIMPLE_BOUNTY_SYSTEM_ADDRESS: config.resolveAddress('SIMPLE_BOUNTY_SYSTEM_ADDRESS'),
|
|
882
|
+
BOOST_MANAGER_ADDRESS: config.resolveAddress('BOOST_MANAGER_ADDRESS'),
|
|
883
|
+
BOOST_MANAGER_DIRECT_ADDRESS: config.resolveAddress('BOOST_MANAGER_DIRECT_ADDRESS'),
|
|
884
|
+
PERSONAL_MARKETPLACE_ADDRESS: config.resolveAddress('PERSONAL_MARKETPLACE_ADDRESS'),
|
|
885
|
+
PERSONAL_LICENSE_RECEIPT_ADDRESS: config.resolveAddress('PERSONAL_LICENSE_RECEIPT_ADDRESS'),
|
|
886
|
+
SUBDAO: config.resolveAddress('SUBDAO'),
|
|
887
|
+
GOV: config.resolveAddress('GOV'),
|
|
888
|
+
TIMELOCK: config.resolveAddress('TIMELOCK'),
|
|
882
889
|
SAFE_TX_SERVICE_URL: process.env.SAFE_TX_SERVICE_URL || null,
|
|
883
890
|
SAGE_USE_SAFE_TX_SERVICE: process.env.SAGE_USE_SAFE_TX_SERVICE || null
|
|
884
891
|
},
|