diff --git a/packages/apps/public/locales/en/react-components.json b/packages/apps/public/locales/en/react-components.json index 7adf6a05f1..789f8cb9ee 100644 --- a/packages/apps/public/locales/en/react-components.json +++ b/packages/apps/public/locales/en/react-components.json @@ -48,6 +48,7 @@ "no tags": "no tags", "ongoing referendum": "ongoing referendum", "only this network": "only this network", + "per block": "per block", "proposed by": "proposed by", "redeemable": "redeemable", "reserved": "reserved", @@ -60,6 +61,7 @@ "type": "type", "unbonding": "unbonding", "unstake threshold": "unstake threshold", + "until block": "until block", "use on any network": "use on any network", "using my account": "using my account", "value": "value", @@ -75,4 +77,4 @@ "{{blocks}} blocks": "{{blocks}} blocks", "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)" -} \ No newline at end of file +} diff --git a/packages/apps/public/locales/en/translation.json b/packages/apps/public/locales/en/translation.json index c182faf9b6..92ffbbd2aa 100644 --- a/packages/apps/public/locales/en/translation.json +++ b/packages/apps/public/locales/en/translation.json @@ -972,6 +972,7 @@ "pending extrinsics": "", "pending hashes": "", "pending swap id": "", + "per block": "", "period": "", "pgp hash": "", "points": "", @@ -1106,6 +1107,7 @@ "unchecked weight for this call": "", "unlock account with password": "", "unstake threshold": "", + "until block": "", "update on #{{index}}": "", "upgradable extensions": "", "use on any network": "", @@ -1166,4 +1168,4 @@ "{{threshold}}, not passing": "", "{{threshold}}, passing": "", "{{value}}x voting balance, locked for {{lock}}x enactment ({{period}} days)": "" -} \ No newline at end of file +} diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index fb5c9a83de..88d271e9e2 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { DeriveBalancesAll, DeriveDemocracyLock, DeriveStakingAccount } from '@polkadot/api-derive/types'; -import { LockIdentifier, ValidatorPrefsTo145 } from '@polkadot/types/interfaces'; +import { BlockNumber, LockIdentifier, ValidatorPrefsTo145 } from '@polkadot/types/interfaces'; import BN from 'bn.js'; import React from 'react'; @@ -11,8 +11,8 @@ import styled from 'styled-components'; import { BN_ZERO, formatBalance, formatNumber, hexToString, isObject } from '@polkadot/util'; import { Expander, Icon, Tooltip } from '@polkadot/react-components'; import { withCalls, withMulti } from '@polkadot/react-api/hoc'; -import { useAccounts } from '@polkadot/react-hooks'; -import { FormatBalance } from '@polkadot/react-query'; +import { useAccounts, useApi, useCall } from '@polkadot/react-hooks'; +import { BlockToTime, FormatBalance } from '@polkadot/react-query'; import DemocracyLocks from './DemocracyLocks'; import StakingRedeemable from './StakingRedeemable'; @@ -215,13 +215,13 @@ function renderValidatorPrefs ({ stakingInfo, withValidatorPrefs = false }: Prop ); } -function renderBalances (props: Props, allAccounts: string[], t: (key: string) => T): React.ReactNode { +function renderBalances (props: Props, allAccounts: string[], bestNumber: BlockNumber | undefined, t: (key: string) => T): React.ReactNode { const { address, balancesAll, democracyLocks, stakingInfo, withBalance = true, withBalanceToggle = false } = props; const balanceDisplay = withBalance === true ? DEFAULT_BALANCES : withBalance || false; - if (!balanceDisplay) { + if (!bestNumber || !balanceDisplay) { return null; } @@ -269,7 +269,16 @@ function renderBalances (props: Props, allAccounts: string[], t: (k > {formatBalance(balancesAll.vestedClaimable, { forceUnit: '-' })}
{t('available to be unlocked')}
+
+ {formatBalance(balancesAll.vestedClaimable, { forceUnit: '-' })} +
{t('available to be unlocked')}
+ {formatBalance(balancesAll.vestingPerBlock)} +
{t('per block')}
+
+
{`${t('until block')} ${formatNumber(balancesAll.vestingEndBlock)}`}
+ +
+
} trigger={`${address}-vested-trigger`} /> @@ -379,13 +388,15 @@ function renderBalances (props: Props, allAccounts: string[], t: (k function AddressInfo (props: Props): React.ReactElement { const { t } = useTranslation(); + const { api } = useApi(); const { allAccounts } = useAccounts(); + const bestNumber = useCall(api.derive.chain.bestNumber); const { children, className = '', extraInfo, withBalanceToggle, withHexSessionId } = props; return (
- {renderBalances(props, allAccounts, t)} + {renderBalances(props, allAccounts, bestNumber, t)} {withHexSessionId && withHexSessionId[0] && ( <>