@hyperlane-xyz/cli 3.20.0-beta1 → 4.0.0-alpha
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/README.md +1 -1
- package/dist/cli.js +10 -6
- package/dist/cli.js.map +1 -1
- package/dist/src/avs/config.d.ts +11 -0
- package/dist/src/avs/config.d.ts.map +1 -0
- package/dist/src/avs/config.js +10 -0
- package/dist/src/avs/config.js.map +1 -0
- package/dist/src/avs/stakeRegistry.d.ts +21 -0
- package/dist/src/avs/stakeRegistry.d.ts.map +1 -0
- package/dist/src/avs/stakeRegistry.js +64 -0
- package/dist/src/avs/stakeRegistry.js.map +1 -0
- package/dist/src/commands/avs.d.ts +12 -0
- package/dist/src/commands/avs.d.ts.map +1 -0
- package/dist/src/commands/avs.js +64 -0
- package/dist/src/commands/avs.js.map +1 -0
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +10 -60
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/core.d.ts +16 -0
- package/dist/src/commands/core.d.ts.map +1 -0
- package/dist/src/commands/core.js +88 -0
- package/dist/src/commands/core.js.map +1 -0
- package/dist/src/commands/deploy.d.ts +13 -0
- package/dist/src/commands/deploy.d.ts.map +1 -1
- package/dist/src/commands/deploy.js +22 -26
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/options.d.ts +11 -5
- package/dist/src/commands/options.d.ts.map +1 -1
- package/dist/src/commands/options.js +45 -11
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/registry.d.ts +6 -0
- package/dist/src/commands/registry.d.ts.map +1 -0
- package/dist/src/commands/{chains.js → registry.js} +3 -3
- package/dist/src/commands/registry.js.map +1 -0
- package/dist/src/commands/send.d.ts.map +1 -1
- package/dist/src/commands/send.js +2 -42
- package/dist/src/commands/send.js.map +1 -1
- package/dist/src/commands/validator.d.ts +3 -0
- package/dist/src/commands/validator.d.ts.map +1 -0
- package/dist/src/commands/validator.js +34 -0
- package/dist/src/commands/validator.js.map +1 -0
- package/dist/src/commands/{hook.d.ts → warp.d.ts} +6 -2
- package/dist/src/commands/warp.d.ts.map +1 -0
- package/dist/src/commands/warp.js +101 -0
- package/dist/src/commands/warp.js.map +1 -0
- package/dist/src/config/chain.d.ts.map +1 -1
- package/dist/src/config/chain.js +21 -9
- package/dist/src/config/chain.js.map +1 -1
- package/dist/src/config/hooks.d.ts +4528 -90
- package/dist/src/config/hooks.d.ts.map +1 -1
- package/dist/src/config/hooks.js +31 -97
- package/dist/src/config/hooks.js.map +1 -1
- package/dist/src/config/ism.d.ts +58 -61
- package/dist/src/config/ism.d.ts.map +1 -1
- package/dist/src/config/ism.js +40 -128
- package/dist/src/config/ism.js.map +1 -1
- package/dist/src/config/warp.d.ts +3 -2
- package/dist/src/config/warp.d.ts.map +1 -1
- package/dist/src/config/warp.js +112 -49
- package/dist/src/config/warp.js.map +1 -1
- package/dist/src/consts.d.ts +1 -0
- package/dist/src/consts.d.ts.map +1 -1
- package/dist/src/consts.js +1 -0
- package/dist/src/consts.js.map +1 -1
- package/dist/src/context/context.d.ts +1 -1
- package/dist/src/context/context.d.ts.map +1 -1
- package/dist/src/context/context.js +37 -15
- package/dist/src/context/context.js.map +1 -1
- package/dist/src/context/types.d.ts +1 -0
- package/dist/src/context/types.d.ts.map +1 -1
- package/dist/src/deploy/agent.js +1 -1
- package/dist/src/deploy/agent.js.map +1 -1
- package/dist/src/deploy/core.d.ts +4 -8
- package/dist/src/deploy/core.d.ts.map +1 -1
- package/dist/src/deploy/core.js +28 -232
- package/dist/src/deploy/core.js.map +1 -1
- package/dist/src/deploy/dry-run.d.ts +2 -2
- package/dist/src/deploy/dry-run.d.ts.map +1 -1
- package/dist/src/deploy/dry-run.js +1 -0
- package/dist/src/deploy/dry-run.js.map +1 -1
- package/dist/src/deploy/utils.d.ts +4 -7
- package/dist/src/deploy/utils.d.ts.map +1 -1
- package/dist/src/deploy/utils.js +22 -19
- package/dist/src/deploy/utils.js.map +1 -1
- package/dist/src/deploy/warp.d.ts.map +1 -1
- package/dist/src/deploy/warp.js +38 -123
- package/dist/src/deploy/warp.js.map +1 -1
- package/dist/src/send/message.d.ts.map +1 -1
- package/dist/src/send/message.js +15 -29
- package/dist/src/send/message.js.map +1 -1
- package/dist/src/send/transfer.d.ts.map +1 -1
- package/dist/src/send/transfer.js +5 -6
- package/dist/src/send/transfer.js.map +1 -1
- package/dist/src/submit/submit.d.ts +5 -0
- package/dist/src/submit/submit.d.ts.map +1 -0
- package/dist/src/submit/submit.js +30 -0
- package/dist/src/submit/submit.js.map +1 -0
- package/dist/src/submit/types.d.ts +18 -0
- package/dist/src/submit/types.d.ts.map +1 -0
- package/dist/src/submit/types.js +2 -0
- package/dist/src/submit/types.js.map +1 -0
- package/dist/src/tests/deployTestErc20.js +3 -2
- package/dist/src/tests/deployTestErc20.js.map +1 -1
- package/dist/src/tests/hooks.test.js +14 -8
- package/dist/src/tests/hooks.test.js.map +1 -1
- package/dist/src/tests/ism.test.js +1 -1
- package/dist/src/tests/ism.test.js.map +1 -1
- package/dist/src/utils/balances.d.ts +2 -2
- package/dist/src/utils/balances.d.ts.map +1 -1
- package/dist/src/utils/balances.js +8 -3
- package/dist/src/utils/balances.js.map +1 -1
- package/dist/src/utils/chains.d.ts +1 -0
- package/dist/src/utils/chains.d.ts.map +1 -1
- package/dist/src/utils/chains.js +20 -3
- package/dist/src/utils/chains.js.map +1 -1
- package/dist/src/utils/env.d.ts +3 -0
- package/dist/src/utils/env.d.ts.map +1 -1
- package/dist/src/utils/env.js +3 -0
- package/dist/src/utils/env.js.map +1 -1
- package/dist/src/utils/files.d.ts +1 -0
- package/dist/src/utils/files.d.ts.map +1 -1
- package/dist/src/utils/files.js +8 -0
- package/dist/src/utils/files.js.map +1 -1
- package/dist/src/utils/keys.d.ts +5 -3
- package/dist/src/utils/keys.d.ts.map +1 -1
- package/dist/src/utils/keys.js +16 -13
- package/dist/src/utils/keys.js.map +1 -1
- package/dist/src/validator/address.d.ts +10 -0
- package/dist/src/validator/address.d.ts.map +1 -0
- package/dist/src/validator/address.js +107 -0
- package/dist/src/validator/address.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/examples/core-config.yaml +19 -0
- package/examples/hooks.yaml +8 -4
- package/examples/warp-route-deployment.yaml +2 -4
- package/package.json +7 -4
- package/dist/src/commands/chains.d.ts +0 -6
- package/dist/src/commands/chains.d.ts.map +0 -1
- package/dist/src/commands/chains.js.map +0 -1
- package/dist/src/commands/hook.d.ts.map +0 -1
- package/dist/src/commands/hook.js +0 -34
- package/dist/src/commands/hook.js.map +0 -1
- package/dist/src/commands/ism.d.ts +0 -12
- package/dist/src/commands/ism.d.ts.map +0 -1
- package/dist/src/commands/ism.js +0 -36
- package/dist/src/commands/ism.js.map +0 -1
- package/dist/src/registry/MergedRegistry.d.ts +0 -35
- package/dist/src/registry/MergedRegistry.d.ts.map +0 -1
- package/dist/src/registry/MergedRegistry.js +0 -83
- package/dist/src/registry/MergedRegistry.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { runKurtosisAgentDeploy } from '../deploy/agent.js';
|
|
2
2
|
import { runCoreDeploy } from '../deploy/core.js';
|
|
3
|
-
import { evaluateIfDryRunFailure
|
|
3
|
+
import { evaluateIfDryRunFailure } from '../deploy/dry-run.js';
|
|
4
4
|
import { runWarpRouteDeploy } from '../deploy/warp.js';
|
|
5
5
|
import { log, logGray } from '../logger.js';
|
|
6
|
-
import {
|
|
6
|
+
import { readYamlOrJson } from '../utils/files.js';
|
|
7
|
+
import { agentConfigCommandOption, agentTargetsCommandOption, chainCommandOption, dryRunCommandOption, fromAddressCommandOption, originCommandOption, outputFileCommandOption, warpDeploymentConfigCommandOption, } from './options.js';
|
|
7
8
|
/**
|
|
8
9
|
* Parent command
|
|
9
10
|
*/
|
|
@@ -11,7 +12,6 @@ export const deployCommand = {
|
|
|
11
12
|
command: 'deploy',
|
|
12
13
|
describe: 'Permissionlessly deploy a Hyperlane contracts or extensions',
|
|
13
14
|
builder: (yargs) => yargs
|
|
14
|
-
.command(coreCommand)
|
|
15
15
|
.command(warpCommand)
|
|
16
16
|
.command(agentCommand)
|
|
17
17
|
.version(false)
|
|
@@ -42,31 +42,28 @@ const agentCommand = {
|
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Generates a command module for deploying Hyperlane contracts, given a command
|
|
46
|
+
*
|
|
47
|
+
* @param commandName - the deploy command key used to look up the deployFunction
|
|
48
|
+
* @returns A command module used to deploy Hyperlane contracts.
|
|
46
49
|
*/
|
|
47
|
-
const
|
|
48
|
-
command: '
|
|
49
|
-
describe: 'Deploy
|
|
50
|
+
export const deploy = {
|
|
51
|
+
command: 'deploy',
|
|
52
|
+
describe: 'Deploy Hyperlane contracts',
|
|
50
53
|
builder: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'dry-run': dryRunOption,
|
|
54
|
+
chain: chainCommandOption,
|
|
55
|
+
config: outputFileCommandOption('./configs/core-config.yaml', false, 'The path to a JSON or YAML file with a core deployment config.'),
|
|
56
|
+
'dry-run': dryRunCommandOption,
|
|
57
|
+
'from-address': fromAddressCommandOption,
|
|
56
58
|
},
|
|
57
|
-
handler: async ({ context,
|
|
58
|
-
logGray(`Hyperlane permissionless
|
|
59
|
-
logGray(
|
|
60
|
-
if (dryRun)
|
|
61
|
-
await verifyAnvil();
|
|
59
|
+
handler: async ({ context, chain, config: configFilePath, dryRun }) => {
|
|
60
|
+
logGray(`Hyperlane permissionless deployment${dryRun ? ' dry-run' : ''}`);
|
|
61
|
+
logGray(`------------------------------------------------`);
|
|
62
62
|
try {
|
|
63
|
-
const chains = targets?.split(',').map((r) => r.trim());
|
|
64
63
|
await runCoreDeploy({
|
|
65
64
|
context,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
hookConfigPath: hook,
|
|
69
|
-
agentOutPath: agent,
|
|
65
|
+
chain,
|
|
66
|
+
config: readYamlOrJson(configFilePath),
|
|
70
67
|
});
|
|
71
68
|
}
|
|
72
69
|
catch (error) {
|
|
@@ -83,14 +80,13 @@ const warpCommand = {
|
|
|
83
80
|
command: 'warp',
|
|
84
81
|
describe: 'Deploy Warp Route contracts',
|
|
85
82
|
builder: {
|
|
86
|
-
config:
|
|
87
|
-
'dry-run':
|
|
83
|
+
config: warpDeploymentConfigCommandOption,
|
|
84
|
+
'dry-run': dryRunCommandOption,
|
|
85
|
+
'from-address': fromAddressCommandOption,
|
|
88
86
|
},
|
|
89
87
|
handler: async ({ context, config, dryRun }) => {
|
|
90
88
|
logGray(`Hyperlane warp route deployment${dryRun ? ' dry-run' : ''}`);
|
|
91
89
|
logGray('------------------------------------------------');
|
|
92
|
-
if (dryRun)
|
|
93
|
-
await verifyAnvil();
|
|
94
90
|
try {
|
|
95
91
|
await runWarpRouteDeploy({
|
|
96
92
|
context,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/commands/deploy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc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A6B,EAAE,MAAM;aACtC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACvC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -10,12 +10,18 @@ export declare const agentTargetsCommandOption: Options;
|
|
|
10
10
|
export declare const originCommandOption: Options;
|
|
11
11
|
export declare const ismCommandOption: Options;
|
|
12
12
|
export declare const hookCommandOption: Options;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
13
|
+
export declare const warpDeploymentConfigCommandOption: Options;
|
|
14
|
+
export declare const warpCoreConfigCommandOption: Options;
|
|
15
15
|
export declare const agentConfigCommandOption: (isIn: boolean, defaultPath?: string) => Options;
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
16
|
+
export declare const outputFileCommandOption: (defaultPath?: string, demandOption?: boolean, description?: string) => Options;
|
|
17
|
+
export declare const inputFileCommandOption: Options;
|
|
18
|
+
export declare const fromAddressCommandOption: Options;
|
|
19
|
+
export declare const dryRunCommandOption: Options;
|
|
19
20
|
export declare const chainCommandOption: Options;
|
|
20
21
|
export declare const addressCommandOption: (description: string, demandOption?: boolean) => Options;
|
|
22
|
+
export declare const awsAccessKeyCommandOption: Options;
|
|
23
|
+
export declare const awsSecretKeyCommandOption: Options;
|
|
24
|
+
export declare const awsRegionCommandOption: Options;
|
|
25
|
+
export declare const awsBucketCommandOption: Options;
|
|
26
|
+
export declare const awsKeyIdCommandOption: Options;
|
|
21
27
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/commands/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/commands/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AAqB,EAAE,OAGnC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import os from 'os';
|
|
1
2
|
import { DEFAULT_GITHUB_REGISTRY } from '@hyperlane-xyz/registry';
|
|
2
3
|
import { LogFormat, LogLevel } from '@hyperlane-xyz/utils';
|
|
3
4
|
import { ENV } from '../utils/env.js';
|
|
@@ -21,7 +22,7 @@ export const registryUriCommandOption = {
|
|
|
21
22
|
export const overrideRegistryUriCommandOption = {
|
|
22
23
|
type: 'string',
|
|
23
24
|
description: 'Path to a local registry to override the default registry',
|
|
24
|
-
default:
|
|
25
|
+
default: `${os.homedir()}/.hyperlane`,
|
|
25
26
|
};
|
|
26
27
|
export const skipConfirmationOption = {
|
|
27
28
|
type: 'boolean',
|
|
@@ -31,10 +32,10 @@ export const skipConfirmationOption = {
|
|
|
31
32
|
};
|
|
32
33
|
export const keyCommandOption = {
|
|
33
34
|
type: 'string',
|
|
34
|
-
description:
|
|
35
|
-
|
|
36
|
-
alias: 'k',
|
|
35
|
+
description: 'A hex private key or seed phrase for transaction signing, or use the HYP_KEY env var.',
|
|
36
|
+
alias: ['k', 'private-key', 'seed-phrase'],
|
|
37
37
|
default: ENV.HYP_KEY,
|
|
38
|
+
defaultDescription: 'process.env.HYP_KEY',
|
|
38
39
|
};
|
|
39
40
|
/* Command-specific options */
|
|
40
41
|
export const coreTargetsCommandOption = {
|
|
@@ -57,13 +58,13 @@ export const hookCommandOption = {
|
|
|
57
58
|
type: 'string',
|
|
58
59
|
description: 'A path to a JSON or YAML file with Hook configs (for every chain)',
|
|
59
60
|
};
|
|
60
|
-
export const
|
|
61
|
+
export const warpDeploymentConfigCommandOption = {
|
|
61
62
|
type: 'string',
|
|
62
63
|
description: 'A path to a JSON or YAML file with a warp route deployment config.',
|
|
63
64
|
default: './configs/warp-route-deployment.yaml',
|
|
64
65
|
alias: 'w',
|
|
65
66
|
};
|
|
66
|
-
export const
|
|
67
|
+
export const warpCoreConfigCommandOption = {
|
|
67
68
|
type: 'string',
|
|
68
69
|
description: 'File path to Warp Route config',
|
|
69
70
|
alias: 'w',
|
|
@@ -75,22 +76,28 @@ export const agentConfigCommandOption = (isIn, defaultPath) => ({
|
|
|
75
76
|
description: `${isIn ? 'Input' : 'Output'} file path for the agent configuration`,
|
|
76
77
|
default: defaultPath,
|
|
77
78
|
});
|
|
78
|
-
export const
|
|
79
|
+
export const outputFileCommandOption = (defaultPath, demandOption = false, description = 'Output file path') => ({
|
|
79
80
|
type: 'string',
|
|
80
|
-
description
|
|
81
|
+
description,
|
|
81
82
|
default: defaultPath,
|
|
82
83
|
alias: 'o',
|
|
84
|
+
demandOption,
|
|
83
85
|
});
|
|
84
|
-
export const
|
|
86
|
+
export const inputFileCommandOption = {
|
|
85
87
|
type: 'string',
|
|
86
88
|
description: 'Input file path',
|
|
87
89
|
alias: 'i',
|
|
88
90
|
demandOption: true,
|
|
89
91
|
};
|
|
90
|
-
export const
|
|
92
|
+
export const fromAddressCommandOption = {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: `An address to simulate transaction signing on a forked network`,
|
|
95
|
+
alias: 'f',
|
|
96
|
+
};
|
|
97
|
+
export const dryRunCommandOption = {
|
|
91
98
|
type: 'string',
|
|
92
99
|
description: 'Chain name to fork and simulate deployment. Please ensure an anvil node instance is running during execution via `anvil`.',
|
|
93
|
-
alias:
|
|
100
|
+
alias: 'd',
|
|
94
101
|
};
|
|
95
102
|
export const chainCommandOption = {
|
|
96
103
|
type: 'string',
|
|
@@ -101,4 +108,31 @@ export const addressCommandOption = (description, demandOption = false) => ({
|
|
|
101
108
|
description,
|
|
102
109
|
demandOption,
|
|
103
110
|
});
|
|
111
|
+
/* Validator options */
|
|
112
|
+
export const awsAccessKeyCommandOption = {
|
|
113
|
+
type: 'string',
|
|
114
|
+
description: 'AWS access key of IAM user associated with validator',
|
|
115
|
+
default: ENV.AWS_ACCESS_KEY_ID,
|
|
116
|
+
defaultDescription: 'process.env.AWS_ACCESS_KEY_ID',
|
|
117
|
+
};
|
|
118
|
+
export const awsSecretKeyCommandOption = {
|
|
119
|
+
type: 'string',
|
|
120
|
+
description: 'AWS secret access key of IAM user associated with validator',
|
|
121
|
+
default: ENV.AWS_SECRET_ACCESS_KEY,
|
|
122
|
+
defaultDescription: 'process.env.AWS_SECRET_ACCESS_KEY',
|
|
123
|
+
};
|
|
124
|
+
export const awsRegionCommandOption = {
|
|
125
|
+
type: 'string',
|
|
126
|
+
describe: 'AWS region associated with validator',
|
|
127
|
+
default: ENV.AWS_REGION,
|
|
128
|
+
defaultDescription: 'process.env.AWS_REGION',
|
|
129
|
+
};
|
|
130
|
+
export const awsBucketCommandOption = {
|
|
131
|
+
type: 'string',
|
|
132
|
+
describe: 'AWS S3 bucket containing validator signatures and announcement',
|
|
133
|
+
};
|
|
134
|
+
export const awsKeyIdCommandOption = {
|
|
135
|
+
type: 'string',
|
|
136
|
+
describe: 'Key ID from AWS KMS',
|
|
137
|
+
};
|
|
104
138
|
//# sourceMappingURL=options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/commands/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/commands/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,sBAAsB,GAAY;IAC7C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAY;IAC5C,IAAI,EAAE,QAA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
|
|
@@ -3,8 +3,8 @@ const ChainTypes = ['mainnet', 'testnet'];
|
|
|
3
3
|
/**
|
|
4
4
|
* Parent command
|
|
5
5
|
*/
|
|
6
|
-
export const
|
|
7
|
-
command: '
|
|
6
|
+
export const registryCommand = {
|
|
7
|
+
command: 'registry',
|
|
8
8
|
describe: 'View information about Hyperlane chains in a registry',
|
|
9
9
|
builder: (yargs) => yargs
|
|
10
10
|
.command(listCommand)
|
|
@@ -82,4 +82,4 @@ const addressesCommand = {
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=
|
|
85
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/commands/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAG1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,uDAAuD;IACjE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,OAAO,CAAC,WAAW,CAAC;SACpB,OAAO,CAAC,gBAAgB,CAAC;SACzB,OAAO,CAAC,KAAK,CAAC;SACd,aAAa,EAAE;IACpB,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,GAAkD;IACjE,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,wCAAwC;IAClD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE,4BAA4B;YACtC,OAAO,EAAE,UAAU;SACpB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EA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,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QACnC,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC9D,OAAO,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;YACnD,OAAO,CAAC,mCAAmC,CAAC,CAAC;YAC7C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;YACrD,OAAO,CAAC,+BAA+B,CAAC,CAAC;YACzC,OAAO,CAAC,oCAAoC,CAAC,CAAC;YAC9C,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAM/C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,aAMzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAwBlD,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
2
|
import { log } from '../logger.js';
|
|
3
3
|
import { sendTestMessage } from '../send/message.js';
|
|
4
|
-
import { sendTestTransfer } from '../send/transfer.js';
|
|
5
|
-
import { warpConfigOption } from './options.js';
|
|
6
4
|
/**
|
|
7
5
|
* Parent command
|
|
8
6
|
*/
|
|
9
7
|
export const sendCommand = {
|
|
10
8
|
command: 'send',
|
|
11
|
-
describe: 'Send a test message
|
|
12
|
-
builder: (yargs) => yargs
|
|
13
|
-
.command(messageCommand)
|
|
14
|
-
.command(transferCommand)
|
|
15
|
-
.version(false)
|
|
16
|
-
.demandCommand(),
|
|
9
|
+
describe: 'Send a test message',
|
|
10
|
+
builder: (yargs) => yargs.command(messageCommand).version(false).demandCommand(),
|
|
17
11
|
handler: () => log('Command required'),
|
|
18
12
|
};
|
|
19
13
|
/**
|
|
@@ -68,38 +62,4 @@ const messageCommand = {
|
|
|
68
62
|
process.exit(0);
|
|
69
63
|
},
|
|
70
64
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Transfer command
|
|
73
|
-
*/
|
|
74
|
-
const transferCommand = {
|
|
75
|
-
command: 'transfer',
|
|
76
|
-
describe: 'Send a test token transfer on a warp route',
|
|
77
|
-
builder: {
|
|
78
|
-
...messageOptions,
|
|
79
|
-
warp: warpConfigOption,
|
|
80
|
-
wei: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
description: 'Amount in wei to send',
|
|
83
|
-
default: 1,
|
|
84
|
-
},
|
|
85
|
-
recipient: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
description: 'Token recipient address (defaults to sender)',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
handler: async ({ context, origin, destination, timeout, quick, relay, warp, wei, recipient, }) => {
|
|
91
|
-
await sendTestTransfer({
|
|
92
|
-
context,
|
|
93
|
-
warpConfigPath: warp,
|
|
94
|
-
origin,
|
|
95
|
-
destination,
|
|
96
|
-
wei,
|
|
97
|
-
recipient,
|
|
98
|
-
timeoutSec: timeout,
|
|
99
|
-
skipWaitForDelivery: quick,
|
|
100
|
-
selfRelay: relay,
|
|
101
|
-
});
|
|
102
|
-
process.exit(0);
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
65
|
//# sourceMappingURL=send.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,qBAAqB;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE;IAC9D,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA6B;IACtD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,mCAAmC;KACjD;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,sCAAsC;KACpD;IACD,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,CAAC,GAAG,EAAE;KAChB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,uCAAuC;QACpD,OAAO,EAAE,KAAK;KACf;IACD,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,mDAAmD;QAChE,OAAO,EAAE,KAAK;KACf;CACF,CAAC;AAUF,MAAM,cAAc,GAEhB;IACF,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,uCAAuC;IACjD,OAAO,EAAE;QACP,GAAG,cAAc;QACjB,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uBAAuB;YACpC,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,EACd,OAAO,EACP,MAAM,EACN,WAAW,EACX,OAAO,EACP,KAAK,EACL,KAAK,EACL,IAAI,GACL,EAAE,EAAE;QACH,MAAM,eAAe,CAAC;YACpB,OAAO;YACP,MAAM;YACN,WAAW;YACX,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACjE,UAAU,EAAE,OAAO;YACnB,mBAAmB,EAAE,KAAK;YAC1B,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/commands/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAetC,eAAO,MAAM,gBAAgB,EAAE,aAK9B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { log } from '../logger.js';
|
|
2
|
+
import { getValidatorAddress } from '../validator/address.js';
|
|
3
|
+
import { awsAccessKeyCommandOption, awsBucketCommandOption, awsKeyIdCommandOption, awsRegionCommandOption, awsSecretKeyCommandOption, } from './options.js';
|
|
4
|
+
// Parent command to help configure and set up Hyperlane validators
|
|
5
|
+
export const validatorCommand = {
|
|
6
|
+
command: 'validator',
|
|
7
|
+
describe: 'Configure and manage Hyperlane validators',
|
|
8
|
+
builder: (yargs) => yargs.command(addressCommand).demandCommand(),
|
|
9
|
+
handler: () => log('Command required'),
|
|
10
|
+
};
|
|
11
|
+
// If AWS access key needed for future validator commands, move to context
|
|
12
|
+
const addressCommand = {
|
|
13
|
+
command: 'address',
|
|
14
|
+
describe: 'Get the validator address from S3 bucket or KMS key ID',
|
|
15
|
+
builder: {
|
|
16
|
+
'access-key': awsAccessKeyCommandOption,
|
|
17
|
+
'secret-key': awsSecretKeyCommandOption,
|
|
18
|
+
region: awsRegionCommandOption,
|
|
19
|
+
bucket: awsBucketCommandOption,
|
|
20
|
+
'key-id': awsKeyIdCommandOption,
|
|
21
|
+
},
|
|
22
|
+
handler: async ({ context, accessKey, secretKey, region, bucket, keyId }) => {
|
|
23
|
+
await getValidatorAddress({
|
|
24
|
+
context,
|
|
25
|
+
accessKey,
|
|
26
|
+
secretKey,
|
|
27
|
+
region,
|
|
28
|
+
bucket,
|
|
29
|
+
keyId,
|
|
30
|
+
});
|
|
31
|
+
process.exit(0);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/commands/validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAkB;IAC7C,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,2CAA2C;IACrD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,aAAa,EAAE;IACjE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACvC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,cAAc,GAMf;IACH,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,wDAAwD;IAClE,OAAO,EAAE;QACP,YAAY,EAAE,yBAAyB;QACvC,YAAY,EAAE,yBAAyB;QACvC,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE,sBAAsB;QAC9B,QAAQ,EAAE,qBAAqB;KAChC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1E,MAAM,mBAAmB,CAAC;YACxB,OAAO;YACP,SAAS;YACT,SAAS;YACT,MAAM;YACN,MAAM;YACN,KAAK;SACN,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -3,10 +3,14 @@ import { CommandModuleWithContext } from '../context/types.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Parent command
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const warpCommand: CommandModule;
|
|
7
|
+
export declare const configure: CommandModuleWithContext<{
|
|
8
|
+
ismAdvanced: boolean;
|
|
9
|
+
out: string;
|
|
10
|
+
}>;
|
|
7
11
|
export declare const read: CommandModuleWithContext<{
|
|
8
12
|
chain: string;
|
|
9
13
|
address: string;
|
|
10
14
|
out: string;
|
|
11
15
|
}>;
|
|
12
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=warp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warp.d.ts","sourceRoot":"","sources":["../../../src/commands/warp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,OAAO,EACL,wBAAwB,EAEzB,MAAM,qBAAqB,CAAC;AAa7B;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,aAYzB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,wBAAwB,CAAC;IAC/C,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,CAmBA,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,wBAAwB,CAAC;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAmCA,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { EvmERC20WarpRouteReader } from '@hyperlane-xyz/sdk';
|
|
2
|
+
import { createWarpRouteDeployConfig } from '../config/warp.js';
|
|
3
|
+
import { log, logGray, logGreen } from '../logger.js';
|
|
4
|
+
import { sendTestTransfer } from '../send/transfer.js';
|
|
5
|
+
import { writeFileAtPath } from '../utils/files.js';
|
|
6
|
+
import { addressCommandOption, chainCommandOption, outputFileCommandOption, warpCoreConfigCommandOption, } from './options.js';
|
|
7
|
+
import { messageOptions } from './send.js';
|
|
8
|
+
/**
|
|
9
|
+
* Parent command
|
|
10
|
+
*/
|
|
11
|
+
export const warpCommand = {
|
|
12
|
+
command: 'warp',
|
|
13
|
+
describe: 'Manage Hyperlane warp routes',
|
|
14
|
+
builder: (yargs) => yargs
|
|
15
|
+
.command(configure)
|
|
16
|
+
.command(read)
|
|
17
|
+
.command(send)
|
|
18
|
+
.version(false)
|
|
19
|
+
.demandCommand(),
|
|
20
|
+
handler: () => log('Command required'),
|
|
21
|
+
};
|
|
22
|
+
export const configure = {
|
|
23
|
+
command: 'configure',
|
|
24
|
+
describe: 'Create a warp route configuration.',
|
|
25
|
+
builder: {
|
|
26
|
+
ismAdvanced: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
describe: 'Create an advanced ISM & hook configuration',
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
out: outputFileCommandOption('./configs/warp-route-deployment.yaml'),
|
|
32
|
+
},
|
|
33
|
+
handler: async ({ context, ismAdvanced, out }) => {
|
|
34
|
+
await createWarpRouteDeployConfig({
|
|
35
|
+
context,
|
|
36
|
+
outPath: out,
|
|
37
|
+
shouldUseDefault: !ismAdvanced,
|
|
38
|
+
});
|
|
39
|
+
process.exit(0);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const read = {
|
|
43
|
+
command: 'read',
|
|
44
|
+
describe: 'Reads the warp route config at the given path.',
|
|
45
|
+
builder: {
|
|
46
|
+
chain: {
|
|
47
|
+
...chainCommandOption,
|
|
48
|
+
demandOption: true,
|
|
49
|
+
},
|
|
50
|
+
address: addressCommandOption('Address of the router contract to read.', true),
|
|
51
|
+
out: outputFileCommandOption(),
|
|
52
|
+
},
|
|
53
|
+
handler: async ({ context, chain, address, out }) => {
|
|
54
|
+
logGray('Hyperlane Warp Reader');
|
|
55
|
+
logGray('---------------------');
|
|
56
|
+
const { multiProvider } = context;
|
|
57
|
+
const evmERC20WarpRouteReader = new EvmERC20WarpRouteReader(multiProvider, chain);
|
|
58
|
+
const warpRouteConfig = await evmERC20WarpRouteReader.deriveWarpRouteConfig(address);
|
|
59
|
+
if (out) {
|
|
60
|
+
writeFileAtPath(out, JSON.stringify(warpRouteConfig, null, 4) + '\n');
|
|
61
|
+
logGreen(`✅ Warp route config written successfully to ${out}.`);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
logGreen(`✅ Warp route config read successfully:`);
|
|
65
|
+
log(JSON.stringify(warpRouteConfig, null, 4));
|
|
66
|
+
}
|
|
67
|
+
process.exit(0);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
const send = {
|
|
71
|
+
command: 'send',
|
|
72
|
+
describe: 'Send a test token transfer on a warp route',
|
|
73
|
+
builder: {
|
|
74
|
+
...messageOptions,
|
|
75
|
+
warp: warpCoreConfigCommandOption,
|
|
76
|
+
wei: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Amount in wei to send',
|
|
79
|
+
default: 1,
|
|
80
|
+
},
|
|
81
|
+
recipient: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
description: 'Token recipient address (defaults to sender)',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
handler: async ({ context, origin, destination, timeout, quick, relay, warp, wei, recipient, }) => {
|
|
87
|
+
await sendTestTransfer({
|
|
88
|
+
context,
|
|
89
|
+
warpConfigPath: warp,
|
|
90
|
+
origin,
|
|
91
|
+
destination,
|
|
92
|
+
wei,
|
|
93
|
+
recipient,
|
|
94
|
+
timeoutSec: timeout,
|
|
95
|
+
skipWaitForDelivery: quick,
|
|
96
|
+
selfRelay: relay,
|
|
97
|
+
});
|
|
98
|
+
process.exit(0);
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=warp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warp.js","sourceRoot":"","sources":["../../../src/commands/warp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAKhE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,oBAAoB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ACL,KAAK,EACL,IAAI,EACJ,GAAG,EACH,SAAS,GACV,EAAE,EAAE;QACH,MAAM,gBAAgB,CAAC;YACrB,OAAO;YACP,cAAc,EAAE,IAAI;YACpB,MAAM;YACN,WAAW;YACX,GAAG;YACH,SAAS;YACT,UAAU,EAAE,OAAO;YACnB,mBAAmB,EAAE,KAAK;YAC1B,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/config/chain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/config/chain.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,iBAuBhD;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,GACR,EAAE;IACD,OAAO,EAAE,cAAc,CAAC;CACzB,iBAiHA"}
|
package/dist/src/config/chain.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { confirm, input } from '@inquirer/prompts';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
2
3
|
import { ChainMetadataSchema } from '@hyperlane-xyz/sdk';
|
|
3
4
|
import { ProtocolType } from '@hyperlane-xyz/utils';
|
|
4
5
|
import { errorRed, log, logBlue, logGreen } from '../logger.js';
|
|
6
|
+
import { detectAndConfirmOrPrompt } from '../utils/chains.js';
|
|
5
7
|
import { readYamlOrJson } from '../utils/files.js';
|
|
6
8
|
export function readChainConfigs(filePath) {
|
|
7
9
|
log(`Reading file configs in ${filePath}`);
|
|
@@ -23,21 +25,31 @@ export function readChainConfigs(filePath) {
|
|
|
23
25
|
}
|
|
24
26
|
export async function createChainConfig({ context, }) {
|
|
25
27
|
logBlue('Creating a new chain config');
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
28
|
+
const rpcUrl = await detectAndConfirmOrPrompt(async () => {
|
|
29
|
+
await new ethers.providers.JsonRpcProvider().getNetwork();
|
|
30
|
+
return ethers.providers.JsonRpcProvider.defaultUrl();
|
|
31
|
+
}, 'Enter http or https', 'rpc url');
|
|
32
|
+
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
|
|
33
|
+
const name = await detectAndConfirmOrPrompt(async () => {
|
|
34
|
+
const clientName = await provider.send('web3_clientVersion', []);
|
|
35
|
+
const port = rpcUrl.split(':').slice(-1);
|
|
36
|
+
const client = clientName.split('/')[0];
|
|
37
|
+
return `${client}${port}`;
|
|
38
|
+
}, 'Enter (one word, lower case)', 'chain name');
|
|
39
|
+
const chainId = parseInt(await detectAndConfirmOrPrompt(async () => {
|
|
40
|
+
const network = await provider.getNetwork();
|
|
41
|
+
return network.chainId.toString();
|
|
42
|
+
}, 'Enter a (number)', 'chain id'), 10);
|
|
32
43
|
const metadata = {
|
|
33
44
|
name,
|
|
34
|
-
chainId
|
|
35
|
-
domainId:
|
|
45
|
+
chainId,
|
|
46
|
+
domainId: chainId,
|
|
36
47
|
protocol: ProtocolType.Ethereum,
|
|
37
48
|
rpcUrls: [{ http: rpcUrl }],
|
|
38
49
|
};
|
|
39
50
|
const wantAdvancedConfig = await confirm({
|
|
40
|
-
|
|
51
|
+
default: false,
|
|
52
|
+
message: 'Do you want to set block or gas properties for this chain config?',
|
|
41
53
|
});
|
|
42
54
|
if (wantAdvancedConfig) {
|
|
43
55
|
const wantBlockConfig = await confirm({
|