Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix Allow signing when no calldata is needed #244

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions packages/ui/src/components/modals/ProposalSigning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -213,10 +214,11 @@ const ProposalSigning = ({
api,
selectedAccount,
multisig,
needCallData,
addedCallData,
callInfo,
selectedSigner,
signCallback,
addedCallData,
addToast,
getSubscanExtrinsicLink
]
Expand Down Expand Up @@ -288,7 +290,27 @@ const ProposalSigning = ({
/>
</>
)}

{!needCallData && !callInfo?.call && (
<>
<Grid
item
xs={0}
md={1}
/>
<HashGridStyled
item
xs={12}
md={6}
>
{proposalData.hash}
</HashGridStyled>
<Grid
item
xs={0}
md={5}
/>
</>
)}
{(!needCallData || !!callInfo?.call) && !errorMessage && (
<>
<Grid
Expand Down Expand Up @@ -365,6 +387,9 @@ const ProposalSigning = ({
)
}

const HashGridStyled = styled(Grid)`
margin: 1rem 0 1rem 0;
`
export default styled(ProposalSigning)(
({ theme }) => `
.buttonContainer {
Expand Down
Loading