Skip to content

Commit

Permalink
Fix build errors from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed Aug 6, 2023
1 parent f686eb2 commit ce5fbfc
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 49 deletions.
7 changes: 2 additions & 5 deletions typescript/cli/src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import { input } from '@inquirer/prompts';
import select from '@inquirer/select';
import { CommandModule } from 'yargs';

import {
ChainMetadata,
ProtocolType,
isValidChainMetadata,
} from '@hyperlane-xyz/sdk';
import { ChainMetadata, isValidChainMetadata } from '@hyperlane-xyz/sdk';
import { ProtocolType } from '@hyperlane-xyz/utils';

import { readChainConfig } from '../configs.js';
import { errorRed, logBlue, logGreen } from '../logger.js';
Expand Down
8 changes: 4 additions & 4 deletions typescript/cli/src/commands/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ const messageCommand: CommandModule = {
const coreArtifactsPath: string = argv.core;
const origin: string = argv.origin;
const destination: string = argv.destination;
const timeout: number = argv.timeout;
const timeoutSec: number = argv.timeout;
await sendTestMessage({
key,
chainConfigPath,
coreArtifactsPath,
origin,
destination,
timeout,
timeoutSec,
});
process.exit(0);
},
Expand Down Expand Up @@ -102,7 +102,7 @@ const transferCommand: CommandModule = {
const coreArtifactsPath: string = argv.core;
const origin: string = argv.origin;
const destination: string = argv.destination;
const timeout: number = argv.timeout;
const timeoutSec: number = argv.timeout;
const routerAddress: string = argv.router;
const wei: string = argv.wei;
const recipient: string | undefined = argv.recipient;
Expand All @@ -115,7 +115,7 @@ const transferCommand: CommandModule = {
routerAddress,
wei,
recipient,
timeout,
timeoutSec,
});
process.exit(0);
},
Expand Down
2 changes: 1 addition & 1 deletion typescript/cli/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
MultiProvider,
chainMetadata,
hyperlaneEnvironments,
objMerge,
} from '@hyperlane-xyz/sdk';
import { objMerge } from '@hyperlane-xyz/utils';

import { readChainConfigIfExists } from './configs.js';
import { keyToSigner } from './utils/keys.js';
Expand Down
8 changes: 4 additions & 4 deletions typescript/cli/src/deploy/TestRecipientDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
HyperlaneDeployer,
MultiProvider,
} from '@hyperlane-xyz/sdk';
import { types, utils } from '@hyperlane-xyz/utils';
import { Address, eqAddress } from '@hyperlane-xyz/utils';

export type TestRecipientConfig = {
interchainSecurityModule: types.Address;
interchainSecurityModule: Address;
};

export type TestRecipientContracts = {
testRecipient: TestRecipient;
};

export type TestRecipientAddresses = {
testRecipient: types.Address;
testRecipient: Address;
};

export const testRecipientFactories = {
Expand All @@ -43,7 +43,7 @@ export class TestRecipientDeployer extends HyperlaneDeployer<
this.logger(`Checking ISM ${chain}`);
const ism = await testRecipient.interchainSecurityModule();
this.logger(`Found ISM for on ${chain}: ${ism}`);
if (!utils.eqAddress(ism, config.interchainSecurityModule)) {
if (!eqAddress(ism, config.interchainSecurityModule)) {
this.logger(`Current ISM does not match config. Updating.`);
const tx = testRecipient.setInterchainSecurityModule(
config.interchainSecurityModule,
Expand Down
12 changes: 5 additions & 7 deletions typescript/cli/src/deploy/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ import {
defaultMultisigIsmConfigs,
mainnetChainsMetadata,
multisigIsmVerificationCost,
objFilter,
objMerge,
serializeContractsMap,
testnetChainsMetadata,
} from '@hyperlane-xyz/sdk';
import { types } from '@hyperlane-xyz/utils';
import { Address, objFilter, objMerge } from '@hyperlane-xyz/utils';

import { readDeploymentArtifacts, readMultisigConfig } from '../configs.js';
import { MINIMUM_CORE_DEPLOY_BALANCE } from '../consts.js';
Expand Down Expand Up @@ -343,7 +341,7 @@ async function executeDeploy({
}

function buildIsmConfig(
owner: types.Address,
owner: Address,
remotes: ChainName[],
multisigIsmConfigs: ChainMap<MultisigIsmConfig>,
): RoutingIsmConfig {
Expand All @@ -361,7 +359,7 @@ function buildIsmConfig(
}

function buildIsmConfigMap(
owner: types.Address,
owner: Address,
chains: ChainName[],
remotes: ChainName[],
multisigIsmConfigs: ChainMap<MultisigIsmConfig>,
Expand All @@ -379,7 +377,7 @@ function buildIsmConfigMap(
}

function buildCoreConfigMap(
owner: types.Address,
owner: Address,
local: ChainName,
remotes: ChainName[],
multisigIsmConfigs: ChainMap<MultisigIsmConfig>,
Expand Down Expand Up @@ -407,7 +405,7 @@ function buildTestRecipientConfigMap(
}

function buildIgpConfigMap(
owner: types.Address,
owner: Address,
deployChains: ChainName[],
allChains: ChainName[],
multisigIsmConfigs: ChainMap<MultisigIsmConfig>,
Expand Down
8 changes: 4 additions & 4 deletions typescript/cli/src/deploy/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ERC20Metadata, TokenType } from '@hyperlane-xyz/hyperlane-token';
import type { types } from '@hyperlane-xyz/utils';
import type { Address } from '@hyperlane-xyz/utils';

export type MinimalTokenMetadata = Omit<ERC20Metadata, 'totalSupply'>;

Expand All @@ -15,13 +15,13 @@ interface BaseWarpUITokenConfig extends MinimalTokenMetadata {

interface CollateralTokenConfig extends BaseWarpUITokenConfig {
type: TokenType.collateral;
address: types.Address;
hypCollateralAddress: types.Address;
address: Address;
hypCollateralAddress: Address;
}

interface NativeTokenConfig extends BaseWarpUITokenConfig {
type: TokenType.native;
hypNativeAddress: types.Address;
hypNativeAddress: Address;
}

export type WarpUITokenConfig = CollateralTokenConfig | NativeTokenConfig;
3 changes: 2 additions & 1 deletion typescript/cli/src/deploy/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ethers } from 'ethers';

import { ChainName, MultiProvider, ProtocolType } from '@hyperlane-xyz/sdk';
import { ChainName, MultiProvider } from '@hyperlane-xyz/sdk';
import { ProtocolType } from '@hyperlane-xyz/utils';

import { log, logGreen } from '../logger.js';
import { assertNativeBalances } from '../utils/balances.js';
Expand Down
5 changes: 2 additions & 3 deletions typescript/cli/src/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import {
MultiProvider,
RouterConfig,
chainMetadata as defaultChainMetadata,
objMap,
} from '@hyperlane-xyz/sdk';
import { types } from '@hyperlane-xyz/utils';
import { Address, objMap } from '@hyperlane-xyz/utils';

import {
WarpRouteConfig,
Expand Down Expand Up @@ -289,7 +288,7 @@ function writeTokenDeploymentArtifacts(
{ configMap }: DeployParams,
) {
const artifacts: ChainMap<{
router: types.Address;
router: Address;
tokenType: TokenType;
}> = objMap(contracts, (chain, contract) => {
return {
Expand Down
14 changes: 7 additions & 7 deletions typescript/cli/src/send/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
HyperlaneIgp,
MultiProvider,
} from '@hyperlane-xyz/sdk';
import { utils } from '@hyperlane-xyz/utils';
import { addressToBytes32, sleep, timeout } from '@hyperlane-xyz/utils';

import { readDeploymentArtifacts } from '../configs.js';
import { MINIMUM_TEST_SEND_BALANCE } from '../consts.js';
Expand All @@ -26,14 +26,14 @@ export async function sendTestMessage({
coreArtifactsPath,
origin,
destination,
timeout,
timeoutSec,
}: {
key: string;
chainConfigPath: string;
coreArtifactsPath: string;
origin: ChainName;
destination: ChainName;
timeout: number;
timeoutSec: number;
}) {
const { signer, multiProvider } = getDeployerContext(key, chainConfigPath);
const artifacts = coreArtifactsPath
Expand All @@ -48,9 +48,9 @@ export async function sendTestMessage({
minBalanceWei: MINIMUM_TEST_SEND_BALANCE,
});

await utils.timeout(
await timeout(
executeDelivery({ origin, destination, multiProvider, signer, artifacts }),
timeout * 1000,
timeoutSec * 1000,
'Timed out waiting for messages to be delivered',
);
}
Expand Down Expand Up @@ -90,7 +90,7 @@ async function executeDelivery({
log('Dispatching message');
const messageTx = await mailbox.dispatch(
destinationDomain,
utils.addressToBytes32(recipient),
addressToBytes32(recipient),
'0x48656c6c6f21', // Hello!
);
const messageReceipt = await multiProvider.handleTx(origin, messageTx);
Expand Down Expand Up @@ -125,7 +125,7 @@ async function executeDelivery({
if (delivered) break;

log('Waiting for message delivery on destination chain...');
await utils.sleep(5000);
await sleep(5000);
}

logGreen('Message was delivered!');
Expand Down
20 changes: 10 additions & 10 deletions typescript/cli/src/send/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
HyperlaneCore,
MultiProvider,
} from '@hyperlane-xyz/sdk';
import { types, utils } from '@hyperlane-xyz/utils';
import { Address, sleep, timeout } from '@hyperlane-xyz/utils';

import { readDeploymentArtifacts } from '../configs.js';
import { MINIMUM_TEST_SEND_BALANCE } from '../consts.js';
Expand All @@ -32,17 +32,17 @@ export async function sendTestTransfer({
routerAddress,
wei,
recipient,
timeout,
timeoutSec,
}: {
key: string;
chainConfigPath: string;
coreArtifactsPath: string;
origin: ChainName;
destination: ChainName;
routerAddress: types.Address;
routerAddress: Address;
wei: string;
recipient?: string;
timeout: number;
timeoutSec: number;
}) {
const { signer, multiProvider } = getDeployerContext(key, chainConfigPath);
const artifacts = coreArtifactsPath
Expand All @@ -64,7 +64,7 @@ export async function sendTestTransfer({
minBalanceWei: MINIMUM_TEST_SEND_BALANCE,
});

await utils.timeout(
await timeout(
executeDelivery({
origin,
destination,
Expand All @@ -75,7 +75,7 @@ export async function sendTestTransfer({
multiProvider,
artifacts,
}),
timeout * 1000,
timeoutSec * 1000,
'Timed out waiting for messages to be delivered',
);
}
Expand All @@ -92,7 +92,7 @@ async function executeDelivery({
}: {
origin: ChainName;
destination: ChainName;
routerAddress: types.Address;
routerAddress: Address;
wei: string;
recipient?: string;
multiProvider: MultiProvider;
Expand Down Expand Up @@ -153,16 +153,16 @@ async function executeDelivery({
const delivered = await mailbox.delivered(message.id);
if (delivered) break;
log('Waiting for message delivery on destination chain...');
await utils.sleep(5000);
await sleep(5000);
}

logGreen(`Transfer sent to destination chain!`);
}

async function getWrappedToken(
address: types.Address,
address: Address,
provider: ethers.providers.Provider,
): Promise<types.Address | null> {
): Promise<Address | null> {
try {
const contract = HypERC20Collateral__factory.connect(address, provider);
const wrappedToken = await contract.wrappedToken();
Expand Down
4 changes: 2 additions & 2 deletions typescript/cli/src/utils/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ethers } from 'ethers';

import { ERC20__factory } from '@hyperlane-xyz/hyperlane-token';
import { ChainName, MultiProvider } from '@hyperlane-xyz/sdk';
import { types } from '@hyperlane-xyz/utils';
import { Address } from '@hyperlane-xyz/utils';

export async function assertNativeBalances(
multiProvider: MultiProvider,
Expand Down Expand Up @@ -30,7 +30,7 @@ export async function assertTokenBalance(
multiProvider: MultiProvider,
signer: ethers.Signer,
chain: ChainName,
token: types.Address,
token: Address,
minBalanceWei: string,
) {
const address = await signer.getAddress();
Expand Down
2 changes: 1 addition & 1 deletion typescript/cli/src/utils/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import { parse as yamlParse, stringify as yamlStringify } from 'yaml';

import { objMerge } from '@hyperlane-xyz/sdk';
import { objMerge } from '@hyperlane-xyz/utils';

import { logBlue } from '../logger.js';

Expand Down

0 comments on commit ce5fbfc

Please sign in to comment.