|
| 1 | +# Token-API NFT React Components |
| 2 | + |
| 3 | +A super-lightweight set of **five** React components that surface common NFT data from the [Token API](https://token-api.thegraph.com/). |
| 4 | +Each component lives in a single file, has **zero runtime dependencies** (besides `react`) and can be copy-pasted straight into any React project. |
| 5 | + |
| 6 | +## Components |
| 7 | + |
| 8 | +| Component | Description | API Docs | |
| 9 | +|-----------|-------------|----------| |
| 10 | +| `ActivityFeed.jsx` | Latest mints / transfers / burns for a collection | [API →](https://token-api.service.pinax.network/#tag/evm/GET/nft/activities/evm) | |
| 11 | +| `CollectionStatsBadge.jsx` | High-level stats for a collection (supply, owners, transfers) | [API →](https://token-api.service.pinax.network/#tag/evm/GET/nft/collections/evm/%7Bcontract%7D) | |
| 12 | +| `NFTTopHolders.jsx` | Top addresses ranked by number of tokens held | [API →](https://token-api.service.pinax.network/#tag/evm/GET/nft/holders/evm/%7Bcontract%7D) | |
| 13 | +| `NFTWalletHoldings.jsx` | All NFTs owned by a wallet | [API →](https://token-api.service.pinax.network/#tag/evm/GET/nft/ownerships/evm/%7Baddress%7D) | |
| 14 | +| `RecentMintsTable.jsx` | Recent mint events for a collection | [API →](https://token-api.service.pinax.network/#tag/evm/GET/nft/activities/evm) | |
| 15 | + |
| 16 | +## Quick Start (2 minutes) |
| 17 | + |
| 18 | +1. **Get your JWT Token** |
| 19 | + - Visit [The Graph Marketplace](https://marketplace.thegraph.com/) |
| 20 | + - Get your JWT token for authenticated API access |
| 21 | + - Higher rate limits than public endpoints |
| 22 | + |
| 23 | +2. **Create `.env` file in your project root:** |
| 24 | + ```bash |
| 25 | + # .env |
| 26 | + VITE_TOKEN_API_JWT_KEY=your_jwt_token_here # For Vite |
| 27 | + # or |
| 28 | + REACT_APP_TOKEN_API_JWT_KEY=your_jwt_token_here # For Create React App |
| 29 | + ``` |
| 30 | + |
| 31 | +3. **Copy & Use Components** |
| 32 | + ```jsx |
| 33 | + // Example: App.jsx |
| 34 | + import ActivityFeed from "./components/ActivityFeed"; |
| 35 | + import CollectionStatsBadge from "./components/CollectionStatsBadge"; |
| 36 | + |
| 37 | + export default function App() { |
| 38 | + return ( |
| 39 | + <div> |
| 40 | + <CollectionStatsBadge /> |
| 41 | + <ActivityFeed /> |
| 42 | + </div> |
| 43 | + ); |
| 44 | + } |
| 45 | + ``` |
| 46 | + |
| 47 | +## Example Contract Addresses |
| 48 | + |
| 49 | +Try these example addresses to see the components in action: |
| 50 | + |
| 51 | +- **NFT Collection:** `0xbd3531da5cf5857e7cfaa92426877b022e612cf8` (Pudgy Penguins) |
| 52 | +- **Wallet Address:** `0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045` (vitalik.eth) |
| 53 | + |
| 54 | +## Features |
| 55 | + |
| 56 | +- 🔒 Secure authentication with JWT |
| 57 | +- 🚀 Zero dependencies (just React) |
| 58 | +- 📱 Responsive & mobile-friendly |
| 59 | +- 🎨 Clean, minimal styling |
| 60 | +- 🔗 Direct links to API docs |
| 61 | +- ⚡ Instant copy & paste setup |
| 62 | + |
| 63 | +## Component Features |
| 64 | + |
| 65 | +Each component includes: |
| 66 | +- Pre-filled example addresses |
| 67 | +- Loading & error states |
| 68 | +- Network selection (mainnet active, others coming soon) |
| 69 | +- Direct links to API documentation |
| 70 | +- Clean, minimal styling that's easy to customize |
| 71 | + |
| 72 | +## Environment Setup |
| 73 | + |
| 74 | +The components support both Vite and Create React App: |
| 75 | + |
| 76 | +```bash |
| 77 | +# For Vite projects |
| 78 | +VITE_TOKEN_API_JWT_KEY=your_jwt_token_here |
| 79 | + |
| 80 | +# For Create React App projects |
| 81 | +REACT_APP_TOKEN_API_JWT_KEY=your_jwt_token_here |
| 82 | +``` |
| 83 | + |
| 84 | +## API Documentation |
| 85 | + |
| 86 | +Each component links directly to its API documentation. Click the "API Docs ↗" link in any component's header to view the full API details. |
0 commit comments