Skip to content

Commit

Permalink
Simplify regex
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h committed Nov 25, 2024
1 parent a34c9cf commit 6306e75
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cli/src/command-helpers/abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const getContractNameForAddress = async (
const contractSourceCode = await fetchSourceCodeFromEtherscan(network, address);
let contractName = contractSourceCode.result[0].ContractName;
// Some explorers will return the full path of the contract instead of just the name
const regex = /^contracts\/(?<contract>.+)\.sol:\1$/;
const regex = /(?<contract>.+)\.sol:\1$/;

if (regex.test(contractName)) contractName = regex.exec(contractName)?.groups?.contract;

Expand Down

0 comments on commit 6306e75

Please sign in to comment.