Skip to content

Commit

Permalink
Expand the recognition of RPC url for Tenderly network (#173)
Browse files Browse the repository at this point in the history
* add another regex entry into recognition of tenderly network.

* Version changes
  • Loading branch information
dule-git committed Jan 31, 2024
1 parent b2a7831 commit 7fd53a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-impalas-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tenderly/hardhat-tenderly": patch
---

Expand the recognition of RPC url for Tenderly networks
12 changes: 7 additions & 5 deletions packages/tenderly-hardhat/src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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://<network_name>.rpc.tenderly.co/...
// - https://virtual.<network_name>.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);
};

Expand Down

0 comments on commit 7fd53a1

Please sign in to comment.