Display parathread info (w/ api & specName) (#5280)

This commit is contained in:
Jaco 2021-05-14 14:40:00 +03:00 committed by GitHub
parent 093dc60835
commit 308ff07ac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 8 deletions

View File

@ -26,7 +26,7 @@ function ParachainInfo ({ className, id }: Props): React.ReactElement<Props> {
return (
<div className={className}>
{bestNumber && <div>{formatNumber(bestNumber)}</div>}
{runtimeVersion && <div className='version'>v{runtimeVersion.specVersion.toString()}</div>}
{runtimeVersion && <div className='version'><div className='media--1100'>{runtimeVersion.specName.toString()}</div><div className='media--1100'>/</div><div>{runtimeVersion.specVersion.toString()}</div></div>}
</div>
);
}
@ -34,5 +34,13 @@ function ParachainInfo ({ className, id }: Props): React.ReactElement<Props> {
export default React.memo(styled(ParachainInfo)`
.version {
font-size: 0.85rem;
white-space: nowrap;
> div {
display: inline-block;
overflow: hidden;
max-width: 10em;
text-overflow: ellipsis;
}
}
`);

View File

@ -12,6 +12,7 @@ import { useAccounts, useApi, useCallMulti } from '@polkadot/react-hooks';
import { formatNumber } from '@polkadot/util';
import Lifecycle from '../Overview/Lifecycle';
import ParachainInfo from '../Overview/ParachainInfo';
import Periods from '../Overview/Periods';
import { useTranslation } from '../translate';
import { sliceHex } from '../util';
@ -79,7 +80,11 @@ function Upcoming ({ id, leasePeriod, leases, nextAction }: Props): React.ReactE
nextAction={nextAction}
/>
</td>
<td className='all number together'>
<td className='all' />
<td className='number no-pad-left'>
<ParachainInfo id={id} />
</td>
<td className='number together'>
{leasePeriod && leases && periods && (
leases.length
? (

View File

@ -85,6 +85,8 @@ function Parathreads ({ actionsQueue, className, ids, leasePeriod, ownedIds }: P
['', 'media--1100'],
[t('head'), 'start media--1500'],
[t('lifecycle'), 'start'],
[],
[t('chain'), 'no-pad-left'],
[t('leases')],
['', 'media--900']
]);

View File

@ -91,7 +91,7 @@ async function getInjectedAccounts (injectedPromise: Promise<InjectedExtension[]
}
}));
} catch (error) {
console.error('web3Enable', error);
console.error('web3Accounts', error);
return [];
}
@ -109,13 +109,13 @@ async function retrieve (api: ApiPromise, injectedPromise: Promise<InjectedExten
getInjectedAccounts(injectedPromise)
]);
// HACK Horrible hack to try and give some window to the DOT denomination
const ss58Format = api.consts.system?.ss58Prefix || chainProperties.ss58Format;
const properties = registry.createType('ChainProperties', { ss58Format, tokenDecimals: chainProperties.tokenDecimals, tokenSymbol: chainProperties.tokenSymbol });
return {
injectedAccounts,
properties,
properties: registry.createType('ChainProperties', {
ss58Format: api.consts.system?.ss58Prefix || chainProperties.ss58Format,
tokenDecimals: chainProperties.tokenDecimals,
tokenSymbol: chainProperties.tokenSymbol
}),
systemChain: (systemChain || '<unknown>').toString(),
systemChainType,
systemName: systemName.toString(),