|
|
|
@ -1,6 +1,11 @@ |
|
|
|
|
import { stringify as yamlStringify } from 'yaml'; |
|
|
|
|
|
|
|
|
|
import { CoreConfigSchema, HookConfig, IsmConfig } from '@hyperlane-xyz/sdk'; |
|
|
|
|
import { |
|
|
|
|
CoreConfigSchema, |
|
|
|
|
HookConfig, |
|
|
|
|
IsmConfig, |
|
|
|
|
OwnableConfig, |
|
|
|
|
} from '@hyperlane-xyz/sdk'; |
|
|
|
|
|
|
|
|
|
import { CommandContext } from '../context/types.js'; |
|
|
|
|
import { errorRed, log, logBlue, logGreen } from '../logger.js'; |
|
|
|
@ -18,6 +23,9 @@ import { |
|
|
|
|
} from './hooks.js'; |
|
|
|
|
import { createAdvancedIsmConfig, createTrustedRelayerConfig } from './ism.js'; |
|
|
|
|
|
|
|
|
|
const ENTER_DESIRED_VALUE_MSG = 'Enter the desired'; |
|
|
|
|
const SIGNER_PROMPT_LABEL = 'signer'; |
|
|
|
|
|
|
|
|
|
export async function createCoreDeployConfig({ |
|
|
|
|
context, |
|
|
|
|
configFilePath, |
|
|
|
@ -31,9 +39,9 @@ export async function createCoreDeployConfig({ |
|
|
|
|
|
|
|
|
|
const owner = await detectAndConfirmOrPrompt( |
|
|
|
|
async () => context.signer?.getAddress(), |
|
|
|
|
'Enter the desired', |
|
|
|
|
ENTER_DESIRED_VALUE_MSG, |
|
|
|
|
'owner address', |
|
|
|
|
'signer', |
|
|
|
|
SIGNER_PROMPT_LABEL, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const defaultIsm: IsmConfig = advanced |
|
|
|
@ -41,6 +49,7 @@ export async function createCoreDeployConfig({ |
|
|
|
|
: await createTrustedRelayerConfig(context, advanced); |
|
|
|
|
|
|
|
|
|
let defaultHook: HookConfig, requiredHook: HookConfig; |
|
|
|
|
let proxyAdmin: OwnableConfig, interchainAccountRouter: OwnableConfig; |
|
|
|
|
if (advanced) { |
|
|
|
|
defaultHook = await createHookConfig({ |
|
|
|
|
context, |
|
|
|
@ -52,9 +61,31 @@ export async function createCoreDeployConfig({ |
|
|
|
|
selectMessage: 'Select required hook type', |
|
|
|
|
advanced, |
|
|
|
|
}); |
|
|
|
|
proxyAdmin = { |
|
|
|
|
owner: await detectAndConfirmOrPrompt( |
|
|
|
|
async () => context.signer?.getAddress(), |
|
|
|
|
ENTER_DESIRED_VALUE_MSG, |
|
|
|
|
'ProxyAdmin owner address', |
|
|
|
|
SIGNER_PROMPT_LABEL, |
|
|
|
|
), |
|
|
|
|
}; |
|
|
|
|
interchainAccountRouter = { |
|
|
|
|
owner: await detectAndConfirmOrPrompt( |
|
|
|
|
async () => context.signer?.getAddress(), |
|
|
|
|
ENTER_DESIRED_VALUE_MSG, |
|
|
|
|
'ICA Router owner address', |
|
|
|
|
SIGNER_PROMPT_LABEL, |
|
|
|
|
), |
|
|
|
|
}; |
|
|
|
|
} else { |
|
|
|
|
defaultHook = await createMerkleTreeConfig(); |
|
|
|
|
requiredHook = await createProtocolFeeConfig(context, advanced); |
|
|
|
|
proxyAdmin = { |
|
|
|
|
owner, |
|
|
|
|
}; |
|
|
|
|
interchainAccountRouter = { |
|
|
|
|
owner, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
@ -63,6 +94,8 @@ export async function createCoreDeployConfig({ |
|
|
|
|
defaultIsm, |
|
|
|
|
defaultHook, |
|
|
|
|
requiredHook, |
|
|
|
|
proxyAdmin, |
|
|
|
|
interchainAccountRouter, |
|
|
|
|
}); |
|
|
|
|
logBlue(`Core config is valid, writing to file ${configFilePath}:\n`); |
|
|
|
|
log(indentYamlOrJson(yamlStringify(coreConfig, null, 2), 4)); |
|
|
|
|