From 1436a60070bef5e8b6acb6a9a7ad03b0d360ec05 Mon Sep 17 00:00:00 2001 From: tommy0x <128688932+tommy0x@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:09:56 +0100 Subject: [PATCH] feat(frontend): tx link in recent warps (#393) --- .../components/RecentWarps/RecentWarps.tsx | 39 ++++++++++++++----- .../frontend/src/hooks/useRecentWarps.tsx | 2 + 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/packages/frontend/src/components/RecentWarps/RecentWarps.tsx b/packages/frontend/src/components/RecentWarps/RecentWarps.tsx index 5a7f2b46..46022d4a 100644 --- a/packages/frontend/src/components/RecentWarps/RecentWarps.tsx +++ b/packages/frontend/src/components/RecentWarps/RecentWarps.tsx @@ -2,8 +2,9 @@ import { Table, formatTokenAmount, Skeleton } from '@sifi/shared-ui'; import { FunctionComponent } from 'react'; import { useRecentWarps } from 'src/hooks/useRecentWarps'; import { useTokens } from 'src/hooks/useTokens'; -import { getIconFromSymbol } from 'src/utils'; -import { getChainIcon } from 'src/utils/chains'; +import { getChainById, getChainIcon } from 'src/utils/chains'; +import { firstAndLast, getEvmTxUrl, getIconFromSymbol } from 'src/utils'; +import { useSwapFormValues } from 'src/hooks/useSwapFormValues'; const RecentWarpsTableData: FunctionComponent = () => { const { data: warps, error, isLoading } = useRecentWarps(); @@ -36,9 +37,11 @@ const RecentWarpsTableData: FunctionComponent = () => { return ( <> {warps?.map(warp => { + const hash = warp.id.split('-')[0]; + return ( - +
@@ -99,6 +102,21 @@ const RecentWarpsTableData: FunctionComponent = () => {
+ +
+ + TX + + + {firstAndLast(hash)} + +
+
); })} @@ -115,15 +133,16 @@ const RecentWarps: FunctionComponent = () => {
- - -
- - From - - To + + +
+ From + To
+ + Transaction +
diff --git a/packages/frontend/src/hooks/useRecentWarps.tsx b/packages/frontend/src/hooks/useRecentWarps.tsx index 7feb2763..45c7e8a7 100644 --- a/packages/frontend/src/hooks/useRecentWarps.tsx +++ b/packages/frontend/src/hooks/useRecentWarps.tsx @@ -6,6 +6,7 @@ import { SUPPORTED_CHAINS } from 'src/utils/chains'; const RECENT_WARPS_QUERY = gql` query recentWarps($since: BigInt!) { warps(first: 5, where: { addedAt_gt: $since }, orderBy: addedAt, orderDirection: desc) { + id addedAt amountInDecimal tokenIn { @@ -21,6 +22,7 @@ const RECENT_WARPS_QUERY = gql` `; type Warp = { + id: string; addedAt: string; chainId: number; amountInDecimal: string;