diff --git a/packages/react-signer/src/Modal.tsx b/packages/react-signer/src/Modal.tsx index e29d73c5d3..599cde5a52 100644 --- a/packages/react-signer/src/Modal.tsx +++ b/packages/react-signer/src/Modal.tsx @@ -48,7 +48,7 @@ interface State { isRenderError: boolean; isSendable: boolean; isSubmit: boolean; - multiApproval: boolean; + multiCall: boolean; nonce?: BN; password: string; qrAddress: string; @@ -123,7 +123,7 @@ const initialState: State = { isRenderError: false, isSendable: false, isSubmit: true, - multiApproval: false, + multiCall: false, nonce: undefined, password: '', qrAddress: '', @@ -136,8 +136,8 @@ const initialState: State = { class Signer extends React.PureComponent { public state: State = initialState; - public static getDerivedStateFromProps ({ allAccounts, queue }: Props, { currentItem, password, unlockError }: State): Partial { - const nextItem = queue.find(({ status }): boolean => ['queued', 'qr'].includes(status)); + public static getDerivedStateFromProps ({ allAccounts, queue }: Props, { currentItem, multiCall, password, unlockError }: State): Partial { + const nextItem = queue.find(({ status }) => ['queued', 'qr'].includes(status)); const isSame = !!nextItem && !!currentItem && @@ -159,8 +159,10 @@ class Signer extends React.PureComponent { return { currentItem: nextItem, isSendable, - password: isSame ? password : '', - unlockError: isSame ? unlockError : null + ...(isSame + ? { multiCall, password, unlockError } + : { multiCall: false, password: '', unlockError: null } + ) }; } @@ -299,7 +301,7 @@ class Signer extends React.PureComponent { private renderSignatory (): React.ReactNode { const { t } = this.props; - const { currentItem, multiApproval } = this.state; + const { currentItem, multiCall } = this.state; const { isMultisig, who } = currentItem ? extractExternal(currentItem.accountId) : { isMultisig: false, who: [] }; @@ -309,30 +311,39 @@ class Signer extends React.PureComponent { } return ( - - - - - - -

{t('The signatory is one of the allowed accounts on the multisig. The transaction could either be the call or an approval for the hash of a call.')}

-
-
+ <> + + + + + +

{t('The signatory is one of the allowed accounts on the multisig, making a recorded approval for the transaction.')}

+
+
+ + + + + +

{t('This could either be an approval for the hash or with full call details. The call as last approval triggers execution.')}

+
+
+ ); } @@ -447,8 +458,8 @@ class Signer extends React.PureComponent { this.setState({ showTip }); }; - private onToggleMultiApproval = (multiApproval: boolean): void => { - this.setState({ multiApproval }); + private onToggleMultiCall = (multiCall: boolean): void => { + this.setState({ multiCall }); } private onToggleSign = (isSubmit: boolean): void => { @@ -650,7 +661,7 @@ class Signer extends React.PureComponent { private async sendExtrinsic (queueTx: QueueTx, password?: string): Promise { const { api, queueSetTxStatus } = this.props; - const { isSubmit, multiApproval, showTip, signatory, tip } = this.state; + const { isSubmit, multiCall, showTip, signatory, tip } = this.state; const { accountId, extrinsic, id, isUnsigned, payload } = queueTx; if (!isUnsigned) { @@ -700,9 +711,9 @@ class Signer extends React.PureComponent { } pair = keyring.getPair(signatory as string); - tx = multiApproval - ? api.tx.utility.approveAsMulti(basePair.meta.threshold, others, timepoint, submittable.method.hash) - : api.tx.utility.asMulti(basePair.meta.threshold, others, timepoint, submittable.method); + tx = multiCall + ? api.tx.utility.asMulti(basePair.meta.threshold, others, timepoint, submittable.method) + : api.tx.utility.approveAsMulti(basePair.meta.threshold, others, timepoint, submittable.method.hash); } console.log('sendExtrinsic::', JSON.stringify(tx.method.toHuman()));