From 74ea7dd3aae833251e051250ae17d74e711fe890 Mon Sep 17 00:00:00 2001 From: Jaco Date: Wed, 13 Oct 2021 17:44:09 +0300 Subject: [PATCH] Display multiple vesting schedules (#6282) * Display multiple vesting schedules * Bump API --- package.json | 12 +- packages/page-accounts/package.json | 2 +- packages/page-contracts/package.json | 2 +- packages/react-api/package.json | 2 +- packages/react-components/src/AddressInfo.tsx | 110 +++++++++++------- packages/test-support/package.json | 2 +- yarn.lock | 108 ++++++++--------- 7 files changed, 130 insertions(+), 108 deletions(-) diff --git a/package.json b/package.json index fa71887ee5..2c392dc772 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,15 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^6.3.2-11", - "@polkadot/api-contract": "^6.3.2-11", + "@polkadot/api": "^6.3.2-12", + "@polkadot/api-contract": "^6.3.2-12", "@polkadot/hw-ledger": "^7.4.1", "@polkadot/keyring": "^7.4.1", "@polkadot/networks": "^7.4.1", - "@polkadot/phishing": "^0.6.347", - "@polkadot/types": "^6.3.2-11", - "@polkadot/types-known": "^6.3.2-11", - "@polkadot/types-support": "^6.3.2-11", + "@polkadot/phishing": "^0.6.350", + "@polkadot/types": "^6.3.2-12", + "@polkadot/types-known": "^6.3.2-12", + "@polkadot/types-support": "^6.3.2-12", "@polkadot/util": "^7.4.1", "@polkadot/util-crypto": "^7.4.1", "@polkadot/wasm-crypto": "^4.2.1", diff --git a/packages/page-accounts/package.json b/packages/page-accounts/package.json index b2692a3a68..4ec1bef50d 100644 --- a/packages/page-accounts/package.json +++ b/packages/page-accounts/package.json @@ -6,7 +6,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.15.4", - "@polkadot/phishing": "^0.6.347", + "@polkadot/phishing": "^0.6.350", "@polkadot/react-components": "^0.96.2-66", "@polkadot/vanitygen": "^0.47.2", "detect-browser": "^5.2.1", diff --git a/packages/page-contracts/package.json b/packages/page-contracts/package.json index 4127d41d45..c56f6656b3 100644 --- a/packages/page-contracts/package.json +++ b/packages/page-contracts/package.json @@ -6,6 +6,6 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.15.4", - "@polkadot/api-contract": "^6.3.2-11" + "@polkadot/api-contract": "^6.3.2-12" } } diff --git a/packages/react-api/package.json b/packages/react-api/package.json index 9c69f593a9..06cf73ea46 100644 --- a/packages/react-api/package.json +++ b/packages/react-api/package.json @@ -6,7 +6,7 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.15.4", - "@polkadot/api": "^6.3.2-11", + "@polkadot/api": "^6.3.2-12", "@polkadot/extension-compat-metamask": "^0.40.4-0", "@polkadot/extension-dapp": "^0.40.4-0", "@substrate/connect": "^0.4.1", diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index 07362c8ff7..410d3bfb49 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -224,6 +224,7 @@ function renderValidatorPrefs ({ stakingInfo, withValidatorPrefs = false }: Prop function createBalanceItems (formatIndex: number, lookup: Record, t: TFunction, { address, balanceDisplay, balancesAll, bestNumber, democracyLocks, isAllLocked, otherBonded, ownBonded, stakingInfo, votingOf, withBalanceToggle, withLabel }: { address: string; balanceDisplay: BalanceActiveType; balancesAll?: DeriveBalancesAll | DeriveBalancesAccountData; bestNumber: BlockNumber; democracyLocks?: DeriveDemocracyLock[]; isAllLocked: boolean; otherBonded: BN[]; ownBonded: BN; stakingInfo?: DeriveStakingAccount; votingOf?: Voting; withBalanceToggle: boolean, withLabel: boolean }): React.ReactNode { const allItems: React.ReactNode[] = []; + const deriveBalances = balancesAll as DeriveBalancesAll; !withBalanceToggle && balancesAll && balanceDisplay.total && allItems.push( @@ -236,58 +237,71 @@ function createBalanceItems (formatIndex: number, lookup: Record /> ); - balancesAll && balanceDisplay.available && (balancesAll as DeriveBalancesAll).availableBalance && allItems.push( + balancesAll && balanceDisplay.available && deriveBalances.availableBalance && allItems.push( ); - balanceDisplay.vested && (balancesAll as DeriveBalancesAll)?.isVesting && allItems.push( - - + ); + } + + balanceDisplay.locked && balancesAll && (isAllLocked || deriveBalances.lockedBalance?.gtn(0)) && allItems.push(