diff --git a/packages/page-accounts/src/Accounts/Account.tsx b/packages/page-accounts/src/Accounts/Account.tsx index 0f6e9aeebd..fe398605d0 100644 --- a/packages/page-accounts/src/Accounts/Account.tsx +++ b/packages/page-accounts/src/Accounts/Account.tsx @@ -1,4 +1,4 @@ -// Copyright 2017-2020 @polkadot/app-staking authors & contributors +// Copyright 2017-2020 @polkadot/app-accounts authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. diff --git a/packages/page-accounts/src/Accounts/index.tsx b/packages/page-accounts/src/Accounts/index.tsx index ef1acc2774..05d7cc1609 100644 --- a/packages/page-accounts/src/Accounts/index.tsx +++ b/packages/page-accounts/src/Accounts/index.tsx @@ -1,4 +1,4 @@ -// Copyright 2017-2020 @polkadot/app-staking authors & contributors +// Copyright 2017-2020 @polkadot/app-accounts authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. diff --git a/packages/page-accounts/src/Accounts/modals/MultisigCreate.tsx b/packages/page-accounts/src/Accounts/modals/MultisigCreate.tsx index 1e9907a2bb..dfafed1e3a 100644 --- a/packages/page-accounts/src/Accounts/modals/MultisigCreate.tsx +++ b/packages/page-accounts/src/Accounts/modals/MultisigCreate.tsx @@ -6,12 +6,13 @@ import { ActionStatus } from '@polkadot/react-components/Status/types'; import { ModalProps } from '../../types'; import BN from 'bn.js'; -import React, { useCallback, useMemo, useState } from 'react'; -import { Button, Input, InputAddress, InputNumber, Modal } from '@polkadot/react-components'; +import React, { useCallback, useState } from 'react'; +import { Button, Input, InputAddressMulti, InputNumber, Modal } from '@polkadot/react-components'; import { useApi } from '@polkadot/react-hooks'; import keyring from '@polkadot/ui-keyring'; import { useTranslation } from '../../translate'; +import useKnownAddresses from '../useKnownAddresses'; interface Props extends ModalProps { className?: string; @@ -24,8 +25,6 @@ interface CreateOptions { tags?: string[]; } -type Setter = (address: string| null) => void; - const MAX_SIGNATORIES = 16; function createAccount (signatories: string[], threshold: BN | number, { genesisHash, name, tags = [] }: CreateOptions, success: string): ActionStatus { @@ -50,23 +49,10 @@ function createAccount (signatories: string[], threshold: BN | number, { genesis function Multisig ({ className, onClose, onStatusChange }: Props): React.ReactElement { const { api, isDevelopment } = useApi(); const { t } = useTranslation(); + const availableSignatories = useKnownAddresses(); const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' }); const [signatories, setSignatories] = useState(['']); const [{ isThresholdValid, threshold }, setThreshold] = useState({ isThresholdValid: true, threshold: new BN(1) }); - const setSignatory = useMemo((): Setter[] => { - return Array(MAX_SIGNATORIES).fill(0).map((_, index): Setter => - (address: string | null): void => { - setSignatories((signatories: string[]): string[] => { - if (address) { - signatories[index] = address; - } - - return signatories; - }); - } - ); - }, []); - const isValid = isNameValid && isThresholdValid; const _createMultisig = useCallback( (): void => { @@ -90,59 +76,61 @@ function Multisig ({ className, onClose, onStatusChange }: Props): React.ReactEl [signatories] ); - const _onLess = useCallback( - () => setSignatories((signatories) => signatories.slice(0, signatories.length - 1)), - [] - ); - - const _onMore = useCallback( - () => setSignatories((signatories) => signatories.concat('')), - [] - ); + const isValid = isNameValid && isThresholdValid; return ( - - - {signatories.map((_, index) => ( - - ))} - -