Skip to main content
Transaction history provides a complete record of all your swaps and transfers performed through OneBalance. You can view transaction details, check status, and access blockchain explorers for verification.

How it works

The transaction history system:
  1. Fetches all transactions associated with your account
  2. Displays both swap and transfer operations
  3. Shows real-time transaction status
  4. Provides links to blockchain explorers
  5. Supports pagination for large transaction sets
All transactions are tracked from initiation through completion or failure.

Implementation

Transaction history page

The history page uses the TransactionHistory component:
app/(trading)/history/page.tsx

Fetching transaction history

Use the useTransactionHistory hook to load transactions:
lib/hooks/useTransactionHistory.ts

API integration

The transactions API supports pagination:
lib/api/transactions.ts

Transaction types

Two types of transactions are displayed:

Swaps

Token exchanges across or within chains:
components/TransactionHistory.tsx

Transfers

Cross-chain token transfers to other addresses:
components/TransactionHistory.tsx

Transaction status

Each transaction has one of several status values:
Transaction successfully executed and confirmed on all chains.
Transaction submitted and awaiting confirmation.
Transaction failed during execution.
Transaction failed and funds were returned.

Status indicators

Status is displayed with color-coded badges:
components/TransactionHistory.tsx

Transaction details

Each transaction card is expandable to show detailed information:
components/TransactionHistory.tsx

Amount formatting

Amounts are formatted based on their magnitude:
components/TransactionHistory.tsx

Chain operations

Transactions include details about operations on each chain:
lib/types/quote.ts
Each operation includes a link to the blockchain explorer:
components/TransactionHistory.tsx

Pagination

Load more transactions as the user scrolls:
lib/hooks/useTransactionHistory.ts

Load more button

components/TransactionHistory.tsx

Refresh functionality

Users can manually refresh their transaction history:
components/TransactionHistory.tsx

Empty states

Handle cases where the user has no transactions:
components/TransactionHistory.tsx

Timestamp formatting

Dates are formatted using date-fns:

Best practices

1

Load on authentication

Automatically fetch transaction history when the user connects their wallet.
2

Implement pagination

Load transactions in batches (10-20 at a time) to improve performance.
3

Provide explorer links

Always include links to blockchain explorers so users can verify transactions independently.
4

Show clear status indicators

Use color coding and icons to make transaction status immediately visible.
5

Handle errors gracefully

Display helpful error messages when transaction history fails to load.
Transaction history is stored by OneBalance and persists across sessions. Users can view their complete transaction history anytime they connect their wallet.

API reference

For more details on transaction-related endpoints: