diff --git a/typescript/sdk/src/providers/MultiProvider.ts b/typescript/sdk/src/providers/MultiProvider.ts index fb7f9e188..9990aaaf2 100644 --- a/typescript/sdk/src/providers/MultiProvider.ts +++ b/typescript/sdk/src/providers/MultiProvider.ts @@ -40,9 +40,13 @@ export class MultiProvider { chainMetadata: ChainMap = defaultChainMetadata, options: MultiProviderOptions = {}, ) { - Object.values(chainMetadata).forEach((cm) => { + Object.entries(chainMetadata).forEach(([key, cm]) => { if (!isValidChainMetadata(cm)) throw new Error(`Invalid chain metadata for ${cm.chainId}`); + if (key !== cm.name) + throw new Error( + `Chain name mismatch: Key was ${key}, but name is ${cm.name}`, + ); }); this.metadata = chainMetadata;