From 7fd53a1759c2443322ef2b729617d79c0b183e7f Mon Sep 17 00:00:00 2001 From: dule-git <61541725+dule-git@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:00:00 +0100 Subject: [PATCH] Expand the recognition of RPC url for Tenderly network (#173) * add another regex entry into recognition of tenderly network. * Version changes --- .changeset/silent-impalas-return.md | 5 +++++ packages/tenderly-hardhat/src/utils/util.ts | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .changeset/silent-impalas-return.md diff --git a/.changeset/silent-impalas-return.md b/.changeset/silent-impalas-return.md new file mode 100644 index 00000000..b9f3ed03 --- /dev/null +++ b/.changeset/silent-impalas-return.md @@ -0,0 +1,5 @@ +--- +"@tenderly/hardhat-tenderly": patch +--- + +Expand the recognition of RPC url for Tenderly networks diff --git a/packages/tenderly-hardhat/src/utils/util.ts b/packages/tenderly-hardhat/src/utils/util.ts index 77679335..4c34cfa4 100644 --- a/packages/tenderly-hardhat/src/utils/util.ts +++ b/packages/tenderly-hardhat/src/utils/util.ts @@ -60,7 +60,7 @@ export const makeVerifyContractsRequest = async ( } logger.trace("Found network is:", networkName); - let chainId = undefined; + let chainId; if (isTenderlyNetworkConfig(hre.config.networks[networkName]) && platformID !== undefined) { chainId = platformID; } else if (hre.network?.config?.chainId !== undefined) { @@ -133,9 +133,9 @@ async function insertLibraries( const copiedCompiler: SolcConfig = { version: originalCompiler.version, settings: { - ...originalCompiler.settings - } - } + ...originalCompiler.settings, + }, + }; if (libraries === undefined || libraries === null) { return copiedCompiler; } @@ -447,8 +447,10 @@ export const isTenderlyNetworkConfig = (nw: NetworkConfig): boolean => { // The network belongs to tenderly if the rpc_url is one of the following: // - https://rpc.vnet.tenderly.co/devnet/... // - https://.rpc.tenderly.co/... + // - https://virtual..rpc.tenderly.co/... // - https://rpc.tenderly.co/... - const regex = /^https?:\/\/(?:rpc\.vnet\.tenderly\.co\/devnet\/|(?:[\w-]+\.rpc|rpc)\.tenderly\.co\/).*$/; + const regex = + /^https?:\/\/(?:rpc\.vnet\.tenderly\.co\/devnet\/|(?:[\w-]+\.rpc|rpc)\.tenderly\.co\/|virtual\.[\w-]+\.rpc\.tenderly\.co\/).*$/; return regex.test(nw.url); };