diff --git a/src/app/history/layout.tsx b/src/app/history/layout.tsx new file mode 100644 index 0000000..88b57c3 --- /dev/null +++ b/src/app/history/layout.tsx @@ -0,0 +1,9 @@ +import { OrderProvider } from "#/contexts/ordersContext"; + +export default function Layout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + return {children}; +} diff --git a/src/app/history/order/[orderHash]/page.tsx b/src/app/history/order/[orderHash]/page.tsx index aaf5b6a..65679a4 100644 --- a/src/app/history/order/[orderHash]/page.tsx +++ b/src/app/history/order/[orderHash]/page.tsx @@ -57,12 +57,7 @@ export default function OrderPage({ const orderDateTime = formatDateTime( epochToDate(Number(stopLossOrder?.blockTimestamp)) ); - const orderExpirationDateTime = formatDateTime( - epochToDate( - Number(stopLossOrder?.blockTimestamp) + - Number(stopLossOrder?.stopLossData?.validityBucketSeconds) - ) - ); + const amountIn = Number(stopLossOrder?.stopLossData?.tokenAmountIn) / 10 ** Number(stopLossOrder?.stopLossData?.tokenIn.decimals); @@ -125,12 +120,6 @@ export default function OrderPage({ > {orderDateTime} - - {orderExpirationDateTime} -
diff --git a/src/app/txpending/[safeTxHash]/page.tsx b/src/app/txpending/[safeTxHash]/page.tsx index 50fe038..15b1d28 100644 --- a/src/app/txpending/[safeTxHash]/page.tsx +++ b/src/app/txpending/[safeTxHash]/page.tsx @@ -6,18 +6,27 @@ import { useRouter } from "next/navigation"; import { useEffect } from "react"; import { Spinner } from "#/components/Spinner"; +import { ChainId, publicClientsFromIds } from "#/lib/publicClients"; export default function Page({ params: { safeTxHash }, }: { params: { safeTxHash: string }; }) { - const { sdk } = useSafeAppsSDK(); + const { sdk, safe } = useSafeAppsSDK(); + const publicClient = publicClientsFromIds[safe.chainId as ChainId]; const router = useRouter(); async function redirectToHistoryOnTxExecuted() { const tx = await sdk.txs.getBySafeTxHash(safeTxHash); - if (tx.txStatus === TransactionStatus.SUCCESS) { + if (tx.txStatus === TransactionStatus.SUCCESS && tx.txHash) { + const confirmationBlocks = await publicClient.getTransactionConfirmations( + { + hash: tx.txHash as `0x${string}`, + } + ); + + if (confirmationBlocks < 3) return; // Wait 1 second for the subgraph to index the transaction setTimeout(() => { router.push("/history"); diff --git a/src/components/RootLayout.tsx b/src/components/RootLayout.tsx index 62b50fb..b818255 100644 --- a/src/components/RootLayout.tsx +++ b/src/components/RootLayout.tsx @@ -9,7 +9,6 @@ import React from "react"; import { ReactFlowProvider } from "reactflow"; import { NetworksContextProvider } from "#/contexts/networks"; -import { OrderProvider } from "#/contexts/ordersContext"; import { Footer } from "./Footer"; import { Header } from "./Header"; @@ -33,19 +32,17 @@ export function RootLayout({ children }: React.PropsWithChildren) { }> - -
-
- {path !== "/history" && } -
-
{children}
-
-
- -
+
+
+ {path !== "/history" && } +
+
{children}
+
+
+