@hyperlane-xyz/cli
Version:
A command-line utility for common Hyperlane operations
116 lines • 4.18 kB
JavaScript
import { $ } from 'zx';
import { readYamlOrJson } from '../../utils/files.js';
import { ANVIL_KEY, REGISTRY_PATH } from './helpers.js';
/**
* Deploys the Hyperlane core contracts to the specified chain using the provided config.
*/
export function hyperlaneCoreDeployRaw(coreInputPath, privateKey, skipConfirmationPrompts, hypKey) {
if (hypKey) {
return $ `HYP_KEY=${hypKey} yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry ${REGISTRY_PATH} \
--config ${coreInputPath} \
--verbosity debug \
${skipConfirmationPrompts ? '--yes' : ''}`;
}
if (privateKey) {
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry ${REGISTRY_PATH} \
--config ${coreInputPath} \
--key ${privateKey} \
--verbosity debug \
${skipConfirmationPrompts ? '--yes' : ''}`;
}
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry ${REGISTRY_PATH} \
--config ${coreInputPath} \
--verbosity debug \
${skipConfirmationPrompts ? '--yes' : ''}`;
}
/**
* Deploys the Hyperlane core contracts to the specified chain using the provided config.
*/
export async function hyperlaneCoreDeploy(chain, coreInputPath) {
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core deploy \
--registry ${REGISTRY_PATH} \
--config ${coreInputPath} \
--chain ${chain} \
--key ${ANVIL_KEY} \
--verbosity debug \
--yes`;
}
/**
* Reads a Hyperlane core deployment on the specified chain using the provided config.
*/
export async function hyperlaneCoreRead(chain, coreOutputPath) {
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core read \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--verbosity debug \
--yes`;
}
/**
* Verifies that a Hyperlane core deployment matches the provided config on the specified chain.
*/
export function hyperlaneCoreCheck(chain, coreOutputPath, mailbox) {
if (mailbox) {
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core check \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--mailbox ${mailbox} \
--verbosity debug \
--yes`;
}
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core check \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--verbosity debug \
--yes`;
}
/**
* Creates a Hyperlane core deployment config
*/
export function hyperlaneCoreInit(coreOutputPath, privateKey, hyp_key) {
if (hyp_key) {
return $ `${hyp_key ? `HYP_KEY=${hyp_key}` : ''} yarn workspace @hyperlane-xyz/cli run hyperlane core init \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--verbosity debug \
--yes`;
}
if (privateKey) {
return $ `${hyp_key ? 'HYP_KEY=${hyp_key}' : ''} yarn workspace @hyperlane-xyz/cli run hyperlane core init \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--verbosity debug \
--key ${privateKey} \
--yes`;
}
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core init \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--verbosity debug \
--yes`;
}
/**
* Updates a Hyperlane core deployment on the specified chain using the provided config.
*/
export async function hyperlaneCoreApply(chain, coreOutputPath) {
return $ `yarn workspace @hyperlane-xyz/cli run hyperlane core apply \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--key ${ANVIL_KEY} \
--verbosity debug \
--yes`;
}
/**
* Reads the Core deployment config and outputs it to specified output path.
*/
export async function readCoreConfig(chain, coreConfigPath) {
await hyperlaneCoreRead(chain, coreConfigPath);
return readYamlOrJson(coreConfigPath);
}
//# sourceMappingURL=core.js.map