Skip to content

Commit 02cef95

Browse files
committed
cli: print pdas in status --verbose (solana)
1 parent 95246d4 commit 02cef95

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

cli/src/index.ts

+38-5
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ yargs(hideBin(process.argv))
635635

636636
let errors = 0;
637637

638+
const extraInfo: any = {};
639+
638640
// diff remote and local configs
639641
for (const [chain, deployment] of Object.entries(deps)) {
640642
assertChain(chain);
@@ -652,11 +654,19 @@ yargs(hideBin(process.argv))
652654
if (verbose) {
653655
const immutables = await getImmutables(chain, deployment.ntt);
654656
if (immutables) {
655-
console.log(JSON.stringify({ [chain]: immutables }, null, 2))
657+
extraInfo[chain] = immutables;
658+
}
659+
const pdas = await getPdas(chain, deployment.ntt);
660+
if (pdas) {
661+
extraInfo[chain] = pdas;
656662
}
657663
}
658664
}
659665

666+
if (extraInfo) {
667+
console.log(chalk.yellow(JSON.stringify(extraInfo, null, 2)));
668+
}
669+
660670
// verify peers
661671
const missing = await missingConfigs(deps, verbose);
662672

@@ -1175,9 +1185,9 @@ async function missingConfigs(
11751185
continue;
11761186
}
11771187
if (verbose) {
1178-
process.stdout.write(`Verifying registration for ${fromChain} -> ${toChain}\r`);
1188+
process.stdout.write(`Verifying registration for ${fromChain} -> ${toChain}......\r`);
11791189
}
1180-
const peer = await from.ntt.getPeer(toChain);
1190+
const peer = await retryWithExponentialBackoff(() => from.ntt.getPeer(toChain), 5, 5000);
11811191
if (peer === null) {
11821192
const configLimit = from.config.local?.limits?.inbound?.[toChain]?.replace(".", "");
11831193
count++;
@@ -1310,7 +1320,7 @@ async function pullDeployments(deployments: Config, network: Network, verbose: b
13101320

13111321
for (const [chain, deployment] of Object.entries(deployments.chains)) {
13121322
if (verbose) {
1313-
process.stdout.write(`Fetching config for ${chain}\r`);
1323+
process.stdout.write(`Fetching config for ${chain}......\r`);
13141324
}
13151325
assertChain(chain);
13161326
const managerAddress: string | undefined = deployment.manager;
@@ -1433,6 +1443,29 @@ async function getImmutables<N extends Network, C extends Chain>(chain: C, ntt:
14331443
};
14341444
}
14351445

1446+
async function getPdas<N extends Network, C extends Chain>(chain: C, ntt: Ntt<N, C>) {
1447+
const platform = chainToPlatform(chain);
1448+
if (platform !== "Solana") {
1449+
return null;
1450+
}
1451+
const solanaNtt = ntt as SolanaNtt<N, SolanaChains>;
1452+
const config = solanaNtt.pdas.configAccount();
1453+
const emitter = solanaNtt.pdas.emitterAccount();
1454+
const outboxRateLimit = solanaNtt.pdas.outboxRateLimitAccount();
1455+
const tokenAuthority = solanaNtt.pdas.tokenAuthority();
1456+
const lutAccount = solanaNtt.pdas.lutAccount();
1457+
const lutAuthority = solanaNtt.pdas.lutAuthority();
1458+
1459+
return {
1460+
config,
1461+
emitter,
1462+
outboxRateLimit,
1463+
tokenAuthority,
1464+
lutAccount,
1465+
lutAuthority,
1466+
};
1467+
}
1468+
14361469
function getVersion<N extends Network, C extends Chain>(chain: C, ntt: Ntt<N, C>): string {
14371470
const platform = chainToPlatform(chain);
14381471
switch (platform) {
@@ -1528,7 +1561,7 @@ async function pullInboundLimits(ntts: Partial<{ [C in Chain]: Ntt<Network, C> }
15281561
continue;
15291562
}
15301563
if (verbose) {
1531-
process.stdout.write(`Fetching inbound limit for ${c1} -> ${c2}\r`);
1564+
process.stdout.write(`Fetching inbound limit for ${c1} -> ${c2}.......\r`);
15321565
}
15331566
const peer = await retryWithExponentialBackoff(() => ntt1.getPeer(c2), 5, 5000);
15341567
if (chainConf.limits?.inbound === undefined) {

0 commit comments

Comments
 (0)