Correct threshold for fast track (#2942)
* Correct threshold for fast track * Same fix for treasury
This commit is contained in:
parent
cdc4ae150a
commit
8feda3640d
@ -99,7 +99,7 @@ function Fasttrack ({ imageHash, threshold }: Props): React.ReactElement<Props>
|
||||
onStart={toggleFasttrack}
|
||||
params={
|
||||
api.tx.technicalCommittee.propose.meta.args.length === 3
|
||||
? [threshold, proposal, proposalLength]
|
||||
? [memberThreshold, proposal, proposalLength]
|
||||
: [memberThreshold, proposal]
|
||||
}
|
||||
tx='technicalCommittee.propose'
|
||||
|
||||
@ -2,6 +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 { SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
import { DeriveCollectiveProposal } from '@polkadot/api-derive/types';
|
||||
import { ProposalIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
@ -18,6 +19,11 @@ interface Props {
|
||||
members: string[];
|
||||
}
|
||||
|
||||
interface ProposalState {
|
||||
proposal?: SubmittableExtrinsic<'promise'> | null;
|
||||
proposalLength: number;
|
||||
}
|
||||
|
||||
function Submission ({ councilProposals, id, isDisabled, members }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
@ -28,6 +34,7 @@ function Submission ({ councilProposals, id, isDisabled, members }: Props): Reac
|
||||
const [isOpen, toggleOpen] = useToggle();
|
||||
const [accountId, setAccountId] = useState<string | null>(null);
|
||||
const [councilType, setCouncilType] = useState('reject');
|
||||
const [{ proposal, proposalLength }, setProposal] = useState<ProposalState>({ proposalLength: 0 });
|
||||
const [hasProposals, setHasProposals] = useState(true);
|
||||
const councilTypeOpt = useMemo(() => [
|
||||
{ text: t<string>('Acceptance proposal to council'), value: 'accept' },
|
||||
@ -43,6 +50,14 @@ function Submission ({ councilProposals, id, isDisabled, members }: Props): Reac
|
||||
);
|
||||
}, [councilProposals]);
|
||||
|
||||
useEffect((): void => {
|
||||
const proposal = councilType === 'reject'
|
||||
? api.tx.treasury.rejectProposal(id)
|
||||
: api.tx.treasury.approveProposal(id);
|
||||
|
||||
setProposal({ proposal, proposalLength: proposal.length });
|
||||
}, [api, councilType, id]);
|
||||
|
||||
if (hasProposals) {
|
||||
return null;
|
||||
}
|
||||
@ -93,12 +108,11 @@ function Submission ({ councilProposals, id, isDisabled, members }: Props): Reac
|
||||
isPrimary
|
||||
label={t<string>('Send to council')}
|
||||
onStart={toggleOpen}
|
||||
params={[
|
||||
councilThreshold,
|
||||
councilType === 'reject'
|
||||
? api.tx.treasury.rejectProposal(id)
|
||||
: api.tx.treasury.approveProposal(id)
|
||||
]}
|
||||
params={
|
||||
api.tx.council.propose.meta.args.length === 3
|
||||
? [councilThreshold, proposal, proposalLength]
|
||||
: [councilThreshold, proposal]
|
||||
}
|
||||
tx='council.propose'
|
||||
/>
|
||||
</Modal.Actions>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user