diff --git a/package.json b/package.json index 6650ba8339a..4bb5c10d5e8 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^0.99.0-beta.7", - "@polkadot/api-contract": "^0.99.0-beta.7", + "@polkadot/api": "^0.99.0-beta.9", + "@polkadot/api-contract": "^0.99.0-beta.9", "@polkadot/keyring": "^1.7.1", - "@polkadot/types": "^0.99.0-beta.7", + "@polkadot/types": "^0.99.0-beta.9", "@polkadot/util": "^1.7.1", "@polkadot/util-crypto": "^1.7.1", "babel-core": "^7.0.0-bridge.0", diff --git a/packages/app-accounts/src/modals/Backup.tsx b/packages/app-accounts/src/modals/Backup.tsx index 4d424d83175..240d7ce9e93 100644 --- a/packages/app-accounts/src/modals/Backup.tsx +++ b/packages/app-accounts/src/modals/Backup.tsx @@ -67,7 +67,6 @@ export default function ({ address, onClose }: Props): React.ReactElement return ( {t('Backup account')} diff --git a/packages/app-accounts/src/modals/ChangePass.tsx b/packages/app-accounts/src/modals/ChangePass.tsx index 37c86d705ef..f89b0812dca 100644 --- a/packages/app-accounts/src/modals/ChangePass.tsx +++ b/packages/app-accounts/src/modals/ChangePass.tsx @@ -37,7 +37,6 @@ class ChangePass extends TxComponent { return ( {t('Change account password')} diff --git a/packages/app-accounts/src/modals/Create.tsx b/packages/app-accounts/src/modals/Create.tsx index 5aeeb23bb9e..e59bedb7202 100644 --- a/packages/app-accounts/src/modals/Create.tsx +++ b/packages/app-accounts/src/modals/Create.tsx @@ -189,7 +189,6 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, t, type: return ( {t('Add an account via seed')} diff --git a/packages/app-accounts/src/modals/CreateConfirmation.tsx b/packages/app-accounts/src/modals/CreateConfirmation.tsx index 5a664a732d7..a778b1979b4 100644 --- a/packages/app-accounts/src/modals/CreateConfirmation.tsx +++ b/packages/app-accounts/src/modals/CreateConfirmation.tsx @@ -18,10 +18,7 @@ interface Props extends I18nProps { function CreateConfirmation ({ address, name, onClose, onCommit, t }: Props): React.ReactElement | null { return ( - + {t('Important notice')} diff --git a/packages/app-accounts/src/modals/Derive.tsx b/packages/app-accounts/src/modals/Derive.tsx index cb92f63abea..e02056f3685 100644 --- a/packages/app-accounts/src/modals/Derive.tsx +++ b/packages/app-accounts/src/modals/Derive.tsx @@ -136,7 +136,6 @@ function Derive ({ className, from, onClose, t }: Props): React.ReactElement { return ( {t('Derive account from pair')} diff --git a/packages/app-accounts/src/modals/Import.tsx b/packages/app-accounts/src/modals/Import.tsx index dc71c38fd3d..886a80ea877 100644 --- a/packages/app-accounts/src/modals/Import.tsx +++ b/packages/app-accounts/src/modals/Import.tsx @@ -38,10 +38,7 @@ class Import extends TxComponent { const { isFileValid, isPassValid } = this.state; return ( - + {t('Add via backup file')} {this.renderInput()} diff --git a/packages/app-accounts/src/modals/Qr.tsx b/packages/app-accounts/src/modals/Qr.tsx index 0174af37548..69a69581ebb 100644 --- a/packages/app-accounts/src/modals/Qr.tsx +++ b/packages/app-accounts/src/modals/Qr.tsx @@ -49,7 +49,6 @@ function QrModal ({ className, onClose, onStatusChange, t }: Props): React.React return ( {t('Add account via Qr')} diff --git a/packages/app-accounts/src/modals/Transfer.tsx b/packages/app-accounts/src/modals/Transfer.tsx index c1de333a0bf..46c04e3d826 100644 --- a/packages/app-accounts/src/modals/Transfer.tsx +++ b/packages/app-accounts/src/modals/Transfer.tsx @@ -89,7 +89,6 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId: return ( {t('Send funds')} diff --git a/packages/app-address-book/src/modals/Create.tsx b/packages/app-address-book/src/modals/Create.tsx index 5c4570a8340..83974806fb5 100644 --- a/packages/app-address-book/src/modals/Create.tsx +++ b/packages/app-address-book/src/modals/Create.tsx @@ -77,10 +77,7 @@ function Create ({ onClose, onStatusChange, t }: Props): React.ReactElement + {t('Add an address')} | null { return ( diff --git a/packages/app-contracts/src/Modal.tsx b/packages/app-contracts/src/Modal.tsx index b45ecf34828..379e311c896 100644 --- a/packages/app-contracts/src/Modal.tsx +++ b/packages/app-contracts/src/Modal.tsx @@ -54,7 +54,6 @@ class ContractModal

return ( diff --git a/packages/app-contracts/src/RemoveABI.tsx b/packages/app-contracts/src/RemoveABI.tsx index d2f1f7a6dd0..42ecf9b6b7a 100644 --- a/packages/app-contracts/src/RemoveABI.tsx +++ b/packages/app-contracts/src/RemoveABI.tsx @@ -24,7 +24,6 @@ function RemoveABI ({ code, onClose, onRemove, t }: Props): React.ReactElement

diff --git a/packages/app-council/src/Motions/Motion.tsx b/packages/app-council/src/Motions/Motion.tsx index d4694b14e68..b1d47d00b80 100644 --- a/packages/app-council/src/Motions/Motion.tsx +++ b/packages/app-council/src/Motions/Motion.tsx @@ -2,29 +2,23 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { Proposal as ProposalType, Votes } from '@polkadot/types/interfaces'; +import { DerivedCouncilProposal } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/react-components/types'; -import BN from 'bn.js'; import React from 'react'; -import { Option } from '@polkadot/types'; import { AddressMini, Voting } from '@polkadot/react-components'; -import { withCalls, withMulti } from '@polkadot/react-api'; import ProposalCell from '@polkadot/app-democracy/Overview/ProposalCell'; import { formatNumber } from '@polkadot/util'; import translate from '../translate'; interface Props extends I18nProps { - chain_bestNumber?: BN; - hash: string; - proposal: ProposalType | null; - votes: Votes | null; + motion: DerivedCouncilProposal; } -function Motion ({ className, hash, proposal, t, votes }: Props): React.ReactElement | null { - if (!proposal || !votes) { +function Motion ({ className, motion: { hash, proposal, votes }, t }: Props): React.ReactElement | null { + if (!votes) { return null; } @@ -33,7 +27,11 @@ function Motion ({ className, hash, proposal, t, votes }: Props): React.ReactEle return (

{formatNumber(index)}

- + {formatNumber(ayes.length)}/{formatNumber(threshold)} @@ -70,21 +68,4 @@ function Motion ({ className, hash, proposal, t, votes }: Props): React.ReactEle ); } -export default withMulti( - Motion, - translate, - withCalls( - ['query.council.proposalOf', { - paramName: 'hash', - propName: 'proposal', - transform: (value: Option): ProposalType | null => - value.unwrapOr(null) - }], - ['query.council.voting', { - paramName: 'hash', - propName: 'votes', - transform: (value: Option): Votes | null => - value.unwrapOr(null) - }] - ) -); +export default translate(Motion); diff --git a/packages/app-council/src/Motions/index.tsx b/packages/app-council/src/Motions/index.tsx index 6f9afa04bfb..793365d2e79 100644 --- a/packages/app-council/src/Motions/index.tsx +++ b/packages/app-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 { Hash } from '@polkadot/types/interfaces'; +import { DerivedCouncilProposals, DerivedCouncilProposal } from '@polkadot/api-derive/types'; import { I18nProps } from '@polkadot/react-components/types'; import React from 'react'; @@ -13,7 +13,7 @@ import Propose from './Propose'; import translate from '../translate'; interface Props extends I18nProps { - motions?: Hash[]; + motions?: DerivedCouncilProposals; } function Proposals ({ className, motions, t }: Props): React.ReactElement { @@ -24,10 +24,10 @@ function Proposals ({ className, motions, t }: Props): React.ReactElement ? ( - {motions?.map((hash: Hash): React.ReactNode => ( + {motions?.map((motion: DerivedCouncilProposal): React.ReactNode => ( ))} diff --git a/packages/app-council/src/Overview/Summary.tsx b/packages/app-council/src/Overview/Summary.tsx index 448b8489c13..40ccc303dd0 100644 --- a/packages/app-council/src/Overview/Summary.tsx +++ b/packages/app-council/src/Overview/Summary.tsx @@ -38,7 +38,7 @@ function Summary ({ bestNumber, className, electionsInfo: { members, candidateCo )} - {bestNumber && termDuration && termDuration.gtn(0) && ( + {bestNumber && termDuration?.gtn(0) && (
{ const { api } = useApi(); const { pathname } = useLocation(); - const motions = useCall(api.query.council.proposals, []); + const motions = useCall(api.derive.council.proposals, []); return (
diff --git a/packages/app-council/src/useCounter.ts b/packages/app-council/src/useCounter.ts index 52bd8e0add7..c33943d172f 100644 --- a/packages/app-council/src/useCounter.ts +++ b/packages/app-council/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 { Hash } from '@polkadot/types/interfaces'; +import { DerivedCouncilProposals } 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 motions = useCall(isApiReady ? api.query.council?.proposals : undefined, []); + const motions = useCall(isApiReady ? api.derive.council.proposals : undefined, []); const [counter, setCounter] = useState(0); useEffect((): void => { diff --git a/packages/app-democracy/src/Overview/DispatchEntry.tsx b/packages/app-democracy/src/Overview/DispatchEntry.tsx index 56dbb945651..7536506a18b 100644 --- a/packages/app-democracy/src/Overview/DispatchEntry.tsx +++ b/packages/app-democracy/src/Overview/DispatchEntry.tsx @@ -43,7 +43,10 @@ function DispatchEntry ({ blockNumber, hash, referendumIndex, t }: Props): React )} - + ); } diff --git a/packages/app-democracy/src/Overview/Externals.tsx b/packages/app-democracy/src/Overview/Externals.tsx index 92b580016e2..3bfa286efef 100644 --- a/packages/app-democracy/src/Overview/Externals.tsx +++ b/packages/app-democracy/src/Overview/Externals.tsx @@ -61,7 +61,11 @@ function Externals ({ className, t }: Props): React.ReactElement | null {
- +
{expanded && {t('locked')}} value={expanded.balance} />}
diff --git a/packages/app-democracy/src/Overview/PreImage.tsx b/packages/app-democracy/src/Overview/PreImage.tsx index 774d3e5cb58..9d0443a611e 100644 --- a/packages/app-democracy/src/Overview/PreImage.tsx +++ b/packages/app-democracy/src/Overview/PreImage.tsx @@ -39,7 +39,6 @@ function PreImage ({ className, onClose, t }: Props): React.ReactElement return ( {t('Submit preimage')} diff --git a/packages/app-democracy/src/Overview/Proposal.tsx b/packages/app-democracy/src/Overview/Proposal.tsx index 370c28e7ef9..be57f8704b5 100644 --- a/packages/app-democracy/src/Overview/Proposal.tsx +++ b/packages/app-democracy/src/Overview/Proposal.tsx @@ -31,7 +31,11 @@ function Proposal ({ className, t, value: { balance, hash, index, proposal, prop {t('locked')}} value={balance} /> - + {seconding.length !== 0 && (
diff --git a/packages/app-democracy/src/Overview/Propose.tsx b/packages/app-democracy/src/Overview/Propose.tsx index 6acc0cac9e3..cb690a28672 100644 --- a/packages/app-democracy/src/Overview/Propose.tsx +++ b/packages/app-democracy/src/Overview/Propose.tsx @@ -29,7 +29,6 @@ function Propose ({ className, onClose, t }: Props): React.ReactElement { return ( {t('Submit proposal')} diff --git a/packages/app-democracy/src/Overview/Referendum.tsx b/packages/app-democracy/src/Overview/Referendum.tsx index 93f8cf04a04..5e6e62ec0f4 100644 --- a/packages/app-democracy/src/Overview/Referendum.tsx +++ b/packages/app-democracy/src/Overview/Referendum.tsx @@ -84,7 +84,11 @@ function Referendum ({ chain_bestNumber, className, democracy_referendumVotesFor return (

{formatNumber(value.index)}

- + {formatNumber(value.info.end.sub(chain_bestNumber).subn(1))} blocks diff --git a/packages/app-democracy/src/Overview/Seconding.tsx b/packages/app-democracy/src/Overview/Seconding.tsx index 5061e1d610c..250b6648b9a 100644 --- a/packages/app-democracy/src/Overview/Seconding.tsx +++ b/packages/app-democracy/src/Overview/Seconding.tsx @@ -33,7 +33,6 @@ function Seconding ({ depositors, proposalId, t }: Props): React.ReactElement {isSecondingOpen && ( diff --git a/packages/app-democracy/src/Overview/Voting.tsx b/packages/app-democracy/src/Overview/Voting.tsx index 5712a0e4f8d..5e06cffafc8 100644 --- a/packages/app-democracy/src/Overview/Voting.tsx +++ b/packages/app-democracy/src/Overview/Voting.tsx @@ -6,7 +6,7 @@ import { I18nProps } from '@polkadot/react-components/types'; import BN from 'bn.js'; import React, { useState } from 'react'; -import { Button, Dropdown, InputAddress, Modal, TxButton } from '@polkadot/react-components'; +import { Button, Modal, VoteAccount, VoteActions, VoteToggle } from '@polkadot/react-components'; import { useAccounts } from '@polkadot/react-hooks'; import { isBoolean } from '@polkadot/util'; @@ -33,61 +33,31 @@ function Voting ({ referendumId, t }: Props): React.ReactElement | null { <> {isVotingOpen && ( {t('Vote on proposal')} - - + - - -