Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function BestNumber ({ children, className, label, style }: Props): React.ReactElement {
const { api, isApiReady } = useApi();
const bestNumber = useCall(isApiReady ? api.derive.chain.bestNumber as any : undefined, []);
return (
<div style="{style}">
{label || ''}{
bestNumber
? formatNumber(bestNumber)
: '-'
}{children}
</div>
);
}
const publicPropCount = useCall(api.query.democracy.publicPropCount, []);
const referendumCount = useCall(api.query.democracy.referendumCount, []);
return (
<section>
{formatNumber(activeProposals?.length)}
{formatNumber(publicPropCount)}
</section>
<section>
{formatNumber((referendumCount || ZERO).sub(nextActive || ZERO))}
{formatNumber(referendumCount)}
</section>
{bestNumber && (
<section>
</section>
)}
<details>
<summary>{
meta && meta.documentation
? meta.documentation.join(' ')
: t('Details')
}</summary>
</details>
{
extrinsic.isSigned
?
: null
}
export default function BestFinalized ({ children, className, label, style }: Props): React.ReactElement {
const { api } = useApi();
const bestNumberFinalized = useCall(api.derive.chain.bestNumberFinalized as any, []);
return (
<div style="{style}">
{label || ''}{
bestNumberFinalized
? formatNumber(bestNumberFinalized)
: '-'
}{children}
</div>
);
}
)
: {t('other stake')}} value={stakeOther}> ({formatNumber(nominators.length)})
)}
{!isExpanded && (
<>
{(commission || validatorPayment) && (
commission
? <><label>{t('commission')}</label>{commission}
: {t('commission')}} value={validatorPayment} />
)}
{points && points.gtn(0) && (
<><label>{t('points')}</label>{formatNumber(points)}
)}
{lastBlockNumber && <><label>{t('last #')}</label>{lastBlockNumber}}
{hasQueries && api.query.imOnline?.authoredBlocks && (
)}
)}
return (
<section>
{formatNumber(activeProposals?.length)}
{formatNumber(publicPropCount)}
</section>
<section>
{formatNumber((referendumCount || ZERO).sub(nextActive || ZERO))}
{formatNumber(referendumCount)}
</section>
{bestNumber && (
<section>
</section>
)}
);
}
<span><b>Reserved:</b>{reservedBalance && {formatBalance(reservedBalance)}}</span>
<span><b>Locked:</b>{lockedBalance && {formatBalance(lockedBalance)}}</span>
{renderUnlocking()}
);
};
return (
{allBalances
?
<strong>Total Balance:</strong> {allBalances.freeBalance && formatBalance(allBalances.freeBalance)}
Transactions: {formatNumber(allBalances.accountNonce)}
:
}
{
detailed &&
allBalances &&
renderDetailedBalances()
}
);
}
function ProposalDisplay ({ className, proposal: { council, id, proposal }, t }: Props): React.ReactElement | null {
return (
<h1>{formatNumber(id)}</h1>
{t('bond')}}
value={proposal.bond}
/>
{t('beneficiary')}}
value={proposal.beneficiary}
/>
function Motion ({ className, motion: { hash, proposal, votes }, t }: Props): React.ReactElement | null {
if (!votes) {
return null;
}
const { ayes, index, nays, threshold } = votes;
return (
<h1>{formatNumber(index)}</h1>
<label>{t('threshold')}</label>
{formatNumber(ayes.length)}/{formatNumber(threshold)}
{ayes.map((address, index): React.ReactNode => (
function renderExtended ({ balancesAll, t, address, withExtended }: Props): React.ReactNode {
const extendedDisplay = withExtended === true
? DEFAULT_EXTENDED
: withExtended || undefined;
if (!extendedDisplay) {
return null;
}
return (
<div>
{balancesAll && extendedDisplay.nonce && (
<>
<label label="{t('transactions')}">
<div>{formatNumber(balancesAll.accountNonce)}</div>
)}
{extendedDisplay.crypto && (
<>
<label label="{t('type')}">
)}
</label></label></div>
);
}