chore: don't ask for api key if it already exists (#4549)

### Description

CLI will ask for API keys even if your (local) registry already includes
the API key. This PR fixes that.

Can't say i love the current code setup, it seems to me that it should
be more like a pass on the registry and filter chains that don't have
api keys, prompt for the api key and then persist that in the registry
if its writable. But since i have so little context, kept it mostly this
way to accomplish the desired product experience.
pull/4535/head
Nam Chu Hoai 1 month ago committed by GitHub
parent ba15abef17
commit 0a22e96553
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      typescript/cli/src/context/context.ts

@ -195,6 +195,10 @@ export async function getOrRequestApiKeys(
const apiKeys: ChainMap<string> = {};
for (const chain of chains) {
if (chainMetadata[chain]?.blockExplorers?.[0]?.apiKey) {
apiKeys[chain] = chainMetadata[chain]!.blockExplorers![0]!.apiKey!;
continue;
}
const wantApiKey = await confirm({
default: false,
message: `Do you want to use an API key to verify on this (${chain}) chain's block explorer`,

Loading…
Cancel
Save