From 48dafee04709715e45168c39be92b40b54737ba7 Mon Sep 17 00:00:00 2001 From: Nikos Kontakis Date: Tue, 12 Dec 2023 08:27:28 +0200 Subject: [PATCH] Change ethereum icons based on URL; Fixes #9632 (#9694) --- packages/react-api/src/Api.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/react-api/src/Api.tsx b/packages/react-api/src/Api.tsx index 2b6fc9ed62..b414c3ddfd 100644 --- a/packages/react-api/src/Api.tsx +++ b/packages/react-api/src/Api.tsx @@ -132,7 +132,7 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise, store: KeyringStore | undefined, types: Record>): Promise { +async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, injectedPromise: Promise, store: KeyringStore | undefined, types: Record>, urlIsEthereum = false): Promise { statics.registry.register(types); const { injectedAccounts, properties, systemChain, systemChainType, systemName, systemVersion } = await retrieve(api, injectedPromise); @@ -142,7 +142,7 @@ async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, inject : settings.prefix; const tokenSymbol = properties.tokenSymbol.unwrapOr([formatBalance.getDefaults().unit, ...DEFAULT_AUX]); const tokenDecimals = properties.tokenDecimals.unwrapOr([DEFAULT_DECIMALS]); - const isEthereum = ethereumChains.includes(api.runtimeVersion.specName.toString()); + const isEthereum = ethereumChains.includes(api.runtimeVersion.specName.toString()) || urlIsEthereum; const isDevelopment = (systemChainType.isDevelopment || systemChainType.isLocal || isTestChain(systemChain)); console.log(`chain: ${systemChain} (${systemChainType.toString()}), ${stringify(properties)}`); @@ -299,7 +299,9 @@ export function ApiCtxRoot ({ apiUrl, children, isElectron, store }: Props): Rea .then(setExtensions) .catch(console.error); - loadOnReady(statics.api, apiEndpoint, injectedPromise, store, types) + const urlIsEthereum = !!location.href.includes('keyring-type=ethereum'); + + loadOnReady(statics.api, apiEndpoint, injectedPromise, store, types, urlIsEthereum) .then(setState) .catch(onError); });