Adjust min multisig threshold to 2 (#3542)
This commit is contained in:
parent
1ad3472214
commit
0dddfd7cb5
@ -10,7 +10,6 @@ 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 { BN_ONE } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
import useKnownAddresses from '../Accounts/useKnownAddresses';
|
||||
@ -28,6 +27,7 @@ interface CreateOptions {
|
||||
}
|
||||
|
||||
const MAX_SIGNATORIES = 16;
|
||||
const BN_TWO = new BN(2);
|
||||
|
||||
function createMultisig (signatories: string[], threshold: BN | number, { genesisHash, name, tags = [] }: CreateOptions, success: string): ActionStatus {
|
||||
// we will fill in all the details below
|
||||
@ -54,7 +54,7 @@ function Multisig ({ className = '', onClose, onStatusChange }: Props): React.Re
|
||||
const availableSignatories = useKnownAddresses();
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [signatories, setSignatories] = useState<string[]>(['']);
|
||||
const [{ isThresholdValid, threshold }, setThreshold] = useState({ isThresholdValid: true, threshold: BN_ONE });
|
||||
const [{ isThresholdValid, threshold }, setThreshold] = useState({ isThresholdValid: true, threshold: BN_TWO });
|
||||
|
||||
const _createMultisig = useCallback(
|
||||
(): void => {
|
||||
@ -74,7 +74,7 @@ function Multisig ({ className = '', onClose, onStatusChange }: Props): React.Re
|
||||
|
||||
const _onChangeThreshold = useCallback(
|
||||
(threshold: BN | undefined) =>
|
||||
threshold && setThreshold({ isThresholdValid: threshold.gtn(0) && threshold.lten(signatories.length), threshold }),
|
||||
threshold && setThreshold({ isThresholdValid: threshold.gte(BN_TWO) && threshold.lten(signatories.length), threshold }),
|
||||
[signatories]
|
||||
);
|
||||
|
||||
@ -111,6 +111,7 @@ function Multisig ({ className = '', onClose, onStatusChange }: Props): React.Re
|
||||
isError={!isThresholdValid}
|
||||
label={t<string>('threshold')}
|
||||
onChange={_onChangeThreshold}
|
||||
value={threshold}
|
||||
/>
|
||||
</Modal.Column>
|
||||
<Modal.Column>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user