Skip to content

Commit

Permalink
fix: renamed sdk files
Browse files Browse the repository at this point in the history
  • Loading branch information
dianasavvatina committed Nov 14, 2024
1 parent 8481ec5 commit af864af
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 13 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
import { FormProvider } from "react-hook-form";

import { Header } from "./Header";
import { useSignWithBeacon } from "./useSignWithBeacon";
import { useColor } from "../../../styles/useColor";
import { AddressTile } from "../../AddressTile/AddressTile";
import { JsValueWrap } from "../../JsValueWrap";
import { useSignWithBeacon } from "../Beacon/useSignWithBeacon";
import { SignButton } from "../SignButton";
import { SignPageFee } from "../SignPageFee";
import { type SdkSignPageProps } from "../utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ export const OriginationOperationSignPage = (
{ operation, headerProps }: SdkSignPageProps,
calculatedSignProps: CalculatedSignProps
) => {
const { isSigning, onSign, network, form, fee } = calculatedSignProps;
const color = useColor();
const { code, storage } = operation.operations[0] as ContractOrigination;

const { isSigning, onSign, network, fee, form } = calculatedSignProps;

return (
<FormProvider {...form}>
<ModalContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { StakeSignPage } from "./StakeSignPage";
import { TezSignPage } from "./TezSignPage";
import { UndelegationSignPage } from "./UndelegationSignPage";
import { UnstakeSignPage } from "./UnstakeSignPage";
import { useSignWithBeacon } from "./useSignWithBeacon";
import { useSignWithBeacon } from "../Beacon/useSignWithBeacon";

export const BeaconSignPage = (signProps: SdkSignPageProps) => {
export const SingleSignPage = (signProps: SdkSignPageProps) => {
const operationType = signProps.operation.operations[0].type;

const calculatedProps = useSignWithBeacon({ ...signProps });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { executeParams } from "@umami/test-utils";
import { mockImplicitAddress } from "@umami/tezos";

import { useHandleBeaconMessage } from "./useHandleBeaconMessage";
import { BatchSignPage } from "../../components/SendFlow/Beacon/BatchSignPage";
import { BeaconSignPage } from "../../components/SendFlow/Beacon/BeaconSignPage";
import { BatchSignPage } from "../../components/SendFlow/sdk/BatchSignPage";
import { SingleSignPage } from "../../components/SendFlow/sdk/SingleSignPage";
import { act, dynamicModalContextMock, renderHook, screen, waitFor } from "../../testUtils";
import { type SdkSignPageProps } from "../SendFlow/utils";

Expand Down Expand Up @@ -326,7 +326,7 @@ describe("<useHandleBeaconMessage />", () => {
});

describe("single operation", () => {
it("opens a modal with the BeaconSignPage for 1 operation", async () => {
it("opens a modal with the SingleSignPage for 1 operation", async () => {
jest.mocked(estimate).mockResolvedValueOnce({
...makeAccountOperations(account, account, [
{ type: "tez", amount: "1", recipient: mockImplicitAddress(2) },
Expand Down Expand Up @@ -375,7 +375,7 @@ describe("<useHandleBeaconMessage />", () => {

await waitFor(() =>
expect(dynamicModalContextMock.openWith).toHaveBeenCalledWith(
<BeaconSignPage {...signProps} />,
<SingleSignPage {...signProps} />,
{ onClose: expect.any(Function) }
)
);
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/components/beacon/useHandleBeaconMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import { type Network } from "@umami/tezos";

import { PermissionRequestModal } from "./PermissionRequestModal";
import { SignPayloadRequestModal } from "./SignPayloadRequestModal";
import { BatchSignPage } from "../../components/SendFlow/Beacon/BatchSignPage";
import { BeaconSignPage } from "../../components/SendFlow/Beacon/BeaconSignPage";
import { BatchSignPage } from "../../components/SendFlow/sdk/BatchSignPage";
import { SingleSignPage } from "../../components/SendFlow/sdk/SingleSignPage";
import { type SdkSignPageProps } from "../SendFlow/utils";

/**
* @returns a function that handles a beacon message and opens a modal with the appropriate content
*
* For operation requests it will also try to convert the operation(s) to our {@link Operation} format,
* estimate the fee and open the BeaconSignPage only if it succeeds
* estimate the fee and open the SingleSignPage only if it succeeds
*/
export const useHandleBeaconMessage = () => {
const { openWith } = useDynamicModalContext();
Expand Down Expand Up @@ -121,7 +121,7 @@ export const useHandleBeaconMessage = () => {
};

if (operation.operations.length === 1) {
modal = <BeaconSignPage {...signProps} />;
modal = <SingleSignPage {...signProps} />;
} else {
modal = <BatchSignPage {...signProps} {...message.operationDetails} />;
}
Expand Down

0 comments on commit af864af

Please sign in to comment.