diff --git a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchERC20Tokens.ts b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchERC20Tokens.ts index 77ce5c312bf..d68d7baeb89 100644 --- a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchERC20Tokens.ts +++ b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchERC20Tokens.ts @@ -92,7 +92,7 @@ export async function fetchERC20Tokens(args: { lastTransferredDate: token.queried_wallet_balances[0]?.last_transferred_date, })); - const fungibleTokens = data.fungibles.map((token) => ({ + let fungibleTokens = data.fungibles.map((token) => ({ name: token.name, symbol: token.symbol, contractAddress: token.fungible_id.split(".")[1] ?? "--", @@ -104,6 +104,7 @@ export async function fetchERC20Tokens(args: { lastTransferredDate: token.queried_wallet_balances[0]?.last_transferred_date, })); + fungibleTokens = fungibleTokens.filter(d => d.name != null || d.symbol != null); return [...nativeTokens, ...fungibleTokens]; } catch (error) { console.error("Error fetching tokens:", error); diff --git a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchTxActivity.ts b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchTxActivity.ts index 7ca2fb23405..c3850a0346b 100644 --- a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchTxActivity.ts +++ b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchTxActivity.ts @@ -51,6 +51,7 @@ export async function fetchTxActivity(args: { limit_per_type?: number; page?: number; }): Promise { + try { let { chainId, address, limit_per_type, page } = args; if (!limit_per_type) limit_per_type = 100; if (!page) page = 0; @@ -83,4 +84,8 @@ export async function fetchTxActivity(args: { return [...outgoingTxsData.data, ...incomingTxsData.data].sort( (a, b) => b.block_number - a.block_number, ); +} catch (err) { + console.log("Failed to fetch tx activity", err); + return []; + } } diff --git a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/components/ActivityOverview.tsx b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/components/ActivityOverview.tsx index 9d9cddb059f..92106234ffb 100644 --- a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/components/ActivityOverview.tsx +++ b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/components/ActivityOverview.tsx @@ -10,14 +10,14 @@ import { } from "@/components/ui/table"; import { TabButtons } from "@/components/ui/tabs"; import { useState } from "react"; +import { formatDistanceToNow } from "date-fns"; interface Transaction { id: string; type: "out" | "in"; - amount: string; + value: string; to?: string; from?: string; - contract?: string; method?: string; date: string; } @@ -68,12 +68,12 @@ export function ActivityOverview({ isEnabled: true, onClick: () => setActiveTab("transactions"), }, - { - name: "Contracts", - isActive: activeTab === "contracts", - isEnabled: true, - onClick: () => setActiveTab("contracts"), - }, + // { + // name: "Contracts", + // isActive: activeTab === "contracts", + // isEnabled: true, + // onClick: () => setActiveTab("contracts"), + // }, ]} tabClassName="font-medium !text-sm" /> @@ -85,24 +85,23 @@ export function ActivityOverview({ + Tx Hash Type Amount - Details + From + To Date {currentTransactions.map((tx) => ( + {tx.id.slice(0, 12)}... {tx.type} - {tx.amount} - - {tx.to && `To: ${tx.to} `} - {tx.from && `From: ${tx.from} `} - {tx.contract && `Contract: ${tx.contract} `} - {tx.method && ` Method: ${tx.method}`} - - {tx.date} + {tx.value} + {tx.from} + {tx.to} + {formatDistanceToNow(tx.date)} ago ))} diff --git a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/hooks/useGetTxActivity.ts b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/hooks/useGetTxActivity.ts index b89da4fbcc5..7f05a33250a 100644 --- a/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/hooks/useGetTxActivity.ts +++ b/apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/hooks/useGetTxActivity.ts @@ -1,10 +1,11 @@ import { useEffect, useState } from "react"; import { fetchTxActivity as getRecentTransactions } from "../actions/fetchTxActivity"; +import { toEther } from "thirdweb/utils"; export interface TransactionDetails { id: string; - type: "out" | "in"; - value: bigint; + type: "in" | "out"; + value: string; to?: string; from?: string; method?: string; @@ -24,7 +25,7 @@ export function useGetRecentTransactions(chainId: number, address: string) { return { id: tx.hash, type, - value: BigInt(tx.value), + value: toEther(BigInt(tx.value)).toString(), to: tx.to_address || undefined, from: tx.from_address, method: tx.function_selector || undefined,