diff --git a/apps/contract-verification/src/app/types/defaults.ts b/apps/contract-verification/src/app/types/defaults.ts index 61148c60b8..26030304d4 100644 --- a/apps/contract-verification/src/app/types/defaults.ts +++ b/apps/contract-verification/src/app/types/defaults.ts @@ -16,16 +16,17 @@ const DEFAULTS: SettingsForVerifier = { }, } -export function getSettingsForChain(chainId: string, userSettings: ContractVerificationSettings): ChainSettings { +export function mergeChainSettingsWithDefaults(chainId: string, userSettings: ContractVerificationSettings): ChainSettings { const verifiers: SettingsForVerifier = {} - for (const verifierId in VERIFIERS) { + for (const verifierId of VERIFIERS) { const userSetting: VerifierSettings = userSettings.chains[chainId]?.verifiers[verifierId] if (userSetting) { verifiers[verifierId] = { ...userSetting } // Only apply default settings for Etherscan and Blockscout on mainnet if (verifierId === 'Sourcify' || chainId === '1') { + // Add keys not defined by user for (const key of Object.keys(DEFAULTS[verifierId])) { if (!verifiers[verifierId][key]) { verifiers[verifierId][key] = DEFAULTS[verifierId][key] diff --git a/apps/contract-verification/src/app/views/SettingsView.tsx b/apps/contract-verification/src/app/views/SettingsView.tsx index 924ba2594a..ff439525ee 100644 --- a/apps/contract-verification/src/app/views/SettingsView.tsx +++ b/apps/contract-verification/src/app/views/SettingsView.tsx @@ -1,7 +1,7 @@ import { useContext, useState } from 'react' import { SearchableChainDropdown, ConfigInput } from '../components' import type { VerifierIdentifier, Chain, VerifierSettings, ContractVerificationSettings } from '../types' -import { getSettingsForChain as mergeChainSettingsWithDefaults } from '../types' +import { mergeChainSettingsWithDefaults } from '../types' import { AppContext } from '../AppContext' export const SettingsView = () => { @@ -23,7 +23,6 @@ export const SettingsView = () => { changedSettings.chains[chainId].verifiers[verifier][key] = value setSettings(changedSettings) - console.log(changedSettings) } return (