diff --git a/apps/web/src/components/SendFlow/Beacon/useSignWithBeacon.tsx b/apps/web/src/components/SendFlow/Beacon/useSignWithBeacon.tsx index 7def3c8f69..80ca2bf2ab 100644 --- a/apps/web/src/components/SendFlow/Beacon/useSignWithBeacon.tsx +++ b/apps/web/src/components/SendFlow/Beacon/useSignWithBeacon.tsx @@ -11,7 +11,6 @@ import { type CalculatedSignProps, type SdkSignPageProps } from "../utils"; export const useSignWithBeacon = ({ operation, headerProps, - requestId, }: SdkSignPageProps): CalculatedSignProps => { const { isLoading: isSigning, handleAsyncAction } = useAsyncActionHandler(); const { openWith } = useDynamicModalContext(); @@ -28,7 +27,7 @@ export const useSignWithBeacon = ({ const response: OperationResponseInput = { type: BeaconMessageType.OperationResponse, - id: requestId.id.toString(), + id: headerProps.requestId.id.toString(), transactionHash: opHash, }; await WalletClient.respond(response); diff --git a/apps/web/src/components/SendFlow/WalletConnect/useSignWithWalletConnect.tsx b/apps/web/src/components/SendFlow/WalletConnect/useSignWithWalletConnect.tsx index 809c9e7a31..71ce454142 100644 --- a/apps/web/src/components/SendFlow/WalletConnect/useSignWithWalletConnect.tsx +++ b/apps/web/src/components/SendFlow/WalletConnect/useSignWithWalletConnect.tsx @@ -11,12 +11,12 @@ import { type CalculatedSignProps, type SdkSignPageProps } from "../utils"; export const useSignWithWalletConnect = ({ operation, headerProps, - requestId, }: SdkSignPageProps): CalculatedSignProps => { const { isLoading: isSigning, handleAsyncAction } = useAsyncActionHandler(); const { openWith } = useDynamicModalContext(); const form = useForm({ defaultValues: { executeParams: operation.estimates } }); + const requestId = headerProps.requestId; if (requestId.sdkType !== "walletconnect") { return { diff --git a/apps/web/src/components/SendFlow/common/BatchSignPage.tsx b/apps/web/src/components/SendFlow/common/BatchSignPage.tsx index eee5749c08..b80e8ea1a3 100644 --- a/apps/web/src/components/SendFlow/common/BatchSignPage.tsx +++ b/apps/web/src/components/SendFlow/common/BatchSignPage.tsx @@ -34,7 +34,9 @@ export const BatchSignPage = ( const beaconCalculatedProps = useSignWithBeacon({ ...signProps }); const walletConnectCalculatedProps = useSignWithWalletConnect({ ...signProps }); const calculatedProps = - signProps.requestId.sdkType === "beacon" ? beaconCalculatedProps : walletConnectCalculatedProps; + signProps.headerProps.requestId.sdkType === "beacon" + ? beaconCalculatedProps + : walletConnectCalculatedProps; const { isSigning, onSign, network, fee } = calculatedProps; const { signer, operations } = signProps.operation; diff --git a/apps/web/src/components/SendFlow/common/OriginationOperationSignPage.test.tsx b/apps/web/src/components/SendFlow/common/OriginationOperationSignPage.test.tsx index b9f4f89e9a..c54e81238c 100644 --- a/apps/web/src/components/SendFlow/common/OriginationOperationSignPage.test.tsx +++ b/apps/web/src/components/SendFlow/common/OriginationOperationSignPage.test.tsx @@ -35,11 +35,11 @@ const headerProps: SignHeaderProps = { network: GHOSTNET, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: operation, - requestId: { sdkType: "beacon", id: message.id }, }; jest.mock("@umami/core", () => ({ diff --git a/apps/web/src/components/SendFlow/common/SingleSignPage.test.tsx b/apps/web/src/components/SendFlow/common/SingleSignPage.test.tsx index 1f61a0ebe2..7bc25ac05d 100644 --- a/apps/web/src/components/SendFlow/common/SingleSignPage.test.tsx +++ b/apps/web/src/components/SendFlow/common/SingleSignPage.test.tsx @@ -81,6 +81,7 @@ describe("", () => { network: GHOSTNET, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; store.dispatch(networksActions.setCurrent(GHOSTNET)); @@ -89,7 +90,6 @@ describe("", () => { const signProps: SdkSignPageProps = { headerProps: headerProps, operation: operation, - requestId: { sdkType: "beacon", id: message.id }, }; jest.mocked(useGetSecretKey).mockImplementation(() => () => Promise.resolve("secretKey")); diff --git a/apps/web/src/components/SendFlow/common/SingleSignPage.tsx b/apps/web/src/components/SendFlow/common/SingleSignPage.tsx index 5c35f7addf..2716600398 100644 --- a/apps/web/src/components/SendFlow/common/SingleSignPage.tsx +++ b/apps/web/src/components/SendFlow/common/SingleSignPage.tsx @@ -18,7 +18,9 @@ export const SingleSignPage = (signProps: SdkSignPageProps) => { const beaconCalculatedProps = useSignWithBeacon({ ...signProps }); const walletConnectCalculatedProps = useSignWithWalletConnect({ ...signProps }); const calculatedProps = - signProps.requestId.sdkType === "beacon" ? beaconCalculatedProps : walletConnectCalculatedProps; + signProps.headerProps.requestId.sdkType === "beacon" + ? beaconCalculatedProps + : walletConnectCalculatedProps; switch (operationType) { case "tez": { diff --git a/apps/web/src/components/SendFlow/common/TezSignPage.test.tsx b/apps/web/src/components/SendFlow/common/TezSignPage.test.tsx index 538ff08fa2..682c7832d1 100644 --- a/apps/web/src/components/SendFlow/common/TezSignPage.test.tsx +++ b/apps/web/src/components/SendFlow/common/TezSignPage.test.tsx @@ -55,11 +55,11 @@ describe("", () => { network: GHOSTNET, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: operation, - requestId: { sdkType: "beacon", id: message.id }, }; store.dispatch(networksActions.setCurrent(GHOSTNET)); diff --git a/apps/web/src/components/SendFlow/utils.tsx b/apps/web/src/components/SendFlow/utils.tsx index dfc8ff88f3..45a54f2547 100644 --- a/apps/web/src/components/SendFlow/utils.tsx +++ b/apps/web/src/components/SendFlow/utils.tsx @@ -76,10 +76,10 @@ export type SignHeaderProps = { network: Network; appName: string; appIcon?: string; + requestId: SignRequestId; }; export type SdkSignPageProps = { - requestId: SignRequestId; operation: EstimatedAccountOperations; headerProps: SignHeaderProps; }; diff --git a/apps/web/src/components/WalletConnect/useHandleWcRequest.tsx b/apps/web/src/components/WalletConnect/useHandleWcRequest.tsx index 89f476e89f..a122d06437 100644 --- a/apps/web/src/components/WalletConnect/useHandleWcRequest.tsx +++ b/apps/web/src/components/WalletConnect/useHandleWcRequest.tsx @@ -126,11 +126,11 @@ export const useHandleWcRequest = () => { network, appName: session.peer.metadata.name, appIcon: session.peer.metadata.icons[0], + requestId: { sdkType: "walletconnect", id: id, topic }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: estimatedOperations, - requestId: { sdkType: "walletconnect", id: id, topic }, }; if (operation.operations.length === 1) { diff --git a/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx b/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx index 00eb28aeed..06a515d8b1 100644 --- a/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx +++ b/apps/web/src/components/beacon/useHandleBeaconMessage.test.tsx @@ -360,11 +360,11 @@ describe("", () => { network: MAINNET, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: operation, - requestId: { sdkType: "beacon", id: message.id }, }; const { @@ -465,11 +465,11 @@ describe("", () => { network: MAINNET, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: estimatedOperations, - requestId: { sdkType: "beacon", id: message.id }, }; const { diff --git a/apps/web/src/components/beacon/useHandleBeaconMessage.tsx b/apps/web/src/components/beacon/useHandleBeaconMessage.tsx index a2ae139318..b3dad127f4 100644 --- a/apps/web/src/components/beacon/useHandleBeaconMessage.tsx +++ b/apps/web/src/components/beacon/useHandleBeaconMessage.tsx @@ -130,11 +130,11 @@ export const useHandleBeaconMessage = () => { network: network, appName: message.appMetadata.name, appIcon: message.appMetadata.icon, + requestId: { sdkType: "beacon", id: message.id }, }; const signProps: SdkSignPageProps = { headerProps: headerProps, operation: estimatedOperations, - requestId: { sdkType: "beacon", id: message.id }, }; if (operation.operations.length === 1) {