Skip to content

Commit ed66c51

Browse files
committed
wip
1 parent c06f1af commit ed66c51

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/components/WalletDashboard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { ChainMetadata } from "thirdweb/chains";
33
import { useGetERC20Tokens } from "../hooks/useGetERC20Tokens";
44
import { useGetNFTs } from "../hooks/useGetNFTs";
5-
import { useGetTxActivity } from "../hooks/useGetTxActivity";
5+
import { useGetRecentTransactions } from "../hooks/useGetTxActivity";
66
import { mockWalletData } from "../utils/mockData";
77
import { ActivityOverview } from "./ActivityOverview";
88
import { NebulaInterface } from "./NebulaInterface";
@@ -20,7 +20,7 @@ export function WalletDashboard(props: {
2020
props.chain.chainId,
2121
props.address,
2222
);
23-
const { txActivity, isLoading: isLoadingActivity } = useGetTxActivity(
23+
const { txActivity, isLoading: isLoadingActivity } = useGetRecentTransactions(
2424
props.chain.chainId,
2525
props.address,
2626
);

apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/hooks/useGetTxActivity.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
import { useEffect, useState } from "react";
2-
import { fetchTxActivity } from "../actions/fetchTxActivity";
2+
import { fetchTxActivity as getRecentTransactions } from "../actions/fetchTxActivity";
33

4-
interface TxActivityItem {
4+
export interface TransactionDetails {
55
id: string;
6-
// all txs we retrieve for now are outgoing
7-
// TODO: add incoming
86
type: "out" | "in";
9-
amount: string;
7+
value: bigint;
108
to?: string;
119
from?: string;
1210
method?: string;
1311
date: string;
1412
}
1513

16-
export function useGetTxActivity(chainId: number, address: string) {
17-
const [txActivity, setTxActivity] = useState<TxActivityItem[]>([]);
14+
export function useGetRecentTransactions(chainId: number, address: string) {
15+
const [txActivity, setTxActivity] = useState<TransactionDetails[]>([]);
1816
const [isLoading, setIsLoading] = useState(true);
1917

2018
useEffect(() => {
2119
(async () => {
22-
const response = await fetchTxActivity({ chainId, address });
23-
const activity = response.map((tx): TxActivityItem => {
20+
const response = await getRecentTransactions({ chainId, address });
21+
const activity = response.map((tx): TransactionDetails => {
2422
const type =
2523
tx.to_address?.toLowerCase() === address.toLowerCase() ? "in" : "out";
2624
return {
2725
id: tx.hash,
2826
type,
29-
amount: `${tx.value / 10 ** 18} ETH`,
27+
value: BigInt(tx.value),
3028
to: tx.to_address || undefined,
3129
from: tx.from_address,
3230
method: tx.function_selector || undefined,

0 commit comments

Comments
 (0)