Skip to content

Commit

Permalink
Change ethereum icons based on URL; Fixes #9632 (#9694)
Browse files Browse the repository at this point in the history
  • Loading branch information
wirednkod authored Dec 12, 2023
1 parent b88b0af commit 48dafee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/react-api/src/Api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise<InjectedExten
};
}

async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, injectedPromise: Promise<InjectedExtension[]>, store: KeyringStore | undefined, types: Record<string, Record<string, string>>): Promise<ApiState> {
async function loadOnReady (api: ApiPromise, endpoint: LinkOption | null, injectedPromise: Promise<InjectedExtension[]>, store: KeyringStore | undefined, types: Record<string, Record<string, string>>, urlIsEthereum = false): Promise<ApiState> {
statics.registry.register(types);

const { injectedAccounts, properties, systemChain, systemChainType, systemName, systemVersion } = await retrieve(api, injectedPromise);
Expand All @@ -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)}`);
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 48dafee

Please sign in to comment.