chore(cli): format message stdout during hl send message (#4025)

### Description

- formats message stdout during hl send message

### Drive-by changes

- none

### Related issues

- P1

### Backward compatibility

- yes

### Testing

- manual

example output:
```
➜  cli git:(06-20-fix_cli_add_units_and_explanation_to_protocol_fee_input) ✗ hl send message --relay --registry $HOME/workplace/Hyperlane/hyperlane-registry
Hyperlane CLI

? Select the origin chain fuji
? Select the destination chain brown
Running pre-flight checks for chains...
 Chains are valid
 Signer is valid
 Balances are sufficient
Dispatching message
Pending https://testnet.snowtrace.io/tx/0x5d0793052ad6df340242f332a218b14a8182b083bebbf5666faac83f7c20ed66 (waiting 3 blocks for confirmation)
Sent message from fuji to 0xb2b1125501aA997b912A0fa32f74B3041C0c4FcB on brown.
Message ID: 0x2ba918e23225a7dc67ec803cff998cbe9beefd45c7243422349035dcac5e20d0
Message:
    parsed:
      version: 3
      nonce: 2605
      origin: 43113
      sender: "0x00000000000000000000000016f4898f47c085c41d7cc6b1dc72b91ea617dcbb"
      destination: 6700087
      recipient: "0x000000000000000000000000b2b1125501aa997b912a0fa32f74b3041c0c4fcb"
      body: "0x48656c6c6f21"
      originChain: fuji
      destinationChain: brown
    id: "0x2ba918e23225a7dc67ec803cff998cbe9beefd45c7243422349035dcac5e20d0"
    message: "0x0300000a2d0000a86900000000000000000000000016f4898f47c085c41d7cc6b1d\
      c72b91ea617dcbb00663c37000000000000000000000000b2b1125501aa997b912a0fa32f74b3\
      041c0c4fcb48656c6c6f21"
```
pull/4035/head
Noah Bayindirli 🥂 4 months ago committed by GitHub
parent bb0c7afab7
commit 7add7bf871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      typescript/cli/src/deploy/core.ts
  2. 5
      typescript/cli/src/deploy/warp.ts
  3. 5
      typescript/cli/src/send/message.ts

@ -1,9 +1,12 @@
import { stringify as yamlStringify } from 'yaml';
import { ChainName, CoreConfig, EvmCoreModule } from '@hyperlane-xyz/sdk';
import { MINIMUM_CORE_DEPLOY_GAS } from '../consts.js';
import { WriteCommandContext } from '../context/types.js';
import { logBlue } from '../logger.js';
import { log, logBlue, logGreen } from '../logger.js';
import { runSingleChainSelectionStep } from '../utils/chains.js';
import { indentYamlOrJson } from '../utils/files.js';
import {
completeDeploy,
@ -83,5 +86,7 @@ export async function runCoreDeploy({
// @TODO implement writeAgentConfig
}
logBlue('Deployment is complete!');
logGreen('✅ Core contract deployments complete:\n');
log(indentYamlOrJson(yamlStringify(deployedAddresses, null, 2), 4));
}

@ -143,15 +143,14 @@ async function executeDeploy(params: DeployParams) {
const deployedContracts = await deployer.deploy(modifiedConfig);
const warpCoreConfig = await getWarpCoreConfig(params, deployedContracts);
logGreen('✅ Warp contract deployments complete');
const warpCoreConfig = await getWarpCoreConfig(params, deployedContracts);
if (!isDryRun) {
log('Writing deployment artifacts');
log('Writing deployment artifacts...');
await registry.addWarpRoute(warpCoreConfig);
}
log(indentYamlOrJson(yamlStringify(warpCoreConfig, null, 2), 4));
logBlue('Deployment is complete!');
}
async function deployAndResolveWarpIsm(

@ -1,3 +1,5 @@
import { stringify as yamlStringify } from 'yaml';
import { ChainName, HyperlaneCore } from '@hyperlane-xyz/sdk';
import { addressToBytes32, timeout } from '@hyperlane-xyz/utils';
@ -6,6 +8,7 @@ import { CommandContext, WriteCommandContext } from '../context/types.js';
import { runPreflightChecksForChains } from '../deploy/utils.js';
import { errorRed, log, logBlue, logGreen } from '../logger.js';
import { runSingleChainSelectionStep } from '../utils/chains.js';
import { indentYamlOrJson } from '../utils/files.js';
export async function sendTestMessage({
context,
@ -103,7 +106,7 @@ async function executeDelivery({
);
logBlue(`Sent message from ${origin} to ${recipient} on ${destination}.`);
logBlue(`Message ID: ${message.id}`);
log(`Message: ${JSON.stringify(message)}`);
log(`Message:\n${indentYamlOrJson(yamlStringify(message, null, 2), 4)}`);
if (selfRelay) {
log('Attempting self-relay of message');

Loading…
Cancel
Save