A simple HTML5/CSS/JavaScript application for visualizing ArDrive token state data, including balances, vaults, and contract settings.
Also provides user interfaces for transferring tokens via interactions signed by Wander Wallet.
- Multiple Data Sources: Choose between example snapshot, live Cache API, or custom sources
- Balance Explorer: View, search, filter, and sort token balances by address or amount
- Vault Viewer: Explore locked tokens with detailed information about lock periods
- Modular Data Architecture: Clean interface-based design for easy data source switching
- Column Sorting: Click column headers to sort data with visual indicators
- Responsive Design: Works on desktop and mobile devices
ardrive_token_app/
├── index.html # Main HTML file
├── styles.css # Stylesheet
├── app.js # Main application logic
├── data-source.js # DataSource interface
├── local-file-source.js # Local file implementation
├── api-source.js # API endpoint implementation
└── ardrive_token_state.json # Token state data
The DataSource class in data-source.js provides a clean interface for retrieving token state data:
export class DataSource {
async fetchState() { /* ... */ }
async getContractId() { /* ... */ }
async getBalances() { /* ... */ }
async getVaults() { /* ... */ }
async getTokenName() { /* ... */ }
async getTokenTicker() { /* ... */ }
}- LocalFileSource: Loads data from a local JSON file (included example)
- ApiSource: Fetches data from HTTP endpoints (arns.app Cache API supported)
- Custom sources: Extensible architecture for future implementations
Since the app uses ES6 modules, you need to serve it via HTTP:
# Using Python 3
python3 -m http.server 8000
# Using Node.js (http-server)
npx http-server
# Using PHP
php -S localhost:8000Then open http://localhost:8000 in your browser.
The application supports multiple data sources:
Uses the included ardrive_token_state.json file. Good for quick testing and offline usage.
Fetches live token state from the arns.app cache API:
- Default endpoint:
https://api.arns.app/v1/contract/{contractId}?validity=true - Default contract:
-8A6RexFkpfWwuyVO98wzSFZh0d6VJuI-buTJvlwOJQ - You can enter a different contract address to view other SmartWeave contracts
Placeholder for computing state from transaction history.
To load data:
- The app automatically loads data from the Cache API on startup
- You can change the data source and click "Load Data" to reload
- If using Cache API, you can modify the contract address before loading
To add a new data source implementation:
- Create a new class that extends
DataSource - Implement the
fetchState()method - Add the option to the data source selector in
index.html - Update
handleLoadData()inapp.jsto instantiate your source
The application expects JSON data in the following format:
{
"contractTxId": "contract-id-here",
"state": {
"balances": {
"address1": 100,
"address2": 200
},
"vault": {
"address1": [
{
"balance": 1000,
"start": 12345,
"end": 67890
}
]
},
"name": "Token Name",
"ticker": "TKN"
}
}- Export data to CSV
- Advanced filtering options
- Vault timeline visualization
- Balance distribution charts
- Historical state comparison
- Address detail view
- Pagination for large datasets
MIT