Skip to content

Commit

Permalink
Get isEthereum from chain properties (#9667)
Browse files Browse the repository at this point in the history
* Get isEthereum from chain properties

* Set isEthereum in registry

* Update with latest api changes

* Lint
  • Loading branch information
fgamundi authored Dec 18, 2023
1 parent 73b536d commit 7c582f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-api/src/Api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise<InjectedExten
!DISALLOW_EXTENSIONS.includes(source)
),
properties: statics.registry.createType('ChainProperties', {
isEthereum: api.registry.chainIsEthereum,
ss58Format: api.registry.chainSS58,
tokenDecimals: api.registry.chainDecimals,
tokenSymbol: api.registry.chainTokens
Expand All @@ -142,14 +143,15 @@ 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()) || urlIsEthereum;
const isEthereum = properties.isEthereum.isTrue || ethereumChains.includes(api.runtimeVersion.specName.toString()) || urlIsEthereum;
const isDevelopment = (systemChainType.isDevelopment || systemChainType.isLocal || isTestChain(systemChain));

console.log(`chain: ${systemChain} (${systemChainType.toString()}), ${stringify(properties)}`);

// explicitly override the ss58Format as specified
statics.registry.setChainProperties(
statics.registry.createType('ChainProperties', {
isEthereum,
ss58Format,
tokenDecimals,
tokenSymbol
Expand Down

0 comments on commit 7c582f0

Please sign in to comment.