mirror of
https://github.com/luxfi/docs.git
synced 2026-09-24 00:25:32 +00:00
fix(ci): use luxfi/lux-docs image name to avoid GHCR permission issue
This commit is contained in:
@@ -16,7 +16,7 @@ concurrency:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
IMAGE_NAME: luxfi/lux-docs
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
|
||||
@@ -1,19 +1,81 @@
|
||||
---
|
||||
title: API Reference
|
||||
description: REST API endpoints
|
||||
description: Lux Cloud REST API endpoints
|
||||
icon: FileCode
|
||||
---
|
||||
|
||||
All Lux Cloud API requests require authentication via Bearer token.
|
||||
|
||||
## Authentication
|
||||
|
||||
All requests require an API key via Bearer token.
|
||||
```bash
|
||||
curl -H "Authorization: Bearer YOUR_API_KEY" \
|
||||
https://api.lux.cloud/v1/...
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| POST | `/v1/rpc/{chain}` | JSON-RPC proxy |
|
||||
| GET | `/v1/tokens/balances` | Token balances |
|
||||
| GET | `/v1/nft/owner` | NFT ownership |
|
||||
| POST | `/v1/webhooks` | Create webhook |
|
||||
| GET | `/v1/health` | Health check |
|
||||
| POST | `/v1/rpc/{chain}` | JSON-RPC proxy to any chain |
|
||||
| GET | `/v1/tokens/balances` | ERC-20 token balances for an address |
|
||||
| GET | `/v1/tokens/transfers` | Token transfer history |
|
||||
| GET | `/v1/nft/owner` | NFTs owned by an address |
|
||||
| GET | `/v1/nft/collection` | Collection metadata |
|
||||
| GET | `/v1/nft/token` | Single token metadata |
|
||||
| POST | `/v1/webhooks` | Create a webhook subscription |
|
||||
| GET | `/v1/webhooks` | List active webhooks |
|
||||
| DELETE | `/v1/webhooks/:id` | Delete a webhook |
|
||||
| GET | `/v1/health` | Health check (no auth required) |
|
||||
|
||||
## Token Balances
|
||||
|
||||
```bash
|
||||
curl "https://api.lux.cloud/v1/tokens/balances?address=0x...&chain=lux" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"address": "0x...",
|
||||
"chain": "lux",
|
||||
"nativeBalance": "1500000000000000000",
|
||||
"tokens": [
|
||||
{
|
||||
"contract": "0xToken...",
|
||||
"symbol": "USDC",
|
||||
"decimals": 6,
|
||||
"balance": "1000000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Error Responses
|
||||
|
||||
| Code | Description |
|
||||
|------|-------------|
|
||||
| 401 | Missing or invalid API key |
|
||||
| 429 | Rate limit exceeded |
|
||||
| 500 | Internal server error |
|
||||
| 502 | Upstream node unavailable |
|
||||
|
||||
## Rate Limits
|
||||
|
||||
Rate limits are enforced per API key. Responses include rate limit headers:
|
||||
|
||||
```
|
||||
X-RateLimit-Limit: 600
|
||||
X-RateLimit-Remaining: 599
|
||||
X-RateLimit-Reset: 1711094400
|
||||
```
|
||||
|
||||
## Pagination
|
||||
|
||||
List endpoints support cursor-based pagination:
|
||||
|
||||
```bash
|
||||
curl "https://api.lux.cloud/v1/tokens/transfers?address=0x...&page=2&limit=50"
|
||||
```
|
||||
|
||||
@@ -1,15 +1,61 @@
|
||||
---
|
||||
title: Configuration
|
||||
description: Environment variables
|
||||
description: Environment variables for Lux Cloud
|
||||
icon: Settings
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
All Lux Cloud services are configured via environment variables.
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `API_KEY_SALT` | Salt for API key hashing |
|
||||
| `DATABASE_URL` | PostgreSQL connection |
|
||||
| `REDIS_URL` | Redis for WebSocket state |
|
||||
| `RPC_ENDPOINTS` | Upstream node endpoints |
|
||||
| `NEXT_PUBLIC_BRAND` | Brand (lux/hanzo/zoo/bootnode) |
|
||||
## Core Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `API_KEY_SALT` | Salt for API key hashing (must be secret) | -- |
|
||||
| `DATABASE_URL` | PostgreSQL connection string | -- |
|
||||
| `REDIS_URL` | Redis/Valkey for WebSocket state and caching | -- |
|
||||
| `RPC_ENDPOINTS` | Upstream luxd node endpoints (comma-separated) | -- |
|
||||
| `PORT` | API listen port | `3000` |
|
||||
|
||||
## Branding Variables
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `NEXT_PUBLIC_BRAND` | Brand identifier | `lux` |
|
||||
| `NEXT_PUBLIC_BRAND_NAME` | Display name | `Lux Cloud` |
|
||||
| `NEXT_PUBLIC_BRAND_URL` | Brand website | `https://lux.cloud` |
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `RATE_LIMIT_RPC` | RPC requests per minute | `600` |
|
||||
| `RATE_LIMIT_API` | REST API requests per minute | `300` |
|
||||
| `RATE_LIMIT_WS` | WebSocket messages per minute | `120` |
|
||||
|
||||
## RPC Proxy
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `RPC_TIMEOUT` | Request timeout (ms) | `30000` |
|
||||
| `RPC_RETRY_COUNT` | Retries on failure | `3` |
|
||||
| `RPC_HEALTH_INTERVAL` | Health check interval (ms) | `10000` |
|
||||
|
||||
## Indexer
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------|-------------|---------|
|
||||
| `INDEX_INTERVAL` | Block polling interval (ms) | `2000` |
|
||||
| `INDEX_BATCH_SIZE` | Blocks per batch | `100` |
|
||||
| `INDEX_START_BLOCK` | Starting block number | `0` |
|
||||
|
||||
## Example Configuration
|
||||
|
||||
```bash
|
||||
# Production
|
||||
API_KEY_SALT=<random-32-bytes>
|
||||
DATABASE_URL=postgres://cloud:pass@postgres:5432/cloud
|
||||
REDIS_URL=redis://valkey:6379
|
||||
RPC_ENDPOINTS=http://luxd-0:9630,http://luxd-1:9630
|
||||
NEXT_PUBLIC_BRAND=lux
|
||||
PORT=3000
|
||||
```
|
||||
|
||||
@@ -4,10 +4,64 @@ description: Deploy Lux Cloud infrastructure
|
||||
icon: Server
|
||||
---
|
||||
|
||||
Lux Cloud runs on Kubernetes with Traefik as the ingress controller.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
Traefik LB → API Gateway → RPC Proxy → Lux Nodes
|
||||
→ Token Indexer → PostgreSQL
|
||||
→ WebSocket Hub → Redis
|
||||
Traefik LB (LoadBalancer)
|
||||
-> API Gateway (rate limiting, auth)
|
||||
-> RPC Proxy (multi-chain JSON-RPC)
|
||||
-> Lux Nodes (luxd fleet)
|
||||
-> Token Indexer
|
||||
-> PostgreSQL (balances, transfers)
|
||||
-> WebSocket Hub
|
||||
-> Redis/Valkey (pub/sub state)
|
||||
-> NFT Indexer
|
||||
-> PostgreSQL (metadata, ownership)
|
||||
```
|
||||
|
||||
## Kubernetes Resources
|
||||
|
||||
| Resource | Type | Replicas |
|
||||
|----------|------|----------|
|
||||
| API Gateway | Deployment | 3 |
|
||||
| RPC Proxy | Deployment | 3 |
|
||||
| Token Indexer | StatefulSet | 1 |
|
||||
| NFT Indexer | StatefulSet | 1 |
|
||||
| WebSocket Hub | Deployment | 2 |
|
||||
| PostgreSQL | StatefulSet | 1 (with replica) |
|
||||
| Redis/Valkey | StatefulSet | 1 |
|
||||
|
||||
## Deploy
|
||||
|
||||
```bash
|
||||
kubectl kustomize infra/k8s/cloud/ | kubectl apply -f -
|
||||
```
|
||||
|
||||
## Image Tags
|
||||
|
||||
| Service | Image |
|
||||
|---------|-------|
|
||||
| API Gateway | `ghcr.io/luxfi/cloud-gateway:latest` |
|
||||
| RPC Proxy | `ghcr.io/luxfi/cloud-rpc:latest` |
|
||||
| Indexer | `ghcr.io/luxfi/cloud-indexer:latest` |
|
||||
|
||||
All images are built for `linux/amd64` via CI/CD.
|
||||
|
||||
## Health Checks
|
||||
|
||||
```bash
|
||||
# API health
|
||||
curl https://api.lux.cloud/v1/health
|
||||
|
||||
# Node health (proxied)
|
||||
curl https://api.lux.cloud/v1/rpc/lux \
|
||||
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
|
||||
```
|
||||
|
||||
## Monitoring
|
||||
|
||||
- Prometheus metrics at `/metrics` on each service
|
||||
- Grafana dashboards for RPC latency, error rates, and throughput
|
||||
- Alerting on node health and indexer lag
|
||||
|
||||
@@ -4,15 +4,78 @@ description: Deploy Lux Cloud
|
||||
icon: Download
|
||||
---
|
||||
|
||||
## Docker
|
||||
Lux Cloud can be deployed via Docker Compose for development or Kubernetes for production.
|
||||
|
||||
## Docker Compose (Development)
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/luxfi/cloud:latest
|
||||
git clone https://github.com/luxfi/cloud
|
||||
cd cloud
|
||||
|
||||
# Configure
|
||||
cp .env.example .env
|
||||
# Edit .env with your settings
|
||||
|
||||
# Start all services
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Kubernetes
|
||||
This starts the API gateway, RPC proxy, indexer, PostgreSQL, and Redis.
|
||||
|
||||
## Docker (Standalone)
|
||||
|
||||
```bash
|
||||
helm install cloud luxfi/cloud --namespace cloud
|
||||
docker pull ghcr.io/luxfi/cloud:latest
|
||||
|
||||
docker run -d \
|
||||
-p 3000:3000 \
|
||||
-e DATABASE_URL=postgres://... \
|
||||
-e REDIS_URL=redis://... \
|
||||
-e RPC_ENDPOINTS=http://luxd:9630 \
|
||||
-e API_KEY_SALT=your-secret-salt \
|
||||
ghcr.io/luxfi/cloud:latest
|
||||
```
|
||||
|
||||
## Kubernetes (Production)
|
||||
|
||||
```bash
|
||||
# Using Helm
|
||||
helm install cloud luxfi/cloud \
|
||||
--namespace cloud \
|
||||
--create-namespace \
|
||||
--set database.url=postgres://... \
|
||||
--set redis.url=redis://... \
|
||||
--set rpc.endpoints=http://luxd:9630
|
||||
|
||||
# Using Kustomize
|
||||
kubectl kustomize infra/k8s/cloud/ | kubectl apply -f -
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Service | Version | Purpose |
|
||||
|---------|---------|---------|
|
||||
| PostgreSQL | 15+ | Token and NFT indexer storage |
|
||||
| Redis/Valkey | 7+ | WebSocket state, caching, rate limiting |
|
||||
| luxd | latest | Blockchain node(s) for RPC |
|
||||
|
||||
## Verify Installation
|
||||
|
||||
```bash
|
||||
# Health check
|
||||
curl http://localhost:3000/v1/health
|
||||
|
||||
# Test RPC
|
||||
curl -X POST http://localhost:3000/v1/rpc/lux \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
|
||||
```
|
||||
|
||||
## Production Checklist
|
||||
|
||||
- TLS certificates on all endpoints
|
||||
- API key salt configured (never use the default)
|
||||
- Rate limiting enabled
|
||||
- Database backups configured
|
||||
- Monitoring and alerting set up
|
||||
- Images pinned to specific tags (not `latest`)
|
||||
|
||||
@@ -4,14 +4,71 @@ description: NFT collections, ownership, and media
|
||||
icon: Image
|
||||
---
|
||||
|
||||
## Get NFTs
|
||||
The NFT API provides endpoints for querying NFT ownership, collection metadata, and token media across all Lux chains.
|
||||
|
||||
## Get NFTs by Owner
|
||||
|
||||
```bash
|
||||
curl https://api.lux.cloud/v1/nft/owner?address=0x...
|
||||
curl "https://api.lux.cloud/v1/nft/owner?address=0x...&chain=lux" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Collection Data
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"nfts": [
|
||||
{
|
||||
"contract": "0xContractAddress...",
|
||||
"tokenId": "42",
|
||||
"name": "My NFT #42",
|
||||
"image": "https://ipfs.io/ipfs/Qm...",
|
||||
"standard": "ERC-721",
|
||||
"chain": "lux"
|
||||
}
|
||||
],
|
||||
"totalCount": 15,
|
||||
"page": 1
|
||||
}
|
||||
```
|
||||
|
||||
## Get Collection Data
|
||||
|
||||
```bash
|
||||
curl https://api.lux.cloud/v1/nft/collection?contract=0x...
|
||||
curl "https://api.lux.cloud/v1/nft/collection?contract=0x...&chain=lux" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Get Token Metadata
|
||||
|
||||
```bash
|
||||
curl "https://api.lux.cloud/v1/nft/token?contract=0x...&tokenId=42" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| GET | `/v1/nft/owner` | NFTs owned by an address |
|
||||
| GET | `/v1/nft/collection` | Collection metadata and stats |
|
||||
| GET | `/v1/nft/token` | Individual token metadata |
|
||||
| GET | `/v1/nft/transfers` | Recent transfer history |
|
||||
|
||||
## Supported Standards
|
||||
|
||||
| Standard | Features |
|
||||
|----------|----------|
|
||||
| ERC-721 | Ownership, metadata, media, transfer history |
|
||||
| ERC-1155 | Multi-token balances, batch queries |
|
||||
|
||||
## Query Parameters
|
||||
|
||||
| Parameter | Description |
|
||||
|-----------|-------------|
|
||||
| `address` | Wallet address to query |
|
||||
| `contract` | NFT contract address |
|
||||
| `tokenId` | Specific token ID |
|
||||
| `chain` | Chain to query (lux, zoo, hanzo, spc, pars) |
|
||||
| `page` | Page number (default: 1) |
|
||||
| `limit` | Results per page (default: 20, max: 100) |
|
||||
|
||||
@@ -1,14 +1,78 @@
|
||||
---
|
||||
title: Quick Start
|
||||
description: Your first API call
|
||||
description: Your first Lux Cloud API call
|
||||
icon: Zap
|
||||
---
|
||||
|
||||
## Get an API Key
|
||||
|
||||
Sign up at [lux.cloud](https://lux.cloud) to get an API key.
|
||||
|
||||
## Get Block Number
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.lux.cloud/v1/rpc/lux \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer YOUR_API_KEY' \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
|
||||
```
|
||||
|
||||
## Get Balance
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.lux.cloud/v1/rpc/lux \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-d '{
|
||||
"jsonrpc":"2.0",
|
||||
"method":"eth_getBalance",
|
||||
"params":["0x9011E888251AB053B7bD1cdB598Db4f9DEd94714", "latest"],
|
||||
"id":1
|
||||
}'
|
||||
```
|
||||
|
||||
## Get Token Balances
|
||||
|
||||
```bash
|
||||
curl "https://api.lux.cloud/v1/tokens/balances?address=0x9011E888..." \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Subscribe to New Blocks (WebSocket)
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket("wss://api.lux.cloud/v1/ws/lux");
|
||||
|
||||
ws.onopen = () => {
|
||||
ws.send(JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
method: "eth_subscribe",
|
||||
params: ["newHeads"],
|
||||
id: 1,
|
||||
}));
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log("New block:", data.params?.result?.number);
|
||||
};
|
||||
```
|
||||
|
||||
## Supported Chains
|
||||
|
||||
| Chain | RPC Path |
|
||||
|-------|----------|
|
||||
| Lux C-Chain | `/v1/rpc/lux` |
|
||||
| Zoo | `/v1/rpc/zoo` |
|
||||
| Hanzo | `/v1/rpc/hanzo` |
|
||||
| SPC | `/v1/rpc/spc` |
|
||||
| Pars | `/v1/rpc/pars` |
|
||||
| Ethereum | `/v1/rpc/ethereum` |
|
||||
|
||||
## Rate Limits
|
||||
|
||||
| Plan | Requests/sec | WebSocket connections |
|
||||
|------|-------------|----------------------|
|
||||
| Free | 10 | 2 |
|
||||
| Pro | 100 | 10 |
|
||||
| Enterprise | Unlimited | Unlimited |
|
||||
|
||||
@@ -4,14 +4,71 @@ description: Multi-chain JSON-RPC proxy
|
||||
icon: Server
|
||||
---
|
||||
|
||||
The RPC proxy provides a unified endpoint for all Lux chains with load balancing, automatic failover, and rate limiting.
|
||||
|
||||
## Endpoints
|
||||
|
||||
All chains are accessible via:
|
||||
All chains are accessible via a single base URL:
|
||||
|
||||
```
|
||||
https://api.lux.cloud/v1/rpc/{chain}
|
||||
```
|
||||
|
||||
## Supported Chains
|
||||
|
||||
| Chain | Path | Chain ID |
|
||||
|-------|------|----------|
|
||||
| Lux C-Chain | `/v1/rpc/lux` | 96369 |
|
||||
| Zoo | `/v1/rpc/zoo` | 200200 |
|
||||
| Hanzo | `/v1/rpc/hanzo` | 36963 |
|
||||
| SPC | `/v1/rpc/spc` | 36911 |
|
||||
| Pars | `/v1/rpc/pars` | 494949 |
|
||||
| Ethereum | `/v1/rpc/ethereum` | 1 |
|
||||
|
||||
## Example
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.lux.cloud/v1/rpc/lux \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-d '{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "eth_blockNumber",
|
||||
"params": [],
|
||||
"id": 1
|
||||
}'
|
||||
```
|
||||
|
||||
## Supported Methods
|
||||
|
||||
All standard Ethereum JSON-RPC methods are supported:
|
||||
|
||||
| Category | Methods |
|
||||
|----------|---------|
|
||||
| Chain state | `eth_blockNumber`, `eth_getBalance`, `eth_getCode` |
|
||||
| Transactions | `eth_sendRawTransaction`, `eth_getTransactionReceipt` |
|
||||
| Calls | `eth_call`, `eth_estimateGas` |
|
||||
| Logs | `eth_getLogs` |
|
||||
| Subscriptions | `eth_subscribe` (via WebSocket only) |
|
||||
|
||||
## Load Balancing
|
||||
|
||||
Requests are distributed across healthy nodes with automatic failover.
|
||||
Requests are distributed across healthy upstream nodes using round-robin with health checks:
|
||||
|
||||
- Health checks every 10 seconds
|
||||
- Automatic failover on node failure
|
||||
- Sticky sessions for subscription connections
|
||||
- Request timeout: 30 seconds with 3 retries
|
||||
|
||||
## Batch Requests
|
||||
|
||||
Batch JSON-RPC is supported:
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.lux.cloud/v1/rpc/lux \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-d '[
|
||||
{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
|
||||
{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":2}
|
||||
]'
|
||||
```
|
||||
|
||||
@@ -4,16 +4,80 @@ description: ERC-20/721/1155 balances and metadata
|
||||
icon: Coins
|
||||
---
|
||||
|
||||
The Token API provides indexed access to token balances, transfer history, and metadata across all Lux chains.
|
||||
|
||||
## Get Balances
|
||||
|
||||
```bash
|
||||
curl https://api.lux.cloud/v1/tokens/balances?address=0x...
|
||||
curl "https://api.lux.cloud/v1/tokens/balances?address=0x...&chain=lux" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"address": "0x9011E888...",
|
||||
"chain": "lux",
|
||||
"nativeBalance": "1500000000000000000",
|
||||
"tokens": [
|
||||
{
|
||||
"contract": "0xUSDC...",
|
||||
"name": "USD Coin",
|
||||
"symbol": "USDC",
|
||||
"decimals": 6,
|
||||
"balance": "1000000000",
|
||||
"logo": "https://..."
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Get Transfer History
|
||||
|
||||
```bash
|
||||
curl "https://api.lux.cloud/v1/tokens/transfers?address=0x...&chain=lux&limit=20" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Supported Standards
|
||||
|
||||
| Standard | Features |
|
||||
|----------|----------|
|
||||
| ERC-20 | Balance, transfers, metadata |
|
||||
| ERC-721 | Ownership, metadata, media |
|
||||
| ERC-1155 | Multi-token balances |
|
||||
| ERC-20 | Balance, transfers, metadata (name, symbol, decimals) |
|
||||
| ERC-721 | Ownership, transfer history, metadata URI |
|
||||
| ERC-1155 | Multi-token balances, batch transfers |
|
||||
|
||||
## Query Parameters
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|-----------|-------------|---------|
|
||||
| `address` | Wallet address (required) | -- |
|
||||
| `chain` | Chain identifier | `lux` |
|
||||
| `contract` | Filter by token contract | all tokens |
|
||||
| `page` | Page number | 1 |
|
||||
| `limit` | Results per page | 20 |
|
||||
|
||||
## Token Metadata
|
||||
|
||||
The API automatically resolves token metadata from on-chain data:
|
||||
|
||||
| Field | Source |
|
||||
|-------|--------|
|
||||
| `name` | `ERC20.name()` |
|
||||
| `symbol` | `ERC20.symbol()` |
|
||||
| `decimals` | `ERC20.decimals()` |
|
||||
| `totalSupply` | `ERC20.totalSupply()` |
|
||||
| `logo` | Token list or IPFS metadata |
|
||||
|
||||
## Multi-Chain Support
|
||||
|
||||
Query balances across all Lux chains:
|
||||
|
||||
| Chain | Identifier |
|
||||
|-------|-----------|
|
||||
| Lux C-Chain | `lux` |
|
||||
| Zoo | `zoo` |
|
||||
| Hanzo | `hanzo` |
|
||||
| SPC | `spc` |
|
||||
| Pars | `pars` |
|
||||
|
||||
@@ -1,12 +1,76 @@
|
||||
---
|
||||
title: Webhooks
|
||||
description: Event-driven notifications
|
||||
description: Event-driven notifications for blockchain activity
|
||||
icon: Bell
|
||||
---
|
||||
|
||||
## Create Webhook
|
||||
Webhooks deliver real-time notifications when blockchain events occur. Configure a webhook URL to receive HTTP POST callbacks for transfers, contract events, and more.
|
||||
|
||||
## Create a Webhook
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.lux.cloud/v1/webhooks \
|
||||
-d '{"url": "https://example.com/hook", "events": ["transfer"]}'
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"url": "https://example.com/hook",
|
||||
"events": ["transfer", "contract_event"],
|
||||
"chain": "lux",
|
||||
"filters": {
|
||||
"address": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## Event Types
|
||||
|
||||
| Event | Description |
|
||||
|-------|-------------|
|
||||
| `transfer` | Native token transfer (LUX, ETH) |
|
||||
| `erc20_transfer` | ERC-20 token transfer |
|
||||
| `erc721_transfer` | NFT transfer |
|
||||
| `erc1155_transfer` | Multi-token transfer |
|
||||
| `contract_event` | Any contract event log |
|
||||
| `new_block` | New block produced |
|
||||
|
||||
## Webhook Payload
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "evt-abc123",
|
||||
"event": "transfer",
|
||||
"chain": "lux",
|
||||
"blockNumber": 12345,
|
||||
"txHash": "0xabc...",
|
||||
"from": "0x...",
|
||||
"to": "0x...",
|
||||
"value": "1000000000000000000",
|
||||
"timestamp": "2026-03-22T10:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
## Manage Webhooks
|
||||
|
||||
```bash
|
||||
# List webhooks
|
||||
curl https://api.lux.cloud/v1/webhooks \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
|
||||
# Delete a webhook
|
||||
curl -X DELETE https://api.lux.cloud/v1/webhooks/wh-abc123 \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
## Retry Policy
|
||||
|
||||
Failed deliveries are retried with exponential backoff:
|
||||
|
||||
| Attempt | Delay |
|
||||
|---------|-------|
|
||||
| 1 | Immediate |
|
||||
| 2 | 30 seconds |
|
||||
| 3 | 2 minutes |
|
||||
| 4 | 10 minutes |
|
||||
| 5 | 1 hour |
|
||||
|
||||
After 5 failures, the webhook is disabled. Re-enable it via the API.
|
||||
|
||||
@@ -4,14 +4,95 @@ description: Real-time blockchain subscriptions
|
||||
icon: Radio
|
||||
---
|
||||
|
||||
WebSocket connections provide real-time blockchain event streaming without polling.
|
||||
|
||||
## Connect
|
||||
|
||||
```javascript
|
||||
const ws = new WebSocket('wss://api.lux.cloud/v1/ws/lux');
|
||||
const ws = new WebSocket("wss://api.lux.cloud/v1/ws/lux");
|
||||
```
|
||||
|
||||
Replace `lux` with any supported chain: `zoo`, `hanzo`, `spc`, `pars`, `ethereum`.
|
||||
|
||||
## Subscribe to New Blocks
|
||||
|
||||
```javascript
|
||||
ws.onopen = () => {
|
||||
ws.send(JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
method: "eth_subscribe",
|
||||
params: ["newHeads"],
|
||||
id: 1,
|
||||
}));
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
const msg = JSON.parse(event.data);
|
||||
if (msg.params) {
|
||||
console.log("Block:", msg.params.result.number);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Subscribe to Logs
|
||||
|
||||
Filter events by address and topics:
|
||||
|
||||
```javascript
|
||||
ws.send(JSON.stringify({
|
||||
jsonrpc: '2.0',
|
||||
method: 'eth_subscribe',
|
||||
params: ['newHeads'],
|
||||
id: 1
|
||||
jsonrpc: "2.0",
|
||||
method: "eth_subscribe",
|
||||
params: [
|
||||
"logs",
|
||||
{
|
||||
address: "0xContractAddress...",
|
||||
topics: [
|
||||
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
|
||||
],
|
||||
},
|
||||
],
|
||||
id: 2,
|
||||
}));
|
||||
```
|
||||
|
||||
## Subscribe to Pending Transactions
|
||||
|
||||
```javascript
|
||||
ws.send(JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
method: "eth_subscribe",
|
||||
params: ["newPendingTransactions"],
|
||||
id: 3,
|
||||
}));
|
||||
```
|
||||
|
||||
## Unsubscribe
|
||||
|
||||
```javascript
|
||||
ws.send(JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
method: "eth_unsubscribe",
|
||||
params: ["0x1234..."], // subscription ID from subscribe response
|
||||
id: 4,
|
||||
}));
|
||||
```
|
||||
|
||||
## Connection Limits
|
||||
|
||||
| Plan | Max Connections | Messages/min |
|
||||
|------|----------------|-------------|
|
||||
| Free | 2 | 120 |
|
||||
| Pro | 10 | 600 |
|
||||
| Enterprise | Unlimited | Unlimited |
|
||||
|
||||
## Reconnection
|
||||
|
||||
WebSocket connections may drop due to network issues. Implement automatic reconnection with exponential backoff:
|
||||
|
||||
```javascript
|
||||
function connect() {
|
||||
const ws = new WebSocket("wss://api.lux.cloud/v1/ws/lux");
|
||||
ws.onclose = () => setTimeout(connect, 1000);
|
||||
return ws;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,16 +1,66 @@
|
||||
---
|
||||
title: White-Label
|
||||
description: Deploy under your own brand
|
||||
description: Deploy Lux Cloud under your own brand
|
||||
icon: Palette
|
||||
---
|
||||
|
||||
## Brands
|
||||
Lux Cloud supports white-label deployment. The same codebase serves multiple brands with different themes, logos, and domains.
|
||||
|
||||
| Brand | Domain | Config |
|
||||
|-------|--------|--------|
|
||||
| Lux Cloud | lux.cloud | Default |
|
||||
| Hanzo Web3 | web3.hanzo.ai | `NEXT_PUBLIC_BRAND=hanzo` |
|
||||
| Zoo Labs | web3.zoo.ngo | `NEXT_PUBLIC_BRAND=zoo` |
|
||||
| Bootnode | bootno.de | `NEXT_PUBLIC_BRAND=bootnode` |
|
||||
## Supported Brands
|
||||
|
||||
Brand is auto-detected from domain or set via environment variable.
|
||||
| Brand | Domain | Config | Theme |
|
||||
|-------|--------|--------|-------|
|
||||
| Lux Cloud | lux.cloud | Default | Blue |
|
||||
| Hanzo Web3 | web3.hanzo.ai | `NEXT_PUBLIC_BRAND=hanzo` | Purple |
|
||||
| Zoo Labs | web3.zoo.ngo | `NEXT_PUBLIC_BRAND=zoo` | Green |
|
||||
| Bootnode | bootno.de | `NEXT_PUBLIC_BRAND=bootnode` | Orange |
|
||||
|
||||
## Auto-Detection
|
||||
|
||||
The brand is auto-detected from the request's `Host` header. If no match is found, it falls back to the `NEXT_PUBLIC_BRAND` environment variable.
|
||||
|
||||
## Custom Branding
|
||||
|
||||
To deploy with your own brand:
|
||||
|
||||
1. Set the environment variables:
|
||||
|
||||
```bash
|
||||
NEXT_PUBLIC_BRAND=mybrand
|
||||
NEXT_PUBLIC_BRAND_NAME="My Cloud"
|
||||
NEXT_PUBLIC_BRAND_URL="https://mycloud.example.com"
|
||||
NEXT_PUBLIC_BRAND_LOGO="/logos/mycloud.svg"
|
||||
```
|
||||
|
||||
2. Add your logo to the `public/logos/` directory
|
||||
|
||||
3. Create a theme file at `themes/mybrand.ts`:
|
||||
|
||||
```typescript
|
||||
export const mybrand = {
|
||||
colors: {
|
||||
primary: "#FF6600",
|
||||
background: "#0A0A0A",
|
||||
text: "#FFFFFF",
|
||||
},
|
||||
fonts: {
|
||||
heading: "Inter",
|
||||
body: "Inter",
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
4. Deploy as normal -- the UI picks up the brand automatically
|
||||
|
||||
## Per-Brand Features
|
||||
|
||||
Each brand can enable or disable features:
|
||||
|
||||
| Feature | Lux Cloud | Hanzo Web3 | Zoo Labs |
|
||||
|---------|-----------|------------|----------|
|
||||
| RPC Proxy | Yes | Yes | Yes |
|
||||
| Token API | Yes | Yes | Yes |
|
||||
| NFT API | Yes | Yes | Yes |
|
||||
| Webhooks | Yes | Yes | No |
|
||||
| WebSockets | Yes | Yes | Yes |
|
||||
| DEX API | No | Yes | No |
|
||||
|
||||
@@ -5,7 +5,7 @@ index: true
|
||||
icon: Terminal
|
||||
---
|
||||
|
||||
The Lux CLI provides commands for managing networks, chains, keys, nodes, and validators. All commands follow the pattern `lux <group> <action> [flags]`.
|
||||
The Lux CLI provides commands for managing networks, chains, keys, nodes, and validators. All commands follow the pattern `lux [group] [action] [flags]`.
|
||||
|
||||
## Command Groups
|
||||
|
||||
|
||||
Reference in New Issue
Block a user