Skip to content

Commit f9822c0

Browse files
committed
refactor: linting and formatting
1 parent 3f08e8d commit f9822c0

File tree

9 files changed

+82
-90
lines changed

9 files changed

+82
-90
lines changed

apps/dashboard/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"@radix-ui/react-separator": "^1.1.1",
4646
"@radix-ui/react-slot": "^1.1.1",
4747
"@radix-ui/react-switch": "^1.1.2",
48-
"@radix-ui/react-tabs": "^1.1.2",
4948
"@radix-ui/react-tooltip": "1.1.7",
5049
"@sentry/nextjs": "8.51.0",
5150
"@shazow/whatsabi": "^0.19.0",

apps/dashboard/src/app/(dashboard)/hackweek/[chain_id]/[address]/actions/fetchNFTs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ interface Collection {
8484
telegram_url: string | null;
8585
marketplace_pages: MarketplacePage[];
8686
floor_prices: FloorPrice[];
87-
top_bids: any[];
87+
top_bids: unknown[];
8888
distinct_owner_count: number;
8989
distinct_nft_count: number;
9090
total_quantity: number;
@@ -148,7 +148,7 @@ interface NFT {
148148
queried_wallet_balances: Owner[];
149149
}
150150

151-
export interface SimpleHashResponse {
151+
interface SimpleHashResponse {
152152
next_cursor: null | string;
153153
next: null | string;
154154
previous: null | string;
Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
import { DASHBOARD_THIRDWEB_CLIENT_ID } from "@/constants/env";
22

3-
export interface Transaction {
4-
chain_id: number;
5-
hash: string;
6-
nonce: number;
7-
block_hash: string;
8-
block_number: number;
9-
block_timestamp: number;
10-
transaction_index: number;
11-
from_address: string;
12-
to_address: string | null;
13-
value: number;
14-
gas: number;
15-
gas_price: number | null;
16-
data: string | null;
17-
function_selector: string | null;
18-
max_fee_per_gas: number | null;
19-
max_priority_fee_per_gas: number | null;
20-
transaction_type: number | null;
21-
r: string | null;
22-
s: string | null;
23-
v: number | null;
24-
access_list_json: string | null;
25-
contract_address: string | null;
26-
gas_used: number | null;
27-
cumulative_gas_used: number | null;
28-
effective_gas_price: number | null;
29-
blob_gas_used: number | null;
30-
blob_gas_price: number | null;
31-
logs_bloom: string | null;
32-
status: boolean | null; // true for success, false for failure
3+
interface Transaction {
4+
chain_id: number;
5+
hash: string;
6+
nonce: number;
7+
block_hash: string;
8+
block_number: number;
9+
block_timestamp: number;
10+
transaction_index: number;
11+
from_address: string;
12+
to_address: string | null;
13+
value: number;
14+
gas: number;
15+
gas_price: number | null;
16+
data: string | null;
17+
function_selector: string | null;
18+
max_fee_per_gas: number | null;
19+
max_priority_fee_per_gas: number | null;
20+
transaction_type: number | null;
21+
r: string | null;
22+
s: string | null;
23+
v: number | null;
24+
access_list_json: string | null;
25+
contract_address: string | null;
26+
gas_used: number | null;
27+
cumulative_gas_used: number | null;
28+
effective_gas_price: number | null;
29+
blob_gas_used: number | null;
30+
blob_gas_price: number | null;
31+
logs_bloom: string | null;
32+
status: boolean | null; // true for success, false for failure
3333
}
3434

3535
interface InsightsResponse {
@@ -48,7 +48,7 @@ interface InsightsResponse {
4848
export async function fetchTxActivity(args: {
4949
chainId: number;
5050
address: string;
51-
limit_per_type?: number,
51+
limit_per_type?: number;
5252
page?: number;
5353
}): Promise<Transaction[]> {
5454
let { chainId, address, limit_per_type, page } = args;
@@ -74,11 +74,13 @@ export async function fetchTxActivity(args: {
7474
);
7575

7676
if (!outgoingTxsResponse.ok || !incomingTxsResponse.ok) {
77-
throw new Error('Failed to fetch transaction history');
77+
throw new Error("Failed to fetch transaction history");
7878
}
7979

8080
const outgoingTxsData: InsightsResponse = await outgoingTxsResponse.json();
8181
const incomingTxsData: InsightsResponse = await incomingTxsResponse.json();
8282

83-
return [...outgoingTxsData.data, ...incomingTxsData.data].sort((a, b) => b.block_number - a.block_number);
84-
}
83+
return [...outgoingTxsData.data, ...incomingTxsData.data].sort(
84+
(a, b) => b.block_number - a.block_number,
85+
);
86+
}

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
TableRow,
1010
} from "@/components/ui/table";
1111
import { TabButtons } from "@/components/ui/tabs";
12-
import {} from "@radix-ui/react-tabs";
1312
import { useState } from "react";
1413

1514
interface Transaction {
@@ -40,7 +39,9 @@ export function ActivityOverview({
4039
contracts,
4140
isLoading,
4241
}: ActivityOverviewProps) {
43-
const [activeTab, setActiveTab] = useState<"transactions" | "contracts">("transactions");
42+
const [activeTab, setActiveTab] = useState<"transactions" | "contracts">(
43+
"transactions",
44+
);
4445
const [currentPage, setCurrentPage] = useState(1);
4546
const itemsPerPage = 5;
4647

@@ -115,7 +116,8 @@ export function ActivityOverview({
115116
name: "Previous",
116117
isActive: currentPage === 1,
117118
isEnabled: currentPage > 1,
118-
onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
119+
onClick: () =>
120+
setCurrentPage((prev) => Math.max(prev - 1, 1)),
119121
},
120122
{
121123
name: `Page ${currentPage} of ${totalPages}`,
@@ -127,7 +129,8 @@ export function ActivityOverview({
127129
name: "Next",
128130
isActive: currentPage === totalPages,
129131
isEnabled: currentPage < totalPages,
130-
onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
132+
onClick: () =>
133+
setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
131134
},
132135
]}
133136
tabClassName="font-medium !text-sm"
@@ -145,7 +148,7 @@ export function ActivityOverview({
145148
</TableHeader>
146149
<TableBody>
147150
{contracts.map((contract, index) => (
148-
<TableRow key={index}>
151+
<TableRow key={`${contract.address}-${index}`}>
149152
<TableCell>{contract.name}</TableCell>
150153
<TableCell>{contract.address}</TableCell>
151154
<TableCell>{contract.lastInteraction}</TableCell>

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
TableRow,
1010
} from "@/components/ui/table";
1111
import { TabButtons } from "@/components/ui/tabs";
12-
import {} from "@radix-ui/react-tabs";
1312
import { useState } from "react";
1413
import { toTokens } from "thirdweb";
1514
import type { ChainMetadata } from "thirdweb/chains";
@@ -72,7 +71,7 @@ export function TokenHoldings({
7271
<Spinner />
7372
) : (
7473
tokens.map((token, idx) => (
75-
<TableRow key={idx}>
74+
<TableRow key={`${token.name}-${idx}`}>
7675
<TableCell>
7776
{token.symbol} ({token.name})
7877
</TableCell>
@@ -90,7 +89,11 @@ export function TokenHoldings({
9089
) : activeTab === "nft" ? (
9190
<div className="mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
9291
{nfts.map((nft, idx) => (
93-
<NFTCard key={idx} nft={nft} chain={chain} />
92+
<NFTCard
93+
key={`${nft.contractAddress}-${idx}`}
94+
nft={nft}
95+
chain={chain}
96+
/>
9497
))}
9598
</div>
9699
) : null}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"use client";
22
import type { ChainMetadata } from "thirdweb/chains";
33
import { useBalance } from "../hooks/getBalance";
4-
import { useGetTxActivity } from "../hooks/useGetTxActivity";
54
import { useGetERC20Tokens } from "../hooks/useGetERC20Tokens";
65
import { useGetNFTs } from "../hooks/useGetNFTs";
6+
import { useGetTxActivity } from "../hooks/useGetTxActivity";
77
import { mockWalletData } from "../utils/mockData";
88
import { ActivityOverview } from "./ActivityOverview";
99
import { BalanceOverview } from "./BalanceOverview";
@@ -38,7 +38,10 @@ export function WalletDashboard(props: {
3838
// console.error("Error fetching NFTs:", errorNFTs);
3939
// }
4040

41-
const { txActivity, isLoading: isLoadingActivity } = useGetTxActivity(props.chain.chainId, props.address)
41+
const { txActivity, isLoading: isLoadingActivity } = useGetTxActivity(
42+
props.chain.chainId,
43+
props.address,
44+
);
4245

4346
return (
4447
<div className="grid gap-6">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function useBalance(chainId: number, address: string): UseBalanceResult {
1919
setIsLoading(true);
2020
setError(null);
2121
const client = createThirdwebClient({
22-
clientId: process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID!,
22+
clientId: process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
2323
});
2424
const rpcRequest = getRpcClient({
2525
client,

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import { useEffect, useState } from "react";
22
import { fetchTxActivity } from "../actions/fetchTxActivity";
33

44
interface TxActivityItem {
5-
id: string;
6-
// all txs we retrieve for now are outgoing
7-
// TODO: add incoming
8-
type: "out" | "in";
9-
amount: string;
10-
to?: string;
11-
from?: string;
12-
method?: string;
13-
date: string;
14-
}
5+
id: string;
6+
// all txs we retrieve for now are outgoing
7+
// TODO: add incoming
8+
type: "out" | "in";
9+
amount: string;
10+
to?: string;
11+
from?: string;
12+
method?: string;
13+
date: string;
14+
}
1515

1616
export function useGetTxActivity(chainId: number, address: string) {
1717
const [txActivity, setTxActivity] = useState<TxActivityItem[]>([]);
@@ -21,17 +21,18 @@ export function useGetTxActivity(chainId: number, address: string) {
2121
(async () => {
2222
const response = await fetchTxActivity({ chainId, address });
2323
const activity = response.map((tx): TxActivityItem => {
24-
let type = tx.to_address?.toLowerCase() === address.toLowerCase() ? "in" : "out";
24+
const type =
25+
tx.to_address?.toLowerCase() === address.toLowerCase() ? "in" : "out";
2526
return {
2627
id: tx.hash,
2728
type,
28-
amount: `${tx.value / Math.pow(10, 18)} ETH`,
29+
amount: `${tx.value / 10 ** 18} ETH`,
2930
to: tx.to_address || undefined,
3031
from: tx.from_address,
3132
method: tx.function_selector || undefined,
3233
date: new Date(tx.block_timestamp * 1000).toLocaleString(),
3334
};
34-
})
35+
});
3536
setTxActivity(activity);
3637
setIsLoading(false);
3738
})();

pnpm-lock.yaml

Lines changed: 10 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)