diff --git a/package.json b/package.json index dae4e2a415..9b2d88449f 100644 --- a/package.json +++ b/package.json @@ -8,10 +8,10 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^1.9.0-beta.12", - "@polkadot/api-contract": "^1.9.0-beta.12", + "@polkadot/api": "^1.9.0-beta.16", + "@polkadot/api-contract": "^1.9.0-beta.16", "@polkadot/keyring": "^2.7.0-beta.8", - "@polkadot/types": "^1.9.0-beta.12", + "@polkadot/types": "^1.9.0-beta.16", "@polkadot/util": "^2.7.0-beta.8", "@polkadot/util-crypto": "^2.7.0-beta.8", "babel-core": "^7.0.0-bridge.0", diff --git a/packages/page-accounts/package.json b/packages/page-accounts/package.json index 97cf2cde0a..0d60bad523 100644 --- a/packages/page-accounts/package.json +++ b/packages/page-accounts/package.json @@ -13,7 +13,7 @@ "dependencies": { "@babel/runtime": "^7.9.2", "@polkadot/react-components": "0.40.0-beta.192", - "@polkadot/react-qr": "^0.52.0-beta.20", + "@polkadot/react-qr": "^0.52.0-beta.21", "@polkadot/vanitygen": "^0.11.0-beta.12", "detect-browser": "^5.0.0", "file-saver": "^2.0.2" diff --git a/packages/page-accounts/src/Accounts/modals/Derive.tsx b/packages/page-accounts/src/Accounts/modals/Derive.tsx index e6ed0dece1..56b2493660 100644 --- a/packages/page-accounts/src/Accounts/modals/Derive.tsx +++ b/packages/page-accounts/src/Accounts/modals/Derive.tsx @@ -22,7 +22,7 @@ interface Props { onClose: () => void; } -interface DerivedAddress { +interface DeriveAddress { address: string | null; deriveError: string | null; } @@ -71,7 +71,7 @@ function Derive ({ className, from, onClose }: Props): React.ReactElement { const { t } = useTranslation(); const { queueAction } = useContext(StatusContext); const [source] = useState(keyring.getPair(from)); - const [{ address, deriveError }, setDerived] = useState({ address: null, deriveError: null }); + const [{ address, deriveError }, setDerive] = useState({ address: null, deriveError: null }); const [isConfirmationOpen, setIsConfirmationOpen] = useState(false); const [isLocked, setIsLocked] = useState(source.isLocked); const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' }); @@ -87,7 +87,7 @@ function Derive ({ className, from, onClose }: Props): React.ReactElement { }, [source]); useEffect((): void => { - setDerived((): DerivedAddress => { + setDerive((): DeriveAddress => { let address: string | null = null; const deriveError = deriveValidate(debouncedSuri, source.type); diff --git a/packages/page-contracts/package.json b/packages/page-contracts/package.json index 1fe82ffdc7..b0e9dcf898 100644 --- a/packages/page-contracts/package.json +++ b/packages/page-contracts/package.json @@ -12,6 +12,6 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.9.2", - "@polkadot/api-contract": "^1.9.0-beta.12" + "@polkadot/api-contract": "^1.9.0-beta.16" } } diff --git a/packages/page-council/src/Motions/Motion.tsx b/packages/page-council/src/Motions/Motion.tsx index f9afbe3e2c..69898cb667 100644 --- a/packages/page-council/src/Motions/Motion.tsx +++ b/packages/page-council/src/Motions/Motion.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { AccountId, BlockNumber } from '@polkadot/types/interfaces'; -import { DerivedCollectiveProposal } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; import BN from 'bn.js'; import React from 'react'; @@ -20,7 +20,7 @@ interface Props { className?: string; isMember: boolean; members: string[]; - motion: DerivedCollectiveProposal; + motion: DeriveCollectiveProposal; prime: AccountId | null; } diff --git a/packages/page-council/src/Motions/index.tsx b/packages/page-council/src/Motions/index.tsx index 1466001e9a..cb48c19f5d 100644 --- a/packages/page-council/src/Motions/index.tsx +++ b/packages/page-council/src/Motions/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedCollectiveProposals, DerivedCollectiveProposal } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposals, DeriveCollectiveProposal } from '@polkadot/api-derive/types'; import { AccountId } from '@polkadot/types/interfaces'; import React from 'react'; @@ -17,7 +17,7 @@ import Slashing from './Slashing'; interface Props { className?: string; - motions?: DerivedCollectiveProposals; + motions?: DeriveCollectiveProposals; prime: AccountId | null; } @@ -48,7 +48,7 @@ function Proposals ({ className, motions, prime }: Props): React.ReactElement - {motions?.map((motion: DerivedCollectiveProposal): React.ReactNode => ( + {motions?.map((motion: DeriveCollectiveProposal): React.ReactNode => ( { const { api } = useApi(); const bestNumber = useCall(api.derive.chain.bestNumber, []); - const electionsInfo = useCall(api.derive.elections.info, []); + const electionsInfo = useCall(api.derive.elections.info, []); const allVotes = api.query.electionsPhragmen?.votesOf.creator.meta.type.asMap.linked.isTrue // eslint-disable-next-line react-hooks/rules-of-hooks ? useCall>(api.query.electionsPhragmen?.votesOf, [], { diff --git a/packages/page-council/src/Overview/types.ts b/packages/page-council/src/Overview/types.ts index 9de7f2b11d..f6c73e60b3 100644 --- a/packages/page-council/src/Overview/types.ts +++ b/packages/page-council/src/Overview/types.ts @@ -3,12 +3,12 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { SetIndex } from '@polkadot/types/interfaces'; -import { DerivedElectionsInfo } from '@polkadot/api-derive/types'; +import { DeriveElectionsInfo } from '@polkadot/api-derive/types'; import BN from 'bn.js'; export interface ComponentProps { - electionsInfo?: DerivedElectionsInfo; + electionsInfo?: DeriveElectionsInfo; } export interface VoterPosition { diff --git a/packages/page-council/src/index.tsx b/packages/page-council/src/index.tsx index ca1974fbb3..41baff6753 100644 --- a/packages/page-council/src/index.tsx +++ b/packages/page-council/src/index.tsx @@ -4,7 +4,7 @@ import { Option } from '@polkadot/types'; import { AccountId } from '@polkadot/types/interfaces'; -import { DerivedCollectiveProposals } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposals } from '@polkadot/api-derive/types'; import { AppProps, BareProps } from '@polkadot/react-components/types'; import React, { useMemo } from 'react'; @@ -31,7 +31,7 @@ function CouncilApp ({ basePath, className }: Props): React.ReactElement const prime = useCall(api.query.council.prime, [], { transform: (result: Option): AccountId | null => result.unwrapOr(null) }) || null; - const motions = useCall(api.derive.council.proposals); + const motions = useCall(api.derive.council.proposals); const items = useMemo(() => [ { diff --git a/packages/page-council/src/useCounter.ts b/packages/page-council/src/useCounter.ts index 1a07f67dfb..692f5a0076 100644 --- a/packages/page-council/src/useCounter.ts +++ b/packages/page-council/src/useCounter.ts @@ -2,11 +2,11 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedCollectiveProposals } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposals } from '@polkadot/api-derive/types'; import { useApi, useCall } from '@polkadot/react-hooks'; -function transform (motions: DerivedCollectiveProposals): number { +function transform (motions: DeriveCollectiveProposals): number { return motions.filter(({ votes }): boolean => !!votes).length; } diff --git a/packages/page-democracy/src/Overview/Referendum.tsx b/packages/page-democracy/src/Overview/Referendum.tsx index 3e79d81501..d963d8bd15 100644 --- a/packages/page-democracy/src/Overview/Referendum.tsx +++ b/packages/page-democracy/src/Overview/Referendum.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedReferendumExt } from '@polkadot/api-derive/types'; +import { DeriveReferendumExt } from '@polkadot/api-derive/types'; import { BlockNumber } from '@polkadot/types/interfaces'; import React, { useMemo } from 'react'; @@ -19,7 +19,7 @@ import Voting from './Voting'; interface Props { className?: string; - value: DerivedReferendumExt; + value: DeriveReferendumExt; } function Referendum ({ className, value }: Props): React.ReactElement | null { diff --git a/packages/page-democracy/src/Overview/Referendums.tsx b/packages/page-democracy/src/Overview/Referendums.tsx index 9242016445..83a1b0e33c 100644 --- a/packages/page-democracy/src/Overview/Referendums.tsx +++ b/packages/page-democracy/src/Overview/Referendums.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedReferendumExt } from '@polkadot/api-derive/types'; +import { DeriveReferendumExt } from '@polkadot/api-derive/types'; import React from 'react'; import { Spinner, Table } from '@polkadot/react-components'; @@ -18,7 +18,7 @@ interface Props { function Referendums ({ className }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); - const referendums = useCall(api.derive.democracy.referendums, []); + const referendums = useCall(api.derive.democracy.referendums, []); return (
diff --git a/packages/page-explorer/src/SummarySession.tsx b/packages/page-explorer/src/SummarySession.tsx index b203c97d39..f234977c69 100644 --- a/packages/page-explorer/src/SummarySession.tsx +++ b/packages/page-explorer/src/SummarySession.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedSessionInfo } from '@polkadot/api-derive/types'; +import { DeriveSessionInfo } from '@polkadot/api-derive/types'; import React, { useMemo } from 'react'; import { CardSummary } from '@polkadot/react-components'; @@ -19,7 +19,7 @@ interface Props { function SummarySession ({ withEra = true, withSession = true }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); - const sessionInfo = useCall(api.derive.session?.info, []); + const sessionInfo = useCall(api.derive.session?.info, []); const eraLabel = useMemo(() => t('era') , [t]); diff --git a/packages/page-extrinsics/src/Balance.tsx b/packages/page-extrinsics/src/Balance.tsx index 4c2edc9508..f264c852b6 100644 --- a/packages/page-extrinsics/src/Balance.tsx +++ b/packages/page-extrinsics/src/Balance.tsx @@ -5,7 +5,7 @@ import { BareProps } from '@polkadot/react-api/types'; import React from 'react'; -import { DerivedBalancesAll } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll } from '@polkadot/api-derive/types'; import { InputBalance } from '@polkadot/react-components'; import { useApi, useCall } from '@polkadot/react-hooks'; @@ -16,7 +16,7 @@ interface Props extends BareProps { function BalanceDisplay ({ className, label, params, style }: Props): React.ReactElement { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return ( | null { const { t } = useTranslation(); const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [accountId]); + const allBalances = useCall(api.derive.balances.all as any, [accountId]); const [error, setError] = useState(null); useEffect((): void => { diff --git a/packages/page-staking/src/Actions/Account/Nominate.tsx b/packages/page-staking/src/Actions/Account/Nominate.tsx index 4e4b647715..9d62a1b514 100644 --- a/packages/page-staking/src/Actions/Account/Nominate.tsx +++ b/packages/page-staking/src/Actions/Account/Nominate.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedStakingOverview } from '@polkadot/api-derive/types'; +import { DeriveStakingOverview } from '@polkadot/api-derive/types'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; @@ -18,7 +18,7 @@ interface Props { next?: string[]; nominees?: string[]; onClose: () => void; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; stashId: string; } diff --git a/packages/page-staking/src/Actions/Account/Validate.tsx b/packages/page-staking/src/Actions/Account/Validate.tsx index 6dbbe29d51..1115807734 100644 --- a/packages/page-staking/src/Actions/Account/Validate.tsx +++ b/packages/page-staking/src/Actions/Account/Validate.tsx @@ -31,36 +31,6 @@ class Validate extends TxComponent { commission: new BN(0) }; - // FIXME Borken with new InputBalance - // inject the preferences returned via RPC once into the state (from this - // point forward it will be entirely managed by the actual inputs) - // public static getDerivedStateFromProps ({ isSubstrateV2, validatorPrefs }: Props, state: State): Pick | null { - // if (state.unstakeThreshold && state.validatorPayment) { - // return null; - // } - - // if (validatorPrefs) { - // // 1.x, it has both values - // if (isSubstrateV2) { - // const { validatorPayment } = validatorPrefs as ValidatorPrefs; - - // return { - // validatorPayment: validatorPayment.toBn() - // }; - // } else { - // const { unstakeThreshold, validatorPayment } = validatorPrefs as ValidatorPrefs0to145; - - // return { - // unstakeThreshold: unstakeThreshold.toBn(), - // unstakeThresholdError: null, - // validatorPayment: validatorPayment.toBn() - // }; - // } - // } - - // return null; - // } - public render (): React.ReactNode { const { isOpen, t } = this.props; diff --git a/packages/page-staking/src/Actions/Account/index.tsx b/packages/page-staking/src/Actions/Account/index.tsx index 0e7c814f2b..59666b15f0 100644 --- a/packages/page-staking/src/Actions/Account/index.tsx +++ b/packages/page-staking/src/Actions/Account/index.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { SubmittableExtrinsic } from '@polkadot/api/types'; -import { DerivedBalancesAll, DerivedStakingAccount, DerivedStakingOverview, DeriveStakerReward } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll, DeriveStakingAccount, DeriveStakingOverview, DeriveStakerReward } from '@polkadot/api-derive/types'; import { AccountId, EraIndex, Exposure, StakingLedger, ValidatorPrefs } from '@polkadot/types/interfaces'; import { Codec, ITuple } from '@polkadot/types/types'; @@ -40,7 +40,7 @@ interface Props { next?: string[]; onUpdateType: (stashId: string, type: 'validator' | 'nominator' | 'started' | 'other') => void; rewards?: DeriveStakerReward[]; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; stashId: string; } @@ -66,7 +66,7 @@ function toIdString (id?: AccountId | null): string | null { : null; } -function getStakeState (allAccounts: string[], allStashes: string[] | undefined, { controllerId: _controllerId, exposure, nextSessionIds, nominators, rewardDestination, sessionIds, stakingLedger, validatorPrefs }: DerivedStakingAccount, stashId: string, validateInfo: ValidatorInfo): StakeState { +function getStakeState (allAccounts: string[], allStashes: string[] | undefined, { controllerId: _controllerId, exposure, nextSessionIds, nominators, rewardDestination, sessionIds, stakingLedger, validatorPrefs }: DeriveStakingAccount, stashId: string, validateInfo: ValidatorInfo): StakeState { const isStashNominating = !!(nominators?.length); const isStashValidating = !(Array.isArray(validateInfo) ? validateInfo[1].isEmpty : validateInfo.isEmpty) || !!allStashes?.includes(stashId); const nextConcat = u8aConcat(...nextSessionIds.map((id): Uint8Array => id.toU8a())); @@ -115,8 +115,8 @@ function Account ({ allStashes, className, isOwnStash, next, onUpdateType, rewar const { api } = useApi(); const { allAccounts } = useAccounts(); const validateInfo = useCall(api.query.staking.validators, [stashId]); - const balancesAll = useCall(api.derive.balances.all as any, [stashId]); - const stakingAccount = useCall(api.derive.staking.account as any, [stashId]); + const balancesAll = useCall(api.derive.balances.all as any, [stashId]); + const stakingAccount = useCall(api.derive.staking.account as any, [stashId]); const [[payoutRewards, payoutEras, payoutTotal], setStakingRewards] = useState<[DeriveStakerReward[], EraIndex[], BN]>([[], [], new BN(0)]); const [{ controllerId, destination, hexSessionIdQueue, hexSessionIdNext, isLoading, isOwnController, isStashNominating, isStashValidating, nominees, sessionIds, validatorPrefs }, setStakeState] = useState({ controllerId: null, destination: 0, hexSessionIdNext: null, hexSessionIdQueue: null, isLoading: true, isOwnController: false, isStashNominating: false, isStashValidating: false, sessionIds: [] }); const [activeNoms, setActiveNoms] = useState([]); diff --git a/packages/page-staking/src/Actions/index.tsx b/packages/page-staking/src/Actions/index.tsx index a2c1b7e377..e998ace75a 100644 --- a/packages/page-staking/src/Actions/index.tsx +++ b/packages/page-staking/src/Actions/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedStakingOverview, DeriveStakerReward } from '@polkadot/api-derive/types'; +import { DeriveStakingOverview, DeriveStakerReward } from '@polkadot/api-derive/types'; import { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces'; import React, { useCallback, useEffect, useState } from 'react'; @@ -20,7 +20,7 @@ interface Props { className?: string; isVisible: boolean; next?: string[]; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; } function Actions ({ allRewards, allStashes, className, isVisible, next, stakingOverview }: Props): React.ReactElement { diff --git a/packages/page-staking/src/Overview/Address/index.tsx b/packages/page-staking/src/Overview/Address/index.tsx index 820a7447ce..66fc696e5d 100644 --- a/packages/page-staking/src/Overview/Address/index.tsx +++ b/packages/page-staking/src/Overview/Address/index.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { AccountId, Balance } from '@polkadot/types/interfaces'; -import { DeriveAccountInfo, DerivedStakingQuery } from '@polkadot/api-derive/types'; +import { DeriveAccountInfo, DeriveStakingQuery } from '@polkadot/api-derive/types'; import BN from 'bn.js'; import React, { useCallback, useEffect, useState } from 'react'; @@ -47,7 +47,7 @@ interface StakingState { stakeOwn?: BN; } -function expandInfo ({ controllerId, exposure, nextSessionIds, validatorPrefs }: DerivedStakingQuery, withNominations = true): StakingState { +function expandInfo ({ controllerId, exposure, nextSessionIds, validatorPrefs }: DeriveStakingQuery, withNominations = true): StakingState { const nominators = withNominations && exposure ? exposure.others.map(({ who, value }): [AccountId, Balance] => [who, value.unwrap()]) : []; @@ -104,7 +104,7 @@ function Address ({ address, className, filterName, hasQueries, isAuthor, isElec const { t } = useTranslation(); const { api } = useApi(); const info = useCall(api.derive.accounts.info as any, [address]); - const stakingInfo = useCall(isMain && api.derive.staking.query as any, [address]); + const stakingInfo = useCall(isMain && api.derive.staking.query as any, [address]); const [{ commission, nominators, stakeOwn, stakeOther }, setStakingState] = useState({ nominators: [] }); const [isVisible, setIsVisible] = useState(true); diff --git a/packages/page-staking/src/Overview/CurrentList.tsx b/packages/page-staking/src/Overview/CurrentList.tsx index 8270929e45..ad3799b516 100644 --- a/packages/page-staking/src/Overview/CurrentList.tsx +++ b/packages/page-staking/src/Overview/CurrentList.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedHeartbeats, DerivedStakingOverview } from '@polkadot/api-derive/types'; +import { DeriveHeartbeats, DeriveStakingOverview } from '@polkadot/api-derive/types'; import { AccountId } from '@polkadot/types/interfaces'; import { AddressDetails } from './types'; @@ -21,9 +21,9 @@ interface Props { isVisible: boolean; lastAuthors?: string[]; next?: string[]; - recentlyOnline?: DerivedHeartbeats; + recentlyOnline?: DeriveHeartbeats; setNominators: (nominators: string[]) => void; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; } type AccountExtend = [string, boolean, boolean]; @@ -68,7 +68,7 @@ function reduceDetails (state: Record, _details: Address }, { ...state }); } -function getDetails (stakingOverview: DerivedStakingOverview, validators: AccountExtend[]): AddressDetails[] { +function getDetails (stakingOverview: DeriveStakingOverview, validators: AccountExtend[]): AddressDetails[] { const allPoints = [...stakingOverview.eraPoints.individual.entries()]; return validators.map(([address]): AddressDetails => { @@ -83,7 +83,7 @@ function getDetails (stakingOverview: DerivedStakingOverview, validators: Accoun }); } -function getFiltered (stakingOverview: DerivedStakingOverview, favorites: string[], next?: string[]): Filtered { +function getFiltered (stakingOverview: DeriveStakingOverview, favorites: string[], next?: string[]): Filtered { const allElected = accountsToString(stakingOverview.nextElected); const validatorIds = accountsToString(stakingOverview.validators); const validators = filterAccounts(validatorIds, allElected, favorites, []); diff --git a/packages/page-staking/src/Overview/Summary.tsx b/packages/page-staking/src/Overview/Summary.tsx index 014c019424..732a220df3 100644 --- a/packages/page-staking/src/Overview/Summary.tsx +++ b/packages/page-staking/src/Overview/Summary.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedStakingOverview } from '@polkadot/api-derive/types'; +import { DeriveStakingOverview } from '@polkadot/api-derive/types'; import React, { useContext } from 'react'; import styled from 'styled-components'; @@ -17,7 +17,7 @@ interface Props { isVisible: boolean; next?: string[]; nominators: string[]; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; style?: any; } diff --git a/packages/page-staking/src/Overview/index.tsx b/packages/page-staking/src/Overview/index.tsx index 52d0a76ef8..1857505ce0 100644 --- a/packages/page-staking/src/Overview/index.tsx +++ b/packages/page-staking/src/Overview/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedHeartbeats, DerivedStakingOverview } from '@polkadot/api-derive/types'; +import { DeriveHeartbeats, DeriveStakingOverview } from '@polkadot/api-derive/types'; import { BareProps } from '@polkadot/react-components/types'; import React, { useContext } from 'react'; @@ -14,10 +14,10 @@ import CurrentList from './CurrentList'; interface Props extends BareProps { hasQueries: boolean; isVisible: boolean; - recentlyOnline?: DerivedHeartbeats; + recentlyOnline?: DeriveHeartbeats; next?: string[]; setNominators: (nominators: string[]) => void; - stakingOverview?: DerivedStakingOverview; + stakingOverview?: DeriveStakingOverview; } function Overview ({ hasQueries, isVisible, className, recentlyOnline, next, setNominators, stakingOverview }: Props): React.ReactElement { diff --git a/packages/page-staking/src/Targets/index.tsx b/packages/page-staking/src/Targets/index.tsx index b24655db7e..20235ac4f5 100644 --- a/packages/page-staking/src/Targets/index.tsx +++ b/packages/page-staking/src/Targets/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedStakingElected, DeriveSessionIndexes } from '@polkadot/api-derive/types'; +import { DeriveStakingElected, DeriveSessionIndexes } from '@polkadot/api-derive/types'; import { Balance, ValidatorPrefs, ValidatorPrefsTo196 } from '@polkadot/types/interfaces'; import { ValidatorInfo } from './types'; @@ -90,7 +90,7 @@ function sortValidators (list: ValidatorInfo[]): ValidatorInfo[] { }); } -function extractInfo (allAccounts: string[], amount: BN = new BN(0), electedInfo: DerivedStakingElected, favorites: string[], lastReward = new BN(1)): AllInfo { +function extractInfo (allAccounts: string[], amount: BN = new BN(0), electedInfo: DeriveStakingElected, favorites: string[], lastReward = new BN(1)): AllInfo { const nominators: string[] = []; let totalStaked = new BN(0); const perValidatorReward = lastReward.divn(electedInfo.info.length); @@ -181,7 +181,7 @@ function Targets ({ className }: Props): React.ReactElement { optBalance.unwrapOrDefault() }); const [_amount, setAmount] = useState(new BN(1_000)); - const electedInfo = useCall(api.derive.staking.electedInfo, []); + const electedInfo = useCall(api.derive.staking.electedInfo, []); const [favorites, toggleFavorite] = useFavorites(STORE_FAVS_BASE); const [{ nominators, validators, sorted, totalStaked }, setWorkable] = useState({ nominators: [], validators: [] }); const [{ sortBy, sortFromMax }, setSortBy] = useState<{ sortBy: SortBy; sortFromMax: boolean }>({ sortBy: 'rankOverall', sortFromMax: true }); diff --git a/packages/page-staking/src/index.tsx b/packages/page-staking/src/index.tsx index 55cd609f05..e710261921 100644 --- a/packages/page-staking/src/index.tsx +++ b/packages/page-staking/src/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedHeartbeats, DerivedStakingOverview } from '@polkadot/api-derive/types'; +import { DeriveHeartbeats, DeriveStakingOverview } from '@polkadot/api-derive/types'; import { AppProps as Props } from '@polkadot/react-components/types'; import { AccountId } from '@polkadot/types/interfaces'; @@ -39,8 +39,8 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement transform: (stashes: AccountId[]): string[] => stashes.map((accountId): string => accountId.toString()) }); - const recentlyOnline = useCall(api.derive.imOnline?.receivedHeartbeats, []); - const stakingOverview = useCall(api.derive.staking.overview, []); + const recentlyOnline = useCall(api.derive.imOnline?.receivedHeartbeats, []); + const stakingOverview = useCall(api.derive.staking.overview, []); const [nominators, dispatchNominators] = useReducer(reduceNominators, [] as string[]); const hasQueries = useMemo( (): boolean => diff --git a/packages/page-staking/src/types.ts b/packages/page-staking/src/types.ts index 5c40a93d54..46166e50f1 100644 --- a/packages/page-staking/src/types.ts +++ b/packages/page-staking/src/types.ts @@ -2,14 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedFees, DerivedBalancesAll } from '@polkadot/api-derive/types'; +import { DeriveFees, DeriveBalancesAll } from '@polkadot/api-derive/types'; import { AccountId, Balance, BlockNumber, Hash, SessionIndex } from '@polkadot/types/interfaces'; export type Nominators = Record; export interface CalculateBalanceProps { - balances_fees?: DerivedFees; - balances_all?: DerivedBalancesAll; + balances_fees?: DeriveFees; + balances_all?: DeriveBalancesAll; } export type AccountFilter = 'all' | 'controller' | 'session' | 'stash' | 'unbonded'; diff --git a/packages/page-treasury/src/Overview/Proposal.tsx b/packages/page-treasury/src/Overview/Proposal.tsx index d3eb1387c4..6172c92cbb 100644 --- a/packages/page-treasury/src/Overview/Proposal.tsx +++ b/packages/page-treasury/src/Overview/Proposal.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedTreasuryProposal } from '@polkadot/api-derive/types'; +import { DeriveTreasuryProposal } from '@polkadot/api-derive/types'; import React from 'react'; import { AddressMini, AddressSmall, LinkExternal } from '@polkadot/react-components'; @@ -16,7 +16,7 @@ import Voting from './Voting'; interface Props { className?: string; isMember: boolean; - proposal: DerivedTreasuryProposal; + proposal: DeriveTreasuryProposal; onRespond: () => void; withSend: boolean; } diff --git a/packages/page-treasury/src/Overview/Proposals.tsx b/packages/page-treasury/src/Overview/Proposals.tsx index b463bcd5d7..57c0bed1a9 100644 --- a/packages/page-treasury/src/Overview/Proposals.tsx +++ b/packages/page-treasury/src/Overview/Proposals.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedTreasuryProposal } from '@polkadot/api-derive/types'; +import { DeriveTreasuryProposal } from '@polkadot/api-derive/types'; import { AccountId, Balance } from '@polkadot/types/interfaces'; import React, { useEffect, useState } from 'react'; @@ -16,7 +16,7 @@ import { useTranslation } from '../translate'; interface Props { className?: string; isApprovals?: boolean; - proposals?: DerivedTreasuryProposal[]; + proposals?: DeriveTreasuryProposal[]; } function ProposalsBase ({ className, isApprovals, proposals }: Props): React.ReactElement { diff --git a/packages/page-treasury/src/Overview/Submission.tsx b/packages/page-treasury/src/Overview/Submission.tsx index 835d1383cd..46863d3f92 100644 --- a/packages/page-treasury/src/Overview/Submission.tsx +++ b/packages/page-treasury/src/Overview/Submission.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedCollectiveProposal } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; import { ProposalIndex } from '@polkadot/types/interfaces'; import React, { useEffect, useMemo, useState } from 'react'; @@ -12,7 +12,7 @@ import { useApi, useCall, useToggle } from '@polkadot/react-hooks'; import { useTranslation } from '../translate'; interface Props { - councilProposals: DerivedCollectiveProposal[]; + councilProposals: DeriveCollectiveProposal[]; id: ProposalIndex; isDisabled: boolean; } diff --git a/packages/page-treasury/src/Overview/Summary.tsx b/packages/page-treasury/src/Overview/Summary.tsx index 7435b553f1..b29ec1f93e 100644 --- a/packages/page-treasury/src/Overview/Summary.tsx +++ b/packages/page-treasury/src/Overview/Summary.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalancesAccount } from '@polkadot/api-derive/types'; +import { DeriveBalancesAccount } from '@polkadot/api-derive/types'; import { Balance } from '@polkadot/types/interfaces'; import React from 'react'; @@ -25,7 +25,7 @@ function Summary ({ approvalCount, proposalCount }: Props): React.ReactElement

(api.derive.chain.bestNumber as any, []); const spendPeriod = api.consts.treasury.spendPeriod; - const treasuryBalance = useCall(api.derive.balances.account as any, [TREASURY_ACCOUNT]); + const treasuryBalance = useCall(api.derive.balances.account as any, [TREASURY_ACCOUNT]); const value = treasuryBalance?.freeBalance.gtn(0) ? treasuryBalance.freeBalance.toString() diff --git a/packages/page-treasury/src/Overview/Voting.tsx b/packages/page-treasury/src/Overview/Voting.tsx index 337f9c80e0..5200369231 100644 --- a/packages/page-treasury/src/Overview/Voting.tsx +++ b/packages/page-treasury/src/Overview/Voting.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedCollectiveProposal } from '@polkadot/api-derive/types'; +import { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; import { ProposalIndex, Hash } from '@polkadot/types/interfaces'; import React, { useEffect, useState } from 'react'; @@ -13,7 +13,7 @@ import { isBoolean } from '@polkadot/util'; import { useTranslation } from '../translate'; interface Props { - councilProposals: DerivedCollectiveProposal[]; + councilProposals: DeriveCollectiveProposal[]; isDisabled?: boolean; } diff --git a/packages/page-treasury/src/Overview/index.tsx b/packages/page-treasury/src/Overview/index.tsx index 74f689be80..565119ee2a 100644 --- a/packages/page-treasury/src/Overview/index.tsx +++ b/packages/page-treasury/src/Overview/index.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedTreasuryProposals } from '@polkadot/api-derive/types'; +import { DeriveTreasuryProposals } from '@polkadot/api-derive/types'; import { AppProps, BareProps, I18nProps } from '@polkadot/react-components/types'; import React from 'react'; @@ -17,7 +17,7 @@ interface Props extends AppProps, BareProps, I18nProps {} function Overview ({ className }: Props): React.ReactElement { const { api } = useApi(); - const info = useCall(api.derive.treasury.proposals, []); + const info = useCall(api.derive.treasury.proposals, []); return (

diff --git a/packages/page-treasury/src/useCounter.ts b/packages/page-treasury/src/useCounter.ts index 1ad04ecbc4..6c16747da5 100644 --- a/packages/page-treasury/src/useCounter.ts +++ b/packages/page-treasury/src/useCounter.ts @@ -2,14 +2,14 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedTreasuryProposals } from '@polkadot/api-derive/types'; +import { DeriveTreasuryProposals } from '@polkadot/api-derive/types'; import { useState, useEffect } from 'react'; import { useApi, useCall } from '@polkadot/react-hooks'; export default function useCounter (): number { const { api, isApiReady } = useApi(); - const proposals = useCall(isApiReady && api.derive.treasury?.proposals, []); + const proposals = useCall(isApiReady && api.derive.treasury?.proposals, []); const [counter, setCounter] = useState(0); useEffect((): void => { diff --git a/packages/react-api/package.json b/packages/react-api/package.json index e12f1324ba..22d1054177 100644 --- a/packages/react-api/package.json +++ b/packages/react-api/package.json @@ -31,8 +31,8 @@ "homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme", "dependencies": { "@babel/runtime": "^7.9.2", - "@polkadot/api": "^1.9.0-beta.12", - "@polkadot/extension-dapp": "^0.23.1", + "@polkadot/api": "^1.9.0-beta.16", + "@polkadot/extension-dapp": "^0.24.0-beta.0", "rxjs-compat": "^6.5.4" } } diff --git a/packages/react-components/package.json b/packages/react-components/package.json index 1699fb4022..b3553947f0 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -13,10 +13,10 @@ "@babel/runtime": "^7.9.2", "@polkadot/keyring": "^2.7.0-beta.8", "@polkadot/react-api": "0.40.0-beta.192", - "@polkadot/react-identicon": "^0.52.0-beta.20", + "@polkadot/react-identicon": "^0.52.0-beta.21", "@polkadot/react-query": "0.40.0-beta.192", - "@polkadot/ui-keyring": "^0.52.0-beta.20", - "@polkadot/ui-settings": "^0.52.0-beta.20", + "@polkadot/ui-keyring": "^0.52.0-beta.21", + "@polkadot/ui-settings": "^0.52.0-beta.21", "chart.js": "^2.9.3", "codeflask": "^1.4.1", "i18next": "^19.3.3", diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index 22da01053b..a17ba8d064 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalancesAll, DerivedStakingAccount } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll, DeriveStakingAccount } from '@polkadot/api-derive/types'; import { ValidatorPrefsTo145 } from '@polkadot/types/interfaces'; import { BareProps } from './types'; @@ -44,10 +44,10 @@ export interface ValidatorPrefsType { interface Props extends BareProps { address: string; - balancesAll?: DerivedBalancesAll; + balancesAll?: DeriveBalancesAll; children?: React.ReactNode; extraInfo?: [string, string][]; - stakingInfo?: DerivedStakingAccount; + stakingInfo?: DeriveStakingAccount; withBalance?: boolean | BalanceActiveType; withBalanceToggle?: false; withExtended?: boolean | CryptoActiveType; @@ -110,7 +110,7 @@ function skipStakingIf ({ stakingInfo, withBalance = true, withRewardDestination } // calculates the bonded, first being the own, the second being nominated -function calcBonded (stakingInfo?: DerivedStakingAccount, bonded?: boolean | BN[]): [BN, BN[]] { +function calcBonded (stakingInfo?: DeriveStakingAccount, bonded?: boolean | BN[]): [BN, BN[]] { let other: BN[] = []; let own = new BN(0); diff --git a/packages/react-components/src/AddressRow.tsx b/packages/react-components/src/AddressRow.tsx index 9e0faffac5..51cdbb11c3 100644 --- a/packages/react-components/src/AddressRow.tsx +++ b/packages/react-components/src/AddressRow.tsx @@ -3,7 +3,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DeriveAccountInfo, DerivedStakingAccount } from '@polkadot/api-derive/types'; +import { DeriveAccountInfo, DeriveStakingAccount } from '@polkadot/api-derive/types'; import { ApiProps } from '@polkadot/react-api/types'; import { I18nProps } from '@polkadot/react-components/types'; import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces'; @@ -31,7 +31,7 @@ export interface Props extends I18nProps, RowProps { accounts_info?: DeriveAccountInfo; noDefaultNameOpacity?: boolean; overlay?: React.ReactNode; - stakingInfo?: DerivedStakingAccount; + stakingInfo?: DeriveStakingAccount; value: AccountId | AccountIndex | Address | string | null; withAddressOrName?: boolean; withBalance?: boolean | BalanceActiveType; diff --git a/packages/react-components/src/Chart/Doughnut.tsx b/packages/react-components/src/Chart/Doughnut.tsx index 88d7c1b13c..94cabc747d 100644 --- a/packages/react-components/src/Chart/Doughnut.tsx +++ b/packages/react-components/src/Chart/Doughnut.tsx @@ -25,11 +25,6 @@ function ChartDoughnut ({ className, size = 100, style, values }: DoughnutProps) labels: [] }; - // FIXME Classic case of kicking the can down the road, i.e. don't expend energy - // when stuff are not used. This was replaced by the HorizBar as the only Chart - // in actual use (by Referendum). However the below is not optimal, and gets re- - // calculated on each render. If this component is put back in use, look at - // getDerivedStateFromProps in HorizBar (the logic is the same for chartData) values.forEach(({ colors: [normalColor = '#00f', hoverColor], label, value }): void => { options.colorNormal.push(normalColor); options.colorHover.push(hoverColor || normalColor); diff --git a/packages/react-components/src/InputBalanceBonded.tsx b/packages/react-components/src/InputBalanceBonded.tsx index a98c4fb6ad..593718ef27 100644 --- a/packages/react-components/src/InputBalanceBonded.tsx +++ b/packages/react-components/src/InputBalanceBonded.tsx @@ -4,7 +4,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { BareProps, BitLength } from './types'; -import { DerivedFees, DerivedBalancesAll } from '@polkadot/api-derive/types'; +import { DeriveFees, DeriveBalancesAll } from '@polkadot/api-derive/types'; import BN from 'bn.js'; import React from 'react'; @@ -16,8 +16,8 @@ import { withCalls, withMulti, withApi } from '@polkadot/react-api/hoc'; interface Props extends BareProps, ApiProps { autoFocus?: boolean; - balances_fees?: DerivedFees; - balances_all?: DerivedBalancesAll; + balances_fees?: DeriveFees; + balances_all?: DeriveBalancesAll; controllerId: string; defaultValue?: BN | string; destination?: number; diff --git a/packages/react-components/src/VoteValue.tsx b/packages/react-components/src/VoteValue.tsx index 546a17a751..2fe6d94c1c 100644 --- a/packages/react-components/src/VoteValue.tsx +++ b/packages/react-components/src/VoteValue.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalancesAll } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll } from '@polkadot/api-derive/types'; import BN from 'bn.js'; import React, { useCallback, useEffect, useState } from 'react'; @@ -27,7 +27,7 @@ interface ValueState { function VoteValue ({ accountId, autoFocus, onChange }: Props): React.ReactElement | null { const { t } = useTranslation(); const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [accountId]); + const allBalances = useCall(api.derive.balances.all as any, [accountId]); const [{ selectedId, value }, setValue] = useState({}); // TODO This may be useful elsewhere, so figure out a way to make this a utility diff --git a/packages/react-hooks/src/useOwnEraRewards.ts b/packages/react-hooks/src/useOwnEraRewards.ts index c8e17edb6f..43a1d2d037 100644 --- a/packages/react-hooks/src/useOwnEraRewards.ts +++ b/packages/react-hooks/src/useOwnEraRewards.ts @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DeriveSessionIndexes, DerivedStakingQuery, DeriveStakerReward } from '@polkadot/api-derive/types'; +import { DeriveSessionIndexes, DeriveStakingQuery, DeriveStakerReward } from '@polkadot/api-derive/types'; import { EraIndex } from '@polkadot/types/interfaces'; import { useEffect, useState } from 'react'; @@ -22,7 +22,7 @@ function useNextPayouts (onlyLatest?: boolean): [string, BN][] | undefined { const { api, isApiReady } = useApi(); const mountedRef = useIsMountedRef(); const stashIds = useOwnStashIds(); - const allInfo = useCall(isApiReady && stashIds && api.derive.staking?.queryMulti, stashIds); + const allInfo = useCall(isApiReady && stashIds && api.derive.staking?.queryMulti, stashIds); const indexes = useCall(isApiReady && api.derive.session?.indexes, []); const [nextPayouts, setNextPayouts] = useState<[string, BN][] | undefined>(); diff --git a/packages/react-query/src/Available.tsx b/packages/react-query/src/Available.tsx index 41e48b1f7e..cb5d25e1f8 100644 --- a/packages/react-query/src/Available.tsx +++ b/packages/react-query/src/Available.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { BareProps } from '@polkadot/react-api/types'; -import { DerivedBalancesAll } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll } from '@polkadot/api-derive/types'; import { AccountId, AccountIndex, Address } from '@polkadot/types/interfaces'; import React from 'react'; @@ -19,7 +19,7 @@ interface Props extends BareProps { function AvailableDisplay ({ children, className, label, params }: Props): React.ReactElement { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return ( { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return ( { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return ( { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return ( { const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [params]); + const allBalances = useCall(api.derive.balances.all as any, [params]); return (
diff --git a/packages/react-signer/package.json b/packages/react-signer/package.json index 41b951b16f..9c7f52b25b 100644 --- a/packages/react-signer/package.json +++ b/packages/react-signer/package.json @@ -12,6 +12,6 @@ "dependencies": { "@babel/runtime": "^7.9.2", "@polkadot/react-components": "0.40.0-beta.192", - "@polkadot/react-qr": "^0.52.0-beta.20" + "@polkadot/react-qr": "^0.52.0-beta.21" } } diff --git a/packages/react-signer/src/Checks/ContractCall.tsx b/packages/react-signer/src/Checks/ContractCall.tsx index 32114a083e..1308cb60ac 100644 --- a/packages/react-signer/src/Checks/ContractCall.tsx +++ b/packages/react-signer/src/Checks/ContractCall.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedContractFees } from '@polkadot/api-derive/types'; +import { DeriveContractFees } from '@polkadot/api-derive/types'; import { ExtraFees as State } from './types'; import BN from 'bn.js'; @@ -11,7 +11,7 @@ import { Compact, UInt } from '@polkadot/types'; interface Props { endowment: BN | Compact; - fees: DerivedContractFees; + fees: DeriveContractFees; onChange: (fees: State) => void; } diff --git a/packages/react-signer/src/Checks/ContractDeploy.tsx b/packages/react-signer/src/Checks/ContractDeploy.tsx index d843288380..6fbf6d7022 100644 --- a/packages/react-signer/src/Checks/ContractDeploy.tsx +++ b/packages/react-signer/src/Checks/ContractDeploy.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedContractFees } from '@polkadot/api-derive/types'; +import { DeriveContractFees } from '@polkadot/api-derive/types'; import { ExtraFees as State } from './types'; import BN from 'bn.js'; @@ -11,7 +11,7 @@ import { Compact, UInt } from '@polkadot/types'; interface Props { endowment: BN | Compact; - fees: DerivedContractFees; + fees: DeriveContractFees; onChange: (fees: State) => void; } diff --git a/packages/react-signer/src/Checks/Proposal.tsx b/packages/react-signer/src/Checks/Proposal.tsx index d37c074e7d..112877bccd 100644 --- a/packages/react-signer/src/Checks/Proposal.tsx +++ b/packages/react-signer/src/Checks/Proposal.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedFees } from '@polkadot/api-derive/types'; +import { DeriveFees } from '@polkadot/api-derive/types'; import { ExtraFees } from './types'; import BN from 'bn.js'; @@ -16,7 +16,7 @@ import { useTranslation } from '../translate'; interface Props { deposit: BN | Compact; - fees: DerivedFees; + fees: DeriveFees; democracy_minimumDeposit?: BN; onChange: (fees: ExtraFees) => void; } diff --git a/packages/react-signer/src/Checks/Transfer.tsx b/packages/react-signer/src/Checks/Transfer.tsx index dfdf2f3cce..23031c3c0c 100644 --- a/packages/react-signer/src/Checks/Transfer.tsx +++ b/packages/react-signer/src/Checks/Transfer.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedBalancesAll, DerivedFees } from '@polkadot/api-derive/types'; +import { DeriveBalancesAll, DeriveFees } from '@polkadot/api-derive/types'; import { AccountId } from '@polkadot/types/interfaces'; import { ExtraFees } from './types'; @@ -17,7 +17,7 @@ import { useTranslation } from '../translate'; interface Props { amount: BN | Compact; - fees: DerivedFees; + fees: DeriveFees; recipientId: string | AccountId; onChange: (fees: ExtraFees) => void; } @@ -30,7 +30,7 @@ interface State extends ExtraFees { function Transfer ({ amount, fees, onChange, recipientId }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); - const allBalances = useCall(api.derive.balances.all as any, [recipientId]); + const allBalances = useCall(api.derive.balances.all as any, [recipientId]); const [{ isCreation, isNoEffect }, setState] = useState({ extraFees: new BN(0), extraAmount: new BN(0), diff --git a/packages/react-signer/src/Checks/constants.ts b/packages/react-signer/src/Checks/constants.ts index 07a67c2b35..3316fee820 100644 --- a/packages/react-signer/src/Checks/constants.ts +++ b/packages/react-signer/src/Checks/constants.ts @@ -2,13 +2,13 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { DerivedFees, DerivedBalancesAll, DerivedContractFees } from '@polkadot/api-derive/types'; +import { DeriveFees, DeriveBalancesAll, DeriveContractFees } from '@polkadot/api-derive/types'; import BN from 'bn.js'; import { registry } from '@polkadot/react-api'; import { createType } from '@polkadot/types'; -const ZERO_BALANCE: DerivedBalancesAll = { +const ZERO_BALANCE: DeriveBalancesAll = { accountId: createType(registry, 'AccountId'), accountNonce: createType(registry, 'Index'), availableBalance: createType(registry, 'Balance'), @@ -24,7 +24,7 @@ const ZERO_BALANCE: DerivedBalancesAll = { votingBalance: createType(registry, 'Balance') }; -const ZERO_FEES_BALANCES: DerivedFees = { +const ZERO_FEES_BALANCES: DeriveFees = { creationFee: createType(registry, 'Balance'), existentialDeposit: createType(registry, 'Balance'), transactionBaseFee: createType(registry, 'Balance'), @@ -34,7 +34,7 @@ const ZERO_FEES_BALANCES: DerivedFees = { const ZERO_FEES = ZERO_FEES_BALANCES; -const ZERO_FEES_CONTRACT: DerivedContractFees = { +const ZERO_FEES_CONTRACT: DeriveContractFees = { callBaseFee: new BN(0), contractFee: new BN(0), creationFee: new BN(0), diff --git a/yarn.lock b/yarn.lock index a08d8413a9..67d4d55c24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2836,56 +2836,56 @@ __metadata: languageName: node linkType: hard -"@polkadot/api-contract@npm:^1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/api-contract@npm:1.9.0-beta.12" +"@polkadot/api-contract@npm:^1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/api-contract@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/api": 1.9.0-beta.12 - "@polkadot/rpc-core": 1.9.0-beta.12 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/api": 1.9.0-beta.16 + "@polkadot/rpc-core": 1.9.0-beta.16 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 bn.js: ^5.1.1 rxjs: ^6.5.4 - checksum: 2/c30a14ba2cfabd3d555e91d7aff445c96e6dd2adec2bbc8679f27c6266a823d8f2bb55545f0d20a10562321cef9b65ab80d0d71cff521854c335daf84aee32b7 + checksum: 2/cc696c9ff873960519c7957fa20badece865f1ced3fb344427b2276ca50f1e739b94daa6ff09f94a8f2790c4058d0d9a8264dbc11098ebf71e51f8c6eb0d14ed languageName: node linkType: hard -"@polkadot/api-derive@npm:1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/api-derive@npm:1.9.0-beta.12" +"@polkadot/api-derive@npm:1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/api-derive@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/api": 1.9.0-beta.12 - "@polkadot/rpc-core": 1.9.0-beta.12 - "@polkadot/rpc-provider": 1.9.0-beta.12 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/api": 1.9.0-beta.16 + "@polkadot/rpc-core": 1.9.0-beta.16 + "@polkadot/rpc-provider": 1.9.0-beta.16 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 "@polkadot/util-crypto": ^2.7.0-beta.8 bn.js: ^5.1.1 memoizee: ^0.4.14 rxjs: ^6.5.4 - checksum: 2/f9a09c67a497fce0a0d410ffe31fc334c47100903dd13995a95a461208d5067b9358b14cd86c121634edb80d04df2317d02903a37d88572eadfb920d331c0260 + checksum: 2/993cf50b7fd6fb5882287e00d20d496f4c8cc8cb054f9fbca44992ea471bfb92b7463f8794dec2590aef8578e63c62f1f491fc42683793176f62db539e80edeb languageName: node linkType: hard -"@polkadot/api@npm:^1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/api@npm:1.9.0-beta.12" +"@polkadot/api@npm:^1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/api@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/api-derive": 1.9.0-beta.12 + "@polkadot/api-derive": 1.9.0-beta.16 "@polkadot/keyring": ^2.7.0-beta.8 - "@polkadot/metadata": 1.9.0-beta.12 - "@polkadot/rpc-core": 1.9.0-beta.12 - "@polkadot/rpc-provider": 1.9.0-beta.12 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/metadata": 1.9.0-beta.16 + "@polkadot/rpc-core": 1.9.0-beta.16 + "@polkadot/rpc-provider": 1.9.0-beta.16 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 "@polkadot/util-crypto": ^2.7.0-beta.8 bn.js: ^5.1.1 eventemitter3: ^4.0.0 rxjs: ^6.5.4 - checksum: 2/e3ff8243c0525305a5f92018b07d747621b4d494970d19446d71e5a5a4bab137ea01cd944987104cb513d3bac05a69506e49d89472415b1e19cd2924c0826a43 + checksum: 2/b5f3ac2f8b06017ca4c5e8c4bf20a62d05ae4e8e6ab4b88a9969fefa2a9eb616b77a71ef971ade855f55649f961357d13c30106a147f50db9e066411f57ca9ef languageName: node linkType: hard @@ -2904,7 +2904,7 @@ __metadata: dependencies: "@babel/runtime": ^7.9.2 "@polkadot/react-components": 0.40.0-beta.192 - "@polkadot/react-qr": ^0.52.0-beta.20 + "@polkadot/react-qr": ^0.52.0-beta.21 "@polkadot/vanitygen": ^0.11.0-beta.12 detect-browser: ^5.0.0 file-saver: ^2.0.2 @@ -2926,7 +2926,7 @@ __metadata: resolution: "@polkadot/app-contracts@workspace:packages/page-contracts" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/api-contract": ^1.9.0-beta.12 + "@polkadot/api-contract": ^1.9.0-beta.16 languageName: unknown linkType: soft @@ -3216,26 +3216,26 @@ __metadata: languageName: node linkType: hard -"@polkadot/extension-dapp@npm:^0.23.1": - version: 0.23.1 - resolution: "@polkadot/extension-dapp@npm:0.23.1" +"@polkadot/extension-dapp@npm:^0.24.0-beta.0": + version: 0.24.0-beta.0 + resolution: "@polkadot/extension-dapp@npm:0.24.0-beta.0" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/extension-inject": 0.23.1 + "@polkadot/extension-inject": 0.24.0-beta.0 peerDependencies: "@polkadot/api": "*" - checksum: 2/891c4f9ec5a71c8c8c0d8b118c8c350c20f0740a3cfabd70a5c5b9f8384654a7b4d8283e747ff202669ea5fa2ba53c82d98619646ba88866f4053cad21d0f72d + checksum: 2/1eb7e9fe4b1b7207d5e57bf0ae3d5b8efcdd2c9dceb2d43f20311c286d4630675fe7cc90fe3fa08b2a5c8a9f63a639927283b9eee08700dfc258fd0a3b664188 languageName: node linkType: hard -"@polkadot/extension-inject@npm:0.23.1": - version: 0.23.1 - resolution: "@polkadot/extension-inject@npm:0.23.1" +"@polkadot/extension-inject@npm:0.24.0-beta.0": + version: 0.24.0-beta.0 + resolution: "@polkadot/extension-inject@npm:0.24.0-beta.0" dependencies: "@babel/runtime": ^7.9.2 peerDependencies: "@polkadot/api": "*" - checksum: 2/1df16ef560b717dc6d32b951f0e6cfec063c687f6b21e7bbb0f306c81bdbe4da42905f453575cb81e08b3a1a0a9428d93120c0d89822e8df874cc32db51e74ee + checksum: 2/2a3fe95b14360d0abe893dc9f99335970e86408a8135b069b428641f73e8cfcae1c97c11ad9559ddf2612181f09b78a93b08e4f11bc06162be65b43e823056f9 languageName: node linkType: hard @@ -3250,16 +3250,16 @@ __metadata: languageName: node linkType: hard -"@polkadot/metadata@npm:1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/metadata@npm:1.9.0-beta.12" +"@polkadot/metadata@npm:1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/metadata@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 "@polkadot/util-crypto": ^2.7.0-beta.8 bn.js: ^5.1.1 - checksum: 2/fef1630d458bb4c5ebcaf0efd6519c2985b546265138880f8d171141c0a5f59a809217cf928d9099e6184970206c86fca2c8e985d989dfc130678589036ba186 + checksum: 2/f22e564a1f686744e53332e3f72e14e61624bca8d6f7d42c0a2c6e51cc613001cec03fb967cd58ea66097f0b9d2027f3645a5c64442726def75e16a946a50969 languageName: node linkType: hard @@ -3268,8 +3268,8 @@ __metadata: resolution: "@polkadot/react-api@workspace:packages/react-api" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/api": ^1.9.0-beta.12 - "@polkadot/extension-dapp": ^0.23.1 + "@polkadot/api": ^1.9.0-beta.16 + "@polkadot/extension-dapp": ^0.24.0-beta.0 rxjs-compat: ^6.5.4 languageName: unknown linkType: soft @@ -3281,10 +3281,10 @@ __metadata: "@babel/runtime": ^7.9.2 "@polkadot/keyring": ^2.7.0-beta.8 "@polkadot/react-api": 0.40.0-beta.192 - "@polkadot/react-identicon": ^0.52.0-beta.20 + "@polkadot/react-identicon": ^0.52.0-beta.21 "@polkadot/react-query": 0.40.0-beta.192 - "@polkadot/ui-keyring": ^0.52.0-beta.20 - "@polkadot/ui-settings": ^0.52.0-beta.20 + "@polkadot/ui-keyring": ^0.52.0-beta.21 + "@polkadot/ui-settings": ^0.52.0-beta.21 chart.js: ^2.9.3 codeflask: ^1.4.1 i18next: ^19.3.3 @@ -3319,13 +3319,13 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/react-identicon@npm:^0.52.0-beta.20": - version: 0.52.0-beta.20 - resolution: "@polkadot/react-identicon@npm:0.52.0-beta.20" +"@polkadot/react-identicon@npm:^0.52.0-beta.21": + version: 0.52.0-beta.21 + resolution: "@polkadot/react-identicon@npm:0.52.0-beta.21" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/ui-settings": 0.52.0-beta.20 - "@polkadot/ui-shared": 0.52.0-beta.20 + "@polkadot/ui-settings": 0.52.0-beta.21 + "@polkadot/ui-shared": 0.52.0-beta.21 color: ^3.1.2 jdenticon: 2.2.0 react-copy-to-clipboard: ^5.0.2 @@ -3337,7 +3337,7 @@ __metadata: react: "*" react-dom: "*" react-is: "*" - checksum: 2/1ef8f2e280a63fdba0e2d09f1449e95a80c26f0488f422d8747fe12d5d467041b6f1ce367c2f123e5b98345ebda172e65256d6ef92523a8aeac26c67e9709897 + checksum: 2/11e637d80acf0d8131ac386e70bbcdc884120f87c1a8472ee1759d63c17cf0101770d936bead8ccfeb334c1b88754dc3cd4cee8aa52fab46169a3e7d92705080 languageName: node linkType: hard @@ -3350,9 +3350,9 @@ __metadata: languageName: unknown linkType: soft -"@polkadot/react-qr@npm:^0.52.0-beta.20": - version: 0.52.0-beta.20 - resolution: "@polkadot/react-qr@npm:0.52.0-beta.20" +"@polkadot/react-qr@npm:^0.52.0-beta.21": + version: 0.52.0-beta.21 + resolution: "@polkadot/react-qr@npm:0.52.0-beta.21" dependencies: "@babel/runtime": ^7.9.2 qrcode-generator: ^1.4.4 @@ -3363,7 +3363,7 @@ __metadata: react: "*" react-dom: "*" styled-components: "*" - checksum: 2/0acc96739e2f1e59eaf5dad1a6628ab84cbdbb30f8291f997f3030e443d3f5ac96be17ef0ed642144af59dc84e0a9cc7518ff60833e9ce105f6a1f839fcd4991 + checksum: 2/d5328a9ce41be1ad8fc79072d81357d8982cb87d6828350162f006cbf6a8b6a2eef31d2df67fa1fd74de65676d31a68e5da46283539a3a8fce8c66eaefcbd819 languageName: node linkType: hard @@ -3381,39 +3381,39 @@ __metadata: dependencies: "@babel/runtime": ^7.9.2 "@polkadot/react-components": 0.40.0-beta.192 - "@polkadot/react-qr": ^0.52.0-beta.20 + "@polkadot/react-qr": ^0.52.0-beta.21 languageName: unknown linkType: soft -"@polkadot/rpc-core@npm:1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/rpc-core@npm:1.9.0-beta.12" +"@polkadot/rpc-core@npm:1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/rpc-core@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/metadata": 1.9.0-beta.12 - "@polkadot/rpc-provider": 1.9.0-beta.12 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/metadata": 1.9.0-beta.16 + "@polkadot/rpc-provider": 1.9.0-beta.16 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 memoizee: ^0.4.14 rxjs: ^6.5.4 - checksum: 2/015a26dacef28744b7e889f00f4853b5626c78715cf222b380ebc1fe5ba997b0a2c224c76d55dfe8b6f259db7e93a7adef7f7f1e388f0ca2c133fd80833d38b0 + checksum: 2/caba2f0e5c7bcea77e090e7474e6f5a13ea3ea170cdf624b42944cf05b409f661fb9b9154e5eb60c1f235fc8fa16641643073077e1ee336b035e6277bfcbd4c2 languageName: node linkType: hard -"@polkadot/rpc-provider@npm:1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/rpc-provider@npm:1.9.0-beta.12" +"@polkadot/rpc-provider@npm:1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/rpc-provider@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/metadata": 1.9.0-beta.12 - "@polkadot/types": 1.9.0-beta.12 + "@polkadot/metadata": 1.9.0-beta.16 + "@polkadot/types": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 "@polkadot/util-crypto": ^2.7.0-beta.8 bn.js: ^5.1.1 eventemitter3: ^4.0.0 isomorphic-fetch: ^2.2.1 websocket: ^1.0.31 - checksum: 2/17e247c8b5b6d2ea67192727dd21c246fd5d8cf5230c1fae46c6c502c121d77364c9a9510304557fb545fce4a5d0546e8e56ece427fc9dab9b998ba5dfe4b445 + checksum: 2/b0236848e3801cf433c34ca0c7e68166eff2060a7708c15de3385522e6d044d3e5a1cc364a966af4c0f54b7319dd83fc14b4b696e4b1d8aa7cc2bcdcc2d07f83 languageName: node linkType: hard @@ -3426,25 +3426,25 @@ __metadata: languageName: node linkType: hard -"@polkadot/types@npm:^1.9.0-beta.12": - version: 1.9.0-beta.12 - resolution: "@polkadot/types@npm:1.9.0-beta.12" +"@polkadot/types@npm:^1.9.0-beta.16": + version: 1.9.0-beta.16 + resolution: "@polkadot/types@npm:1.9.0-beta.16" dependencies: "@babel/runtime": ^7.9.2 - "@polkadot/metadata": 1.9.0-beta.12 + "@polkadot/metadata": 1.9.0-beta.16 "@polkadot/util": ^2.7.0-beta.8 "@polkadot/util-crypto": ^2.7.0-beta.8 "@types/bn.js": ^4.11.6 bn.js: ^5.1.1 memoizee: ^0.4.14 rxjs: ^6.5.4 - checksum: 2/c7ef63e507479fbb09c36426a55b5ca478a126cd167fd92ccee81c50fe3035bdca3caf803b5783ff72ab7b6722a0959111637d063649bdf38a58a4b3085c61b9 + checksum: 2/d21269b1917450448a3cc3ff6ac176b7e56b07dbcff2c3de7be84102d81e9ba93cfe6ff7709e59f0b67cb7659a622f0bb5b28965695f338016f9c8bd6ef9c5ca languageName: node linkType: hard -"@polkadot/ui-keyring@npm:^0.52.0-beta.20": - version: 0.52.0-beta.20 - resolution: "@polkadot/ui-keyring@npm:0.52.0-beta.20" +"@polkadot/ui-keyring@npm:^0.52.0-beta.21": + version: 0.52.0-beta.21 + resolution: "@polkadot/ui-keyring@npm:0.52.0-beta.21" dependencies: "@babel/runtime": ^7.9.2 "@ledgerhq/hw-transport-node-hid": ^5.11.0 @@ -3462,33 +3462,33 @@ __metadata: dependenciesMeta: "@ledgerhq/hw-transport-node-hid": optional: true - checksum: 2/55a6a24ca32e58970225bc822ae08558b670ad86b308bc8cec7ea4fb8900e88df60b6462a80f08292b622d7bb8a8738fc6998281e957ecb38dbc7ca8c5e7243a + checksum: 2/ec29d4ecf91df1ee10dfb3e5e0db1a61310733a647f9b5ec7dd9413b2bd4bc467b8e31f72d1004ca6ca74a02fe4424f11969c61bba36cef951db224d7f568d8e languageName: node linkType: hard -"@polkadot/ui-settings@npm:0.52.0-beta.20, @polkadot/ui-settings@npm:^0.52.0-beta.20": - version: 0.52.0-beta.20 - resolution: "@polkadot/ui-settings@npm:0.52.0-beta.20" +"@polkadot/ui-settings@npm:0.52.0-beta.21, @polkadot/ui-settings@npm:^0.52.0-beta.21": + version: 0.52.0-beta.21 + resolution: "@polkadot/ui-settings@npm:0.52.0-beta.21" dependencies: "@babel/runtime": ^7.9.2 eventemitter3: ^4.0.0 store: ^2.0.12 peerDependencies: "@polkadot/util": "*" - checksum: 2/0a1116085aeb111c1597da888cab74400ea807564636eb845fa61a24fd017dcec41440491eaf9508ca46583a9b5b8e79ab80fca7687950b2f065503b132722bc + checksum: 2/8c345dba7fb5ebb2a1876d2703092c7e93a729d358416cd3e117cb73c1d98fea10bbe74d6641a15379bf07525922f8787093490da909b628d8e6321c8a33783e languageName: node linkType: hard -"@polkadot/ui-shared@npm:0.52.0-beta.20": - version: 0.52.0-beta.20 - resolution: "@polkadot/ui-shared@npm:0.52.0-beta.20" +"@polkadot/ui-shared@npm:0.52.0-beta.21": + version: 0.52.0-beta.21 + resolution: "@polkadot/ui-shared@npm:0.52.0-beta.21" dependencies: "@babel/runtime": ^7.9.2 color: ^3.1.2 peerDependencies: "@polkadot/util": "*" "@polkadot/util-crypto": "*" - checksum: 2/1eb9f682ad2e336d1d0e45663d665c1f1db6d7a455ba5545fc1360bc97658dde4840263dd0b49ef4aa7ef0268c31d8b2c82a4246a927caa511eb1a10250f17eb + checksum: 2/cc9e5caae0c3596530fe0006eb95be0c7c5104727b229bf9a8ac1fa9ba032d6223d5e8257b5bef27bb2657dfed61e56a3ab74062db9dc6c857ada3299a861ec4 languageName: node linkType: hard