@hyperlane-xyz/cli 3.1.10 → 3.2.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 +6 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +27 -4
- package/dist/cli.js.map +1 -1
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +14 -0
- package/dist/env.js.map +1 -0
- 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 +19 -0
- package/dist/src/avs/stakeRegistry.d.ts.map +1 -0
- package/dist/src/avs/stakeRegistry.js +94 -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 +58 -0
- package/dist/src/commands/avs.js.map +1 -0
- package/dist/src/commands/chains.d.ts.map +1 -1
- package/dist/src/commands/chains.js +46 -27
- package/dist/src/commands/chains.js.map +1 -1
- package/dist/src/commands/config.js +74 -85
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/deploy.d.ts.map +1 -1
- package/dist/src/commands/deploy.js +58 -91
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/hook.d.ts +12 -0
- package/dist/src/commands/hook.d.ts.map +1 -0
- package/dist/src/commands/hook.js +34 -0
- package/dist/src/commands/hook.js.map +1 -0
- package/dist/src/commands/ism.d.ts +12 -0
- package/dist/src/commands/ism.d.ts.map +1 -0
- package/dist/src/commands/ism.js +36 -0
- package/dist/src/commands/ism.js.map +1 -0
- package/dist/src/commands/options.d.ts +19 -7
- package/dist/src/commands/options.d.ts.map +1 -1
- package/dist/src/commands/options.js +90 -27
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/send.d.ts +14 -1
- package/dist/src/commands/send.d.ts.map +1 -1
- package/dist/src/commands/send.js +32 -55
- package/dist/src/commands/send.js.map +1 -1
- package/dist/src/commands/signCommands.d.ts +3 -0
- package/dist/src/commands/signCommands.d.ts.map +1 -0
- package/dist/src/commands/signCommands.js +11 -0
- package/dist/src/commands/signCommands.js.map +1 -0
- package/dist/src/commands/status.d.ts +5 -2
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +9 -19
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/config/chain.d.ts +5 -7
- package/dist/src/config/chain.d.ts.map +1 -1
- package/dist/src/config/chain.js +94 -68
- package/dist/src/config/chain.js.map +1 -1
- package/dist/src/config/chain.test.js +1 -5
- package/dist/src/config/chain.test.js.map +1 -1
- package/dist/src/config/hooks.d.ts +91 -214
- package/dist/src/config/hooks.d.ts.map +1 -1
- package/dist/src/config/hooks.js +218 -122
- package/dist/src/config/hooks.js.map +1 -1
- package/dist/src/config/ism.d.ts +74 -0
- package/dist/src/config/ism.d.ts.map +1 -0
- package/dist/src/config/ism.js +223 -0
- package/dist/src/config/ism.js.map +1 -0
- package/dist/src/config/multisig.d.ts +4 -14
- package/dist/src/config/multisig.d.ts.map +1 -1
- package/dist/src/config/multisig.js +35 -29
- package/dist/src/config/multisig.js.map +1 -1
- package/dist/src/config/warp.d.ts +7 -180
- package/dist/src/config/warp.d.ts.map +1 -1
- package/dist/src/config/warp.js +55 -62
- 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 +14 -0
- package/dist/src/context/context.d.ts.map +1 -0
- package/dist/src/context/context.js +108 -0
- package/dist/src/context/context.js.map +1 -0
- package/dist/src/context/types.d.ts +33 -0
- package/dist/src/context/types.d.ts.map +1 -0
- package/dist/src/context/types.js.map +1 -0
- package/dist/src/deploy/agent.d.ts +6 -4
- package/dist/src/deploy/agent.d.ts.map +1 -1
- package/dist/src/deploy/agent.js +10 -24
- package/dist/src/deploy/agent.js.map +1 -1
- package/dist/src/deploy/core.d.ts +10 -7
- package/dist/src/deploy/core.d.ts.map +1 -1
- package/dist/src/deploy/core.js +156 -160
- package/dist/src/deploy/core.js.map +1 -1
- package/dist/src/deploy/dry-run.d.ts +19 -0
- package/dist/src/deploy/dry-run.d.ts.map +1 -0
- package/dist/src/deploy/dry-run.js +45 -0
- package/dist/src/deploy/dry-run.js.map +1 -0
- package/dist/src/deploy/utils.d.ts +15 -8
- package/dist/src/deploy/utils.d.ts.map +1 -1
- package/dist/src/deploy/utils.js +60 -11
- package/dist/src/deploy/utils.js.map +1 -1
- package/dist/src/deploy/warp.d.ts +4 -7
- package/dist/src/deploy/warp.d.ts.map +1 -1
- package/dist/src/deploy/warp.js +129 -169
- package/dist/src/deploy/warp.js.map +1 -1
- package/dist/src/hook/read.d.ts +13 -0
- package/dist/src/hook/read.d.ts.map +1 -0
- package/dist/src/hook/read.js +25 -0
- package/dist/src/hook/read.js.map +1 -0
- package/dist/src/ism/read.d.ts +13 -0
- package/dist/src/ism/read.d.ts.map +1 -0
- package/dist/src/ism/read.js +25 -0
- package/dist/src/ism/read.js.map +1 -0
- package/dist/src/logger.d.ts +17 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +32 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/registry/MergedRegistry.d.ts +35 -0
- package/dist/src/registry/MergedRegistry.d.ts.map +1 -0
- package/dist/src/registry/MergedRegistry.js +83 -0
- package/dist/src/registry/MergedRegistry.js.map +1 -0
- package/dist/src/send/message.d.ts +7 -6
- package/dist/src/send/message.d.ts.map +1 -1
- package/dist/src/send/message.js +40 -22
- package/dist/src/send/message.js.map +1 -1
- package/dist/src/send/transfer.d.ts +8 -10
- package/dist/src/send/transfer.d.ts.map +1 -1
- package/dist/src/send/transfer.js +68 -70
- package/dist/src/send/transfer.js.map +1 -1
- package/dist/src/status/message.d.ts +7 -5
- package/dist/src/status/message.d.ts.map +1 -1
- package/dist/src/status/message.js +25 -12
- package/dist/src/status/message.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/{deploy → submit}/types.js.map +1 -1
- package/dist/src/tests/deployTestErc20.d.ts +2 -0
- package/dist/src/tests/deployTestErc20.d.ts.map +1 -0
- package/dist/src/tests/deployTestErc20.js +26 -0
- package/dist/src/tests/deployTestErc20.js.map +1 -0
- package/dist/src/tests/hooks.test.d.ts +2 -0
- package/dist/src/tests/hooks.test.d.ts.map +1 -0
- package/dist/src/tests/hooks.test.js +83 -0
- package/dist/src/tests/hooks.test.js.map +1 -0
- package/dist/src/tests/ism.test.d.ts +2 -0
- package/dist/src/tests/ism.test.d.ts.map +1 -0
- package/dist/src/tests/ism.test.js +76 -0
- package/dist/src/tests/ism.test.js.map +1 -0
- package/dist/src/tests/multisig.test.d.ts +2 -0
- package/dist/src/tests/multisig.test.d.ts.map +1 -0
- package/dist/src/tests/multisig.test.js +34 -0
- package/dist/src/tests/multisig.test.js.map +1 -0
- package/dist/src/utils/balances.d.ts +2 -4
- package/dist/src/utils/balances.d.ts.map +1 -1
- package/dist/src/utils/balances.js +8 -12
- package/dist/src/utils/balances.js.map +1 -1
- package/dist/src/utils/chains.d.ts +3 -2
- package/dist/src/utils/chains.d.ts.map +1 -1
- package/dist/src/utils/chains.js +33 -18
- package/dist/src/utils/chains.js.map +1 -1
- package/dist/src/utils/env.d.ts +6 -0
- package/dist/src/utils/env.d.ts.map +1 -0
- package/dist/src/utils/env.js +9 -0
- package/dist/src/utils/env.js.map +1 -0
- package/dist/src/utils/files.d.ts +6 -4
- package/dist/src/utils/files.d.ts.map +1 -1
- package/dist/src/utils/files.js +37 -25
- package/dist/src/utils/files.js.map +1 -1
- package/dist/src/utils/keys.d.ts +28 -1
- package/dist/src/utils/keys.d.ts.map +1 -1
- package/dist/src/utils/keys.js +65 -6
- package/dist/src/utils/keys.js.map +1 -1
- package/dist/src/utils/tokens.d.ts +3 -0
- package/dist/src/utils/tokens.d.ts.map +1 -0
- package/dist/src/utils/tokens.js +14 -0
- package/dist/src/utils/tokens.js.map +1 -0
- package/dist/src/utils/version-check.d.ts +2 -0
- package/dist/src/utils/version-check.d.ts.map +1 -0
- package/dist/src/utils/version-check.js +15 -0
- package/dist/src/utils/version-check.js.map +1 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.d.ts.map +1 -0
- package/dist/src/version.js +2 -0
- package/dist/src/version.js.map +1 -0
- package/examples/chain-config.yaml +38 -46
- package/examples/contract-artifacts.yaml +4 -4
- package/examples/hooks.yaml +66 -0
- package/examples/ism-advanced.yaml +33 -0
- package/examples/{multisig-ism.yaml → ism.yaml} +0 -8
- package/examples/warp-route-deployment.yaml +32 -0
- package/package.json +20 -13
- package/dist/logger.d.ts +0 -14
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -45
- package/dist/logger.js.map +0 -1
- package/dist/src/config/artifacts.d.ts +0 -3
- package/dist/src/config/artifacts.d.ts.map +0 -1
- package/dist/src/config/artifacts.js +0 -18
- package/dist/src/config/artifacts.js.map +0 -1
- package/dist/src/context.d.ts +0 -388
- package/dist/src/context.d.ts.map +0 -1
- package/dist/src/context.js +0 -30
- package/dist/src/context.js.map +0 -1
- package/dist/src/deploy/TestRecipientDeployer.d.ts +0 -20
- package/dist/src/deploy/TestRecipientDeployer.d.ts.map +0 -1
- package/dist/src/deploy/TestRecipientDeployer.js +0 -36
- package/dist/src/deploy/TestRecipientDeployer.js.map +0 -1
- package/dist/src/deploy/types.d.ts +0 -21
- package/dist/src/deploy/types.d.ts.map +0 -1
- package/examples/anvil-chains.yaml +0 -22
- package/examples/hook-config.yaml +0 -18
- package/examples/warp-tokens.yaml +0 -26
- /package/dist/src/{deploy → context}/types.js +0 -0
|
@@ -1,47 +1,110 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import { DEFAULT_GITHUB_REGISTRY } from '@hyperlane-xyz/registry';
|
|
3
|
+
import { LogFormat, LogLevel } from '@hyperlane-xyz/utils';
|
|
4
|
+
import { ENV } from '../utils/env.js';
|
|
5
|
+
/* Global options */
|
|
6
|
+
export const logFormatCommandOption = {
|
|
7
|
+
type: 'string',
|
|
8
|
+
description: 'Log output format',
|
|
9
|
+
choices: Object.values(LogFormat),
|
|
10
|
+
};
|
|
11
|
+
export const logLevelCommandOption = {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'Log verbosity level',
|
|
14
|
+
choices: Object.values(LogLevel),
|
|
15
|
+
};
|
|
16
|
+
export const registryUriCommandOption = {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Registry URI, such as a Github repo URL or a local file path',
|
|
19
|
+
alias: 'r',
|
|
20
|
+
default: DEFAULT_GITHUB_REGISTRY,
|
|
21
|
+
};
|
|
22
|
+
export const overrideRegistryUriCommandOption = {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Path to a local registry to override the default registry',
|
|
25
|
+
default: `${os.homedir()}/.hyperlane`,
|
|
26
|
+
};
|
|
27
|
+
export const skipConfirmationOption = {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
description: 'Skip confirmation prompts',
|
|
30
|
+
default: false,
|
|
31
|
+
alias: 'y',
|
|
32
|
+
};
|
|
1
33
|
export const keyCommandOption = {
|
|
2
34
|
type: 'string',
|
|
3
|
-
description: 'A hex private key or seed phrase for transaction signing
|
|
4
|
-
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
|
+
default: ENV.HYP_KEY,
|
|
38
|
+
defaultDescription: 'process.env.HYP_KEY',
|
|
5
39
|
};
|
|
6
|
-
|
|
40
|
+
/* Command-specific options */
|
|
41
|
+
export const coreTargetsCommandOption = {
|
|
7
42
|
type: 'string',
|
|
8
|
-
description: '
|
|
9
|
-
default: './configs/chains.yaml',
|
|
10
|
-
alias: 'c',
|
|
43
|
+
description: 'Comma separated list of chain names to which contracts will be deployed',
|
|
11
44
|
};
|
|
12
|
-
export const
|
|
45
|
+
export const agentTargetsCommandOption = {
|
|
13
46
|
type: 'string',
|
|
14
|
-
description: '
|
|
15
|
-
default: './artifacts',
|
|
16
|
-
alias: 'o',
|
|
47
|
+
description: 'Comma separated list of chains to relay between',
|
|
17
48
|
};
|
|
18
|
-
export const
|
|
49
|
+
export const originCommandOption = {
|
|
19
50
|
type: 'string',
|
|
20
|
-
description: '
|
|
21
|
-
alias: 'ca',
|
|
51
|
+
description: 'The name of the origin chain to deploy to',
|
|
22
52
|
};
|
|
23
|
-
export const
|
|
53
|
+
export const ismCommandOption = {
|
|
24
54
|
type: 'string',
|
|
25
|
-
description: '
|
|
26
|
-
alias: 'ac',
|
|
55
|
+
description: 'A path to a JSON or YAML file with basic or advanced ISM configs (e.g. Multisig)',
|
|
27
56
|
};
|
|
28
|
-
export const
|
|
57
|
+
export const hookCommandOption = {
|
|
29
58
|
type: 'string',
|
|
30
|
-
description: '
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
59
|
+
description: 'A path to a JSON or YAML file with Hook configs (for every chain)',
|
|
60
|
+
};
|
|
61
|
+
export const warpDeploymentConfigCommandOption = {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'A path to a JSON or YAML file with a warp route deployment config.',
|
|
64
|
+
default: './configs/warp-route-deployment.yaml',
|
|
65
|
+
alias: 'w',
|
|
66
|
+
};
|
|
67
|
+
export const warpCoreConfigCommandOption = {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'File path to Warp Route config',
|
|
70
|
+
alias: 'w',
|
|
71
|
+
// TODO make this optional and have the commands get it from the registry
|
|
72
|
+
demandOption: true,
|
|
34
73
|
};
|
|
35
|
-
export const
|
|
74
|
+
export const agentConfigCommandOption = (isIn, defaultPath) => ({
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: `${isIn ? 'Input' : 'Output'} file path for the agent configuration`,
|
|
77
|
+
default: defaultPath,
|
|
78
|
+
});
|
|
79
|
+
export const outputFileCommandOption = (defaultPath) => ({
|
|
36
80
|
type: 'string',
|
|
37
81
|
description: 'Output file path',
|
|
38
82
|
default: defaultPath,
|
|
39
83
|
alias: 'o',
|
|
40
84
|
});
|
|
41
|
-
export const
|
|
42
|
-
type: '
|
|
43
|
-
description: '
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
export const inputFileCommandOption = {
|
|
86
|
+
type: 'string',
|
|
87
|
+
description: 'Input file path',
|
|
88
|
+
alias: 'i',
|
|
89
|
+
demandOption: true,
|
|
46
90
|
};
|
|
91
|
+
export const fromAddressCommandOption = {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: `An address to simulate transaction signing on a forked network`,
|
|
94
|
+
alias: 'f',
|
|
95
|
+
};
|
|
96
|
+
export const dryRunCommandOption = {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'Chain name to fork and simulate deployment. Please ensure an anvil node instance is running during execution via `anvil`.',
|
|
99
|
+
alias: 'd',
|
|
100
|
+
};
|
|
101
|
+
export const chainCommandOption = {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: 'The specific chain to perform operations with.',
|
|
104
|
+
};
|
|
105
|
+
export const addressCommandOption = (description, demandOption = false) => ({
|
|
106
|
+
type: 'string',
|
|
107
|
+
description,
|
|
108
|
+
demandOption,
|
|
109
|
+
});
|
|
47
110
|
//# 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":"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O,EAAE,WAAW;IACpB,KAAK,EAAE,GAAG;CACX,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAY;IAC7C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,KAAK,EAAE,GAAG;IACV,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAY;IAC/C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,gEAAgE;IAC7E,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAY;IAC1C,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,2HAA2H;IAC7H,KAAK,EAAE,GAAG;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAY;IACzC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,gDAAgD;CAC9D,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,WAAmB,EACnB,YAAY,GAAG,KAAK,EACX,EAAE,CAAC,CAAC;IACb,IAAI,EAAE,QAAQ;IACd,WAAW;IACX,YAAY;CACb,CAAC,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { CommandModule } from 'yargs';
|
|
1
|
+
import { CommandModule, Options } from 'yargs';
|
|
2
2
|
/**
|
|
3
3
|
* Parent command
|
|
4
4
|
*/
|
|
5
5
|
export declare const sendCommand: CommandModule;
|
|
6
|
+
/**
|
|
7
|
+
* Message command
|
|
8
|
+
*/
|
|
9
|
+
export declare const messageOptions: {
|
|
10
|
+
[k: string]: Options;
|
|
11
|
+
};
|
|
12
|
+
export interface MessageOptionsArgTypes {
|
|
13
|
+
origin?: string;
|
|
14
|
+
destination?: string;
|
|
15
|
+
timeout: number;
|
|
16
|
+
quick: boolean;
|
|
17
|
+
relay: boolean;
|
|
18
|
+
}
|
|
6
19
|
//# sourceMappingURL=send.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"
|
|
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;AAS/C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,aAUzB,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,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { log } from '
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { log } from '../logger.js';
|
|
3
3
|
import { sendTestMessage } from '../send/message.js';
|
|
4
4
|
import { sendTestTransfer } from '../send/transfer.js';
|
|
5
|
-
import {
|
|
5
|
+
import { warpCoreConfigCommandOption } from './options.js';
|
|
6
6
|
/**
|
|
7
7
|
* Parent command
|
|
8
8
|
*/
|
|
@@ -19,20 +19,15 @@ export const sendCommand = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Message command
|
|
21
21
|
*/
|
|
22
|
-
const messageOptions = {
|
|
23
|
-
key: keyCommandOption,
|
|
22
|
+
export const messageOptions = {
|
|
24
23
|
origin: {
|
|
25
24
|
type: 'string',
|
|
26
25
|
description: 'Origin chain to send message from',
|
|
27
|
-
demandOption: true,
|
|
28
26
|
},
|
|
29
27
|
destination: {
|
|
30
28
|
type: 'string',
|
|
31
29
|
description: 'Destination chain to send message to',
|
|
32
|
-
demandOption: true,
|
|
33
30
|
},
|
|
34
|
-
core: coreArtifactsOption,
|
|
35
|
-
chains: chainsCommandOption,
|
|
36
31
|
timeout: {
|
|
37
32
|
type: 'number',
|
|
38
33
|
description: 'Timeout in seconds',
|
|
@@ -43,27 +38,32 @@ const messageOptions = {
|
|
|
43
38
|
description: 'Skip wait for message to be delivered',
|
|
44
39
|
default: false,
|
|
45
40
|
},
|
|
41
|
+
relay: {
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
description: 'Handle self-relay of message on destination chain',
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
46
|
};
|
|
47
47
|
const messageCommand = {
|
|
48
48
|
command: 'message',
|
|
49
49
|
describe: 'Send a test message to a remote chain',
|
|
50
|
-
builder:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
builder: {
|
|
51
|
+
...messageOptions,
|
|
52
|
+
body: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Optional Message body',
|
|
55
|
+
default: 'Hello!',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
handler: async ({ context, origin, destination, timeout, quick, relay, body, }) => {
|
|
59
59
|
await sendTestMessage({
|
|
60
|
-
|
|
61
|
-
chainConfigPath,
|
|
62
|
-
coreArtifactsPath,
|
|
60
|
+
context,
|
|
63
61
|
origin,
|
|
64
62
|
destination,
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
messageBody: ethers.utils.hexlify(ethers.utils.toUtf8Bytes(body)),
|
|
64
|
+
timeoutSec: timeout,
|
|
65
|
+
skipWaitForDelivery: quick,
|
|
66
|
+
selfRelay: relay,
|
|
67
67
|
});
|
|
68
68
|
process.exit(0);
|
|
69
69
|
},
|
|
@@ -74,19 +74,9 @@ const messageCommand = {
|
|
|
74
74
|
const transferCommand = {
|
|
75
75
|
command: 'transfer',
|
|
76
76
|
describe: 'Send a test token transfer on a warp route',
|
|
77
|
-
builder:
|
|
77
|
+
builder: {
|
|
78
78
|
...messageOptions,
|
|
79
|
-
|
|
80
|
-
type: 'string',
|
|
81
|
-
description: 'The address of the token router contract',
|
|
82
|
-
demandOption: true,
|
|
83
|
-
},
|
|
84
|
-
type: {
|
|
85
|
-
type: 'string',
|
|
86
|
-
description: 'Warp token type (native of collateral)',
|
|
87
|
-
default: TokenType.collateral,
|
|
88
|
-
choices: [TokenType.collateral, TokenType.native],
|
|
89
|
-
},
|
|
79
|
+
warp: warpCoreConfigCommandOption,
|
|
90
80
|
wei: {
|
|
91
81
|
type: 'string',
|
|
92
82
|
description: 'Amount in wei to send',
|
|
@@ -96,31 +86,18 @@ const transferCommand = {
|
|
|
96
86
|
type: 'string',
|
|
97
87
|
description: 'Token recipient address (defaults to sender)',
|
|
98
88
|
},
|
|
99
|
-
}
|
|
100
|
-
handler: async (
|
|
101
|
-
const key = argv.key || process.env.HYP_KEY;
|
|
102
|
-
const chainConfigPath = argv.chains;
|
|
103
|
-
const coreArtifactsPath = argv.core;
|
|
104
|
-
const origin = argv.origin;
|
|
105
|
-
const destination = argv.destination;
|
|
106
|
-
const timeoutSec = argv.timeout;
|
|
107
|
-
const routerAddress = argv.router;
|
|
108
|
-
const tokenType = argv.type;
|
|
109
|
-
const wei = argv.wei;
|
|
110
|
-
const recipient = argv.recipient;
|
|
111
|
-
const skipWaitForDelivery = argv.quick;
|
|
89
|
+
},
|
|
90
|
+
handler: async ({ context, origin, destination, timeout, quick, relay, warp, wei, recipient, }) => {
|
|
112
91
|
await sendTestTransfer({
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
coreArtifactsPath,
|
|
92
|
+
context,
|
|
93
|
+
warpConfigPath: warp,
|
|
116
94
|
origin,
|
|
117
95
|
destination,
|
|
118
|
-
routerAddress,
|
|
119
|
-
tokenType,
|
|
120
96
|
wei,
|
|
121
97
|
recipient,
|
|
122
|
-
timeoutSec,
|
|
123
|
-
skipWaitForDelivery,
|
|
98
|
+
timeoutSec: timeout,
|
|
99
|
+
skipWaitForDelivery: quick,
|
|
100
|
+
selfRelay: relay,
|
|
124
101
|
});
|
|
125
102
|
process.exit(0);
|
|
126
103
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../src/commands/send.ts"],"names":[],"mappings":"
|
|
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;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,iCAAiC;IAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,OAAO,CAAC,cAAc,CAAC;SACvB,OAAO,CAAC,eAAe,CAAC;SACxB,OAAO,CAAC,KAAK,CAAC;SACd,aAAa,EAAE;IACpB,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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,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signCommands.d.ts","sourceRoot":"","sources":["../../../src/commands/signCommands.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,UAAqB,CAAC;AAEhD,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAOhD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Commands that send tx and require a key to sign.
|
|
2
|
+
// It's useful to have this listed here so the context
|
|
3
|
+
// middleware can request keys up front when required.
|
|
4
|
+
export const SIGN_COMMANDS = ['deploy', 'send'];
|
|
5
|
+
export function isSignCommand(argv) {
|
|
6
|
+
return (SIGN_COMMANDS.includes(argv._[0]) ||
|
|
7
|
+
(argv._.length > 1 &&
|
|
8
|
+
(SIGN_COMMANDS.includes(argv._[1]) ||
|
|
9
|
+
(argv._[1] === 'avs' && argv._[2] === 'register'))));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=signCommands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signCommands.js","sourceRoot":"","sources":["../../../src/commands/signCommands.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,sDAAsD;AACtD,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEhD,MAAM,UAAU,aAAa,CAAC,IAAS;IACrC,OAAO,CACL,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;YAChB,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CACxD,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { CommandModuleWithContext } from '../context/types.js';
|
|
2
|
+
import { MessageOptionsArgTypes } from './send.js';
|
|
3
|
+
export declare const statusCommand: CommandModuleWithContext<MessageOptionsArgTypes & {
|
|
4
|
+
id?: string;
|
|
5
|
+
}>;
|
|
3
6
|
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,sBAAsB,EAAkB,MAAM,WAAW,CAAC;AAEnE,eAAO,MAAM,aAAa,EAAE,wBAAwB,CAClD,sBAAsB,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBzC,CAAC"}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import { checkMessageStatus } from '../status/message.js';
|
|
2
|
-
import {
|
|
2
|
+
import { messageOptions } from './send.js';
|
|
3
3
|
export const statusCommand = {
|
|
4
4
|
command: 'status',
|
|
5
5
|
describe: 'Check status of a message',
|
|
6
|
-
builder:
|
|
6
|
+
builder: {
|
|
7
|
+
...messageOptions,
|
|
7
8
|
id: {
|
|
8
9
|
type: 'string',
|
|
9
10
|
description: 'Message ID',
|
|
10
|
-
demandOption: true,
|
|
11
11
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
description: 'Destination chain name',
|
|
15
|
-
demandOption: true,
|
|
16
|
-
},
|
|
17
|
-
chains: chainsCommandOption,
|
|
18
|
-
core: coreArtifactsOption,
|
|
19
|
-
}),
|
|
20
|
-
handler: async (argv) => {
|
|
21
|
-
const chainConfigPath = argv.chains;
|
|
22
|
-
const coreArtifactsPath = argv.core;
|
|
23
|
-
const messageId = argv.id;
|
|
24
|
-
const destination = argv.destination;
|
|
12
|
+
},
|
|
13
|
+
handler: async ({ context, origin, destination, id, relay }) => {
|
|
25
14
|
await checkMessageStatus({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
messageId,
|
|
15
|
+
context,
|
|
16
|
+
messageId: id,
|
|
29
17
|
destination,
|
|
18
|
+
origin,
|
|
19
|
+
selfRelay: relay,
|
|
30
20
|
});
|
|
31
21
|
process.exit(0);
|
|
32
22
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAA0B,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,2BAA2B;IACrC,OAAO,EAAE;QACP,GAAG,cAAc;QACjB,EAAE,EAAE;YACF,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,YAAY;SAC1B;KACF;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC7D,MAAM,kBAAkB,CAAC;YACvB,OAAO;YACP,SAAS,EAAE,EAAE;YACb,WAAW;YACX,MAAM;YACN,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare function readChainConfigs(filePath: string):
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
format: FileFormat;
|
|
7
|
-
outPath: string;
|
|
1
|
+
import { ChainMetadata } from '@hyperlane-xyz/sdk';
|
|
2
|
+
import { CommandContext } from '../context/types.js';
|
|
3
|
+
export declare function readChainConfigs(filePath: string): ChainMetadata;
|
|
4
|
+
export declare function createChainConfig({ context, }: {
|
|
5
|
+
context: CommandContext;
|
|
8
6
|
}): Promise<void>;
|
|
9
7
|
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -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,86 +1,112 @@
|
|
|
1
|
-
import { confirm, input
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { confirm, input } from '@inquirer/prompts';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
import { ChainMetadataSchema } from '@hyperlane-xyz/sdk';
|
|
4
|
+
import { ProtocolType } from '@hyperlane-xyz/utils';
|
|
5
|
+
import { errorRed, log, logBlue, logGreen } from '../logger.js';
|
|
6
|
+
import { detectAndConfirmOrPrompt } from '../utils/chains.js';
|
|
7
|
+
import { readYamlOrJson } from '../utils/files.js';
|
|
7
8
|
export function readChainConfigs(filePath) {
|
|
8
9
|
log(`Reading file configs in ${filePath}`);
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
typeof
|
|
12
|
-
!Object.keys(
|
|
10
|
+
const chainMetadata = readYamlOrJson(filePath);
|
|
11
|
+
if (!chainMetadata ||
|
|
12
|
+
typeof chainMetadata !== 'object' ||
|
|
13
|
+
!Object.keys(chainMetadata).length) {
|
|
13
14
|
errorRed(`No configs found in ${filePath}`);
|
|
14
15
|
process.exit(1);
|
|
15
16
|
}
|
|
16
17
|
// Validate configs from file and merge in core configs as needed
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const parseResult = ChainMetadataSchema.safeParse(chainToMetadata[chain]);
|
|
23
|
-
if (!parseResult.success) {
|
|
24
|
-
errorRed(`Chain config for ${chain} is invalid, please see https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/cli/examples/chain-config.yaml for an example`);
|
|
25
|
-
errorRed(JSON.stringify(parseResult.error.errors));
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
if (chainToMetadata[chain].name !== chain) {
|
|
29
|
-
errorRed(`Chain ${chain} name does not match key`);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Ensure MultiProvider accepts this metadata
|
|
34
|
-
getMultiProvider(chainToMetadata);
|
|
35
|
-
logGreen(`All chain configs in ${filePath} are valid`);
|
|
36
|
-
return chainToMetadata;
|
|
37
|
-
}
|
|
38
|
-
export function readChainConfigsIfExists(filePath) {
|
|
39
|
-
if (!isFile(filePath)) {
|
|
40
|
-
log('No chain config file provided');
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return readChainConfigs(filePath);
|
|
18
|
+
const parseResult = ChainMetadataSchema.safeParse(chainMetadata);
|
|
19
|
+
if (!parseResult.success) {
|
|
20
|
+
errorRed(`Chain config for ${filePath} is invalid, please see https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/cli/examples/chain-config.yaml for an example`);
|
|
21
|
+
errorRed(JSON.stringify(parseResult.error.errors));
|
|
22
|
+
process.exit(1);
|
|
45
23
|
}
|
|
24
|
+
return chainMetadata;
|
|
46
25
|
}
|
|
47
|
-
export async function createChainConfig({
|
|
26
|
+
export async function createChainConfig({ context, }) {
|
|
48
27
|
logBlue('Creating a new chain config');
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
const protocol = await select({
|
|
66
|
-
message: 'Select protocol type',
|
|
67
|
-
choices: Object.values(ProtocolType).map((protocol) => ({
|
|
68
|
-
name: protocol,
|
|
69
|
-
value: protocol,
|
|
70
|
-
})),
|
|
71
|
-
});
|
|
72
|
-
const rpcUrl = await input({ message: 'Enter http or https rpc url' });
|
|
28
|
+
const rpcUrl = await detectAndConfirmOrPrompt(async () => {
|
|
29
|
+
await new ethers.providers.JsonRpcProvider().getNetwork();
|
|
30
|
+
return ethers.providers.JsonRpcProvider.defaultUrl();
|
|
31
|
+
}, 'rpc url', 'Enter http or https');
|
|
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
|
+
}, 'chain name', 'Enter (one word, lower case)');
|
|
39
|
+
const chainId = parseInt(await detectAndConfirmOrPrompt(async () => {
|
|
40
|
+
const network = await provider.getNetwork();
|
|
41
|
+
return network.chainId.toString();
|
|
42
|
+
}, 'chain id', 'Enter a (number)'), 10);
|
|
73
43
|
const metadata = {
|
|
74
44
|
name,
|
|
75
|
-
chainId
|
|
76
|
-
domainId:
|
|
77
|
-
protocol,
|
|
45
|
+
chainId,
|
|
46
|
+
domainId: chainId,
|
|
47
|
+
protocol: ProtocolType.Ethereum,
|
|
78
48
|
rpcUrls: [{ http: rpcUrl }],
|
|
79
49
|
};
|
|
50
|
+
const wantAdvancedConfig = await confirm({
|
|
51
|
+
default: false,
|
|
52
|
+
message: 'Do you want to set block or gas properties for this chain config?',
|
|
53
|
+
});
|
|
54
|
+
if (wantAdvancedConfig) {
|
|
55
|
+
const wantBlockConfig = await confirm({
|
|
56
|
+
message: 'Do you want to add block config for this chain?',
|
|
57
|
+
});
|
|
58
|
+
if (wantBlockConfig) {
|
|
59
|
+
const blockConfirmation = await input({
|
|
60
|
+
message: 'Enter no. of blocks to wait before considering a transaction confirmed(0-500)',
|
|
61
|
+
validate: (value) => parseInt(value) >= 0 && parseInt(value) <= 500,
|
|
62
|
+
});
|
|
63
|
+
const blockReorgPeriod = await input({
|
|
64
|
+
message: 'Enter no. of blocks before a transaction has a near-zero chance of reverting(0-500)',
|
|
65
|
+
validate: (value) => parseInt(value) >= 0 && parseInt(value) <= 500,
|
|
66
|
+
});
|
|
67
|
+
const blockTimeEstimate = await input({
|
|
68
|
+
message: 'Enter the rough estimate of time per block in seconds(0-20)',
|
|
69
|
+
validate: (value) => parseInt(value) >= 0 && parseInt(value) <= 20,
|
|
70
|
+
});
|
|
71
|
+
metadata.blocks = {
|
|
72
|
+
confirmations: parseInt(blockConfirmation, 10),
|
|
73
|
+
reorgPeriod: parseInt(blockReorgPeriod, 10),
|
|
74
|
+
estimateBlockTime: parseInt(blockTimeEstimate, 10),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const wantGasConfig = await confirm({
|
|
78
|
+
message: 'Do you want to add gas config for this chain?',
|
|
79
|
+
});
|
|
80
|
+
if (wantGasConfig) {
|
|
81
|
+
const isEIP1559 = await confirm({
|
|
82
|
+
message: 'Is your chain an EIP1559 enabled?',
|
|
83
|
+
});
|
|
84
|
+
if (isEIP1559) {
|
|
85
|
+
const maxFeePerGas = await input({
|
|
86
|
+
message: 'Enter the max fee per gas in gwei',
|
|
87
|
+
});
|
|
88
|
+
const maxPriorityFeePerGas = await input({
|
|
89
|
+
message: 'Enter the max priority fee per gas in gwei',
|
|
90
|
+
});
|
|
91
|
+
metadata.transactionOverrides = {
|
|
92
|
+
maxFeePerGas: BigInt(maxFeePerGas) * BigInt(10 ** 9),
|
|
93
|
+
maxPriorityFeePerGas: BigInt(maxPriorityFeePerGas) * BigInt(10 ** 9),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const gasPrice = await input({
|
|
98
|
+
message: 'Enter the gas price in gwei',
|
|
99
|
+
});
|
|
100
|
+
metadata.transactionOverrides = {
|
|
101
|
+
gasPrice: BigInt(gasPrice) * BigInt(10 ** 9),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
80
106
|
const parseResult = ChainMetadataSchema.safeParse(metadata);
|
|
81
107
|
if (parseResult.success) {
|
|
82
|
-
logGreen(`Chain config is valid, writing to
|
|
83
|
-
|
|
108
|
+
logGreen(`Chain config is valid, writing to registry`);
|
|
109
|
+
await context.registry.updateChain({ chainName: metadata.name, metadata });
|
|
84
110
|
}
|
|
85
111
|
else {
|
|
86
112
|
errorRed(`Chain config is invalid, please see https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/cli/examples/chain-config.yaml for an example`);
|