@hyperlane-xyz/cli 3.1.10 → 3.3.0
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/dist/cli.js +6 -5
- package/dist/cli.js.map +1 -1
- package/dist/src/commands/chains.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +44 -14
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/deploy.js +11 -8
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/options.d.ts.map +1 -1
- package/dist/src/commands/options.js +1 -2
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/send.js +2 -5
- package/dist/src/commands/send.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +0 -2
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/config/artifacts.d.ts +2 -1
- package/dist/src/config/artifacts.d.ts.map +1 -1
- package/dist/src/config/artifacts.js +24 -2
- package/dist/src/config/artifacts.js.map +1 -1
- package/dist/src/config/chain.d.ts +1 -1
- package/dist/src/config/chain.d.ts.map +1 -1
- package/dist/src/config/chain.js +1 -1
- package/dist/src/config/chain.js.map +1 -1
- package/dist/src/config/hooks.d.ts +89 -211
- package/dist/src/config/hooks.d.ts.map +1 -1
- package/dist/src/config/hooks.js +221 -85
- package/dist/src/config/hooks.js.map +1 -1
- package/dist/src/config/ism.d.ts +57 -0
- package/dist/src/config/ism.d.ts.map +1 -0
- package/dist/src/config/ism.js +199 -0
- package/dist/src/config/ism.js.map +1 -0
- package/dist/src/config/multisig.d.ts +1 -10
- package/dist/src/config/multisig.d.ts.map +1 -1
- package/dist/src/config/multisig.js +29 -22
- package/dist/src/config/multisig.js.map +1 -1
- package/dist/src/config/warp.js.map +1 -1
- package/dist/src/context.d.ts +32 -384
- package/dist/src/context.d.ts.map +1 -1
- package/dist/src/context.js +32 -11
- package/dist/src/context.js.map +1 -1
- package/dist/src/context.test.d.ts +2 -0
- package/dist/src/context.test.d.ts.map +1 -0
- package/dist/src/context.test.js +21 -0
- package/dist/src/context.test.js.map +1 -0
- package/dist/src/deploy/TestRecipientDeployer.js.map +1 -1
- package/dist/src/deploy/agent.d.ts +3 -2
- package/dist/src/deploy/agent.d.ts.map +1 -1
- package/dist/src/deploy/agent.js +10 -22
- package/dist/src/deploy/agent.js.map +1 -1
- package/dist/src/deploy/core.d.ts +3 -1
- package/dist/src/deploy/core.d.ts.map +1 -1
- package/dist/src/deploy/core.js +85 -96
- package/dist/src/deploy/core.js.map +1 -1
- package/dist/src/deploy/utils.d.ts +3 -1
- package/dist/src/deploy/utils.d.ts.map +1 -1
- package/dist/src/deploy/utils.js +9 -0
- 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 +9 -9
- package/dist/src/deploy/warp.js.map +1 -1
- package/dist/src/send/message.d.ts +3 -3
- package/dist/src/send/message.d.ts.map +1 -1
- package/dist/src/send/message.js +13 -8
- package/dist/src/send/message.js.map +1 -1
- package/dist/src/send/transfer.d.ts +4 -4
- package/dist/src/send/transfer.d.ts.map +1 -1
- package/dist/src/send/transfer.js +22 -11
- package/dist/src/send/transfer.js.map +1 -1
- package/dist/src/status/message.d.ts +3 -3
- package/dist/src/status/message.d.ts.map +1 -1
- package/dist/src/status/message.js +14 -5
- package/dist/src/status/message.js.map +1 -1
- 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.js.map +1 -1
- package/dist/src/utils/chains.d.ts +1 -1
- package/dist/src/utils/chains.d.ts.map +1 -1
- package/dist/src/utils/chains.js +5 -4
- package/dist/src/utils/chains.js.map +1 -1
- package/dist/src/utils/files.d.ts.map +1 -1
- package/dist/src/utils/files.js +5 -0
- package/dist/src/utils/files.js.map +1 -1
- 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/hooks.yaml +66 -0
- package/examples/ism-advanced.yaml +33 -0
- package/examples/{multisig-ism.yaml → ism.yaml} +0 -8
- package/package.json +9 -6
- package/examples/hook-config.yaml +0 -18
package/dist/src/config/hooks.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { confirm, input, select } from '@inquirer/prompts';
|
|
2
|
-
import { BigNumber } from 'bignumber.js';
|
|
2
|
+
import { BigNumber as BigNumberJs } from 'bignumber.js';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { GasOracleContractType, HookType, defaultMultisigConfigs, multisigIsmVerificationCost, } from '@hyperlane-xyz/sdk';
|
|
5
|
+
import { GasOracleContractType, HookType, chainMetadata, defaultMultisigConfigs, multisigIsmVerificationCost, } from '@hyperlane-xyz/sdk';
|
|
6
6
|
import { normalizeAddressEvm, objMap, toWei, } from '@hyperlane-xyz/utils';
|
|
7
7
|
import { errorRed, log, logBlue, logGreen, logRed } from '../../logger.js';
|
|
8
8
|
import { runMultiChainSelectionStep } from '../utils/chains.js';
|
|
@@ -18,16 +18,39 @@ const ProtocolFeeSchema = z.object({
|
|
|
18
18
|
const MerkleTreeSchema = z.object({
|
|
19
19
|
type: z.literal(HookType.MERKLE_TREE),
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const IGPSchema = z.object({
|
|
22
|
+
type: z.literal(HookType.INTERCHAIN_GAS_PAYMASTER),
|
|
23
|
+
owner: z.string(),
|
|
24
|
+
beneficiary: z.string(),
|
|
25
|
+
overhead: z.record(z.number()),
|
|
26
|
+
gasOracleType: z.record(z.literal(GasOracleContractType.StorageGasOracle)),
|
|
27
|
+
oracleKey: z.string(),
|
|
25
28
|
});
|
|
26
|
-
const
|
|
29
|
+
const RoutingConfigSchema = z.lazy(() => z.object({
|
|
30
|
+
type: z.literal(HookType.ROUTING),
|
|
31
|
+
owner: z.string(),
|
|
32
|
+
domains: z.record(HookConfigSchema),
|
|
33
|
+
}));
|
|
34
|
+
const AggregationConfigSchema = z.lazy(() => z.object({
|
|
35
|
+
type: z.literal(HookType.AGGREGATION),
|
|
36
|
+
hooks: z.array(HookConfigSchema),
|
|
37
|
+
}));
|
|
38
|
+
const HookConfigSchema = z.union([
|
|
39
|
+
ProtocolFeeSchema,
|
|
40
|
+
MerkleTreeSchema,
|
|
41
|
+
IGPSchema,
|
|
42
|
+
RoutingConfigSchema,
|
|
43
|
+
AggregationConfigSchema,
|
|
44
|
+
]);
|
|
45
|
+
const HooksConfigSchema = z.object({
|
|
46
|
+
required: HookConfigSchema,
|
|
47
|
+
default: HookConfigSchema,
|
|
48
|
+
});
|
|
49
|
+
const HooksConfigMapSchema = z.record(HooksConfigSchema);
|
|
27
50
|
export function isValidHookConfigMap(config) {
|
|
28
|
-
return
|
|
51
|
+
return HooksConfigMapSchema.safeParse(config).success;
|
|
29
52
|
}
|
|
30
|
-
export function presetHookConfigs(owner, local, destinationChains,
|
|
53
|
+
export function presetHookConfigs(owner, local, destinationChains, multisigConfig) {
|
|
31
54
|
const gasOracleType = destinationChains.reduce((acc, chain) => {
|
|
32
55
|
acc[chain] = GasOracleContractType.StorageGasOracle;
|
|
33
56
|
return acc;
|
|
@@ -35,16 +58,19 @@ export function presetHookConfigs(owner, local, destinationChains, ismConfig) {
|
|
|
35
58
|
const overhead = destinationChains.reduce((acc, chain) => {
|
|
36
59
|
let validatorThreshold;
|
|
37
60
|
let validatorCount;
|
|
38
|
-
if (
|
|
39
|
-
validatorThreshold =
|
|
40
|
-
validatorCount =
|
|
61
|
+
if (multisigConfig) {
|
|
62
|
+
validatorThreshold = multisigConfig.threshold;
|
|
63
|
+
validatorCount = multisigConfig.validators.length;
|
|
41
64
|
}
|
|
42
65
|
else if (local in defaultMultisigConfigs) {
|
|
43
66
|
validatorThreshold = defaultMultisigConfigs[local].threshold;
|
|
44
67
|
validatorCount = defaultMultisigConfigs[local].validators.length;
|
|
45
68
|
}
|
|
46
69
|
else {
|
|
47
|
-
|
|
70
|
+
// default values
|
|
71
|
+
// fix here: https://github.com/hyperlane-xyz/issues/issues/773
|
|
72
|
+
validatorThreshold = 2;
|
|
73
|
+
validatorCount = 3;
|
|
48
74
|
}
|
|
49
75
|
acc[chain] = multisigIsmVerificationCost(validatorThreshold, validatorCount);
|
|
50
76
|
return acc;
|
|
@@ -53,8 +79,8 @@ export function presetHookConfigs(owner, local, destinationChains, ismConfig) {
|
|
|
53
79
|
return {
|
|
54
80
|
required: {
|
|
55
81
|
type: HookType.PROTOCOL_FEE,
|
|
56
|
-
maxProtocolFee: ethers.utils.parseUnits('1', 'gwei'),
|
|
57
|
-
protocolFee: ethers.utils.parseUnits('0', 'wei'),
|
|
82
|
+
maxProtocolFee: ethers.utils.parseUnits('1', 'gwei').toString(),
|
|
83
|
+
protocolFee: ethers.utils.parseUnits('0', 'wei').toString(),
|
|
58
84
|
beneficiary: owner,
|
|
59
85
|
owner: owner,
|
|
60
86
|
},
|
|
@@ -76,27 +102,23 @@ export function presetHookConfigs(owner, local, destinationChains, ismConfig) {
|
|
|
76
102
|
},
|
|
77
103
|
};
|
|
78
104
|
}
|
|
79
|
-
export function
|
|
105
|
+
export function readHooksConfigMap(filePath) {
|
|
80
106
|
const config = readYamlOrJson(filePath);
|
|
81
107
|
if (!config) {
|
|
82
|
-
logRed(`No
|
|
108
|
+
logRed(`No hook config found at ${filePath}`);
|
|
83
109
|
return;
|
|
84
110
|
}
|
|
85
|
-
const result =
|
|
111
|
+
const result = HooksConfigMapSchema.safeParse(config);
|
|
86
112
|
if (!result.success) {
|
|
87
113
|
const firstIssue = result.error.issues[0];
|
|
88
114
|
throw new Error(`Invalid hook config: ${firstIssue.path} => ${firstIssue.message}`);
|
|
89
115
|
}
|
|
90
116
|
const parsedConfig = result.data;
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
logGreen(`All multisig configs in ${filePath} are valid`);
|
|
95
|
-
return defaultHook;
|
|
117
|
+
const hooks = objMap(parsedConfig, (_, config) => config);
|
|
118
|
+
logGreen(`All hook configs in ${filePath} are valid for ${hooks}`);
|
|
119
|
+
return hooks;
|
|
96
120
|
}
|
|
97
|
-
|
|
98
|
-
// export async function readProtocolFeeHookConfig(config: {type: HookType.PROTOCOL_FEE, ...}) {
|
|
99
|
-
export async function createHookConfig({ format, outPath, chainConfigPath, }) {
|
|
121
|
+
export async function createHooksConfigMap({ format, outPath, chainConfigPath, }) {
|
|
100
122
|
logBlue('Creating a new hook config');
|
|
101
123
|
const customChains = readChainConfigsIfExists(chainConfigPath);
|
|
102
124
|
const chains = await runMultiChainSelectionStep(customChains);
|
|
@@ -104,73 +126,187 @@ export async function createHookConfig({ format, outPath, chainConfigPath, }) {
|
|
|
104
126
|
for (const chain of chains) {
|
|
105
127
|
for (const hookRequirements of ['required', 'default']) {
|
|
106
128
|
log(`Setting ${hookRequirements} hook for chain ${chain}`);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
],
|
|
113
|
-
pageSize: 5,
|
|
114
|
-
});
|
|
115
|
-
if (hookType === 'merkle_tree') {
|
|
116
|
-
result[chain] = {
|
|
117
|
-
...result[chain],
|
|
118
|
-
[hookRequirements]: { type: HookType.MERKLE_TREE },
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
else if (hookType === 'protocol_fee') {
|
|
122
|
-
const owner = await input({
|
|
123
|
-
message: 'Enter owner address',
|
|
124
|
-
});
|
|
125
|
-
const ownerAddress = normalizeAddressEvm(owner);
|
|
126
|
-
let beneficiary;
|
|
127
|
-
let sameAsOwner = false;
|
|
128
|
-
sameAsOwner = await confirm({
|
|
129
|
-
message: 'Use this same address for the beneficiary?',
|
|
130
|
-
});
|
|
131
|
-
if (sameAsOwner) {
|
|
132
|
-
beneficiary = ownerAddress;
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
beneficiary = await input({
|
|
136
|
-
message: 'Enter beneficiary address',
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
const beneficiaryAddress = normalizeAddressEvm(beneficiary);
|
|
140
|
-
// TODO: input in gwei, wei, etc
|
|
141
|
-
const maxProtocolFee = toWei(await input({
|
|
142
|
-
message: 'Enter max protocol fee in (e.g. 1.0)',
|
|
143
|
-
}));
|
|
144
|
-
const protocolFee = toWei(await input({
|
|
145
|
-
message: 'Enter protocol fee (e.g. 1.0)',
|
|
146
|
-
}));
|
|
147
|
-
if (BigNumber(protocolFee).gt(maxProtocolFee)) {
|
|
148
|
-
errorRed('Protocol fee cannot be greater than max protocol fee');
|
|
149
|
-
throw new Error('Invalid protocol fee');
|
|
150
|
-
}
|
|
151
|
-
result[chain] = {
|
|
152
|
-
...result[chain],
|
|
153
|
-
[hookRequirements]: {
|
|
154
|
-
type: HookType.PROTOCOL_FEE,
|
|
155
|
-
maxProtocolFee: maxProtocolFee.toString(),
|
|
156
|
-
protocolFee: protocolFee.toString(),
|
|
157
|
-
beneficiary: beneficiaryAddress,
|
|
158
|
-
owner: ownerAddress,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
throw new Error(`Invalid hook type: ${hookType}}`);
|
|
164
|
-
}
|
|
129
|
+
const remotes = chains.filter((c) => c !== chain);
|
|
130
|
+
result[chain] = {
|
|
131
|
+
...result[chain],
|
|
132
|
+
[hookRequirements]: await createHookConfig(chain, remotes),
|
|
133
|
+
};
|
|
165
134
|
}
|
|
166
135
|
if (isValidHookConfigMap(result)) {
|
|
167
136
|
logGreen(`Hook config is valid, writing to file ${outPath}`);
|
|
168
137
|
mergeYamlOrJson(outPath, result, format);
|
|
169
138
|
}
|
|
170
139
|
else {
|
|
171
|
-
errorRed(`Hook config is invalid, please see https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/cli/examples/
|
|
140
|
+
errorRed(`Hook config is invalid, please see https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/cli/examples/hooks.yaml for an example`);
|
|
172
141
|
throw new Error('Invalid hook config');
|
|
173
142
|
}
|
|
174
143
|
}
|
|
175
144
|
}
|
|
145
|
+
export async function createHookConfig(chain, remotes) {
|
|
146
|
+
let lastConfig;
|
|
147
|
+
const hookType = await select({
|
|
148
|
+
message: 'Select hook type',
|
|
149
|
+
choices: [
|
|
150
|
+
{
|
|
151
|
+
value: HookType.MERKLE_TREE,
|
|
152
|
+
name: HookType.MERKLE_TREE,
|
|
153
|
+
description: 'Add messages to the incremental merkle tree on origin chain (needed for the merkleRootMultisigIsm on the remote chain)',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
value: HookType.PROTOCOL_FEE,
|
|
157
|
+
name: HookType.PROTOCOL_FEE,
|
|
158
|
+
description: 'Charge fees for each message dispatch from this chain',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
value: HookType.INTERCHAIN_GAS_PAYMASTER,
|
|
162
|
+
name: HookType.INTERCHAIN_GAS_PAYMASTER,
|
|
163
|
+
description: 'Allow for payments for expected gas to be paid by the relayer while delivering on remote chain',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
value: HookType.AGGREGATION,
|
|
167
|
+
name: HookType.AGGREGATION,
|
|
168
|
+
description: 'Aggregate multiple hooks into a single hook (e.g. merkle tree + IGP) which will be called in sequence',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: HookType.ROUTING,
|
|
172
|
+
name: HookType.ROUTING,
|
|
173
|
+
description: 'Each destination domain can have its own hook configured via DomainRoutingHook',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
pageSize: 10,
|
|
177
|
+
});
|
|
178
|
+
if (hookType === HookType.MERKLE_TREE) {
|
|
179
|
+
lastConfig = { type: HookType.MERKLE_TREE };
|
|
180
|
+
}
|
|
181
|
+
else if (hookType === HookType.PROTOCOL_FEE) {
|
|
182
|
+
lastConfig = await createProtocolFeeConfig(chain);
|
|
183
|
+
}
|
|
184
|
+
else if (hookType === HookType.INTERCHAIN_GAS_PAYMASTER) {
|
|
185
|
+
lastConfig = await createIGPConfig(remotes);
|
|
186
|
+
}
|
|
187
|
+
else if (hookType === HookType.AGGREGATION) {
|
|
188
|
+
lastConfig = await createAggregationConfig(chain, remotes);
|
|
189
|
+
}
|
|
190
|
+
else if (hookType === HookType.ROUTING) {
|
|
191
|
+
lastConfig = await createRoutingConfig(chain, remotes);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
throw new Error(`Invalid hook type: ${hookType}`);
|
|
195
|
+
}
|
|
196
|
+
return lastConfig;
|
|
197
|
+
}
|
|
198
|
+
export async function createProtocolFeeConfig(chain) {
|
|
199
|
+
const owner = await input({
|
|
200
|
+
message: 'Enter owner address',
|
|
201
|
+
});
|
|
202
|
+
const ownerAddress = normalizeAddressEvm(owner);
|
|
203
|
+
let beneficiary;
|
|
204
|
+
let sameAsOwner = false;
|
|
205
|
+
sameAsOwner = await confirm({
|
|
206
|
+
message: 'Use this same address for the beneficiary?',
|
|
207
|
+
});
|
|
208
|
+
if (sameAsOwner) {
|
|
209
|
+
beneficiary = ownerAddress;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
beneficiary = await input({
|
|
213
|
+
message: 'Enter beneficiary address',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const beneficiaryAddress = normalizeAddressEvm(beneficiary);
|
|
217
|
+
// TODO: input in gwei, wei, etc
|
|
218
|
+
const maxProtocolFee = toWei(await input({
|
|
219
|
+
message: `Enter max protocol fee ${nativeTokenAndDecimals(chain)} e.g. 1.0)`,
|
|
220
|
+
}));
|
|
221
|
+
const protocolFee = toWei(await input({
|
|
222
|
+
message: `Enter protocol fee in ${nativeTokenAndDecimals(chain)} e.g. 0.01)`,
|
|
223
|
+
}));
|
|
224
|
+
if (BigNumberJs(protocolFee).gt(maxProtocolFee)) {
|
|
225
|
+
errorRed('Protocol fee cannot be greater than max protocol fee');
|
|
226
|
+
throw new Error('Invalid protocol fee');
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
type: HookType.PROTOCOL_FEE,
|
|
230
|
+
maxProtocolFee: maxProtocolFee.toString(),
|
|
231
|
+
protocolFee: protocolFee.toString(),
|
|
232
|
+
beneficiary: beneficiaryAddress,
|
|
233
|
+
owner: ownerAddress,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
export async function createIGPConfig(remotes) {
|
|
237
|
+
const owner = await input({
|
|
238
|
+
message: 'Enter owner address',
|
|
239
|
+
});
|
|
240
|
+
const ownerAddress = normalizeAddressEvm(owner);
|
|
241
|
+
let beneficiary, oracleKey;
|
|
242
|
+
let sameAsOwner = false;
|
|
243
|
+
sameAsOwner = await confirm({
|
|
244
|
+
message: 'Use this same address for the beneficiary and gasOracleKey?',
|
|
245
|
+
});
|
|
246
|
+
if (sameAsOwner) {
|
|
247
|
+
beneficiary = ownerAddress;
|
|
248
|
+
oracleKey = ownerAddress;
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
beneficiary = await input({
|
|
252
|
+
message: 'Enter beneficiary address',
|
|
253
|
+
});
|
|
254
|
+
oracleKey = await input({
|
|
255
|
+
message: 'Enter gasOracleKey address',
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
const beneficiaryAddress = normalizeAddressEvm(beneficiary);
|
|
259
|
+
const oracleKeyAddress = normalizeAddressEvm(oracleKey);
|
|
260
|
+
const overheads = {};
|
|
261
|
+
for (const chain of remotes) {
|
|
262
|
+
const overhead = parseInt(await input({
|
|
263
|
+
message: `Enter overhead for ${chain} (eg 75000)`,
|
|
264
|
+
}));
|
|
265
|
+
overheads[chain] = overhead;
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
type: HookType.INTERCHAIN_GAS_PAYMASTER,
|
|
269
|
+
beneficiary: beneficiaryAddress,
|
|
270
|
+
owner: ownerAddress,
|
|
271
|
+
oracleKey: oracleKeyAddress,
|
|
272
|
+
overhead: overheads,
|
|
273
|
+
gasOracleType: objMap(overheads, () => GasOracleContractType.StorageGasOracle),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export async function createAggregationConfig(chain, remotes) {
|
|
277
|
+
const hooksNum = parseInt(await input({
|
|
278
|
+
message: 'Enter the number of hooks to aggregate (number)',
|
|
279
|
+
}), 10);
|
|
280
|
+
const hooks = [];
|
|
281
|
+
for (let i = 0; i < hooksNum; i++) {
|
|
282
|
+
logBlue(`Creating hook ${i + 1} of ${hooksNum} ...`);
|
|
283
|
+
hooks.push(await createHookConfig(chain, remotes));
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
type: HookType.AGGREGATION,
|
|
287
|
+
hooks,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
export async function createRoutingConfig(origin, remotes) {
|
|
291
|
+
const owner = await input({
|
|
292
|
+
message: 'Enter owner address',
|
|
293
|
+
});
|
|
294
|
+
const ownerAddress = owner;
|
|
295
|
+
const domainsMap = {};
|
|
296
|
+
for (const chain of remotes) {
|
|
297
|
+
await confirm({
|
|
298
|
+
message: `You are about to configure hook for remote chain ${chain}. Continue?`,
|
|
299
|
+
});
|
|
300
|
+
const config = await createHookConfig(origin, remotes);
|
|
301
|
+
domainsMap[chain] = config;
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
type: HookType.ROUTING,
|
|
305
|
+
owner: ownerAddress,
|
|
306
|
+
domains: domainsMap,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function nativeTokenAndDecimals(chain) {
|
|
310
|
+
return `10^${chainMetadata[chain].nativeToken?.decimals ?? '18'} which you cannot exceed (in ${chainMetadata[chain].nativeToken?.symbol ?? 'eth'}`;
|
|
311
|
+
}
|
|
176
312
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/config/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/config/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,qBAAqB,EACrB,QAAQ,EAGR,aAAa,EACb,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,mBAAmB,EACnB,MAAM,EACN,KAAK,GACN,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAc,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,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AAC;QACrD,KAAK,CAAC,IAAI,CAAC,MAAM,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,WAAW;QAC1B,KAAK;KACN,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAiB,EACjB,OAAoB;IAEpB,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC;QACxB,OAAO,EAAE,qBAAqB;KAC/B,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,KAAK,CAAC;IAE3B,MAAM,UAAU,GAAyB,EAAE,CAAC;IAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,OAAO,CAAC;YACZ,OAAO,EAAE,oDAAoD,KAAK,aAAa;SAChF,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvD,UAAU,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;IAC7B,CAAC;IACD,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,OAAO;QACtB,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,UAAU;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAgB;IAC9C,OAAO,MACL,aAAa,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,QAAQ,IAAI,IAChD,gCACE,aAAa,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,MAAM,IAAI,KAC9C,EAAE,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ChainName, IsmType } from '@hyperlane-xyz/sdk';
|
|
3
|
+
import { FileFormat } from '../utils/files.js';
|
|
4
|
+
declare const IsmConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
5
|
+
type: z.ZodUnion<[z.ZodLiteral<IsmType.MERKLE_ROOT_MULTISIG>, z.ZodLiteral<IsmType.MESSAGE_ID_MULTISIG>]>;
|
|
6
|
+
threshold: z.ZodNumber;
|
|
7
|
+
validators: z.ZodArray<z.ZodString, "many">;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
type: IsmType.MERKLE_ROOT_MULTISIG | IsmType.MESSAGE_ID_MULTISIG;
|
|
10
|
+
threshold: number;
|
|
11
|
+
validators: string[];
|
|
12
|
+
}, {
|
|
13
|
+
type: IsmType.MERKLE_ROOT_MULTISIG | IsmType.MESSAGE_ID_MULTISIG;
|
|
14
|
+
threshold: number;
|
|
15
|
+
validators: string[];
|
|
16
|
+
}>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<IsmType.TEST_ISM>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
type: IsmType.TEST_ISM;
|
|
20
|
+
}, {
|
|
21
|
+
type: IsmType.TEST_ISM;
|
|
22
|
+
}>]>;
|
|
23
|
+
declare const IsmConfigMapSchema: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
24
|
+
type: z.ZodUnion<[z.ZodLiteral<IsmType.MERKLE_ROOT_MULTISIG>, z.ZodLiteral<IsmType.MESSAGE_ID_MULTISIG>]>;
|
|
25
|
+
threshold: z.ZodNumber;
|
|
26
|
+
validators: z.ZodArray<z.ZodString, "many">;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
type: IsmType.MERKLE_ROOT_MULTISIG | IsmType.MESSAGE_ID_MULTISIG;
|
|
29
|
+
threshold: number;
|
|
30
|
+
validators: string[];
|
|
31
|
+
}, {
|
|
32
|
+
type: IsmType.MERKLE_ROOT_MULTISIG | IsmType.MESSAGE_ID_MULTISIG;
|
|
33
|
+
threshold: number;
|
|
34
|
+
validators: string[];
|
|
35
|
+
}>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>, z.ZodObject<{
|
|
36
|
+
type: z.ZodLiteral<IsmType.TEST_ISM>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
type: IsmType.TEST_ISM;
|
|
39
|
+
}, {
|
|
40
|
+
type: IsmType.TEST_ISM;
|
|
41
|
+
}>]>>, Record<string, any>, Record<string, any>>;
|
|
42
|
+
export type ZodIsmConfig = z.infer<typeof IsmConfigSchema>;
|
|
43
|
+
export type ZodIsmConfigMap = z.infer<typeof IsmConfigMapSchema>;
|
|
44
|
+
export declare function parseIsmConfig(filePath: string): z.SafeParseReturnType<Record<string, any>, Record<string, any>>;
|
|
45
|
+
export declare function readIsmConfig(filePath: string): Record<string, any>;
|
|
46
|
+
export declare function isValildIsmConfig(config: any): boolean;
|
|
47
|
+
export declare function createIsmConfigMap({ format, outPath, chainConfigPath, }: {
|
|
48
|
+
format: FileFormat;
|
|
49
|
+
outPath: string;
|
|
50
|
+
chainConfigPath: string;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
export declare function createIsmConfig(remote: ChainName, origins: ChainName[]): Promise<ZodIsmConfig>;
|
|
53
|
+
export declare function createMultisigConfig(type: IsmType.MERKLE_ROOT_MULTISIG | IsmType.MESSAGE_ID_MULTISIG): Promise<ZodIsmConfig>;
|
|
54
|
+
export declare function createAggregationConfig(remote: ChainName, chains: ChainName[]): Promise<ZodIsmConfig>;
|
|
55
|
+
export declare function createRoutingConfig(remote: ChainName, chains: ChainName[]): Promise<ZodIsmConfig>;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=ism.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ism.d.ts","sourceRoot":"","sources":["../../../src/config/ism.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAY,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,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