From f3674d1e95c72db10086da7bac309aa6d0ee4299 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Tue, 11 Jul 2023 13:19:20 +0100 Subject: [PATCH 1/2] no calldata needed --- .../src/components/modals/ProposalSigning.tsx | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/ui/src/components/modals/ProposalSigning.tsx b/packages/ui/src/components/modals/ProposalSigning.tsx index 6fafaa9d..f698ed50 100644 --- a/packages/ui/src/components/modals/ProposalSigning.tsx +++ b/packages/ui/src/components/modals/ProposalSigning.tsx @@ -1,4 +1,4 @@ -import { CircularProgress, Dialog, DialogContent, DialogTitle, Grid } from '@mui/material' +import { Box, CircularProgress, Dialog, DialogContent, DialogTitle, Grid } from '@mui/material' import { Button, TextFieldStyled } from '../library' import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react' import { styled } from '@mui/material/styles' @@ -50,17 +50,17 @@ const ProposalSigning = ({ () => proposalData?.info?.depositor === selectedAccount?.address, [proposalData, selectedAccount] ) + const { callInfo, isGettingCallInfo } = useCallInfoFromCallData( + proposalData.callData || addedCallData + ) const needCallData = useMemo( () => - // if we don't have the calldata and it's the last approval + // if we don't have the calldata from the chain and it's the last approval !!threshold && proposalData.info?.approvals.length === threshold - 1 && !proposalData.callData, [proposalData, threshold] ) - const { callInfo, isGettingCallInfo } = useCallInfoFromCallData( - needCallData ? addedCallData : proposalData.callData - ) const onSubmitting = useCallback(() => { setIsSubmitting(false) @@ -131,7 +131,8 @@ const ProposalSigning = ({ return } - if (!proposalData.callData && !addedCallData) { + // if the callData is needed, but none was supplied or found + if (needCallData && !proposalData.callData && !addedCallData) { const error = 'No callData found or supplied' console.error(error) setErrorMessage(error) @@ -213,10 +214,11 @@ const ProposalSigning = ({ api, selectedAccount, multisig, + needCallData, + addedCallData, callInfo, selectedSigner, signCallback, - addedCallData, addToast, getSubscanExtrinsicLink ] @@ -288,7 +290,27 @@ const ProposalSigning = ({ /> )} - + {!needCallData && !callInfo?.call && ( + <> + + + {proposalData.hash} + + + + )} {(!needCallData || !!callInfo?.call) && !errorMessage && ( <> ` .buttonContainer { From c961974871dc7faffaafd4591b87b105becbe561 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Tue, 11 Jul 2023 13:20:06 +0100 Subject: [PATCH 2/2] no Box --- packages/ui/src/components/modals/ProposalSigning.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/src/components/modals/ProposalSigning.tsx b/packages/ui/src/components/modals/ProposalSigning.tsx index f698ed50..2eef3d0d 100644 --- a/packages/ui/src/components/modals/ProposalSigning.tsx +++ b/packages/ui/src/components/modals/ProposalSigning.tsx @@ -1,4 +1,4 @@ -import { Box, CircularProgress, Dialog, DialogContent, DialogTitle, Grid } from '@mui/material' +import { CircularProgress, Dialog, DialogContent, DialogTitle, Grid } from '@mui/material' import { Button, TextFieldStyled } from '../library' import { ChangeEvent, useCallback, useEffect, useMemo, useState } from 'react' import { styled } from '@mui/material/styles'