Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
441422b
Add flake
Stentonian Oct 14, 2025
65e6d6e
[flake] set correct node version
Stentonian Oct 14, 2025
7250b0b
Merge pull request #10 from silhouette-exchange/stent/nix
Stentonian Oct 14, 2025
6646cb4
[flake] add gemini
Stentonian Oct 14, 2025
483bb2c
Add gemini.md
Stentonian Oct 14, 2025
df9798f
Add MD task files
Stentonian Oct 14, 2025
5470aca
Merge pull request #11 from silhouette-exchange/stent/basic-explorer-…
Stentonian Oct 14, 2025
44e243f
feat: Add comprehensive account details page with dual-chain support
codegen-sh[bot] Oct 14, 2025
1d5a990
fix: Replace inefficient block scanning with informative message
codegen-sh[bot] Oct 14, 2025
7a349a2
refactor: Address CodeRabbit review feedback
codegen-sh[bot] Oct 15, 2025
b40267a
Update app/components/AccountDetails/HyperCoreAccountState.tsx
Stentonian Oct 15, 2025
e82a280
Update app/components/AccountDetails/HyperCoreAccountState.tsx
Stentonian Oct 15, 2025
8886e97
Update app/components/AccountDetails/HyperCoreAccountState.tsx
Stentonian Oct 15, 2025
89f9f40
Revert "Update app/components/AccountDetails/HyperCoreAccountState.tsx"
Stentonian Oct 15, 2025
ec07612
Revert "Update app/components/AccountDetails/HyperCoreAccountState.tsx"
Stentonian Oct 15, 2025
fa62ad6
Revert "Revert "Update app/components/AccountDetails/HyperCoreAccount…
Stentonian Oct 15, 2025
2ad1e51
Address CodeRabbit review feedback for account details
codegen-sh[bot] Oct 15, 2025
2dbed44
Switch HyperCore transaction list to userDetails API
codegen-sh[bot] Oct 15, 2025
62a6579
fix: Correct userDetails API response handling
codegen-sh[bot] Oct 15, 2025
4611d4c
Merge pull request #12 from silhouette-exchange/feat/account-details-…
Stentonian Oct 15, 2025
79ce417
Add standardized linting and formatting tools
codegen-sh[bot] Oct 15, 2025
e44821d
Merge pull request #13 from silhouette-exchange/codegen-bot/add-linti…
Stentonian Oct 15, 2025
c2ed504
Implement unified search and navigation feature
codegen-sh[bot] Oct 15, 2025
1b1073a
Fix TypeScript imports and improve accessibility in UnifiedSearchBar
codegen-sh[bot] Oct 15, 2025
a3ddfa1
Persist network selection across pages via URL parameters
codegen-sh[bot] Oct 16, 2025
36d763f
Add HyperEVM heading and support for addApiWallet action decoder
codegen-sh[bot] Oct 16, 2025
32be0de
Add custom RPC testnet support and fix account page routing
codegen-sh[bot] Oct 16, 2025
c946519
Merge pull request #14 from silhouette-exchange/codegen-bot/unified-s…
Stentonian Oct 16, 2025
c7b53f3
Implement dedicated /tx route with loading indicators
codegen-sh[bot] Oct 21, 2025
0449f69
Fix static export compatibility and transaction links
codegen-sh[bot] Oct 21, 2025
079d586
Fix import paths after moving tx page to parent directory
codegen-sh[bot] Oct 21, 2025
ab7d5d8
Fix constants import path
codegen-sh[bot] Oct 21, 2025
6c58737
Add network parameter to account links and back-to-search button
codegen-sh[bot] Oct 21, 2025
d361c7d
Refactor: Extract validation and chain search to shared utilities
codegen-sh[bot] Oct 21, 2025
087e098
Fix missing HyperCore imports in app/tx/page.tsx
codegen-sh[bot] Oct 22, 2025
24ab43e
Implement dynamic route for transaction page
codegen-sh[bot] Oct 22, 2025
e6aa6fd
Fix provider chainId, event decoding, and route structure
codegen-sh[bot] Oct 22, 2025
f32404f
Merge pull request #15 from silhouette-exchange/codegen-bot/tx-route-…
Stentonian Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dependencies
node_modules
pnpm-lock.yaml
package-lock.json
yarn.lock

# Build outputs
.next
out
dist
build

# Cache
.cache
.turbo

# Misc
.DS_Store
*.log
*.tsbuildinfo

10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"arrowParens": "avoid",
"endOfLine": "lf"
}
107 changes: 107 additions & 0 deletions ACCOUNT_DETAILS_PAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Feature Specification: Account Details Page

## 1. Objective

To create a new, comprehensive "Account Details" page that provides a unified view of a user's assets and transaction history across both HyperEVM (L2) and HyperCore (L1). This page will serve as the central hub for account-centric exploration.

## 2. URL Structure

The page will use Next.js dynamic routing to handle different account addresses.

- **URL:** `/address/[address]`
- **Example:** `/address/0x1234...abcd`

## 3. Page Layout & Component Structure

The page will be composed of a main page component that orchestrates several smaller, specialized components. The primary layout will be a two-pane design, displaying HyperEVM and HyperCore information side-by-side.

### 3.1. Main Page Component

- **File:** `app/address/[address]/page.tsx`
- **Responsibilities:**
- Extracts the `address` from the URL parameters.
- Renders the main page layout, including the account address as a title.
- Renders the `HyperEvmAccountDetails` and `HyperCoreAccountDetails` components, passing the address to each.

### 3.2. Left Pane: HyperEVM (L2)

- **Component:** `app/components/AccountDetails/HyperEvmAccountDetails.tsx`
- **Responsibilities:**
- Displays a title, e.g., "HyperEVM (L2) Overview".
- Fetches and displays the account's **HYPE** balance using `ethers.js`.
- Renders the `HyperEvmTransactionList` component.

#### 3.2.1. HyperEVM Transaction List

- **Component:** `app/components/AccountDetails/HyperEvmTransactionList.tsx`
- **Functionality:**
- **Data Fetching:**
- **Instruction for AI:** The method for fetching a transaction list by address on HyperEVM is not predefined. You must research the capabilities of the public RPC endpoints. If a direct method like `eth_getTransactionsByAddress` is not available, investigate if Hyperliquid provides a public, Etherscan-compatible API for this purpose. If no direct method is found, this feature may need to be deferred.
- **Display:**
- Renders a table or list of transactions.
- Each row should display:
- **Transaction Hash:** Link to the transaction's detail page.
- **Method:** The function name/signature if it's a contract interaction (e.g., "Transfer"), otherwise empty.
- **Block Number:** Link to the (future) block detail page.
- **Age:** A human-readable timestamp (e.g., "5 minutes ago").
- **CoreWriter Indicator:** A small badge or icon if the transaction includes `RawAction` logs from the CoreWriter contract.
- **Pagination:**
- Initially, fetch and display 25 transactions.
- A "Load More" button at the bottom of the list will fetch and append the next 25 transactions.

### 3.3. Right Pane: HyperCore (L1)

- **Component:** `app/components/AccountDetails/HyperCoreAccountDetails.tsx`
- **Responsibilities:**
- Displays a title, e.g., "HyperCore (L1) State".
- Renders the `HyperCoreAccountState` component.
- Renders the `HyperCoreTransactionList` component.

#### 3.3.1. HyperCore Account State

- **Component:** `app/components/AccountDetails/HyperCoreAccountState.tsx`
- **Functionality:**
- This component will be a refactored, non-modal version of the existing `AccountBalanceModal.tsx`.
- It will accept an `address` prop.
- Using the `@nktkas/hyperliquid` library, it will fetch and display:
- A summary section (Account Value, Total Margin Used, Withdrawable).
- A list of open Perpetual Positions.
- A table of Spot Balances.

#### 3.3.2. HyperCore Transaction List

- **Component:** `app/components/AccountDetails/HyperCoreTransactionList.tsx`
- **Functionality:**
- **Data Fetching:**
- Use the `@nktkas/hyperliquid` library's `InfoClient` to fetch the user's L1 action history.
- **Display:**
- Renders a table or list of L1 actions.
- Each row should display:
- **Transaction Hash:** Link to the transaction's detail page.
- **Action Type:** The type of L1 action (e.g., "deposit", "withdrawal", "order").
- **Timestamp:** A human-readable timestamp.
- **Pagination:**
- Follows the same "Load More" pattern as the HyperEVM list, with 25 items per page.

## 4. Implementation Steps

1. **Create New Directory:** Create a new directory `app/components/AccountDetails`.
2. **Refactor `AccountBalanceModal`:**
- Create the new `HyperCoreAccountState.tsx` component.
- Move the core data fetching and display logic from `AccountBalanceModal.tsx` into this new component.
- The modal can now be a simpler wrapper around this new component.
3. **Build Page Structure:**
- Create the dynamic route page at `app/address/[address]/page.tsx`.
- Create the main pane components: `HyperEvmAccountDetails.tsx` and `HyperCoreAccountDetails.tsx`.
4. **Implement Transaction Lists:**
- Create `HyperEvmTransactionList.tsx` and `HyperCoreTransactionList.tsx`.
- Implement the data fetching and pagination logic for both.
5. **Update Existing Components:**
- Modify `TransactionInfo.tsx` and `HyperCoreTransactionInfo.tsx`.
- Identify all displayed addresses ('From', 'To', 'User') and transform them into Next.js `<Link>` components pointing to the new account details page (e.g., `<Link href={`/address/${address}`}>`).
6. **Implement Unified Search:**
- On `app/page.tsx`, replace the tabbed interface with a single search input and button.
- The search handler function will:
1. Check if the input is a valid address or a transaction hash.
2. If it's an address, navigate to `/address/[address]`.
3. If it's a transaction hash, attempt to fetch it from both the HyperEVM provider and the HyperCore API. Route the user to the main page with the correct chain type and hash set in the state based on which API call succeeds.
108 changes: 108 additions & 0 deletions ENHANCED_TRANSACTION_VIEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Feature Specification: Enhanced Transaction Views

## 1. Objective

To improve the interconnectivity of the explorer by making all addresses displayed within the existing HyperEVM and HyperCore transaction detail views clickable. These links will navigate the user to the new "Account Details" page for the respective address.

## 2. Scope of Changes

This task involves modifying the following existing components to change how addresses are rendered:

- `app/components/TransactionInfo/TransactionInfo.tsx` (for HyperEVM)
- `app/components/HyperCoreTransactionInfo.tsx` (for HyperCore)

## 3. Functional Requirements

The core requirement is to replace static text displays of addresses with interactive links.

### 3.1. HyperEVM Transaction View (`TransactionInfo.tsx`)

- **Target Fields:**
- `From`: The sender of the transaction.
- `To`: The recipient of the transaction or the contract address.
- **Implementation Details:**
- Import the `Link` component from `next/link`.
- In the JSX, wrap the address values for the 'From' and 'To' fields in a `<Link>` component.
- The `href` attribute of the link should be dynamically generated.
- **Example:**

```jsx
// Before
<code>{transaction.from}</code>

// After
<Link href={`/address/${transaction.from}`} passHref>
<code className="clickable-address">{transaction.from}</code>
</Link>
```

- A new CSS class, `clickable-address`, should be added to provide visual feedback (e.g., pointer cursor, hover effect). This can be added to `globals.css`.

### 3.2. HyperCore Transaction View (`HyperCoreTransactionInfo.tsx`)

- **Target Field:**
- `User`: The user who initiated the L1 action.
- **Implementation Details:**
- The `User` field is already a `<button>` to open the balance modal. We will enhance this to also act as a navigation link.
- The best approach is to wrap the existing button in a `<Link>` component. This preserves the existing functionality while adding navigation.
- Import the `Link` component from `next/link`.
- Wrap the `<button>` element for the 'User' field.
- **Example:**

```jsx
// Before
<button
type="button"
className="info-value hash-value clickable-address"
onClick={() => setShowBalanceModal(true)}
// ...
>
{txDetails.user}
</button>

// After
<Link href={`/address/${txDetails.user}`} passHref>
<a className="info-value hash-value clickable-address" title="View account details">
{txDetails.user}
</a>
</Link>
{/* The modal can be triggered by a separate icon/button next to the address if needed,
or we can reconsider the UX. For now, linking is the priority.
A simple solution is to have the link navigate, and the modal can be accessed from the account page.
Let's remove the onClick for the modal from this component to simplify.
The Account Details page will now be the primary way to view balances.
*/}
```

- **Refinement:** To simplify the user experience, the `onClick` handler that opens the `AccountBalanceModal` should be **removed** from this component. The primary way to view an account's balance will now be by navigating to their Account Details page, which contains a more permanent and detailed view of their balances. The `AccountBalanceModal` can still be used elsewhere if needed, but its direct trigger from this component will be deprecated in favor of the new, more comprehensive page.

## 4. CSS Styling

Add the following styles to `app/globals.css` to ensure a consistent look and feel for all clickable links.

```css
.clickable-address {
color: #3b82f6; /* Or your theme's link color */
text-decoration: none;
cursor: pointer;
transition: text-decoration 0.2s ease-in-out;
}

.clickable-address:hover {
text-decoration: underline;
}
```

## 5. Implementation Steps

1. **Modify `TransactionInfo.tsx`:**
- Locate the `<tr>` elements for "From" and "To".
- Import `Link` from `next/link`.
- Wrap the address `<code>` tags with the `<Link>` component as described above.
2. **Modify `HyperCoreTransactionInfo.tsx`:**
- Locate the `<button>` element for "User".
- Import `Link` from `next/link`.
- Replace the button with a `<Link>` component that wraps an `<a>` tag containing the user's address.
- Remove the `onClick` handler and the `showBalanceModal` state management from this component. The modal is no longer needed here.
3. **Update CSS:**
- Add the `.clickable-address` styles to `app/globals.css`.
70 changes: 70 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# GEMINI.md

## Project Overview

This is a Next.js application called "CoreWriter Trace" that allows users to decode and analyze Hyperliquid CoreWriter actions from transaction logs. The application is built with React 19, Next.js 15, and TypeScript, and it is designed for optimal performance and developer experience. It supports multiple networks (Mainnet, Testnet, and custom RPC endpoints) and provides a responsive user interface for both desktop and mobile devices.

The application is configured for static export, which means it can be deployed to any static hosting service. It uses `ethers` to interact with the blockchain and `@nktkas/hyperliquid` for HyperCore transactions.

## Building and Running

### Prerequisites

- **Node.js**: 18.18.0 or higher
- **pnpm**: 9.15.0 or higher

### Installation

```bash
pnpm install
```

### Development

```bash
pnpm dev
```

The application will be available at `http://localhost:3000`.

### Building for Production

```bash
pnpm build
```

This will create a static export of the application in the `out/` directory.

### Running in Production

```bash
pnpm start
```

This will serve the static files from the `out/` directory.

## Development Conventions

### Scripts

The following scripts are available in `package.json`:

- `pnpm dev`: Start the development server.
- `pnpm build`: Build the application for production.
- `pnpm start`: Start the production server.
- `pnpm lint`: Run ESLint to check for code quality and style issues.
- `pnpm test`: Run tests using Jest.
- `pnpm clean`: Clean build artifacts and cache.
- `pnpm type-check`: Run the TypeScript compiler to check for type errors.

### Code Style

The project uses ESLint with the `eslint-config-next` configuration to enforce a consistent code style.

### Testing

The project uses Jest for testing. The test files are located in the `__tests__` directory.

### Contribution Guidelines

The `README.md` file provides contribution guidelines, which include forking the repository, creating a feature branch, and submitting a pull request.
60 changes: 60 additions & 0 deletions IMPROVEMENT_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# CoreWriter Trace - Improvement Plan (Updated)

## 1. Introduction

The goal is to evolve the CoreWriter Trace tool from a transaction-specific decoder into a more fully-fledged block explorer for the Hyperliquid ecosystem. This plan outlines the proposed new features and improvements, keeping in mind the unique dual-chain architecture (HyperEVM and HyperCore).

The core principle is to enhance functionality while maintaining the existing design and user experience, with a primary focus on introducing account-centric exploration capabilities.

## 2. Guiding Principles

- **Dual-Chain First:** Every new feature must consider both HyperEVM (L2) and HyperCore (L1). Account views, in particular, should present a unified summary across both chains.
- **Maintain Simplicity:** The UI should remain clean and intuitive. New features should be integrated in a way that doesn't clutter the existing interface.
- **Component-Based:** New features should be built as modular React components to ensure maintainability and reusability.
- **Inspired by Standards:** We will draw inspiration from established explorers like Blockscout for data presentation and feature sets, but adapt them specifically for Hyperliquid's architecture.

## 3. High-Level Feature Proposals

### 3.1. Unified Search & Navigation

The current tabbed input fields on the homepage will be replaced by a single, intelligent search bar.

- **Smart Input Detection:** The search bar will automatically detect the input type:
- Transaction Hash (HyperEVM or HyperCore)
- Account Address
- **Routing:** Based on the input type, the user will be navigated to the appropriate page (Transaction View or the new Account View).
- **Note on TX Hashes:** For a given transaction hash, only one of the HyperEVM or HyperCore APIs will return a result. The search logic should query both and route to the one that responds successfully.

### 3.2. Account Details Page (High Priority)

This is the core new feature. A new page will be created that provides a comprehensive overview of a specific user account. The page will feature a two-pane layout to present information from both chains side-by-side.

**URL Structure:** `/address/{account_address}`

**Layout:**

- **Left Pane: HyperEVM (L2)**
- **Balance:** Display the account's **HYPE** balance.
- **Transaction History:** A paginated list of all HyperEVM transactions involving this account. Transactions containing CoreWriter actions will be visually indicated, similar to the current explorer. Each transaction will link to its respective transaction detail page.
- **Right Pane: HyperCore (L1)**
- **Account State:** Display the user's current state on the L1, including:
- Spot Balances
- Perpetual Positions & Margin Summary
- Withdrawable funds
- (This will reuse and expand upon the existing `AccountBalanceModal` component).
- **Transaction History:** A paginated list of the user's L1 actions (e.g., deposits, withdrawals, liquidations, etc.). Each transaction will link to its HyperCore transaction detail page.

### 3.3. Enhanced Transaction Views

The existing transaction detail pages will be updated to improve interconnectivity within the explorer.

- **Clickable Addresses:** All addresses displayed on the HyperEVM and HyperCore transaction views (e.g., 'From', 'To', 'User') will be converted into links that navigate to the new Account Details Page for that address.

## 4. Implementation Notes

- **Prioritization:** The **Account Details Page** is the highest priority and will be detailed first.
- **Data Fetching (HyperEVM):** The method for fetching an account's transaction history on HyperEVM is not yet defined. The AI implementing this feature will need to research available RPC methods or indexing services.
- **Data Fetching (HyperCore):** The `@nktkas/hyperliquid` library will be used to fetch the L1 action history for an account.
- **Pagination:** Transaction history lists will use a "Load More" button, showing 25 items per page.
- **UI/Display:** No specific UI preferences have been stated. The implementation will follow the existing design language and conventions from standard block explorers.
- **Block Details Page:** This feature is out of scope for now and will be considered in the future.
Loading