Skip to content

Commit 84b3d9e

Browse files
committed
Throw early for non-EVM chains
1 parent f1746c5 commit 84b3d9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/cli/src/command-helpers/contracts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ export class ContractService {
160160
const network = this.registry.getNetworkById(networkId);
161161
if (!network) throw new Error(`Invalid network ${networkId}`);
162162

163-
const chainId = network.caip2Id.split(':')[1];
164-
if (!/^\d+$/.test(chainId))
165-
throw new Error(`Invalid chainId, Sourcify API expects integer value, got '${chainId}'`);
163+
if (!network.caip2Id.startsWith('eip155'))
164+
throw new Error(`Invalid chainId, Sourcify API only supports EVM chains`);
166165

166+
const chainId = network.caip2Id.split(':')[1];
167167
const url = `https://sourcify.dev/server/files/any/${chainId}/${address}`;
168168
const json:
169169
| {

0 commit comments

Comments
 (0)