From b63714ede82819395dc1f928ea131800bae57c6e Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Tue, 9 Apr 2024 11:48:15 -0400 Subject: [PATCH] Convert packages from CJS to ESM (#3531) ### Description - Reconfigure tsconfig and package.json for the utils, core, sdk, and helloworld packages - Update imports to use ESM syntax - Add patch for typechain to address [issue 898](https://github.com/dethcrypto/TypeChain/pull/898) ### Drive-by changes Improve package Readme content ### Related issues Fixes https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/1354 ### Backward compatibility No: package consumers using CJS will need to modify their imports or update to ESM. See [this popular gist](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) for details. ### Testing - [x] CI test coverage which invokes a lot of code via the CLI e2e - [x] Manually test in Warp UI by copying packages - [x] Publish beta packages and test in a few popular bundlers --- .changeset/kind-panthers-clap.md | 9 + .eslintignore | 3 +- .prettierrc | 1 + .../typechain-npm-8.3.2-b02e27439e.patch | 23 + Dockerfile | 3 +- package.json | 15 +- solidity/README.md | 20 +- .../{hardhat.config.ts => hardhat.config.cts} | 2 + solidity/package.json | 47 +- solidity/test/merkle.test.ts | 10 +- solidity/test/message.test.ts | 14 +- solidity/test/mockMailbox.test.ts | 10 +- solidity/test/signer.ts | 12 + solidity/test/testrecipient.test.ts | 8 +- solidity/tsconfig.json | 4 +- tsconfig.json | 11 +- typescript/ccip-server/package.json | 7 +- typescript/cli/ci-test.sh | 2 +- typescript/cli/package.json | 14 +- typescript/cli/tsconfig.json | 2 - .../{.solcover.js => .solcover.cjs} | 0 typescript/helloworld/README.md | 2 +- .../{hardhat.config.ts => hardhat.config.cts} | 1 + typescript/helloworld/package.json | 46 +- typescript/helloworld/src/app/app.ts | 6 +- typescript/helloworld/src/app/contracts.ts | 2 +- typescript/helloworld/src/deploy/check.ts | 6 +- typescript/helloworld/src/deploy/deploy.ts | 6 +- typescript/helloworld/src/index.ts | 20 +- .../src/multiProtocolApp/evmAdapter.ts | 4 +- .../src/multiProtocolApp/multiProtocolApp.ts | 8 +- .../src/multiProtocolApp/sealevelAdapter.ts | 2 +- typescript/helloworld/src/scripts/check.ts | 8 +- typescript/helloworld/src/scripts/deploy.ts | 4 +- typescript/helloworld/src/test/deploy.test.ts | 14 +- .../helloworld/src/test/helloworld.test.ts | 12 +- typescript/helloworld/tsconfig.json | 16 +- .../infra/config/environments/agents.ts | 6 +- .../infra/config/environments/helloworld.ts | 4 +- typescript/infra/config/environments/index.ts | 6 +- .../config/environments/mainnet3/agent.ts | 18 +- .../config/environments/mainnet3/chains.ts | 2 +- .../config/environments/mainnet3/core.ts | 6 +- .../config/environments/mainnet3/funding.ts | 8 +- .../environments/mainnet3/gas-oracle.ts | 8 +- .../environments/mainnet3/helloworld.ts | 10 +- .../infra/config/environments/mainnet3/igp.ts | 6 +- .../config/environments/mainnet3/index.ts | 26 +- .../environments/mainnet3/infrastructure.ts | 2 +- .../environments/mainnet3/liquidityLayer.ts | 4 +- .../config/environments/mainnet3/owners.ts | 2 +- .../environments/mainnet3/validators.ts | 8 +- .../infra/config/environments/test/agent.ts | 10 +- .../environments/test/aggregationIsm.ts | 2 +- .../infra/config/environments/test/chains.ts | 2 +- .../infra/config/environments/test/core.ts | 10 +- .../config/environments/test/gas-oracle.ts | 6 +- .../infra/config/environments/test/igp.ts | 6 +- .../infra/config/environments/test/index.ts | 14 +- .../infra/config/environments/test/infra.ts | 2 +- .../infra/config/environments/test/owners.ts | 2 +- .../config/environments/test/routingIsm.ts | 2 +- .../config/environments/test/validators.ts | 2 +- .../config/environments/testnet4/agent.ts | 18 +- .../config/environments/testnet4/core.ts | 6 +- .../config/environments/testnet4/funding.ts | 8 +- .../environments/testnet4/gas-oracle.ts | 8 +- .../environments/testnet4/helloworld.ts | 10 +- .../infra/config/environments/testnet4/igp.ts | 6 +- .../config/environments/testnet4/index.ts | 28 +- .../environments/testnet4/infrastructure.ts | 2 +- .../environments/testnet4/middleware.ts | 4 +- .../config/environments/testnet4/owners.ts | 2 +- .../environments/testnet4/validators.ts | 8 +- typescript/infra/config/environments/utils.ts | 4 +- typescript/infra/config/multisigIsm.ts | 12 +- typescript/infra/config/routingIsm.ts | 12 +- typescript/infra/fork-all.sh | 2 +- typescript/infra/fork.sh | 10 +- typescript/infra/hardhat.config.cts | 19 + typescript/infra/hardhat.config.ts | 186 ----- .../helloworld-kathy/templates/_helpers.tpl | 2 +- .../helm/key-funder/templates/cron-job.yaml | 2 +- .../templates/circle-relayer-deployment.yaml | 2 +- .../templates/portal-relayer-deployment.yaml | 2 +- .../helm/warp-routes/templates/_helpers.tpl | 2 +- typescript/infra/package.json | 34 +- typescript/infra/scripts/agent-utils.ts | 47 +- .../infra/scripts/agents/deploy-agents.ts | 8 +- .../scripts/agents/remove-agent-deploys.ts | 4 +- .../scripts/agents/update-agents-diff.ts | 4 +- typescript/infra/scripts/agents/utils.ts | 13 +- .../infra/scripts/announce-validators.ts | 12 +- typescript/infra/scripts/check-deploy.ts | 22 +- typescript/infra/scripts/check-rpc-urls.ts | 6 +- typescript/infra/scripts/core-utils.ts | 8 +- typescript/infra/scripts/create-keys.ts | 4 +- typescript/infra/scripts/debug-message.ts | 6 +- typescript/infra/scripts/delete-keys.ts | 4 +- .../scripts/deploy-infra-external-secrets.ts | 8 +- .../infra/scripts/deploy-infra-monitoring.ts | 8 +- typescript/infra/scripts/deploy.ts | 30 +- .../scripts/funding/deploy-key-funder.ts | 10 +- .../fund-deterministic-key-from-deployer.ts | 12 +- .../funding/fund-keys-from-deployer.ts | 32 +- .../infra/scripts/funding/reclaim-from-igp.ts | 6 +- typescript/infra/scripts/get-key-addresses.ts | 6 +- .../infra/scripts/helloworld/deploy-kathy.ts | 10 +- typescript/infra/scripts/helloworld/kathy.ts | 27 +- typescript/infra/scripts/helloworld/utils.ts | 12 +- .../list-validator-checkpoint-indices.ts | 10 +- .../scripts/middleware/circle-relayer.ts | 15 +- .../scripts/middleware/deploy-relayers.ts | 10 +- .../scripts/middleware/portal-relayer.ts | 17 +- typescript/infra/scripts/module-can-verify.ts | 6 +- .../infra/scripts/print-chain-metadatas.ts | 4 +- typescript/infra/scripts/print-gas-prices.ts | 2 +- .../scripts/print-multisig-ism-config.ts | 4 +- .../infra/scripts/print-token-prices.ts | 2 +- typescript/infra/scripts/rotate-key.ts | 2 +- typescript/infra/scripts/safe-delegate.ts | 6 +- .../infra/scripts/send-test-messages.ts | 183 +++++ typescript/infra/scripts/update-key.ts | 2 +- typescript/infra/scripts/verify-validators.ts | 8 +- typescript/infra/scripts/verify.ts | 8 +- .../warp-routes/deploy-warp-monitor.ts | 4 +- typescript/infra/scripts/warp-routes/helm.ts | 10 +- .../monitor-warp-routes-balances.ts | 4 +- typescript/infra/src/agents/agent.ts | 8 +- typescript/infra/src/agents/aws/index.ts | 3 - typescript/infra/src/agents/aws/key.ts | 83 +- typescript/infra/src/agents/aws/user.ts | 13 +- .../infra/src/agents/aws/validator-user.ts | 11 +- typescript/infra/src/agents/aws/validator.ts | 2 +- typescript/infra/src/agents/gcp.ts | 62 +- typescript/infra/src/agents/index.ts | 30 +- typescript/infra/src/agents/key-utils.ts | 42 +- typescript/infra/src/agents/keys.ts | 10 +- typescript/infra/src/config/agent/agent.ts | 17 +- typescript/infra/src/config/agent/index.ts | 11 - typescript/infra/src/config/agent/relayer.ts | 10 +- typescript/infra/src/config/agent/scraper.ts | 6 +- .../infra/src/config/agent/validator.ts | 8 +- typescript/infra/src/config/chain.ts | 5 +- typescript/infra/src/config/environment.ts | 18 +- typescript/infra/src/config/funding.ts | 6 +- typescript/infra/src/config/gas-oracle.ts | 2 +- .../infra/src/config/helloworld/types.ts | 2 +- typescript/infra/src/config/index.ts | 9 - typescript/infra/src/config/middleware.ts | 2 +- typescript/infra/src/deployment/deploy.ts | 6 +- typescript/infra/src/deployment/verify.ts | 4 +- .../infra/src/funding/deterministic-keys.ts | 13 +- typescript/infra/src/funding/key-funder.ts | 9 +- .../infra/src/govern/HyperlaneAppGovernor.ts | 8 +- .../infra/src/govern/HyperlaneCoreGovernor.ts | 2 +- .../infra/src/govern/HyperlaneIgpGovernor.ts | 2 +- .../infra/src/govern/ProxiedRouterGovernor.ts | 2 +- typescript/infra/src/govern/multisend.ts | 2 +- typescript/infra/src/helloworld/kathy.ts | 16 +- .../external-secrets/external-secrets.ts | 10 +- .../infrastructure/monitoring/prometheus.ts | 8 +- .../src/middleware/liquidity-layer-relayer.ts | 9 +- typescript/infra/src/utils/gcloud.ts | 7 +- typescript/infra/src/utils/helm.ts | 4 +- typescript/infra/src/utils/utils.ts | 10 +- typescript/infra/test/agent-configs.test.ts | 14 +- .../infra/test/cloud-agent-keys.test.ts | 10 +- typescript/infra/test/govern.hardhat-test.ts | 17 +- typescript/infra/tsconfig.json | 7 +- typescript/sdk/.mocharc.json | 2 +- typescript/sdk/README.md | 2 + .../{hardhat.config.ts => hardhat.config.cts} | 4 +- typescript/sdk/package.json | 27 +- typescript/sdk/src/app/HyperlaneApp.ts | 13 +- .../sdk/src/app/MultiProtocolApp.test.ts | 6 +- typescript/sdk/src/app/MultiProtocolApp.ts | 10 +- typescript/sdk/src/consts/chainMetadata.ts | 6 +- .../sdk/src/consts/environments/index.ts | 8 +- typescript/sdk/src/consts/multisigIsm.ts | 4 +- typescript/sdk/src/contracts/contracts.ts | 8 +- typescript/sdk/src/contracts/types.ts | 2 +- .../sdk/src/core/CoreDeployer.hardhat-test.ts | 36 +- typescript/sdk/src/core/HyperlaneCore.test.ts | 4 +- typescript/sdk/src/core/HyperlaneCore.ts | 22 +- .../sdk/src/core/HyperlaneCoreChecker.ts | 20 +- .../sdk/src/core/HyperlaneCoreDeployer.ts | 26 +- .../sdk/src/core/MultiProtocolCore.test.ts | 12 +- typescript/sdk/src/core/MultiProtocolCore.ts | 20 +- typescript/sdk/src/core/TestCoreApp.ts | 8 +- typescript/sdk/src/core/TestCoreDeployer.ts | 14 +- .../sdk/src/core/TestRecipientDeployer.ts | 10 +- .../core/adapters/CosmWasmCoreAdapter.test.ts | 8 +- .../src/core/adapters/CosmWasmCoreAdapter.ts | 12 +- .../src/core/adapters/CosmWasmIgpAdapter.ts | 8 +- .../sdk/src/core/adapters/EvmCoreAdapter.ts | 16 +- .../core/adapters/SealevelCoreAdapter.test.ts | 2 +- .../src/core/adapters/SealevelCoreAdapter.ts | 10 +- typescript/sdk/src/core/adapters/types.ts | 6 +- typescript/sdk/src/core/contracts.ts | 2 +- typescript/sdk/src/core/events.ts | 5 +- .../core/testHyperlaneDeploy.hardhat-test.ts | 16 +- typescript/sdk/src/core/types.ts | 12 +- .../sdk/src/deploy/HyperlaneAppChecker.ts | 18 +- .../sdk/src/deploy/HyperlaneDeployer.ts | 31 +- .../deploy/HyperlaneProxyFactoryDeployer.ts | 12 +- typescript/sdk/src/deploy/types.ts | 8 +- .../sdk/src/deploy/verify/ContractVerifier.ts | 8 +- .../verify/PostDeploymentContractVerifier.ts | 12 +- typescript/sdk/src/deploy/verify/utils.ts | 2 +- typescript/sdk/src/gas/HyperlaneIgp.ts | 14 +- typescript/sdk/src/gas/HyperlaneIgpChecker.ts | 14 +- .../sdk/src/gas/HyperlaneIgpDeployer.ts | 20 +- .../src/gas/adapters/SealevelIgpAdapter.ts | 10 +- .../sdk/src/gas/adapters/serialization.ts | 2 +- .../configure-gas-oracles.hardhat-test.ts | 19 +- typescript/sdk/src/gas/oracle/types.ts | 2 +- typescript/sdk/src/gas/token-prices.test.ts | 6 +- typescript/sdk/src/gas/token-prices.ts | 8 +- typescript/sdk/src/gas/types.ts | 13 +- .../sdk/src/hook/HyperlaneHookDeployer.ts | 26 +- typescript/sdk/src/hook/contracts.ts | 2 +- typescript/sdk/src/hook/types.ts | 6 +- typescript/sdk/src/index.ts | 309 +++---- .../ism/HyperlaneIsmFactory.hardhat-test.ts | 22 +- typescript/sdk/src/ism/HyperlaneIsmFactory.ts | 24 +- .../ism/adapters/CosmWasmMultisigAdapter.ts | 10 +- typescript/sdk/src/ism/multisig.ts | 4 +- typescript/sdk/src/ism/types.ts | 4 +- typescript/sdk/src/ism/utils.ts | 14 +- .../sdk/src/metadata/ChainMetadataManager.ts | 8 +- .../sdk/src/metadata/agentConfig.test.ts | 6 +- typescript/sdk/src/metadata/agentConfig.ts | 15 +- typescript/sdk/src/metadata/blockExplorer.ts | 4 +- .../sdk/src/metadata/chainMetadata.test.ts | 4 +- .../sdk/src/metadata/chainMetadataTypes.ts | 2 +- .../sdk/src/metadata/deploymentArtifacts.ts | 2 +- typescript/sdk/src/metadata/health.ts | 14 +- typescript/sdk/src/metadata/matchingList.ts | 2 +- .../sdk/src/metadata/warpRouteConfig.ts | 4 +- .../middleware/account/InterchainAccount.ts | 16 +- .../account/InterchainAccountChecker.ts | 12 +- .../account/InterchainAccountDeployer.ts | 14 +- .../account/accounts.hardhat-test.ts | 38 +- .../sdk/src/middleware/account/contracts.ts | 2 +- .../sdk/src/middleware/account/types.ts | 2 +- .../liquidity-layer/LiquidityLayerApp.ts | 16 +- .../LiquidityLayerRouterDeployer.ts | 17 +- .../middleware/liquidity-layer/contracts.ts | 2 +- .../liquidity-layer.hardhat-test.ts | 26 +- .../src/middleware/query/InterchainQuery.ts | 12 +- .../query/InterchainQueryChecker.ts | 8 +- .../query/InterchainQueryDeployer.ts | 12 +- .../sdk/src/middleware/query/contracts.ts | 2 +- .../middleware/query/queries.hardhat-test.ts | 34 +- .../providers/MultiProtocolProvider.test.ts | 6 +- .../src/providers/MultiProtocolProvider.ts | 16 +- typescript/sdk/src/providers/MultiProvider.ts | 15 +- .../HyperlaneEtherscanProvider.ts | 4 +- .../SmartProvider/HyperlaneJsonRpcProvider.ts | 4 +- .../SmartProvider.foundry-test.ts | 2 +- .../SmartProvider/SmartProvider.test.ts | 8 +- .../providers/SmartProvider/SmartProvider.ts | 10 +- .../sdk/src/providers/SmartProvider/types.ts | 2 +- .../sdk/src/providers/providerBuilders.ts | 8 +- .../src/providers/transactionFeeEstimators.ts | 6 +- .../sdk/src/router/GasRouterDeployer.ts | 11 +- .../sdk/src/router/HyperlaneRouterChecker.ts | 19 +- .../sdk/src/router/HyperlaneRouterDeployer.ts | 10 +- .../router/MultiProtocolRouterApps.test.ts | 10 +- .../sdk/src/router/MultiProtocolRouterApps.ts | 14 +- .../sdk/src/router/ProxiedRouterChecker.ts | 8 +- .../sdk/src/router/ProxiedRouterDeployer.ts | 10 +- typescript/sdk/src/router/RouterApps.ts | 10 +- .../src/router/adapters/EvmRouterAdapter.ts | 8 +- .../router/adapters/SealevelRouterAdapter.ts | 8 +- typescript/sdk/src/router/adapters/types.ts | 4 +- typescript/sdk/src/router/types.ts | 8 +- typescript/sdk/src/test/metadata-check.ts | 8 +- typescript/sdk/src/test/testUtils.ts | 22 +- typescript/sdk/src/token/IToken.ts | 17 +- typescript/sdk/src/token/Token.test.ts | 12 +- typescript/sdk/src/token/Token.ts | 29 +- typescript/sdk/src/token/TokenAmount.test.ts | 10 +- typescript/sdk/src/token/TokenAmount.ts | 2 +- typescript/sdk/src/token/TokenConnection.ts | 6 +- typescript/sdk/src/token/TokenStandard.ts | 4 +- .../adapters/CosmWasmTokenAdapter.test.ts | 12 +- .../token/adapters/CosmWasmTokenAdapter.ts | 16 +- .../src/token/adapters/CosmosTokenAdapter.ts | 12 +- .../sdk/src/token/adapters/EvmTokenAdapter.ts | 12 +- .../sdk/src/token/adapters/ITokenAdapter.ts | 2 +- .../token/adapters/SealevelTokenAdapter.ts | 20 +- .../sdk/src/token/adapters/serialization.ts | 4 +- typescript/sdk/src/token/app.ts | 10 +- typescript/sdk/src/token/checker.ts | 12 +- typescript/sdk/src/token/config.ts | 2 +- typescript/sdk/src/token/contracts.ts | 4 +- .../sdk/src/token/deploy.hardhat-test.ts | 22 +- typescript/sdk/src/token/deploy.ts | 18 +- typescript/sdk/src/utils/MultiGeneric.ts | 4 +- typescript/sdk/src/utils/filter.ts | 2 +- typescript/sdk/src/utils/ism.ts | 2 +- typescript/sdk/src/utils/wagmi.ts | 6 +- typescript/sdk/src/warp/WarpCore.test.ts | 26 +- typescript/sdk/src/warp/WarpCore.ts | 20 +- typescript/sdk/src/warp/types.ts | 10 +- typescript/sdk/tsconfig.json | 1 - typescript/utils/.mocharc.json | 2 +- typescript/utils/README.md | 20 + typescript/utils/package.json | 16 +- typescript/utils/src/addresses.test.ts | 4 +- typescript/utils/src/addresses.ts | 6 +- typescript/utils/src/amount.test.ts | 7 +- typescript/utils/src/amount.ts | 2 +- typescript/utils/src/base64.ts | 2 +- typescript/utils/src/big-numbers.test.ts | 4 +- typescript/utils/src/big-numbers.ts | 2 +- typescript/utils/src/checkpoints.ts | 2 +- typescript/utils/src/domains.ts | 2 +- typescript/utils/{ => src}/index.ts | 46 +- typescript/utils/src/logging.ts | 2 +- typescript/utils/src/messages.ts | 4 +- typescript/utils/src/multisig.ts | 6 +- typescript/utils/src/validator.ts | 10 +- typescript/utils/tsconfig.json | 6 +- yarn.lock | 766 +++++++++++------- 327 files changed, 2558 insertions(+), 2187 deletions(-) create mode 100644 .changeset/kind-panthers-clap.md create mode 100644 .yarn/patches/typechain-npm-8.3.2-b02e27439e.patch rename solidity/{hardhat.config.ts => hardhat.config.cts} (92%) create mode 100644 solidity/test/signer.ts rename typescript/helloworld/{.solcover.js => .solcover.cjs} (100%) rename typescript/helloworld/{hardhat.config.ts => hardhat.config.cts} (94%) create mode 100644 typescript/infra/hardhat.config.cts delete mode 100644 typescript/infra/hardhat.config.ts create mode 100644 typescript/infra/scripts/send-test-messages.ts delete mode 100644 typescript/infra/src/agents/aws/index.ts delete mode 100644 typescript/infra/src/config/agent/index.ts delete mode 100644 typescript/infra/src/config/index.ts rename typescript/sdk/{hardhat.config.ts => hardhat.config.cts} (82%) create mode 100644 typescript/utils/README.md rename typescript/utils/{ => src}/index.ts (72%) diff --git a/.changeset/kind-panthers-clap.md b/.changeset/kind-panthers-clap.md new file mode 100644 index 000000000..c3a12d476 --- /dev/null +++ b/.changeset/kind-panthers-clap.md @@ -0,0 +1,9 @@ +--- +'@hyperlane-xyz/helloworld': minor +'@hyperlane-xyz/utils': minor +'@hyperlane-xyz/cli': minor +'@hyperlane-xyz/sdk': minor +'@hyperlane-xyz/core': minor +--- + +Convert all public hyperlane npm packages from CJS to pure ESM diff --git a/.eslintignore b/.eslintignore index 5a19e8ace..4d284e827 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ node_modules dist -coverage \ No newline at end of file +coverage +*.cts \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index fda694a67..9d7657f82 100644 --- a/.prettierrc +++ b/.prettierrc @@ -17,5 +17,6 @@ "importOrder": ["^@hyperlane-xyz/(.*)$", "^../(.*)$", "^./(.*)$"], "importOrderSeparation": true, "importOrderSortSpecifiers": true, + "importOrderParserPlugins": ["importAssertions", "typescript", "jsx"], "plugins": ["prettier-plugin-solidity", "@trivago/prettier-plugin-sort-imports"] } diff --git a/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch b/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch new file mode 100644 index 000000000..396755b1c --- /dev/null +++ b/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch @@ -0,0 +1,23 @@ +diff --git a/dist/codegen/createBarrelFiles.js b/dist/codegen/createBarrelFiles.js +index 4bf574d7f6701bc5a8fcb2c281b5c63f31923e79..7f9cbdbd0491d4fa6338a10b23d06c2665c9d968 100644 +--- a/dist/codegen/createBarrelFiles.js ++++ b/dist/codegen/createBarrelFiles.js +@@ -38,15 +38,13 @@ function createBarrelFiles(paths, { typeOnly, postfix = '', moduleSuffix = '' }) + const namespacesExports = nestedDirs + .map((p) => { + const namespaceIdentifier = (0, normalizeDirName_1.normalizeDirName)(p); ++ const fromFilePath = moduleSuffix ? `'./${p}/index${moduleSuffix}'` : `'./${p}'` + if (typeOnly) + return [ +- `import type * as ${namespaceIdentifier} from './${p}';`, ++ `import type * as ${namespaceIdentifier} from ${fromFilePath};`, + `export type { ${namespaceIdentifier} };`, + ].join('\n'); +- if (moduleSuffix) { +- return `export * as ${namespaceIdentifier} from './${p}/index${moduleSuffix}';`; +- } +- return `export * as ${namespaceIdentifier} from './${p}';`; ++ return `export * as ${namespaceIdentifier} from ${fromFilePath};`; + }) + .join('\n'); + const contracts = (fileReexports[path] || []).sort(); diff --git a/Dockerfile b/Dockerfile index f40cc6e49..4a01616b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,13 @@ WORKDIR /hyperlane-monorepo RUN apk add --update --no-cache git g++ make py3-pip jq -RUN yarn set version 4.0.1 +RUN yarn set version 4.0.2 # Copy package.json and friends COPY package.json yarn.lock .yarnrc.yml ./ COPY .yarn/plugins ./.yarn/plugins COPY .yarn/releases ./.yarn/releases +COPY .yarn/patches ./.yarn/patches COPY typescript/utils/package.json ./typescript/utils/ COPY typescript/sdk/package.json ./typescript/sdk/ COPY typescript/helloworld/package.json ./typescript/helloworld/ diff --git a/package.json b/package.json index 38f572009..5d838c09e 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "version": "0.0.0", "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.2.1", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", - "eslint": "^8.43.0", - "eslint-config-prettier": "^8.8.0", + "@typescript-eslint/eslint-plugin": "^7.4.0", + "@typescript-eslint/parser": "^7.4.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "husky": "^8.0.0", "lint-staged": "^12.4.3", - "prettier": "^2.8.8" + "prettier": "^2.8.8", + "tsx": "^4.7.1" }, "dependencies": { "@changesets/cli": "^2.26.2" @@ -42,6 +43,8 @@ "recursive-readdir": "^2.2.3", "underscore": "^1.13", "undici": "^5.11", - "@trivago/prettier-plugin-sort-imports/@babel/parser": "^7.22.7" + "@trivago/prettier-plugin-sort-imports/@babel/parser": "^7.22.7", + "@typechain/ethers-v5": "11.1.2", + "typechain@npm:^8.0.0": "patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch" } } diff --git a/solidity/README.md b/solidity/README.md index e1ab27f2d..f6af38b8e 100644 --- a/solidity/README.md +++ b/solidity/README.md @@ -1,15 +1,19 @@ -# Hyperlane Solidity +# Hyperlane Core -On-chain implementations of Hyperlane in Solidity. +Hyperlane Core contains the contracts and typechain artifacts for the Hyperlane implementation for EVM. -## Setup +## Install -- `yarn install` +```bash +# Install with NPM +npm install @hyperlane-xyz/utils -## Build +# Or with Yarn +yarn add @hyperlane-xyz/utils +``` -- `yarn build` +Note, this package uses [ESM Modules](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) -## Test +## License -- `yarn test` +Apache 2.0 diff --git a/solidity/hardhat.config.ts b/solidity/hardhat.config.cts similarity index 92% rename from solidity/hardhat.config.ts rename to solidity/hardhat.config.cts index f29e2bd8c..4505567e3 100644 --- a/solidity/hardhat.config.ts +++ b/solidity/hardhat.config.cts @@ -24,8 +24,10 @@ module.exports = { outDir: './types', target: 'ethers-v5', alwaysGenerateOverloads: true, + node16Modules: true, }, mocha: { bail: true, + import: 'tsx', }, }; diff --git a/solidity/package.json b/solidity/package.json index f38eaf883..5cf9a3985 100644 --- a/solidity/package.json +++ b/solidity/package.json @@ -11,14 +11,14 @@ }, "devDependencies": { "@layerzerolabs/solidity-examples": "^1.1.0", - "@nomiclabs/hardhat-ethers": "^2.2.1", + "@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-waffle": "^2.0.6", - "@typechain/ethers-v5": "^10.0.0", - "@typechain/hardhat": "^6.0.0", + "@typechain/ethers-v5": "^11.1.2", + "@typechain/hardhat": "^9.1.0", "chai": "^4.3.6", "ethereum-waffle": "^4.0.10", "ethers": "^5.7.2", - "hardhat": "^2.19.0", + "hardhat": "^2.22.2", "hardhat-gas-reporter": "^1.0.9", "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", @@ -26,42 +26,53 @@ "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.8.3", "ts-generator": "^0.1.1", - "typechain": "^8.3.2", - "typescript": "5.1.6" + "ts-node": "^10.8.0", + "typechain": "patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch", + "typescript": "5.3.3" }, "directories": { "test": "test" }, + "type": "module", + "exports": { + ".": "./dist/index.js", + "./mailbox": "./dist/contracts/Mailbox.js", + "./buildArtifact.json": "./buildArtifact.json", + "./contracts": "./contracts" + }, + "types": "./dist/index.d.ts", "files": [ "/buildArtifact.json", "/dist", - "/contracts", - "/interfaces", - "/docs" + "/contracts" ], + "engines": { + "node": ">=16" + }, "homepage": "https://www.hyperlane.xyz", + "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "keywords": [ "Hyperlane", "Solidity" ], "license": "Apache-2.0", - "main": "dist/index.js", - "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "scripts": { - "build": "hardhat compile && ./exportBuildArtifact.sh && tsc", + "build": "yarn hardhat-esm compile && ./exportBuildArtifact.sh && tsc", "lint": "solhint contracts/**/*.sol", - "clean": "hardhat clean && rm -rf ./dist ./cache ./types ./coverage", + "clean": "yarn hardhat-esm clean && rm -rf ./dist ./cache ./types ./coverage ./out ./forge-cache", "coverage": "./coverage.sh", "docs": "forge doc", - "storage": "./storage.sh", + "hardhat-esm": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat --config hardhat.config.cts", "prettier": "prettier --write ./contracts ./test", - "test": "hardhat test && forge test -vvv", - "test:ci": "hardhat test && forge test --no-match-test testFork -vvv", + "test": "yarn hardhat-esm test && yarn test:forge", + "test:hardhat": "yarn hardhat-esm test", + "test:forge": "forge test -vvv", + "test:ci": "yarn test:hardhat && yarn test:forge --no-match-test testFork", "gas": "forge snapshot", "gas-ci": "yarn gas --check --tolerance 2 || (echo 'Manually update gas snapshot' && exit 1)", - "slither": "slither ." + "slither": "slither .", + "storage": "./storage.sh" }, - "types": "dist/index.d.ts", "peerDependencies": { "@ethersproject/abi": "*", "@ethersproject/providers": "*", diff --git a/solidity/test/merkle.test.ts b/solidity/test/merkle.test.ts index b7711c539..f2a3d5d39 100644 --- a/solidity/test/merkle.test.ts +++ b/solidity/test/merkle.test.ts @@ -1,9 +1,11 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { utils } from 'ethers'; -import merkleTestCases from '../../vectors/merkle.json'; +import merkleTestCases from '../../vectors/merkle.json' assert { type: 'json' }; import { TestMerkle, TestMerkle__factory } from '../types'; +import { getSigner } from './signer'; + describe('Merkle', async () => { for (const testCase of merkleTestCases) { const { testName, leaves, expectedRoot, proofs } = testCase; @@ -12,14 +14,14 @@ describe('Merkle', async () => { let merkle: TestMerkle; before(async () => { - const [signer] = await ethers.getSigners(); + const signer = await getSigner(); const merkleFactory = new TestMerkle__factory(signer); merkle = await merkleFactory.deploy(); //insert the leaves for (const leaf of leaves) { - const leafHash = ethers.utils.hashMessage(leaf); + const leafHash = utils.hashMessage(leaf); await merkle.insert(leafHash); } }); diff --git a/solidity/test/message.test.ts b/solidity/test/message.test.ts index bdee259fb..83bde28b6 100644 --- a/solidity/test/message.test.ts +++ b/solidity/test/message.test.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { utils } from 'ethers'; import { addressToBytes32, @@ -7,9 +7,11 @@ import { messageId, } from '@hyperlane-xyz/utils'; -import testCases from '../../vectors/message.json'; +import testCases from '../../vectors/message.json' assert { type: 'json' }; import { Mailbox__factory, TestMessage, TestMessage__factory } from '../types'; +import { getSigner, getSigners } from './signer'; + const remoteDomain = 1000; const localDomain = 2000; const nonce = 11; @@ -19,7 +21,7 @@ describe('Message', async () => { let version: number; before(async () => { - const [signer] = await ethers.getSigners(); + const signer = await getSigner(); const Message = new TestMessage__factory(signer); messageLib = await Message.deploy(); @@ -31,8 +33,8 @@ describe('Message', async () => { }); it('Returns fields from a message', async () => { - const [sender, recipient] = await ethers.getSigners(); - const body = ethers.utils.formatBytes32String('message'); + const [sender, recipient] = await getSigners(); + const body = utils.formatBytes32String('message'); const message = formatMessage( version, @@ -64,7 +66,7 @@ describe('Message', async () => { for (const test of testCases) { const { origin, sender, destination, recipient, body, nonce, id } = test; - const hexBody = ethers.utils.hexlify(body); + const hexBody = utils.hexlify(body); const hyperlaneMessage = formatMessage( version, diff --git a/solidity/test/mockMailbox.test.ts b/solidity/test/mockMailbox.test.ts index edadf7d16..db49a7585 100644 --- a/solidity/test/mockMailbox.test.ts +++ b/solidity/test/mockMailbox.test.ts @@ -1,16 +1,18 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { utils } from 'ethers'; import { addressToBytes32 } from '@hyperlane-xyz/utils'; import { MockMailbox__factory, TestRecipient__factory } from '../types'; +import { getSigner } from './signer'; + const ORIGIN_DOMAIN = 1000; const DESTINATION_DOMAIN = 2000; describe('MockMailbox', function () { it('should be able to mock sending and receiving a message', async function () { - const [signer] = await ethers.getSigners(); + const signer = await getSigner(); const mailboxFactory = new MockMailbox__factory(signer); const testRecipientFactory = new TestRecipient__factory(signer); const originMailbox = await mailboxFactory.deploy(ORIGIN_DOMAIN); @@ -21,7 +23,7 @@ describe('MockMailbox', function () { ); const recipient = await testRecipientFactory.deploy(); - const body = ethers.utils.toUtf8Bytes('This is a test message'); + const body = utils.toUtf8Bytes('This is a test message'); await originMailbox['dispatch(uint32,bytes32,bytes)']( DESTINATION_DOMAIN, @@ -31,6 +33,6 @@ describe('MockMailbox', function () { await destinationMailbox.processNextInboundMessage(); const dataReceived = await recipient.lastData(); - expect(dataReceived).to.eql(ethers.utils.hexlify(body)); + expect(dataReceived).to.eql(utils.hexlify(body)); }); }); diff --git a/solidity/test/signer.ts b/solidity/test/signer.ts new file mode 100644 index 000000000..c59a62620 --- /dev/null +++ b/solidity/test/signer.ts @@ -0,0 +1,12 @@ +import type { Wallet } from 'ethers'; +import hre from 'hardhat'; + +export async function getSigners(): Promise { + // @ts-ignore Hardhat type overrides from @nomiclabs/hardhat-ethers don't work + return hre.ethers.getSigners(); +} + +export async function getSigner(): Promise { + const [signer] = await getSigners(); + return signer; +} diff --git a/solidity/test/testrecipient.test.ts b/solidity/test/testrecipient.test.ts index 2befd818b..acdbf573e 100644 --- a/solidity/test/testrecipient.test.ts +++ b/solidity/test/testrecipient.test.ts @@ -1,17 +1,19 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { utils } from 'ethers'; import { addressToBytes32 } from '@hyperlane-xyz/utils'; import { TestRecipient, TestRecipient__factory } from '../types'; -const testData = ethers.utils.hexlify(ethers.utils.toUtf8Bytes('test')); +import { getSigner } from './signer'; + +const testData = utils.hexlify(utils.toUtf8Bytes('test')); describe('TestRecipient', () => { let recipient: TestRecipient; let signerAddress: string; before(async () => { - const [signer] = await ethers.getSigners(); + const signer = await getSigner(); signerAddress = await signer.getAddress(); const recipientFactory = new TestRecipient__factory(signer); recipient = await recipientFactory.deploy(); diff --git a/solidity/tsconfig.json b/solidity/tsconfig.json index d5353f6c3..cece6d7fc 100644 --- a/solidity/tsconfig.json +++ b/solidity/tsconfig.json @@ -1,8 +1,8 @@ { + "extends": "../tsconfig.json", "compilerOptions": { "outDir": "./dist", "rootDir": "./types" }, - "exclude": ["./test", "hardhat.config.ts", "./dist"], - "extends": "../tsconfig.json" + "exclude": ["./test", "hardhat.config.cts", "./dist"] } diff --git a/tsconfig.json b/tsconfig.json index e40990970..4acc44431 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,8 +9,8 @@ "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020","ES2021", "DOM" ], - "module": "commonjs", - "moduleResolution": "node", + "module": "nodenext", + "moduleResolution": "nodenext", "noEmitOnError": true, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, @@ -23,6 +23,11 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "ES2020", + "target": "es2022", + }, + "ts-node": { + "experimentalSpecifierResolution": "node", + "experimentalResolver": true, + "files": true } } diff --git a/typescript/ccip-server/package.json b/typescript/ccip-server/package.json index a55406b07..109ee72d0 100644 --- a/typescript/ccip-server/package.json +++ b/typescript/ccip-server/package.json @@ -9,10 +9,10 @@ "src" ], "engines": { - "node": ">=14" + "node": ">=16" }, "scripts": { - "start": "ts-node src/server.ts", + "start": "tsx src/server.ts", "dev": "nodemon src/server.ts", "test": "jest", "prettier": "prettier --write ./src/* ./tests/" @@ -27,7 +27,8 @@ "prettier": "^2.8.8", "ts-jest": "^29.1.2", "ts-node": "^10.8.0", - "typescript": "5.1.6" + "tsx": "^4.7.1", + "typescript": "5.3.3" }, "dependencies": { "@chainlink/ccip-read-server": "^0.2.1", diff --git a/typescript/cli/ci-test.sh b/typescript/cli/ci-test.sh index b13044ed8..5909dc1a4 100755 --- a/typescript/cli/ci-test.sh +++ b/typescript/cli/ci-test.sh @@ -69,7 +69,7 @@ sleep 1 if [ "$TEST_TYPE" == $TEST_TYPE_PI_CORE ]; then # Fetch the RPC of chain to fork cd typescript/infra - RPC_URL=$(yarn ts-node scripts/print-chain-metadatas.ts -e mainnet3 | jq -r ".${CHAIN2}.rpcUrls[0].http") + RPC_URL=$(yarn tsx scripts/print-chain-metadatas.ts -e mainnet3 | jq -r ".${CHAIN2}.rpcUrls[0].http") cd ../../ # run the fork chain diff --git a/typescript/cli/package.json b/typescript/cli/package.json index 955fa58c4..198347301 100644 --- a/typescript/cli/package.json +++ b/typescript/cli/package.json @@ -20,11 +20,11 @@ "@types/mocha": "^10.0.1", "@types/node": "^18.14.5", "@types/yargs": "^17.0.24", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typescript-eslint/eslint-plugin": "^7.4.0", + "@typescript-eslint/parser": "^7.4.0", "chai": "^4.3.6", - "eslint": "^8.43.0", - "eslint-config-prettier": "^8.8.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "mocha": "^10.2.0", "prettier": "^2.8.8", "typescript": "^5.1.6" @@ -48,6 +48,9 @@ "main": "./dist/index.js", "types": "./dist/index.d.ts", "type": "module", + "engines": { + "node": ">=16" + }, "bin": { "hyperlane": "./dist/cli.js" }, @@ -63,6 +66,5 @@ "Permissionless", "Deployment", "Typescript" - ], - "packageManager": "yarn@4.0.1" + ] } diff --git a/typescript/cli/tsconfig.json b/typescript/cli/tsconfig.json index 31332c088..77ae051fe 100644 --- a/typescript/cli/tsconfig.json +++ b/typescript/cli/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "module": "Node16", - "moduleResolution": "Node16", "outDir": "./dist/", "rootDir": "." }, diff --git a/typescript/helloworld/.solcover.js b/typescript/helloworld/.solcover.cjs similarity index 100% rename from typescript/helloworld/.solcover.js rename to typescript/helloworld/.solcover.cjs diff --git a/typescript/helloworld/README.md b/typescript/helloworld/README.md index 05f943dd9..8e5bb70df 100644 --- a/typescript/helloworld/README.md +++ b/typescript/helloworld/README.md @@ -24,4 +24,4 @@ yarn lint ## Learn more -For more information, see the [Hyperlane documentation](https://docs.hyperlane.xyz/hyperlane-docs/developers/getting-started). +For more information, see the [Hyperlane documentation](https://docs.hyperlane.xyz/docs/intro). diff --git a/typescript/helloworld/hardhat.config.ts b/typescript/helloworld/hardhat.config.cts similarity index 94% rename from typescript/helloworld/hardhat.config.ts rename to typescript/helloworld/hardhat.config.cts index ef7ce035c..b36c5593c 100644 --- a/typescript/helloworld/hardhat.config.ts +++ b/typescript/helloworld/hardhat.config.cts @@ -18,5 +18,6 @@ module.exports = { outDir: './src/types', target: 'ethers-v5', alwaysGenerateOverloads: true, + node16Modules: true, }, }; diff --git a/typescript/helloworld/package.json b/typescript/helloworld/package.json index 1e7ca63a3..67f563c9f 100644 --- a/typescript/helloworld/package.json +++ b/typescript/helloworld/package.json @@ -9,18 +9,18 @@ "ethers": "^5.7.2" }, "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.2.1", + "@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-waffle": "^2.0.6", "@trivago/prettier-plugin-sort-imports": "^4.2.1", - "@typechain/ethers-v5": "^10.0.0", - "@typechain/hardhat": "^6.0.0", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", + "@typechain/ethers-v5": "^11.1.2", + "@typechain/hardhat": "^9.1.0", + "@typescript-eslint/eslint-plugin": "^7.4.0", + "@typescript-eslint/parser": "^7.4.0", "chai": "^4.3.6", - "eslint": "^8.43.0", - "eslint-config-prettier": "^8.8.0", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", "ethereum-waffle": "^4.0.10", - "hardhat": "^2.19.0", + "hardhat": "^2.22.2", "hardhat-gas-reporter": "^1.0.9", "prettier": "^2.8.8", "prettier-plugin-solidity": "^1.1.3", @@ -28,13 +28,9 @@ "solhint-plugin-prettier": "^0.0.5", "solidity-coverage": "^0.8.3", "ts-node": "^10.8.0", - "typechain": "^8.0.0", - "typescript": "5.1.6" + "typechain": "patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch", + "typescript": "5.3.3" }, - "files": [ - "/dist", - "/contracts" - ], "homepage": "https://www.hyperlane.xyz", "keywords": [ "Hyperlane", @@ -43,23 +39,27 @@ "Typescript" ], "license": "Apache-2.0", - "main": "dist/src/index.js", - "packageManager": "yarn@4.0.1", + "type": "module", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "/dist", + "/contracts" + ], "repository": { "type": "git", "url": "https://github.com/hyperlane-xyz/hyperlane-monorepo" }, "scripts": { - "build": "hardhat compile && tsc", - "clean": "hardhat clean && rm -rf dist cache src/types", - "coverage": "hardhat coverage", + "build": "yarn hardhat-esm compile && tsc", + "clean": "yarn hardhat-esm clean && rm -rf dist cache src/types", + "coverage": "yarn hardhat-esm coverage", "lint": "solhint contracts/**/*.sol && eslint . --ext .ts", + "hardhat-esm": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat --config hardhat.config.cts", "prettier": "prettier --write ./contracts ./src", - "test": "hardhat test ./src/test/**/*.test.ts", - "test:ci": "yarn test", - "sync": "ts-node scripts/sync-with-template-repo.ts" + "test": "yarn hardhat-esm test ./src/test/**/*.test.ts", + "test:ci": "yarn test" }, - "types": "dist/src/index.d.ts", "peerDependencies": { "@ethersproject/abi": "*", "@ethersproject/providers": "*", diff --git a/typescript/helloworld/src/app/app.ts b/typescript/helloworld/src/app/app.ts index 73da14e3f..809cdaf7d 100644 --- a/typescript/helloworld/src/app/app.ts +++ b/typescript/helloworld/src/app/app.ts @@ -11,10 +11,10 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, rootLogger } from '@hyperlane-xyz/utils'; -import { HelloWorld } from '../types'; +import { HelloWorld } from '../types/index.js'; -import { HelloWorldFactories } from './contracts'; -import { StatCounts } from './types'; +import { HelloWorldFactories } from './contracts.js'; +import { StatCounts } from './types.js'; export class HelloWorldApp extends RouterApp { constructor( diff --git a/typescript/helloworld/src/app/contracts.ts b/typescript/helloworld/src/app/contracts.ts index 04f6cdeb4..442ccdd82 100644 --- a/typescript/helloworld/src/app/contracts.ts +++ b/typescript/helloworld/src/app/contracts.ts @@ -1,4 +1,4 @@ -import { HelloWorld__factory } from '../types'; +import { HelloWorld__factory } from '../types/index.js'; export const helloWorldFactories = { router: new HelloWorld__factory(), diff --git a/typescript/helloworld/src/deploy/check.ts b/typescript/helloworld/src/deploy/check.ts index 044f06232..be31470d6 100644 --- a/typescript/helloworld/src/deploy/check.ts +++ b/typescript/helloworld/src/deploy/check.ts @@ -1,9 +1,9 @@ import { HyperlaneRouterChecker } from '@hyperlane-xyz/sdk'; -import { HelloWorldApp } from '../app/app'; -import { HelloWorldFactories } from '../app/contracts'; +import { HelloWorldApp } from '../app/app.js'; +import { HelloWorldFactories } from '../app/contracts.js'; -import { HelloWorldConfig } from './config'; +import { HelloWorldConfig } from './config.js'; export class HelloWorldChecker extends HyperlaneRouterChecker< HelloWorldFactories, diff --git a/typescript/helloworld/src/deploy/deploy.ts b/typescript/helloworld/src/deploy/deploy.ts index 8b9d67b89..b7dccecda 100644 --- a/typescript/helloworld/src/deploy/deploy.ts +++ b/typescript/helloworld/src/deploy/deploy.ts @@ -9,10 +9,10 @@ import { MultiProvider, } from '@hyperlane-xyz/sdk'; -import { HelloWorldFactories, helloWorldFactories } from '../app/contracts'; -import { HelloWorld } from '../types'; +import { HelloWorldFactories, helloWorldFactories } from '../app/contracts.js'; +import { HelloWorld } from '../types/index.js'; -import { HelloWorldConfig } from './config'; +import { HelloWorldConfig } from './config.js'; export class HelloWorldDeployer extends HyperlaneRouterDeployer< HelloWorldConfig, diff --git a/typescript/helloworld/src/index.ts b/typescript/helloworld/src/index.ts index a8c5d2939..363048185 100644 --- a/typescript/helloworld/src/index.ts +++ b/typescript/helloworld/src/index.ts @@ -1,10 +1,10 @@ -export { HelloWorldApp } from './app/app'; -export { HelloWorldFactories, helloWorldFactories } from './app/contracts'; -export { HelloWorldChecker } from './deploy/check'; -export { HelloWorldConfig } from './deploy/config'; -export { HelloWorldDeployer } from './deploy/deploy'; -export { EvmHelloWorldAdapter } from './multiProtocolApp/evmAdapter'; -export { HelloMultiProtocolApp } from './multiProtocolApp/multiProtocolApp'; -export { SealevelHelloWorldAdapter } from './multiProtocolApp/sealevelAdapter'; -export { IHelloWorldAdapter } from './multiProtocolApp/types'; -export * as types from './types'; +export { HelloWorldApp } from './app/app.js'; +export { HelloWorldFactories, helloWorldFactories } from './app/contracts.js'; +export { HelloWorldChecker } from './deploy/check.js'; +export { HelloWorldConfig } from './deploy/config.js'; +export { HelloWorldDeployer } from './deploy/deploy.js'; +export { EvmHelloWorldAdapter } from './multiProtocolApp/evmAdapter.js'; +export { HelloMultiProtocolApp } from './multiProtocolApp/multiProtocolApp.js'; +export { SealevelHelloWorldAdapter } from './multiProtocolApp/sealevelAdapter.js'; +export { IHelloWorldAdapter } from './multiProtocolApp/types.js'; +export * as types from './types/index.js'; diff --git a/typescript/helloworld/src/multiProtocolApp/evmAdapter.ts b/typescript/helloworld/src/multiProtocolApp/evmAdapter.ts index 0d565f465..5d9bacc23 100644 --- a/typescript/helloworld/src/multiProtocolApp/evmAdapter.ts +++ b/typescript/helloworld/src/multiProtocolApp/evmAdapter.ts @@ -9,9 +9,9 @@ import { } from '@hyperlane-xyz/sdk'; import { Address } from '@hyperlane-xyz/utils'; -import { HelloWorld, HelloWorld__factory } from '../types'; +import { HelloWorld, HelloWorld__factory } from '../types/index.js'; -import { IHelloWorldAdapter } from './types'; +import { IHelloWorldAdapter } from './types.js'; export class EvmHelloWorldAdapter extends EvmRouterAdapter diff --git a/typescript/helloworld/src/multiProtocolApp/multiProtocolApp.ts b/typescript/helloworld/src/multiProtocolApp/multiProtocolApp.ts index 03ea154eb..5f86374fd 100644 --- a/typescript/helloworld/src/multiProtocolApp/multiProtocolApp.ts +++ b/typescript/helloworld/src/multiProtocolApp/multiProtocolApp.ts @@ -7,11 +7,11 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, ProtocolType } from '@hyperlane-xyz/utils'; -import { StatCounts } from '../app/types'; +import { StatCounts } from '../app/types.js'; -import { EvmHelloWorldAdapter } from './evmAdapter'; -import { SealevelHelloWorldAdapter } from './sealevelAdapter'; -import { IHelloWorldAdapter } from './types'; +import { EvmHelloWorldAdapter } from './evmAdapter.js'; +import { SealevelHelloWorldAdapter } from './sealevelAdapter.js'; +import { IHelloWorldAdapter } from './types.js'; export class HelloMultiProtocolApp extends MultiProtocolRouterApp< IHelloWorldAdapter, diff --git a/typescript/helloworld/src/multiProtocolApp/sealevelAdapter.ts b/typescript/helloworld/src/multiProtocolApp/sealevelAdapter.ts index 6c4ef158e..11fd77ce8 100644 --- a/typescript/helloworld/src/multiProtocolApp/sealevelAdapter.ts +++ b/typescript/helloworld/src/multiProtocolApp/sealevelAdapter.ts @@ -24,7 +24,7 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, Domain } from '@hyperlane-xyz/utils'; -import { IHelloWorldAdapter } from './types'; +import { IHelloWorldAdapter } from './types.js'; export class SealevelHelloWorldAdapter extends SealevelRouterAdapter diff --git a/typescript/helloworld/src/scripts/check.ts b/typescript/helloworld/src/scripts/check.ts index 9e9393071..2ee8efb62 100644 --- a/typescript/helloworld/src/scripts/check.ts +++ b/typescript/helloworld/src/scripts/check.ts @@ -4,10 +4,10 @@ import { attachContractsMap, } from '@hyperlane-xyz/sdk'; -import { HelloWorldApp } from '../app/app'; -import { helloWorldFactories } from '../app/contracts'; -import { HelloWorldChecker } from '../deploy/check'; -import { prodConfigs } from '../deploy/config'; +import { HelloWorldApp } from '../app/app.js'; +import { helloWorldFactories } from '../app/contracts.js'; +import { HelloWorldChecker } from '../deploy/check.js'; +import { prodConfigs } from '../deploy/config.js'; // COPY FROM OUTPUT OF DEPLOYMENT SCRIPT OR IMPORT FROM ELSEWHERE const deploymentAddresses = {}; diff --git a/typescript/helloworld/src/scripts/deploy.ts b/typescript/helloworld/src/scripts/deploy.ts index 8fb157a91..c891ab060 100644 --- a/typescript/helloworld/src/scripts/deploy.ts +++ b/typescript/helloworld/src/scripts/deploy.ts @@ -6,8 +6,8 @@ import { serializeContractsMap, } from '@hyperlane-xyz/sdk'; -import { prodConfigs } from '../deploy/config'; -import { HelloWorldDeployer } from '../deploy/deploy'; +import { prodConfigs } from '../deploy/config.js'; +import { HelloWorldDeployer } from '../deploy/deploy.js'; async function main() { console.info('Getting signer'); diff --git a/typescript/helloworld/src/test/deploy.test.ts b/typescript/helloworld/src/test/deploy.test.ts index 95c416c72..ad42b488d 100644 --- a/typescript/helloworld/src/test/deploy.test.ts +++ b/typescript/helloworld/src/test/deploy.test.ts @@ -1,5 +1,5 @@ import '@nomiclabs/hardhat-waffle'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { ChainMap, @@ -11,11 +11,11 @@ import { TestCoreDeployer, } from '@hyperlane-xyz/sdk'; -import { HelloWorldApp } from '../app/app'; -import { HelloWorldFactories } from '../app/contracts'; -import { HelloWorldChecker } from '../deploy/check'; -import { HelloWorldConfig } from '../deploy/config'; -import { HelloWorldDeployer } from '../deploy/deploy'; +import { HelloWorldApp } from '../app/app.js'; +import { HelloWorldFactories } from '../app/contracts.js'; +import { HelloWorldChecker } from '../deploy/check.js'; +import { HelloWorldConfig } from '../deploy/config.js'; +import { HelloWorldDeployer } from '../deploy/deploy.js'; describe('deploy', async () => { let multiProvider: MultiProvider; @@ -26,7 +26,7 @@ describe('deploy', async () => { let app: HelloWorldApp; before(async () => { - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/helloworld/src/test/helloworld.test.ts b/typescript/helloworld/src/test/helloworld.test.ts index 5d9f1e062..7fde27c17 100644 --- a/typescript/helloworld/src/test/helloworld.test.ts +++ b/typescript/helloworld/src/test/helloworld.test.ts @@ -1,6 +1,6 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { ChainMap, @@ -12,9 +12,9 @@ import { TestCoreDeployer, } from '@hyperlane-xyz/sdk'; -import { HelloWorldConfig } from '../deploy/config'; -import { HelloWorldDeployer } from '../deploy/deploy'; -import { HelloWorld } from '../types'; +import { HelloWorldConfig } from '../deploy/config.js'; +import { HelloWorldDeployer } from '../deploy/deploy.js'; +import { HelloWorld } from '../types/index.js'; describe('HelloWorld', async () => { const localChain = Chains.test1; @@ -30,7 +30,7 @@ describe('HelloWorld', async () => { let config: ChainMap; before(async () => { - [signer] = await ethers.getSigners(); + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/helloworld/tsconfig.json b/typescript/helloworld/tsconfig.json index a4f8cf6a5..0d5e2b5c6 100644 --- a/typescript/helloworld/tsconfig.json +++ b/typescript/helloworld/tsconfig.json @@ -9,11 +9,11 @@ "ES2015", "ES2016", "ES2017", "ES2018", "ES2019", "ES2020","ES2021", "DOM" ], - "module": "commonjs", - "moduleResolution": "node", + "module": "nodenext", + "moduleResolution": "nodenext", "noEmitOnError": true, "noFallthroughCasesInSwitch": true, - "noImplicitAny": false, + "noImplicitAny": true, "noImplicitReturns": true, "noUnusedLocals": true, "outDir": "./dist", @@ -21,13 +21,17 @@ "preserveWatchOutput": true, "pretty": false, "resolveJsonModule": true, - "rootDir": "./", + "rootDir": "./src", "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "ES2020", + "target": "es2022", }, "exclude": ["./node_modules/", "./dist/", "./src/types/hardhat.d.ts"], "include": ["./src/"], - "files": ["hardhat.config.ts"] + "ts-node": { + "experimentalSpecifierResolution": "node", + "experimentalResolver": true, + "files": true + } } diff --git a/typescript/infra/config/environments/agents.ts b/typescript/infra/config/environments/agents.ts index f9f7055aa..38ef3d6ad 100644 --- a/typescript/infra/config/environments/agents.ts +++ b/typescript/infra/config/environments/agents.ts @@ -1,6 +1,6 @@ -import { agents as mainnet3Agents } from './mainnet3/agent'; -import { agents as testAgents } from './test/agent'; -import { agents as testnet4Agents } from './testnet4/agent'; +import { agents as mainnet3Agents } from './mainnet3/agent.js'; +import { agents as testAgents } from './test/agent.js'; +import { agents as testnet4Agents } from './testnet4/agent.js'; export const agents = { mainnet3: mainnet3Agents, diff --git a/typescript/infra/config/environments/helloworld.ts b/typescript/infra/config/environments/helloworld.ts index 104b3c01e..9b37539d3 100644 --- a/typescript/infra/config/environments/helloworld.ts +++ b/typescript/infra/config/environments/helloworld.ts @@ -1,5 +1,5 @@ -import { helloWorld as mainnet3HelloWorld } from './mainnet3/helloworld'; -import { helloWorld as testnet4HelloWorld } from './testnet4/helloworld'; +import { helloWorld as mainnet3HelloWorld } from './mainnet3/helloworld.js'; +import { helloWorld as testnet4HelloWorld } from './testnet4/helloworld.js'; export const helloworld = { mainnet3: mainnet3HelloWorld, diff --git a/typescript/infra/config/environments/index.ts b/typescript/infra/config/environments/index.ts index e38c89add..81f0a8104 100644 --- a/typescript/infra/config/environments/index.ts +++ b/typescript/infra/config/environments/index.ts @@ -1,6 +1,6 @@ -import { environment as mainnet3 } from './mainnet3'; -import { environment as test } from './test'; -import { environment as testnet4 } from './testnet4'; +import { environment as mainnet3 } from './mainnet3/index.js'; +import { environment as test } from './test/index.js'; +import { environment as testnet4 } from './testnet4/index.js'; export const environments = { test, diff --git a/typescript/infra/config/environments/mainnet3/agent.ts b/typescript/infra/config/environments/mainnet3/agent.ts index 7bd4740af..faf48181a 100644 --- a/typescript/infra/config/environments/mainnet3/agent.ts +++ b/typescript/infra/config/environments/mainnet3/agent.ts @@ -1,5 +1,6 @@ import { Chains, + GasPaymentEnforcement, GasPaymentEnforcementPolicyType, RpcConsensusType, chainMetadata, @@ -10,18 +11,17 @@ import { AgentChainConfig, RootAgentConfig, getAgentChainNamesFromConfig, -} from '../../../src/config'; +} from '../../../src/config/agent/agent.js'; import { - GasPaymentEnforcementConfig, matchingList, routerMatchingList, -} from '../../../src/config/agent/relayer'; -import { ALL_KEY_ROLES, Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +} from '../../../src/config/agent/relayer.js'; +import { ALL_KEY_ROLES, Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { environment, supportedChainNames } from './chains'; -import { helloWorld } from './helloworld'; -import { validatorChainConfig } from './validators'; +import { environment, supportedChainNames } from './chains.js'; +import { helloWorld } from './helloworld.js'; +import { validatorChainConfig } from './validators.js'; import ancient8EthereumUsdcAddresses from './warp/ancient8-USDC-addresses.json'; import arbitrumTIAAddresses from './warp/arbitrum-TIA-addresses.json'; import inevmEthereumUsdcAddresses from './warp/inevm-USDC-addresses.json'; @@ -125,7 +125,7 @@ const contextBase = { }, } as const; -const gasPaymentEnforcement: GasPaymentEnforcementConfig[] = [ +const gasPaymentEnforcement: GasPaymentEnforcement[] = [ { type: GasPaymentEnforcementPolicyType.OnChainFeeQuoting, }, diff --git a/typescript/infra/config/environments/mainnet3/chains.ts b/typescript/infra/config/environments/mainnet3/chains.ts index 73a1681a0..d8e0b4ee1 100644 --- a/typescript/infra/config/environments/mainnet3/chains.ts +++ b/typescript/infra/config/environments/mainnet3/chains.ts @@ -5,7 +5,7 @@ import { chainMetadata, } from '@hyperlane-xyz/sdk'; -import { getChainMetadatas } from '../../../src/config/chain'; +import { getChainMetadatas } from '../../../src/config/chain.js'; // The `Mainnets` from the SDK are all supported chains for the mainnet3 environment. // These chains may be any protocol type. diff --git a/typescript/infra/config/environments/mainnet3/core.ts b/typescript/infra/config/environments/mainnet3/core.ts index 4808494d0..dce9e1fd0 100644 --- a/typescript/infra/config/environments/mainnet3/core.ts +++ b/typescript/infra/config/environments/mainnet3/core.ts @@ -20,9 +20,9 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, objMap } from '@hyperlane-xyz/utils'; -import { supportedChainNames } from './chains'; -import { igp } from './igp'; -import { DEPLOYER, owners } from './owners'; +import { supportedChainNames } from './chains.js'; +import { igp } from './igp.js'; +import { DEPLOYER, owners } from './owners.js'; export const core: ChainMap = objMap(owners, (local, owner) => { const originMultisigs: ChainMap = Object.fromEntries( diff --git a/typescript/infra/config/environments/mainnet3/funding.ts b/typescript/infra/config/environments/mainnet3/funding.ts index 4d91b1683..58c3bf18f 100644 --- a/typescript/infra/config/environments/mainnet3/funding.ts +++ b/typescript/infra/config/environments/mainnet3/funding.ts @@ -1,10 +1,10 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { KeyFunderConfig } from '../../../src/config/funding'; -import { Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +import { KeyFunderConfig } from '../../../src/config/funding.js'; +import { Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; export const keyFunderConfig: KeyFunderConfig = { docker: { diff --git a/typescript/infra/config/environments/mainnet3/gas-oracle.ts b/typescript/infra/config/environments/mainnet3/gas-oracle.ts index e27166fbc..9f6e39e0a 100644 --- a/typescript/infra/config/environments/mainnet3/gas-oracle.ts +++ b/typescript/infra/config/environments/mainnet3/gas-oracle.ts @@ -5,14 +5,12 @@ import { objMap } from '@hyperlane-xyz/utils'; import { AllStorageGasOracleConfigs, - getAllStorageGasOracleConfigs, -} from '../../../src/config'; -import { TOKEN_EXCHANGE_RATE_DECIMALS, + getAllStorageGasOracleConfigs, getTokenExchangeRateFromValues, -} from '../../../src/config/gas-oracle'; +} from '../../../src/config/gas-oracle.js'; -import { supportedChainNames } from './chains'; +import { supportedChainNames } from './chains.js'; import rawGasPrices from './gasPrices.json'; import rawTokenPrices from './tokenPrices.json'; diff --git a/typescript/infra/config/environments/mainnet3/helloworld.ts b/typescript/infra/config/environments/mainnet3/helloworld.ts index 82cf5692a..4c361adcf 100644 --- a/typescript/infra/config/environments/mainnet3/helloworld.ts +++ b/typescript/infra/config/environments/mainnet3/helloworld.ts @@ -1,10 +1,12 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { HelloWorldConfig } from '../../../src/config'; -import { HelloWorldKathyRunMode } from '../../../src/config/helloworld/types'; -import { Contexts } from '../../contexts'; +import { + HelloWorldConfig, + HelloWorldKathyRunMode, +} from '../../../src/config/helloworld/types.js'; +import { Contexts } from '../../contexts.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; import hyperlaneAddresses from './helloworld/hyperlane/addresses.json'; import rcAddresses from './helloworld/rc/addresses.json'; diff --git a/typescript/infra/config/environments/mainnet3/igp.ts b/typescript/infra/config/environments/mainnet3/igp.ts index c6b66f7c2..33c2e30d0 100644 --- a/typescript/infra/config/environments/mainnet3/igp.ts +++ b/typescript/infra/config/environments/mainnet3/igp.ts @@ -10,9 +10,9 @@ import { MainnetChains, ethereumChainNames, supportedChainNames, -} from './chains'; -import { storageGasOracleConfig } from './gas-oracle'; -import { DEPLOYER, owners } from './owners'; +} from './chains.js'; +import { storageGasOracleConfig } from './gas-oracle.js'; +import { DEPLOYER, owners } from './owners.js'; const FOREIGN_DEFAULT_OVERHEAD = 600_000; // cosmwasm warp route somewhat arbitrarily chosen diff --git a/typescript/infra/config/environments/mainnet3/index.ts b/typescript/infra/config/environments/mainnet3/index.ts index 127af1226..a8bc14983 100644 --- a/typescript/infra/config/environments/mainnet3/index.ts +++ b/typescript/infra/config/environments/mainnet3/index.ts @@ -4,20 +4,20 @@ import { ProtocolType, objFilter } from '@hyperlane-xyz/utils'; import { getKeysForRole, getMultiProviderForRole, -} from '../../../scripts/agent-utils'; -import { EnvironmentConfig } from '../../../src/config'; -import { Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +} from '../../../scripts/agent-utils.js'; +import { EnvironmentConfig } from '../../../src/config/environment.js'; +import { Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { agents } from './agent'; -import { environment as environmentName, mainnetConfigs } from './chains'; -import { core } from './core'; -import { keyFunderConfig } from './funding'; -import { helloWorld } from './helloworld'; -import { igp } from './igp'; -import { infrastructure } from './infrastructure'; -import { bridgeAdapterConfigs, relayerConfig } from './liquidityLayer'; -import { owners } from './owners'; +import { agents } from './agent.js'; +import { environment as environmentName, mainnetConfigs } from './chains.js'; +import { core } from './core.js'; +import { keyFunderConfig } from './funding.js'; +import { helloWorld } from './helloworld.js'; +import { igp } from './igp.js'; +import { infrastructure } from './infrastructure.js'; +import { bridgeAdapterConfigs, relayerConfig } from './liquidityLayer.js'; +import { owners } from './owners.js'; export const environment: EnvironmentConfig = { environment: environmentName, diff --git a/typescript/infra/config/environments/mainnet3/infrastructure.ts b/typescript/infra/config/environments/mainnet3/infrastructure.ts index f12382948..1ffdf19fc 100644 --- a/typescript/infra/config/environments/mainnet3/infrastructure.ts +++ b/typescript/infra/config/environments/mainnet3/infrastructure.ts @@ -1,4 +1,4 @@ -import { InfrastructureConfig } from '../../../src/config'; +import { InfrastructureConfig } from '../../../src/config/infrastructure.js'; export const infrastructure: InfrastructureConfig = { kubernetes: { diff --git a/typescript/infra/config/environments/mainnet3/liquidityLayer.ts b/typescript/infra/config/environments/mainnet3/liquidityLayer.ts index 6d0759f82..98847a8d5 100644 --- a/typescript/infra/config/environments/mainnet3/liquidityLayer.ts +++ b/typescript/infra/config/environments/mainnet3/liquidityLayer.ts @@ -8,9 +8,9 @@ import { getDomainId, } from '@hyperlane-xyz/sdk'; -import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware'; +import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; const circleDomainMapping = [ { diff --git a/typescript/infra/config/environments/mainnet3/owners.ts b/typescript/infra/config/environments/mainnet3/owners.ts index 2695402df..ab949f366 100644 --- a/typescript/infra/config/environments/mainnet3/owners.ts +++ b/typescript/infra/config/environments/mainnet3/owners.ts @@ -6,7 +6,7 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, objFilter, objMap } from '@hyperlane-xyz/utils'; -import { ethereumChainNames } from './chains'; +import { ethereumChainNames } from './chains.js'; export const timelocks: ChainMap
= { arbitrum: '0xAC98b0cD1B64EA4fe133C6D2EDaf842cE5cF4b01', diff --git a/typescript/infra/config/environments/mainnet3/validators.ts b/typescript/infra/config/environments/mainnet3/validators.ts index 06cbcd175..ad32c9339 100644 --- a/typescript/infra/config/environments/mainnet3/validators.ts +++ b/typescript/infra/config/environments/mainnet3/validators.ts @@ -1,10 +1,10 @@ import { chainMetadata, getReorgPeriod } from '@hyperlane-xyz/sdk'; -import { ValidatorBaseChainConfigMap } from '../../../src/config/agent'; -import { Contexts } from '../../contexts'; -import { validatorBaseConfigsFn } from '../utils'; +import { ValidatorBaseChainConfigMap } from '../../../src/config/agent/validator.js'; +import { Contexts } from '../../contexts.js'; +import { validatorBaseConfigsFn } from '../utils.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; export const validatorChainConfig = ( context: Contexts, diff --git a/typescript/infra/config/environments/test/agent.ts b/typescript/infra/config/environments/test/agent.ts index ff822528e..1ee2f75ec 100644 --- a/typescript/infra/config/environments/test/agent.ts +++ b/typescript/infra/config/environments/test/agent.ts @@ -3,12 +3,12 @@ import { RpcConsensusType, } from '@hyperlane-xyz/sdk'; -import { RootAgentConfig } from '../../../src/config'; -import { ALL_KEY_ROLES } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +import { RootAgentConfig } from '../../../src/config/agent/agent.js'; +import { ALL_KEY_ROLES } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { agentChainNames, chainNames } from './chains'; -import { validators } from './validators'; +import { agentChainNames, chainNames } from './chains.js'; +import { validators } from './validators.js'; const roleBase = { docker: { diff --git a/typescript/infra/config/environments/test/aggregationIsm.ts b/typescript/infra/config/environments/test/aggregationIsm.ts index c044eea51..3324e90bd 100644 --- a/typescript/infra/config/environments/test/aggregationIsm.ts +++ b/typescript/infra/config/environments/test/aggregationIsm.ts @@ -1,6 +1,6 @@ import { AggregationIsmConfig, IsmType } from '@hyperlane-xyz/sdk'; -import { merkleRootMultisig, messageIdMultisig } from './multisigIsm'; +import { merkleRootMultisig, messageIdMultisig } from './multisigIsm.js'; export const aggregationIsm = (validatorKey: string): AggregationIsmConfig => { return { diff --git a/typescript/infra/config/environments/test/chains.ts b/typescript/infra/config/environments/test/chains.ts index dd2e73b78..aa2a721d3 100644 --- a/typescript/infra/config/environments/test/chains.ts +++ b/typescript/infra/config/environments/test/chains.ts @@ -1,6 +1,6 @@ import { ChainMap, ChainMetadata, chainMetadata } from '@hyperlane-xyz/sdk'; -import { AgentChainNames, Role } from '../../../src/roles'; +import { AgentChainNames, Role } from '../../../src/roles.js'; export const testConfigs: ChainMap = { test1: chainMetadata.test1, diff --git a/typescript/infra/config/environments/test/core.ts b/typescript/infra/config/environments/test/core.ts index 698245a84..6063d71c0 100644 --- a/typescript/infra/config/environments/test/core.ts +++ b/typescript/infra/config/environments/test/core.ts @@ -9,15 +9,15 @@ import { IgpHookConfig, IsmType, MerkleTreeHookConfig, + ProtocolFeeHookConfig, RoutingIsmConfig, } from '@hyperlane-xyz/sdk'; -import { ProtocolFeeHookConfig } from '@hyperlane-xyz/sdk/src/hook/types'; import { objMap } from '@hyperlane-xyz/utils'; -import { aggregationIsm } from './aggregationIsm'; -import { igp } from './igp'; -import { chainToValidator } from './multisigIsm'; -import { owners } from './owners'; +import { aggregationIsm } from './aggregationIsm.js'; +import { igp } from './igp.js'; +import { chainToValidator } from './multisigIsm.js'; +import { owners } from './owners.js'; export const core: ChainMap = objMap(owners, (local, owner) => { const defaultIsm: RoutingIsmConfig = { diff --git a/typescript/infra/config/environments/test/gas-oracle.ts b/typescript/infra/config/environments/test/gas-oracle.ts index 5a7d9c961..f15168e47 100644 --- a/typescript/infra/config/environments/test/gas-oracle.ts +++ b/typescript/infra/config/environments/test/gas-oracle.ts @@ -2,13 +2,13 @@ import { BigNumber, ethers } from 'ethers'; import { ChainMap, ChainName } from '@hyperlane-xyz/sdk'; -import { AllStorageGasOracleConfigs } from '../../../src/config'; import { + AllStorageGasOracleConfigs, TOKEN_EXCHANGE_RATE_DECIMALS, getAllStorageGasOracleConfigs, -} from '../../../src/config/gas-oracle'; +} from '../../../src/config/gas-oracle.js'; -import { chainNames } from './chains'; +import { chainNames } from './chains.js'; const TEST_TOKEN_EXCHANGE_RATE = ethers.utils.parseUnits( '1', diff --git a/typescript/infra/config/environments/test/igp.ts b/typescript/infra/config/environments/test/igp.ts index 86b419a29..a876187c1 100644 --- a/typescript/infra/config/environments/test/igp.ts +++ b/typescript/infra/config/environments/test/igp.ts @@ -6,9 +6,9 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, exclude, objMap } from '@hyperlane-xyz/utils'; -import { TestChains, chainNames } from './chains'; -import { multisigIsm } from './multisigIsm'; -import { owners } from './owners'; +import { TestChains, chainNames } from './chains.js'; +import { multisigIsm } from './multisigIsm.js'; +import { owners } from './owners.js'; function getGasOracles(local: TestChains) { return Object.fromEntries( diff --git a/typescript/infra/config/environments/test/index.ts b/typescript/infra/config/environments/test/index.ts index c11ab549f..1b8df1c35 100644 --- a/typescript/infra/config/environments/test/index.ts +++ b/typescript/infra/config/environments/test/index.ts @@ -2,14 +2,14 @@ import { JsonRpcProvider } from '@ethersproject/providers'; import { MultiProvider } from '@hyperlane-xyz/sdk'; -import { EnvironmentConfig } from '../../../src/config'; +import { EnvironmentConfig } from '../../../src/config/environment.js'; -import { agents } from './agent'; -import { testConfigs } from './chains'; -import { core } from './core'; -import { igp } from './igp'; -import { infra } from './infra'; -import { owners } from './owners'; +import { agents } from './agent.js'; +import { testConfigs } from './chains.js'; +import { core } from './core.js'; +import { igp } from './igp.js'; +import { infra } from './infra.js'; +import { owners } from './owners.js'; export const environment: EnvironmentConfig = { environment: 'test', diff --git a/typescript/infra/config/environments/test/infra.ts b/typescript/infra/config/environments/test/infra.ts index 68a2acd61..0f9da43a6 100644 --- a/typescript/infra/config/environments/test/infra.ts +++ b/typescript/infra/config/environments/test/infra.ts @@ -1,4 +1,4 @@ -import { InfrastructureConfig } from '../../../src/config'; +import { InfrastructureConfig } from '../../../src/config/infrastructure.js'; export const infra: InfrastructureConfig = { kubernetes: { clusterName: '' }, diff --git a/typescript/infra/config/environments/test/owners.ts b/typescript/infra/config/environments/test/owners.ts index 4156bd0ec..a8cba2ecd 100644 --- a/typescript/infra/config/environments/test/owners.ts +++ b/typescript/infra/config/environments/test/owners.ts @@ -1,6 +1,6 @@ import { ChainMap, OwnableConfig } from '@hyperlane-xyz/sdk'; -import { chainNames } from './chains'; +import { chainNames } from './chains.js'; // Owner is hardhat account 0 const OWNER_ADDRESS = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'; diff --git a/typescript/infra/config/environments/test/routingIsm.ts b/typescript/infra/config/environments/test/routingIsm.ts index 7744e7471..8897b6d67 100644 --- a/typescript/infra/config/environments/test/routingIsm.ts +++ b/typescript/infra/config/environments/test/routingIsm.ts @@ -1,6 +1,6 @@ import { IsmType, RoutingIsmConfig } from '@hyperlane-xyz/sdk'; -import { multisigIsm } from './multisigIsm'; +import { multisigIsm } from './multisigIsm.js'; export const routingIsm = ( local_chain: string, diff --git a/typescript/infra/config/environments/test/validators.ts b/typescript/infra/config/environments/test/validators.ts index bab387529..56c25317d 100644 --- a/typescript/infra/config/environments/test/validators.ts +++ b/typescript/infra/config/environments/test/validators.ts @@ -3,7 +3,7 @@ import { ChainName } from '@hyperlane-xyz/sdk'; import { CheckpointSyncerType, ValidatorBaseChainConfigMap, -} from '../../../src/config'; +} from '../../../src/config/agent/validator.js'; const localStoragePath = (chainName: ChainName) => `/tmp/hyperlane-test-${chainName}-validator`; diff --git a/typescript/infra/config/environments/testnet4/agent.ts b/typescript/infra/config/environments/testnet4/agent.ts index 88aae5c1f..71114952e 100644 --- a/typescript/infra/config/environments/testnet4/agent.ts +++ b/typescript/infra/config/environments/testnet4/agent.ts @@ -1,5 +1,6 @@ import { Chains, + GasPaymentEnforcement, GasPaymentEnforcementPolicyType, RpcConsensusType, } from '@hyperlane-xyz/sdk'; @@ -8,15 +9,14 @@ import { AgentChainConfig, RootAgentConfig, getAgentChainNamesFromConfig, - routerMatchingList, -} from '../../../src/config'; -import { GasPaymentEnforcementConfig } from '../../../src/config/agent/relayer'; -import { ALL_KEY_ROLES, Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +} from '../../../src/config/agent/agent.js'; +import { routerMatchingList } from '../../../src/config/agent/relayer.js'; +import { ALL_KEY_ROLES, Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { environment, supportedChainNames } from './chains'; -import { helloWorld } from './helloworld'; -import { validatorChainConfig } from './validators'; +import { environment, supportedChainNames } from './chains.js'; +import { helloWorld } from './helloworld.js'; +import { validatorChainConfig } from './validators.js'; import plumetestnetSepoliaAddresses from './warp/plumetestnet-sepolia-addresses.json'; const releaseCandidateHelloworldMatchingList = routerMatchingList( @@ -79,7 +79,7 @@ const contextBase = { }, } as const; -const gasPaymentEnforcement: GasPaymentEnforcementConfig[] = [ +const gasPaymentEnforcement: GasPaymentEnforcement[] = [ // Default policy is OnChainFeeQuoting { type: GasPaymentEnforcementPolicyType.OnChainFeeQuoting, diff --git a/typescript/infra/config/environments/testnet4/core.ts b/typescript/infra/config/environments/testnet4/core.ts index be92d1a5e..1274b7450 100644 --- a/typescript/infra/config/environments/testnet4/core.ts +++ b/typescript/infra/config/environments/testnet4/core.ts @@ -20,9 +20,9 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, objMap } from '@hyperlane-xyz/utils'; -import { supportedChainNames } from './chains'; -import { igp } from './igp'; -import { owners } from './owners'; +import { supportedChainNames } from './chains.js'; +import { igp } from './igp.js'; +import { owners } from './owners.js'; export const core: ChainMap = objMap( owners, diff --git a/typescript/infra/config/environments/testnet4/funding.ts b/typescript/infra/config/environments/testnet4/funding.ts index 3552dbdf9..8c9ad0621 100644 --- a/typescript/infra/config/environments/testnet4/funding.ts +++ b/typescript/infra/config/environments/testnet4/funding.ts @@ -1,10 +1,10 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { KeyFunderConfig } from '../../../src/config/funding'; -import { Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +import { KeyFunderConfig } from '../../../src/config/funding.js'; +import { Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; export const keyFunderConfig: KeyFunderConfig = { docker: { diff --git a/typescript/infra/config/environments/testnet4/gas-oracle.ts b/typescript/infra/config/environments/testnet4/gas-oracle.ts index ab4181290..6ef880889 100644 --- a/typescript/infra/config/environments/testnet4/gas-oracle.ts +++ b/typescript/infra/config/environments/testnet4/gas-oracle.ts @@ -4,14 +4,12 @@ import { ChainMap, ChainName } from '@hyperlane-xyz/sdk'; import { AllStorageGasOracleConfigs, - getAllStorageGasOracleConfigs, -} from '../../../src/config'; -import { TOKEN_EXCHANGE_RATE_DECIMALS, + getAllStorageGasOracleConfigs, getTokenExchangeRateFromValues, -} from '../../../src/config/gas-oracle'; +} from '../../../src/config/gas-oracle.js'; -import { supportedChainNames } from './chains'; +import { supportedChainNames } from './chains.js'; // Taken by looking at each testnet and overestimating gas prices const gasPrices: ChainMap = { diff --git a/typescript/infra/config/environments/testnet4/helloworld.ts b/typescript/infra/config/environments/testnet4/helloworld.ts index f869b445e..6f47a95ce 100644 --- a/typescript/infra/config/environments/testnet4/helloworld.ts +++ b/typescript/infra/config/environments/testnet4/helloworld.ts @@ -1,10 +1,12 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { HelloWorldConfig } from '../../../src/config'; -import { HelloWorldKathyRunMode } from '../../../src/config/helloworld/types'; -import { Contexts } from '../../contexts'; +import { + HelloWorldConfig, + HelloWorldKathyRunMode, +} from '../../../src/config/helloworld/types.js'; +import { Contexts } from '../../contexts.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; import hyperlaneAddresses from './helloworld/hyperlane/addresses.json'; import rcAddresses from './helloworld/rc/addresses.json'; diff --git a/typescript/infra/config/environments/testnet4/igp.ts b/typescript/infra/config/environments/testnet4/igp.ts index 5ef35db56..c2dc97a36 100644 --- a/typescript/infra/config/environments/testnet4/igp.ts +++ b/typescript/infra/config/environments/testnet4/igp.ts @@ -6,9 +6,9 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, exclude, objMap } from '@hyperlane-xyz/utils'; -import { supportedChainNames } from './chains'; -import { storageGasOracleConfig } from './gas-oracle'; -import { owners } from './owners'; +import { supportedChainNames } from './chains.js'; +import { storageGasOracleConfig } from './gas-oracle.js'; +import { owners } from './owners.js'; export const igp: ChainMap = objMap(owners, (chain, ownerConfig) => { return { diff --git a/typescript/infra/config/environments/testnet4/index.ts b/typescript/infra/config/environments/testnet4/index.ts index b522e7eef..9eaa66e1c 100644 --- a/typescript/infra/config/environments/testnet4/index.ts +++ b/typescript/infra/config/environments/testnet4/index.ts @@ -3,21 +3,21 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; import { getKeysForRole, getMultiProviderForRole, -} from '../../../scripts/agent-utils'; -import { EnvironmentConfig } from '../../../src/config'; -import { Role } from '../../../src/roles'; -import { Contexts } from '../../contexts'; +} from '../../../scripts/agent-utils.js'; +import { EnvironmentConfig } from '../../../src/config/environment.js'; +import { Role } from '../../../src/roles.js'; +import { Contexts } from '../../contexts.js'; -import { agents } from './agent'; -import { environment as environmentName, testnetConfigs } from './chains'; -import { core } from './core'; -import { keyFunderConfig } from './funding'; -import { helloWorld } from './helloworld'; -import { igp } from './igp'; -import { infrastructure } from './infrastructure'; -import { bridgeAdapterConfigs } from './liquidityLayer'; -import { liquidityLayerRelayerConfig } from './middleware'; -import { owners } from './owners'; +import { agents } from './agent.js'; +import { environment as environmentName, testnetConfigs } from './chains.js'; +import { core } from './core.js'; +import { keyFunderConfig } from './funding.js'; +import { helloWorld } from './helloworld.js'; +import { igp } from './igp.js'; +import { infrastructure } from './infrastructure.js'; +import { bridgeAdapterConfigs } from './liquidityLayer.js'; +import { liquidityLayerRelayerConfig } from './middleware.js'; +import { owners } from './owners.js'; export const environment: EnvironmentConfig = { environment: environmentName, diff --git a/typescript/infra/config/environments/testnet4/infrastructure.ts b/typescript/infra/config/environments/testnet4/infrastructure.ts index 9429f4782..33d26d2fe 100644 --- a/typescript/infra/config/environments/testnet4/infrastructure.ts +++ b/typescript/infra/config/environments/testnet4/infrastructure.ts @@ -1,4 +1,4 @@ -import { InfrastructureConfig } from '../../../src/config'; +import { InfrastructureConfig } from '../../../src/config/infrastructure.js'; export const infrastructure: InfrastructureConfig = { kubernetes: { diff --git a/typescript/infra/config/environments/testnet4/middleware.ts b/typescript/infra/config/environments/testnet4/middleware.ts index 6d54c83d8..e68cee52f 100644 --- a/typescript/infra/config/environments/testnet4/middleware.ts +++ b/typescript/infra/config/environments/testnet4/middleware.ts @@ -1,8 +1,8 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware'; +import { LiquidityLayerRelayerConfig } from '../../../src/config/middleware.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; export const liquidityLayerRelayerConfig: LiquidityLayerRelayerConfig = { docker: { diff --git a/typescript/infra/config/environments/testnet4/owners.ts b/typescript/infra/config/environments/testnet4/owners.ts index f63732d4c..af2871a6c 100644 --- a/typescript/infra/config/environments/testnet4/owners.ts +++ b/typescript/infra/config/environments/testnet4/owners.ts @@ -1,6 +1,6 @@ import { ChainMap, OwnableConfig } from '@hyperlane-xyz/sdk'; -import { supportedChainNames } from '../testnet4/chains'; +import { supportedChainNames } from '../testnet4/chains.js'; const ETHEREUM_DEPLOYER_ADDRESS = '0xfaD1C94469700833717Fa8a3017278BC1cA8031C'; // const SEALEVEL_DEPLOYER_ADDRESS = '6DjHX6Ezjpq3zZMZ8KsqyoFYo1zPSDoiZmLLkxD4xKXS'; diff --git a/typescript/infra/config/environments/testnet4/validators.ts b/typescript/infra/config/environments/testnet4/validators.ts index abe8fce07..c02745280 100644 --- a/typescript/infra/config/environments/testnet4/validators.ts +++ b/typescript/infra/config/environments/testnet4/validators.ts @@ -1,10 +1,10 @@ import { chainMetadata, getReorgPeriod } from '@hyperlane-xyz/sdk'; -import { ValidatorBaseChainConfigMap } from '../../../src/config/agent'; -import { Contexts } from '../../contexts'; -import { validatorBaseConfigsFn } from '../utils'; +import { ValidatorBaseChainConfigMap } from '../../../src/config/agent/validator.js'; +import { Contexts } from '../../contexts.js'; +import { validatorBaseConfigsFn } from '../utils.js'; -import { environment } from './chains'; +import { environment } from './chains.js'; export const validatorChainConfig = ( context: Contexts, diff --git a/typescript/infra/config/environments/utils.ts b/typescript/infra/config/environments/utils.ts index b10995ee5..d9e25417e 100644 --- a/typescript/infra/config/environments/utils.ts +++ b/typescript/infra/config/environments/utils.ts @@ -3,8 +3,8 @@ import { CoreChainName } from '@hyperlane-xyz/sdk'; import { CheckpointSyncerType, ValidatorBaseConfig, -} from '../../src/config/agent/validator'; -import { Contexts } from '../contexts'; +} from '../../src/config/agent/validator.js'; +import { Contexts } from '../contexts.js'; export type ValidatorKey = { identifier: string; diff --git a/typescript/infra/config/multisigIsm.ts b/typescript/infra/config/multisigIsm.ts index 8f3f23d6e..038b0331b 100644 --- a/typescript/infra/config/multisigIsm.ts +++ b/typescript/infra/config/multisigIsm.ts @@ -6,13 +6,13 @@ import { defaultMultisigConfigs, } from '@hyperlane-xyz/sdk'; -import { DeployEnvironment } from '../src/config'; +import { DeployEnvironment } from '../src/config/environment.js'; -import { Contexts } from './contexts'; -import { supportedChainNames as mainnet3Chains } from './environments/mainnet3/chains'; -import { chainNames as testChains } from './environments/test/chains'; -import { supportedChainNames as testnet4Chains } from './environments/testnet4/chains'; -import { rcMultisigIsmConfigs } from './rcMultisigIsmConfigs'; +import { Contexts } from './contexts.js'; +import { supportedChainNames as mainnet3Chains } from './environments/mainnet3/chains.js'; +import { chainNames as testChains } from './environments/test/chains.js'; +import { supportedChainNames as testnet4Chains } from './environments/testnet4/chains.js'; +import { rcMultisigIsmConfigs } from './rcMultisigIsmConfigs.js'; const chains = { mainnet3: mainnet3Chains, diff --git a/typescript/infra/config/routingIsm.ts b/typescript/infra/config/routingIsm.ts index 7763ef1f8..b7a126730 100644 --- a/typescript/infra/config/routingIsm.ts +++ b/typescript/infra/config/routingIsm.ts @@ -9,13 +9,13 @@ import { TestChains, } from '@hyperlane-xyz/sdk'; -import { DeployEnvironment } from '../src/config'; +import { DeployEnvironment } from '../src/config/environment.js'; -import { Contexts } from './contexts'; -import { environments } from './environments'; -import { ethereumChainNames as mainnet3Chains } from './environments/mainnet3/chains'; -import { supportedChainNames as testnet4Chains } from './environments/testnet4/chains'; -import { multisigIsm } from './multisigIsm'; +import { Contexts } from './contexts.js'; +import { environments } from './environments/index.js'; +import { ethereumChainNames as mainnet3Chains } from './environments/mainnet3/chains.js'; +import { supportedChainNames as testnet4Chains } from './environments/testnet4/chains.js'; +import { multisigIsm } from './multisigIsm.js'; const chains = { test: TestChains, diff --git a/typescript/infra/fork-all.sh b/typescript/infra/fork-all.sh index 6f39861b4..5b0abc179 100755 --- a/typescript/infra/fork-all.sh +++ b/typescript/infra/fork-all.sh @@ -6,7 +6,7 @@ if [ -z "$ENVIRONMENT" ] || [ -z "$MODULE" ]; then exit 1 fi -CHAINS=`yarn ts-node ./scripts/print-chain-metadatas.ts -e $ENVIRONMENT | \ +CHAINS=`yarn tsx ./scripts/print-chain-metadatas.ts -e $ENVIRONMENT | \ jq -r 'to_entries | map(select(.value.protocol=="ethereum")) | map(.key) ' | \ tr -d '\"[],'` diff --git a/typescript/infra/fork.sh b/typescript/infra/fork.sh index 1e29e4dd5..765e98a47 100755 --- a/typescript/infra/fork.sh +++ b/typescript/infra/fork.sh @@ -13,7 +13,7 @@ trap 'jobs -p | xargs -r kill' EXIT # exit 1 on any subsequent failures set -e -RPC_URL=`yarn ts-node ./scripts/print-chain-metadatas.ts -e $ENVIRONMENT | jq -r ".$CHAIN.rpcUrls[0].http"` +RPC_URL=`yarn tsx ./scripts/print-chain-metadatas.ts -e $ENVIRONMENT | jq -r ".$CHAIN.rpcUrls[0].http"` anvil --fork-url $RPC_URL --fork-retry-backoff 3 --compute-units-per-second 200 --gas-price 1 --silent & ANVIL_PID=$! @@ -25,21 +25,21 @@ done # echo all subsequent commands set -x -yarn ts-node ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE +yarn tsx ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE # get balance DEPLOYER="0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba" BEFORE=$(cast balance $DEPLOYER --rpc-url http://localhost:8545) -yarn ts-node ./scripts/deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE +yarn tsx ./scripts/deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE AFTER=$(cast balance $DEPLOYER --rpc-url http://localhost:8545) DEPLOY_DELTA="$((BEFORE-AFTER))" BEFORE=$(cast balance $DEPLOYER --rpc-url http://localhost:8545) -yarn ts-node ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN --govern -m $MODULE +yarn tsx ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN --govern -m $MODULE AFTER=$(cast balance $DEPLOYER --rpc-url http://localhost:8545) GOVERN_DELTA="$((BEFORE-AFTER))" -yarn ts-node ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE +yarn tsx ./scripts/check-deploy.ts -e $ENVIRONMENT -f $CHAIN -m $MODULE diff --git a/typescript/infra/hardhat.config.cts b/typescript/infra/hardhat.config.cts new file mode 100644 index 000000000..b692ba6c9 --- /dev/null +++ b/typescript/infra/hardhat.config.cts @@ -0,0 +1,19 @@ +import '@nomiclabs/hardhat-ethers'; +import '@nomiclabs/hardhat-waffle'; + +/** + * @type import('hardhat/config').HardhatUserConfig + */ +module.exports = { + solidity: { + version: '0.7.6', + }, + networks: { + hardhat: { + mining: { + auto: true, + interval: 2000, + }, + }, + }, +}; diff --git a/typescript/infra/hardhat.config.ts b/typescript/infra/hardhat.config.ts deleted file mode 100644 index 9311882fc..000000000 --- a/typescript/infra/hardhat.config.ts +++ /dev/null @@ -1,186 +0,0 @@ -import '@nomiclabs/hardhat-etherscan'; -import '@nomiclabs/hardhat-waffle'; -import { task } from 'hardhat/config'; -import { HardhatRuntimeEnvironment } from 'hardhat/types'; - -import { Mailbox, TestSendReceiver__factory } from '@hyperlane-xyz/core'; -import { - ChainName, - HookType, - HyperlaneCore, - MultiProvider, -} from '@hyperlane-xyz/sdk'; -import { addressToBytes32 } from '@hyperlane-xyz/utils'; - -import { Modules, getAddresses } from './scripts/agent-utils'; -import { sleep } from './src/utils/utils'; - -enum MailboxHookType { - REQUIRED = 'requiredHook', - DEFAULT = 'defaultHook', -} - -/** - * If a hookArg is provided, set the mailbox hook to the defaultHookArg. - * The hook is set either as the default hook or the required hook, - * depending on the mailboxHookType argument. - */ -async function setMailboxHook( - mailbox: Mailbox, - coreAddresses: any, - local: ChainName, - mailboxHookType: MailboxHookType, - hookArg: HookType, -) { - const hook = coreAddresses[local][hookArg]; - switch (mailboxHookType) { - case MailboxHookType.REQUIRED: { - await mailbox.setRequiredHook(hook); - break; - } - case MailboxHookType.DEFAULT: { - await mailbox.setDefaultHook(hook); - break; - } - } - console.log(`set the ${mailboxHookType} hook on ${local} to ${hook}`); -} - -const chainSummary = async (core: HyperlaneCore, chain: ChainName) => { - const coreContracts = core.getContracts(chain); - const mailbox = coreContracts.mailbox; - const dispatched = await mailbox.nonce(); - // TODO: Allow processed messages to be filtered by - // origin, possibly sender and recipient. - const processFilter = mailbox.filters.Process(); - const processes = await mailbox.queryFilter(processFilter); - const processed = processes.length; - - const summary = { - chain, - dispatched, - processed, - }; - return summary; -}; - -task('kathy', 'Dispatches random hyperlane messages') - .addParam( - 'messages', - 'Number of messages to send; defaults to having no limit', - '0', - ) - .addParam('timeout', 'Time to wait between messages in ms.', '5000') - .addFlag('mineforever', 'Mine forever after sending messages') - .addParam( - MailboxHookType.DEFAULT, - 'Default hook to call in postDispatch', - HookType.AGGREGATION, - ) - .addParam( - MailboxHookType.REQUIRED, - 'Required hook to call in postDispatch', - HookType.PROTOCOL_FEE, - ) - .setAction( - async ( - taskArgs: { - messages: string; - timeout: string; - mineforever: boolean; - defaultHook: HookType; - requiredHook: HookType; - }, - hre: HardhatRuntimeEnvironment, - ) => { - const timeout = Number.parseInt(taskArgs.timeout); - const environment = 'test'; - const [signer] = await hre.ethers.getSigners(); - const multiProvider = MultiProvider.createTestMultiProvider({ signer }); - const addresses = getAddresses(environment, Modules.CORE); - const core = HyperlaneCore.fromAddressesMap(addresses, multiProvider); - - const randomElement = (list: T[]) => - list[Math.floor(Math.random() * list.length)]; - - // Deploy a recipient - const recipientF = new TestSendReceiver__factory(signer); - const recipient = await recipientF.deploy(); - await recipient.deployTransaction.wait(); - - const isAutomine: boolean = await hre.network.provider.send( - 'hardhat_getAutomine', - ); - - // Generate artificial traffic - let messages = Number.parseInt(taskArgs.messages) || 0; - const run_forever = messages === 0; - while (run_forever || messages-- > 0) { - // Round robin origin chain - const local = core.chains()[messages % core.chains().length]; - // Random remote chain - const remote: ChainName = randomElement(await core.remoteChains(local)); - const remoteId = multiProvider.getDomainId(remote); - const contracts = core.getContracts(local); - const mailbox = contracts.mailbox; - await setMailboxHook( - mailbox, - addresses, - local, - MailboxHookType.DEFAULT, - taskArgs.defaultHook, - ); - await setMailboxHook( - mailbox, - addresses, - local, - MailboxHookType.REQUIRED, - taskArgs.requiredHook, - ); - const quote = await mailbox['quoteDispatch(uint32,bytes32,bytes)']( - remoteId, - addressToBytes32(recipient.address), - '0x1234', - ); - await recipient['dispatchToSelf(address,uint32,bytes)']( - mailbox.address, - remoteId, - '0x1234', - { - value: quote, - }, - ); - console.log( - `send to ${recipient.address} on ${remote} via mailbox ${ - mailbox.address - } on ${local} with nonce ${(await mailbox.nonce()) - 1}`, - ); - console.log(await chainSummary(core, local)); - console.log(await chainSummary(core, remote)); - - await sleep(timeout); - } - - while (taskArgs.mineforever && isAutomine) { - await hre.network.provider.send('hardhat_mine', ['0x01']); - await sleep(timeout); - } - }, - ); - -/** - * @type import('hardhat/config').HardhatUserConfig - */ -module.exports = { - solidity: { - version: '0.7.6', - }, - networks: { - hardhat: { - mining: { - auto: true, - interval: 2000, - }, - }, - }, -}; diff --git a/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl b/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl index fdcb82ab2..12b1e0db9 100644 --- a/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl +++ b/typescript/infra/helm/helloworld-kathy/templates/_helpers.tpl @@ -66,7 +66,7 @@ The helloworld-kathy container image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent command: - - ./node_modules/.bin/ts-node + - ./node_modules/.bin/tsx - ./typescript/infra/scripts/helloworld/kathy.ts - -e - {{ .Values.hyperlane.runEnv }} diff --git a/typescript/infra/helm/key-funder/templates/cron-job.yaml b/typescript/infra/helm/key-funder/templates/cron-job.yaml index d51f07918..610ebf8bb 100644 --- a/typescript/infra/helm/key-funder/templates/cron-job.yaml +++ b/typescript/infra/helm/key-funder/templates/cron-job.yaml @@ -19,7 +19,7 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent command: - - ./node_modules/.bin/ts-node + - ./node_modules/.bin/tsx - ./typescript/infra/scripts/funding/fund-keys-from-deployer.ts - -e - {{ .Values.hyperlane.runEnv }} diff --git a/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml b/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml index 5d24455f8..02dc71378 100644 --- a/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml +++ b/typescript/infra/helm/liquidity-layer-relayers/templates/circle-relayer-deployment.yaml @@ -17,7 +17,7 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent command: - - ./node_modules/.bin/ts-node + - ./node_modules/.bin/tsx - ./typescript/infra/scripts/middleware/circle-relayer.ts - -e - {{ .Values.hyperlane.runEnv }} diff --git a/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml b/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml index d43ee5bf4..8f1828424 100644 --- a/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml +++ b/typescript/infra/helm/liquidity-layer-relayers/templates/portal-relayer-deployment.yaml @@ -17,7 +17,7 @@ spec: image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent command: - - ./node_modules/.bin/ts-node + - ./node_modules/.bin/tsx - ./typescript/infra/scripts/middleware/portal-relayer.ts - -e - {{ .Values.hyperlane.runEnv }} diff --git a/typescript/infra/helm/warp-routes/templates/_helpers.tpl b/typescript/infra/helm/warp-routes/templates/_helpers.tpl index 285a5842b..f4359eaf0 100644 --- a/typescript/infra/helm/warp-routes/templates/_helpers.tpl +++ b/typescript/infra/helm/warp-routes/templates/_helpers.tpl @@ -59,7 +59,7 @@ The warp-routes container image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: IfNotPresent command: - - ./node_modules/.bin/ts-node + - ./node_modules/.bin/tsx - ./typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts - -v - "10000" diff --git a/typescript/infra/package.json b/typescript/infra/package.json index 85ccef825..bf100b8d7 100644 --- a/typescript/infra/package.json +++ b/typescript/infra/package.json @@ -28,7 +28,7 @@ "yargs": "^17.7.2" }, "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.2.1", + "@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-waffle": "^2.0.6", "@types/chai": "^4.2.21", "@types/json-stable-stringify": "^1.0.36", @@ -40,11 +40,11 @@ "chai": "^4.3.6", "ethereum-waffle": "^4.0.10", "ethers": "^5.7.2", - "hardhat": "^2.19.0", + "hardhat": "^2.22.2", "mocha": "^10.2.0", "prettier": "^2.8.8", - "ts-node": "^10.8.0", - "typescript": "5.1.6" + "tsx": "^4.7.1", + "typescript": "5.3.3" }, "private": true, "homepage": "https://www.hyperlane.xyz", @@ -54,24 +54,24 @@ "Infrastructure" ], "license": "Apache-2.0", - "main": "dist/index.js", + "type": "module", "prepublish": "yarn build", "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "scripts": { - "deploy-core": "ts-node scripts/deploy.ts -e test -m core", - "deploy-igp": "ts-node scripts/deploy.ts -e test -m igp", - "deploy-ism": "ts-node scripts/deploy.ts -e test -m ism", - "deploy-helloworld": "ts-node scripts/deploy.ts -e test -m helloworld", - "deploy-hook": "ts-node scripts/deploy.ts -e test -m hook", "build": "tsc", - "clean": "rm -rf ./dist ./cache", "check": "tsc --noEmit", - "kathy": "hardhat kathy --network localhost", - "announce": "hardhat announce --network localhost", - "node": "hardhat node", - "prettier": "prettier --write *.ts ./src ./config ./scripts ./test", - "test": "mocha --config ../sdk/.mocharc.json test/**/*.test.ts && yarn test:hardhat", - "test:hardhat": "hardhat test test/govern.hardhat-test.ts", + "clean": "rm -rf ./dist ./cache", + "deploy-core": "tsx scripts/deploy.ts -e test -m core", + "deploy-igp": "tsx scripts/deploy.ts -e test -m igp", + "deploy-ism": "tsx scripts/deploy.ts -e test -m ism", + "deploy-helloworld": "tsx scripts/deploy.ts -e test -m helloworld", + "deploy-hook": "tsx scripts/deploy.ts -e test -m hook", + "hardhat-esm": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat --config hardhat.config.cts", + "kathy": "yarn tsx ./scripts/send-test-messages.ts", + "prettier": "prettier --write ./src ./config ./scripts ./test", + "test": "yarn test:unit && yarn test:hardhat", + "test:unit": "mocha --config ../sdk/.mocharc.json test/**/*.test.ts", + "test:hardhat": "yarn hardhat-esm test test/govern.hardhat-test.ts", "test:ci": "yarn test" }, "peerDependencies": { diff --git a/typescript/infra/scripts/agent-utils.ts b/typescript/infra/scripts/agent-utils.ts index 94272d862..c5b0188ac 100644 --- a/typescript/infra/scripts/agent-utils.ts +++ b/typescript/infra/scripts/agent-utils.ts @@ -1,6 +1,5 @@ -import debug from 'debug'; import path from 'path'; -import yargs from 'yargs'; +import yargs, { Argv } from 'yargs'; import { AllChains, @@ -18,26 +17,28 @@ import { ProtocolType, objMap, promiseObjAll, + rootLogger, symmetricDifference, } from '@hyperlane-xyz/utils'; -import { Contexts } from '../config/contexts'; -import { agents } from '../config/environments/agents'; -import { validatorBaseConfigsFn } from '../config/environments/utils'; -import { getCurrentKubernetesContext } from '../src/agents'; -import { getCloudAgentKey } from '../src/agents/key-utils'; -import { CloudAgentKey } from '../src/agents/keys'; +import { Contexts } from '../config/contexts.js'; +import { agents } from '../config/environments/agents.js'; +import { validatorBaseConfigsFn } from '../config/environments/utils.js'; +import { getCurrentKubernetesContext } from '../src/agents/index.js'; +import { getCloudAgentKey } from '../src/agents/key-utils.js'; +import { CloudAgentKey } from '../src/agents/keys.js'; +import { RootAgentConfig } from '../src/config/agent/agent.js'; +import { fetchProvider } from '../src/config/chain.js'; import { DeployEnvironment, EnvironmentConfig, - RootAgentConfig, -} from '../src/config'; -import { fetchProvider } from '../src/config/chain'; -import { EnvironmentNames, deployEnvToSdkEnv } from '../src/config/environment'; -import { Role } from '../src/roles'; -import { assertContext, assertRole, readJSON } from '../src/utils/utils'; + EnvironmentNames, + deployEnvToSdkEnv, +} from '../src/config/environment.js'; +import { Role } from '../src/roles.js'; +import { assertContext, assertRole, readJSON } from '../src/utils/utils.js'; -const debugLog = debug('infra:scripts:utils'); +const debugLog = rootLogger.child({ module: 'infra:scripts:utils' }).debug; export enum Modules { // TODO: change @@ -72,7 +73,7 @@ export function getArgs() { .alias('e', 'environment'); } -export function withModuleAndFork(args: yargs.Argv) { +export function withModuleAndFork(args: Argv) { return args .choices('module', Object.values(Modules)) .demandOption('module', 'hyperlane module to deploy') @@ -82,14 +83,14 @@ export function withModuleAndFork(args: yargs.Argv) { .alias('f', 'fork'); } -export function withNetwork(args: yargs.Argv) { +export function withNetwork(args: Argv) { return args .describe('network', 'network to target') .choices('network', Object.values(Chains)) .alias('n', 'network'); } -export function withContext(args: yargs.Argv) { +export function withContext(args: Argv) { return args .describe('context', 'deploy context') .default('context', Contexts.Hyperlane) @@ -98,7 +99,7 @@ export function withContext(args: yargs.Argv) { .demandOption('context'); } -export function withProtocol(args: yargs.Argv) { +export function withProtocol(args: Argv) { return args .describe('protocol', 'protocol type') .default('protocol', ProtocolType.Ethereum) @@ -106,7 +107,7 @@ export function withProtocol(args: yargs.Argv) { .demandOption('protocol'); } -export function withAgentRole(args: yargs.Argv) { +export function withAgentRole(args: Argv) { return args .describe('role', 'agent roles') .array('role') @@ -115,7 +116,7 @@ export function withAgentRole(args: yargs.Argv) { .alias('r', 'role'); } -export function withKeyRoleAndChain(args: yargs.Argv) { +export function withKeyRoleAndChain(args: Argv) { return args .describe('role', 'key role') .choices('role', Object.values(Role)) @@ -133,7 +134,7 @@ export function withKeyRoleAndChain(args: yargs.Argv) { } // missing chains are chains needed which are not as part of defaultMultisigConfigs in sdk/src/consts/ but are in chainMetadata -export function withNewChainValidators(args: yargs.Argv) { +export function withNewChainValidators(args: Argv) { return args .describe( 'newChainValidators', @@ -143,7 +144,7 @@ export function withNewChainValidators(args: yargs.Argv) { .alias('n', 'newChainValidators'); } -export function withBuildArtifactPath(args: yargs.Argv) { +export function withBuildArtifactPath(args: Argv) { return args .describe('buildArtifactPath', 'path to hardhat build artifact') .string('buildArtifactPath') diff --git a/typescript/infra/scripts/agents/deploy-agents.ts b/typescript/infra/scripts/agents/deploy-agents.ts index f2080b7af..0448bdd2b 100644 --- a/typescript/infra/scripts/agents/deploy-agents.ts +++ b/typescript/infra/scripts/agents/deploy-agents.ts @@ -1,8 +1,8 @@ -import { createAgentKeysIfNotExists } from '../../src/agents/key-utils'; -import { HelmCommand } from '../../src/utils/helm'; -import { getConfigsBasedOnArgs } from '../core-utils'; +import { createAgentKeysIfNotExists } from '../../src/agents/key-utils.js'; +import { HelmCommand } from '../../src/utils/helm.js'; +import { getConfigsBasedOnArgs } from '../core-utils.js'; -import { AgentCli } from './utils'; +import { AgentCli } from './utils.js'; async function main() { // Note the create-keys script should be ran prior to running this script. diff --git a/typescript/infra/scripts/agents/remove-agent-deploys.ts b/typescript/infra/scripts/agents/remove-agent-deploys.ts index c0c547827..6d66d7c7d 100644 --- a/typescript/infra/scripts/agents/remove-agent-deploys.ts +++ b/typescript/infra/scripts/agents/remove-agent-deploys.ts @@ -1,6 +1,6 @@ -import { HelmCommand } from '../../src/utils/helm'; +import { HelmCommand } from '../../src/utils/helm.js'; -import { AgentCli } from './utils'; +import { AgentCli } from './utils.js'; async function main() { await new AgentCli().runHelmCommand(HelmCommand.Remove); diff --git a/typescript/infra/scripts/agents/update-agents-diff.ts b/typescript/infra/scripts/agents/update-agents-diff.ts index 2d46b44b3..77322fa30 100644 --- a/typescript/infra/scripts/agents/update-agents-diff.ts +++ b/typescript/infra/scripts/agents/update-agents-diff.ts @@ -1,6 +1,6 @@ -import { HelmCommand } from '../../src/utils/helm'; +import { HelmCommand } from '../../src/utils/helm.js'; -import { AgentCli } from './utils'; +import { AgentCli } from './utils.js'; async function main() { await new AgentCli().runHelmCommand(HelmCommand.UpgradeDiff); diff --git a/typescript/infra/scripts/agents/utils.ts b/typescript/infra/scripts/agents/utils.ts index c35134680..f80f435a0 100644 --- a/typescript/infra/scripts/agents/utils.ts +++ b/typescript/infra/scripts/agents/utils.ts @@ -3,17 +3,18 @@ import { RelayerHelmManager, ScraperHelmManager, ValidatorHelmManager, -} from '../../src/agents'; -import { EnvironmentConfig, RootAgentConfig } from '../../src/config'; -import { Role } from '../../src/roles'; -import { HelmCommand } from '../../src/utils/helm'; +} from '../../src/agents/index.js'; +import { RootAgentConfig } from '../../src/config/agent/agent.js'; +import { EnvironmentConfig } from '../../src/config/environment.js'; +import { Role } from '../../src/roles.js'; +import { HelmCommand } from '../../src/utils/helm.js'; import { assertCorrectKubeContext, getArgs, withAgentRole, withContext, -} from '../agent-utils'; -import { getConfigsBasedOnArgs } from '../core-utils'; +} from '../agent-utils.js'; +import { getConfigsBasedOnArgs } from '../core-utils.js'; export class AgentCli { roles!: Role[]; diff --git a/typescript/infra/scripts/announce-validators.ts b/typescript/infra/scripts/announce-validators.ts index 10e6f6181..82d168511 100644 --- a/typescript/infra/scripts/announce-validators.ts +++ b/typescript/infra/scripts/announce-validators.ts @@ -5,17 +5,17 @@ import * as path from 'path'; import { AllChains, ChainName, HyperlaneCore } from '@hyperlane-xyz/sdk'; -import { S3Validator } from '../src/agents/aws/validator'; -import { CheckpointSyncerType } from '../src/config'; -import { deployEnvToSdkEnv } from '../src/config/environment'; -import { isEthereumProtocolChain } from '../src/utils/utils'; +import { S3Validator } from '../src/agents/aws/validator.js'; +import { CheckpointSyncerType } from '../src/config/agent/validator.js'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; +import { isEthereumProtocolChain } from '../src/utils/utils.js'; import { getAgentConfig, getArgs as getRootArgs, withContext, -} from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +} from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; function getArgs() { return withContext(getRootArgs()) diff --git a/typescript/infra/scripts/check-deploy.ts b/typescript/infra/scripts/check-deploy.ts index a623b5fe6..54b553b0a 100644 --- a/typescript/infra/scripts/check-deploy.ts +++ b/typescript/infra/scripts/check-deploy.ts @@ -15,14 +15,14 @@ import { resolveOrDeployAccountOwner, } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../config/contexts'; -import { deployEnvToSdkEnv } from '../src/config/environment'; -import { HyperlaneAppGovernor } from '../src/govern/HyperlaneAppGovernor'; -import { HyperlaneCoreGovernor } from '../src/govern/HyperlaneCoreGovernor'; -import { HyperlaneIgpGovernor } from '../src/govern/HyperlaneIgpGovernor'; -import { ProxiedRouterGovernor } from '../src/govern/ProxiedRouterGovernor'; -import { Role } from '../src/roles'; -import { impersonateAccount, useLocalProvider } from '../src/utils/fork'; +import { Contexts } from '../config/contexts.js'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; +import { HyperlaneAppGovernor } from '../src/govern/HyperlaneAppGovernor.js'; +import { HyperlaneCoreGovernor } from '../src/govern/HyperlaneCoreGovernor.js'; +import { HyperlaneIgpGovernor } from '../src/govern/HyperlaneIgpGovernor.js'; +import { ProxiedRouterGovernor } from '../src/govern/ProxiedRouterGovernor.js'; +import { Role } from '../src/roles.js'; +import { impersonateAccount, useLocalProvider } from '../src/utils/fork.js'; import { Modules, @@ -30,9 +30,9 @@ import { getArgs as getRootArgs, withContext, withModuleAndFork, -} from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; -import { getHelloWorldApp } from './helloworld/utils'; +} from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; +import { getHelloWorldApp } from './helloworld/utils.js'; function getArgs() { return withModuleAndFork(withContext(getRootArgs())) diff --git a/typescript/infra/scripts/check-rpc-urls.ts b/typescript/infra/scripts/check-rpc-urls.ts index 35d8a84e5..2ab70835b 100644 --- a/typescript/infra/scripts/check-rpc-urls.ts +++ b/typescript/infra/scripts/check-rpc-urls.ts @@ -2,10 +2,10 @@ import { ethers } from 'ethers'; import { rootLogger } from '@hyperlane-xyz/utils'; -import { getSecretRpcEndpoint } from '../src/agents'; +import { getSecretRpcEndpoint } from '../src/agents/index.js'; -import { getArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; // TODO remove this script as part of migration to CLI // It's redundant with metadata-check.ts in the SDK diff --git a/typescript/infra/scripts/core-utils.ts b/typescript/infra/scripts/core-utils.ts index 4c41ccd83..a5dbbadca 100644 --- a/typescript/infra/scripts/core-utils.ts +++ b/typescript/infra/scripts/core-utils.ts @@ -1,8 +1,8 @@ -import { Contexts } from '../config/contexts'; -import { environments } from '../config/environments'; -import { DeployEnvironment } from '../src/config'; +import { Contexts } from '../config/contexts.js'; +import { environments } from '../config/environments/index.js'; +import { DeployEnvironment } from '../src/config/environment.js'; -import { getAgentConfig, getArgs, withContext } from './agent-utils'; +import { getAgentConfig, getArgs, withContext } from './agent-utils.js'; // utils which use both environment configs diff --git a/typescript/infra/scripts/create-keys.ts b/typescript/infra/scripts/create-keys.ts index f0778501a..c5798679a 100644 --- a/typescript/infra/scripts/create-keys.ts +++ b/typescript/infra/scripts/create-keys.ts @@ -1,6 +1,6 @@ -import { createAgentKeysIfNotExists } from '../src/agents/key-utils'; +import { createAgentKeysIfNotExists } from '../src/agents/key-utils.js'; -import { getAgentConfigsBasedOnArgs } from './agent-utils'; +import { getAgentConfigsBasedOnArgs } from './agent-utils.js'; async function main() { const { agentConfig } = await getAgentConfigsBasedOnArgs(); diff --git a/typescript/infra/scripts/debug-message.ts b/typescript/infra/scripts/debug-message.ts index d39a5f1bb..a71022c53 100644 --- a/typescript/infra/scripts/debug-message.ts +++ b/typescript/infra/scripts/debug-message.ts @@ -7,10 +7,10 @@ import { } from '@hyperlane-xyz/sdk'; import { bytes32ToAddress, ensure0x, messageId } from '@hyperlane-xyz/utils'; -import { deployEnvToSdkEnv } from '../src/config/environment'; -import { assertChain } from '../src/utils/utils'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; +import { assertChain } from '../src/utils/utils.js'; -import { getArgs } from './agent-utils'; +import { getArgs } from './agent-utils.js'; async function main() { const argv = await getArgs() diff --git a/typescript/infra/scripts/delete-keys.ts b/typescript/infra/scripts/delete-keys.ts index e76aed23d..934733cfd 100644 --- a/typescript/infra/scripts/delete-keys.ts +++ b/typescript/infra/scripts/delete-keys.ts @@ -1,6 +1,6 @@ -import { deleteAgentKeys } from '../src/agents/key-utils'; +import { deleteAgentKeys } from '../src/agents/key-utils.js'; -import { getAgentConfigsBasedOnArgs } from './agent-utils'; +import { getAgentConfigsBasedOnArgs } from './agent-utils.js'; async function main() { const { agentConfig } = await getAgentConfigsBasedOnArgs(); diff --git a/typescript/infra/scripts/deploy-infra-external-secrets.ts b/typescript/infra/scripts/deploy-infra-external-secrets.ts index cd2024575..f34d3c287 100644 --- a/typescript/infra/scripts/deploy-infra-external-secrets.ts +++ b/typescript/infra/scripts/deploy-infra-external-secrets.ts @@ -1,8 +1,8 @@ -import { runExternalSecretsHelmCommand } from '../src/infrastructure/external-secrets/external-secrets'; -import { HelmCommand } from '../src/utils/helm'; +import { runExternalSecretsHelmCommand } from '../src/infrastructure/external-secrets/external-secrets.js'; +import { HelmCommand } from '../src/utils/helm.js'; -import { assertCorrectKubeContext, getArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { assertCorrectKubeContext, getArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { environment } = await getArgs().argv; diff --git a/typescript/infra/scripts/deploy-infra-monitoring.ts b/typescript/infra/scripts/deploy-infra-monitoring.ts index 81e638cab..40de93a76 100644 --- a/typescript/infra/scripts/deploy-infra-monitoring.ts +++ b/typescript/infra/scripts/deploy-infra-monitoring.ts @@ -1,8 +1,8 @@ -import { runPrometheusHelmCommand } from '../src/infrastructure/monitoring/prometheus'; -import { HelmCommand } from '../src/utils/helm'; +import { runPrometheusHelmCommand } from '../src/infrastructure/monitoring/prometheus.js'; +import { HelmCommand } from '../src/utils/helm.js'; -import { assertCorrectKubeContext, getArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { assertCorrectKubeContext, getArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { environment } = await getArgs().argv; diff --git a/typescript/infra/scripts/deploy.ts b/typescript/infra/scripts/deploy.ts index 7b88da923..fdd235bd6 100644 --- a/typescript/infra/scripts/deploy.ts +++ b/typescript/infra/scripts/deploy.ts @@ -1,6 +1,6 @@ import { ethers } from 'ethers'; import path from 'path'; -import { prompt } from 'prompts'; +import prompts from 'prompts'; import { HelloWorldDeployer } from '@hyperlane-xyz/helloworld'; import { @@ -19,29 +19,25 @@ import { InterchainAccount, InterchainAccountDeployer, InterchainQueryDeployer, - IsmConfig, - IsmType, LiquidityLayerDeployer, TestRecipientDeployer, TokenType, - buildAggregationIsmConfigs, - defaultMultisigConfigs, hyperlaneEnvironments, } from '@hyperlane-xyz/sdk'; import { objMap } from '@hyperlane-xyz/utils'; -import { Contexts } from '../config/contexts'; -import { core as coreConfig } from '../config/environments/mainnet3/core'; -import { DEPLOYER } from '../config/environments/mainnet3/owners'; -import { deployEnvToSdkEnv } from '../src/config/environment'; -import { tokens } from '../src/config/warp'; -import { deployWithArtifacts } from '../src/deployment/deploy'; -import { TestQuerySenderDeployer } from '../src/deployment/testcontracts/testquerysender'; +import { Contexts } from '../config/contexts.js'; +import { core as coreConfig } from '../config/environments/mainnet3/core.js'; +import { DEPLOYER } from '../config/environments/mainnet3/owners.js'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; +import { tokens } from '../src/config/warp.js'; +import { deployWithArtifacts } from '../src/deployment/deploy.js'; +import { TestQuerySenderDeployer } from '../src/deployment/testcontracts/testquerysender.js'; import { extractBuildArtifact, fetchExplorerApiKeys, -} from '../src/deployment/verify'; -import { impersonateAccount, useLocalProvider } from '../src/utils/fork'; +} from '../src/deployment/verify.js'; +import { impersonateAccount, useLocalProvider } from '../src/utils/fork.js'; import { Modules, @@ -54,8 +50,8 @@ import { withContext, withModuleAndFork, withNetwork, -} from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +} from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { @@ -286,7 +282,7 @@ async function main() { if (environment !== 'test' && !fork) { const confirmConfig = network ? config[network] : config; console.log(JSON.stringify(confirmConfig, null, 2)); - const { value: confirmed } = await prompt({ + const { value: confirmed } = await prompts({ type: 'confirm', name: 'value', message: `Confirm you want to deploy this ${module} configuration to ${environment}?`, diff --git a/typescript/infra/scripts/funding/deploy-key-funder.ts b/typescript/infra/scripts/funding/deploy-key-funder.ts index a73104c92..b7bb9bc86 100644 --- a/typescript/infra/scripts/funding/deploy-key-funder.ts +++ b/typescript/infra/scripts/funding/deploy-key-funder.ts @@ -1,11 +1,11 @@ -import { Contexts } from '../../config/contexts'; +import { Contexts } from '../../config/contexts.js'; import { getKeyFunderConfig, runKeyFunderHelmCommand, -} from '../../src/funding/key-funder'; -import { HelmCommand } from '../../src/utils/helm'; -import { assertCorrectKubeContext } from '../agent-utils'; -import { getConfigsBasedOnArgs } from '../core-utils'; +} from '../../src/funding/key-funder.js'; +import { HelmCommand } from '../../src/utils/helm.js'; +import { assertCorrectKubeContext } from '../agent-utils.js'; +import { getConfigsBasedOnArgs } from '../core-utils.js'; async function main() { const { agentConfig, envConfig } = await getConfigsBasedOnArgs(); diff --git a/typescript/infra/scripts/funding/fund-deterministic-key-from-deployer.ts b/typescript/infra/scripts/funding/fund-deterministic-key-from-deployer.ts index e61726add..633c98c26 100644 --- a/typescript/infra/scripts/funding/fund-deterministic-key-from-deployer.ts +++ b/typescript/infra/scripts/funding/fund-deterministic-key-from-deployer.ts @@ -3,15 +3,15 @@ import { format } from 'util'; import { promiseObjAll, rootLogger } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; +import { Contexts } from '../../config/contexts.js'; import { DeterministicKeyRoles, getDeterministicKey, -} from '../../src/funding/deterministic-keys'; -import { Role } from '../../src/roles'; -import { assertChain } from '../../src/utils/utils'; -import { getArgs } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +} from '../../src/funding/deterministic-keys.js'; +import { Role } from '../../src/roles.js'; +import { assertChain } from '../../src/utils/utils.js'; +import { getArgs } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; const logger = rootLogger.child({ module: 'fund-deterministic-key' }); diff --git a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts index 9abbff859..ecf1c3947 100644 --- a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts +++ b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts @@ -13,39 +13,41 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, objFilter, objMap, rootLogger } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; +import { Contexts } from '../../config/contexts.js'; import { KeyAsAddress, fetchLocalKeyAddresses, getRoleKeysPerChain, -} from '../../src/agents/key-utils'; +} from '../../src/agents/key-utils.js'; import { BaseAgentKey, LocalAgentKey, ReadOnlyCloudAgentKey, -} from '../../src/agents/keys'; -import { DeployEnvironment } from '../../src/config'; -import { deployEnvToSdkEnv } from '../../src/config/environment'; +} from '../../src/agents/keys.js'; +import { + DeployEnvironment, + deployEnvToSdkEnv, +} from '../../src/config/environment.js'; import { ContextAndRoles, ContextAndRolesMap, KeyFunderConfig, -} from '../../src/config/funding'; -import { FundableRole, Role } from '../../src/roles'; -import { submitMetrics } from '../../src/utils/metrics'; +} from '../../src/config/funding.js'; +import { FundableRole, Role } from '../../src/roles.js'; +import { submitMetrics } from '../../src/utils/metrics.js'; import { assertContext, assertFundableRole, assertRole, isEthereumProtocolChain, readJSONAtPath, -} from '../../src/utils/utils'; -import { getAgentConfig, getArgs } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +} from '../../src/utils/utils.js'; +import { getAgentConfig, getArgs } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; -import * as L1ETHGateway from './utils/L1ETHGateway.json'; -import * as L1MessageQueue from './utils/L1MessageQueue.json'; -import * as L1ScrollMessenger from './utils/L1ScrollMessenger.json'; +import L1ETHGateway from './utils/L1ETHGateway.json'; +import L1MessageQueue from './utils/L1MessageQueue.json'; +import L1ScrollMessenger from './utils/L1ScrollMessenger.json'; const logger = rootLogger.child({ module: 'fund-keys' }); @@ -143,7 +145,7 @@ const igpClaimThresholdPerChain: ChainMap = { // context provided in --contexts-and-roles, which requires the appropriate credentials. // // Example usage: -// ts-node ./scripts/funding/fund-keys-from-deployer.ts -e testnet4 --context hyperlane --contexts-and-roles rc=relayer +// tsx ./scripts/funding/fund-keys-from-deployer.ts -e testnet4 --context hyperlane --contexts-and-roles rc=relayer async function main() { const { environment, ...argv } = await getArgs() .string('f') diff --git a/typescript/infra/scripts/funding/reclaim-from-igp.ts b/typescript/infra/scripts/funding/reclaim-from-igp.ts index 87c836054..91e96a2ad 100644 --- a/typescript/infra/scripts/funding/reclaim-from-igp.ts +++ b/typescript/infra/scripts/funding/reclaim-from-igp.ts @@ -3,9 +3,9 @@ import { BigNumber } from 'ethers'; import { HyperlaneIgp } from '@hyperlane-xyz/sdk'; import { objMap, promiseObjAll } from '@hyperlane-xyz/utils'; -import { deployEnvToSdkEnv } from '../../src/config/environment'; -import { getArgs } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +import { deployEnvToSdkEnv } from '../../src/config/environment.js'; +import { getArgs } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; // Some arbitrary threshold for now const RECLAIM_BALANCE_THRESHOLD = BigNumber.from(10).pow(17); diff --git a/typescript/infra/scripts/get-key-addresses.ts b/typescript/infra/scripts/get-key-addresses.ts index ccbc22106..b35c38cd2 100644 --- a/typescript/infra/scripts/get-key-addresses.ts +++ b/typescript/infra/scripts/get-key-addresses.ts @@ -1,7 +1,7 @@ -import { getAllCloudAgentKeys } from '../src/agents/key-utils'; +import { getAllCloudAgentKeys } from '../src/agents/key-utils.js'; -import { getArgs, withContext, withProtocol } from './agent-utils'; -import { getConfigsBasedOnArgs } from './core-utils'; +import { getArgs, withContext, withProtocol } from './agent-utils.js'; +import { getConfigsBasedOnArgs } from './core-utils.js'; async function main() { const argv = await withProtocol(withContext(getArgs())).argv; diff --git a/typescript/infra/scripts/helloworld/deploy-kathy.ts b/typescript/infra/scripts/helloworld/deploy-kathy.ts index 2cc7bf443..6e451862c 100644 --- a/typescript/infra/scripts/helloworld/deploy-kathy.ts +++ b/typescript/infra/scripts/helloworld/deploy-kathy.ts @@ -1,9 +1,9 @@ -import { runHelloworldKathyHelmCommand } from '../../src/helloworld/kathy'; -import { HelmCommand } from '../../src/utils/helm'; -import { assertCorrectKubeContext } from '../agent-utils'; -import { getConfigsBasedOnArgs } from '../core-utils'; +import { runHelloworldKathyHelmCommand } from '../../src/helloworld/kathy.js'; +import { HelmCommand } from '../../src/utils/helm.js'; +import { assertCorrectKubeContext } from '../agent-utils.js'; +import { getConfigsBasedOnArgs } from '../core-utils.js'; -import { getHelloWorldConfig } from './utils'; +import { getHelloWorldConfig } from './utils.js'; async function main() { const { agentConfig, envConfig, context } = await getConfigsBasedOnArgs(); diff --git a/typescript/infra/scripts/helloworld/kathy.ts b/typescript/infra/scripts/helloworld/kathy.ts index 33f91e017..101bd6779 100644 --- a/typescript/infra/scripts/helloworld/kathy.ts +++ b/typescript/infra/scripts/helloworld/kathy.ts @@ -22,26 +22,27 @@ import { objMap, retryAsync, rootLogger, + sleep, strip0x, timeout, } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; -import { testnetConfigs } from '../../config/environments/testnet4/chains'; +import { Contexts } from '../../config/contexts.js'; +import { testnetConfigs } from '../../config/environments/testnet4/chains.js'; import { hyperlaneHelloworld, releaseCandidateHelloworld, -} from '../../config/environments/testnet4/helloworld'; -import { owners } from '../../config/environments/testnet4/owners'; -import { CloudAgentKey } from '../../src/agents/keys'; -import { DeployEnvironment } from '../../src/config/environment'; -import { Role } from '../../src/roles'; -import { startMetricsServer } from '../../src/utils/metrics'; -import { assertChain, diagonalize, sleep } from '../../src/utils/utils'; -import { getArgs, withContext } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; - -import { getHelloWorldMultiProtocolApp } from './utils'; +} from '../../config/environments/testnet4/helloworld.js'; +import { owners } from '../../config/environments/testnet4/owners.js'; +import { CloudAgentKey } from '../../src/agents/keys.js'; +import { DeployEnvironment } from '../../src/config/environment.js'; +import { Role } from '../../src/roles.js'; +import { startMetricsServer } from '../../src/utils/metrics.js'; +import { assertChain, diagonalize } from '../../src/utils/utils.js'; +import { getArgs, withContext } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; + +import { getHelloWorldMultiProtocolApp } from './utils.js'; const logger = rootLogger.child({ module: 'kathy' }); diff --git a/typescript/infra/scripts/helloworld/utils.ts b/typescript/infra/scripts/helloworld/utils.ts index 834d259d6..17ea92958 100644 --- a/typescript/infra/scripts/helloworld/utils.ts +++ b/typescript/infra/scripts/helloworld/utils.ts @@ -18,11 +18,13 @@ import { } from '@hyperlane-xyz/sdk'; import { ProtocolType, objMap } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; -import { EnvironmentConfig } from '../../src/config'; -import { deployEnvToSdkEnv } from '../../src/config/environment'; -import { HelloWorldConfig } from '../../src/config/helloworld/types'; -import { Role } from '../../src/roles'; +import { Contexts } from '../../config/contexts.js'; +import { + EnvironmentConfig, + deployEnvToSdkEnv, +} from '../../src/config/environment.js'; +import { HelloWorldConfig } from '../../src/config/helloworld/types.js'; +import { Role } from '../../src/roles.js'; export async function getHelloWorldApp( coreConfig: EnvironmentConfig, diff --git a/typescript/infra/scripts/list-validator-checkpoint-indices.ts b/typescript/infra/scripts/list-validator-checkpoint-indices.ts index d423861b3..d3f1ce91f 100644 --- a/typescript/infra/scripts/list-validator-checkpoint-indices.ts +++ b/typescript/infra/scripts/list-validator-checkpoint-indices.ts @@ -1,11 +1,11 @@ import { HyperlaneCore } from '@hyperlane-xyz/sdk'; -import { S3Validator } from '../src/agents/aws/validator'; -import { deployEnvToSdkEnv } from '../src/config/environment'; -import { concurrentMap } from '../src/utils/utils'; +import { S3Validator } from '../src/agents/aws/validator.js'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; +import { concurrentMap } from '../src/utils/utils.js'; -import { getArgs, getValidatorsByChain } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs, getValidatorsByChain } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { environment } = await getArgs().argv; diff --git a/typescript/infra/scripts/middleware/circle-relayer.ts b/typescript/infra/scripts/middleware/circle-relayer.ts index de9288ee0..18bc68774 100644 --- a/typescript/infra/scripts/middleware/circle-relayer.ts +++ b/typescript/infra/scripts/middleware/circle-relayer.ts @@ -1,4 +1,5 @@ -import path from 'path'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; import { LiquidityLayerApp, @@ -6,11 +7,11 @@ import { attachContractsMap, liquidityLayerFactories, } from '@hyperlane-xyz/sdk'; -import { objFilter } from '@hyperlane-xyz/utils'; +import { objFilter, sleep } from '@hyperlane-xyz/utils'; -import { readJSON, sleep } from '../../src/utils/utils'; -import { getArgs, getEnvironmentDirectory } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +import { readJSON } from '../../src/utils/utils.js'; +import { getArgs, getEnvironmentDirectory } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; async function check() { const { environment } = await getArgs().argv; @@ -21,8 +22,8 @@ async function check() { } const multiProvider = await config.getMultiProvider(); - const dir = path.join( - __dirname, + const dir = join( + dirname(fileURLToPath(import.meta.url)), '../../', getEnvironmentDirectory(environment), 'middleware/liquidity-layer', diff --git a/typescript/infra/scripts/middleware/deploy-relayers.ts b/typescript/infra/scripts/middleware/deploy-relayers.ts index 58a95da84..1dc38f23c 100644 --- a/typescript/infra/scripts/middleware/deploy-relayers.ts +++ b/typescript/infra/scripts/middleware/deploy-relayers.ts @@ -1,11 +1,11 @@ -import { Contexts } from '../../config/contexts'; +import { Contexts } from '../../config/contexts.js'; import { getLiquidityLayerRelayerConfig, runLiquidityLayerRelayerHelmCommand, -} from '../../src/middleware/liquidity-layer-relayer'; -import { HelmCommand } from '../../src/utils/helm'; -import { assertCorrectKubeContext } from '../agent-utils'; -import { getConfigsBasedOnArgs } from '../core-utils'; +} from '../../src/middleware/liquidity-layer-relayer.js'; +import { HelmCommand } from '../../src/utils/helm.js'; +import { assertCorrectKubeContext } from '../agent-utils.js'; +import { getConfigsBasedOnArgs } from '../core-utils.js'; async function main() { const { agentConfig, envConfig, context } = await getConfigsBasedOnArgs(); diff --git a/typescript/infra/scripts/middleware/portal-relayer.ts b/typescript/infra/scripts/middleware/portal-relayer.ts index bc58da092..ed3a8e09b 100644 --- a/typescript/infra/scripts/middleware/portal-relayer.ts +++ b/typescript/infra/scripts/middleware/portal-relayer.ts @@ -1,16 +1,17 @@ -import path from 'path'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; import { LiquidityLayerApp, attachContractsMap, liquidityLayerFactories, } from '@hyperlane-xyz/sdk'; -import { rootLogger } from '@hyperlane-xyz/utils'; +import { rootLogger, sleep } from '@hyperlane-xyz/utils'; -import { bridgeAdapterConfigs } from '../../config/environments/testnet4/token-bridge'; -import { readJSON, sleep } from '../../src/utils/utils'; -import { getArgs, getEnvironmentDirectory } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +import { bridgeAdapterConfigs } from '../../config/environments/testnet4/token-bridge.js'; +import { readJSON } from '../../src/utils/utils.js'; +import { getArgs, getEnvironmentDirectory } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; const logger = rootLogger.child({ module: 'portal-relayer' }); @@ -18,8 +19,8 @@ async function relayPortalTransfers() { const { environment } = await getArgs().argv; const config = getEnvironmentConfig(environment); const multiProvider = await config.getMultiProvider(); - const dir = path.join( - __dirname, + const dir = join( + dirname(fileURLToPath(import.meta.url)), '../../', getEnvironmentDirectory(environment), 'middleware/liquidity-layer', diff --git a/typescript/infra/scripts/module-can-verify.ts b/typescript/infra/scripts/module-can-verify.ts index 4cffb36bf..5aa915b33 100644 --- a/typescript/infra/scripts/module-can-verify.ts +++ b/typescript/infra/scripts/module-can-verify.ts @@ -1,10 +1,10 @@ import { HyperlaneCore, moduleCanCertainlyVerify } from '@hyperlane-xyz/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { deployEnvToSdkEnv } from '../src/config/environment'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; -import { getArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const args = await getArgs().argv; diff --git a/typescript/infra/scripts/print-chain-metadatas.ts b/typescript/infra/scripts/print-chain-metadatas.ts index 954d67644..8653ef908 100644 --- a/typescript/infra/scripts/print-chain-metadatas.ts +++ b/typescript/infra/scripts/print-chain-metadatas.ts @@ -1,5 +1,5 @@ -import { getArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; // This script exists to print the chain metadata configs for a given environment // so they can easily be copied into the Sealevel tooling. :'( diff --git a/typescript/infra/scripts/print-gas-prices.ts b/typescript/infra/scripts/print-gas-prices.ts index 3cf0d757f..b79e10f18 100644 --- a/typescript/infra/scripts/print-gas-prices.ts +++ b/typescript/infra/scripts/print-gas-prices.ts @@ -3,7 +3,7 @@ import { ethers } from 'ethers'; import { MultiProtocolProvider, ProviderType } from '@hyperlane-xyz/sdk'; import { objMap, promiseObjAll } from '@hyperlane-xyz/utils'; -import { mainnetConfigs } from '../config/environments/mainnet3/chains'; +import { mainnetConfigs } from '../config/environments/mainnet3/chains.js'; async function main() { const metadata = mainnetConfigs; diff --git a/typescript/infra/scripts/print-multisig-ism-config.ts b/typescript/infra/scripts/print-multisig-ism-config.ts index 3b27ef8b9..ff4ac9cc8 100644 --- a/typescript/infra/scripts/print-multisig-ism-config.ts +++ b/typescript/infra/scripts/print-multisig-ism-config.ts @@ -1,8 +1,8 @@ import { AllChains, IsmType } from '@hyperlane-xyz/sdk'; -import { multisigIsms } from '../config/multisigIsm'; +import { multisigIsms } from '../config/multisigIsm.js'; -import { getArgs, withContext } from './agent-utils'; +import { getArgs, withContext } from './agent-utils.js'; // This script exists to print the default multisig ISM validator sets for a given environment // so they can easily be copied into the Sealevel tooling. :'( diff --git a/typescript/infra/scripts/print-token-prices.ts b/typescript/infra/scripts/print-token-prices.ts index 7ec88d968..35c30fb5b 100644 --- a/typescript/infra/scripts/print-token-prices.ts +++ b/typescript/infra/scripts/print-token-prices.ts @@ -1,6 +1,6 @@ import { objMap } from '@hyperlane-xyz/utils'; -import { mainnetConfigs } from '../config/environments/mainnet3/chains'; +import { mainnetConfigs } from '../config/environments/mainnet3/chains.js'; const CURRENCY = 'usd'; diff --git a/typescript/infra/scripts/rotate-key.ts b/typescript/infra/scripts/rotate-key.ts index 506288dad..c7a9fe559 100644 --- a/typescript/infra/scripts/rotate-key.ts +++ b/typescript/infra/scripts/rotate-key.ts @@ -3,7 +3,7 @@ import { getArgs, withContext, withKeyRoleAndChain, -} from './agent-utils'; +} from './agent-utils.js'; async function rotateKey() { const argv = await withContext(withKeyRoleAndChain(getArgs())).argv; diff --git a/typescript/infra/scripts/safe-delegate.ts b/typescript/infra/scripts/safe-delegate.ts index cc1f22b88..f2b8d39f0 100644 --- a/typescript/infra/scripts/safe-delegate.ts +++ b/typescript/infra/scripts/safe-delegate.ts @@ -6,10 +6,10 @@ import { AddSafeDelegateProps } from '@safe-global/api-kit'; import { AllChains } from '@hyperlane-xyz/sdk'; -import { getSafeDelegates, getSafeService } from '../src/utils/safe'; +import { getSafeDelegates, getSafeService } from '../src/utils/safe.js'; -import { getArgs as getRootArgs } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs as getRootArgs } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; function getArgs() { return getRootArgs() diff --git a/typescript/infra/scripts/send-test-messages.ts b/typescript/infra/scripts/send-test-messages.ts new file mode 100644 index 000000000..b18e79662 --- /dev/null +++ b/typescript/infra/scripts/send-test-messages.ts @@ -0,0 +1,183 @@ +import { Wallet } from 'ethers'; +import fs from 'fs'; +import yargs from 'yargs'; + +import { Mailbox, TestSendReceiver__factory } from '@hyperlane-xyz/core'; +import { + ChainName, + Chains, + HookType, + HyperlaneCore, + MultiProvider, +} from '@hyperlane-xyz/sdk'; +import { addressToBytes32, sleep } from '@hyperlane-xyz/utils'; + +const ANVIL_KEY = + '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'; + +enum MailboxHookType { + REQUIRED = 'requiredHook', + DEFAULT = 'defaultHook', +} + +/** + * If a hookArg is provided, set the mailbox hook to the defaultHookArg. + * The hook is set either as the default hook or the required hook, + * depending on the mailboxHookType argument. + */ +async function setMailboxHook( + mailbox: Mailbox, + coreAddresses: any, + local: ChainName, + mailboxHookType: MailboxHookType, + hookArg: HookType, +) { + const hook = coreAddresses[local][hookArg]; + switch (mailboxHookType) { + case MailboxHookType.REQUIRED: { + await mailbox.setRequiredHook(hook); + break; + } + case MailboxHookType.DEFAULT: { + await mailbox.setDefaultHook(hook); + break; + } + } + console.log(`set the ${mailboxHookType} hook on ${local} to ${hook}`); +} + +const chainSummary = async (core: HyperlaneCore, chain: ChainName) => { + const coreContracts = core.getContracts(chain); + const mailbox = coreContracts.mailbox; + const dispatched = await mailbox.nonce(); + // TODO: Allow processed messages to be filtered by + // origin, possibly sender and recipient. + const processFilter = mailbox.filters.Process(); + const processes = await mailbox.queryFilter(processFilter); + const processed = processes.length; + + const summary = { + chain, + dispatched, + processed, + }; + return summary; +}; + +function getArgs() { + return yargs(process.argv.slice(2)) + .option('messages', { + type: 'number', + describe: 'Number of messages to send; defaults to having no limit', + default: 0, + }) + .option('timeout', { + type: 'number', + describe: 'Time to wait between messages in ms.', + default: 5000, + }) + .option('mineforever', { + type: 'boolean', + default: false, + describe: 'Mine forever after sending messages', + }) + .option(MailboxHookType.DEFAULT, { + type: 'string', + describe: 'Description for defaultHook', + choices: Object.values(HookType), + default: HookType.AGGREGATION, + }) + .option(MailboxHookType.REQUIRED, { + type: 'string', + describe: 'Required hook to call in postDispatch', + choices: Object.values(HookType), + default: HookType.PROTOCOL_FEE, + }).argv; +} + +async function main() { + const args = await getArgs(); + const { timeout, defaultHook, requiredHook, mineforever } = args; + let messages = args.messages; + + const signer = new Wallet(ANVIL_KEY); + const multiProvider = MultiProvider.createTestMultiProvider({ signer }); + const provider = multiProvider.getProvider(Chains.test1); + + const addresses = JSON.parse( + fs.readFileSync('./config/environments/test/core/addresses.json', 'utf8'), + ); + const core = HyperlaneCore.fromAddressesMap(addresses, multiProvider); + + const randomElement = (list: T[]) => + list[Math.floor(Math.random() * list.length)]; + + // Deploy a recipient + const recipientF = new TestSendReceiver__factory(signer.connect(provider)); + const recipient = await recipientF.deploy(); + await recipient.deployTransaction.wait(); + + // Generate artificial traffic + const run_forever = messages === 0; + while (run_forever || messages-- > 0) { + // Round robin origin chain + const local = core.chains()[messages % core.chains().length]; + // Random remote chain + const remote: ChainName = randomElement(await core.remoteChains(local)); + const remoteId = multiProvider.getDomainId(remote); + const contracts = core.getContracts(local); + const mailbox = contracts.mailbox; + await setMailboxHook( + mailbox, + addresses, + local, + MailboxHookType.DEFAULT, + defaultHook, + ); + await setMailboxHook( + mailbox, + addresses, + local, + MailboxHookType.REQUIRED, + requiredHook, + ); + const quote = await mailbox['quoteDispatch(uint32,bytes32,bytes)']( + remoteId, + addressToBytes32(recipient.address), + '0x1234', + ); + await recipient['dispatchToSelf(address,uint32,bytes)']( + mailbox.address, + remoteId, + '0x1234', + { + value: quote, + }, + ); + console.log( + `send to ${recipient.address} on ${remote} via mailbox ${ + mailbox.address + } on ${local} with nonce ${(await mailbox.nonce()) - 1}`, + ); + console.log(await chainSummary(core, local)); + console.log(await chainSummary(core, remote)); + + await sleep(timeout); + } + + while (mineforever) { + // @ts-ignore send method not included on abstract provider interface + await provider.send('anvil_mine', ['0x01']); + await sleep(timeout); + } +} + +main() + .then(() => { + console.info('Done sending random messages'); + process.exit(0); + }) + .catch((err) => { + console.error('Error sending random messages', err); + process.exit(1); + }); diff --git a/typescript/infra/scripts/update-key.ts b/typescript/infra/scripts/update-key.ts index dab4b279c..862b8c8bc 100644 --- a/typescript/infra/scripts/update-key.ts +++ b/typescript/infra/scripts/update-key.ts @@ -3,7 +3,7 @@ import { getArgs, withContext, withKeyRoleAndChain, -} from './agent-utils'; +} from './agent-utils.js'; async function rotateKey() { const argv = await withKeyRoleAndChain(withContext(getArgs())).argv; diff --git a/typescript/infra/scripts/verify-validators.ts b/typescript/infra/scripts/verify-validators.ts index a9d288cc2..559161c9a 100644 --- a/typescript/infra/scripts/verify-validators.ts +++ b/typescript/infra/scripts/verify-validators.ts @@ -1,11 +1,11 @@ import { HyperlaneCore } from '@hyperlane-xyz/sdk'; import { objMap, promiseObjAll } from '@hyperlane-xyz/utils'; -import { S3Validator } from '../src/agents/aws/validator'; -import { deployEnvToSdkEnv } from '../src/config/environment'; +import { S3Validator } from '../src/agents/aws/validator.js'; +import { deployEnvToSdkEnv } from '../src/config/environment.js'; -import { getArgs, getValidatorsByChain } from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +import { getArgs, getValidatorsByChain } from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { environment } = await getArgs().argv; diff --git a/typescript/infra/scripts/verify.ts b/typescript/infra/scripts/verify.ts index 4b75e6650..0a8c03b3e 100644 --- a/typescript/infra/scripts/verify.ts +++ b/typescript/infra/scripts/verify.ts @@ -8,16 +8,16 @@ import { import { extractBuildArtifact, fetchExplorerApiKeys, -} from '../src/deployment/verify'; -import { readJSONAtPath } from '../src/utils/utils'; +} from '../src/deployment/verify.js'; +import { readJSONAtPath } from '../src/utils/utils.js'; import { assertEnvironment, getArgs, withBuildArtifactPath, withNetwork, -} from './agent-utils'; -import { getEnvironmentConfig } from './core-utils'; +} from './agent-utils.js'; +import { getEnvironmentConfig } from './core-utils.js'; async function main() { const { environment, buildArtifactPath, verificationArtifactPath, network } = diff --git a/typescript/infra/scripts/warp-routes/deploy-warp-monitor.ts b/typescript/infra/scripts/warp-routes/deploy-warp-monitor.ts index 8c765ba63..7fb351bb8 100644 --- a/typescript/infra/scripts/warp-routes/deploy-warp-monitor.ts +++ b/typescript/infra/scripts/warp-routes/deploy-warp-monitor.ts @@ -1,8 +1,8 @@ import yargs from 'yargs'; -import { HelmCommand } from '../../src/utils/helm'; +import { HelmCommand } from '../../src/utils/helm.js'; -import { runWarpRouteHelmCommand } from './helm'; +import { runWarpRouteHelmCommand } from './helm.js'; async function main() { const { filePath } = await yargs(process.argv.slice(2)) diff --git a/typescript/infra/scripts/warp-routes/helm.ts b/typescript/infra/scripts/warp-routes/helm.ts index 997ac27c5..fa0cfb0c6 100644 --- a/typescript/infra/scripts/warp-routes/helm.ts +++ b/typescript/infra/scripts/warp-routes/helm.ts @@ -1,8 +1,8 @@ -import { DeployEnvironment } from '../../src/config'; -import { HelmCommand, helmifyValues } from '../../src/utils/helm'; -import { execCmd } from '../../src/utils/utils'; -import { assertCorrectKubeContext } from '../agent-utils'; -import { getEnvironmentConfig } from '../core-utils'; +import { DeployEnvironment } from '../../src/config/environment.js'; +import { HelmCommand, helmifyValues } from '../../src/utils/helm.js'; +import { execCmd } from '../../src/utils/utils.js'; +import { assertCorrectKubeContext } from '../agent-utils.js'; +import { getEnvironmentConfig } from '../core-utils.js'; export async function runWarpRouteHelmCommand( helmCommand: HelmCommand, diff --git a/typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts b/typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts index 374eeaa45..13e5f3677 100644 --- a/typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts +++ b/typescript/infra/scripts/warp-routes/monitor-warp-routes-balances.ts @@ -22,8 +22,8 @@ import { rootLogger, } from '@hyperlane-xyz/utils'; -import { startMetricsServer } from '../../src/utils/metrics'; -import { readYaml } from '../../src/utils/utils'; +import { startMetricsServer } from '../../src/utils/metrics.js'; +import { readYaml } from '../../src/utils/utils.js'; const logger = rootLogger.child({ module: 'warp-balance-monitor' }); diff --git a/typescript/infra/src/agents/agent.ts b/typescript/infra/src/agents/agent.ts index e6afe9f02..c7a257958 100644 --- a/typescript/infra/src/agents/agent.ts +++ b/typescript/infra/src/agents/agent.ts @@ -1,9 +1,9 @@ import { ChainName } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../config/contexts'; -import { DeployEnvironment } from '../config'; -import { Role } from '../roles'; -import { assertRole } from '../utils/utils'; +import { Contexts } from '../../config/contexts.js'; +import { DeployEnvironment } from '../config/environment.js'; +import { Role } from '../roles.js'; +import { assertRole } from '../utils/utils.js'; export function isValidatorKey(role: Role) { return role === Role.Validator; diff --git a/typescript/infra/src/agents/aws/index.ts b/typescript/infra/src/agents/aws/index.ts deleted file mode 100644 index 18a679fbc..000000000 --- a/typescript/infra/src/agents/aws/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { AgentAwsKey } from './key'; -export { AgentAwsUser } from './user'; -export { ValidatorAgentAwsUser } from './validator-user'; diff --git a/typescript/infra/src/agents/aws/key.ts b/typescript/infra/src/agents/aws/key.ts index a6c47369e..6b4f9b001 100644 --- a/typescript/infra/src/agents/aws/key.ts +++ b/typescript/infra/src/agents/aws/key.ts @@ -16,16 +16,17 @@ import { UpdateAliasCommand, } from '@aws-sdk/client-kms'; import { KmsEthersSigner } from 'aws-kms-ethers-signer'; -import { Debugger, debug } from 'debug'; import { ethers } from 'ethers'; +import { Logger } from 'pino'; import { AgentSignerKeyType, ChainName } from '@hyperlane-xyz/sdk'; +import { rootLogger, sleep } from '@hyperlane-xyz/utils'; -import { AgentContextConfig, AwsKeyConfig } from '../../config/agent'; -import { Role } from '../../roles'; -import { getEthereumAddress, sleep } from '../../utils/utils'; -import { keyIdentifier } from '../agent'; -import { CloudAgentKey } from '../keys'; +import { AgentContextConfig, AwsKeyConfig } from '../../config/agent/agent.js'; +import { Role } from '../../roles.js'; +import { getEthereumAddress } from '../../utils/utils.js'; +import { keyIdentifier } from '../agent.js'; +import { CloudAgentKey } from '../keys.js'; interface UnfetchedKey { fetched: false; @@ -42,7 +43,7 @@ export class AgentAwsKey extends CloudAgentKey { private client: KMSClient | undefined; private region: string; public remoteKey: RemoteKey = { fetched: false }; - protected logger: Debugger; + protected logger: Logger; constructor( agentConfig: AgentContextConfig, @@ -55,11 +56,13 @@ export class AgentAwsKey extends CloudAgentKey { throw new Error('Not configured as AWS'); } this.region = agentConfig.aws.region; - this.logger = debug(`infra:agents:key:aws:${this.identifier}`); + this.logger = rootLogger.child({ + module: `infra:agents:key:aws:${this.identifier}`, + }); } get privateKey(): string { - this.logger( + this.logger.debug( 'Attempting to access private key, which is unavailable for AWS keys', ); throw new Error('Private key unavailable for AWS keys'); @@ -67,10 +70,10 @@ export class AgentAwsKey extends CloudAgentKey { async getClient(): Promise { if (this.client) { - this.logger('Returning existing KMSClient instance'); + this.logger.debug('Returning existing KMSClient instance'); return this.client; } - this.logger('Creating new KMSClient instance'); + this.logger.debug('Creating new KMSClient instance'); this.client = new KMSClient({ region: this.region, }); @@ -102,7 +105,7 @@ export class AgentAwsKey extends CloudAgentKey { } async fetch() { - this.logger('Fetching key'); + this.logger.debug('Fetching key'); const address = await this.fetchAddressFromAws(); this.remoteKey = { fetched: true, @@ -111,28 +114,28 @@ export class AgentAwsKey extends CloudAgentKey { } async createIfNotExists() { - this.logger('Checking if key exists and creating if not'); + this.logger.debug('Checking if key exists and creating if not'); const keyId = await this.getId(); // If it doesn't exist, create it if (!keyId) { - this.logger('Key does not exist, creating new key'); + this.logger.debug('Key does not exist, creating new key'); await this.create(); // It can take a moment for the change to propagate await sleep(1000); } else { - this.logger('Key already exists'); + this.logger.debug('Key already exists'); } await this.fetch(); } async delete() { - this.logger('Delete operation called, but not implemented'); + this.logger.debug('Delete operation called, but not implemented'); throw Error('Not implemented yet'); } // Allows the `userArn` to use the key async putKeyPolicy(userArn: string) { - this.logger(`Putting key policy for user ARN: ${userArn}`); + this.logger.debug(`Putting key policy for user ARN: ${userArn}`); const client = await this.getClient(); const policy = { Version: '2012-10-17', @@ -164,29 +167,29 @@ export class AgentAwsKey extends CloudAgentKey { PolicyName: 'default', // This is the only accepted name }); await client.send(cmd); - this.logger('Key policy put successfully'); + this.logger.debug('Key policy put successfully'); } // Gets the Key's ID if it exists, undefined otherwise async getId() { try { - this.logger('Attempting to describe key to get ID'); + this.logger.debug('Attempting to describe key to get ID'); const keyDescription = await this.describeKey(); const keyId = keyDescription.KeyMetadata?.KeyId; - this.logger(`Key ID retrieved: ${keyId}`); + this.logger.debug(`Key ID retrieved: ${keyId}`); return keyId; } catch (err: any) { if (err.name === 'NotFoundException') { - this.logger('Key not found'); + this.logger.debug('Key not found'); return undefined; } - this.logger(`Error retrieving key ID: ${err}`); + this.logger.debug(`Error retrieving key ID: ${err}`); throw err; } } create() { - this.logger('Creating new key'); + this.logger.debug('Creating new key'); return this._create(false); } @@ -195,7 +198,7 @@ export class AgentAwsKey extends CloudAgentKey { * @returns The address of the new key */ update() { - this.logger('Updating key (creating new key for rotation)'); + this.logger.debug('Updating key (creating new key for rotation)'); return this._create(true); } @@ -203,7 +206,7 @@ export class AgentAwsKey extends CloudAgentKey { * Requires update to have been called on this key prior */ async rotate() { - this.logger('Rotating keys'); + this.logger.debug('Rotating keys'); const canonicalAlias = this.identifier; const newAlias = canonicalAlias + '-new'; const oldAlias = canonicalAlias + '-old'; @@ -248,19 +251,19 @@ export class AgentAwsKey extends CloudAgentKey { // Address should have changed now await this.fetch(); - this.logger('Keys rotated successfully'); + this.logger.debug('Keys rotated successfully'); } async getSigner( provider?: ethers.providers.Provider, ): Promise { - this.logger('Getting signer'); + this.logger.debug('Getting signer'); const keyId = await this.getId(); if (!keyId) { - this.logger('Key ID not defined, cannot get signer'); + this.logger.debug('Key ID not defined, cannot get signer'); throw Error('Key ID not defined'); } - this.logger(`Creating KmsEthersSigner with key ID: ${keyId}`); + this.logger.debug(`Creating KmsEthersSigner with key ID: ${keyId}`); // @ts-ignore We're using a newer version of Provider than // KmsEthersSigner. The return type for getFeeData for this newer // type is a superset of the return type for getFeeData for the older type, @@ -278,15 +281,15 @@ export class AgentAwsKey extends CloudAgentKey { private requireFetched() { if (!this.remoteKey.fetched) { - this.logger('Key has not been fetched yet'); + this.logger.debug('Key has not been fetched yet'); throw new Error('Key not fetched'); } - this.logger('Key has been fetched'); + this.logger.debug('Key has been fetched'); } // Creates a new key and returns its address private async _create(rotate: boolean) { - this.logger(`Creating key with rotation: ${rotate}`); + this.logger.debug(`Creating key with rotation: ${rotate}`); const client = await this.getClient(); const alias = this.identifier; if (!rotate) { @@ -298,7 +301,7 @@ export class AgentAwsKey extends CloudAgentKey { (_) => _.AliasName === alias, ); if (match) { - this.logger(`Alias ${alias} already exists`); + this.logger.debug(`Alias ${alias} already exists`); throw new Error( `Attempted to create new key but alias ${alias} already exists`, ); @@ -318,7 +321,7 @@ export class AgentAwsKey extends CloudAgentKey { const createResponse = await client.send(command); if (!createResponse.KeyMetadata) { - this.logger('KeyMetadata was not returned when creating the key'); + this.logger.debug('KeyMetadata was not returned when creating the key'); throw new Error('KeyMetadata was not returned when creating the key'); } const keyId = createResponse.KeyMetadata?.KeyId; @@ -329,12 +332,12 @@ export class AgentAwsKey extends CloudAgentKey { ); const address = this.fetchAddressFromAws(keyId); - this.logger(`New key created with ID: ${keyId}`); + this.logger.debug(`New key created with ID: ${keyId}`); return address; } private async fetchAddressFromAws(keyId?: string) { - this.logger(`Fetching address from AWS for key ID: ${keyId}`); + this.logger.debug(`Fetching address from AWS for key ID: ${keyId}`); const client = await this.getClient(); if (!keyId) { @@ -348,12 +351,12 @@ export class AgentAwsKey extends CloudAgentKey { const address = getEthereumAddress( Buffer.from(publicKeyResponse.PublicKey!), ); - this.logger(`Address fetched: ${address}`); + this.logger.debug(`Address fetched: ${address}`); return address; } private async describeKey(): Promise { - this.logger('Describing key'); + this.logger.debug('Describing key'); const client = await this.getClient(); return client.send( new DescribeKeyCommand({ @@ -363,7 +366,7 @@ export class AgentAwsKey extends CloudAgentKey { } private async getAliases(): Promise { - this.logger('Getting aliases'); + this.logger.debug('Getting aliases'); const client = await this.getClient(); let aliases: AliasListEntry[] = []; let marker: string | undefined = undefined; @@ -389,7 +392,7 @@ export class AgentAwsKey extends CloudAgentKey { break; } } - this.logger(`Aliases retrieved: ${aliases.length}`); + this.logger.debug(`Aliases retrieved: ${aliases.length}`); return aliases; } } diff --git a/typescript/infra/src/agents/aws/user.ts b/typescript/infra/src/agents/aws/user.ts index 08e89534d..4cf45fc0f 100644 --- a/typescript/infra/src/agents/aws/user.ts +++ b/typescript/infra/src/agents/aws/user.ts @@ -9,17 +9,18 @@ import { import { ChainName } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../../config/contexts'; -import { AgentContextConfig, DeployEnvironment } from '../../config'; -import { Role } from '../../roles'; +import { Contexts } from '../../../config/contexts.js'; +import { AgentContextConfig } from '../../config/agent/agent.js'; +import { DeployEnvironment } from '../../config/environment.js'; +import { Role } from '../../roles.js'; import { fetchGCPSecret, gcpSecretExists, setGCPSecret, -} from '../../utils/gcloud'; -import { userIdentifier } from '../agent'; +} from '../../utils/gcloud.js'; +import { userIdentifier } from '../agent.js'; -import { AgentAwsKey } from './key'; +import { AgentAwsKey } from './key.js'; export class AgentAwsUser { private adminIamClient: IAMClient; diff --git a/typescript/infra/src/agents/aws/validator-user.ts b/typescript/infra/src/agents/aws/validator-user.ts index b343d3a65..db2867bff 100644 --- a/typescript/infra/src/agents/aws/validator-user.ts +++ b/typescript/infra/src/agents/aws/validator-user.ts @@ -10,12 +10,13 @@ import { import { ChainName } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../../config/contexts'; -import { AgentContextConfig, DeployEnvironment } from '../../config'; -import { Role } from '../../roles'; +import { Contexts } from '../../../config/contexts.js'; +import { AgentContextConfig } from '../../config/agent/agent.js'; +import { DeployEnvironment } from '../../config/environment.js'; +import { Role } from '../../roles.js'; -import { AgentAwsKey } from './key'; -import { AgentAwsUser } from './user'; +import { AgentAwsKey } from './key.js'; +import { AgentAwsUser } from './user.js'; export class ValidatorAgentAwsUser extends AgentAwsUser { private adminS3Client: S3Client; diff --git a/typescript/infra/src/agents/aws/validator.ts b/typescript/infra/src/agents/aws/validator.ts index 2cea6b6a8..2c6b48c60 100644 --- a/typescript/infra/src/agents/aws/validator.ts +++ b/typescript/infra/src/agents/aws/validator.ts @@ -8,7 +8,7 @@ import { isS3CheckpointWithId, } from '@hyperlane-xyz/utils'; -import { S3Receipt, S3Wrapper } from './s3'; +import { S3Receipt, S3Wrapper } from './s3.js'; export enum CheckpointStatus { EXTRA = 'âž•', diff --git a/typescript/infra/src/agents/gcp.ts b/typescript/infra/src/agents/gcp.ts index e0fc75874..782c34631 100644 --- a/typescript/infra/src/agents/gcp.ts +++ b/typescript/infra/src/agents/gcp.ts @@ -1,19 +1,19 @@ import { encodeSecp256k1Pubkey, pubkeyToAddress } from '@cosmjs/amino'; import { Keypair } from '@solana/web3.js'; -import { Debugger, debug } from 'debug'; import { Wallet, ethers } from 'ethers'; +import { Logger } from 'pino'; import { ChainName } from '@hyperlane-xyz/sdk'; -import { ProtocolType, strip0x } from '@hyperlane-xyz/utils'; +import { ProtocolType, rootLogger, strip0x } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; -import { DeployEnvironment } from '../config'; -import { Role } from '../roles'; -import { fetchGCPSecret, setGCPSecret } from '../utils/gcloud'; -import { execCmd, include } from '../utils/utils'; +import { Contexts } from '../../config/contexts.js'; +import { DeployEnvironment } from '../config/environment.js'; +import { Role } from '../roles.js'; +import { fetchGCPSecret, setGCPSecret } from '../utils/gcloud.js'; +import { execCmd, include } from '../utils/utils.js'; -import { isValidatorKey, keyIdentifier } from './agent'; -import { CloudAgentKey } from './keys'; +import { isValidatorKey, keyIdentifier } from './agent.js'; +import { CloudAgentKey } from './keys.js'; // This is the type for how the keys are persisted in GCP export interface SecretManagerPersistedKeys { @@ -39,7 +39,7 @@ interface FetchedKey { type RemoteKey = UnfetchedKey | FetchedKey; export class AgentGCPKey extends CloudAgentKey { - protected logger: Debugger; + protected logger: Logger; constructor( environment: DeployEnvironment, @@ -50,23 +50,25 @@ export class AgentGCPKey extends CloudAgentKey { private remoteKey: RemoteKey = { fetched: false }, ) { super(environment, context, role, chainName, index); - this.logger = debug(`infra:agents:key:gcp:${this.identifier}`); + this.logger = rootLogger.child({ + module: `infra:agents:key:gcp:${this.identifier}`, + }); } async createIfNotExists() { - this.logger('Checking if key exists and creating if not'); + this.logger.debug('Checking if key exists and creating if not'); try { await this.fetch(); - this.logger('Key already exists'); + this.logger.debug('Key already exists'); } catch (err) { - this.logger('Key does not exist, creating new key'); + this.logger.debug('Key does not exist, creating new key'); await this.create(); } } serializeAsAddress() { this.requireFetched(); - this.logger('Serializing key as address'); + this.logger.debug('Serializing key as address'); return { identifier: this.identifier, // @ts-ignore @@ -102,7 +104,7 @@ export class AgentGCPKey extends CloudAgentKey { addressForProtocol(protocol: ProtocolType): string | undefined { this.requireFetched(); - this.logger(`Getting address for protocol: ${protocol}`); + this.logger.debug(`Getting address for protocol: ${protocol}`); switch (protocol) { case ProtocolType.Ethereum: @@ -124,13 +126,13 @@ export class AgentGCPKey extends CloudAgentKey { return pubkeyToAddress(encodedPubkey, 'neutron'); } default: - this.logger(`Unsupported protocol: ${protocol}`); + this.logger.debug(`Unsupported protocol: ${protocol}`); return undefined; } } async fetch() { - this.logger('Fetching key'); + this.logger.debug('Fetching key'); const secret: SecretManagerPersistedKeys = (await fetchGCPSecret( this.identifier, )) as any; @@ -139,34 +141,34 @@ export class AgentGCPKey extends CloudAgentKey { privateKey: secret.privateKey, address: secret.address, }; - this.logger(`Key fetched successfully: ${secret.address}`); + this.logger.debug(`Key fetched successfully: ${secret.address}`); } async create() { - this.logger('Creating new key'); + this.logger.debug('Creating new key'); this.remoteKey = await this._create(false); - this.logger('Key created successfully'); + this.logger.debug('Key created successfully'); } async update() { - this.logger('Updating key'); + this.logger.debug('Updating key'); this.remoteKey = await this._create(true); - this.logger('Key updated successfully'); + this.logger.debug('Key updated successfully'); return this.address; } async delete() { - this.logger('Deleting key'); + this.logger.debug('Deleting key'); await execCmd(`gcloud secrets delete ${this.identifier} --quiet`); - this.logger('Key deleted successfully'); + this.logger.debug('Key deleted successfully'); } async getSigner( provider?: ethers.providers.Provider, ): Promise { - this.logger('Getting signer'); + this.logger.debug('Getting signer'); if (!this.remoteKey.fetched) { - this.logger('Key not fetched, fetching now'); + this.logger.debug('Key not fetched, fetching now'); await this.fetch(); } return new Wallet(this.privateKey, provider); @@ -174,14 +176,14 @@ export class AgentGCPKey extends CloudAgentKey { private requireFetched() { if (!this.remoteKey.fetched) { - this.logger('Key not fetched, throwing error'); + this.logger.debug('Key not fetched, throwing error'); throw new Error("Can't persist without address"); } } // eslint-disable-next-line @typescript-eslint/no-unused-vars private async _create(rotate: boolean) { - this.logger(`Creating key with rotation: ${rotate}`); + this.logger.debug(`Creating key with rotation: ${rotate}`); const wallet = Wallet.createRandom(); const address = await wallet.getAddress(); const identifier = this.identifier; @@ -206,7 +208,7 @@ export class AgentGCPKey extends CloudAgentKey { }), }, ); - this.logger('Key creation data persisted to GCP'); + this.logger.debug('Key creation data persisted to GCP'); return { fetched: true, diff --git a/typescript/infra/src/agents/index.ts b/typescript/infra/src/agents/index.ts index 2acbbe4a5..186d35934 100644 --- a/typescript/infra/src/agents/index.ts +++ b/typescript/infra/src/agents/index.ts @@ -1,31 +1,37 @@ import fs from 'fs'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; import { ChainName, RpcConsensusType, chainMetadata } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../config/contexts'; +import { Contexts } from '../../config/contexts.js'; import { AgentConfigHelper, AgentContextConfig, - DeployEnvironment, DockerConfig, HelmRootAgentValues, - RelayerConfigHelper, RootAgentConfig, - ScraperConfigHelper, - ValidatorConfigHelper, -} from '../config'; -import { AgentRole, Role } from '../roles'; -import { fetchGCPSecret } from '../utils/gcloud'; +} from '../config/agent/agent.js'; +import { RelayerConfigHelper } from '../config/agent/relayer.js'; +import { ScraperConfigHelper } from '../config/agent/scraper.js'; +import { ValidatorConfigHelper } from '../config/agent/validator.js'; +import { DeployEnvironment } from '../config/environment.js'; +import { AgentRole, Role } from '../roles.js'; +import { fetchGCPSecret } from '../utils/gcloud.js'; import { HelmCommand, buildHelmChartDependencies, helmifyValues, -} from '../utils/helm'; -import { execCmd, isEthereumProtocolChain } from '../utils/utils'; +} from '../utils/helm.js'; +import { execCmd, isEthereumProtocolChain } from '../utils/utils.js'; -import { AgentGCPKey } from './gcp'; +import { AgentGCPKey } from './gcp.js'; + +const HELM_CHART_PATH = join( + dirname(fileURLToPath(import.meta.url)), + '/../../../../rust/helm/hyperlane-agent/', +); -const HELM_CHART_PATH = __dirname + '/../../../../rust/helm/hyperlane-agent/'; if (!fs.existsSync(HELM_CHART_PATH + 'Chart.yaml')) console.warn( `Could not find helm chart at ${HELM_CHART_PATH}; the relative path may have changed.`, diff --git a/typescript/infra/src/agents/key-utils.ts b/typescript/infra/src/agents/key-utils.ts index c4e42521c..256a24e6b 100644 --- a/typescript/infra/src/agents/key-utils.ts +++ b/typescript/infra/src/agents/key-utils.ts @@ -1,34 +1,30 @@ -import debug from 'debug'; -import fs from 'fs'; -import path from 'path'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; import { ChainMap, ChainName } from '@hyperlane-xyz/sdk'; -import { Address, objMap } from '@hyperlane-xyz/utils'; +import { Address, objMap, rootLogger } from '@hyperlane-xyz/utils'; import localAWMultisigAddresses from '../../config/aw-multisig-hyperlane.json'; // AW - Abacus Works -import { Contexts } from '../../config/contexts'; -import { helloworld } from '../../config/environments/helloworld'; +import { Contexts } from '../../config/contexts.js'; +import { helloworld } from '../../config/environments/helloworld.js'; import localKathyAddresses from '../../config/kathy.json'; import localRelayerAddresses from '../../config/relayer.json'; -import { getJustHelloWorldConfig } from '../../scripts/helloworld/utils'; -import { - AgentContextConfig, - DeployEnvironment, - RootAgentConfig, -} from '../config'; -import { Role } from '../roles'; +import { getJustHelloWorldConfig } from '../../scripts/helloworld/utils.js'; +import { AgentContextConfig, RootAgentConfig } from '../config/agent/agent'; +import { DeployEnvironment } from '../config/environment'; +import { Role } from '../roles.js'; import { execCmd, isEthereumProtocolChain, readJSON, writeJSON, writeJsonAtPath, -} from '../utils/utils'; +} from '../utils/utils.js'; -import { AgentAwsKey } from './aws/key'; -import { AgentGCPKey } from './gcp'; -import { CloudAgentKey } from './keys'; +import { AgentAwsKey } from './aws/key.js'; +import { AgentGCPKey } from './gcp.js'; +import { CloudAgentKey } from './keys.js'; export type LocalRoleAddresses = Record< DeployEnvironment, @@ -41,14 +37,17 @@ export const kathyAddresses: LocalRoleAddresses = export const awMultisigAddresses: ChainMap<{ validators: Address[] }> = localAWMultisigAddresses as ChainMap<{ validators: Address[] }>; -const debugLog = debug('infra:agents:key:utils'); +const debugLog = rootLogger.child({ module: 'infra:agents:key:utils' }).debug; export interface KeyAsAddress { identifier: string; address: string; } -const CONFIG_DIRECTORY_PATH = path.join(__dirname, '../../config'); +const CONFIG_DIRECTORY_PATH = join( + dirname(fileURLToPath(import.meta.url)), + '../../config', +); // ================== // Functions for getting keys @@ -453,7 +452,10 @@ export async function persistRoleAddressesToLocalArtifacts( addresses[environment][context] = updated; // Resolve the relative path - const filePath = path.resolve(__dirname, `../../config/${role}.json`); + const filePath = join( + dirname(fileURLToPath(import.meta.url)), + `../../config/${role}.json`, + ); writeJsonAtPath(filePath, addresses); } diff --git a/typescript/infra/src/agents/keys.ts b/typescript/infra/src/agents/keys.ts index a6d817d89..071c752a1 100644 --- a/typescript/infra/src/agents/keys.ts +++ b/typescript/infra/src/agents/keys.ts @@ -3,12 +3,12 @@ import { ethers } from 'ethers'; import { ChainName } from '@hyperlane-xyz/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; -import { DeployEnvironment } from '../config'; -import { Role } from '../roles'; -import { assertChain, assertContext, assertRole } from '../utils/utils'; +import { Contexts } from '../../config/contexts.js'; +import { DeployEnvironment } from '../config/environment.js'; +import { Role } from '../roles.js'; +import { assertChain, assertContext, assertRole } from '../utils/utils.js'; -import { parseKeyIdentifier } from './agent'; +import { parseKeyIdentifier } from './agent.js'; // Base class to represent keys used to run Hyperlane agents. export abstract class BaseAgentKey { diff --git a/typescript/infra/src/config/agent/agent.ts b/typescript/infra/src/config/agent/agent.ts index 85b379e5e..0b630981f 100644 --- a/typescript/infra/src/config/agent/agent.ts +++ b/typescript/infra/src/config/agent/agent.ts @@ -9,18 +9,21 @@ import { } from '@hyperlane-xyz/sdk'; import { ProtocolType, objMap } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../../config/contexts'; -import { AgentChainNames, AgentRole, Role } from '../../roles'; -import { DeployEnvironment } from '../environment'; -import { HelmImageValues } from '../infrastructure'; +import { Contexts } from '../../../config/contexts.js'; +import { AgentChainNames, AgentRole, Role } from '../../roles.js'; +import { DeployEnvironment } from '../environment.js'; +import { HelmImageValues } from '../infrastructure.js'; import { BaseRelayerConfig, HelmRelayerChainValues, HelmRelayerValues, -} from './relayer'; -import { BaseScraperConfig, HelmScraperValues } from './scraper'; -import { HelmValidatorValues, ValidatorBaseChainConfigMap } from './validator'; +} from './relayer.js'; +import { BaseScraperConfig, HelmScraperValues } from './scraper.js'; +import { + HelmValidatorValues, + ValidatorBaseChainConfigMap, +} from './validator.js'; export type DeepPartial = T extends object ? { diff --git a/typescript/infra/src/config/agent/index.ts b/typescript/infra/src/config/agent/index.ts deleted file mode 100644 index 802717a73..000000000 --- a/typescript/infra/src/config/agent/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Eventually consumed by Rust, which expects camelCase values - -export { - ValidatorConfigHelper, - CheckpointSyncerType, - ValidatorBaseChainConfigMap, -} from './validator'; -export { RelayerConfigHelper, routerMatchingList } from './relayer'; -export { ScraperConfigHelper } from './scraper'; - -export * from './agent'; diff --git a/typescript/infra/src/config/agent/relayer.ts b/typescript/infra/src/config/agent/relayer.ts index 40764395d..f09d177f4 100644 --- a/typescript/infra/src/config/agent/relayer.ts +++ b/typescript/infra/src/config/agent/relayer.ts @@ -14,18 +14,16 @@ import { } from '@hyperlane-xyz/sdk'; import { Address, ProtocolType, addressToBytes32 } from '@hyperlane-xyz/utils'; -import { AgentAwsUser } from '../../agents/aws'; -import { Role } from '../../roles'; -import { HelmStatefulSetValues } from '../infrastructure'; +import { AgentAwsUser } from '../../agents/aws/user.js'; +import { Role } from '../../roles.js'; +import { HelmStatefulSetValues } from '../infrastructure.js'; import { AgentConfigHelper, KeyConfig, RootAgentConfig, defaultChainSignerKeyConfig, -} from './agent'; - -export { GasPaymentEnforcement as GasPaymentEnforcementConfig } from '@hyperlane-xyz/sdk'; +} from './agent.js'; export interface MetricAppContext { name: string; diff --git a/typescript/infra/src/config/agent/scraper.ts b/typescript/infra/src/config/agent/scraper.ts index 6bb35dde0..ce99e7828 100644 --- a/typescript/infra/src/config/agent/scraper.ts +++ b/typescript/infra/src/config/agent/scraper.ts @@ -3,10 +3,10 @@ import { ScraperConfig as ScraperAgentConfig, } from '@hyperlane-xyz/sdk'; -import { Role } from '../../roles'; -import { HelmStatefulSetValues } from '../infrastructure'; +import { Role } from '../../roles.js'; +import { HelmStatefulSetValues } from '../infrastructure.js'; -import { AgentConfigHelper, RootAgentConfig } from './agent'; +import { AgentConfigHelper, RootAgentConfig } from './agent.js'; export interface BaseScraperConfig { // no configs at this time diff --git a/typescript/infra/src/config/agent/validator.ts b/typescript/infra/src/config/agent/validator.ts index 8aeb1e5fe..ac8fd6dd6 100644 --- a/typescript/infra/src/config/agent/validator.ts +++ b/typescript/infra/src/config/agent/validator.ts @@ -8,16 +8,16 @@ import { } from '@hyperlane-xyz/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { ValidatorAgentAwsUser } from '../../agents/aws'; -import { Role } from '../../roles'; -import { HelmStatefulSetValues } from '../infrastructure'; +import { ValidatorAgentAwsUser } from '../../agents/aws/validator-user.js'; +import { Role } from '../../roles.js'; +import { HelmStatefulSetValues } from '../infrastructure.js'; import { AgentConfigHelper, KeyConfig, RootAgentConfig, defaultChainSignerKeyConfig, -} from './agent'; +} from './agent.js'; // Validator agents for each chain. export type ValidatorBaseChainConfigMap = ChainMap; diff --git a/typescript/infra/src/config/chain.ts b/typescript/infra/src/config/chain.ts index dda0edc7c..ddd66fa13 100644 --- a/typescript/infra/src/config/chain.ts +++ b/typescript/infra/src/config/chain.ts @@ -1,7 +1,6 @@ import { providers } from 'ethers'; import { - ChainMap, ChainMetadata, ChainMetadataManager, ChainName, @@ -13,9 +12,9 @@ import { } from '@hyperlane-xyz/sdk'; import { ProtocolType, objFilter } from '@hyperlane-xyz/utils'; -import { getSecretRpcEndpoint } from '../agents'; +import { getSecretRpcEndpoint } from '../agents/index.js'; -import { DeployEnvironment } from './environment'; +import { DeployEnvironment } from './environment.js'; export const defaultRetry: ProviderRetryOptions = { maxRetries: 6, diff --git a/typescript/infra/src/config/environment.ts b/typescript/infra/src/config/environment.ts index 316317859..63a04f3b4 100644 --- a/typescript/infra/src/config/environment.ts +++ b/typescript/infra/src/config/environment.ts @@ -11,16 +11,16 @@ import { RpcConsensusType, } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../config/contexts'; -import { environments } from '../../config/environments'; -import { CloudAgentKey } from '../agents/keys'; -import { Role } from '../roles'; +import { Contexts } from '../../config/contexts.js'; +import { environments } from '../../config/environments/index.js'; +import { CloudAgentKey } from '../agents/keys.js'; +import { Role } from '../roles.js'; -import { RootAgentConfig } from './agent'; -import { KeyFunderConfig } from './funding'; -import { HelloWorldConfig } from './helloworld/types'; -import { InfrastructureConfig } from './infrastructure'; -import { LiquidityLayerRelayerConfig } from './middleware'; +import { RootAgentConfig } from './agent/agent.js'; +import { KeyFunderConfig } from './funding.js'; +import { HelloWorldConfig } from './helloworld/types.js'; +import { InfrastructureConfig } from './infrastructure.js'; +import { LiquidityLayerRelayerConfig } from './middleware.js'; // TODO: fix this? export const EnvironmentNames = ['test', 'testnet4', 'mainnet3']; diff --git a/typescript/infra/src/config/funding.ts b/typescript/infra/src/config/funding.ts index c0834abc4..8490ded06 100644 --- a/typescript/infra/src/config/funding.ts +++ b/typescript/infra/src/config/funding.ts @@ -1,9 +1,9 @@ import { ChainMap, RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { Contexts } from '../../config/contexts'; -import { FundableRole, Role } from '../roles'; +import { Contexts } from '../../config/contexts.js'; +import { FundableRole, Role } from '../roles.js'; -import { DockerConfig } from './agent'; +import { DockerConfig } from './agent/agent.js'; export interface ContextAndRoles { context: Contexts; diff --git a/typescript/infra/src/config/gas-oracle.ts b/typescript/infra/src/config/gas-oracle.ts index a7e91e44b..3a7939b53 100644 --- a/typescript/infra/src/config/gas-oracle.ts +++ b/typescript/infra/src/config/gas-oracle.ts @@ -7,7 +7,7 @@ import { } from '@hyperlane-xyz/sdk'; import { convertDecimals } from '@hyperlane-xyz/utils'; -import { mustGetChainNativeTokenDecimals } from '../utils/utils'; +import { mustGetChainNativeTokenDecimals } from '../utils/utils.js'; // Gas data to configure on a single local chain. Includes DestinationOracleConfig // for each remote chain. diff --git a/typescript/infra/src/config/helloworld/types.ts b/typescript/infra/src/config/helloworld/types.ts index 89c729bc3..1345894d8 100644 --- a/typescript/infra/src/config/helloworld/types.ts +++ b/typescript/infra/src/config/helloworld/types.ts @@ -1,6 +1,6 @@ import { ChainMap, ChainName, RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { DockerConfig } from '../agent'; +import { DockerConfig } from '../agent/agent.js'; export enum HelloWorldKathyRunMode { // Sends messages between all pairwise chains diff --git a/typescript/infra/src/config/index.ts b/typescript/infra/src/config/index.ts deleted file mode 100644 index 97a3b0c81..000000000 --- a/typescript/infra/src/config/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './agent'; -export { DeployEnvironment, EnvironmentConfig } from './environment'; -export { - AllStorageGasOracleConfigs, - StorageGasOracleConfig, - getAllStorageGasOracleConfigs, -} from './gas-oracle'; -export { HelloWorldConfig } from './helloworld/types'; -export { InfrastructureConfig } from './infrastructure'; diff --git a/typescript/infra/src/config/middleware.ts b/typescript/infra/src/config/middleware.ts index 907125b70..e6f25f92b 100644 --- a/typescript/infra/src/config/middleware.ts +++ b/typescript/infra/src/config/middleware.ts @@ -1,6 +1,6 @@ import { RpcConsensusType } from '@hyperlane-xyz/sdk'; -import { DockerConfig } from './agent'; +import { DockerConfig } from './agent/agent.js'; export interface LiquidityLayerRelayerConfig { docker: DockerConfig; diff --git a/typescript/infra/src/deployment/deploy.ts b/typescript/infra/src/deployment/deploy.ts index 3325be15d..3b733fdd8 100644 --- a/typescript/infra/src/deployment/deploy.ts +++ b/typescript/infra/src/deployment/deploy.ts @@ -11,13 +11,13 @@ import { } from '@hyperlane-xyz/sdk'; import { objMap, objMerge, promiseObjAll } from '@hyperlane-xyz/utils'; -import { getAgentConfigJsonPath } from '../../scripts/agent-utils'; -import { DeployEnvironment } from '../config'; +import { getAgentConfigJsonPath } from '../../scripts/agent-utils.js'; +import { DeployEnvironment } from '../config/environment.js'; import { readJSONAtPath, writeJsonAtPath, writeMergedJSONAtPath, -} from '../utils/utils'; +} from '../utils/utils.js'; export async function deployWithArtifacts( configMap: ChainMap, diff --git a/typescript/infra/src/deployment/verify.ts b/typescript/infra/src/deployment/verify.ts index 7314c16fc..8143b5376 100644 --- a/typescript/infra/src/deployment/verify.ts +++ b/typescript/infra/src/deployment/verify.ts @@ -1,7 +1,7 @@ import { BuildArtifact, ChainMap } from '@hyperlane-xyz/sdk'; -import { fetchGCPSecret } from '../utils/gcloud'; -import { readJSONAtPath } from '../utils/utils'; +import { fetchGCPSecret } from '../utils/gcloud.js'; +import { readJSONAtPath } from '../utils/utils.js'; // read build artifact from given path export function extractBuildArtifact(buildArtifactPath: string): BuildArtifact { diff --git a/typescript/infra/src/funding/deterministic-keys.ts b/typescript/infra/src/funding/deterministic-keys.ts index 3f223f773..7271aa207 100644 --- a/typescript/infra/src/funding/deterministic-keys.ts +++ b/typescript/infra/src/funding/deterministic-keys.ts @@ -1,10 +1,9 @@ -import { Wallet } from 'ethers'; -import { HDNode } from 'ethers/lib/utils'; +import { Wallet, utils } from 'ethers'; -import { Contexts } from '../../config/contexts'; -import { AgentGCPKey } from '../agents/gcp'; -import { DeployEnvironment } from '../config'; -import { Role } from '../roles'; +import { Contexts } from '../../config/contexts.js'; +import { AgentGCPKey } from '../agents/gcp.js'; +import { DeployEnvironment } from '../config/environment.js'; +import { Role } from '../roles.js'; // Keys that are derived from the deployer key, mainly to have deterministic addresses on every chain // The order here matters so don't mix it up @@ -30,7 +29,7 @@ export const getDeterministicKey = async ( Role.Deployer, ); await deployerKey.fetch(); - const seed = HDNode.fromSeed(deployerKey.privateKey); + const seed = utils.HDNode.fromSeed(deployerKey.privateKey); const derivedKey = seed.derivePath( `m/44'/60'/0'/${deterministicKeyRole}/${DeterministicKeyRoleNonces[deterministicKeyRole]}`, ); diff --git a/typescript/infra/src/funding/key-funder.ts b/typescript/infra/src/funding/key-funder.ts index 78f58e553..b149b6a0b 100644 --- a/typescript/infra/src/funding/key-funder.ts +++ b/typescript/infra/src/funding/key-funder.ts @@ -1,7 +1,8 @@ -import { AgentContextConfig, EnvironmentConfig } from '../config'; -import { KeyFunderConfig } from '../config/funding'; -import { HelmCommand, helmifyValues } from '../utils/helm'; -import { execCmd } from '../utils/utils'; +import { AgentContextConfig } from '../config/agent/agent.js'; +import { EnvironmentConfig } from '../config/environment.js'; +import { KeyFunderConfig } from '../config/funding.js'; +import { HelmCommand, helmifyValues } from '../utils/helm.js'; +import { execCmd } from '../utils/utils.js'; export async function runKeyFunderHelmCommand( helmCommand: HelmCommand, diff --git a/typescript/infra/src/govern/HyperlaneAppGovernor.ts b/typescript/infra/src/govern/HyperlaneAppGovernor.ts index 52636d45e..98444af86 100644 --- a/typescript/infra/src/govern/HyperlaneAppGovernor.ts +++ b/typescript/infra/src/govern/HyperlaneAppGovernor.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'ethers'; -import { prompts } from 'prompts'; +import prompts from 'prompts'; import { Ownable__factory } from '@hyperlane-xyz/core'; import { @@ -20,14 +20,14 @@ import { objMap, } from '@hyperlane-xyz/utils'; -import { canProposeSafeTransactions } from '../utils/safe'; +import { canProposeSafeTransactions } from '../utils/safe.js'; import { ManualMultiSend, MultiSend, SafeMultiSend, SignerMultiSend, -} from './multisend'; +} from './multisend.js'; export enum SubmissionType { MANUAL = 0, @@ -96,7 +96,7 @@ export abstract class HyperlaneAppGovernor< ); const response = !confirm || - (await prompts.confirm({ + (await prompts({ type: 'confirm', name: 'value', message: 'Can you confirm?', diff --git a/typescript/infra/src/govern/HyperlaneCoreGovernor.ts b/typescript/infra/src/govern/HyperlaneCoreGovernor.ts index f495be5a1..5a0475272 100644 --- a/typescript/infra/src/govern/HyperlaneCoreGovernor.ts +++ b/typescript/infra/src/govern/HyperlaneCoreGovernor.ts @@ -12,7 +12,7 @@ import { ViolationType, } from '@hyperlane-xyz/sdk'; -import { HyperlaneAppGovernor } from '../govern/HyperlaneAppGovernor'; +import { HyperlaneAppGovernor } from '../govern/HyperlaneAppGovernor.js'; export class HyperlaneCoreGovernor extends HyperlaneAppGovernor< HyperlaneCore, diff --git a/typescript/infra/src/govern/HyperlaneIgpGovernor.ts b/typescript/infra/src/govern/HyperlaneIgpGovernor.ts index fdd140b88..1d170596d 100644 --- a/typescript/infra/src/govern/HyperlaneIgpGovernor.ts +++ b/typescript/infra/src/govern/HyperlaneIgpGovernor.ts @@ -13,7 +13,7 @@ import { OwnerViolation, } from '@hyperlane-xyz/sdk'; -import { HyperlaneAppGovernor } from '../govern/HyperlaneAppGovernor'; +import { HyperlaneAppGovernor } from '../govern/HyperlaneAppGovernor.js'; export class HyperlaneIgpGovernor extends HyperlaneAppGovernor< HyperlaneIgp, diff --git a/typescript/infra/src/govern/ProxiedRouterGovernor.ts b/typescript/infra/src/govern/ProxiedRouterGovernor.ts index 004c4522a..5020a7db0 100644 --- a/typescript/infra/src/govern/ProxiedRouterGovernor.ts +++ b/typescript/infra/src/govern/ProxiedRouterGovernor.ts @@ -11,7 +11,7 @@ import { ViolationType, } from '@hyperlane-xyz/sdk'; -import { HyperlaneAppGovernor } from './HyperlaneAppGovernor'; +import { HyperlaneAppGovernor } from './HyperlaneAppGovernor.js'; export class ProxiedRouterGovernor< App extends RouterApp, diff --git a/typescript/infra/src/govern/multisend.ts b/typescript/infra/src/govern/multisend.ts index 53689b9e8..56929e902 100644 --- a/typescript/infra/src/govern/multisend.ts +++ b/typescript/infra/src/govern/multisend.ts @@ -1,7 +1,7 @@ import { ChainName, MultiProvider } from '@hyperlane-xyz/sdk'; import { CallData } from '@hyperlane-xyz/utils'; -import { getSafe, getSafeService } from '../utils/safe'; +import { getSafe, getSafeService } from '../utils/safe.js'; export abstract class MultiSend { abstract sendTransactions(calls: CallData[]): Promise; diff --git a/typescript/infra/src/helloworld/kathy.ts b/typescript/infra/src/helloworld/kathy.ts index c5519682d..44651380d 100644 --- a/typescript/infra/src/helloworld/kathy.ts +++ b/typescript/infra/src/helloworld/kathy.ts @@ -1,14 +1,14 @@ -import { Contexts } from '../../config/contexts'; -import { AgentAwsUser } from '../agents/aws'; -import { AgentGCPKey } from '../agents/gcp'; -import { AgentContextConfig } from '../config'; +import { Contexts } from '../../config/contexts.js'; +import { AgentAwsUser } from '../agents/aws/user.js'; +import { AgentGCPKey } from '../agents/gcp.js'; +import { AgentContextConfig } from '../config/agent/agent.js'; import { HelloWorldKathyConfig, HelloWorldKathyRunMode, -} from '../config/helloworld/types'; -import { Role } from '../roles'; -import { HelmCommand, helmifyValues } from '../utils/helm'; -import { execCmd } from '../utils/utils'; +} from '../config/helloworld/types.js'; +import { Role } from '../roles.js'; +import { HelmCommand, helmifyValues } from '../utils/helm.js'; +import { execCmd } from '../utils/utils.js'; export async function runHelloworldKathyHelmCommand( helmCommand: HelmCommand, diff --git a/typescript/infra/src/infrastructure/external-secrets/external-secrets.ts b/typescript/infra/src/infrastructure/external-secrets/external-secrets.ts index f1280fb4e..24569a6e9 100644 --- a/typescript/infra/src/infrastructure/external-secrets/external-secrets.ts +++ b/typescript/infra/src/infrastructure/external-secrets/external-secrets.ts @@ -1,18 +1,20 @@ -import { InfrastructureConfig } from '../../config/infrastructure'; +import { sleep } from '@hyperlane-xyz/utils'; + +import { InfrastructureConfig } from '../../config/infrastructure.js'; import { createServiceAccountIfNotExists, createServiceAccountKey, getCurrentProject, getCurrentProjectNumber, grantServiceAccountRoleIfNotExists, -} from '../../utils/gcloud'; +} from '../../utils/gcloud.js'; import { HelmCommand, addHelmRepoIfRequired, getDeployableHelmChartName, helmifyValues, -} from '../../utils/helm'; -import { execCmd, execCmdAndParseJson, sleep } from '../../utils/utils'; +} from '../../utils/helm.js'; +import { execCmd, execCmdAndParseJson } from '../../utils/utils.js'; const SECRET_ACCESSOR_ROLE = 'roles/secretmanager.secretAccessor'; diff --git a/typescript/infra/src/infrastructure/monitoring/prometheus.ts b/typescript/infra/src/infrastructure/monitoring/prometheus.ts index 47864847b..a4049fc29 100644 --- a/typescript/infra/src/infrastructure/monitoring/prometheus.ts +++ b/typescript/infra/src/infrastructure/monitoring/prometheus.ts @@ -1,12 +1,12 @@ -import { InfrastructureConfig } from '../../config/infrastructure'; -import { fetchGCPSecret } from '../../utils/gcloud'; +import { InfrastructureConfig } from '../../config/infrastructure.js'; +import { fetchGCPSecret } from '../../utils/gcloud.js'; import { HelmCommand, addHelmRepoIfRequired, getDeployableHelmChartName, helmifyValues, -} from '../../utils/helm'; -import { execCmd } from '../../utils/utils'; +} from '../../utils/helm.js'; +import { execCmd } from '../../utils/utils.js'; interface PrometheusSecrets { remote_write_uri: string; diff --git a/typescript/infra/src/middleware/liquidity-layer-relayer.ts b/typescript/infra/src/middleware/liquidity-layer-relayer.ts index 43ba2bb2d..e334c921e 100644 --- a/typescript/infra/src/middleware/liquidity-layer-relayer.ts +++ b/typescript/infra/src/middleware/liquidity-layer-relayer.ts @@ -1,7 +1,8 @@ -import { AgentContextConfig, EnvironmentConfig } from '../config'; -import { LiquidityLayerRelayerConfig } from '../config/middleware'; -import { HelmCommand, helmifyValues } from '../utils/helm'; -import { execCmd } from '../utils/utils'; +import { AgentContextConfig } from '../config/agent/agent.js'; +import { EnvironmentConfig } from '../config/environment.js'; +import { LiquidityLayerRelayerConfig } from '../config/middleware.js'; +import { HelmCommand, helmifyValues } from '../utils/helm.js'; +import { execCmd } from '../utils/utils.js'; export async function runLiquidityLayerRelayerHelmCommand( helmCommand: HelmCommand, diff --git a/typescript/infra/src/utils/gcloud.ts b/typescript/infra/src/utils/gcloud.ts index dde9411ed..0ce5e21f3 100644 --- a/typescript/infra/src/utils/gcloud.ts +++ b/typescript/infra/src/utils/gcloud.ts @@ -1,16 +1,17 @@ -import debug from 'debug'; import fs from 'fs'; +import { rootLogger } from '@hyperlane-xyz/utils'; + import { rm, writeFile } from 'fs/promises'; -import { execCmd, execCmdAndParseJson } from './utils'; +import { execCmd, execCmdAndParseJson } from './utils.js'; interface IamCondition { title: string; expression: string; } -const debugLog = debug('infra:utils:gcloud'); +const debugLog = rootLogger.child({ module: 'infra:utils:gcloud' }).debug; // Allows secrets to be overridden via environment variables to avoid // gcloud calls. This is particularly useful for running commands in k8s, diff --git a/typescript/infra/src/utils/helm.ts b/typescript/infra/src/utils/helm.ts index 9935ad928..0b5c1653d 100644 --- a/typescript/infra/src/utils/helm.ts +++ b/typescript/infra/src/utils/helm.ts @@ -1,9 +1,9 @@ import { HelmChartConfig, HelmChartRepositoryConfig, -} from '../config/infrastructure'; +} from '../config/infrastructure.js'; -import { execCmd } from './utils'; +import { execCmd } from './utils.js'; export enum HelmCommand { InstallOrUpgrade = 'upgrade --install', diff --git a/typescript/infra/src/utils/utils.ts b/typescript/infra/src/utils/utils.ts index 84256ba58..e06298854 100644 --- a/typescript/infra/src/utils/utils.ts +++ b/typescript/infra/src/utils/utils.ts @@ -1,5 +1,5 @@ // @ts-ignore -import * as asn1 from 'asn1.js'; +import asn1 from 'asn1.js'; import { exec } from 'child_process'; import { ethers } from 'ethers'; import fs from 'fs'; @@ -15,12 +15,8 @@ import { } from '@hyperlane-xyz/sdk'; import { ProtocolType, objMerge } from '@hyperlane-xyz/utils'; -import { Contexts } from '../../config/contexts'; -import { FundableRole, Role } from '../roles'; - -export function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} +import { Contexts } from '../../config/contexts.js'; +import { FundableRole, Role } from '../roles.js'; /** * Map an async function over a list xs with a given concurrency level diff --git a/typescript/infra/test/agent-configs.test.ts b/typescript/infra/test/agent-configs.test.ts index ea7c6f377..5ac073adb 100644 --- a/typescript/infra/test/agent-configs.test.ts +++ b/typescript/infra/test/agent-configs.test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; -import { hyperlaneContextAgentChainConfig as mainnet3AgentChainConfig } from '../config/environments/mainnet3/agent'; -import { supportedChainNames as mainnet3SupportedChainNames } from '../config/environments/mainnet3/chains'; -import { hyperlaneContextAgentChainConfig as testnet4AgentChainConfig } from '../config/environments/testnet4/agent'; -import { supportedChainNames as testnet4SupportedChainNames } from '../config/environments/testnet4/chains'; -import { getAgentConfigJsonPath } from '../scripts/agent-utils'; -import { ensureAgentChainConfigIncludesAllChainNames } from '../src/config'; -import { readJSONAtPath } from '../src/utils/utils'; +import { hyperlaneContextAgentChainConfig as mainnet3AgentChainConfig } from '../config/environments/mainnet3/agent.js'; +import { supportedChainNames as mainnet3SupportedChainNames } from '../config/environments/mainnet3/chains.js'; +import { hyperlaneContextAgentChainConfig as testnet4AgentChainConfig } from '../config/environments/testnet4/agent.js'; +import { supportedChainNames as testnet4SupportedChainNames } from '../config/environments/testnet4/chains.js'; +import { getAgentConfigJsonPath } from '../scripts/agent-utils.js'; +import { ensureAgentChainConfigIncludesAllChainNames } from '../src/config/agent/agent.js'; +import { readJSONAtPath } from '../src/utils/utils.js'; const environmentChainConfigs = { mainnet3: { diff --git a/typescript/infra/test/cloud-agent-keys.test.ts b/typescript/infra/test/cloud-agent-keys.test.ts index b830ce0ed..8e42132cd 100644 --- a/typescript/infra/test/cloud-agent-keys.test.ts +++ b/typescript/infra/test/cloud-agent-keys.test.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; -import { Contexts } from '../config/contexts'; -import { AgentAwsKey } from '../src/agents/aws'; -import { AgentGCPKey } from '../src/agents/gcp'; -import { ReadOnlyCloudAgentKey } from '../src/agents/keys'; -import { Role } from '../src/roles'; +import { Contexts } from '../config/contexts.js'; +import { AgentAwsKey } from '../src/agents/aws/key.js'; +import { AgentGCPKey } from '../src/agents/gcp.js'; +import { ReadOnlyCloudAgentKey } from '../src/agents/keys.js'; +import { Role } from '../src/roles.js'; describe('ReadOnlyCloudAgentKey', () => { describe('fromSerializedAddress', () => { diff --git a/typescript/infra/test/govern.hardhat-test.ts b/typescript/infra/test/govern.hardhat-test.ts index ee1fdf9ae..a94e5dbc1 100644 --- a/typescript/infra/test/govern.hardhat-test.ts +++ b/typescript/infra/test/govern.hardhat-test.ts @@ -1,7 +1,7 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; import { expect } from 'chai'; -import { BigNumber } from 'ethers'; -import { ethers } from 'hardhat'; +import { BigNumber, utils } from 'ethers'; +import hre from 'hardhat'; import { InterchainAccountRouter, @@ -20,21 +20,23 @@ import { HyperlaneProxyFactoryDeployer, InterchainAccount, InterchainAccountDeployer, + InterchainAccountFactories, MultiProvider, OwnableConfig, RouterConfig, TestCoreApp, TestCoreDeployer, - randomAddress, resolveOrDeployAccountOwner, } from '@hyperlane-xyz/sdk'; -import { InterchainAccountFactories } from '@hyperlane-xyz/sdk/dist/middleware/account/contracts'; import { Address, CallData, eqAddress } from '@hyperlane-xyz/utils'; import { AnnotatedCallData, HyperlaneAppGovernor, -} from '../src/govern/HyperlaneAppGovernor'; +} from '../src/govern/HyperlaneAppGovernor.js'; + +// TODO de-dupe with test-utils after migrating this file to the SDK +const randomAddress = () => utils.hexlify(utils.randomBytes(20)); export class TestApp extends HyperlaneApp<{}> {} @@ -105,7 +107,8 @@ describe('ICA governance', async () => { let governor: HyperlaneTestGovernor; before(async () => { - [signer] = await ethers.getSigners(); + // @ts-ignore + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/infra/tsconfig.json b/typescript/infra/tsconfig.json index 4a968b40d..97ee75a9a 100644 --- a/typescript/infra/tsconfig.json +++ b/typescript/infra/tsconfig.json @@ -1,12 +1,15 @@ { + "extends": "../tsconfig.json", "compilerOptions": { + "declaration": false, + "declarationMap": false, "outDir": "./dist/", "rootDir": "./", "noUnusedLocals": false, - "resolveJsonModule": true + "module": "es2022", + "moduleResolution": "node", }, "exclude": ["./node_modules/", "./dist/", "./tmp.ts"], - "extends": "../tsconfig.json", "include": [ "./*.ts", "./config/**/*.ts", diff --git a/typescript/sdk/.mocharc.json b/typescript/sdk/.mocharc.json index e516df998..2a414eb58 100644 --- a/typescript/sdk/.mocharc.json +++ b/typescript/sdk/.mocharc.json @@ -1,3 +1,3 @@ { - "require": ["ts-node/register"] + "import": ["tsx"] } diff --git a/typescript/sdk/README.md b/typescript/sdk/README.md index 8f99d9e61..4c704aa12 100644 --- a/typescript/sdk/README.md +++ b/typescript/sdk/README.md @@ -14,6 +14,8 @@ npm install @hyperlane-xyz/sdk yarn add @hyperlane-xyz/sdk ``` +Note, this package uses [ESM Modules](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) + ## Contents ### Constants diff --git a/typescript/sdk/hardhat.config.ts b/typescript/sdk/hardhat.config.cts similarity index 82% rename from typescript/sdk/hardhat.config.ts rename to typescript/sdk/hardhat.config.cts index e65a4508a..7141d615d 100644 --- a/typescript/sdk/hardhat.config.ts +++ b/typescript/sdk/hardhat.config.cts @@ -1,6 +1,7 @@ import '@nomiclabs/hardhat-ethers'; import '@nomiclabs/hardhat-waffle'; -import '@typechain/hardhat'; +import 'hardhat-gas-reporter'; +import 'solidity-coverage'; /** * @type import('hardhat/config').HardhatUserConfig @@ -20,5 +21,6 @@ module.exports = { }, mocha: { bail: true, + import: 'tsx', }, }; diff --git a/typescript/sdk/package.json b/typescript/sdk/package.json index b80516f42..bd98fa188 100644 --- a/typescript/sdk/package.json +++ b/typescript/sdk/package.json @@ -21,7 +21,7 @@ "zod": "^3.21.2" }, "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.2.1", + "@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-waffle": "^2.0.6", "@types/mocha": "^10.0.1", "@types/node": "^16.9.1", @@ -30,29 +30,39 @@ "@types/ws": "^8.5.5", "chai": "^4.3.6", "dotenv": "^10.0.0", - "eslint": "^8.43.0", + "eslint": "^8.57.0", "ethereum-waffle": "^4.0.10", - "hardhat": "^2.19.0", + "hardhat": "^2.22.2", "mocha": "^10.2.0", "prettier": "^2.8.8", "sinon": "^13.0.2", "ts-node": "^10.8.0", - "typescript": "5.1.6", + "tsx": "^4.7.1", + "typescript": "5.3.3", "yaml": "^2.3.1" }, + "type": "module", + "exports": { + ".": "./dist/index.js", + "./logos": "./logos" + }, + "types": "./dist/index.d.ts", "files": [ "/dist", "/logos" ], + "sideEffects": false, + "engines": { + "node": ">=16" + }, "homepage": "https://www.hyperlane.xyz", + "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "keywords": [ "Hyperlane", "SDK", "Typescript" ], "license": "Apache-2.0", - "main": "dist/index.js", - "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "scripts": { "build": "tsc", "dev": "tsc --watch", @@ -64,11 +74,10 @@ "test": "yarn test:unit && yarn test:hardhat && yarn test:foundry", "test:ci": "yarn test", "test:unit": "mocha --config .mocharc.json './src/**/*.test.ts' --exit", - "test:hardhat": "hardhat test $(find ./src -name \"*.hardhat-test.ts\")", - "test:metadata": "ts-node ./src/test/metadata-check.ts", + "test:hardhat": "NODE_OPTIONS='--experimental-loader ts-node/esm/transpile-only --no-warnings=ExperimentalWarning' hardhat --config hardhat.config.cts test $(find ./src -name \"*.hardhat-test.ts\")", + "test:metadata": "tsx ./src/test/metadata-check.ts", "test:foundry": "./scripts/foundry-test.sh" }, - "types": "dist/index.d.ts", "peerDependencies": { "@ethersproject/abi": "*", "@ethersproject/providers": "*" diff --git a/typescript/sdk/src/app/HyperlaneApp.ts b/typescript/sdk/src/app/HyperlaneApp.ts index 016a75ddb..fe6c365d3 100644 --- a/typescript/sdk/src/app/HyperlaneApp.ts +++ b/typescript/sdk/src/app/HyperlaneApp.ts @@ -1,15 +1,18 @@ import { objMap, rootLogger } from '@hyperlane-xyz/utils'; -import { connectContracts, serializeContracts } from '../contracts/contracts'; +import { + connectContracts, + serializeContracts, +} from '../contracts/contracts.js'; import { HyperlaneAddresses, HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from '../contracts/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainName } from '../types'; -import { MultiGeneric } from '../utils/MultiGeneric'; +} from '../contracts/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainName } from '../types.js'; +import { MultiGeneric } from '../utils/MultiGeneric.js'; export class HyperlaneApp< Factories extends HyperlaneFactories, diff --git a/typescript/sdk/src/app/MultiProtocolApp.test.ts b/typescript/sdk/src/app/MultiProtocolApp.test.ts index 9c69f39fb..49251ab6d 100644 --- a/typescript/sdk/src/app/MultiProtocolApp.test.ts +++ b/typescript/sdk/src/app/MultiProtocolApp.test.ts @@ -2,8 +2,8 @@ import { expect } from 'chai'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; import { BaseAppAdapter, @@ -11,7 +11,7 @@ import { BaseEvmAdapter, BaseSealevelAdapter, MultiProtocolApp, -} from './MultiProtocolApp'; +} from './MultiProtocolApp.js'; class TestMultiProtocolApp extends MultiProtocolApp { override protocolToAdapter(protocol: ProtocolType) { diff --git a/typescript/sdk/src/app/MultiProtocolApp.ts b/typescript/sdk/src/app/MultiProtocolApp.ts index abde68a0e..6444d68a1 100644 --- a/typescript/sdk/src/app/MultiProtocolApp.ts +++ b/typescript/sdk/src/app/MultiProtocolApp.ts @@ -9,17 +9,17 @@ import { symmetricDifference, } from '@hyperlane-xyz/utils'; -import { ChainMetadata } from '../metadata/chainMetadataTypes'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { ChainMetadata } from '../metadata/chainMetadataTypes.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; import { CosmJsProvider, CosmJsWasmProvider, EthersV5Provider, SolanaWeb3Provider, TypedProvider, -} from '../providers/ProviderType'; -import { ChainMap, ChainName } from '../types'; -import { MultiGeneric } from '../utils/MultiGeneric'; +} from '../providers/ProviderType.js'; +import { ChainMap, ChainName } from '../types.js'; +import { MultiGeneric } from '../utils/MultiGeneric.js'; /** * A minimal interface for an adapter that can be used with MultiProtocolApp diff --git a/typescript/sdk/src/consts/chainMetadata.ts b/typescript/sdk/src/consts/chainMetadata.ts index 9ad222da5..2cfdcdbad 100644 --- a/typescript/sdk/src/consts/chainMetadata.ts +++ b/typescript/sdk/src/consts/chainMetadata.ts @@ -4,10 +4,10 @@ import { ChainMetadata, ChainTechnicalStack, ExplorerFamily, -} from '../metadata/chainMetadataTypes'; -import { ChainMap } from '../types'; +} from '../metadata/chainMetadataTypes.js'; +import { ChainMap } from '../types.js'; -import { Chains, Mainnets, Testnets } from './chains'; +import { Chains, Mainnets, Testnets } from './chains.js'; /** * Common native currencies diff --git a/typescript/sdk/src/consts/environments/index.ts b/typescript/sdk/src/consts/environments/index.ts index 96a308cbd..4fa77cc6c 100644 --- a/typescript/sdk/src/consts/environments/index.ts +++ b/typescript/sdk/src/consts/environments/index.ts @@ -1,10 +1,10 @@ import { objMerge } from '@hyperlane-xyz/utils'; -import { ChainName } from '../../types'; -import { CoreChainName } from '../chains'; +import { ChainName } from '../../types.js'; +import { CoreChainName } from '../chains.js'; -import mainnet from './mainnet.json'; -import testnet from './testnet.json'; +import mainnet from './mainnet.json' assert { type: 'json' }; +import testnet from './testnet.json' assert { type: 'json' }; export const hyperlaneEnvironments = { mainnet, testnet }; diff --git a/typescript/sdk/src/consts/multisigIsm.ts b/typescript/sdk/src/consts/multisigIsm.ts index dbe5e9e1b..1a63efe9e 100644 --- a/typescript/sdk/src/consts/multisigIsm.ts +++ b/typescript/sdk/src/consts/multisigIsm.ts @@ -1,5 +1,5 @@ -import { MultisigConfig } from '../ism/types'; -import { ChainMap } from '../types'; +import { MultisigConfig } from '../ism/types.js'; +import { ChainMap } from '../types.js'; export const defaultMultisigConfigs: ChainMap = { alfajores: { diff --git a/typescript/sdk/src/contracts/contracts.ts b/typescript/sdk/src/contracts/contracts.ts index 558b6d0f3..557e68d17 100644 --- a/typescript/sdk/src/contracts/contracts.ts +++ b/typescript/sdk/src/contracts/contracts.ts @@ -12,9 +12,9 @@ import { promiseObjAll, } from '@hyperlane-xyz/utils'; -import { ChainMetadataManager } from '../metadata/ChainMetadataManager'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, Connection } from '../types'; +import { ChainMetadataManager } from '../metadata/ChainMetadataManager.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, Connection } from '../types.js'; import { HyperlaneAddresses, @@ -22,7 +22,7 @@ import { HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from './types'; +} from './types.js'; export function serializeContractsMap( contractsMap: HyperlaneContractsMap, diff --git a/typescript/sdk/src/contracts/types.ts b/typescript/sdk/src/contracts/types.ts index 75e90c47d..271e070d6 100644 --- a/typescript/sdk/src/contracts/types.ts +++ b/typescript/sdk/src/contracts/types.ts @@ -2,7 +2,7 @@ import type { ethers } from 'ethers'; import type { Address } from '@hyperlane-xyz/utils'; -import type { ChainMap } from '../types'; +import type { ChainMap } from '../types.js'; export type AddressesMap = { [key: string]: Address; diff --git a/typescript/sdk/src/core/CoreDeployer.hardhat-test.ts b/typescript/sdk/src/core/CoreDeployer.hardhat-test.ts index 153524436..fb58ef088 100644 --- a/typescript/sdk/src/core/CoreDeployer.hardhat-test.ts +++ b/typescript/sdk/src/core/CoreDeployer.hardhat-test.ts @@ -1,24 +1,24 @@ import '@nomiclabs/hardhat-waffle'; import { assert, expect } from 'chai'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import sinon from 'sinon'; import { objMap, promiseObjAll } from '@hyperlane-xyz/utils'; -import { TestChains } from '../consts/chains'; -import { HyperlaneContractsMap } from '../contracts/types'; -import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { AggregationIsmConfig, IsmType } from '../ism/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { testCoreConfig } from '../test/testUtils'; -import { ChainMap } from '../types'; - -import { HyperlaneCore } from './HyperlaneCore'; -import { HyperlaneCoreChecker } from './HyperlaneCoreChecker'; -import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer'; -import { CoreFactories } from './contracts'; -import { CoreConfig } from './types'; +import { TestChains } from '../consts/chains.js'; +import { HyperlaneContractsMap } from '../contracts/types.js'; +import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { AggregationIsmConfig, IsmType } from '../ism/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { testCoreConfig } from '../test/testUtils.js'; +import { ChainMap } from '../types.js'; + +import { HyperlaneCore } from './HyperlaneCore.js'; +import { HyperlaneCoreChecker } from './HyperlaneCoreChecker.js'; +import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer.js'; +import { CoreFactories } from './contracts.js'; +import { CoreConfig } from './types.js'; describe('core', async () => { let multiProvider: MultiProvider; @@ -29,7 +29,7 @@ describe('core', async () => { let ismFactory: HyperlaneIsmFactory; before(async () => { - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const proxyFactoryDeployer = new HyperlaneProxyFactoryDeployer( multiProvider, @@ -69,7 +69,7 @@ describe('core', async () => { requiredHook: config.defaultHook, })); - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); const nonceBefore = await signer.getTransactionCount(); const updatedContracts = await deployer.deploy(updatedConfig); @@ -106,7 +106,7 @@ describe('core', async () => { }, ); - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); const nonceBefore = await signer.getTransactionCount(); await deployer.deploy(updatedConfig); diff --git a/typescript/sdk/src/core/HyperlaneCore.test.ts b/typescript/sdk/src/core/HyperlaneCore.test.ts index c657b801e..bcf6b8935 100644 --- a/typescript/sdk/src/core/HyperlaneCore.test.ts +++ b/typescript/sdk/src/core/HyperlaneCore.test.ts @@ -1,6 +1,6 @@ -import { MultiProvider } from '../providers/MultiProvider'; +import { MultiProvider } from '../providers/MultiProvider.js'; -import { HyperlaneCore } from './HyperlaneCore'; +import { HyperlaneCore } from './HyperlaneCore.js'; describe('HyperlaneCore', () => { describe('fromEnvironment', () => { diff --git a/typescript/sdk/src/core/HyperlaneCore.ts b/typescript/sdk/src/core/HyperlaneCore.ts index 0874fefdc..83a24eed1 100644 --- a/typescript/sdk/src/core/HyperlaneCore.ts +++ b/typescript/sdk/src/core/HyperlaneCore.ts @@ -13,21 +13,21 @@ import { pollAsync, } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../app/HyperlaneApp'; -import { chainMetadata } from '../consts/chainMetadata'; +import { HyperlaneApp } from '../app/HyperlaneApp.js'; +import { chainMetadata } from '../consts/chainMetadata.js'; import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../consts/environments'; -import { appFromAddressesMapHelper } from '../contracts/contracts'; -import { HyperlaneAddressesMap } from '../contracts/types'; -import { OwnableConfig } from '../deploy/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { RouterConfig } from '../router/types'; -import { ChainMap, ChainName } from '../types'; +} from '../consts/environments/index.js'; +import { appFromAddressesMapHelper } from '../contracts/contracts.js'; +import { HyperlaneAddressesMap } from '../contracts/types.js'; +import { OwnableConfig } from '../deploy/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { RouterConfig } from '../router/types.js'; +import { ChainMap, ChainName } from '../types.js'; -import { CoreFactories, coreFactories } from './contracts'; -import { DispatchedMessage } from './types'; +import { CoreFactories, coreFactories } from './contracts.js'; +import { DispatchedMessage } from './types.js'; export class HyperlaneCore extends HyperlaneApp { static fromEnvironment( diff --git a/typescript/sdk/src/core/HyperlaneCoreChecker.ts b/typescript/sdk/src/core/HyperlaneCoreChecker.ts index 7218b708c..d91a218d3 100644 --- a/typescript/sdk/src/core/HyperlaneCoreChecker.ts +++ b/typescript/sdk/src/core/HyperlaneCoreChecker.ts @@ -2,22 +2,22 @@ import { ethers, utils as ethersUtils } from 'ethers'; import { assert, eqAddress } from '@hyperlane-xyz/utils'; -import { BytecodeHash } from '../consts/bytecode'; -import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker'; -import { proxyImplementation } from '../deploy/proxy'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { collectValidators, moduleMatchesConfig } from '../ism/utils'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; - -import { HyperlaneCore } from './HyperlaneCore'; +import { BytecodeHash } from '../consts/bytecode.js'; +import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker.js'; +import { proxyImplementation } from '../deploy/proxy.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { collectValidators, moduleMatchesConfig } from '../ism/utils.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; + +import { HyperlaneCore } from './HyperlaneCore.js'; import { CoreConfig, CoreViolationType, MailboxViolation, MailboxViolationType, ValidatorAnnounceViolation, -} from './types'; +} from './types.js'; export class HyperlaneCoreChecker extends HyperlaneAppChecker< HyperlaneCore, diff --git a/typescript/sdk/src/core/HyperlaneCoreDeployer.ts b/typescript/sdk/src/core/HyperlaneCoreDeployer.ts index bc00872e9..dc36a05b9 100644 --- a/typescript/sdk/src/core/HyperlaneCoreDeployer.ts +++ b/typescript/sdk/src/core/HyperlaneCoreDeployer.ts @@ -6,20 +6,20 @@ import { } from '@hyperlane-xyz/core'; import { Address, rootLogger } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts } from '../contracts/types'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; -import { ContractVerifier } from '../deploy/verify/ContractVerifier'; -import { HyperlaneHookDeployer } from '../hook/HyperlaneHookDeployer'; -import { HookConfig } from '../hook/types'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { IsmConfig } from '../ism/types'; -import { moduleMatchesConfig } from '../ism/utils'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; +import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { HyperlaneHookDeployer } from '../hook/HyperlaneHookDeployer.js'; +import { HookConfig } from '../hook/types.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { IsmConfig } from '../ism/types.js'; +import { moduleMatchesConfig } from '../ism/utils.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; -import { TestRecipientDeployer } from './TestRecipientDeployer'; -import { CoreAddresses, CoreFactories, coreFactories } from './contracts'; -import { CoreConfig } from './types'; +import { TestRecipientDeployer } from './TestRecipientDeployer.js'; +import { CoreAddresses, CoreFactories, coreFactories } from './contracts.js'; +import { CoreConfig } from './types.js'; export class HyperlaneCoreDeployer extends HyperlaneDeployer< CoreConfig, diff --git a/typescript/sdk/src/core/MultiProtocolCore.test.ts b/typescript/sdk/src/core/MultiProtocolCore.test.ts index 4e419fbb6..2eab2e96f 100644 --- a/typescript/sdk/src/core/MultiProtocolCore.test.ts +++ b/typescript/sdk/src/core/MultiProtocolCore.test.ts @@ -1,13 +1,13 @@ import { expect } from 'chai'; import { ethers } from 'ethers'; -import { ethereum } from '../consts/chainMetadata'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; -import { ProviderType } from '../providers/ProviderType'; +import { ethereum } from '../consts/chainMetadata.js'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; +import { ProviderType } from '../providers/ProviderType.js'; -import { MultiProtocolCore } from './MultiProtocolCore'; -import { EvmCoreAdapter } from './adapters/EvmCoreAdapter'; +import { MultiProtocolCore } from './MultiProtocolCore.js'; +import { EvmCoreAdapter } from './adapters/EvmCoreAdapter.js'; describe('MultiProtocolCore', () => { describe('constructs', () => { diff --git a/typescript/sdk/src/core/MultiProtocolCore.ts b/typescript/sdk/src/core/MultiProtocolCore.ts index 5cae3358b..0d8411a95 100644 --- a/typescript/sdk/src/core/MultiProtocolCore.ts +++ b/typescript/sdk/src/core/MultiProtocolCore.ts @@ -1,19 +1,19 @@ import { HexString, ProtocolType, rootLogger } from '@hyperlane-xyz/utils'; -import { AdapterClassType, MultiProtocolApp } from '../app/MultiProtocolApp'; +import { AdapterClassType, MultiProtocolApp } from '../app/MultiProtocolApp.js'; import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../consts/environments'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; -import { TypedTransactionReceipt } from '../providers/ProviderType'; -import { ChainMap, ChainName } from '../types'; +} from '../consts/environments/index.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; +import { TypedTransactionReceipt } from '../providers/ProviderType.js'; +import { ChainMap, ChainName } from '../types.js'; -import { CosmWasmCoreAdapter } from './adapters/CosmWasmCoreAdapter'; -import { EvmCoreAdapter } from './adapters/EvmCoreAdapter'; -import { SealevelCoreAdapter } from './adapters/SealevelCoreAdapter'; -import { ICoreAdapter } from './adapters/types'; -import { CoreAddresses } from './contracts'; +import { CosmWasmCoreAdapter } from './adapters/CosmWasmCoreAdapter.js'; +import { EvmCoreAdapter } from './adapters/EvmCoreAdapter.js'; +import { SealevelCoreAdapter } from './adapters/SealevelCoreAdapter.js'; +import { ICoreAdapter } from './adapters/types.js'; +import { CoreAddresses } from './contracts.js'; export class MultiProtocolCore extends MultiProtocolApp< ICoreAdapter, diff --git a/typescript/sdk/src/core/TestCoreApp.ts b/typescript/sdk/src/core/TestCoreApp.ts index 3fe41f196..477b24fe5 100644 --- a/typescript/sdk/src/core/TestCoreApp.ts +++ b/typescript/sdk/src/core/TestCoreApp.ts @@ -3,11 +3,11 @@ import { ethers } from 'ethers'; import { TestMailbox, TestMailbox__factory } from '@hyperlane-xyz/core'; import { messageId } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts } from '../contracts/types'; -import { ChainName } from '../types'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { ChainName } from '../types.js'; -import { HyperlaneCore } from './HyperlaneCore'; -import { coreFactories } from './contracts'; +import { HyperlaneCore } from './HyperlaneCore.js'; +import { coreFactories } from './contracts.js'; export const testCoreFactories = { ...coreFactories, diff --git a/typescript/sdk/src/core/TestCoreDeployer.ts b/typescript/sdk/src/core/TestCoreDeployer.ts index abb61a7ab..32a994c5c 100644 --- a/typescript/sdk/src/core/TestCoreDeployer.ts +++ b/typescript/sdk/src/core/TestCoreDeployer.ts @@ -1,11 +1,11 @@ -import { TestChains } from '../consts/chains'; -import { HyperlaneContracts } from '../contracts/types'; -import { testCoreConfig } from '../test/testUtils'; -import { ChainMap } from '../types'; +import { TestChains } from '../consts/chains.js'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { testCoreConfig } from '../test/testUtils.js'; +import { ChainMap } from '../types.js'; -import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer'; -import { TestCoreApp } from './TestCoreApp'; -import { CoreFactories } from './contracts'; +import { HyperlaneCoreDeployer } from './HyperlaneCoreDeployer.js'; +import { TestCoreApp } from './TestCoreApp.js'; +import { CoreFactories } from './contracts.js'; export class TestCoreDeployer extends HyperlaneCoreDeployer { async deploy(): Promise>> { diff --git a/typescript/sdk/src/core/TestRecipientDeployer.ts b/typescript/sdk/src/core/TestRecipientDeployer.ts index 490af7f73..02d0c2a29 100644 --- a/typescript/sdk/src/core/TestRecipientDeployer.ts +++ b/typescript/sdk/src/core/TestRecipientDeployer.ts @@ -1,11 +1,11 @@ import { TestRecipient, TestRecipient__factory } from '@hyperlane-xyz/core'; import { Address, rootLogger } from '@hyperlane-xyz/utils'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; -import { ContractVerifier } from '../deploy/verify/ContractVerifier'; -import { MultiProvider } from '../providers/MultiProvider'; -import { MailboxClientConfig } from '../router/types'; -import { ChainName } from '../types'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; +import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { MailboxClientConfig } from '../router/types.js'; +import { ChainName } from '../types.js'; export type TestRecipientConfig = Pick< MailboxClientConfig, diff --git a/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.test.ts b/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.test.ts index 686b044f2..fb56d868b 100644 --- a/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.test.ts +++ b/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.test.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; -import { Chains } from '../../consts/chains'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ProviderType } from '../../providers/ProviderType'; +import { Chains } from '../../consts/chains.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ProviderType } from '../../providers/ProviderType.js'; -import { CosmWasmCoreAdapter } from './CosmWasmCoreAdapter'; +import { CosmWasmCoreAdapter } from './CosmWasmCoreAdapter.js'; const TX_RECEIPT = JSON.parse( `{"height":62609917,"transactionHash":"3106A2BECE7FC03EC6F7FD3BC1577B9456C8B481A017A3A51AD7E9D27D9240A7","events":[{"type":"coin_spent","attributes":[{"key":"spender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"amount","value":"948228000000000inj"}]},{"type":"coin_received","attributes":[{"key":"receiver","value":"inj17xpfvakm2amg962yls6f84z3kell8c5l6s5ye9"},{"key":"amount","value":"948228000000000inj"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"inj17xpfvakm2amg962yls6f84z3kell8c5l6s5ye9"},{"key":"sender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"amount","value":"948228000000000inj"}]},{"type":"message","attributes":[{"key":"sender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"}]},{"type":"tx","attributes":[{"key":"fee","value":"948228000000000inj"},{"key":"fee_payer","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"}]},{"type":"tx","attributes":[{"key":"acc_seq","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up/20"}]},{"type":"tx","attributes":[{"key":"signature","value":"9XC7pL/hEa4PvJQxyAKdLpucpA/t+lNKzqfeSgUYTw9Old05Lbfx95GkIaXnuTOspCvYIZIuLesJ5wQHdL1Ljw=="}]},{"type":"message","attributes":[{"key":"action","value":"/cosmwasm.wasm.v1.MsgExecuteContract"},{"key":"sender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"module","value":"wasm"}]},{"type":"coin_spent","attributes":[{"key":"spender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"amount","value":"31000000000000000inj"}]},{"type":"coin_received","attributes":[{"key":"receiver","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"},{"key":"amount","value":"31000000000000000inj"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"},{"key":"sender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"amount","value":"31000000000000000inj"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"}]},{"type":"wasm-hpl_warp_native::transfer-remote","attributes":[{"key":"_contract_address","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"},{"key":"sender","value":"inj16paaazy6t2ac02q5t8en099csy7pkyh3hw35up"},{"key":"recipient","value":"0000000000000000000000009a2d8681ffcc45b0c18e72b16fba9b2270b911ed"},{"key":"token","value":"inj"},{"key":"amount","value":"1000000000000000"}]},{"type":"coin_spent","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"spender","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"}]},{"type":"coin_received","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"receiver","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"}]},{"type":"transfer","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"recipient","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"},{"key":"sender","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"}]},{"type":"wasm-mailbox_dispatch_id","attributes":[{"key":"_contract_address","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"},{"key":"message_id","value":"afc6cabcf735ac7b13fb4f1a045c4d675ecf8363cac76a21612411e644041af2"}]},{"type":"wasm-mailbox_dispatch","attributes":[{"key":"_contract_address","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"},{"key":"destination","value":"2525"},{"key":"message","value":"030000032e00696e6a000000000000000000000000db0ab932dd778c771c85636070d920ae90a66136000009dd00000000000000000000000026f32245fcf5ad53159e875d5cae62aecf19c2d40000000000000000000000009a2d8681ffcc45b0c18e72b16fba9b2270b911ed00000000000000000000000000000000000000000000000000038d7ea4c68000"},{"key":"recipient","value":"00000000000000000000000026f32245fcf5ad53159e875d5cae62aecf19c2d4"},{"key":"sender","value":"000000000000000000000000db0ab932dd778c771c85636070d920ae90a66136"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"inj1269dxcuyglc8mmecf95lf63elt3cq2tz57ka6h"}]},{"type":"wasm-hpl_hook_merkle::post_dispatch","attributes":[{"key":"_contract_address","value":"inj1269dxcuyglc8mmecf95lf63elt3cq2tz57ka6h"},{"key":"index","value":"814"},{"key":"message_id","value":"afc6cabcf735ac7b13fb4f1a045c4d675ecf8363cac76a21612411e644041af2"}]},{"type":"wasm-hpl_hook_merkle::inserted_into_tree","attributes":[{"key":"_contract_address","value":"inj1269dxcuyglc8mmecf95lf63elt3cq2tz57ka6h"},{"key":"index","value":"814"}]},{"type":"coin_spent","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"spender","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"}]},{"type":"coin_received","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"receiver","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"}]},{"type":"transfer","attributes":[{"key":"amount","value":"30000000000000000inj"},{"key":"recipient","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"},{"key":"sender","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"}]},{"type":"execute","attributes":[{"key":"_contract_address","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"}]},{"type":"wasm-igp-core-pay-for-gas","attributes":[{"key":"_contract_address","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"},{"key":"dest_domain","value":"2525"},{"key":"gas_amount","value":"250000"},{"key":"gas_refunded","value":"29999999999997500"},{"key":"gas_required","value":"2500"},{"key":"message_id","value":"afc6cabcf735ac7b13fb4f1a045c4d675ecf8363cac76a21612411e644041af2"},{"key":"payment","value":"30000000000000000"},{"key":"sender","value":"inj1palm2wtp6urg0c6j4f2ukv5u5ahdcrqek0sapt"}]},{"type":"wasm-igp-core-post-dispatch","attributes":[{"key":"_contract_address","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"},{"key":"message","value":"030000032e00696e6a000000000000000000000000db0ab932dd778c771c85636070d920ae90a66136000009dd00000000000000000000000026f32245fcf5ad53159e875d5cae62aecf19c2d40000000000000000000000009a2d8681ffcc45b0c18e72b16fba9b2270b911ed00000000000000000000000000000000000000000000000000038d7ea4c68000"},{"key":"metadata","value":"0x"}]},{"type":"coin_spent","attributes":[{"key":"amount","value":"29999999999997500inj"},{"key":"spender","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"}]},{"type":"coin_received","attributes":[{"key":"amount","value":"29999999999997500inj"},{"key":"receiver","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"}]},{"type":"transfer","attributes":[{"key":"amount","value":"29999999999997500inj"},{"key":"recipient","value":"inj1mv9tjvkaw7x8w8y9vds8pkfq46g2vcfkjehc6k"},{"key":"sender","value":"inj1y7h9y2vwtdfmxjm6ur9x8czcghp3u86e2wtcxr"}]}],"gasWanted":948228,"gasUsed":695543}`, diff --git a/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.ts b/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.ts index d7187d28a..c9ebdb2d1 100644 --- a/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.ts +++ b/typescript/sdk/src/core/adapters/CosmWasmCoreAdapter.ts @@ -2,7 +2,7 @@ import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; import { Address, HexString, assert, ensure0x } from '@hyperlane-xyz/utils'; -import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; +import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp.js'; import { Coin, DefaultHookResponse, @@ -14,15 +14,15 @@ import { OwnerResponse, QueryMsg, RequiredHookResponse, -} from '../../cw-types/Mailbox.types'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; +} from '../../cw-types/Mailbox.types.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; import { ProviderType, TypedTransactionReceipt, -} from '../../providers/ProviderType'; -import { ChainName } from '../../types'; +} from '../../providers/ProviderType.js'; +import { ChainName } from '../../types.js'; -import { ICoreAdapter } from './types'; +import { ICoreAdapter } from './types.js'; const MESSAGE_DISPATCH_EVENT_TYPE = 'wasm-mailbox_dispatch'; const MESSAGE_DISPATCH_ID_EVENT_TYPE = 'wasm-mailbox_dispatch_id'; diff --git a/typescript/sdk/src/core/adapters/CosmWasmIgpAdapter.ts b/typescript/sdk/src/core/adapters/CosmWasmIgpAdapter.ts index 1925e62aa..f4ebe0b70 100644 --- a/typescript/sdk/src/core/adapters/CosmWasmIgpAdapter.ts +++ b/typescript/sdk/src/core/adapters/CosmWasmIgpAdapter.ts @@ -2,7 +2,7 @@ import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; import { Address } from '@hyperlane-xyz/utils'; -import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; +import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp.js'; import { BeneficiaryResponse, DefaultGasResponse, @@ -13,9 +13,9 @@ import { QuoteGasPaymentResponse, RouteResponseForAddr, RoutesResponseForAddr, -} from '../../cw-types/Igp.types'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainMap, ChainName } from '../../types'; +} from '../../cw-types/Igp.types.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainMap, ChainName } from '../../types.js'; // TODO: import more type IgpResponse = diff --git a/typescript/sdk/src/core/adapters/EvmCoreAdapter.ts b/typescript/sdk/src/core/adapters/EvmCoreAdapter.ts index a89da035b..1389b504a 100644 --- a/typescript/sdk/src/core/adapters/EvmCoreAdapter.ts +++ b/typescript/sdk/src/core/adapters/EvmCoreAdapter.ts @@ -1,18 +1,18 @@ import { Mailbox__factory } from '@hyperlane-xyz/core'; import { Address, HexString } from '@hyperlane-xyz/utils'; -import { BaseEvmAdapter } from '../../app/MultiProtocolApp'; -import { HyperlaneContractsMap } from '../../contracts/types'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; +import { BaseEvmAdapter } from '../../app/MultiProtocolApp.js'; +import { HyperlaneContractsMap } from '../../contracts/types.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; import { ProviderType, TypedTransactionReceipt, -} from '../../providers/ProviderType'; -import { ChainName } from '../../types'; -import { HyperlaneCore } from '../HyperlaneCore'; -import { CoreFactories } from '../contracts'; +} from '../../providers/ProviderType.js'; +import { ChainName } from '../../types.js'; +import { HyperlaneCore } from '../HyperlaneCore.js'; +import { CoreFactories } from '../contracts.js'; -import { ICoreAdapter } from './types'; +import { ICoreAdapter } from './types.js'; // This adapter just routes to the HyperlaneCore // Which implements the needed functionality for EVM chains diff --git a/typescript/sdk/src/core/adapters/SealevelCoreAdapter.test.ts b/typescript/sdk/src/core/adapters/SealevelCoreAdapter.test.ts index 06e95986f..6f2e60125 100644 --- a/typescript/sdk/src/core/adapters/SealevelCoreAdapter.test.ts +++ b/typescript/sdk/src/core/adapters/SealevelCoreAdapter.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { SealevelCoreAdapter } from './SealevelCoreAdapter'; +import { SealevelCoreAdapter } from './SealevelCoreAdapter.js'; describe('SealevelCoreAdapter', () => { describe('parses dispatch messages', () => { diff --git a/typescript/sdk/src/core/adapters/SealevelCoreAdapter.ts b/typescript/sdk/src/core/adapters/SealevelCoreAdapter.ts index 4c584c231..567c1b526 100644 --- a/typescript/sdk/src/core/adapters/SealevelCoreAdapter.ts +++ b/typescript/sdk/src/core/adapters/SealevelCoreAdapter.ts @@ -8,15 +8,15 @@ import { strip0x, } from '@hyperlane-xyz/utils'; -import { BaseSealevelAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; +import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; import { ProviderType, TypedTransactionReceipt, -} from '../../providers/ProviderType'; -import { ChainName } from '../../types'; +} from '../../providers/ProviderType.js'; +import { ChainName } from '../../types.js'; -import { ICoreAdapter } from './types'; +import { ICoreAdapter } from './types.js'; // https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/rust/sealevel/programs/mailbox/src/processor.rs const MESSAGE_DISPATCH_LOG_REGEX = /Dispatched message to (.*), ID (.*)/; diff --git a/typescript/sdk/src/core/adapters/types.ts b/typescript/sdk/src/core/adapters/types.ts index 7d2268922..f18cbdff2 100644 --- a/typescript/sdk/src/core/adapters/types.ts +++ b/typescript/sdk/src/core/adapters/types.ts @@ -1,8 +1,8 @@ import type { HexString } from '@hyperlane-xyz/utils'; -import type { BaseAppAdapter } from '../../app/MultiProtocolApp'; -import type { TypedTransactionReceipt } from '../../providers/ProviderType'; -import type { ChainName } from '../../types'; +import type { BaseAppAdapter } from '../../app/MultiProtocolApp.js'; +import type { TypedTransactionReceipt } from '../../providers/ProviderType.js'; +import type { ChainName } from '../../types.js'; export interface ICoreAdapter extends BaseAppAdapter { extractMessageIds( diff --git a/typescript/sdk/src/core/contracts.ts b/typescript/sdk/src/core/contracts.ts index bd9ce9eb9..cfe0b41fc 100644 --- a/typescript/sdk/src/core/contracts.ts +++ b/typescript/sdk/src/core/contracts.ts @@ -4,7 +4,7 @@ import { ValidatorAnnounce__factory, } from '@hyperlane-xyz/core'; -import { HyperlaneAddresses } from '../contracts/types'; +import { HyperlaneAddresses } from '../contracts/types.js'; export const coreFactories = { validatorAnnounce: new ValidatorAnnounce__factory(), diff --git a/typescript/sdk/src/core/events.ts b/typescript/sdk/src/core/events.ts index 76157fd58..90b9de1b4 100644 --- a/typescript/sdk/src/core/events.ts +++ b/typescript/sdk/src/core/events.ts @@ -1,7 +1,4 @@ -import type { - DispatchEvent, - ProcessEvent, -} from '@hyperlane-xyz/core/dist/contracts/Mailbox'; +import type { DispatchEvent, ProcessEvent } from '@hyperlane-xyz/core/mailbox'; export { DispatchEvent, ProcessEvent }; diff --git a/typescript/sdk/src/core/testHyperlaneDeploy.hardhat-test.ts b/typescript/sdk/src/core/testHyperlaneDeploy.hardhat-test.ts index 358764d6c..274969fce 100644 --- a/typescript/sdk/src/core/testHyperlaneDeploy.hardhat-test.ts +++ b/typescript/sdk/src/core/testHyperlaneDeploy.hardhat-test.ts @@ -2,18 +2,18 @@ import '@nomiclabs/hardhat-ethers'; import '@nomiclabs/hardhat-waffle'; import { expect } from 'chai'; import { ContractReceipt } from 'ethers'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { TestMailbox, TestRecipient__factory } from '@hyperlane-xyz/core'; import { addressToBytes32 } from '@hyperlane-xyz/utils'; -import { Chains } from '../consts/chains'; -import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../providers/MultiProvider'; +import { Chains } from '../consts/chains.js'; +import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; -import { TestCoreApp } from './TestCoreApp'; -import { TestCoreDeployer } from './TestCoreDeployer'; +import { TestCoreApp } from './TestCoreApp.js'; +import { TestCoreDeployer } from './TestCoreDeployer.js'; const localChain = Chains.test1; const remoteChain = Chains.test2; @@ -26,7 +26,7 @@ describe('TestCoreDeployer', async () => { dispatchReceipt: ContractReceipt; beforeEach(async () => { - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); const multiProvider = MultiProvider.createTestMultiProvider({ signer }); diff --git a/typescript/sdk/src/core/types.ts b/typescript/sdk/src/core/types.ts index f8bc7a1ae..fa86a50a6 100644 --- a/typescript/sdk/src/core/types.ts +++ b/typescript/sdk/src/core/types.ts @@ -1,13 +1,13 @@ import type { Mailbox } from '@hyperlane-xyz/core'; import type { Address, ParsedMessage } from '@hyperlane-xyz/utils'; -import type { UpgradeConfig } from '../deploy/proxy'; -import type { CheckerViolation, OwnableConfig } from '../deploy/types'; -import { HookConfig } from '../hook/types'; -import type { IsmConfig } from '../ism/types'; -import type { ChainName } from '../types'; +import type { UpgradeConfig } from '../deploy/proxy.js'; +import type { CheckerViolation, OwnableConfig } from '../deploy/types.js'; +import { HookConfig } from '../hook/types.js'; +import type { IsmConfig } from '../ism/types.js'; +import type { ChainName } from '../types.js'; -import { CoreFactories } from './contracts'; +import { CoreFactories } from './contracts.js'; export type CoreConfig = OwnableConfig & { defaultIsm: IsmConfig; diff --git a/typescript/sdk/src/deploy/HyperlaneAppChecker.ts b/typescript/sdk/src/deploy/HyperlaneAppChecker.ts index ac516819b..fdebf57ab 100644 --- a/typescript/sdk/src/deploy/HyperlaneAppChecker.ts +++ b/typescript/sdk/src/deploy/HyperlaneAppChecker.ts @@ -1,4 +1,4 @@ -import { keccak256 } from 'ethers/lib/utils'; +import { utils } from 'ethers'; import { Ownable, TimelockController__factory } from '@hyperlane-xyz/core'; import { @@ -10,13 +10,13 @@ import { promiseObjAll, } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../app/HyperlaneApp'; -import { BytecodeHash } from '../consts/bytecode'; -import { filterOwnableContracts } from '../contracts/contracts'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +import { HyperlaneApp } from '../app/HyperlaneApp.js'; +import { BytecodeHash } from '../consts/bytecode.js'; +import { filterOwnableContracts } from '../contracts/contracts.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; -import { UpgradeConfig, isProxy, proxyAdmin } from './proxy'; +import { UpgradeConfig, isProxy, proxyAdmin } from './proxy.js'; import { AccessControlViolation, BytecodeMismatchViolation, @@ -27,7 +27,7 @@ import { TimelockControllerViolation, ViolationType, resolveOrDeployAccountOwner, -} from './types'; +} from './types.js'; export abstract class HyperlaneAppChecker< App extends HyperlaneApp, @@ -175,7 +175,7 @@ export abstract class HyperlaneAppChecker< ): Promise { const provider = this.multiProvider.getProvider(chain); const bytecode = await provider.getCode(address); - const bytecodeHash = keccak256( + const bytecodeHash = utils.keccak256( modifyBytecodePriorToHash(this.removeBytecodeMetadata(bytecode)), ); if (!expectedBytecodeHashes.includes(bytecodeHash)) { diff --git a/typescript/sdk/src/deploy/HyperlaneDeployer.ts b/typescript/sdk/src/deploy/HyperlaneDeployer.ts index 0b8cccffd..b08f26d17 100644 --- a/typescript/sdk/src/deploy/HyperlaneDeployer.ts +++ b/typescript/sdk/src/deploy/HyperlaneDeployer.ts @@ -13,7 +13,7 @@ import { TimelockController__factory, TransparentUpgradeableProxy__factory, } from '@hyperlane-xyz/core'; -import SdkBuildArtifact from '@hyperlane-xyz/core/buildArtifact.json'; +import SdkBuildArtifact from '@hyperlane-xyz/core/buildArtifact.json' assert { type: 'json' }; import { Address, ProtocolType, @@ -27,14 +27,14 @@ import { HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from '../contracts/types'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { IsmConfig } from '../ism/types'; -import { moduleMatchesConfig } from '../ism/utils'; -import { InterchainAccount } from '../middleware/account/InterchainAccount'; -import { MultiProvider } from '../providers/MultiProvider'; -import { MailboxClientConfig } from '../router/types'; -import { ChainMap, ChainName } from '../types'; +} from '../contracts/types.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { IsmConfig } from '../ism/types.js'; +import { moduleMatchesConfig } from '../ism/utils.js'; +import { InterchainAccount } from '../middleware/account/InterchainAccount.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { MailboxClientConfig } from '../router/types.js'; +import { ChainMap, ChainName } from '../types.js'; import { UpgradeConfig, @@ -42,14 +42,17 @@ import { proxyAdmin, proxyConstructorArgs, proxyImplementation, -} from './proxy'; -import { OwnableConfig, Owner } from './types'; -import { ContractVerifier } from './verify/ContractVerifier'; -import { ContractVerificationInput, ExplorerLicenseType } from './verify/types'; +} from './proxy.js'; +import { OwnableConfig, Owner } from './types.js'; +import { ContractVerifier } from './verify/ContractVerifier.js'; +import { + ContractVerificationInput, + ExplorerLicenseType, +} from './verify/types.js'; import { buildVerificationInput, getContractVerificationInput, -} from './verify/utils'; +} from './verify/utils.js'; export interface DeployerOptions { logger?: Logger; diff --git a/typescript/sdk/src/deploy/HyperlaneProxyFactoryDeployer.ts b/typescript/sdk/src/deploy/HyperlaneProxyFactoryDeployer.ts index a03e587fa..7766a345c 100644 --- a/typescript/sdk/src/deploy/HyperlaneProxyFactoryDeployer.ts +++ b/typescript/sdk/src/deploy/HyperlaneProxyFactoryDeployer.ts @@ -1,16 +1,16 @@ import { rootLogger } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts } from '../contracts/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainName } from '../types'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainName } from '../types.js'; -import { HyperlaneDeployer } from './HyperlaneDeployer'; +import { HyperlaneDeployer } from './HyperlaneDeployer.js'; import { ProxyFactoryFactories, proxyFactoryFactories, proxyFactoryImplementations, -} from './contracts'; -import { ContractVerifier } from './verify/ContractVerifier'; +} from './contracts.js'; +import { ContractVerifier } from './verify/ContractVerifier.js'; export class HyperlaneProxyFactoryDeployer extends HyperlaneDeployer< {}, diff --git a/typescript/sdk/src/deploy/types.ts b/typescript/sdk/src/deploy/types.ts index ee788ded5..8afeb0c19 100644 --- a/typescript/sdk/src/deploy/types.ts +++ b/typescript/sdk/src/deploy/types.ts @@ -7,10 +7,10 @@ import type { } from '@hyperlane-xyz/core'; import { Address } from '@hyperlane-xyz/utils'; -import { deployInterchainAccount } from '../middleware/account/InterchainAccount'; -import { AccountConfig } from '../middleware/account/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import type { ChainName } from '../types'; +import { deployInterchainAccount } from '../middleware/account/InterchainAccount.js'; +import { AccountConfig } from '../middleware/account/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import type { ChainName } from '../types.js'; export type Owner = Address | AccountConfig; diff --git a/typescript/sdk/src/deploy/verify/ContractVerifier.ts b/typescript/sdk/src/deploy/verify/ContractVerifier.ts index 4b567b773..f6baa1c16 100644 --- a/typescript/sdk/src/deploy/verify/ContractVerifier.ts +++ b/typescript/sdk/src/deploy/verify/ContractVerifier.ts @@ -4,9 +4,9 @@ import { Logger } from 'pino'; import { rootLogger, sleep, strip0x } from '@hyperlane-xyz/utils'; -import { ExplorerFamily } from '../../metadata/chainMetadataTypes'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ChainMap, ChainName } from '../../types'; +import { ExplorerFamily } from '../../metadata/chainMetadataTypes.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../../types.js'; import { BuildArtifact, @@ -16,7 +16,7 @@ import { ExplorerApiActions, ExplorerApiErrors, FormOptions, -} from './types'; +} from './types.js'; export class ContractVerifier { protected logger = rootLogger.child({ module: 'ContractVerifier' }); diff --git a/typescript/sdk/src/deploy/verify/PostDeploymentContractVerifier.ts b/typescript/sdk/src/deploy/verify/PostDeploymentContractVerifier.ts index 5440868d9..fc34f4684 100644 --- a/typescript/sdk/src/deploy/verify/PostDeploymentContractVerifier.ts +++ b/typescript/sdk/src/deploy/verify/PostDeploymentContractVerifier.ts @@ -1,12 +1,12 @@ import { rootLogger } from '@hyperlane-xyz/utils'; -import { ExplorerFamily } from '../../metadata/chainMetadataTypes'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ChainMap } from '../../types'; -import { MultiGeneric } from '../../utils/MultiGeneric'; +import { ExplorerFamily } from '../../metadata/chainMetadataTypes.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ChainMap } from '../../types.js'; +import { MultiGeneric } from '../../utils/MultiGeneric.js'; -import { ContractVerifier } from './ContractVerifier'; -import { BuildArtifact, CompilerOptions, VerificationInput } from './types'; +import { ContractVerifier } from './ContractVerifier.js'; +import { BuildArtifact, CompilerOptions, VerificationInput } from './types.js'; export class PostDeploymentContractVerifier extends MultiGeneric { protected logger = rootLogger.child({ diff --git a/typescript/sdk/src/deploy/verify/utils.ts b/typescript/sdk/src/deploy/verify/utils.ts index 40968dbc9..37b9d7089 100644 --- a/typescript/sdk/src/deploy/verify/utils.ts +++ b/typescript/sdk/src/deploy/verify/utils.ts @@ -1,6 +1,6 @@ import { ethers, utils } from 'ethers'; -import { ContractVerificationInput } from './types'; +import { ContractVerificationInput } from './types.js'; export function formatFunctionArguments( fragment: utils.Fragment, diff --git a/typescript/sdk/src/gas/HyperlaneIgp.ts b/typescript/sdk/src/gas/HyperlaneIgp.ts index 344035e17..3fe71b2ae 100644 --- a/typescript/sdk/src/gas/HyperlaneIgp.ts +++ b/typescript/sdk/src/gas/HyperlaneIgp.ts @@ -3,17 +3,17 @@ import { BigNumber } from 'ethers'; import { InterchainGasPaymaster__factory } from '@hyperlane-xyz/core'; import { Address } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../app/HyperlaneApp'; +import { HyperlaneApp } from '../app/HyperlaneApp.js'; import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../consts/environments'; -import { appFromAddressesMapHelper } from '../contracts/contracts'; -import { HyperlaneAddressesMap } from '../contracts/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainName } from '../types'; +} from '../consts/environments/index.js'; +import { appFromAddressesMapHelper } from '../contracts/contracts.js'; +import { HyperlaneAddressesMap } from '../contracts/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainName } from '../types.js'; -import { IgpFactories, igpFactories } from './contracts'; +import { IgpFactories, igpFactories } from './contracts.js'; export class HyperlaneIgp extends HyperlaneApp { static fromEnvironment( diff --git a/typescript/sdk/src/gas/HyperlaneIgpChecker.ts b/typescript/sdk/src/gas/HyperlaneIgpChecker.ts index 77972cff1..c6ca5dae0 100644 --- a/typescript/sdk/src/gas/HyperlaneIgpChecker.ts +++ b/typescript/sdk/src/gas/HyperlaneIgpChecker.ts @@ -2,20 +2,20 @@ import { BigNumber } from 'ethers'; import { eqAddress } from '@hyperlane-xyz/utils'; -import { BytecodeHash } from '../consts/bytecode'; -import { chainMetadata } from '../consts/chainMetadata'; -import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker'; -import { proxyImplementation } from '../deploy/proxy'; -import { ChainName } from '../types'; +import { BytecodeHash } from '../consts/bytecode.js'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker.js'; +import { proxyImplementation } from '../deploy/proxy.js'; +import { ChainName } from '../types.js'; -import { HyperlaneIgp } from './HyperlaneIgp'; +import { HyperlaneIgp } from './HyperlaneIgp.js'; import { IgpBeneficiaryViolation, IgpConfig, IgpGasOraclesViolation, IgpOverheadViolation, IgpViolationType, -} from './types'; +} from './types.js'; export class HyperlaneIgpChecker extends HyperlaneAppChecker< HyperlaneIgp, diff --git a/typescript/sdk/src/gas/HyperlaneIgpDeployer.ts b/typescript/sdk/src/gas/HyperlaneIgpDeployer.ts index f774c7456..a66001905 100644 --- a/typescript/sdk/src/gas/HyperlaneIgpDeployer.ts +++ b/typescript/sdk/src/gas/HyperlaneIgpDeployer.ts @@ -5,16 +5,16 @@ import { } from '@hyperlane-xyz/core'; import { eqAddress, rootLogger } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { HyperlaneContracts } from '../contracts/types'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; -import { ContractVerifier } from '../deploy/verify/ContractVerifier'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainName } from '../types'; - -import { IgpFactories, igpFactories } from './contracts'; -import { serializeDifference } from './oracle/types'; -import { IgpConfig } from './types'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; +import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainName } from '../types.js'; + +import { IgpFactories, igpFactories } from './contracts.js'; +import { serializeDifference } from './oracle/types.js'; +import { IgpConfig } from './types.js'; export class HyperlaneIgpDeployer extends HyperlaneDeployer< IgpConfig, diff --git a/typescript/sdk/src/gas/adapters/SealevelIgpAdapter.ts b/typescript/sdk/src/gas/adapters/SealevelIgpAdapter.ts index 95f4df4b3..f3bbb1b4b 100644 --- a/typescript/sdk/src/gas/adapters/SealevelIgpAdapter.ts +++ b/typescript/sdk/src/gas/adapters/SealevelIgpAdapter.ts @@ -3,15 +3,15 @@ import { deserializeUnchecked } from 'borsh'; import { Address } from '@hyperlane-xyz/utils'; -import { BaseSealevelAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; -import { SealevelAccountDataWrapper } from '../../utils/sealevelSerialization'; +import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; +import { SealevelAccountDataWrapper } from '../../utils/sealevelSerialization.js'; import { SealevelOverheadIgpData, SealevelOverheadIgpDataSchema, -} from './serialization'; +} from './serialization.js'; export class SealevelOverheadIgpAdapter extends BaseSealevelAdapter { constructor( diff --git a/typescript/sdk/src/gas/adapters/serialization.ts b/typescript/sdk/src/gas/adapters/serialization.ts index 6d4fbb3b2..70cd80825 100644 --- a/typescript/sdk/src/gas/adapters/serialization.ts +++ b/typescript/sdk/src/gas/adapters/serialization.ts @@ -6,7 +6,7 @@ import { Domain } from '@hyperlane-xyz/utils'; import { SealevelAccountDataWrapper, getSealevelAccountDataSchema, -} from '../../utils/sealevelSerialization'; +} from '../../utils/sealevelSerialization.js'; // Should match https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/rust/sealevel/programs/hyperlane-sealevel-igp/src/accounts.rs#L24 export enum SealevelInterchainGasPaymasterType { diff --git a/typescript/sdk/src/gas/oracle/configure-gas-oracles.hardhat-test.ts b/typescript/sdk/src/gas/oracle/configure-gas-oracles.hardhat-test.ts index 3cf0dcc1e..205398af6 100644 --- a/typescript/sdk/src/gas/oracle/configure-gas-oracles.hardhat-test.ts +++ b/typescript/sdk/src/gas/oracle/configure-gas-oracles.hardhat-test.ts @@ -1,13 +1,14 @@ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import { utils } from 'ethers'; +import hre from 'hardhat'; import { InterchainGasPaymaster } from '@hyperlane-xyz/core'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { testIgpConfig } from '../../test/testUtils'; -import { ChainMap } from '../../types'; -import { HyperlaneIgpDeployer } from '../HyperlaneIgpDeployer'; -import { IgpConfig } from '../types'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { testIgpConfig } from '../../test/testUtils.js'; +import { ChainMap } from '../../types.js'; +import { HyperlaneIgpDeployer } from '../HyperlaneIgpDeployer.js'; +import { IgpConfig } from '../types.js'; describe('HyperlaneIgpDeployer', () => { const local = 'test1'; @@ -19,7 +20,7 @@ describe('HyperlaneIgpDeployer', () => { let testConfig: ChainMap; before(async () => { - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); remoteId = multiProvider.getDomainId(remote); deployer = new HyperlaneIgpDeployer(multiProvider); @@ -39,8 +40,8 @@ describe('HyperlaneIgpDeployer', () => { it('should configure new oracle config', async () => { testConfig[local].oracleConfig![remote] = { - tokenExchangeRate: ethers.utils.parseUnits('2', 'gwei'), - gasPrice: ethers.utils.parseUnits('3', 'gwei'), + tokenExchangeRate: utils.parseUnits('2', 'gwei'), + gasPrice: utils.parseUnits('3', 'gwei'), }; const localContracts = await deployer.deployContracts( diff --git a/typescript/sdk/src/gas/oracle/types.ts b/typescript/sdk/src/gas/oracle/types.ts index 238ba019b..1baa4a18a 100644 --- a/typescript/sdk/src/gas/oracle/types.ts +++ b/typescript/sdk/src/gas/oracle/types.ts @@ -2,7 +2,7 @@ import { ethers } from 'ethers'; import { StorageGasOracle } from '@hyperlane-xyz/core'; -import { TOKEN_EXCHANGE_RATE_EXPONENT } from '../../consts/igp'; +import { TOKEN_EXCHANGE_RATE_EXPONENT } from '../../consts/igp.js'; export enum GasOracleContractType { StorageGasOracle = 'StorageGasOracle', diff --git a/typescript/sdk/src/gas/token-prices.test.ts b/typescript/sdk/src/gas/token-prices.test.ts index 0751a6d2e..c92a065d5 100644 --- a/typescript/sdk/src/gas/token-prices.test.ts +++ b/typescript/sdk/src/gas/token-prices.test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; -import { Chains } from '../consts/chains'; -import { MockCoinGecko } from '../test/testUtils'; +import { Chains } from '../consts/chains.js'; +import { MockCoinGecko } from '../test/testUtils.js'; -import { CoinGeckoTokenPriceGetter } from './token-prices'; +import { CoinGeckoTokenPriceGetter } from './token-prices.js'; describe('TokenPriceGetter', () => { let tokenPriceGetter: CoinGeckoTokenPriceGetter; diff --git a/typescript/sdk/src/gas/token-prices.ts b/typescript/sdk/src/gas/token-prices.ts index 71b5ec70f..700c22536 100644 --- a/typescript/sdk/src/gas/token-prices.ts +++ b/typescript/sdk/src/gas/token-prices.ts @@ -2,10 +2,10 @@ import CoinGecko from 'coingecko-api'; import { rootLogger, sleep } from '@hyperlane-xyz/utils'; -import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata'; -import { CoreChainName, Mainnets } from '../consts/chains'; -import { ChainMetadata } from '../metadata/chainMetadataTypes'; -import { ChainMap, ChainName } from '../types'; +import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata.js'; +import { CoreChainName, Mainnets } from '../consts/chains.js'; +import { ChainMetadata } from '../metadata/chainMetadataTypes.js'; +import { ChainMap, ChainName } from '../types.js'; export interface TokenPriceGetter { getTokenPrice(chain: ChainName): Promise; diff --git a/typescript/sdk/src/gas/types.ts b/typescript/sdk/src/gas/types.ts index 38c6c4970..dacebc2f7 100644 --- a/typescript/sdk/src/gas/types.ts +++ b/typescript/sdk/src/gas/types.ts @@ -3,11 +3,14 @@ import { BigNumber } from 'ethers'; import { InterchainGasPaymaster } from '@hyperlane-xyz/core'; import type { Address } from '@hyperlane-xyz/utils'; -import type { CheckerViolation, OwnableConfig } from '../deploy/types'; -import { ChainMap } from '../types'; - -import { IgpFactories } from './contracts'; -import { GasOracleContractType, StorageGasOracleConfig } from './oracle/types'; +import type { CheckerViolation, OwnableConfig } from '../deploy/types.js'; +import { ChainMap } from '../types.js'; + +import { IgpFactories } from './contracts.js'; +import { + GasOracleContractType, + StorageGasOracleConfig, +} from './oracle/types.js'; export type IgpConfig = OwnableConfig & { beneficiary: Address; diff --git a/typescript/sdk/src/hook/HyperlaneHookDeployer.ts b/typescript/sdk/src/hook/HyperlaneHookDeployer.ts index 84ec5ee7d..c7ead69aa 100644 --- a/typescript/sdk/src/hook/HyperlaneHookDeployer.ts +++ b/typescript/sdk/src/hook/HyperlaneHookDeployer.ts @@ -11,19 +11,19 @@ import { } from '@hyperlane-xyz/core'; import { Address, addressToBytes32, rootLogger } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { HyperlaneContracts } from '../contracts/types'; -import { CoreAddresses } from '../core/contracts'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; -import { ContractVerifier } from '../deploy/verify/ContractVerifier'; -import { HyperlaneIgpDeployer } from '../gas/HyperlaneIgpDeployer'; -import { IgpFactories } from '../gas/contracts'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { IsmType, OpStackIsmConfig } from '../ism/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { CoreAddresses } from '../core/contracts.js'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; +import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { HyperlaneIgpDeployer } from '../gas/HyperlaneIgpDeployer.js'; +import { IgpFactories } from '../gas/contracts.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { IsmType, OpStackIsmConfig } from '../ism/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; -import { DeployedHook, HookFactories, hookFactories } from './contracts'; +import { DeployedHook, HookFactories, hookFactories } from './contracts.js'; import { AggregationHookConfig, DomainRoutingHookConfig, @@ -33,7 +33,7 @@ import { IgpHookConfig, OpStackHookConfig, ProtocolFeeHookConfig, -} from './types'; +} from './types.js'; export class HyperlaneHookDeployer extends HyperlaneDeployer< HookConfig, diff --git a/typescript/sdk/src/hook/contracts.ts b/typescript/sdk/src/hook/contracts.ts index d7fa4995a..23d863fa7 100644 --- a/typescript/sdk/src/hook/contracts.ts +++ b/typescript/sdk/src/hook/contracts.ts @@ -10,7 +10,7 @@ import { } from '@hyperlane-xyz/core'; import { ValueOf } from '@hyperlane-xyz/utils'; -import { HookType } from './types'; +import { HookType } from './types.js'; export const hookFactories = { [HookType.MERKLE_TREE]: new MerkleTreeHook__factory(), diff --git a/typescript/sdk/src/hook/types.ts b/typescript/sdk/src/hook/types.ts index 01f44cbd0..e35047c24 100644 --- a/typescript/sdk/src/hook/types.ts +++ b/typescript/sdk/src/hook/types.ts @@ -1,8 +1,8 @@ import { Address } from '@hyperlane-xyz/utils'; -import { OwnableConfig } from '../deploy/types'; -import { IgpConfig } from '../gas/types'; -import { ChainMap, ChainName } from '../types'; +import { OwnableConfig } from '../deploy/types.js'; +import { IgpConfig } from '../gas/types.js'; +import { ChainMap, ChainName } from '../types.js'; export enum HookType { MERKLE_TREE = 'merkleTreeHook', diff --git a/typescript/sdk/src/index.ts b/typescript/sdk/src/index.ts index 0939d15e0..a609c474c 100644 --- a/typescript/sdk/src/index.ts +++ b/typescript/sdk/src/index.ts @@ -1,18 +1,18 @@ -export { HyperlaneApp } from './app/HyperlaneApp'; +export { HyperlaneApp } from './app/HyperlaneApp.js'; export { AdapterClassType, BaseAppAdapter, BaseEvmAdapter, BaseSealevelAdapter, MultiProtocolApp, -} from './app/MultiProtocolApp'; +} from './app/MultiProtocolApp.js'; export { chainIdToMetadata, chainMetadata, mainnetChainsMetadata, solanaChainToClusterName, testnetChainsMetadata, -} from './consts/chainMetadata'; +} from './consts/chainMetadata.js'; export { AllChains, AllDeprecatedChains, @@ -22,16 +22,16 @@ export { Mainnets, TestChains, Testnets, -} from './consts/chains'; +} from './consts/chains.js'; export { HyperlaneEnvironment, HyperlaneEnvironmentChain, hyperlaneContractAddresses, hyperlaneEnvironments, -} from './consts/environments'; -export { MAILBOX_VERSION } from './consts/mailbox'; -export { defaultMultisigConfigs } from './consts/multisigIsm'; -export { SEALEVEL_SPL_NOOP_ADDRESS } from './consts/sealevel'; +} from './consts/environments/index.js'; +export { MAILBOX_VERSION } from './consts/mailbox.js'; +export { defaultMultisigConfigs } from './consts/multisigIsm.js'; +export { SEALEVEL_SPL_NOOP_ADDRESS } from './consts/sealevel.js'; export { attachContracts, attachContractsMap, @@ -44,7 +44,7 @@ export { filterOwnableContracts, serializeContracts, serializeContractsMap, -} from './contracts/contracts'; +} from './contracts/contracts.js'; export { AddressesMap, HyperlaneAddresses, @@ -52,23 +52,27 @@ export { HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from './contracts/types'; -export { CosmWasmCoreAdapter } from './core/adapters/CosmWasmCoreAdapter'; -export { EvmCoreAdapter } from './core/adapters/EvmCoreAdapter'; -export { SealevelCoreAdapter } from './core/adapters/SealevelCoreAdapter'; -export { ICoreAdapter } from './core/adapters/types'; -export { CoreAddresses, CoreFactories, coreFactories } from './core/contracts'; -export { HyperlaneLifecyleEvent } from './core/events'; -export { HyperlaneCore } from './core/HyperlaneCore'; -export { HyperlaneCoreChecker } from './core/HyperlaneCoreChecker'; -export { HyperlaneCoreDeployer } from './core/HyperlaneCoreDeployer'; -export { MultiProtocolCore } from './core/MultiProtocolCore'; -export { TestCoreApp } from './core/TestCoreApp'; -export { TestCoreDeployer } from './core/TestCoreDeployer'; +} from './contracts/types.js'; +export { HyperlaneCore } from './core/HyperlaneCore.js'; +export { HyperlaneCoreChecker } from './core/HyperlaneCoreChecker.js'; +export { HyperlaneCoreDeployer } from './core/HyperlaneCoreDeployer.js'; +export { MultiProtocolCore } from './core/MultiProtocolCore.js'; +export { TestCoreApp } from './core/TestCoreApp.js'; +export { TestCoreDeployer } from './core/TestCoreDeployer.js'; export { TestRecipientConfig, TestRecipientDeployer, -} from './core/TestRecipientDeployer'; +} from './core/TestRecipientDeployer.js'; +export { CosmWasmCoreAdapter } from './core/adapters/CosmWasmCoreAdapter.js'; +export { EvmCoreAdapter } from './core/adapters/EvmCoreAdapter.js'; +export { SealevelCoreAdapter } from './core/adapters/SealevelCoreAdapter.js'; +export { ICoreAdapter } from './core/adapters/types.js'; +export { + CoreAddresses, + CoreFactories, + coreFactories, +} from './core/contracts.js'; +export { HyperlaneLifecyleEvent } from './core/events.js'; export { CoreConfig, CoreViolationType, @@ -77,44 +81,47 @@ export { MailboxViolation, MailboxViolationType, ValidatorAnnounceViolation, -} from './core/types'; -export { HyperlaneAppChecker } from './deploy/HyperlaneAppChecker'; -export { DeployerOptions, HyperlaneDeployer } from './deploy/HyperlaneDeployer'; -export { HyperlaneProxyFactoryDeployer } from './deploy/HyperlaneProxyFactoryDeployer'; +} from './core/types.js'; +export { HyperlaneAppChecker } from './deploy/HyperlaneAppChecker.js'; +export { + DeployerOptions, + HyperlaneDeployer, +} from './deploy/HyperlaneDeployer.js'; +export { HyperlaneProxyFactoryDeployer } from './deploy/HyperlaneProxyFactoryDeployer.js'; export { CheckerViolation, OwnableConfig, OwnerViolation, ViolationType, resolveOrDeployAccountOwner, -} from './deploy/types'; -export { ContractVerifier } from './deploy/verify/ContractVerifier'; -export { PostDeploymentContractVerifier } from './deploy/verify/PostDeploymentContractVerifier'; +} from './deploy/types.js'; +export { ContractVerifier } from './deploy/verify/ContractVerifier.js'; +export { PostDeploymentContractVerifier } from './deploy/verify/PostDeploymentContractVerifier.js'; export { BuildArtifact, CompilerOptions, ContractVerificationInput, ExplorerLicenseType, VerificationInput, -} from './deploy/verify/types'; -export * as verificationUtils from './deploy/verify/utils'; -export { SealevelOverheadIgpAdapter } from './gas/adapters/SealevelIgpAdapter'; +} from './deploy/verify/types.js'; +export * as verificationUtils from './deploy/verify/utils.js'; +export { HyperlaneIgp } from './gas/HyperlaneIgp.js'; +export { HyperlaneIgpChecker } from './gas/HyperlaneIgpChecker.js'; +export { HyperlaneIgpDeployer } from './gas/HyperlaneIgpDeployer.js'; +export { SealevelOverheadIgpAdapter } from './gas/adapters/SealevelIgpAdapter.js'; export { SealevelInterchainGasPaymasterConfig, SealevelInterchainGasPaymasterConfigSchema, SealevelInterchainGasPaymasterType, SealevelOverheadIgpData, SealevelOverheadIgpDataSchema, -} from './gas/adapters/serialization'; -export { IgpFactories, igpFactories } from './gas/contracts'; -export { HyperlaneIgp } from './gas/HyperlaneIgp'; -export { HyperlaneIgpChecker } from './gas/HyperlaneIgpChecker'; -export { HyperlaneIgpDeployer } from './gas/HyperlaneIgpDeployer'; +} from './gas/adapters/serialization.js'; +export { IgpFactories, igpFactories } from './gas/contracts.js'; export { GasOracleContractType, StorageGasOracleConfig, -} from './gas/oracle/types'; -export { CoinGeckoTokenPriceGetter } from './gas/token-prices'; +} from './gas/oracle/types.js'; +export { CoinGeckoTokenPriceGetter } from './gas/token-prices.js'; export { IgpBeneficiaryViolation, IgpConfig, @@ -122,8 +129,8 @@ export { IgpOverheadViolation, IgpViolation, IgpViolationType, -} from './gas/types'; -export { HyperlaneHookDeployer } from './hook/HyperlaneHookDeployer'; +} from './gas/types.js'; +export { HyperlaneHookDeployer } from './hook/HyperlaneHookDeployer.js'; export { AggregationHookConfig, DomainRoutingHookConfig, @@ -136,12 +143,12 @@ export { OpStackHookConfig, PausableHookConfig, ProtocolFeeHookConfig, -} from './hook/types'; -export { HyperlaneIsmFactory } from './ism/HyperlaneIsmFactory'; +} from './hook/types.js'; +export { HyperlaneIsmFactory } from './ism/HyperlaneIsmFactory.js'; export { buildAggregationIsmConfigs, buildMultisigIsmConfigs, -} from './ism/multisig'; +} from './ism/multisig.js'; export { AggregationIsmConfig, DeployedIsm, @@ -153,8 +160,12 @@ export { OpStackIsmConfig, PausableIsmConfig, RoutingIsmConfig, -} from './ism/types'; -export { collectValidators, moduleCanCertainlyVerify } from './ism/utils'; +} from './ism/types.js'; +export { collectValidators, moduleCanCertainlyVerify } from './ism/utils.js'; +export { + ChainMetadataManager, + ChainMetadataManagerOptions, +} from './metadata/ChainMetadataManager.js'; export { AgentChainMetadata, AgentChainMetadataSchema, @@ -174,11 +185,7 @@ export { ScraperConfig, ValidatorConfig, buildAgentConfig, -} from './metadata/agentConfig'; -export { - ChainMetadataManager, - ChainMetadataManagerOptions, -} from './metadata/ChainMetadataManager'; +} from './metadata/agentConfig.js'; export { BlockExplorer, ChainMetadata, @@ -193,27 +200,29 @@ export { getDomainId, getReorgPeriod, isValidChainMetadata, -} from './metadata/chainMetadataTypes'; -export { ZHash } from './metadata/customZodTypes'; +} from './metadata/chainMetadataTypes.js'; +export { ZHash } from './metadata/customZodTypes.js'; export { HyperlaneDeploymentArtifacts, HyperlaneDeploymentArtifactsSchema, -} from './metadata/deploymentArtifacts'; -export { MatchingList } from './metadata/matchingList'; +} from './metadata/deploymentArtifacts.js'; +export { MatchingList } from './metadata/matchingList.js'; export { WarpRouteConfig, WarpRouteConfigSchema, -} from './metadata/warpRouteConfig'; -export { interchainAccountFactories } from './middleware/account/contracts'; -export { InterchainAccount } from './middleware/account/InterchainAccount'; -export { InterchainAccountChecker } from './middleware/account/InterchainAccountChecker'; +} from './metadata/warpRouteConfig.js'; +export { InterchainAccount } from './middleware/account/InterchainAccount.js'; +export { InterchainAccountChecker } from './middleware/account/InterchainAccountChecker.js'; export { InterchainAccountConfig, InterchainAccountDeployer, -} from './middleware/account/InterchainAccountDeployer'; -export { AccountConfig } from './middleware/account/types'; -export { liquidityLayerFactories } from './middleware/liquidity-layer/contracts'; -export { LiquidityLayerApp } from './middleware/liquidity-layer/LiquidityLayerApp'; +} from './middleware/account/InterchainAccountDeployer.js'; +export { + InterchainAccountFactories, + interchainAccountFactories, +} from './middleware/account/contracts.js'; +export { AccountConfig } from './middleware/account/types.js'; +export { LiquidityLayerApp } from './middleware/liquidity-layer/LiquidityLayerApp.js'; export { BridgeAdapterConfig, BridgeAdapterType, @@ -221,31 +230,23 @@ export { LiquidityLayerConfig, LiquidityLayerDeployer, PortalAdapterConfig, -} from './middleware/liquidity-layer/LiquidityLayerRouterDeployer'; -export { interchainQueryFactories } from './middleware/query/contracts'; -export { InterchainQuery } from './middleware/query/InterchainQuery'; -export { InterchainQueryChecker } from './middleware/query/InterchainQueryChecker'; +} from './middleware/liquidity-layer/LiquidityLayerRouterDeployer.js'; +export { liquidityLayerFactories } from './middleware/liquidity-layer/contracts.js'; +export { InterchainQuery } from './middleware/query/InterchainQuery.js'; +export { InterchainQueryChecker } from './middleware/query/InterchainQueryChecker.js'; export { InterchainQueryConfig, InterchainQueryDeployer, -} from './middleware/query/InterchainQueryDeployer'; +} from './middleware/query/InterchainQueryDeployer.js'; +export { interchainQueryFactories } from './middleware/query/contracts.js'; export { MultiProtocolProvider, MultiProtocolProviderOptions, -} from './providers/MultiProtocolProvider'; -export { MultiProvider, MultiProviderOptions } from './providers/MultiProvider'; +} from './providers/MultiProtocolProvider.js'; export { - ProviderBuilderFn, - ProviderBuilderMap, - TypedProviderBuilderFn, - defaultEthersV5ProviderBuilder, - defaultFuelProviderBuilder, - defaultProviderBuilder, - defaultProviderBuilderMap, - defaultSolProviderBuilder, - defaultViemProviderBuilder, - protocolToDefaultProviderBuilder, -} from './providers/providerBuilders'; + MultiProvider, + MultiProviderOptions, +} from './providers/MultiProvider.js'; export { CosmJsContract, CosmJsProvider, @@ -273,16 +274,16 @@ export { ViemProvider, ViemTransaction, ViemTransactionReceipt, -} from './providers/ProviderType'; -export { HyperlaneEtherscanProvider } from './providers/SmartProvider/HyperlaneEtherscanProvider'; -export { HyperlaneJsonRpcProvider } from './providers/SmartProvider/HyperlaneJsonRpcProvider'; +} from './providers/ProviderType.js'; +export { HyperlaneEtherscanProvider } from './providers/SmartProvider/HyperlaneEtherscanProvider.js'; +export { HyperlaneJsonRpcProvider } from './providers/SmartProvider/HyperlaneJsonRpcProvider.js'; export { AllProviderMethods, IProviderMethods, ProviderMethod, excludeProviderMethods, -} from './providers/SmartProvider/ProviderMethods'; -export { HyperlaneSmartProvider } from './providers/SmartProvider/SmartProvider'; +} from './providers/SmartProvider/ProviderMethods.js'; +export { HyperlaneSmartProvider } from './providers/SmartProvider/SmartProvider.js'; export { ChainMetadataWithRpcConnectionInfo, ProviderErrorResult, @@ -292,24 +293,36 @@ export { ProviderSuccessResult, ProviderTimeoutResult, SmartProviderOptions, -} from './providers/SmartProvider/types'; +} from './providers/SmartProvider/types.js'; +export { + ProviderBuilderFn, + ProviderBuilderMap, + TypedProviderBuilderFn, + defaultEthersV5ProviderBuilder, + defaultFuelProviderBuilder, + defaultProviderBuilder, + defaultProviderBuilderMap, + defaultSolProviderBuilder, + defaultViemProviderBuilder, + protocolToDefaultProviderBuilder, +} from './providers/providerBuilders.js'; +export { GasRouterDeployer } from './router/GasRouterDeployer.js'; +export { HyperlaneRouterChecker } from './router/HyperlaneRouterChecker.js'; +export { HyperlaneRouterDeployer } from './router/HyperlaneRouterDeployer.js'; +export { + MultiProtocolGasRouterApp, + MultiProtocolRouterApp, +} from './router/MultiProtocolRouterApps.js'; +export { GasRouterApp, RouterApp } from './router/RouterApps.js'; export { EvmGasRouterAdapter, EvmRouterAdapter, -} from './router/adapters/EvmRouterAdapter'; +} from './router/adapters/EvmRouterAdapter.js'; export { SealevelGasRouterAdapter, SealevelRouterAdapter, -} from './router/adapters/SealevelRouterAdapter'; -export { IGasRouterAdapter, IRouterAdapter } from './router/adapters/types'; -export { GasRouterDeployer } from './router/GasRouterDeployer'; -export { HyperlaneRouterChecker } from './router/HyperlaneRouterChecker'; -export { HyperlaneRouterDeployer } from './router/HyperlaneRouterDeployer'; -export { - MultiProtocolGasRouterApp, - MultiProtocolRouterApp, -} from './router/MultiProtocolRouterApps'; -export { GasRouterApp, Router, RouterApp } from './router/RouterApps'; +} from './router/adapters/SealevelRouterAdapter.js'; +export { IGasRouterAdapter, IRouterAdapter } from './router/adapters/types.js'; export { MailboxClientConfig as ConnectionClientConfig, ClientViolation as ConnectionClientViolation, @@ -325,13 +338,31 @@ export { RouterViolation, RouterViolationType, proxiedFactories, -} from './router/types'; -export { randomAddress } from './test/testUtils'; +} from './router/types.js'; +export { IToken, TokenArgs, TokenConfigSchema } from './token/IToken.js'; +export { Token } from './token/Token.js'; +export { TokenAmount } from './token/TokenAmount.js'; export { - CosmIbcToWarpTokenAdapter, - CosmIbcTokenAdapter, - CosmNativeTokenAdapter, -} from './token/adapters/CosmosTokenAdapter'; + HyperlaneTokenConnection, + IbcToHyperlaneTokenConnection, + IbcTokenConnection, + TokenConnection, + TokenConnectionConfigSchema, + TokenConnectionType, + getTokenConnectionId, + parseTokenConnectionId, +} from './token/TokenConnection.js'; +export { + PROTOCOL_TO_NATIVE_STANDARD, + TOKEN_COLLATERALIZED_STANDARDS, + TOKEN_COSMWASM_STANDARDS, + TOKEN_HYP_STANDARDS, + TOKEN_MULTI_CHAIN_STANDARDS, + TOKEN_NFT_STANDARDS, + TOKEN_STANDARD_TO_PROTOCOL, + TOKEN_TYPE_TO_STANDARD, + TokenStandard, +} from './token/TokenStandard.js'; export { CW20Metadata, CwHypCollateralAdapter, @@ -339,37 +370,42 @@ export { CwHypSyntheticAdapter, CwNativeTokenAdapter, CwTokenAdapter, -} from './token/adapters/CosmWasmTokenAdapter'; +} from './token/adapters/CosmWasmTokenAdapter.js'; +export { + CosmIbcToWarpTokenAdapter, + CosmIbcTokenAdapter, + CosmNativeTokenAdapter, +} from './token/adapters/CosmosTokenAdapter.js'; export { EvmHypCollateralAdapter, EvmHypNativeAdapter, EvmHypSyntheticAdapter, EvmNativeTokenAdapter, EvmTokenAdapter, -} from './token/adapters/EvmTokenAdapter'; +} from './token/adapters/EvmTokenAdapter.js'; export { IHypTokenAdapter, ITokenAdapter, InterchainGasQuote, TransferParams, TransferRemoteParams, -} from './token/adapters/ITokenAdapter'; +} from './token/adapters/ITokenAdapter.js'; export { SealevelHypCollateralAdapter, SealevelHypNativeAdapter, SealevelHypSyntheticAdapter, SealevelNativeTokenAdapter, SealevelTokenAdapter, -} from './token/adapters/SealevelTokenAdapter'; +} from './token/adapters/SealevelTokenAdapter.js'; export { SealevelHypTokenInstruction, SealevelHyperlaneTokenData, SealevelHyperlaneTokenDataSchema, SealevelTransferRemoteInstruction, SealevelTransferRemoteSchema, -} from './token/adapters/serialization'; -export { HypERC20App } from './token/app'; -export { HypERC20Checker } from './token/checker'; +} from './token/adapters/serialization.js'; +export { HypERC20App } from './token/app.js'; +export { HypERC20Checker } from './token/checker.js'; export { CollateralConfig, ERC20Metadata, @@ -388,53 +424,33 @@ export { TokenType, isCollateralConfig, isUriConfig, -} from './token/config'; +} from './token/config.js'; export { HypERC20Factories, HypERC721Factories, TokenFactories, -} from './token/contracts'; -export { HypERC20Deployer, HypERC721Deployer } from './token/deploy'; -export { IToken, TokenArgs, TokenConfigSchema } from './token/IToken'; -export { Token } from './token/Token'; -export { TokenAmount } from './token/TokenAmount'; -export { - HyperlaneTokenConnection, - IbcToHyperlaneTokenConnection, - IbcTokenConnection, - TokenConnection, - TokenConnectionConfigSchema, - TokenConnectionType, - getTokenConnectionId, - parseTokenConnectionId, -} from './token/TokenConnection'; -export { - PROTOCOL_TO_NATIVE_STANDARD, - TOKEN_COLLATERALIZED_STANDARDS, - TOKEN_COSMWASM_STANDARDS, - TOKEN_HYP_STANDARDS, - TOKEN_MULTI_CHAIN_STANDARDS, - TOKEN_NFT_STANDARDS, - TOKEN_STANDARD_TO_PROTOCOL, - TOKEN_TYPE_TO_STANDARD, - TokenStandard, -} from './token/TokenStandard'; +} from './token/contracts.js'; +export { HypERC20Deployer, HypERC721Deployer } from './token/deploy.js'; export { ChainMap, ChainName, ChainNameOrId, Connection, TestChainNames, -} from './types'; -export { filterByChains } from './utils/filter'; -export { multisigIsmVerificationCost } from './utils/ism'; -export { MultiGeneric } from './utils/MultiGeneric'; +} from './types.js'; +export { MultiGeneric } from './utils/MultiGeneric.js'; +export { filterByChains } from './utils/filter.js'; +export { multisigIsmVerificationCost } from './utils/ism.js'; export { SealevelAccountDataWrapper, SealevelInstructionWrapper, getSealevelAccountDataSchema, -} from './utils/sealevelSerialization'; -export { chainMetadataToWagmiChain, wagmiChainMetadata } from './utils/wagmi'; +} from './utils/sealevelSerialization.js'; +export { + chainMetadataToWagmiChain, + wagmiChainMetadata, +} from './utils/wagmi.js'; +export { WarpCore, WarpCoreOptions } from './warp/WarpCore.js'; export { FeeConstantConfig, RouteBlacklist, @@ -442,5 +458,4 @@ export { WarpCoreConfigSchema, WarpTxCategory, WarpTypedTransaction, -} from './warp/types'; -export { WarpCore, WarpCoreOptions } from './warp/WarpCore'; +} from './warp/types.js'; diff --git a/typescript/sdk/src/ism/HyperlaneIsmFactory.hardhat-test.ts b/typescript/sdk/src/ism/HyperlaneIsmFactory.hardhat-test.ts index 6ee8085b6..939a82222 100644 --- a/typescript/sdk/src/ism/HyperlaneIsmFactory.hardhat-test.ts +++ b/typescript/sdk/src/ism/HyperlaneIsmFactory.hardhat-test.ts @@ -1,18 +1,18 @@ /* eslint-disable no-console */ import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { DomainRoutingIsm } from '@hyperlane-xyz/core'; import { Address } from '@hyperlane-xyz/utils'; -import { TestChains } from '../consts/chains'; -import { TestCoreApp } from '../core/TestCoreApp'; -import { TestCoreDeployer } from '../core/TestCoreDeployer'; -import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer'; -import { MultiProvider } from '../providers/MultiProvider'; -import { randomAddress, randomInt } from '../test/testUtils'; +import { TestChains } from '../consts/chains.js'; +import { TestCoreApp } from '../core/TestCoreApp.js'; +import { TestCoreDeployer } from '../core/TestCoreDeployer.js'; +import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { randomAddress, randomInt } from '../test/testUtils.js'; -import { HyperlaneIsmFactory } from './HyperlaneIsmFactory'; +import { HyperlaneIsmFactory } from './HyperlaneIsmFactory.js'; import { AggregationIsmConfig, IsmConfig, @@ -20,8 +20,8 @@ import { ModuleType, MultisigIsmConfig, RoutingIsmConfig, -} from './types'; -import { moduleMatchesConfig } from './utils'; +} from './types.js'; +import { moduleMatchesConfig } from './utils.js'; function randomModuleType(): ModuleType { const choices = [ @@ -83,7 +83,7 @@ describe('HyperlaneIsmFactory', async () => { const chain = 'test1'; beforeEach(async () => { - const [signer] = await ethers.getSigners(); + const [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/sdk/src/ism/HyperlaneIsmFactory.ts b/typescript/sdk/src/ism/HyperlaneIsmFactory.ts index e906703a3..536026d62 100644 --- a/typescript/sdk/src/ism/HyperlaneIsmFactory.ts +++ b/typescript/sdk/src/ism/HyperlaneIsmFactory.ts @@ -26,22 +26,22 @@ import { rootLogger, } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../app/HyperlaneApp'; -import { chainMetadata } from '../consts/chainMetadata'; +import { HyperlaneApp } from '../app/HyperlaneApp.js'; +import { chainMetadata } from '../consts/chainMetadata.js'; import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../consts/environments'; -import { appFromAddressesMapHelper } from '../contracts/contracts'; -import { HyperlaneAddressesMap } from '../contracts/types'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; +} from '../consts/environments/index.js'; +import { appFromAddressesMapHelper } from '../contracts/contracts.js'; +import { HyperlaneAddressesMap } from '../contracts/types.js'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; import { ProxyFactoryFactories, proxyFactoryFactories, -} from '../deploy/contracts'; -import { resolveOrDeployAccountOwner } from '../deploy/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +} from '../deploy/contracts.js'; +import { resolveOrDeployAccountOwner } from '../deploy/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; import { AggregationIsmConfig, @@ -52,8 +52,8 @@ import { MultisigIsmConfig, RoutingIsmConfig, RoutingIsmDelta, -} from './types'; -import { routingModuleDelta } from './utils'; +} from './types.js'; +import { routingModuleDelta } from './utils.js'; export class HyperlaneIsmFactory extends HyperlaneApp { // The shape of this object is `ChainMap
`, diff --git a/typescript/sdk/src/ism/adapters/CosmWasmMultisigAdapter.ts b/typescript/sdk/src/ism/adapters/CosmWasmMultisigAdapter.ts index 8f2e7e768..aaeb89985 100644 --- a/typescript/sdk/src/ism/adapters/CosmWasmMultisigAdapter.ts +++ b/typescript/sdk/src/ism/adapters/CosmWasmMultisigAdapter.ts @@ -7,15 +7,15 @@ import { promiseObjAll, } from '@hyperlane-xyz/utils'; -import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; +import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp.js'; import { EnrolledValidatorsResponse, ExecuteMsg as MultisigExecute, QueryMsg as MultisigQuery, -} from '../../cw-types/IsmMultisig.types'; -import { MultisigConfig } from '../../ism/types'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainMap, ChainName } from '../../types'; +} from '../../cw-types/IsmMultisig.types.js'; +import { MultisigConfig } from '../../ism/types.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainMap, ChainName } from '../../types.js'; type MultisigResponse = EnrolledValidatorsResponse; diff --git a/typescript/sdk/src/ism/multisig.ts b/typescript/sdk/src/ism/multisig.ts index 370f23221..d2dd05756 100644 --- a/typescript/sdk/src/ism/multisig.ts +++ b/typescript/sdk/src/ism/multisig.ts @@ -1,13 +1,13 @@ import { objFilter, objMap } from '@hyperlane-xyz/utils'; -import { ChainMap, ChainName } from '../types'; +import { ChainMap, ChainName } from '../types.js'; import { AggregationIsmConfig, IsmType, MultisigConfig, MultisigIsmConfig, -} from './types'; +} from './types.js'; // build multisigIsmConfig from multisigConfig // eg. for { sepolia (local), arbitrumsepolia, scrollsepolia } diff --git a/typescript/sdk/src/ism/types.ts b/typescript/sdk/src/ism/types.ts index 12c84a2a9..14ecb95a0 100644 --- a/typescript/sdk/src/ism/types.ts +++ b/typescript/sdk/src/ism/types.ts @@ -8,8 +8,8 @@ import { } from '@hyperlane-xyz/core'; import type { Address, Domain, ValueOf } from '@hyperlane-xyz/utils'; -import { OwnableConfig } from '../deploy/types'; -import { ChainMap } from '../types'; +import { OwnableConfig } from '../deploy/types.js'; +import { ChainMap } from '../types.js'; // this enum should match the IInterchainSecurityModule.sol enum // meant for the relayer diff --git a/typescript/sdk/src/ism/utils.ts b/typescript/sdk/src/ism/utils.ts index 6b7322e38..d1c0efe03 100644 --- a/typescript/sdk/src/ism/utils.ts +++ b/typescript/sdk/src/ism/utils.ts @@ -20,12 +20,12 @@ import { rootLogger, } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { HyperlaneContracts } from '../contracts/types'; -import { ProxyFactoryFactories } from '../deploy/contracts'; -import { resolveOrDeployAccountOwner } from '../deploy/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainName } from '../types'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { ProxyFactoryFactories } from '../deploy/contracts.js'; +import { resolveOrDeployAccountOwner } from '../deploy/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainName } from '../types.js'; import { IsmConfig, @@ -34,7 +34,7 @@ import { RoutingIsmConfig, RoutingIsmDelta, ismTypeToModuleType, -} from './types'; +} from './types.js'; const logger = rootLogger.child({ module: 'IsmUtils' }); diff --git a/typescript/sdk/src/metadata/ChainMetadataManager.ts b/typescript/sdk/src/metadata/ChainMetadataManager.ts index 95302c115..627748250 100644 --- a/typescript/sdk/src/metadata/ChainMetadataManager.ts +++ b/typescript/sdk/src/metadata/ChainMetadataManager.ts @@ -2,8 +2,8 @@ import { Logger } from 'pino'; import { ProtocolType, exclude, pick, rootLogger } from '@hyperlane-xyz/utils'; -import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata'; -import { ChainMap, ChainName, ChainNameOrId } from '../types'; +import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata.js'; +import { ChainMap, ChainName, ChainNameOrId } from '../types.js'; import { getExplorerAddressUrl, @@ -11,13 +11,13 @@ import { getExplorerApiUrl, getExplorerBaseUrl, getExplorerTxUrl, -} from './blockExplorer'; +} from './blockExplorer.js'; import { ChainMetadata, ExplorerFamily, getDomainId, safeParseChainMetadata, -} from './chainMetadataTypes'; +} from './chainMetadataTypes.js'; export interface ChainMetadataManagerOptions { logger?: Logger; diff --git a/typescript/sdk/src/metadata/agentConfig.test.ts b/typescript/sdk/src/metadata/agentConfig.test.ts index 814018c89..5bd8a0f43 100644 --- a/typescript/sdk/src/metadata/agentConfig.test.ts +++ b/typescript/sdk/src/metadata/agentConfig.test.ts @@ -1,9 +1,9 @@ import { expect } from 'chai'; -import { Chains } from '../consts/chains'; -import { MultiProvider } from '../providers/MultiProvider'; +import { Chains } from '../consts/chains.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; -import { buildAgentConfig } from './agentConfig'; +import { buildAgentConfig } from './agentConfig.js'; describe('Agent config', () => { const args: Parameters = [ diff --git a/typescript/sdk/src/metadata/agentConfig.ts b/typescript/sdk/src/metadata/agentConfig.ts index fe0e9ad54..e11cf9106 100644 --- a/typescript/sdk/src/metadata/agentConfig.ts +++ b/typescript/sdk/src/metadata/agentConfig.ts @@ -6,16 +6,19 @@ import { z } from 'zod'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; -import { ChainMetadata, ChainMetadataSchemaObject } from './chainMetadataTypes'; -import { ZHash, ZNzUint, ZUWei, ZUint } from './customZodTypes'; +import { + ChainMetadata, + ChainMetadataSchemaObject, +} from './chainMetadataTypes.js'; +import { ZHash, ZNzUint, ZUWei, ZUint } from './customZodTypes.js'; import { HyperlaneDeploymentArtifacts, HyperlaneDeploymentArtifactsSchema, -} from './deploymentArtifacts'; -import { MatchingListSchema } from './matchingList'; +} from './deploymentArtifacts.js'; +import { MatchingListSchema } from './matchingList.js'; export enum RpcConsensusType { Single = 'single', diff --git a/typescript/sdk/src/metadata/blockExplorer.ts b/typescript/sdk/src/metadata/blockExplorer.ts index ccd8a0388..00df97cd4 100644 --- a/typescript/sdk/src/metadata/blockExplorer.ts +++ b/typescript/sdk/src/metadata/blockExplorer.ts @@ -1,8 +1,8 @@ import { ProtocolType } from '@hyperlane-xyz/utils'; -import { solanaChainToClusterName } from '../consts/chainMetadata'; +import { solanaChainToClusterName } from '../consts/chainMetadata.js'; -import { ChainMetadata, ExplorerFamily } from './chainMetadataTypes'; +import { ChainMetadata, ExplorerFamily } from './chainMetadataTypes.js'; export function getExplorerBaseUrl(metadata: ChainMetadata): string | null { if (!metadata?.blockExplorers?.length) return null; diff --git a/typescript/sdk/src/metadata/chainMetadata.test.ts b/typescript/sdk/src/metadata/chainMetadata.test.ts index 210480f87..2720d3129 100644 --- a/typescript/sdk/src/metadata/chainMetadata.test.ts +++ b/typescript/sdk/src/metadata/chainMetadata.test.ts @@ -2,9 +2,9 @@ import { expect } from 'chai'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; +import { chainMetadata } from '../consts/chainMetadata.js'; -import { ChainMetadata, isValidChainMetadata } from './chainMetadataTypes'; +import { ChainMetadata, isValidChainMetadata } from './chainMetadataTypes.js'; const minimalSchema: ChainMetadata = { chainId: 5, diff --git a/typescript/sdk/src/metadata/chainMetadataTypes.ts b/typescript/sdk/src/metadata/chainMetadataTypes.ts index 3d16dc89c..b5ec6c05d 100644 --- a/typescript/sdk/src/metadata/chainMetadataTypes.ts +++ b/typescript/sdk/src/metadata/chainMetadataTypes.ts @@ -6,7 +6,7 @@ import { SafeParseReturnType, z } from 'zod'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { ZChainName, ZNzUint, ZUint } from './customZodTypes'; +import { ZChainName, ZNzUint, ZUint } from './customZodTypes.js'; export enum ExplorerFamily { Etherscan = 'etherscan', diff --git a/typescript/sdk/src/metadata/deploymentArtifacts.ts b/typescript/sdk/src/metadata/deploymentArtifacts.ts index 3740ff875..f66f4ebbf 100644 --- a/typescript/sdk/src/metadata/deploymentArtifacts.ts +++ b/typescript/sdk/src/metadata/deploymentArtifacts.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -import { ZHash } from './customZodTypes'; +import { ZHash } from './customZodTypes.js'; export const HyperlaneDeploymentArtifactsSchema = z.object({ mailbox: ZHash.describe('The address of the Mailbox contract.'), diff --git a/typescript/sdk/src/metadata/health.ts b/typescript/sdk/src/metadata/health.ts index 751d2185e..0318cf785 100644 --- a/typescript/sdk/src/metadata/health.ts +++ b/typescript/sdk/src/metadata/health.ts @@ -6,24 +6,24 @@ import { timeout, } from '@hyperlane-xyz/utils'; -import { chainIdToMetadata } from '../consts/chainMetadata'; -import { CoreChainName } from '../consts/chains'; -import { hyperlaneContractAddresses } from '../consts/environments'; +import { chainIdToMetadata } from '../consts/chainMetadata.js'; +import { CoreChainName } from '../consts/chains.js'; +import { hyperlaneContractAddresses } from '../consts/environments/index.js'; import { CosmJsProvider, CosmJsWasmProvider, EthersV5Provider, ProviderType, SolanaWeb3Provider, -} from '../providers/ProviderType'; -import { protocolToDefaultProviderBuilder } from '../providers/providerBuilders'; +} from '../providers/ProviderType.js'; +import { protocolToDefaultProviderBuilder } from '../providers/providerBuilders.js'; import { getExplorerAddressUrl, getExplorerBaseUrl, getExplorerTxUrl, -} from './blockExplorer'; -import { ChainMetadata, RpcUrl } from './chainMetadataTypes'; +} from './blockExplorer.js'; +import { ChainMetadata, RpcUrl } from './chainMetadataTypes.js'; const HEALTH_CHECK_TIMEOUT = 5000; // 5s diff --git a/typescript/sdk/src/metadata/matchingList.ts b/typescript/sdk/src/metadata/matchingList.ts index d09c23c15..0e7a50804 100644 --- a/typescript/sdk/src/metadata/matchingList.ts +++ b/typescript/sdk/src/metadata/matchingList.ts @@ -4,7 +4,7 @@ */ import { z } from 'zod'; -import { ZHash, ZNzUint } from './customZodTypes'; +import { ZHash, ZNzUint } from './customZodTypes.js'; const DomainSchema = z.union([ z.literal('*'), diff --git a/typescript/sdk/src/metadata/warpRouteConfig.ts b/typescript/sdk/src/metadata/warpRouteConfig.ts index e8028c815..2fd69ce03 100644 --- a/typescript/sdk/src/metadata/warpRouteConfig.ts +++ b/typescript/sdk/src/metadata/warpRouteConfig.ts @@ -2,8 +2,8 @@ import { z } from 'zod'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { TokenType } from '../token/config'; -import { ChainMap } from '../types'; +import { TokenType } from '../token/config.js'; +import { ChainMap } from '../types.js'; const TokenConfigSchema = z.object({ protocolType: z.nativeEnum(ProtocolType), diff --git a/typescript/sdk/src/middleware/account/InterchainAccount.ts b/typescript/sdk/src/middleware/account/InterchainAccount.ts index a83b3c15a..bc38c9c40 100644 --- a/typescript/sdk/src/middleware/account/InterchainAccount.ts +++ b/typescript/sdk/src/middleware/account/InterchainAccount.ts @@ -12,25 +12,25 @@ import { import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../../consts/environments'; +} from '../../consts/environments/index.js'; import { appFromAddressesMapHelper, filterChainMapToProtocol, -} from '../../contracts/contracts'; +} from '../../contracts/contracts.js'; import { HyperlaneAddressesMap, HyperlaneContracts, HyperlaneContractsMap, -} from '../../contracts/types'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { RouterApp } from '../../router/RouterApps'; -import { ChainName } from '../../types'; +} from '../../contracts/types.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { RouterApp } from '../../router/RouterApps.js'; +import { ChainName } from '../../types.js'; import { InterchainAccountFactories, interchainAccountFactories, -} from './contracts'; -import { AccountConfig } from './types'; +} from './contracts.js'; +import { AccountConfig } from './types.js'; export class InterchainAccount extends RouterApp { constructor( diff --git a/typescript/sdk/src/middleware/account/InterchainAccountChecker.ts b/typescript/sdk/src/middleware/account/InterchainAccountChecker.ts index 8a7990a7b..ee49f5be3 100644 --- a/typescript/sdk/src/middleware/account/InterchainAccountChecker.ts +++ b/typescript/sdk/src/middleware/account/InterchainAccountChecker.ts @@ -1,12 +1,12 @@ import { objMap } from '@hyperlane-xyz/utils'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ProxiedRouterChecker } from '../../router/ProxiedRouterChecker'; -import { ChainMap } from '../../types'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ProxiedRouterChecker } from '../../router/ProxiedRouterChecker.js'; +import { ChainMap } from '../../types.js'; -import { InterchainAccount } from './InterchainAccount'; -import { InterchainAccountConfig } from './InterchainAccountDeployer'; -import { InterchainAccountFactories } from './contracts'; +import { InterchainAccount } from './InterchainAccount.js'; +import { InterchainAccountConfig } from './InterchainAccountDeployer.js'; +import { InterchainAccountFactories } from './contracts.js'; export class InterchainAccountChecker extends ProxiedRouterChecker< InterchainAccountFactories, diff --git a/typescript/sdk/src/middleware/account/InterchainAccountDeployer.ts b/typescript/sdk/src/middleware/account/InterchainAccountDeployer.ts index 1b86772a5..13f430488 100644 --- a/typescript/sdk/src/middleware/account/InterchainAccountDeployer.ts +++ b/typescript/sdk/src/middleware/account/InterchainAccountDeployer.ts @@ -2,17 +2,17 @@ import { ethers } from 'ethers'; import { Router } from '@hyperlane-xyz/core'; -import { HyperlaneContracts } from '../../contracts/types'; -import { ContractVerifier } from '../../deploy/verify/ContractVerifier'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer'; -import { ProxiedRouterConfig, RouterConfig } from '../../router/types'; -import { ChainName } from '../../types'; +import { HyperlaneContracts } from '../../contracts/types.js'; +import { ContractVerifier } from '../../deploy/verify/ContractVerifier.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer.js'; +import { ProxiedRouterConfig, RouterConfig } from '../../router/types.js'; +import { ChainName } from '../../types.js'; import { InterchainAccountFactories, interchainAccountFactories, -} from './contracts'; +} from './contracts.js'; export type InterchainAccountConfig = ProxiedRouterConfig; diff --git a/typescript/sdk/src/middleware/account/accounts.hardhat-test.ts b/typescript/sdk/src/middleware/account/accounts.hardhat-test.ts index 9938e39b7..b476bb7b6 100644 --- a/typescript/sdk/src/middleware/account/accounts.hardhat-test.ts +++ b/typescript/sdk/src/middleware/account/accounts.hardhat-test.ts @@ -1,28 +1,28 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; import { expect } from 'chai'; -import { BigNumber } from 'ethers'; -import { ethers } from 'hardhat'; +import { BigNumber, constants } from 'ethers'; +import hre from 'hardhat'; import { InterchainAccountRouter, TestRecipient__factory, } from '@hyperlane-xyz/core'; -import { Chains } from '../../consts/chains'; -import { HyperlaneContractsMap } from '../../contracts/types'; -import { TestCoreApp } from '../../core/TestCoreApp'; -import { TestCoreDeployer } from '../../core/TestCoreDeployer'; -import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { RouterConfig } from '../../router/types'; -import { ChainMap } from '../../types'; +import { Chains } from '../../consts/chains.js'; +import { HyperlaneContractsMap } from '../../contracts/types.js'; +import { TestCoreApp } from '../../core/TestCoreApp.js'; +import { TestCoreDeployer } from '../../core/TestCoreDeployer.js'; +import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { RouterConfig } from '../../router/types.js'; +import { ChainMap } from '../../types.js'; -import { InterchainAccount } from './InterchainAccount'; -import { InterchainAccountChecker } from './InterchainAccountChecker'; -import { InterchainAccountDeployer } from './InterchainAccountDeployer'; -import { InterchainAccountFactories } from './contracts'; -import { AccountConfig } from './types'; +import { InterchainAccount } from './InterchainAccount.js'; +import { InterchainAccountChecker } from './InterchainAccountChecker.js'; +import { InterchainAccountDeployer } from './InterchainAccountDeployer.js'; +import { InterchainAccountFactories } from './contracts.js'; +import { AccountConfig } from './types.js'; describe('InterchainAccounts', async () => { const localChain = Chains.test1; @@ -38,7 +38,7 @@ describe('InterchainAccounts', async () => { let config: ChainMap; before(async () => { - [signer] = await ethers.getSigners(); + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( @@ -78,7 +78,7 @@ describe('InterchainAccounts', async () => { multiProvider.getDomainId(localChain), signer.address, local.address, - ethers.constants.AddressZero, + constants.AddressZero, ); const call = { diff --git a/typescript/sdk/src/middleware/account/contracts.ts b/typescript/sdk/src/middleware/account/contracts.ts index cc3606d42..7aaa16ad7 100644 --- a/typescript/sdk/src/middleware/account/contracts.ts +++ b/typescript/sdk/src/middleware/account/contracts.ts @@ -3,7 +3,7 @@ import { InterchainAccountRouter__factory, } from '@hyperlane-xyz/core'; -import { proxiedFactories } from '../../router/types'; +import { proxiedFactories } from '../../router/types.js'; export const interchainAccountFactories = { interchainAccountRouter: new InterchainAccountRouter__factory(), diff --git a/typescript/sdk/src/middleware/account/types.ts b/typescript/sdk/src/middleware/account/types.ts index 5123b0590..85d5acda7 100644 --- a/typescript/sdk/src/middleware/account/types.ts +++ b/typescript/sdk/src/middleware/account/types.ts @@ -1,6 +1,6 @@ import { Address } from '@hyperlane-xyz/utils'; -import { ChainName } from '../../types'; +import { ChainName } from '../../types.js'; export type AccountConfig = { origin: ChainName; diff --git a/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerApp.ts b/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerApp.ts index 8f779d50a..93e324a24 100644 --- a/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerApp.ts +++ b/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerApp.ts @@ -14,14 +14,14 @@ import { strip0x, } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../../app/HyperlaneApp'; -import { HyperlaneContracts } from '../../contracts/types'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ChainMap, ChainName } from '../../types'; -import { fetchWithTimeout } from '../../utils/fetch'; - -import { BridgeAdapterConfig } from './LiquidityLayerRouterDeployer'; -import { liquidityLayerFactories } from './contracts'; +import { HyperlaneApp } from '../../app/HyperlaneApp.js'; +import { HyperlaneContracts } from '../../contracts/types.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../../types.js'; +import { fetchWithTimeout } from '../../utils/fetch.js'; + +import { BridgeAdapterConfig } from './LiquidityLayerRouterDeployer.js'; +import { liquidityLayerFactories } from './contracts.js'; const PORTAL_VAA_SERVICE_TESTNET_BASE_URL = 'https://wormhole-v2-testnet-api.certus.one/v1/signed_vaa/'; diff --git a/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerRouterDeployer.ts b/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerRouterDeployer.ts index 015920f21..ae27525e5 100644 --- a/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerRouterDeployer.ts +++ b/typescript/sdk/src/middleware/liquidity-layer/LiquidityLayerRouterDeployer.ts @@ -11,14 +11,17 @@ import { Address, eqAddress, objFilter, objMap } from '@hyperlane-xyz/utils'; import { HyperlaneContracts, HyperlaneContractsMap, -} from '../../contracts/types'; -import { ContractVerifier } from '../../deploy/verify/ContractVerifier'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer'; -import { RouterConfig } from '../../router/types'; -import { ChainMap, ChainName } from '../../types'; +} from '../../contracts/types.js'; +import { ContractVerifier } from '../../deploy/verify/ContractVerifier.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer.js'; +import { RouterConfig } from '../../router/types.js'; +import { ChainMap, ChainName } from '../../types.js'; -import { LiquidityLayerFactories, liquidityLayerFactories } from './contracts'; +import { + LiquidityLayerFactories, + liquidityLayerFactories, +} from './contracts.js'; export enum BridgeAdapterType { Circle = 'Circle', diff --git a/typescript/sdk/src/middleware/liquidity-layer/contracts.ts b/typescript/sdk/src/middleware/liquidity-layer/contracts.ts index d994306b4..ef88008b9 100644 --- a/typescript/sdk/src/middleware/liquidity-layer/contracts.ts +++ b/typescript/sdk/src/middleware/liquidity-layer/contracts.ts @@ -4,7 +4,7 @@ import { PortalAdapter__factory, } from '@hyperlane-xyz/core'; -import { proxiedFactories } from '../../router/types'; +import { proxiedFactories } from '../../router/types.js'; export const liquidityLayerFactories = { circleBridgeAdapter: new CircleBridgeAdapter__factory(), diff --git a/typescript/sdk/src/middleware/liquidity-layer/liquidity-layer.hardhat-test.ts b/typescript/sdk/src/middleware/liquidity-layer/liquidity-layer.hardhat-test.ts index e60c1d48f..5ba99e188 100644 --- a/typescript/sdk/src/middleware/liquidity-layer/liquidity-layer.hardhat-test.ts +++ b/typescript/sdk/src/middleware/liquidity-layer/liquidity-layer.hardhat-test.ts @@ -1,6 +1,6 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { LiquidityLayerRouter, @@ -16,23 +16,23 @@ import { } from '@hyperlane-xyz/core'; import { addressToBytes32, objMap } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../../consts/chainMetadata'; -import { Chains } from '../../consts/chains'; -import { TestCoreApp } from '../../core/TestCoreApp'; -import { TestCoreDeployer } from '../../core/TestCoreDeployer'; -import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ChainMap } from '../../types'; +import { chainMetadata } from '../../consts/chainMetadata.js'; +import { Chains } from '../../consts/chains.js'; +import { TestCoreApp } from '../../core/TestCoreApp.js'; +import { TestCoreDeployer } from '../../core/TestCoreDeployer.js'; +import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ChainMap } from '../../types.js'; -import { LiquidityLayerApp } from './LiquidityLayerApp'; +import { LiquidityLayerApp } from './LiquidityLayerApp.js'; import { BridgeAdapterType, CircleBridgeAdapterConfig, LiquidityLayerConfig, LiquidityLayerDeployer, PortalAdapterConfig, -} from './LiquidityLayerRouterDeployer'; +} from './LiquidityLayerRouterDeployer.js'; describe.skip('LiquidityLayerRouter', async () => { const localChain = Chains.test1; @@ -53,7 +53,7 @@ describe.skip('LiquidityLayerRouter', async () => { let messageTransmitter: MockCircleMessageTransmitter; before(async () => { - [signer] = await ethers.getSigners(); + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/sdk/src/middleware/query/InterchainQuery.ts b/typescript/sdk/src/middleware/query/InterchainQuery.ts index dc8712f82..4cc51e5e0 100644 --- a/typescript/sdk/src/middleware/query/InterchainQuery.ts +++ b/typescript/sdk/src/middleware/query/InterchainQuery.ts @@ -3,19 +3,19 @@ import { InterchainQueryRouter } from '@hyperlane-xyz/core'; import { HyperlaneEnvironment, hyperlaneEnvironments, -} from '../../consts/environments'; -import { appFromAddressesMapHelper } from '../../contracts/contracts'; +} from '../../consts/environments/index.js'; +import { appFromAddressesMapHelper } from '../../contracts/contracts.js'; import { HyperlaneAddressesMap, HyperlaneContracts, -} from '../../contracts/types'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { RouterApp } from '../../router/RouterApps'; +} from '../../contracts/types.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { RouterApp } from '../../router/RouterApps.js'; import { InterchainQueryFactories, interchainQueryFactories, -} from './contracts'; +} from './contracts.js'; export class InterchainQuery extends RouterApp { router( diff --git a/typescript/sdk/src/middleware/query/InterchainQueryChecker.ts b/typescript/sdk/src/middleware/query/InterchainQueryChecker.ts index 7070fb511..2e1525500 100644 --- a/typescript/sdk/src/middleware/query/InterchainQueryChecker.ts +++ b/typescript/sdk/src/middleware/query/InterchainQueryChecker.ts @@ -1,8 +1,8 @@ -import { ProxiedRouterChecker } from '../../router/ProxiedRouterChecker'; +import { ProxiedRouterChecker } from '../../router/ProxiedRouterChecker.js'; -import { InterchainQuery } from './InterchainQuery'; -import { InterchainQueryConfig } from './InterchainQueryDeployer'; -import { InterchainQueryFactories } from './contracts'; +import { InterchainQuery } from './InterchainQuery.js'; +import { InterchainQueryConfig } from './InterchainQueryDeployer.js'; +import { InterchainQueryFactories } from './contracts.js'; export class InterchainQueryChecker extends ProxiedRouterChecker< InterchainQueryFactories, diff --git a/typescript/sdk/src/middleware/query/InterchainQueryDeployer.ts b/typescript/sdk/src/middleware/query/InterchainQueryDeployer.ts index 93e5dab3d..66ec5d4da 100644 --- a/typescript/sdk/src/middleware/query/InterchainQueryDeployer.ts +++ b/typescript/sdk/src/middleware/query/InterchainQueryDeployer.ts @@ -2,16 +2,16 @@ import { ethers } from 'ethers'; import { Router } from '@hyperlane-xyz/core'; -import { HyperlaneContracts } from '../../contracts/types'; -import { ContractVerifier } from '../../deploy/verify/ContractVerifier'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer'; -import { RouterConfig } from '../../router/types'; +import { HyperlaneContracts } from '../../contracts/types.js'; +import { ContractVerifier } from '../../deploy/verify/ContractVerifier.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { ProxiedRouterDeployer } from '../../router/ProxiedRouterDeployer.js'; +import { RouterConfig } from '../../router/types.js'; import { InterchainQueryFactories, interchainQueryFactories, -} from './contracts'; +} from './contracts.js'; export type InterchainQueryConfig = RouterConfig; diff --git a/typescript/sdk/src/middleware/query/contracts.ts b/typescript/sdk/src/middleware/query/contracts.ts index 256a3daee..1725f60bc 100644 --- a/typescript/sdk/src/middleware/query/contracts.ts +++ b/typescript/sdk/src/middleware/query/contracts.ts @@ -1,6 +1,6 @@ import { InterchainQueryRouter__factory } from '@hyperlane-xyz/core'; -import { proxiedFactories } from '../../router/types'; +import { proxiedFactories } from '../../router/types.js'; export const interchainQueryFactories = { interchainQueryRouter: new InterchainQueryRouter__factory(), diff --git a/typescript/sdk/src/middleware/query/queries.hardhat-test.ts b/typescript/sdk/src/middleware/query/queries.hardhat-test.ts index c2b1d99f5..6d38c47c4 100644 --- a/typescript/sdk/src/middleware/query/queries.hardhat-test.ts +++ b/typescript/sdk/src/middleware/query/queries.hardhat-test.ts @@ -1,6 +1,6 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; import { expect } from 'chai'; -import { ethers } from 'hardhat'; +import hre from 'hardhat'; import { InterchainQueryRouter, @@ -9,21 +9,21 @@ import { } from '@hyperlane-xyz/core'; import { addressToBytes32 } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../../consts/chainMetadata'; -import { Chains } from '../../consts/chains'; -import { HyperlaneContractsMap } from '../../contracts/types'; -import { TestCoreApp } from '../../core/TestCoreApp'; -import { TestCoreDeployer } from '../../core/TestCoreDeployer'; -import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../../providers/MultiProvider'; -import { RouterConfig } from '../../router/types'; -import { ChainMap } from '../../types'; +import { chainMetadata } from '../../consts/chainMetadata.js'; +import { Chains } from '../../consts/chains.js'; +import { HyperlaneContractsMap } from '../../contracts/types.js'; +import { TestCoreApp } from '../../core/TestCoreApp.js'; +import { TestCoreDeployer } from '../../core/TestCoreDeployer.js'; +import { HyperlaneProxyFactoryDeployer } from '../../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../../providers/MultiProvider.js'; +import { RouterConfig } from '../../router/types.js'; +import { ChainMap } from '../../types.js'; -import { InterchainQuery } from './InterchainQuery'; -import { InterchainQueryChecker } from './InterchainQueryChecker'; -import { InterchainQueryDeployer } from './InterchainQueryDeployer'; -import { InterchainQueryFactories } from './contracts'; +import { InterchainQuery } from './InterchainQuery.js'; +import { InterchainQueryChecker } from './InterchainQueryChecker.js'; +import { InterchainQueryDeployer } from './InterchainQueryDeployer.js'; +import { InterchainQueryFactories } from './contracts.js'; describe.skip('InterchainQueryRouter', async () => { const localChain = Chains.test1; @@ -41,7 +41,7 @@ describe.skip('InterchainQueryRouter', async () => { let testQuery: TestQuery; before(async () => { - [signer] = await ethers.getSigners(); + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const ismFactory = new HyperlaneIsmFactory( diff --git a/typescript/sdk/src/providers/MultiProtocolProvider.test.ts b/typescript/sdk/src/providers/MultiProtocolProvider.test.ts index bdb9ac19c..b1ac8e5b5 100644 --- a/typescript/sdk/src/providers/MultiProtocolProvider.test.ts +++ b/typescript/sdk/src/providers/MultiProtocolProvider.test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; -import { ethereum } from '../consts/chainMetadata'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { ethereum } from '../consts/chainMetadata.js'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; describe('MultiProtocolProvider', () => { describe('constructs', () => { diff --git a/typescript/sdk/src/providers/MultiProtocolProvider.ts b/typescript/sdk/src/providers/MultiProtocolProvider.ts index e3ac8fc33..3ed9dee61 100644 --- a/typescript/sdk/src/providers/MultiProtocolProvider.ts +++ b/typescript/sdk/src/providers/MultiProtocolProvider.ts @@ -9,12 +9,12 @@ import { rootLogger, } from '@hyperlane-xyz/utils'; -import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata'; -import { ChainMetadataManager } from '../metadata/ChainMetadataManager'; -import type { ChainMetadata } from '../metadata/chainMetadataTypes'; -import type { ChainMap, ChainName, ChainNameOrId } from '../types'; +import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata.js'; +import { ChainMetadataManager } from '../metadata/ChainMetadataManager.js'; +import type { ChainMetadata } from '../metadata/chainMetadataTypes.js'; +import type { ChainMap, ChainName, ChainNameOrId } from '../types.js'; -import { MultiProvider, MultiProviderOptions } from './MultiProvider'; +import { MultiProvider, MultiProviderOptions } from './MultiProvider.js'; import { CosmJsProvider, CosmJsWasmProvider, @@ -26,15 +26,15 @@ import { TypedProvider, TypedTransaction, ViemProvider, -} from './ProviderType'; +} from './ProviderType.js'; import { ProviderBuilderMap, defaultProviderBuilderMap, -} from './providerBuilders'; +} from './providerBuilders.js'; import { TransactionFeeEstimate, estimateTransactionFee, -} from './transactionFeeEstimators'; +} from './transactionFeeEstimators.js'; export interface MultiProtocolProviderOptions { logger?: Logger; diff --git a/typescript/sdk/src/providers/MultiProvider.ts b/typescript/sdk/src/providers/MultiProvider.ts index eb1fc661e..572cf929a 100644 --- a/typescript/sdk/src/providers/MultiProvider.ts +++ b/typescript/sdk/src/providers/MultiProvider.ts @@ -11,13 +11,16 @@ import { Logger } from 'pino'; import { Address, pick, rootLogger } from '@hyperlane-xyz/utils'; -import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata'; -import { CoreChainName, TestChains } from '../consts/chains'; -import { ChainMetadataManager } from '../metadata/ChainMetadataManager'; -import { ChainMetadata } from '../metadata/chainMetadataTypes'; -import { ChainMap, ChainName, ChainNameOrId } from '../types'; +import { chainMetadata as defaultChainMetadata } from '../consts/chainMetadata.js'; +import { CoreChainName, TestChains } from '../consts/chains.js'; +import { ChainMetadataManager } from '../metadata/ChainMetadataManager.js'; +import { ChainMetadata } from '../metadata/chainMetadataTypes.js'; +import { ChainMap, ChainName, ChainNameOrId } from '../types.js'; -import { ProviderBuilderFn, defaultProviderBuilder } from './providerBuilders'; +import { + ProviderBuilderFn, + defaultProviderBuilder, +} from './providerBuilders.js'; type Provider = providers.Provider; diff --git a/typescript/sdk/src/providers/SmartProvider/HyperlaneEtherscanProvider.ts b/typescript/sdk/src/providers/SmartProvider/HyperlaneEtherscanProvider.ts index ed225c153..908c7939a 100644 --- a/typescript/sdk/src/providers/SmartProvider/HyperlaneEtherscanProvider.ts +++ b/typescript/sdk/src/providers/SmartProvider/HyperlaneEtherscanProvider.ts @@ -2,13 +2,13 @@ import { providers } from 'ethers'; import { objFilter, rootLogger, sleep } from '@hyperlane-xyz/utils'; -import { BlockExplorer } from '../../metadata/chainMetadataTypes'; +import { BlockExplorer } from '../../metadata/chainMetadataTypes.js'; import { IProviderMethods, ProviderMethod, excludeProviderMethods, -} from './ProviderMethods'; +} from './ProviderMethods.js'; // Used for crude rate-limiting of explorer queries without API keys const hostToLastQueried: Record = {}; diff --git a/typescript/sdk/src/providers/SmartProvider/HyperlaneJsonRpcProvider.ts b/typescript/sdk/src/providers/SmartProvider/HyperlaneJsonRpcProvider.ts index 436522cf9..8b434a29c 100644 --- a/typescript/sdk/src/providers/SmartProvider/HyperlaneJsonRpcProvider.ts +++ b/typescript/sdk/src/providers/SmartProvider/HyperlaneJsonRpcProvider.ts @@ -11,8 +11,8 @@ import { AllProviderMethods, IProviderMethods, ProviderMethod, -} from './ProviderMethods'; -import { RpcConfigWithConnectionInfo } from './types'; +} from './ProviderMethods.js'; +import { RpcConfigWithConnectionInfo } from './types.js'; const NUM_LOG_BLOCK_RANGES_TO_QUERY = 10; const NUM_PARALLEL_LOG_QUERIES = 5; diff --git a/typescript/sdk/src/providers/SmartProvider/SmartProvider.foundry-test.ts b/typescript/sdk/src/providers/SmartProvider/SmartProvider.foundry-test.ts index 8b55e33fd..55301eb35 100644 --- a/typescript/sdk/src/providers/SmartProvider/SmartProvider.foundry-test.ts +++ b/typescript/sdk/src/providers/SmartProvider/SmartProvider.foundry-test.ts @@ -3,7 +3,7 @@ import { Wallet, constants } from 'ethers'; import { ERC20__factory } from '@hyperlane-xyz/core'; -import { HyperlaneSmartProvider } from './SmartProvider'; +import { HyperlaneSmartProvider } from './SmartProvider.js'; const PK = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'; const NETWORK = 31337; diff --git a/typescript/sdk/src/providers/SmartProvider/SmartProvider.test.ts b/typescript/sdk/src/providers/SmartProvider/SmartProvider.test.ts index 287b7888d..957eab65c 100644 --- a/typescript/sdk/src/providers/SmartProvider/SmartProvider.test.ts +++ b/typescript/sdk/src/providers/SmartProvider/SmartProvider.test.ts @@ -4,11 +4,11 @@ import { ethers } from 'ethers'; import { eqAddress } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../../consts/chainMetadata'; -import { ChainMetadata } from '../../metadata/chainMetadataTypes'; +import { chainMetadata } from '../../consts/chainMetadata.js'; +import { ChainMetadata } from '../../metadata/chainMetadataTypes.js'; -import { ProviderMethod } from './ProviderMethods'; -import { HyperlaneSmartProvider } from './SmartProvider'; +import { ProviderMethod } from './ProviderMethods.js'; +import { HyperlaneSmartProvider } from './SmartProvider.js'; const DEFAULT_ACCOUNT = '0xfaD1C94469700833717Fa8a3017278BC1cA8031C'; const WETH_CONTRACT = '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9'; diff --git a/typescript/sdk/src/providers/SmartProvider/SmartProvider.ts b/typescript/sdk/src/providers/SmartProvider/SmartProvider.ts index 76270505f..8c83dab2f 100644 --- a/typescript/sdk/src/providers/SmartProvider/SmartProvider.ts +++ b/typescript/sdk/src/providers/SmartProvider/SmartProvider.ts @@ -14,18 +14,18 @@ import { ChainMetadata, ExplorerFamily, RpcUrl, -} from '../../metadata/chainMetadataTypes'; +} from '../../metadata/chainMetadataTypes.js'; -import { HyperlaneEtherscanProvider } from './HyperlaneEtherscanProvider'; -import { HyperlaneJsonRpcProvider } from './HyperlaneJsonRpcProvider'; -import { IProviderMethods, ProviderMethod } from './ProviderMethods'; +import { HyperlaneEtherscanProvider } from './HyperlaneEtherscanProvider.js'; +import { HyperlaneJsonRpcProvider } from './HyperlaneJsonRpcProvider.js'; +import { IProviderMethods, ProviderMethod } from './ProviderMethods.js'; import { ChainMetadataWithRpcConnectionInfo, ProviderPerformResult, ProviderStatus, ProviderTimeoutResult, SmartProviderOptions, -} from './types'; +} from './types.js'; const DEFAULT_MAX_RETRIES = 1; const DEFAULT_BASE_RETRY_DELAY_MS = 250; // 0.25 seconds diff --git a/typescript/sdk/src/providers/SmartProvider/types.ts b/typescript/sdk/src/providers/SmartProvider/types.ts index 487d37893..d08933af4 100644 --- a/typescript/sdk/src/providers/SmartProvider/types.ts +++ b/typescript/sdk/src/providers/SmartProvider/types.ts @@ -1,6 +1,6 @@ import type { utils } from 'ethers'; -import { ChainMetadata, RpcUrl } from '../../metadata/chainMetadataTypes'; +import { ChainMetadata, RpcUrl } from '../../metadata/chainMetadataTypes.js'; export type RpcConfigWithConnectionInfo = RpcUrl & { connection?: utils.ConnectionInfo; diff --git a/typescript/sdk/src/providers/providerBuilders.ts b/typescript/sdk/src/providers/providerBuilders.ts index 74edb30e1..11cd3d15a 100644 --- a/typescript/sdk/src/providers/providerBuilders.ts +++ b/typescript/sdk/src/providers/providerBuilders.ts @@ -6,7 +6,7 @@ import { createPublicClient, http } from 'viem'; import { ProtocolType, isNumeric } from '@hyperlane-xyz/utils'; -import { ChainMetadata, RpcUrl } from '../metadata/chainMetadataTypes'; +import { ChainMetadata, RpcUrl } from '../metadata/chainMetadataTypes.js'; import { CosmJsProvider, @@ -16,9 +16,9 @@ import { SolanaWeb3Provider, TypedProvider, ViemProvider, -} from './ProviderType'; -import { HyperlaneSmartProvider } from './SmartProvider/SmartProvider'; -import { ProviderRetryOptions } from './SmartProvider/types'; +} from './ProviderType.js'; +import { HyperlaneSmartProvider } from './SmartProvider/SmartProvider.js'; +import { ProviderRetryOptions } from './SmartProvider/types.js'; export type ProviderBuilderFn

= ( rpcUrls: ChainMetadata['rpcUrls'], diff --git a/typescript/sdk/src/providers/transactionFeeEstimators.ts b/typescript/sdk/src/providers/transactionFeeEstimators.ts index d3f66f58e..e4a0c8464 100644 --- a/typescript/sdk/src/providers/transactionFeeEstimators.ts +++ b/typescript/sdk/src/providers/transactionFeeEstimators.ts @@ -4,11 +4,11 @@ import { toUtf8 } from '@cosmjs/encoding'; import { Uint53 } from '@cosmjs/math'; import { Registry } from '@cosmjs/proto-signing'; import { StargateClient, defaultRegistryTypes } from '@cosmjs/stargate'; -import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx'; +import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx.js'; import { Address, HexString, Numberish, assert } from '@hyperlane-xyz/utils'; -import { ChainMetadata } from '../metadata/chainMetadataTypes'; +import { ChainMetadata } from '../metadata/chainMetadataTypes.js'; import { CosmJsProvider, @@ -24,7 +24,7 @@ import { TypedTransaction, ViemProvider, ViemTransaction, -} from './ProviderType'; +} from './ProviderType.js'; export interface TransactionFeeEstimate { gasUnits: number | bigint; diff --git a/typescript/sdk/src/router/GasRouterDeployer.ts b/typescript/sdk/src/router/GasRouterDeployer.ts index 28b147112..8c7d0a52e 100644 --- a/typescript/sdk/src/router/GasRouterDeployer.ts +++ b/typescript/sdk/src/router/GasRouterDeployer.ts @@ -1,11 +1,14 @@ import { GasRouter } from '@hyperlane-xyz/core'; import { Address } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts, HyperlaneContractsMap } from '../contracts/types'; -import { ChainMap } from '../types'; +import { + HyperlaneContracts, + HyperlaneContractsMap, +} from '../contracts/types.js'; +import { ChainMap } from '../types.js'; -import { ProxiedRouterDeployer } from './ProxiedRouterDeployer'; -import { GasRouterConfig, ProxiedFactories } from './types'; +import { ProxiedRouterDeployer } from './ProxiedRouterDeployer.js'; +import { GasRouterConfig, ProxiedFactories } from './types.js'; export abstract class GasRouterDeployer< Config extends GasRouterConfig, diff --git a/typescript/sdk/src/router/HyperlaneRouterChecker.ts b/typescript/sdk/src/router/HyperlaneRouterChecker.ts index 94c611a97..06d52f748 100644 --- a/typescript/sdk/src/router/HyperlaneRouterChecker.ts +++ b/typescript/sdk/src/router/HyperlaneRouterChecker.ts @@ -1,18 +1,17 @@ -import { ConnectionClientViolation } from '..'; import { ethers } from 'ethers'; import { zeroAddress } from 'viem'; import { IMailbox__factory } from '@hyperlane-xyz/core'; import { addressToBytes32, eqAddress } from '@hyperlane-xyz/utils'; -import { HyperlaneFactories } from '../contracts/types'; -import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { moduleMatchesConfig } from '../ism/utils'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; +import { HyperlaneFactories } from '../contracts/types.js'; +import { HyperlaneAppChecker } from '../deploy/HyperlaneAppChecker.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { moduleMatchesConfig } from '../ism/utils.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; -import { RouterApp } from './RouterApps'; +import { RouterApp } from './RouterApps.js'; import { ClientViolation, ClientViolationType, @@ -20,7 +19,7 @@ import { RouterConfig, RouterViolation, RouterViolationType, -} from './types'; +} from './types.js'; export class HyperlaneRouterChecker< Factories extends HyperlaneFactories, @@ -70,7 +69,7 @@ export class HyperlaneRouterChecker< ); if (!matches) { - const violation: ConnectionClientViolation = { + const violation: ClientViolation = { chain, type: violationType, contract: router, diff --git a/typescript/sdk/src/router/HyperlaneRouterDeployer.ts b/typescript/sdk/src/router/HyperlaneRouterDeployer.ts index 5c5d984b1..b9ed41bfb 100644 --- a/typescript/sdk/src/router/HyperlaneRouterDeployer.ts +++ b/typescript/sdk/src/router/HyperlaneRouterDeployer.ts @@ -7,15 +7,15 @@ import { objMerge, } from '@hyperlane-xyz/utils'; -import { filterOwnableContracts } from '../contracts/contracts'; +import { filterOwnableContracts } from '../contracts/contracts.js'; import { HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from '../contracts/types'; -import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; -import { RouterConfig } from '../router/types'; -import { ChainMap } from '../types'; +} from '../contracts/types.js'; +import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer.js'; +import { RouterConfig } from '../router/types.js'; +import { ChainMap } from '../types.js'; export abstract class HyperlaneRouterDeployer< Config extends RouterConfig, diff --git a/typescript/sdk/src/router/MultiProtocolRouterApps.test.ts b/typescript/sdk/src/router/MultiProtocolRouterApps.test.ts index e00b49e98..9449871e8 100644 --- a/typescript/sdk/src/router/MultiProtocolRouterApps.test.ts +++ b/typescript/sdk/src/router/MultiProtocolRouterApps.test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { ethers } from 'ethers'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; -import { MultiProtocolRouterApp } from './MultiProtocolRouterApps'; -import { EvmRouterAdapter } from './adapters/EvmRouterAdapter'; -import { RouterAddress } from './types'; +import { MultiProtocolRouterApp } from './MultiProtocolRouterApps.js'; +import { EvmRouterAdapter } from './adapters/EvmRouterAdapter.js'; +import { RouterAddress } from './types.js'; describe('MultiProtocolRouterApp', () => { describe('constructs', () => { diff --git a/typescript/sdk/src/router/MultiProtocolRouterApps.ts b/typescript/sdk/src/router/MultiProtocolRouterApps.ts index b60bd9f91..31532bcbc 100644 --- a/typescript/sdk/src/router/MultiProtocolRouterApps.ts +++ b/typescript/sdk/src/router/MultiProtocolRouterApps.ts @@ -1,20 +1,18 @@ import { Address, Domain, ProtocolType } from '@hyperlane-xyz/utils'; -import { AdapterClassType, MultiProtocolApp } from '../app/MultiProtocolApp'; -import { ChainMap, ChainName } from '../types'; +import { AdapterClassType, MultiProtocolApp } from '../app/MultiProtocolApp.js'; +import { ChainMap, ChainName } from '../types.js'; import { EvmGasRouterAdapter, EvmRouterAdapter, -} from './adapters/EvmRouterAdapter'; +} from './adapters/EvmRouterAdapter.js'; import { SealevelGasRouterAdapter, SealevelRouterAdapter, -} from './adapters/SealevelRouterAdapter'; -import { IGasRouterAdapter, IRouterAdapter } from './adapters/types'; -import { RouterAddress } from './types'; - -export { Router } from '@hyperlane-xyz/core'; +} from './adapters/SealevelRouterAdapter.js'; +import { IGasRouterAdapter, IRouterAdapter } from './adapters/types.js'; +import { RouterAddress } from './types.js'; export class MultiProtocolRouterApp< IAdapterApi extends IRouterAdapter = IRouterAdapter, diff --git a/typescript/sdk/src/router/ProxiedRouterChecker.ts b/typescript/sdk/src/router/ProxiedRouterChecker.ts index 560a90bd7..a3a158888 100644 --- a/typescript/sdk/src/router/ProxiedRouterChecker.ts +++ b/typescript/sdk/src/router/ProxiedRouterChecker.ts @@ -1,8 +1,8 @@ -import { ChainName } from '../types'; +import { ChainName } from '../types.js'; -import { HyperlaneRouterChecker } from './HyperlaneRouterChecker'; -import { RouterApp } from './RouterApps'; -import { ProxiedFactories, ProxiedRouterConfig } from './types'; +import { HyperlaneRouterChecker } from './HyperlaneRouterChecker.js'; +import { RouterApp } from './RouterApps.js'; +import { ProxiedFactories, ProxiedRouterConfig } from './types.js'; export abstract class ProxiedRouterChecker< Factories extends ProxiedFactories, diff --git a/typescript/sdk/src/router/ProxiedRouterDeployer.ts b/typescript/sdk/src/router/ProxiedRouterDeployer.ts index bcee93af2..f8a560804 100644 --- a/typescript/sdk/src/router/ProxiedRouterDeployer.ts +++ b/typescript/sdk/src/router/ProxiedRouterDeployer.ts @@ -7,12 +7,12 @@ import { } from '@hyperlane-xyz/core'; import { eqAddress } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts } from '../contracts/types'; -import { resolveOrDeployAccountOwner } from '../deploy/types'; -import { ChainName } from '../types'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { resolveOrDeployAccountOwner } from '../deploy/types.js'; +import { ChainName } from '../types.js'; -import { HyperlaneRouterDeployer } from './HyperlaneRouterDeployer'; -import { ProxiedFactories, ProxiedRouterConfig } from './types'; +import { HyperlaneRouterDeployer } from './HyperlaneRouterDeployer.js'; +import { ProxiedFactories, ProxiedRouterConfig } from './types.js'; export abstract class ProxiedRouterDeployer< Config extends ProxiedRouterConfig, diff --git a/typescript/sdk/src/router/RouterApps.ts b/typescript/sdk/src/router/RouterApps.ts index 756436c11..5251a93f2 100644 --- a/typescript/sdk/src/router/RouterApps.ts +++ b/typescript/sdk/src/router/RouterApps.ts @@ -9,16 +9,14 @@ import { promiseObjAll, } from '@hyperlane-xyz/utils'; -import { HyperlaneApp } from '../app/HyperlaneApp'; +import { HyperlaneApp } from '../app/HyperlaneApp.js'; import { HyperlaneContracts, HyperlaneContractsMap, HyperlaneFactories, -} from '../contracts/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap, ChainName } from '../types'; - -export { Router } from '@hyperlane-xyz/core'; +} from '../contracts/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap, ChainName } from '../types.js'; export abstract class RouterApp< Factories extends HyperlaneFactories, diff --git a/typescript/sdk/src/router/adapters/EvmRouterAdapter.ts b/typescript/sdk/src/router/adapters/EvmRouterAdapter.ts index 1a39d96e3..a47bd2776 100644 --- a/typescript/sdk/src/router/adapters/EvmRouterAdapter.ts +++ b/typescript/sdk/src/router/adapters/EvmRouterAdapter.ts @@ -6,11 +6,11 @@ import { } from '@hyperlane-xyz/core'; import { Address, Domain, bytes32ToAddress } from '@hyperlane-xyz/utils'; -import { BaseEvmAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; +import { BaseEvmAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; -import { IGasRouterAdapter, IRouterAdapter } from './types'; +import { IGasRouterAdapter, IRouterAdapter } from './types.js'; export class EvmRouterAdapter extends BaseEvmAdapter implements IRouterAdapter { constructor( diff --git a/typescript/sdk/src/router/adapters/SealevelRouterAdapter.ts b/typescript/sdk/src/router/adapters/SealevelRouterAdapter.ts index a5ceed5bd..5a7f1c0b9 100644 --- a/typescript/sdk/src/router/adapters/SealevelRouterAdapter.ts +++ b/typescript/sdk/src/router/adapters/SealevelRouterAdapter.ts @@ -2,11 +2,11 @@ import { PublicKey } from '@solana/web3.js'; import { Address, Domain } from '@hyperlane-xyz/utils'; -import { BaseSealevelAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; +import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; -import { IGasRouterAdapter, IRouterAdapter } from './types'; +import { IGasRouterAdapter, IRouterAdapter } from './types.js'; export class SealevelRouterAdapter extends BaseSealevelAdapter diff --git a/typescript/sdk/src/router/adapters/types.ts b/typescript/sdk/src/router/adapters/types.ts index 3384d25f3..b6834c838 100644 --- a/typescript/sdk/src/router/adapters/types.ts +++ b/typescript/sdk/src/router/adapters/types.ts @@ -1,7 +1,7 @@ import { Address, Domain } from '@hyperlane-xyz/utils'; -import { BaseAppAdapter } from '../../app/MultiProtocolApp'; -import { ChainName } from '../../types'; +import { BaseAppAdapter } from '../../app/MultiProtocolApp.js'; +import { ChainName } from '../../types.js'; export interface IRouterAdapter extends BaseAppAdapter { interchainSecurityModule(): Promise

; diff --git a/typescript/sdk/src/router/types.ts b/typescript/sdk/src/router/types.ts index 9dd5e86ce..ff5900225 100644 --- a/typescript/sdk/src/router/types.ts +++ b/typescript/sdk/src/router/types.ts @@ -6,10 +6,10 @@ import { } from '@hyperlane-xyz/core'; import type { Address } from '@hyperlane-xyz/utils'; -import { HyperlaneFactories } from '../contracts/types'; -import { UpgradeConfig } from '../deploy/proxy'; -import { CheckerViolation, OwnableConfig } from '../deploy/types'; -import { IsmConfig } from '../ism/types'; +import { HyperlaneFactories } from '../contracts/types.js'; +import { UpgradeConfig } from '../deploy/proxy.js'; +import { CheckerViolation, OwnableConfig } from '../deploy/types.js'; +import { IsmConfig } from '../ism/types.js'; export type RouterAddress = { router: Address; diff --git a/typescript/sdk/src/test/metadata-check.ts b/typescript/sdk/src/test/metadata-check.ts index 590d239c7..7ed52f5d7 100644 --- a/typescript/sdk/src/test/metadata-check.ts +++ b/typescript/sdk/src/test/metadata-check.ts @@ -3,10 +3,10 @@ import { ethers } from 'ethers'; import { Address, ProtocolType } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { CoreChainName, TestChains } from '../consts/chains'; -import { isBlockExplorerHealthy, isRpcHealthy } from '../metadata/health'; -import { ChainMap } from '../types'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { CoreChainName, TestChains } from '../consts/chains.js'; +import { isBlockExplorerHealthy, isRpcHealthy } from '../metadata/health.js'; +import { ChainMap } from '../types.js'; const PROTOCOL_TO_ADDRESS: Record = { [ProtocolType.Ethereum]: ethers.constants.AddressZero, diff --git a/typescript/sdk/src/test/testUtils.ts b/typescript/sdk/src/test/testUtils.ts index 020017adf..22ce7eaca 100644 --- a/typescript/sdk/src/test/testUtils.ts +++ b/typescript/sdk/src/test/testUtils.ts @@ -2,22 +2,22 @@ import { BigNumber, ethers } from 'ethers'; import { Address, exclude, objMap } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { HyperlaneContractsMap } from '../contracts/types'; -import { CoreFactories } from '../core/contracts'; -import { CoreConfig } from '../core/types'; -import { IgpFactories } from '../gas/contracts'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { HyperlaneContractsMap } from '../contracts/types.js'; +import { CoreFactories } from '../core/contracts.js'; +import { CoreConfig } from '../core/types.js'; +import { IgpFactories } from '../gas/contracts.js'; import { CoinGeckoInterface, CoinGeckoResponse, CoinGeckoSimpleInterface, CoinGeckoSimplePriceParams, -} from '../gas/token-prices'; -import { IgpConfig } from '../gas/types'; -import { HookType } from '../hook/types'; -import { IsmType } from '../ism/types'; -import { RouterConfig } from '../router/types'; -import { ChainMap, ChainName } from '../types'; +} from '../gas/token-prices.js'; +import { IgpConfig } from '../gas/types.js'; +import { HookType } from '../hook/types.js'; +import { IsmType } from '../ism/types.js'; +import { RouterConfig } from '../router/types.js'; +import { ChainMap, ChainName } from '../types.js'; export function randomInt(max: number, min = 0): number { return Math.floor(Math.random() * (max - min)) + min; diff --git a/typescript/sdk/src/token/IToken.ts b/typescript/sdk/src/token/IToken.ts index 943d3881a..28321597c 100644 --- a/typescript/sdk/src/token/IToken.ts +++ b/typescript/sdk/src/token/IToken.ts @@ -2,17 +2,20 @@ import { z } from 'zod'; import { Address, Numberish, ProtocolType } from '@hyperlane-xyz/utils'; -import { ZChainName, ZUint } from '../metadata/customZodTypes'; -import type { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; -import type { ChainName } from '../types'; +import { ZChainName, ZUint } from '../metadata/customZodTypes.js'; +import type { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; +import type { ChainName } from '../types.js'; -import type { TokenAmount } from './TokenAmount'; +import type { TokenAmount } from './TokenAmount.js'; import { type TokenConnection, TokenConnectionConfigSchema, -} from './TokenConnection'; -import { TokenStandard } from './TokenStandard'; -import type { IHypTokenAdapter, ITokenAdapter } from './adapters/ITokenAdapter'; +} from './TokenConnection.js'; +import { TokenStandard } from './TokenStandard.js'; +import type { + IHypTokenAdapter, + ITokenAdapter, +} from './adapters/ITokenAdapter.js'; export const TokenConfigSchema = z.object({ chainName: ZChainName.describe( diff --git a/typescript/sdk/src/token/Token.test.ts b/typescript/sdk/src/token/Token.test.ts index d961e76db..ebac4bbd6 100644 --- a/typescript/sdk/src/token/Token.test.ts +++ b/typescript/sdk/src/token/Token.test.ts @@ -4,13 +4,13 @@ import { ethers } from 'ethers'; import { Address, ProtocolType } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../consts/chainMetadata'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; -import { TokenArgs } from './IToken'; -import { Token } from './Token'; -import { TokenStandard } from './TokenStandard'; +import { TokenArgs } from './IToken.js'; +import { Token } from './Token.js'; +import { TokenStandard } from './TokenStandard.js'; // null values represent TODOs here, ideally all standards should be tested const STANDARD_TO_TOKEN: Record = { diff --git a/typescript/sdk/src/token/Token.ts b/typescript/sdk/src/token/Token.ts index 6603644dc..7ddc870e5 100644 --- a/typescript/sdk/src/token/Token.ts +++ b/typescript/sdk/src/token/Token.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-empty-interface */ +/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ import { MsgTransferEncodeObject } from '@cosmjs/stargate'; import { @@ -9,13 +9,13 @@ import { eqAddress, } from '@hyperlane-xyz/utils'; -import { ChainMetadata } from '../metadata/chainMetadataTypes'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; -import { ChainName } from '../types'; +import { ChainMetadata } from '../metadata/chainMetadataTypes.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; +import { ChainName } from '../types.js'; -import type { IToken, TokenArgs } from './IToken'; -import { TokenAmount } from './TokenAmount'; -import { TokenConnection, TokenConnectionType } from './TokenConnection'; +import type { IToken, TokenArgs } from './IToken.js'; +import { TokenAmount } from './TokenAmount.js'; +import { TokenConnection, TokenConnectionType } from './TokenConnection.js'; import { PROTOCOL_TO_NATIVE_STANDARD, TOKEN_COLLATERALIZED_STANDARDS, @@ -24,34 +24,37 @@ import { TOKEN_NFT_STANDARDS, TOKEN_STANDARD_TO_PROTOCOL, TokenStandard, -} from './TokenStandard'; +} from './TokenStandard.js'; import { CwHypCollateralAdapter, CwHypNativeAdapter, CwHypSyntheticAdapter, CwNativeTokenAdapter, CwTokenAdapter, -} from './adapters/CosmWasmTokenAdapter'; +} from './adapters/CosmWasmTokenAdapter.js'; import { CosmIbcToWarpTokenAdapter, CosmIbcTokenAdapter, CosmNativeTokenAdapter, -} from './adapters/CosmosTokenAdapter'; +} from './adapters/CosmosTokenAdapter.js'; import { EvmHypCollateralAdapter, EvmHypNativeAdapter, EvmHypSyntheticAdapter, EvmNativeTokenAdapter, EvmTokenAdapter, -} from './adapters/EvmTokenAdapter'; -import type { IHypTokenAdapter, ITokenAdapter } from './adapters/ITokenAdapter'; +} from './adapters/EvmTokenAdapter.js'; +import type { + IHypTokenAdapter, + ITokenAdapter, +} from './adapters/ITokenAdapter.js'; import { SealevelHypCollateralAdapter, SealevelHypNativeAdapter, SealevelHypSyntheticAdapter, SealevelNativeTokenAdapter, SealevelTokenAdapter, -} from './adapters/SealevelTokenAdapter'; +} from './adapters/SealevelTokenAdapter.js'; // Declaring the interface in addition to class allows // Typescript to infer the members vars from TokenArgs diff --git a/typescript/sdk/src/token/TokenAmount.test.ts b/typescript/sdk/src/token/TokenAmount.test.ts index e4f154275..56f15a8d8 100644 --- a/typescript/sdk/src/token/TokenAmount.test.ts +++ b/typescript/sdk/src/token/TokenAmount.test.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { ethers } from 'ethers'; -import { chainMetadata } from '../consts/chainMetadata'; -import { Chains } from '../consts/chains'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { Chains } from '../consts/chains.js'; -import { Token } from './Token'; -import { TokenAmount } from './TokenAmount'; -import { TokenStandard } from './TokenStandard'; +import { Token } from './Token.js'; +import { TokenAmount } from './TokenAmount.js'; +import { TokenStandard } from './TokenStandard.js'; const token1 = new Token({ chainName: Chains.ethereum, diff --git a/typescript/sdk/src/token/TokenAmount.ts b/typescript/sdk/src/token/TokenAmount.ts index 2f3fe63da..76536dffa 100644 --- a/typescript/sdk/src/token/TokenAmount.ts +++ b/typescript/sdk/src/token/TokenAmount.ts @@ -1,6 +1,6 @@ import { Numberish, fromWei } from '@hyperlane-xyz/utils'; -import type { IToken } from './IToken'; +import type { IToken } from './IToken.js'; export class TokenAmount { public readonly amount: bigint; diff --git a/typescript/sdk/src/token/TokenConnection.ts b/typescript/sdk/src/token/TokenConnection.ts index bd743e9d8..44bedc97f 100644 --- a/typescript/sdk/src/token/TokenConnection.ts +++ b/typescript/sdk/src/token/TokenConnection.ts @@ -2,10 +2,10 @@ import { z } from 'zod'; import { Address, ProtocolType, assert } from '@hyperlane-xyz/utils'; -import { ZChainName } from '../metadata/customZodTypes'; -import { ChainName } from '../types'; +import { ZChainName } from '../metadata/customZodTypes.js'; +import { ChainName } from '../types.js'; -import type { IToken } from './IToken'; +import type { IToken } from './IToken.js'; export enum TokenConnectionType { Hyperlane = 'hyperlane', diff --git a/typescript/sdk/src/token/TokenStandard.ts b/typescript/sdk/src/token/TokenStandard.ts index 95f8f7ef0..31a31721e 100644 --- a/typescript/sdk/src/token/TokenStandard.ts +++ b/typescript/sdk/src/token/TokenStandard.ts @@ -3,9 +3,9 @@ import { ProtocolType, objMap } from '@hyperlane-xyz/utils'; import { PROTOCOL_TO_DEFAULT_PROVIDER_TYPE, ProviderType, -} from '../providers/ProviderType'; +} from '../providers/ProviderType.js'; -import { TokenType } from './config'; +import { TokenType } from './config.js'; export enum TokenStandard { // EVM diff --git a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.test.ts b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.test.ts index dddb2c3a4..7c8ce2ac4 100644 --- a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.test.ts +++ b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.test.ts @@ -13,16 +13,16 @@ import { Tendermint37Client } from '@cosmjs/tendermint-rpc'; import { Address } from '@hyperlane-xyz/utils'; -import { chainMetadata } from '../../consts/chainMetadata'; -import { Chains } from '../../consts/chains'; -import { CosmWasmCoreAdapter } from '../../core/adapters/CosmWasmCoreAdapter'; +import { chainMetadata } from '../../consts/chainMetadata.js'; +import { Chains } from '../../consts/chains.js'; +import { CosmWasmCoreAdapter } from '../../core/adapters/CosmWasmCoreAdapter.js'; import { MailboxResponse, QueryMsg as MerkleQuery, OwnerResponse, -} from '../../cw-types/HookMerkle.types'; -import { CosmWasmMultisigAdapter } from '../../ism/adapters/CosmWasmMultisigAdapter'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; +} from '../../cw-types/HookMerkle.types.js'; +import { CosmWasmMultisigAdapter } from '../../ism/adapters/CosmWasmMultisigAdapter.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; const neutronAddresses = { mailbox: 'neutron1sjzzd4gwkggy6hrrs8kxxatexzcuz3jecsxm3wqgregkulzj8r7qlnuef4', diff --git a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts index 6432b4cf2..9ee5fba38 100644 --- a/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/CosmWasmTokenAdapter.ts @@ -9,14 +9,14 @@ import { strip0x, } from '@hyperlane-xyz/utils'; -import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; +import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp.js'; import { BalanceResponse, ExecuteMsg as Cw20Execute, QueryMsg as Cw20Query, TokenInfoResponse, -} from '../../cw-types/Cw20Base.types'; -import { QuoteDispatchResponse } from '../../cw-types/Mailbox.types'; +} from '../../cw-types/Cw20Base.types.js'; +import { QuoteDispatchResponse } from '../../cw-types/Mailbox.types.js'; import { DomainsResponse, InterchainSecurityModuleResponse, @@ -27,10 +27,10 @@ import { TokenTypeResponse, ExecuteMsg as WarpCw20Execute, QueryMsg as WarpCw20Query, -} from '../../cw-types/WarpCw20.types'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; -import { ERC20Metadata } from '../config'; +} from '../../cw-types/WarpCw20.types.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; +import { ERC20Metadata } from '../config.js'; import { IHypTokenAdapter, @@ -38,7 +38,7 @@ import { InterchainGasQuote, TransferParams, TransferRemoteParams, -} from './ITokenAdapter'; +} from './ITokenAdapter.js'; // Interacts with IBC denom tokens in CosmWasm export class CwNativeTokenAdapter diff --git a/typescript/sdk/src/token/adapters/CosmosTokenAdapter.ts b/typescript/sdk/src/token/adapters/CosmosTokenAdapter.ts index fb17ec491..de0bfd2ee 100644 --- a/typescript/sdk/src/token/adapters/CosmosTokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/CosmosTokenAdapter.ts @@ -3,19 +3,19 @@ import Long from 'long'; import { Address, Domain, assert } from '@hyperlane-xyz/utils'; -import { BaseCosmosAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; -import { MinimalTokenMetadata } from '../config'; +import { BaseCosmosAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; +import { MinimalTokenMetadata } from '../config.js'; -import { CwHypCollateralAdapter } from './CosmWasmTokenAdapter'; +import { CwHypCollateralAdapter } from './CosmWasmTokenAdapter.js'; import { IHypTokenAdapter, ITokenAdapter, InterchainGasQuote, TransferParams, TransferRemoteParams, -} from './ITokenAdapter'; +} from './ITokenAdapter.js'; const COSMOS_IBC_TRANSFER_TIMEOUT = 600_000; // 10 minutes diff --git a/typescript/sdk/src/token/adapters/EvmTokenAdapter.ts b/typescript/sdk/src/token/adapters/EvmTokenAdapter.ts index 34a62a7b1..72d801880 100644 --- a/typescript/sdk/src/token/adapters/EvmTokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/EvmTokenAdapter.ts @@ -18,10 +18,10 @@ import { strip0x, } from '@hyperlane-xyz/utils'; -import { BaseEvmAdapter } from '../../app/MultiProtocolApp'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; -import { MinimalTokenMetadata } from '../config'; +import { BaseEvmAdapter } from '../../app/MultiProtocolApp.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; +import { MinimalTokenMetadata } from '../config.js'; import { IHypTokenAdapter, @@ -29,7 +29,7 @@ import { InterchainGasQuote, TransferParams, TransferRemoteParams, -} from './ITokenAdapter'; +} from './ITokenAdapter.js'; // An estimate of the gas amount for a typical EVM token router transferRemote transaction // Computed by estimating on a few different chains, taking the max, and then adding ~50% padding @@ -237,7 +237,7 @@ export class EvmHypCollateralAdapter if (!this.wrappedTokenAddress) { this.wrappedTokenAddress = await this.collateralContract.wrappedToken(); } - return this.wrappedTokenAddress; + return this.wrappedTokenAddress!; } protected async getWrappedTokenAdapter(): Promise< diff --git a/typescript/sdk/src/token/adapters/ITokenAdapter.ts b/typescript/sdk/src/token/adapters/ITokenAdapter.ts index 4d2f64b4a..f5dfd906a 100644 --- a/typescript/sdk/src/token/adapters/ITokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/ITokenAdapter.ts @@ -1,6 +1,6 @@ import { Address, Domain, Numberish } from '@hyperlane-xyz/utils'; -import { MinimalTokenMetadata } from '../config'; +import { MinimalTokenMetadata } from '../config.js'; export interface TransferParams { weiAmountOrId: Numberish; diff --git a/typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts b/typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts index 50b965f85..a924bc92c 100644 --- a/typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts +++ b/typescript/sdk/src/token/adapters/SealevelTokenAdapter.ts @@ -23,17 +23,17 @@ import { isZeroishAddress, } from '@hyperlane-xyz/utils'; -import { BaseSealevelAdapter } from '../../app/MultiProtocolApp'; -import { SEALEVEL_SPL_NOOP_ADDRESS } from '../../consts/sealevel'; -import { SealevelOverheadIgpAdapter } from '../../gas/adapters/SealevelIgpAdapter'; -import { SealevelInterchainGasPaymasterType } from '../../gas/adapters/serialization'; -import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; -import { ChainName } from '../../types'; +import { BaseSealevelAdapter } from '../../app/MultiProtocolApp.js'; +import { SEALEVEL_SPL_NOOP_ADDRESS } from '../../consts/sealevel.js'; +import { SealevelOverheadIgpAdapter } from '../../gas/adapters/SealevelIgpAdapter.js'; +import { SealevelInterchainGasPaymasterType } from '../../gas/adapters/serialization.js'; +import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider.js'; +import { ChainName } from '../../types.js'; import { SealevelAccountDataWrapper, SealevelInstructionWrapper, -} from '../../utils/sealevelSerialization'; -import { MinimalTokenMetadata } from '../config'; +} from '../../utils/sealevelSerialization.js'; +import { MinimalTokenMetadata } from '../config.js'; import { IHypTokenAdapter, @@ -41,14 +41,14 @@ import { InterchainGasQuote, TransferParams, TransferRemoteParams, -} from './ITokenAdapter'; +} from './ITokenAdapter.js'; import { SealevelHypTokenInstruction, SealevelHyperlaneTokenData, SealevelHyperlaneTokenDataSchema, SealevelTransferRemoteInstruction, SealevelTransferRemoteSchema, -} from './serialization'; +} from './serialization.js'; // author @tkporter @jmrossy // Interacts with native currencies diff --git a/typescript/sdk/src/token/adapters/serialization.ts b/typescript/sdk/src/token/adapters/serialization.ts index 822ab5b3f..e48817b9c 100644 --- a/typescript/sdk/src/token/adapters/serialization.ts +++ b/typescript/sdk/src/token/adapters/serialization.ts @@ -5,12 +5,12 @@ import { Domain } from '@hyperlane-xyz/utils'; import { SealevelInterchainGasPaymasterConfig, SealevelInterchainGasPaymasterConfigSchema, -} from '../../gas/adapters/serialization'; +} from '../../gas/adapters/serialization.js'; import { SealevelAccountDataWrapper, SealevelInstructionWrapper, getSealevelAccountDataSchema, -} from '../../utils/sealevelSerialization'; +} from '../../utils/sealevelSerialization.js'; /** * Hyperlane Token Borsh Schema diff --git a/typescript/sdk/src/token/app.ts b/typescript/sdk/src/token/app.ts index e032c09e8..9ea8141fa 100644 --- a/typescript/sdk/src/token/app.ts +++ b/typescript/sdk/src/token/app.ts @@ -1,20 +1,20 @@ import { TokenRouter } from '@hyperlane-xyz/core'; import { objKeys } from '@hyperlane-xyz/utils'; -import { appFromAddressesMapHelper } from '../contracts/contracts'; +import { appFromAddressesMapHelper } from '../contracts/contracts.js'; import { HyperlaneAddressesMap, HyperlaneContracts, HyperlaneContractsMap, -} from '../contracts/types'; -import { MultiProvider } from '../providers/MultiProvider'; -import { GasRouterApp } from '../router/RouterApps'; +} from '../contracts/types.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { GasRouterApp } from '../router/RouterApps.js'; import { HypERC20Factories, hypERC20Tokenfactories, hypERC20factories, -} from './contracts'; +} from './contracts.js'; export class HypERC20App extends GasRouterApp { constructor( diff --git a/typescript/sdk/src/token/checker.ts b/typescript/sdk/src/token/checker.ts index c9109006b..9b0e366f8 100644 --- a/typescript/sdk/src/token/checker.ts +++ b/typescript/sdk/src/token/checker.ts @@ -3,11 +3,11 @@ import { BigNumber } from 'ethers'; import { ERC20, ERC20__factory, HypERC20Collateral } from '@hyperlane-xyz/core'; import { eqAddress } from '@hyperlane-xyz/utils'; -import { TokenMismatchViolation } from '../deploy/types'; -import { HyperlaneRouterChecker } from '../router/HyperlaneRouterChecker'; -import { ChainName } from '../types'; +import { TokenMismatchViolation } from '../deploy/types.js'; +import { HyperlaneRouterChecker } from '../router/HyperlaneRouterChecker.js'; +import { ChainName } from '../types.js'; -import { HypERC20App } from './app'; +import { HypERC20App } from './app.js'; import { ERC20RouterConfig, HypERC20Config, @@ -15,8 +15,8 @@ import { isCollateralConfig, isNativeConfig, isSyntheticConfig, -} from './config'; -import { HypERC20Factories } from './contracts'; +} from './config.js'; +import { HypERC20Factories } from './contracts.js'; export class HypERC20Checker extends HyperlaneRouterChecker< HypERC20Factories, diff --git a/typescript/sdk/src/token/config.ts b/typescript/sdk/src/token/config.ts index d8c0cc561..d1ffc9d69 100644 --- a/typescript/sdk/src/token/config.ts +++ b/typescript/sdk/src/token/config.ts @@ -1,6 +1,6 @@ import { ethers } from 'ethers'; -import { GasRouterConfig } from '../router/types'; +import { GasRouterConfig } from '../router/types.js'; export enum TokenType { synthetic = 'synthetic', diff --git a/typescript/sdk/src/token/contracts.ts b/typescript/sdk/src/token/contracts.ts index 4abe10956..766e4ca75 100644 --- a/typescript/sdk/src/token/contracts.ts +++ b/typescript/sdk/src/token/contracts.ts @@ -12,9 +12,9 @@ import { HypNative__factory, } from '@hyperlane-xyz/core'; -import { proxiedFactories } from '../router/types'; +import { proxiedFactories } from '../router/types.js'; -import { TokenType } from './config'; +import { TokenType } from './config.js'; export const hypERC20contracts = { [TokenType.fastCollateral]: 'FastHypERC20Collateral', diff --git a/typescript/sdk/src/token/deploy.hardhat-test.ts b/typescript/sdk/src/token/deploy.hardhat-test.ts index bc1037578..4bf3af167 100644 --- a/typescript/sdk/src/token/deploy.hardhat-test.ts +++ b/typescript/sdk/src/token/deploy.hardhat-test.ts @@ -1,17 +1,17 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { ethers } from 'hardhat'; +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers.js'; +import hre from 'hardhat'; import { objMap } from '@hyperlane-xyz/utils'; -import { TestCoreApp } from '../core/TestCoreApp'; -import { TestCoreDeployer } from '../core/TestCoreDeployer'; -import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../providers/MultiProvider'; -import { ChainMap } from '../types'; +import { TestCoreApp } from '../core/TestCoreApp.js'; +import { TestCoreDeployer } from '../core/TestCoreDeployer.js'; +import { HyperlaneProxyFactoryDeployer } from '../deploy/HyperlaneProxyFactoryDeployer.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { ChainMap } from '../types.js'; -import { ERC20RouterConfig, HypERC20Config, TokenType } from './config'; -import { HypERC20Deployer } from './deploy'; +import { ERC20RouterConfig, HypERC20Config, TokenType } from './config.js'; +import { HypERC20Deployer } from './deploy.js'; describe('TokenDeployer', async () => { let signer: SignerWithAddress; @@ -21,7 +21,7 @@ describe('TokenDeployer', async () => { let config: ChainMap; before(async () => { - [signer] = await ethers.getSigners(); + [signer] = await hre.ethers.getSigners(); multiProvider = MultiProvider.createTestMultiProvider({ signer }); const ismFactoryDeployer = new HyperlaneProxyFactoryDeployer(multiProvider); const factories = await ismFactoryDeployer.deploy( diff --git a/typescript/sdk/src/token/deploy.ts b/typescript/sdk/src/token/deploy.ts index f72ab12e4..1d28f8da1 100644 --- a/typescript/sdk/src/token/deploy.ts +++ b/typescript/sdk/src/token/deploy.ts @@ -9,13 +9,13 @@ import { } from '@hyperlane-xyz/core'; import { objKeys, objMap, rootLogger } from '@hyperlane-xyz/utils'; -import { HyperlaneContracts } from '../contracts/types'; -import { ContractVerifier } from '../deploy/verify/ContractVerifier'; -import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory'; -import { MultiProvider } from '../providers/MultiProvider'; -import { GasRouterDeployer } from '../router/GasRouterDeployer'; -import { GasConfig, RouterConfig } from '../router/types'; -import { ChainMap, ChainName } from '../types'; +import { HyperlaneContracts } from '../contracts/types.js'; +import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; +import { HyperlaneIsmFactory } from '../ism/HyperlaneIsmFactory.js'; +import { MultiProvider } from '../providers/MultiProvider.js'; +import { GasRouterDeployer } from '../router/GasRouterDeployer.js'; +import { GasConfig, RouterConfig } from '../router/types.js'; +import { ChainMap, ChainName } from '../types.js'; import { CollateralConfig, @@ -35,7 +35,7 @@ import { isSyntheticConfig, isTokenMetadata, isUriConfig, -} from './config'; +} from './config.js'; import { HypERC20Factories, HypERC721Factories, @@ -44,7 +44,7 @@ import { hypERC20factories, hypERC721contracts, hypERC721factories, -} from './contracts'; +} from './contracts.js'; export class HypERC20Deployer extends GasRouterDeployer< ERC20RouterConfig, diff --git a/typescript/sdk/src/utils/MultiGeneric.ts b/typescript/sdk/src/utils/MultiGeneric.ts index 93f0b93fe..35c7e66a8 100644 --- a/typescript/sdk/src/utils/MultiGeneric.ts +++ b/typescript/sdk/src/utils/MultiGeneric.ts @@ -1,5 +1,5 @@ -import { AllDeprecatedChains } from '../consts/chains'; -import { ChainMap, ChainName } from '../types'; +import { AllDeprecatedChains } from '../consts/chains.js'; +import { ChainMap, ChainName } from '../types.js'; // Generalized map container for chain name to some value export class MultiGeneric { diff --git a/typescript/sdk/src/utils/filter.ts b/typescript/sdk/src/utils/filter.ts index d2fc8392e..2986a0890 100644 --- a/typescript/sdk/src/utils/filter.ts +++ b/typescript/sdk/src/utils/filter.ts @@ -1,4 +1,4 @@ -import { ChainMap } from '../types'; +import { ChainMap } from '../types.js'; export function filterByChains( owners: ChainMap, diff --git a/typescript/sdk/src/utils/ism.ts b/typescript/sdk/src/utils/ism.ts index 59a4b2ed3..7cd35e13f 100644 --- a/typescript/sdk/src/utils/ism.ts +++ b/typescript/sdk/src/utils/ism.ts @@ -1,4 +1,4 @@ -import multisigIsmVerifyCosts from '../consts/multisigIsmVerifyCosts.json'; +import multisigIsmVerifyCosts from '../consts/multisigIsmVerifyCosts.json' assert { type: 'json' }; export function multisigIsmVerificationCost(m: number, n: number): number { if ( diff --git a/typescript/sdk/src/utils/wagmi.ts b/typescript/sdk/src/utils/wagmi.ts index 43d1589fd..b393bd3ea 100644 --- a/typescript/sdk/src/utils/wagmi.ts +++ b/typescript/sdk/src/utils/wagmi.ts @@ -2,12 +2,12 @@ import type { Chain as WagmiChain } from '@wagmi/chains'; import { ProtocolType, objFilter, objMap } from '@hyperlane-xyz/utils'; -import { chainMetadata, etherToken } from '../consts/chainMetadata'; +import { chainMetadata, etherToken } from '../consts/chainMetadata.js'; import { ChainMetadata, getChainIdNumber, -} from '../metadata/chainMetadataTypes'; -import type { ChainMap } from '../types'; +} from '../metadata/chainMetadataTypes.js'; +import type { ChainMap } from '../types.js'; // For convenient use in wagmi-based apps export const wagmiChainMetadata: ChainMap = objMap( diff --git a/typescript/sdk/src/warp/WarpCore.test.ts b/typescript/sdk/src/warp/WarpCore.test.ts index bf792cf17..fb8157310 100644 --- a/typescript/sdk/src/warp/WarpCore.test.ts +++ b/typescript/sdk/src/warp/WarpCore.test.ts @@ -1,20 +1,19 @@ import { expect } from 'chai'; import fs from 'fs'; -import path from 'path'; import sinon from 'sinon'; import { parse as yamlParse } from 'yaml'; -import { chainMetadata } from '../consts/chainMetadata'; -import { Chains } from '../consts/chains'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; -import { ProviderType } from '../providers/ProviderType'; -import { Token } from '../token/Token'; -import { TokenStandard } from '../token/TokenStandard'; -import { InterchainGasQuote } from '../token/adapters/ITokenAdapter'; -import { ChainName } from '../types'; +import { chainMetadata } from '../consts/chainMetadata.js'; +import { Chains } from '../consts/chains.js'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; +import { ProviderType } from '../providers/ProviderType.js'; +import { Token } from '../token/Token.js'; +import { TokenStandard } from '../token/TokenStandard.js'; +import { InterchainGasQuote } from '../token/adapters/ITokenAdapter.js'; +import { ChainName } from '../types.js'; -import { WarpCore } from './WarpCore'; -import { WarpTxCategory } from './types'; +import { WarpCore } from './WarpCore.js'; +import { WarpTxCategory } from './types.js'; const MOCK_LOCAL_QUOTE = { gasUnits: 2_000n, gasPrice: 100, fee: 200_000n }; const MOCK_INTERCHAIN_QUOTE = { amount: 20_000n }; @@ -43,10 +42,7 @@ describe('WarpCore', () => { Token.FromChainMetadataNativeToken(chainMetadata[Chains.ethereum]), ]); const exampleConfig = yamlParse( - fs.readFileSync( - path.join(__dirname, './example-warp-core-config.yaml'), - 'utf-8', - ), + fs.readFileSync('./src/warp/example-warp-core-config.yaml', 'utf-8'), ); const fromConfig = WarpCore.FromConfig(multiProvider, exampleConfig); expect(fromArgs).to.be.instanceOf(WarpCore); diff --git a/typescript/sdk/src/warp/WarpCore.ts b/typescript/sdk/src/warp/WarpCore.ts index 3354cdf25..fd205371f 100644 --- a/typescript/sdk/src/warp/WarpCore.ts +++ b/typescript/sdk/src/warp/WarpCore.ts @@ -12,21 +12,21 @@ import { rootLogger, } from '@hyperlane-xyz/utils'; -import { MultiProtocolProvider } from '../providers/MultiProtocolProvider'; +import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; import { TransactionFeeEstimate, estimateTransactionFeeEthersV5ForGasUnits, -} from '../providers/transactionFeeEstimators'; -import { IToken } from '../token/IToken'; -import { Token } from '../token/Token'; -import { TokenAmount } from '../token/TokenAmount'; -import { parseTokenConnectionId } from '../token/TokenConnection'; +} from '../providers/transactionFeeEstimators.js'; +import { IToken } from '../token/IToken.js'; +import { Token } from '../token/Token.js'; +import { TokenAmount } from '../token/TokenAmount.js'; +import { parseTokenConnectionId } from '../token/TokenConnection.js'; import { TOKEN_COLLATERALIZED_STANDARDS, TOKEN_STANDARD_TO_PROVIDER_TYPE, -} from '../token/TokenStandard'; -import { EVM_TRANSFER_REMOTE_GAS_ESTIMATE } from '../token/adapters/EvmTokenAdapter'; -import { ChainName, ChainNameOrId } from '../types'; +} from '../token/TokenStandard.js'; +import { EVM_TRANSFER_REMOTE_GAS_ESTIMATE } from '../token/adapters/EvmTokenAdapter.js'; +import { ChainName, ChainNameOrId } from '../types.js'; import { FeeConstantConfig, @@ -35,7 +35,7 @@ import { WarpCoreFeeEstimate, WarpTxCategory, WarpTypedTransaction, -} from './types'; +} from './types.js'; export interface WarpCoreOptions { logger?: Logger; diff --git a/typescript/sdk/src/warp/types.ts b/typescript/sdk/src/warp/types.ts index a8eab762c..e5db231af 100644 --- a/typescript/sdk/src/warp/types.ts +++ b/typescript/sdk/src/warp/types.ts @@ -1,10 +1,10 @@ import { z } from 'zod'; -import { ZChainName } from '../metadata/customZodTypes'; -import type { TypedTransaction } from '../providers/ProviderType'; -import { TokenConfigSchema } from '../token/IToken'; -import type { TokenAmount } from '../token/TokenAmount'; -import type { ChainName } from '../types'; +import { ZChainName } from '../metadata/customZodTypes.js'; +import type { TypedTransaction } from '../providers/ProviderType.js'; +import { TokenConfigSchema } from '../token/IToken.js'; +import type { TokenAmount } from '../token/TokenAmount.js'; +import type { ChainName } from '../types.js'; /** * Configuration used for instantiating a WarpCore diff --git a/typescript/sdk/tsconfig.json b/typescript/sdk/tsconfig.json index 72d5a0462..8b20eb5f5 100644 --- a/typescript/sdk/tsconfig.json +++ b/typescript/sdk/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "outDir": "./dist/", "rootDir": "./src/", - "resolveJsonModule": true }, "include": ["./src/**/*.ts", "./src/*.d.ts"] } diff --git a/typescript/utils/.mocharc.json b/typescript/utils/.mocharc.json index e516df998..2a414eb58 100644 --- a/typescript/utils/.mocharc.json +++ b/typescript/utils/.mocharc.json @@ -1,3 +1,3 @@ { - "require": ["ts-node/register"] + "import": ["tsx"] } diff --git a/typescript/utils/README.md b/typescript/utils/README.md new file mode 100644 index 000000000..a182829c8 --- /dev/null +++ b/typescript/utils/README.md @@ -0,0 +1,20 @@ +# Hyperlane Utils + +A collection of various utilities and types for building applications with Hyperlane. +Typically not used directly but through the [Hyperlane SDK](https://www.npmjs.com/package/@hyperlane-xyz/sdk) instead. + +## Install + +```bash +# Install with NPM +npm install @hyperlane-xyz/utils + +# Or with Yarn +yarn add @hyperlane-xyz/utils +``` + +Note, this package uses [ESM Modules](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) + +## License + +Apache 2.0 diff --git a/typescript/utils/package.json b/typescript/utils/package.json index 93b75ac11..46b6bf948 100644 --- a/typescript/utils/package.json +++ b/typescript/utils/package.json @@ -14,18 +14,17 @@ "chai": "^4.3.6", "mocha": "^10.2.0", "prettier": "^2.8.8", - "typescript": "5.1.6" + "typescript": "5.3.3" }, "homepage": "https://www.hyperlane.xyz", + "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "keywords": [ "Hyperlane", "Utilities", "Typescript" ], "license": "Apache-2.0", - "main": "dist/index.js", "prepublish": "yarn build", - "repository": "https://github.com/hyperlane-xyz/hyperlane-monorepo", "scripts": { "build": "tsc", "clean": "rm -rf ./dist", @@ -34,9 +33,14 @@ "test": "mocha --config .mocharc.json './src/**/*.test.ts'", "test:ci": "yarn test" }, - "sideEffects": false, - "types": "dist/index.d.ts", + "type": "module", + "exports": "./dist/index.js", + "types": "./dist/index.d.ts", "files": [ "/dist" - ] + ], + "sideEffects": false, + "engines": { + "node": ">=16" + } } diff --git a/typescript/utils/src/addresses.test.ts b/typescript/utils/src/addresses.test.ts index 0d3e01d4d..d25e33cf8 100644 --- a/typescript/utils/src/addresses.test.ts +++ b/typescript/utils/src/addresses.test.ts @@ -4,8 +4,8 @@ import { addressToBytes, bytesToProtocolAddress, isZeroishAddress, -} from './addresses'; -import { ProtocolType } from './types'; +} from './addresses.js'; +import { ProtocolType } from './types.js'; const ETH_ZERO_ADDR = '0x0000000000000000000000000000000000000000'; const ETH_NON_ZERO_ADDR = '0x0000000000000000000000000000000000000001'; diff --git a/typescript/utils/src/addresses.ts b/typescript/utils/src/addresses.ts index 86133cb63..88532464f 100644 --- a/typescript/utils/src/addresses.ts +++ b/typescript/utils/src/addresses.ts @@ -2,9 +2,9 @@ import { fromBech32, normalizeBech32, toBech32 } from '@cosmjs/encoding'; import { PublicKey } from '@solana/web3.js'; import { utils as ethersUtils } from 'ethers'; -import { isNullish } from './typeof'; -import { Address, HexString, ProtocolType } from './types'; -import { assert } from './validation'; +import { isNullish } from './typeof.js'; +import { Address, HexString, ProtocolType } from './types.js'; +import { assert } from './validation.js'; const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; const SEALEVEL_ADDRESS_REGEX = /^[a-zA-Z0-9]{36,44}$/; diff --git a/typescript/utils/src/amount.test.ts b/typescript/utils/src/amount.test.ts index 4ba6c9962..be70a6650 100644 --- a/typescript/utils/src/amount.test.ts +++ b/typescript/utils/src/amount.test.ts @@ -1,6 +1,11 @@ import { expect } from 'chai'; -import { eqAmountApproximate, fromWei, fromWeiRounded, toWei } from './amount'; +import { + eqAmountApproximate, + fromWei, + fromWeiRounded, + toWei, +} from './amount.js'; describe('fromWei', () => { it('parses and converts correctly', () => { diff --git a/typescript/utils/src/amount.ts b/typescript/utils/src/amount.ts index f46998230..02f6467dd 100644 --- a/typescript/utils/src/amount.ts +++ b/typescript/utils/src/amount.ts @@ -1,5 +1,5 @@ import { formatUnits, parseUnits } from '@ethersproject/units'; -import BigNumber from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; const DEFAULT_DISPLAY_DECIMALS = 4; const DEFAULT_TOKEN_DECIMALS = 18; diff --git a/typescript/utils/src/base64.ts b/typescript/utils/src/base64.ts index 0dc338b30..1d2ae02fa 100644 --- a/typescript/utils/src/base64.ts +++ b/typescript/utils/src/base64.ts @@ -1,4 +1,4 @@ -import { rootLogger } from './logging'; +import { rootLogger } from './logging.js'; export function toBase64(data: any): string | undefined { try { diff --git a/typescript/utils/src/big-numbers.test.ts b/typescript/utils/src/big-numbers.test.ts index 82efee036..31e5e481a 100644 --- a/typescript/utils/src/big-numbers.test.ts +++ b/typescript/utils/src/big-numbers.test.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; import { expect } from 'chai'; import { FixedNumber } from 'ethers'; @@ -10,7 +10,7 @@ import { isBigNumberish, isZeroish, mulBigAndFixed, -} from './big-numbers'; +} from './big-numbers.js'; describe('isBigNumberish', () => { const testCases = [ diff --git a/typescript/utils/src/big-numbers.ts b/typescript/utils/src/big-numbers.ts index 3a85e289b..fa20e0759 100644 --- a/typescript/utils/src/big-numbers.ts +++ b/typescript/utils/src/big-numbers.ts @@ -1,4 +1,4 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; import { FixedNumber } from 'ethers'; // Use toString(10) on bignumber.js to prevent ethers.js bigNumber error diff --git a/typescript/utils/src/checkpoints.ts b/typescript/utils/src/checkpoints.ts index e31318768..d83d54c68 100644 --- a/typescript/utils/src/checkpoints.ts +++ b/typescript/utils/src/checkpoints.ts @@ -5,7 +5,7 @@ import { S3Checkpoint, S3CheckpointWithId, SignatureLike, -} from './types'; +} from './types.js'; function isValidSignature(signature: any): signature is SignatureLike { return typeof signature === 'string' diff --git a/typescript/utils/src/domains.ts b/typescript/utils/src/domains.ts index 21327d951..021a76dc7 100644 --- a/typescript/utils/src/domains.ts +++ b/typescript/utils/src/domains.ts @@ -1,6 +1,6 @@ import { utils } from 'ethers'; -import { addressToBytes32 } from './addresses'; +import { addressToBytes32 } from './addresses.js'; export function domainHash(domain: number, merkle_tree_hook: string): string { return utils.solidityKeccak256( diff --git a/typescript/utils/index.ts b/typescript/utils/src/index.ts similarity index 72% rename from typescript/utils/index.ts rename to typescript/utils/src/index.ts index bf928ae29..4f6d0fd04 100644 --- a/typescript/utils/index.ts +++ b/typescript/utils/src/index.ts @@ -37,7 +37,7 @@ export { normalizeAddressSealevel, shortenAddress, strip0x, -} from './src/addresses'; +} from './addresses.js'; export { convertDecimals, eqAmountApproximate, @@ -45,8 +45,8 @@ export { fromWeiRounded, toWei, tryParseAmount, -} from './src/amount'; -export { chunk, exclude } from './src/arrays'; +} from './amount.js'; +export { chunk, exclude } from './arrays.js'; export { pollAsync, raceWithContext, @@ -54,9 +54,9 @@ export { runWithTimeout, sleep, timeout, -} from './src/async'; -export { base58ToBuffer, bufferToBase58, hexOrBase58ToHex } from './src/base58'; -export { fromBase64, toBase64 } from './src/base64'; +} from './async.js'; +export { base58ToBuffer, bufferToBase58, hexOrBase58ToHex } from './base58.js'; +export { fromBase64, toBase64 } from './base64.js'; export { BigNumberMax, BigNumberMin, @@ -65,16 +65,16 @@ export { isBigNumberish, isZeroish, mulBigAndFixed, -} from './src/big-numbers'; -export { formatCallData } from './src/calldata'; +} from './big-numbers.js'; +export { formatCallData } from './calldata.js'; export { isCheckpoint, isS3Checkpoint, isS3CheckpointWithId, -} from './src/checkpoints'; -export { domainHash } from './src/domains'; -export { safelyAccessEnvVar } from './src/env'; -export { canonizeId, evmId } from './src/ids'; +} from './checkpoints.js'; +export { domainHash } from './domains.js'; +export { safelyAccessEnvVar } from './env.js'; +export { canonizeId, evmId } from './ids.js'; export { LogFormat, LogLevel, @@ -85,13 +85,13 @@ export { getRootLogger, rootLogger, setRootLogger, -} from './src/logging'; -export { mean, median, stdDev, sum } from './src/math'; -export { formatMessage, messageId, parseMessage } from './src/messages'; +} from './logging.js'; +export { mean, median, stdDev, sum } from './math.js'; +export { formatMessage, messageId, parseMessage } from './messages.js'; export { formatLegacyMultisigIsmMetadata, parseLegacyMultisigIsmMetadata, -} from './src/multisig'; +} from './multisig.js'; export { ValueOf, arrayToObject, @@ -106,16 +106,16 @@ export { objMerge, pick, promiseObjAll, -} from './src/objects'; -export { difference, setEquality, symmetricDifference } from './src/sets'; +} from './objects.js'; +export { difference, setEquality, symmetricDifference } from './sets.js'; export { errorToString, sanitizeString, streamToString, toTitleCase, trimToLength, -} from './src/strings'; -export { isNullish, isNumeric } from './src/typeof'; +} from './strings.js'; +export { isNullish, isNumeric } from './typeof.js'; export { Address, AddressBytes32, @@ -138,6 +138,6 @@ export { S3CheckpointWithId, SignatureLike, TokenCaip19Id, -} from './src/types'; -export { assert } from './src/validation'; -export { BaseValidator } from './src/validator'; +} from './types.js'; +export { assert } from './validation.js'; +export { BaseValidator } from './validator.js'; diff --git a/typescript/utils/src/logging.ts b/typescript/utils/src/logging.ts index c5543ddaa..126b74e84 100644 --- a/typescript/utils/src/logging.ts +++ b/typescript/utils/src/logging.ts @@ -1,6 +1,6 @@ import { LevelWithSilent, Logger, pino } from 'pino'; -import { safelyAccessEnvVar } from './env'; +import { safelyAccessEnvVar } from './env.js'; // Level and format here should correspond with the agent options as much as possible // https://docs.hyperlane.xyz/docs/operate/config-reference#logfmt diff --git a/typescript/utils/src/messages.ts b/typescript/utils/src/messages.ts index e510754e9..2873edcdd 100644 --- a/typescript/utils/src/messages.ts +++ b/typescript/utils/src/messages.ts @@ -1,7 +1,7 @@ import { BigNumber, ethers, utils } from 'ethers'; -import { addressToBytes32 } from './addresses'; -import { Address, Domain, HexString, ParsedMessage } from './types'; +import { addressToBytes32 } from './addresses.js'; +import { Address, Domain, HexString, ParsedMessage } from './types.js'; /** * JS Implementation of solidity/contracts/libs/Message.sol#formatMessage diff --git a/typescript/utils/src/multisig.ts b/typescript/utils/src/multisig.ts index 334ef9ad9..c7a82b582 100644 --- a/typescript/utils/src/multisig.ts +++ b/typescript/utils/src/multisig.ts @@ -1,8 +1,8 @@ -import BigNumber from 'bignumber.js'; +import { BigNumber } from 'bignumber.js'; import { utils } from 'ethers'; -import { addressToBytes32 } from './addresses'; -import { ParsedLegacyMultisigIsmMetadata } from './types'; +import { addressToBytes32 } from './addresses.js'; +import { ParsedLegacyMultisigIsmMetadata } from './types.js'; export const parseLegacyMultisigIsmMetadata = ( metadata: string, diff --git a/typescript/utils/src/validator.ts b/typescript/utils/src/validator.ts index f30b6d5ee..e651fafa6 100644 --- a/typescript/utils/src/validator.ts +++ b/typescript/utils/src/validator.ts @@ -1,7 +1,13 @@ import { ethers } from 'ethers'; -import { domainHash } from './domains'; -import { Address, Checkpoint, Domain, HexString, SignatureLike } from './types'; +import { domainHash } from './domains.js'; +import { + Address, + Checkpoint, + Domain, + HexString, + SignatureLike, +} from './types.js'; /** * Utilities for validators to construct and verify checkpoints. diff --git a/typescript/utils/tsconfig.json b/typescript/utils/tsconfig.json index 057d76f65..36ba99b45 100644 --- a/typescript/utils/tsconfig.json +++ b/typescript/utils/tsconfig.json @@ -1,9 +1,9 @@ { + "extends": "../tsconfig.json", "compilerOptions": { "outDir": "./dist/", - "rootDir": "./" + "rootDir": "./src" }, "exclude": ["./node_modules/", "./dist/", "./tmp.ts"], - "extends": "../tsconfig.json", - "include": ["./index.ts", "./src/*.ts"] + "include": ["./src/*.ts"] } diff --git a/yarn.lock b/yarn.lock index c05c0f73f..b32d882f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,6 +5,13 @@ __metadata: version: 8 cacheKey: 10 +"@aashutoshrathi/word-wrap@npm:^1.2.3": + version: 1.2.6 + resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" + checksum: 6eebd12a5cd03cee38fcb915ef9f4ea557df6a06f642dfc7fe8eb4839eb5c9ca55a382f3604d52c14200b0c214c12af5e1f23d2a6d8e23ef2d016b105a9d6c0a + languageName: node + linkType: hard + "@adraffy/ens-normalize@npm:1.10.0": version: 1.10.0 resolution: "@adraffy/ens-normalize@npm:1.10.0" @@ -3744,7 +3751,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0": +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" dependencies: @@ -3755,34 +3762,34 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.4.0": - version: 4.5.1 - resolution: "@eslint-community/regexpp@npm:4.5.1" - checksum: e31e456d44e9bf98d59c8ac445549098e1a6d9c4e22053cad58e86a9f78a1e64104ef7f7f46255c442e0c878fe0e566ffba287787d070196c83510ef30d1d197 +"@eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": + version: 4.10.0 + resolution: "@eslint-community/regexpp@npm:4.10.0" + checksum: 8c36169c815fc5d726078e8c71a5b592957ee60d08c6470f9ce0187c8046af1a00afbda0a065cc40ff18d5d83f82aed9793c6818f7304a74a7488dc9f3ecbd42 languageName: node linkType: hard -"@eslint/eslintrc@npm:^2.0.3": - version: 2.0.3 - resolution: "@eslint/eslintrc@npm:2.0.3" +"@eslint/eslintrc@npm:^2.1.4": + version: 2.1.4 + resolution: "@eslint/eslintrc@npm:2.1.4" dependencies: ajv: "npm:^6.12.4" debug: "npm:^4.3.2" - espree: "npm:^9.5.2" + espree: "npm:^9.6.0" globals: "npm:^13.19.0" ignore: "npm:^5.2.0" import-fresh: "npm:^3.2.1" js-yaml: "npm:^4.1.0" minimatch: "npm:^3.1.2" strip-json-comments: "npm:^3.1.1" - checksum: 3508a9eb1a1cdf205f34648a993862b15c178669b71d6a9544787558b925ac689d8ddf3e598990156a17b708e79d3cb867fb45d5662908d14c1b10eaad858516 + checksum: 7a3b14f4b40fc1a22624c3f84d9f467a3d9ea1ca6e9a372116cb92507e485260359465b58e25bcb6c9981b155416b98c9973ad9b796053fd7b3f776a6946bce8 languageName: node linkType: hard -"@eslint/js@npm:8.43.0": - version: 8.43.0 - resolution: "@eslint/js@npm:8.43.0" - checksum: db6a89a5360909e6f670c0f4057811a6d00f35ca5b3632bd30b6f7aab35c9cf689d58ea70a22ac8d03d4abc5760ca8ae10fb0e9efc48c843e9db20039b638dce +"@eslint/js@npm:8.57.0": + version: 8.57.0 + resolution: "@eslint/js@npm:8.57.0" + checksum: 3c501ce8a997cf6cbbaf4ed358af5492875e3550c19b9621413b82caa9ae5382c584b0efa79835639e6e0ddaa568caf3499318e5bdab68643ef4199dce5eb0a0 languageName: node linkType: hard @@ -4856,14 +4863,14 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.10": - version: 0.11.10 - resolution: "@humanwhocodes/config-array@npm:0.11.10" +"@humanwhocodes/config-array@npm:^0.11.14": + version: 0.11.14 + resolution: "@humanwhocodes/config-array@npm:0.11.14" dependencies: - "@humanwhocodes/object-schema": "npm:^1.2.1" - debug: "npm:^4.1.1" + "@humanwhocodes/object-schema": "npm:^2.0.2" + debug: "npm:^4.3.1" minimatch: "npm:^3.0.5" - checksum: f93086ae6a340e739a6bb23d4575b69f52acc4e4e3d62968eaaf77a77db4ba69d6d3e50c0028ba19b634ef6b241553a9d9a13d91b797b3ea33d5d711bb3362fb + checksum: 3ffb24ecdfab64014a230e127118d50a1a04d11080cbb748bc21629393d100850496456bbcb4e8c438957fe0934430d731042f1264d6a167b62d32fc2863580a languageName: node linkType: hard @@ -4874,10 +4881,10 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^1.2.1": - version: 1.2.1 - resolution: "@humanwhocodes/object-schema@npm:1.2.1" - checksum: b48a8f87fcd5fdc4ac60a31a8bf710d19cc64556050575e6a35a4a48a8543cf8cde1598a65640ff2cdfbfd165b38f9db4fa3782bea7848eb585cc3db824002e6 +"@humanwhocodes/object-schema@npm:^2.0.2": + version: 2.0.2 + resolution: "@humanwhocodes/object-schema@npm:2.0.2" + checksum: ef915e3e2f34652f3d383b28a9a99cfea476fa991482370889ab14aac8ecd2b38d47cc21932526c6d949da0daf4a4a6bf629d30f41b0caca25e146819cbfa70e languageName: node linkType: hard @@ -4896,7 +4903,8 @@ __metadata: prettier: "npm:^2.8.8" ts-jest: "npm:^29.1.2" ts-node: "npm:^10.8.0" - typescript: "npm:5.1.6" + tsx: "npm:^4.7.1" + typescript: "npm:5.3.3" languageName: unknown linkType: soft @@ -4910,13 +4918,13 @@ __metadata: "@types/mocha": "npm:^10.0.1" "@types/node": "npm:^18.14.5" "@types/yargs": "npm:^17.0.24" - "@typescript-eslint/eslint-plugin": "npm:^5.62.0" - "@typescript-eslint/parser": "npm:^5.62.0" + "@typescript-eslint/eslint-plugin": "npm:^7.4.0" + "@typescript-eslint/parser": "npm:^7.4.0" bignumber.js: "npm:^9.1.1" chai: "npm:^4.3.6" chalk: "npm:^5.3.0" - eslint: "npm:^8.43.0" - eslint-config-prettier: "npm:^8.8.0" + eslint: "npm:^8.57.0" + eslint-config-prettier: "npm:^9.1.0" ethers: "npm:^5.7.2" latest-version: "npm:^8.0.0" mocha: "npm:^10.2.0" @@ -4940,16 +4948,16 @@ __metadata: "@hyperlane-xyz/utils": "npm:3.10.0" "@layerzerolabs/lz-evm-oapp-v2": "npm:2.0.2" "@layerzerolabs/solidity-examples": "npm:^1.1.0" - "@nomiclabs/hardhat-ethers": "npm:^2.2.1" + "@nomiclabs/hardhat-ethers": "npm:^2.2.3" "@nomiclabs/hardhat-waffle": "npm:^2.0.6" "@openzeppelin/contracts": "npm:^4.9.3" "@openzeppelin/contracts-upgradeable": "npm:^v4.9.3" - "@typechain/ethers-v5": "npm:^10.0.0" - "@typechain/hardhat": "npm:^6.0.0" + "@typechain/ethers-v5": "npm:^11.1.2" + "@typechain/hardhat": "npm:^9.1.0" chai: "npm:^4.3.6" ethereum-waffle: "npm:^4.0.10" ethers: "npm:^5.7.2" - hardhat: "npm:^2.19.0" + hardhat: "npm:^2.22.2" hardhat-gas-reporter: "npm:^1.0.9" prettier: "npm:^2.8.8" prettier-plugin-solidity: "npm:^1.1.3" @@ -4957,8 +4965,9 @@ __metadata: solhint-plugin-prettier: "npm:^0.0.5" solidity-coverage: "npm:^0.8.3" ts-generator: "npm:^0.1.1" - typechain: "npm:^8.3.2" - typescript: "npm:5.1.6" + ts-node: "npm:^10.8.0" + typechain: "patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch" + typescript: "npm:5.3.3" peerDependencies: "@ethersproject/abi": "*" "@ethersproject/providers": "*" @@ -4988,20 +4997,20 @@ __metadata: dependencies: "@hyperlane-xyz/core": "npm:3.10.0" "@hyperlane-xyz/sdk": "npm:3.10.0" - "@nomiclabs/hardhat-ethers": "npm:^2.2.1" + "@nomiclabs/hardhat-ethers": "npm:^2.2.3" "@nomiclabs/hardhat-waffle": "npm:^2.0.6" "@openzeppelin/contracts-upgradeable": "npm:^4.9.3" "@trivago/prettier-plugin-sort-imports": "npm:^4.2.1" - "@typechain/ethers-v5": "npm:^10.0.0" - "@typechain/hardhat": "npm:^6.0.0" - "@typescript-eslint/eslint-plugin": "npm:^5.62.0" - "@typescript-eslint/parser": "npm:^5.62.0" + "@typechain/ethers-v5": "npm:^11.1.2" + "@typechain/hardhat": "npm:^9.1.0" + "@typescript-eslint/eslint-plugin": "npm:^7.4.0" + "@typescript-eslint/parser": "npm:^7.4.0" chai: "npm:^4.3.6" - eslint: "npm:^8.43.0" - eslint-config-prettier: "npm:^8.8.0" + eslint: "npm:^8.57.0" + eslint-config-prettier: "npm:^9.1.0" ethereum-waffle: "npm:^4.0.10" ethers: "npm:^5.7.2" - hardhat: "npm:^2.19.0" + hardhat: "npm:^2.22.2" hardhat-gas-reporter: "npm:^1.0.9" prettier: "npm:^2.8.8" prettier-plugin-solidity: "npm:^1.1.3" @@ -5009,8 +5018,8 @@ __metadata: solhint-plugin-prettier: "npm:^0.0.5" solidity-coverage: "npm:^0.8.3" ts-node: "npm:^10.8.0" - typechain: "npm:^8.0.0" - typescript: "npm:5.1.6" + typechain: "patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch" + typescript: "npm:5.3.3" peerDependencies: "@ethersproject/abi": "*" "@ethersproject/providers": "*" @@ -5035,7 +5044,7 @@ __metadata: "@hyperlane-xyz/helloworld": "npm:3.10.0" "@hyperlane-xyz/sdk": "npm:3.10.0" "@hyperlane-xyz/utils": "npm:3.10.0" - "@nomiclabs/hardhat-ethers": "npm:^2.2.1" + "@nomiclabs/hardhat-ethers": "npm:^2.2.3" "@nomiclabs/hardhat-etherscan": "npm:^3.0.3" "@nomiclabs/hardhat-waffle": "npm:^2.0.6" "@safe-global/api-kit": "npm:^1.3.0" @@ -5054,14 +5063,14 @@ __metadata: dotenv: "npm:^10.0.0" ethereum-waffle: "npm:^4.0.10" ethers: "npm:^5.7.2" - hardhat: "npm:^2.19.0" + hardhat: "npm:^2.22.2" json-stable-stringify: "npm:^1.1.1" mocha: "npm:^10.2.0" prettier: "npm:^2.8.8" prom-client: "npm:^14.0.1" prompts: "npm:^2.4.2" - ts-node: "npm:^10.8.0" - typescript: "npm:5.1.6" + tsx: "npm:^4.7.1" + typescript: "npm:5.3.3" yargs: "npm:^17.7.2" peerDependencies: "@ethersproject/abi": "*" @@ -5074,13 +5083,14 @@ __metadata: dependencies: "@changesets/cli": "npm:^2.26.2" "@trivago/prettier-plugin-sort-imports": "npm:^4.2.1" - "@typescript-eslint/eslint-plugin": "npm:^5.62.0" - "@typescript-eslint/parser": "npm:^5.62.0" - eslint: "npm:^8.43.0" - eslint-config-prettier: "npm:^8.8.0" + "@typescript-eslint/eslint-plugin": "npm:^7.4.0" + "@typescript-eslint/parser": "npm:^7.4.0" + eslint: "npm:^8.57.0" + eslint-config-prettier: "npm:^9.1.0" husky: "npm:^8.0.0" lint-staged: "npm:^12.4.3" prettier: "npm:^2.8.8" + tsx: "npm:^4.7.1" languageName: unknown linkType: soft @@ -5092,7 +5102,7 @@ __metadata: "@cosmjs/stargate": "npm:^0.31.3" "@hyperlane-xyz/core": "npm:3.10.0" "@hyperlane-xyz/utils": "npm:3.10.0" - "@nomiclabs/hardhat-ethers": "npm:^2.2.1" + "@nomiclabs/hardhat-ethers": "npm:^2.2.3" "@nomiclabs/hardhat-waffle": "npm:^2.0.6" "@solana/spl-token": "npm:^0.3.8" "@solana/web3.js": "npm:^1.78.0" @@ -5109,16 +5119,17 @@ __metadata: cosmjs-types: "npm:^0.9.0" cross-fetch: "npm:^3.1.5" dotenv: "npm:^10.0.0" - eslint: "npm:^8.43.0" + eslint: "npm:^8.57.0" ethereum-waffle: "npm:^4.0.10" ethers: "npm:^5.7.2" - hardhat: "npm:^2.19.0" + hardhat: "npm:^2.22.2" mocha: "npm:^10.2.0" pino: "npm:^8.19.0" prettier: "npm:^2.8.8" sinon: "npm:^13.0.2" ts-node: "npm:^10.8.0" - typescript: "npm:5.1.6" + tsx: "npm:^4.7.1" + typescript: "npm:5.3.3" viem: "npm:^1.20.0" yaml: "npm:^2.3.1" zod: "npm:^3.21.2" @@ -5169,7 +5180,7 @@ __metadata: mocha: "npm:^10.2.0" pino: "npm:^8.19.0" prettier: "npm:^2.8.8" - typescript: "npm:5.1.6" + typescript: "npm:5.3.3" languageName: unknown linkType: soft @@ -6260,6 +6271,105 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/edr-darwin-arm64@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-darwin-arm64@npm:0.3.3" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@nomicfoundation/edr-darwin-x64@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-darwin-x64@npm:0.3.3" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-linux-arm64-gnu@npm:0.3.3" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@nomicfoundation/edr-linux-arm64-musl@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-linux-arm64-musl@npm:0.3.3" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@nomicfoundation/edr-linux-x64-gnu@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-linux-x64-gnu@npm:0.3.3" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@nomicfoundation/edr-linux-x64-musl@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-linux-x64-musl@npm:0.3.3" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@nomicfoundation/edr-win32-arm64-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-win32-arm64-msvc@npm:0.3.3" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@nomicfoundation/edr-win32-ia32-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-win32-ia32-msvc@npm:0.3.3" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@nomicfoundation/edr-win32-x64-msvc@npm:0.3.3": + version: 0.3.3 + resolution: "@nomicfoundation/edr-win32-x64-msvc@npm:0.3.3" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@nomicfoundation/edr@npm:^0.3.1": + version: 0.3.3 + resolution: "@nomicfoundation/edr@npm:0.3.3" + dependencies: + "@nomicfoundation/edr-darwin-arm64": "npm:0.3.3" + "@nomicfoundation/edr-darwin-x64": "npm:0.3.3" + "@nomicfoundation/edr-linux-arm64-gnu": "npm:0.3.3" + "@nomicfoundation/edr-linux-arm64-musl": "npm:0.3.3" + "@nomicfoundation/edr-linux-x64-gnu": "npm:0.3.3" + "@nomicfoundation/edr-linux-x64-musl": "npm:0.3.3" + "@nomicfoundation/edr-win32-arm64-msvc": "npm:0.3.3" + "@nomicfoundation/edr-win32-ia32-msvc": "npm:0.3.3" + "@nomicfoundation/edr-win32-x64-msvc": "npm:0.3.3" + dependenciesMeta: + "@nomicfoundation/edr-darwin-arm64": + optional: true + "@nomicfoundation/edr-darwin-x64": + optional: true + "@nomicfoundation/edr-linux-arm64-gnu": + optional: true + "@nomicfoundation/edr-linux-arm64-musl": + optional: true + "@nomicfoundation/edr-linux-x64-gnu": + optional: true + "@nomicfoundation/edr-linux-x64-musl": + optional: true + "@nomicfoundation/edr-win32-arm64-msvc": + optional: true + "@nomicfoundation/edr-win32-ia32-msvc": + optional: true + "@nomicfoundation/edr-win32-x64-msvc": + optional: true + checksum: fd3447d557ca38716f957cdf3b3d5c211acd86d2a3c2a556473d281fb3515d0d04d54106dd249a63c70d68c7e2f2e2e09c3cc7203b0bfa5d758acdccf10c6442 + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-block@npm:5.0.2": version: 5.0.2 resolution: "@nomicfoundation/ethereumjs-block@npm:5.0.2" @@ -6306,6 +6416,15 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/ethereumjs-common@npm:4.0.4": + version: 4.0.4 + resolution: "@nomicfoundation/ethereumjs-common@npm:4.0.4" + dependencies: + "@nomicfoundation/ethereumjs-util": "npm:9.0.4" + checksum: 1daaede087c5dee92cb1e5309a548da2d64484722b917eccda4118d627293b61f705a990075f4d7f0f350100ed79396b3a25e7ea67824242d36d23716fe75e97 + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-ethash@npm:3.0.2": version: 3.0.2 resolution: "@nomicfoundation/ethereumjs-ethash@npm:3.0.2" @@ -6345,6 +6464,15 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/ethereumjs-rlp@npm:5.0.4": + version: 5.0.4 + resolution: "@nomicfoundation/ethereumjs-rlp@npm:5.0.4" + bin: + rlp: bin/rlp.cjs + checksum: 39fb26340bb2643a66c642315aa7b6fcfbdbddddeee18b4b683b77aa93b8a031bc86d4d4144368e5dd20499dc96b8b27751c6a285ff34e7a9969b530b306ce8c + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-statemanager@npm:2.0.2": version: 2.0.2 resolution: "@nomicfoundation/ethereumjs-statemanager@npm:2.0.2" @@ -6386,6 +6514,23 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/ethereumjs-tx@npm:5.0.4": + version: 5.0.4 + resolution: "@nomicfoundation/ethereumjs-tx@npm:5.0.4" + dependencies: + "@nomicfoundation/ethereumjs-common": "npm:4.0.4" + "@nomicfoundation/ethereumjs-rlp": "npm:5.0.4" + "@nomicfoundation/ethereumjs-util": "npm:9.0.4" + ethereum-cryptography: "npm:0.1.3" + peerDependencies: + c-kzg: ^2.1.2 + peerDependenciesMeta: + c-kzg: + optional: true + checksum: 5e84de14fa464501c5c60ac6519f536d39ebc52c4d1fb79c63a66ea86f992bde4f338b0b0fdd2e5bc811ebd984e8ff41e4205e47d30001bad5b45370568bc41c + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-util@npm:9.0.2": version: 9.0.2 resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.2" @@ -6397,6 +6542,21 @@ __metadata: languageName: node linkType: hard +"@nomicfoundation/ethereumjs-util@npm:9.0.4": + version: 9.0.4 + resolution: "@nomicfoundation/ethereumjs-util@npm:9.0.4" + dependencies: + "@nomicfoundation/ethereumjs-rlp": "npm:5.0.4" + ethereum-cryptography: "npm:0.1.3" + peerDependencies: + c-kzg: ^2.1.2 + peerDependenciesMeta: + c-kzg: + optional: true + checksum: 891806c7edda29c7b3f61551949ff0c1fa5f4e122fba84878bf27362a9e058768fd01194dc0e031de2e523c30ecbeb22e6841b8ab3772c8567fef4af6480872d + languageName: node + linkType: hard + "@nomicfoundation/ethereumjs-vm@npm:7.0.2": version: 7.0.2 resolution: "@nomicfoundation/ethereumjs-vm@npm:7.0.2" @@ -6527,13 +6687,13 @@ __metadata: languageName: node linkType: hard -"@nomiclabs/hardhat-ethers@npm:^2.2.1": - version: 2.2.1 - resolution: "@nomiclabs/hardhat-ethers@npm:2.2.1" +"@nomiclabs/hardhat-ethers@npm:^2.2.3": + version: 2.2.3 + resolution: "@nomiclabs/hardhat-ethers@npm:2.2.3" peerDependencies: ethers: ^5.0.0 hardhat: ^2.0.0 - checksum: 43f8daa2f26797079cc05107fc0ab82417c41bdbea3d2882450178f386a0554533b7dfc3664a0ac1101e355c36d666c6b1b210a5562651d3af51b35105a752f5 + checksum: bd239a00d3384b6dfefbf2444bacd7fdaccc9df40efac2255b4f8314f0414416e65296945bbe6debec65479a3f8a5f9d1e69aa66a39d1852e5ac1d690c3b458a languageName: node linkType: hard @@ -7759,36 +7919,36 @@ __metadata: linkType: hard "@tsconfig/node10@npm:^1.0.7": - version: 1.0.9 - resolution: "@tsconfig/node10@npm:1.0.9" - checksum: a33ae4dc2a621c0678ac8ac4bceb8e512ae75dac65417a2ad9b022d9b5411e863c4c198b6ba9ef659e14b9fb609bbec680841a2e84c1172df7a5ffcf076539df + version: 1.0.11 + resolution: "@tsconfig/node10@npm:1.0.11" + checksum: 51fe47d55fe1b80ec35e6e5ed30a13665fd3a531945350aa74a14a1e82875fb60b350c2f2a5e72a64831b1b6bc02acb6760c30b3738b54954ec2dea82db7a267 languageName: node linkType: hard "@tsconfig/node12@npm:^1.0.7": - version: 1.0.10 - resolution: "@tsconfig/node12@npm:1.0.10" - checksum: 3683668703d5a2b43fe9b3135c5e475c401b5aaf7a586df8bb7eead1184b901d6606b6aee093dbb82e2d23b58f26104da433c86601a2912f512c1c935e4144a0 + version: 1.0.11 + resolution: "@tsconfig/node12@npm:1.0.11" + checksum: 5ce29a41b13e7897a58b8e2df11269c5395999e588b9a467386f99d1d26f6c77d1af2719e407621412520ea30517d718d5192a32403b8dfcc163bf33e40a338a languageName: node linkType: hard "@tsconfig/node14@npm:^1.0.0": - version: 1.0.2 - resolution: "@tsconfig/node14@npm:1.0.2" - checksum: 6260dd461728c200921b4848cd9e1df2bfb2c1ee6c1b6dadbc9bf81afadff8ddf11c6312e08c07de89f6c40163916ff8307f6008bf6c76a4d72a2833dae7bf7c + version: 1.0.3 + resolution: "@tsconfig/node14@npm:1.0.3" + checksum: 19275fe80c4c8d0ad0abed6a96dbf00642e88b220b090418609c4376e1cef81bf16237bf170ad1b341452feddb8115d8dd2e5acdfdea1b27422071163dc9ba9d languageName: node linkType: hard "@tsconfig/node16@npm:^1.0.2": - version: 1.0.3 - resolution: "@tsconfig/node16@npm:1.0.3" - checksum: 3a8b657dd047495b7ad23437d6afd20297ce90380ff0bdee93fc7d39a900dbd8d9e26e53ff6b465e7967ce2adf0b218782590ce9013285121e6a5928fbd6819f + version: 1.0.4 + resolution: "@tsconfig/node16@npm:1.0.4" + checksum: 202319785901f942a6e1e476b872d421baec20cf09f4b266a1854060efbf78cde16a4d256e8bc949d31e6cd9a90f1e8ef8fb06af96a65e98338a2b6b0de0a0ff languageName: node linkType: hard -"@typechain/ethers-v5@npm:^10.0.0": - version: 10.2.1 - resolution: "@typechain/ethers-v5@npm:10.2.1" +"@typechain/ethers-v5@npm:11.1.2": + version: 11.1.2 + resolution: "@typechain/ethers-v5@npm:11.1.2" dependencies: lodash: "npm:^4.17.15" ts-essentials: "npm:^7.0.1" @@ -7796,26 +7956,23 @@ __metadata: "@ethersproject/abi": ^5.0.0 "@ethersproject/providers": ^5.0.0 ethers: ^5.1.3 - typechain: ^8.1.1 + typechain: ^8.3.2 typescript: ">=4.3.0" - checksum: 463dbb5cd7314d492c3fd53c18e888c33e7c70d1b6bf0ffb38697ef112998c27e9c6bdf22dc7c7662cd43dfca644e53c7f245b6795a6dc615e273b248cd96fa8 + checksum: 0d992825f6462d617e7de384488c70d73a14dac3852ab0c299c2811183965457346b5a151f9f2fa367cc3668e950d070d5c1337bc13d7112d510d8fc35f2b30f languageName: node linkType: hard -"@typechain/hardhat@npm:^6.0.0": - version: 6.1.0 - resolution: "@typechain/hardhat@npm:6.1.0" +"@typechain/hardhat@npm:^9.1.0": + version: 9.1.0 + resolution: "@typechain/hardhat@npm:9.1.0" dependencies: fs-extra: "npm:^9.1.0" - lodash: "npm:^4.17.15" peerDependencies: - "@ethersproject/abi": ^5.4.7 - "@ethersproject/providers": ^5.4.7 - "@typechain/ethers-v5": ^10.1.0 - ethers: ^5.4.7 + "@typechain/ethers-v6": ^0.5.1 + ethers: ^6.1.0 hardhat: ^2.9.9 - typechain: ^8.1.0 - checksum: d905fcd6a49286fffec45c9a1977a43362005c01868ebf1ed30083e34ae0033ca360fed104923ea3dc821990fb7714a8ad9b43bc65971e8fdb48c4dd0406a39b + typechain: ^8.3.2 + checksum: 1f59d8243af020905f3cdb96125cf9fcad33bd16f919d5e07762c63e0220bccb658abf59b0ad74be784a3387c0a6b0262612fa1adeb9f6c99061a6abaa6afc53 languageName: node linkType: hard @@ -8033,10 +8190,10 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:^7.0.9": - version: 7.0.11 - resolution: "@types/json-schema@npm:7.0.11" - checksum: e50864a93f4dcb9de64c0c605d836f5416341c824d7a8cde1aa15a5fc68bed44b33cdcb2e04e5098339e9121848378f2d0cc5b124dec41c89203c6f67d6f344a +"@types/json-schema@npm:^7.0.12": + version: 7.0.15 + resolution: "@types/json-schema@npm:7.0.15" + checksum: 1a3c3e06236e4c4aab89499c428d585527ce50c24fe8259e8b3926d3df4cfbbbcf306cfc73ddfb66cbafc973116efd15967020b0f738f63e09e64c7d260519e7 languageName: node linkType: hard @@ -8322,13 +8479,6 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.3.12": - version: 7.5.0 - resolution: "@types/semver@npm:7.5.0" - checksum: 8fbfbf79e9c14c3c20160a42145a146cba44d9763d0fac78358b394dc36e41bc2590bc4f0129c6fcbbc9b30f12ea1ba821bfe84b29dc80897f315cc7dd251393 - languageName: node - linkType: hard - "@types/semver@npm:^7.5.0": version: 7.5.6 resolution: "@types/semver@npm:7.5.6" @@ -8435,124 +8585,133 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.62.0" +"@typescript-eslint/eslint-plugin@npm:^7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.4.0" dependencies: - "@eslint-community/regexpp": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:5.62.0" - "@typescript-eslint/type-utils": "npm:5.62.0" - "@typescript-eslint/utils": "npm:5.62.0" + "@eslint-community/regexpp": "npm:^4.5.1" + "@typescript-eslint/scope-manager": "npm:7.4.0" + "@typescript-eslint/type-utils": "npm:7.4.0" + "@typescript-eslint/utils": "npm:7.4.0" + "@typescript-eslint/visitor-keys": "npm:7.4.0" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" - ignore: "npm:^5.2.0" - natural-compare-lite: "npm:^1.4.0" - semver: "npm:^7.3.7" - tsutils: "npm:^3.21.0" + ignore: "npm:^5.2.4" + natural-compare: "npm:^1.4.0" + semver: "npm:^7.5.4" + ts-api-utils: "npm:^1.0.1" peerDependencies: - "@typescript-eslint/parser": ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + "@typescript-eslint/parser": ^7.0.0 + eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 9cc8319c6fd8a21938f5b69476974a7e778c283a55ef9fad183c850995b9adcb0087d57cea7b2ac6b9449570eee983aad39491d14cdd2e52d6b4b0485e7b2482 + checksum: 9bd8852c7e4e9608c3fded94f7c60506cc7d2b6d8a8c1cad6d48969a7363751b20282874e55ccdf180635cf204cb10b3e1e5c3d1cff34d4fcd07762be3fc138e languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/parser@npm:5.62.0" +"@typescript-eslint/parser@npm:^7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/parser@npm:7.4.0" dependencies: - "@typescript-eslint/scope-manager": "npm:5.62.0" - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/typescript-estree": "npm:5.62.0" + "@typescript-eslint/scope-manager": "npm:7.4.0" + "@typescript-eslint/types": "npm:7.4.0" + "@typescript-eslint/typescript-estree": "npm:7.4.0" + "@typescript-eslint/visitor-keys": "npm:7.4.0" debug: "npm:^4.3.4" peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: b6ca629d8f4e6283ff124501731cc886703eb4ce2c7d38b3e4110322ea21452b9d9392faf25be6bd72f54b89de7ffc72a40d9b159083ac54345a3d04b4fa5394 + checksum: 142a9e1187d305ed43b4fef659c36fa4e28359467198c986f0955c70b4067c9799f4c85d9881fbf099c55dfb265e30666e28b3ef290520e242b45ca7cb8e4ca9 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/scope-manager@npm:5.62.0" +"@typescript-eslint/scope-manager@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/scope-manager@npm:7.4.0" dependencies: - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/visitor-keys": "npm:5.62.0" - checksum: e827770baa202223bc0387e2fd24f630690809e460435b7dc9af336c77322290a770d62bd5284260fa881c86074d6a9fd6c97b07382520b115f6786b8ed499da + "@typescript-eslint/types": "npm:7.4.0" + "@typescript-eslint/visitor-keys": "npm:7.4.0" + checksum: 8cf9292444f9731017a707cac34bef5ae0eb33b5cd42ed07fcd046e981d97889d9201d48e02f470f2315123f53771435e10b1dc81642af28a11df5352a8e8be2 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/type-utils@npm:5.62.0" +"@typescript-eslint/type-utils@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/type-utils@npm:7.4.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:5.62.0" - "@typescript-eslint/utils": "npm:5.62.0" + "@typescript-eslint/typescript-estree": "npm:7.4.0" + "@typescript-eslint/utils": "npm:7.4.0" debug: "npm:^4.3.4" - tsutils: "npm:^3.21.0" + ts-api-utils: "npm:^1.0.1" peerDependencies: - eslint: "*" + eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: f9a4398d6d2aae09e3e765eff04cf4ab364376a87868031ac5c6a64c9bbb555cb1a7f99b07b3d1017e7422725b5f0bbee537f13b82ab2d930f161c987b3dece0 + checksum: a8bd0929d8237679b2b8a7817f070a4b9658ee976882fba8ff37e4a70dd33f87793e1b157771104111fe8054eaa8ad437a010b6aa465072fbdb932647125db2d languageName: node linkType: hard -"@typescript-eslint/types@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/types@npm:5.62.0" - checksum: 24e8443177be84823242d6729d56af2c4b47bfc664dd411a1d730506abf2150d6c31bdefbbc6d97c8f91043e3a50e0c698239dcb145b79bb6b0c34469aaf6c45 +"@typescript-eslint/types@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/types@npm:7.4.0" + checksum: 2782c5bf65cd3dfa9cd32bc3023676bbca22144987c3f6c6b67fd96c73d4a60b85a57458c49fd11b9971ac6531824bb3ae0664491e7a6de25d80c523c9be92b7 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" +"@typescript-eslint/typescript-estree@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.4.0" dependencies: - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/visitor-keys": "npm:5.62.0" + "@typescript-eslint/types": "npm:7.4.0" + "@typescript-eslint/visitor-keys": "npm:7.4.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" - semver: "npm:^7.3.7" - tsutils: "npm:^3.21.0" + minimatch: "npm:9.0.3" + semver: "npm:^7.5.4" + ts-api-utils: "npm:^1.0.1" peerDependenciesMeta: typescript: optional: true - checksum: 06c975eb5f44b43bd19fadc2e1023c50cf87038fe4c0dd989d4331c67b3ff509b17fa60a3251896668ab4d7322bdc56162a9926971218d2e1a1874d2bef9a52e + checksum: 162ec9d7582f45588342e1be36fdb60e41f50bbdfbc3035c91b517ff5d45244f776921c88d88e543e1c7d0f1e6ada5474a8316b78f1b0e6d2233b101bc45b166 languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/utils@npm:5.62.0" +"@typescript-eslint/utils@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/utils@npm:7.4.0" dependencies: - "@eslint-community/eslint-utils": "npm:^4.2.0" - "@types/json-schema": "npm:^7.0.9" - "@types/semver": "npm:^7.3.12" - "@typescript-eslint/scope-manager": "npm:5.62.0" - "@typescript-eslint/types": "npm:5.62.0" - "@typescript-eslint/typescript-estree": "npm:5.62.0" - eslint-scope: "npm:^5.1.1" - semver: "npm:^7.3.7" + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@types/json-schema": "npm:^7.0.12" + "@types/semver": "npm:^7.5.0" + "@typescript-eslint/scope-manager": "npm:7.4.0" + "@typescript-eslint/types": "npm:7.4.0" + "@typescript-eslint/typescript-estree": "npm:7.4.0" + semver: "npm:^7.5.4" peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 15ef13e43998a082b15f85db979f8d3ceb1f9ce4467b8016c267b1738d5e7cdb12aa90faf4b4e6dd6486c236cf9d33c463200465cf25ff997dbc0f12358550a1 + eslint: ^8.56.0 + checksum: ffed27e770c486cd000ff892d9049b0afe8b9d6318452a5355b78a37436cbb414bceacae413a2ac813f3e584684825d5e0baa2e6376b7ad6013a108ac91bc19d languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.62.0": - version: 5.62.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" +"@typescript-eslint/visitor-keys@npm:7.4.0": + version: 7.4.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.4.0" dependencies: - "@typescript-eslint/types": "npm:5.62.0" - eslint-visitor-keys: "npm:^3.3.0" - checksum: dc613ab7569df9bbe0b2ca677635eb91839dfb2ca2c6fa47870a5da4f160db0b436f7ec0764362e756d4164e9445d49d5eb1ff0b87f4c058946ae9d8c92eb388 + "@typescript-eslint/types": "npm:7.4.0" + eslint-visitor-keys: "npm:^3.4.1" + checksum: 70dc99f2ad116c6e2d9e55af249e4453e06bba2ceea515adef2d2e86e97e557865bb1b1d467667462443eb0d624baba36f7442fd1082f3874339bbc381c26e93 + languageName: node + linkType: hard + +"@ungap/structured-clone@npm:^1.2.0": + version: 1.2.0 + resolution: "@ungap/structured-clone@npm:1.2.0" + checksum: c6fe89a505e513a7592e1438280db1c075764793a2397877ff1351721fe8792a966a5359769e30242b3cd023f2efb9e63ca2ca88019d73b564488cc20e3eab12 languageName: node linkType: hard @@ -9252,13 +9411,13 @@ __metadata: linkType: hard "acorn-walk@npm:^8.1.1": - version: 8.2.0 - resolution: "acorn-walk@npm:8.2.0" - checksum: e69f7234f2adfeb16db3671429a7c80894105bd7534cb2032acf01bb26e6a847952d11a062d071420b43f8d82e33d2e57f26fe87d9cce0853e8143d8910ff1de + version: 8.3.2 + resolution: "acorn-walk@npm:8.3.2" + checksum: 57dbe2fd8cf744f562431775741c5c087196cd7a65ce4ccb3f3981cdfad25cd24ad2bad404997b88464ac01e789a0a61e5e355b2a84876f13deef39fb39686ca languageName: node linkType: hard -"acorn@npm:^8.11.3": +"acorn@npm:^8.11.3, acorn@npm:^8.4.1, acorn@npm:^8.9.0": version: 8.11.3 resolution: "acorn@npm:8.11.3" bin: @@ -9267,24 +9426,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.4.1": - version: 8.7.1 - resolution: "acorn@npm:8.7.1" - bin: - acorn: bin/acorn - checksum: 60a550c0c1173379a4ed29abd76f8a7f80adccdb8862afc8ce217fd006b7f47e8a035a72f518fcc0ef386334f0f91b6c8140cc51fd51137b8ecedf43663acf9a - languageName: node - linkType: hard - -"acorn@npm:^8.8.0": - version: 8.9.0 - resolution: "acorn@npm:8.9.0" - bin: - acorn: bin/acorn - checksum: 243af601b8dfe859008c49ebf75a5bf3ad55d243aed7fdd16966ffb3e0276d070381dce95813b77796b87b1997c01946103744e3fcddaefc40b96bda4d94c075 - languageName: node - linkType: hard - "address@npm:^1.0.1": version: 1.2.0 resolution: "address@npm:1.2.0" @@ -9359,7 +9500,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.10.0, ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.12.6": +"ajv@npm:^6.12.3, ajv@npm:^6.12.4, ajv@npm:^6.12.6": version: 6.12.6 resolution: "ajv@npm:6.12.6" dependencies: @@ -9403,6 +9544,15 @@ __metadata: languageName: node linkType: hard +"ansi-align@npm:^3.0.0": + version: 3.0.1 + resolution: "ansi-align@npm:3.0.1" + dependencies: + string-width: "npm:^4.1.0" + checksum: 4c7e8b6a10eaf18874ecee964b5db62ac86d0b9266ad4987b3a1efcb5d11a9e12c881ee40d14951833135a8966f10a3efe43f9c78286a6e632f53d85ad28b9c0 + languageName: node + linkType: hard + "ansi-colors@npm:3.2.3": version: 3.2.3 resolution: "ansi-colors@npm:3.2.3" @@ -10222,6 +10372,22 @@ __metadata: languageName: node linkType: hard +"boxen@npm:^5.1.2": + version: 5.1.2 + resolution: "boxen@npm:5.1.2" + dependencies: + ansi-align: "npm:^3.0.0" + camelcase: "npm:^6.2.0" + chalk: "npm:^4.1.0" + cli-boxes: "npm:^2.2.1" + string-width: "npm:^4.2.2" + type-fest: "npm:^0.20.2" + widest-line: "npm:^3.1.0" + wrap-ansi: "npm:^7.0.0" + checksum: bc3d3d88d77dc8cabb0811844acdbd4805e8ca8011222345330817737042bf6f86d93eb74a3f7e0cab634e64ef69db03cf52b480761ed90a965de0c8ff1bea8c + languageName: node + linkType: hard + "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -10886,6 +11052,13 @@ __metadata: languageName: node linkType: hard +"cli-boxes@npm:^2.2.1": + version: 2.2.1 + resolution: "cli-boxes@npm:2.2.1" + checksum: be79f8ec23a558b49e01311b39a1ea01243ecee30539c880cf14bf518a12e223ef40c57ead0cb44f509bffdffc5c129c746cd50d863ab879385370112af4f585 + languageName: node + linkType: hard + "cli-cursor@npm:^3.1.0": version: 3.1.0 resolution: "cli-cursor@npm:3.1.0" @@ -12541,34 +12714,24 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:^8.8.0": - version: 8.8.0 - resolution: "eslint-config-prettier@npm:8.8.0" +"eslint-config-prettier@npm:^9.1.0": + version: 9.1.0 + resolution: "eslint-config-prettier@npm:9.1.0" peerDependencies: eslint: ">=7.0.0" bin: eslint-config-prettier: bin/cli.js - checksum: 3638144cecada897105ff9442bc85aba71c4f44d7d25b576cb34d50a207f6655f7cc55e729aad1a934a9f15e55c88e7adcbd1067d6582325fc89864c879b52f1 - languageName: node - linkType: hard - -"eslint-scope@npm:^5.1.1": - version: 5.1.1 - resolution: "eslint-scope@npm:5.1.1" - dependencies: - esrecurse: "npm:^4.3.0" - estraverse: "npm:^4.1.1" - checksum: c541ef384c92eb5c999b7d3443d80195fcafb3da335500946f6db76539b87d5826c8f2e1d23bf6afc3154ba8cd7c8e566f8dc00f1eea25fdf3afc8fb9c87b238 + checksum: 411e3b3b1c7aa04e3e0f20d561271b3b909014956c4dba51c878bf1a23dbb8c800a3be235c46c4732c70827276e540b6eed4636d9b09b444fd0a8e07f0fcd830 languageName: node linkType: hard -"eslint-scope@npm:^7.2.0": - version: 7.2.0 - resolution: "eslint-scope@npm:7.2.0" +"eslint-scope@npm:^7.2.2": + version: 7.2.2 + resolution: "eslint-scope@npm:7.2.2" dependencies: esrecurse: "npm:^4.3.0" estraverse: "npm:^5.2.0" - checksum: 94d8942840b35bf5e6559bd0f0a8b10610d65b1e44e41295e66ed1fe82f83bc51756e7af607d611b75f435adf821122bd901aa565701596ca1a628db41c0cd87 + checksum: 5c660fb905d5883ad018a6fea2b49f3cb5b1cbf2cd4bd08e98646e9864f9bc2c74c0839bed2d292e90a4a328833accc197c8f0baed89cbe8d605d6f918465491 languageName: node linkType: hard @@ -12586,26 +12749,34 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.43.0": - version: 8.43.0 - resolution: "eslint@npm:8.43.0" +"eslint-visitor-keys@npm:^3.4.3": + version: 3.4.3 + resolution: "eslint-visitor-keys@npm:3.4.3" + checksum: 3f357c554a9ea794b094a09bd4187e5eacd1bc0d0653c3adeb87962c548e6a1ab8f982b86963ae1337f5d976004146536dcee5d0e2806665b193fbfbf1a9231b + languageName: node + linkType: hard + +"eslint@npm:^8.57.0": + version: 8.57.0 + resolution: "eslint@npm:8.57.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.2.0" - "@eslint-community/regexpp": "npm:^4.4.0" - "@eslint/eslintrc": "npm:^2.0.3" - "@eslint/js": "npm:8.43.0" - "@humanwhocodes/config-array": "npm:^0.11.10" + "@eslint-community/regexpp": "npm:^4.6.1" + "@eslint/eslintrc": "npm:^2.1.4" + "@eslint/js": "npm:8.57.0" + "@humanwhocodes/config-array": "npm:^0.11.14" "@humanwhocodes/module-importer": "npm:^1.0.1" "@nodelib/fs.walk": "npm:^1.2.8" - ajv: "npm:^6.10.0" + "@ungap/structured-clone": "npm:^1.2.0" + ajv: "npm:^6.12.4" chalk: "npm:^4.0.0" cross-spawn: "npm:^7.0.2" debug: "npm:^4.3.2" doctrine: "npm:^3.0.0" escape-string-regexp: "npm:^4.0.0" - eslint-scope: "npm:^7.2.0" - eslint-visitor-keys: "npm:^3.4.1" - espree: "npm:^9.5.2" + eslint-scope: "npm:^7.2.2" + eslint-visitor-keys: "npm:^3.4.3" + espree: "npm:^9.6.1" esquery: "npm:^1.4.2" esutils: "npm:^2.0.2" fast-deep-equal: "npm:^3.1.3" @@ -12615,7 +12786,6 @@ __metadata: globals: "npm:^13.19.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.0" - import-fresh: "npm:^3.0.0" imurmurhash: "npm:^0.1.4" is-glob: "npm:^4.0.0" is-path-inside: "npm:^3.0.3" @@ -12625,24 +12795,23 @@ __metadata: lodash.merge: "npm:^4.6.2" minimatch: "npm:^3.1.2" natural-compare: "npm:^1.4.0" - optionator: "npm:^0.9.1" + optionator: "npm:^0.9.3" strip-ansi: "npm:^6.0.1" - strip-json-comments: "npm:^3.1.0" text-table: "npm:^0.2.0" bin: eslint: bin/eslint.js - checksum: 192f74a53988677586b23b1f0e55777fff77e32d25a1ce4c6bd0ebafe889032176acdb72cd0f60c13e68688b315fa01ee6923512db060f1cbbc42fb93632f1e8 + checksum: 00496e218b23747a7a9817bf58b522276d0dc1f2e546dceb4eea49f9871574088f72f1f069a6b560ef537efa3a75261b8ef70e51ef19033da1cc4c86a755ef15 languageName: node linkType: hard -"espree@npm:^9.5.2": - version: 9.5.2 - resolution: "espree@npm:9.5.2" +"espree@npm:^9.6.0, espree@npm:^9.6.1": + version: 9.6.1 + resolution: "espree@npm:9.6.1" dependencies: - acorn: "npm:^8.8.0" + acorn: "npm:^8.9.0" acorn-jsx: "npm:^5.3.2" eslint-visitor-keys: "npm:^3.4.1" - checksum: 2c9d0fec9ac1230856baec338bd238ca9a69b451ee451f0da25e07d356e1bdef45a2ae5f8c374f492f4bb568d17fc7c998ef44f04a2e9b6a11fc8c194c677ba4 + checksum: 255ab260f0d711a54096bdeda93adff0eadf02a6f9b92f02b323e83a2b7fc258797919437ad331efec3930475feb0142c5ecaaf3cdab4befebd336d47d3f3134 languageName: node linkType: hard @@ -12691,13 +12860,6 @@ __metadata: languageName: node linkType: hard -"estraverse@npm:^4.1.1": - version: 4.3.0 - resolution: "estraverse@npm:4.3.0" - checksum: 3f67ad02b6dbfaddd9ea459cf2b6ef4ecff9a6082a7af9d22e445b9abc082ad9ca47e1825557b293fcdae477f4714e561123e30bb6a5b2f184fb2bad4a9497eb - languageName: node - linkType: hard - "estraverse@npm:^5.1.0, estraverse@npm:^5.2.0": version: 5.3.0 resolution: "estraverse@npm:5.3.0" @@ -14550,22 +14712,16 @@ __metadata: languageName: node linkType: hard -"hardhat@npm:^2.19.0": - version: 2.19.1 - resolution: "hardhat@npm:2.19.1" +"hardhat@npm:^2.22.2": + version: 2.22.2 + resolution: "hardhat@npm:2.22.2" dependencies: "@ethersproject/abi": "npm:^5.1.2" "@metamask/eth-sig-util": "npm:^4.0.0" - "@nomicfoundation/ethereumjs-block": "npm:5.0.2" - "@nomicfoundation/ethereumjs-blockchain": "npm:7.0.2" - "@nomicfoundation/ethereumjs-common": "npm:4.0.2" - "@nomicfoundation/ethereumjs-evm": "npm:2.0.2" - "@nomicfoundation/ethereumjs-rlp": "npm:5.0.2" - "@nomicfoundation/ethereumjs-statemanager": "npm:2.0.2" - "@nomicfoundation/ethereumjs-trie": "npm:6.0.2" - "@nomicfoundation/ethereumjs-tx": "npm:5.0.2" - "@nomicfoundation/ethereumjs-util": "npm:9.0.2" - "@nomicfoundation/ethereumjs-vm": "npm:7.0.2" + "@nomicfoundation/edr": "npm:^0.3.1" + "@nomicfoundation/ethereumjs-common": "npm:4.0.4" + "@nomicfoundation/ethereumjs-tx": "npm:5.0.4" + "@nomicfoundation/ethereumjs-util": "npm:9.0.4" "@nomicfoundation/solidity-analyzer": "npm:^0.1.0" "@sentry/node": "npm:^5.18.1" "@types/bn.js": "npm:^5.1.0" @@ -14573,6 +14729,7 @@ __metadata: adm-zip: "npm:^0.4.16" aggregate-error: "npm:^3.0.0" ansi-escapes: "npm:^4.3.0" + boxen: "npm:^5.1.2" chalk: "npm:^2.4.2" chokidar: "npm:^3.4.0" ci-info: "npm:^2.0.0" @@ -14612,7 +14769,7 @@ __metadata: optional: true bin: hardhat: internal/cli/bootstrap.js - checksum: 652978cf195b6b7e1b94c4933561147c1c9c41c12284b84abf3791d8d115e57977439d16fad55ae144b33c19c07475c94ed7f5d50d3cc1e6ba47b540a902127e + checksum: c79747b9922c3010aa043c5b527c68dfcd20286a1a09296ae145bbfb96e73c05fe0e9ab6b652960022c7398817e3bc5164c70cdf34f9fa64f3d57a637dd4c857 languageName: node linkType: hard @@ -15126,7 +15283,7 @@ __metadata: languageName: node linkType: hard -"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": +"import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" dependencies: @@ -17660,6 +17817,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:9.0.3": + version: 9.0.3 + resolution: "minimatch@npm:9.0.3" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: c81b47d28153e77521877649f4bab48348d10938df9e8147a58111fe00ef89559a2938de9f6632910c4f7bf7bb5cd81191a546167e58d357f0cfb1e18cecc1c5 + languageName: node + linkType: hard + "minimatch@npm:^5.0.1": version: 5.1.0 resolution: "minimatch@npm:5.1.0" @@ -18153,13 +18319,6 @@ __metadata: languageName: node linkType: hard -"natural-compare-lite@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare-lite@npm:1.4.0" - checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 - languageName: node - linkType: hard - "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -18819,17 +18978,17 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.9.1": - version: 0.9.1 - resolution: "optionator@npm:0.9.1" +"optionator@npm:^0.9.3": + version: 0.9.3 + resolution: "optionator@npm:0.9.3" dependencies: + "@aashutoshrathi/word-wrap": "npm:^1.2.3" deep-is: "npm:^0.1.3" fast-levenshtein: "npm:^2.0.6" levn: "npm:^0.4.1" prelude-ls: "npm:^1.2.1" type-check: "npm:^0.4.0" - word-wrap: "npm:^1.2.3" - checksum: 19cfb625ba3cafd99c204744595a8b5111491632d379be341a8286c53a0101adac6f7ca9be4319ccecaaf5d43a55e65dde8b434620726032472833d958d43698 + checksum: fa28d3016395974f7fc087d6bbf0ac7f58ac3489f4f202a377e9c194969f329a7b88c75f8152b33fb08794a30dcd5c079db6bb465c28151357f113d80bbf67da languageName: node linkType: hard @@ -21576,7 +21735,7 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": +"string-width@npm:^1.0.2 || 2 || 3 || 4, string-width@npm:^4.0.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.2, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" dependencies: @@ -21790,7 +21949,7 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": +"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" checksum: 492f73e27268f9b1c122733f28ecb0e7e8d8a531a6662efbd08e22cccb3f9475e90a1b82cab06a392f6afae6d2de636f977e231296400d0ec5304ba70f166443 @@ -22238,6 +22397,15 @@ __metadata: languageName: node linkType: hard +"ts-api-utils@npm:^1.0.1": + version: 1.3.0 + resolution: "ts-api-utils@npm:1.3.0" + peerDependencies: + typescript: ">=4.2.0" + checksum: 3ee44faa24410cd649b5c864e068d438aa437ef64e9e4a66a41646a6d3024d3097a695eeb3fb26ee364705d3cb9653a65756d009e6a53badb6066a5f447bf7ed + languageName: node + linkType: hard + "ts-command-line-args@npm:^2.2.0": version: 2.3.1 resolution: "ts-command-line-args@npm:2.3.1" @@ -22321,8 +22489,8 @@ __metadata: linkType: hard "ts-node@npm:^10.8.0": - version: 10.9.1 - resolution: "ts-node@npm:10.9.1" + version: 10.9.2 + resolution: "ts-node@npm:10.9.2" dependencies: "@cspotcode/source-map-support": "npm:^0.8.0" "@tsconfig/node10": "npm:^1.0.7" @@ -22354,11 +22522,11 @@ __metadata: ts-node-script: dist/bin-script.js ts-node-transpile-only: dist/bin-transpile.js ts-script: dist/bin-script-deprecated.js - checksum: bee56d4dc96ccbafc99dfab7b73fbabc62abab2562af53cdea91c874a301b9d11e42bc33c0a032a6ed6d813dbdc9295ec73dde7b73ea4ebde02b0e22006f7e04 + checksum: a91a15b3c9f76ac462f006fa88b6bfa528130dcfb849dd7ef7f9d640832ab681e235b8a2bc58ecde42f72851cc1d5d4e22c901b0c11aa51001ea1d395074b794 languageName: node linkType: hard -"tslib@npm:1.14.1, tslib@npm:^1.11.1, tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": +"tslib@npm:1.14.1, tslib@npm:^1.11.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: 7dbf34e6f55c6492637adb81b555af5e3b4f9cc6b998fb440dac82d3b42bdc91560a35a5fb75e20e24a076c651438234da6743d139e4feabf0783f3cdfe1dddb @@ -22386,17 +22554,6 @@ __metadata: languageName: node linkType: hard -"tsutils@npm:^3.21.0": - version: 3.21.0 - resolution: "tsutils@npm:3.21.0" - dependencies: - tslib: "npm:^1.8.1" - peerDependencies: - typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - checksum: ea036bec1dd024e309939ffd49fda7a351c0e87a1b8eb049570dd119d447250e2c56e0e6c00554e8205760e7417793fdebff752a46e573fbe07d4f375502a5b2 - languageName: node - linkType: hard - "tsx@npm:^4.7.1": version: 4.7.1 resolution: "tsx@npm:4.7.1" @@ -22558,7 +22715,7 @@ __metadata: languageName: node linkType: hard -"typechain@npm:^8.0.0, typechain@npm:^8.3.2": +"typechain@npm:8.3.2": version: 8.3.2 resolution: "typechain@npm:8.3.2" dependencies: @@ -22580,6 +22737,28 @@ __metadata: languageName: node linkType: hard +"typechain@patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch": + version: 8.3.2 + resolution: "typechain@patch:typechain@npm%3A8.3.2#~/.yarn/patches/typechain-npm-8.3.2-b02e27439e.patch::version=8.3.2&hash=12f0f5" + dependencies: + "@types/prettier": "npm:^2.1.1" + debug: "npm:^4.3.1" + fs-extra: "npm:^7.0.0" + glob: "npm:7.1.7" + js-sha3: "npm:^0.8.0" + lodash: "npm:^4.17.15" + mkdirp: "npm:^1.0.4" + prettier: "npm:^2.3.1" + ts-command-line-args: "npm:^2.2.0" + ts-essentials: "npm:^7.0.1" + peerDependencies: + typescript: ">=4.3.0" + bin: + typechain: dist/cli/cli.js + checksum: 1ce15777d041b5df98976d6cb6163e130db9cc8203bffcfe1afe62d2336dfd6315b5bd75f8ecebe81b234a0f072c41c043e56d6c184c6fbaf329a9eb3ae55421 + languageName: node + linkType: hard + "typed-array-buffer@npm:^1.0.0": version: 1.0.0 resolution: "typed-array-buffer@npm:1.0.0" @@ -22643,13 +22822,13 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.1.6": - version: 5.1.6 - resolution: "typescript@npm:5.1.6" +"typescript@npm:5.3.3": + version: 5.3.3 + resolution: "typescript@npm:5.3.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: f347cde665cf43dc4c1c7d9821c7d9bbec3c3914f4bdd82ee490e9fb9f6d99036ed8666463b6a192dd005eeef333c5087d5931bdd51ec853436ff9a670a7417e + checksum: 6e4e6a14a50c222b3d14d4ea2f729e79f972fa536ac1522b91202a9a65af3605c2928c4a790a4a50aa13694d461c479ba92cedaeb1e7b190aadaa4e4b96b8e18 languageName: node linkType: hard @@ -22663,13 +22842,13 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.1.6#optional!builtin": - version: 5.1.6 - resolution: "typescript@patch:typescript@npm%3A5.1.6#optional!builtin::version=5.1.6&hash=5da071" +"typescript@patch:typescript@npm%3A5.3.3#optional!builtin": + version: 5.3.3 + resolution: "typescript@patch:typescript@npm%3A5.3.3#optional!builtin::version=5.3.3&hash=e012d7" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: f5481fa3ba0eee8970f46708d13c05650a865ad093b586fc9573f425c64c57ca97e3308e110bb528deb3ccebe83f6fd7b5a8ac90018038da96326a9ccdf8e77c + checksum: c93786fcc9a70718ba1e3819bab56064ead5817004d1b8186f8ca66165f3a2d0100fee91fa64c840dcd45f994ca5d615d8e1f566d39a7470fc1e014dbb4cf15d languageName: node linkType: hard @@ -23811,6 +23990,15 @@ __metadata: languageName: node linkType: hard +"widest-line@npm:^3.1.0": + version: 3.1.0 + resolution: "widest-line@npm:3.1.0" + dependencies: + string-width: "npm:^4.0.0" + checksum: 03db6c9d0af9329c37d74378ff1d91972b12553c7d72a6f4e8525fe61563fa7adb0b9d6e8d546b7e059688712ea874edd5ded475999abdeedf708de9849310e0 + languageName: node + linkType: hard + "wonka@npm:^6.0.0, wonka@npm:^6.1.2": version: 6.3.4 resolution: "wonka@npm:6.3.4" @@ -23818,7 +24006,7 @@ __metadata: languageName: node linkType: hard -"word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3": +"word-wrap@npm:~1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3" checksum: 08a677e1578b9cc367a03d52bc51b6869fec06303f68d29439e4ed647257411f857469990c31066c1874678937dac737c9f8f20d3fd59918fb86b7d926a76b15