Skip to content

Commit

Permalink
Add advanced settings to multisig sign page (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan authored Jun 12, 2024
1 parent ebef7e5 commit 373baf1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/components/AdvancedSettingsAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import colors from "../style/colors";
import { mutezToTez, tezToMutez } from "../utils/format";
import { Estimation, TEZ_DECIMALS } from "../utils/tezos";

export const AdvancedSettingsAccordion = ({ index = 0 }) => {
type AdvancedSettingsAccordionProps = {
index?: number;
};

export const AdvancedSettingsAccordion = ({ index = 0 }: AdvancedSettingsAccordionProps) => {
const {
register,
getValues,
Expand Down
4 changes: 3 additions & 1 deletion src/components/SendFlow/BatchModalBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const BatchModalBody: React.FC<{
title: string;
operation: EstimatedAccountOperations;
transactionCount: number;
}> = ({ title, operation, transactionCount }) => (
children?: React.ReactNode;
}> = ({ title, operation, transactionCount, children }) => (
<>
<FormPageHeader subTitle={subTitle(operation.signer)} title={title} />
<ModalBody>
Expand All @@ -29,6 +30,7 @@ export const BatchModalBody: React.FC<{
</Flex>
<SignPageFee fee={totalFee(operation.estimates)} />
</Flex>
{children}
</ModalBody>
</>
);
20 changes: 14 additions & 6 deletions src/components/SendFlow/Multisig/SignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EstimatedAccountOperations } from "../../../types/AccountOperations";
import { ApproveOrExecute } from "../../../types/Operation";
import { useAsyncActionHandler } from "../../../utils/hooks/useAsyncActionHandler";
import { executeOperations } from "../../../utils/tezos";
import { AdvancedSettingsAccordion } from "../../AdvancedSettingsAccordion";
import { DynamicModalContext } from "../../DynamicModal";
import { BatchModalBody } from "../BatchModalBody";
import { SignButton } from "../SignButton";
Expand All @@ -28,14 +29,15 @@ export const SignPage: React.FC<{
defaultValues: { executeParams: operation.estimates },
});

// TODO: add advanced execute params component
const estimatedOperations = {
...operation,
estimates: form.watch("executeParams"),
};

const approveOrExecute = (tezosToolkit: TezosToolkit) =>
handleAsyncAction(
async () => {
const { opHash } = await executeOperations(
{ ...operation, estimates: form.watch("executeParams") },
tezosToolkit
);
const { opHash } = await executeOperations(estimatedOperations, tezosToolkit);

return openWith(<SuccessStep hash={opHash} />);
},
Expand All @@ -48,7 +50,13 @@ export const SignPage: React.FC<{
<FormProvider {...form}>
<ModalContent>
<form>
<BatchModalBody operation={operation} title={title} transactionCount={transactionCount} />
<BatchModalBody
operation={estimatedOperations}
title={title}
transactionCount={transactionCount}
>
<AdvancedSettingsAccordion />
</BatchModalBody>

<ModalFooter>
<SignButton onSubmit={approveOrExecute} signer={signer} text={title} />
Expand Down

1 comment on commit 373baf1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 89.64% 3704/4132
🟢 Branches 81.81% 1277/1561
🟢 Functions 87.96% 1125/1279
🟢 Lines 89.55% 3505/3914

Test suite run success

1445 tests passing in 187 suites.

Report generated by 🧪jest coverage report action from 373baf1

Please sign in to comment.