diff --git a/packages/app-extrinsics/src/Balance.tsx b/packages/app-extrinsics/src/Balance.tsx index 319efd9351..1445b3c327 100644 --- a/packages/app-extrinsics/src/Balance.tsx +++ b/packages/app-extrinsics/src/Balance.tsx @@ -5,18 +5,18 @@ import { BareProps, CallProps } from '@polkadot/ui-api/types'; import React from 'react'; -import { Balance } from '@polkadot/types'; +import { DerivedBalances } from '@polkadot/api-derive/types'; import { withCalls, withMulti } from '@polkadot/ui-api'; import { InputBalance } from '@polkadot/ui-app'; type Props = BareProps & CallProps & { - balances_freeBalance?: Balance, + balances_all?: DerivedBalances, label?: React.ReactNode }; class BalanceDisplay extends React.PureComponent { render () { - const { className, label, style, balances_freeBalance } = this.props; + const { className, label, style, balances_all } = this.props; return ( { isDisabled label={label} style={style} - defaultValue={balances_freeBalance} + defaultValue={balances_all && balances_all.freeBalance} /> ); } @@ -33,6 +33,6 @@ class BalanceDisplay extends React.PureComponent { export default withMulti( BalanceDisplay, withCalls( - ['query.balances.freeBalance', { paramName: 'params' }] + ['derive.balances.all', { paramName: 'params' }] ) ); diff --git a/packages/app-staking/src/Account/index.tsx b/packages/app-staking/src/Account/index.tsx index 0efc414425..aa6f8c9991 100644 --- a/packages/app-staking/src/Account/index.tsx +++ b/packages/app-staking/src/Account/index.tsx @@ -2,16 +2,17 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalancesMap, DerivedStaking } from '@polkadot/api-derive/types'; -import { AccountId, Balance, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types'; +import { AccountFilter, RecentlyOfflineMap } from '../types'; +import { AccountId, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types'; import { ApiProps } from '@polkadot/ui-api/types'; -import { AddressMini, AddressSummary, Button, TxButton } from '@polkadot/ui-app'; +import { DerivedBalances, DerivedBalancesMap, DerivedStaking } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/ui-app/types'; import { KeyringSectionOption } from '@polkadot/ui-keyring/options/types'; + import React from 'react'; +import { AddressMini, AddressSummary, Button, TxButton } from '@polkadot/ui-app'; import { withCalls } from '@polkadot/ui-api'; -import { AccountFilter, RecentlyOfflineMap } from '../types'; import Bond from './Bond'; import BondExtra from './BondExtra'; import Nominating from './Nominating'; @@ -26,7 +27,7 @@ type Props = ApiProps & I18nProps & { filter: AccountFilter, isValidator: boolean, recentlyOffline: RecentlyOfflineMap, - freeBalance?: Balance, + balances_all?: DerivedBalances, staking_info?: DerivedStaking, stashOptions: Array }; @@ -315,14 +316,14 @@ class Account extends React.PureComponent { } private renderButtons () { - const { accountId, freeBalance, t } = this.props; + const { accountId, balances_all, t } = this.props; const { isActiveStash, isActiveController, nominators, sessionId, stakingLedger, validatorPrefs } = this.state; const buttons = []; if (isActiveStash) { // only show a "Bond Additional" button if this stash account actually doesn't bond everything already // staking_ledger.total gives the total amount that can be slashed (any active amount + what is being unlocked) - if (freeBalance && stakingLedger && stakingLedger.total && (freeBalance.gt(stakingLedger.total))) { + if (balances_all && stakingLedger && stakingLedger.total && (balances_all.freeBalance.gt(stakingLedger.total))) { buttons.push(