Forgepad API Documentation
This document provides comprehensive documentation for all external API endpoints available in the Forgepad platform. The API is built using Next.js API Routes and is designed for token launches, rewards/mining system, and competition leaderboards on Solana.
Base URL: https://forgepad.fun
Authentication
Most public endpoints do not require authentication. Admin endpoints require JWT authentication via cookies.
For user-facing endpoints, wallet addresses are used as identifiers and must be valid Solana wallet addresses (Base58 encoded, 32-44 characters).
Token Management
Create Pool (Upload)
Creates a new token pool with bonding curve configuration.
Endpoint: POST /api/upload
Content-Type: application/json
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
tokenLogo | string | Yes | Base64 encoded image (data:image/png;base64,...) |
mint | string | Yes | Token mint public key |
tokenName | string | Yes | Name of the token |
tokenSymbol | string | Yes | Token symbol (e.g., "FORGE") |
userWallet | string | Yes | Creator's wallet address |
tokenSupply | number | Yes | Total token supply |
bondingStartMarketcap | number | Yes | Starting market cap in USD |
bondingMarketcap | number | Yes | Target migration market cap in USD |
bondingFee | number | Yes | Trading fee percentage (e.g., 1 for 1%) |
migrationFee | number | Yes | Migration fee in basis points |
devBuy | number | Yes | Initial dev buy amount in quote token (0 for no dev buy) |
quoteMint | string | Yes | Quote mint: "SOL", "USDC", "USD1", or "MET" |
tokenDescription | string | No | Token description |
website | string | No | Project website URL |
twitter | string | No | Twitter/X handle or URL |
telegram | string | No | Telegram group URL |
distributionType | string | No | "Rewards", "Dividends", "Burn", or "Charity" |
charityOrganizationId | string | No | The Giving Block organization ID (required for Charity) |
charityOrganizationName | string | No | Charity organization name |
charityOrganizationLogo | string | No | Charity organization logo URL |
charityThreshold | number | No | SOL threshold for charity donations |
competitionLaunch | boolean | No | Use competition bonding curve config |
Example Request:
{
"tokenLogo": "data:image/png;base64,iVBORw0KGgoAAAANSUhE...",
"mint": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"tokenName": "My Token",
"tokenSymbol": "MTK",
"userWallet": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"tokenSupply": 1000000000,
"bondingStartMarketcap": 5000,
"bondingMarketcap": 100000,
"bondingFee": 1,
"migrationFee": 100,
"devBuy": 0.5,
"quoteMint": "SOL",
"tokenDescription": "A revolutionary token",
"website": "https://mytoken.com",
"twitter": "@mytoken"
}Success Response (200):
{
"success": true,
"poolTx": "<base64-encoded-transaction>",
"curveConfig": "44VcSFBvrj9pUhXCEzv8436wxYTbiXxGvW79MUWuM2W2"
}Notes:
- The
poolTxis a base64-encoded Solana transaction that needs to be signed by the user's wallet - For charity tokens,
quoteMintmust be"SOL" - Maximum body size: 10MB (for logo upload)
Send Transaction
Signs and sends a transaction with the mint keypair.
Endpoint: POST /api/send-transaction
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
walletSignedTransaction | string | Yes | Base64 encoded transaction signed by user wallet |
mintSecretKey | number[] | Yes | Mint keypair secret key as byte array |
mintFilename | string | No | Filename for cleanup |
mintSource | string | No | "bot" or "vanity" |
Example Request:
{
"walletSignedTransaction": "<base64-transaction>",
"mintSecretKey": [1, 2, 3, ...],
"mintSource": "bot",
"mintFilename": "mint-abc123.json"
}Success Response (200):
{
"success": true,
"signature": "5wHu1qwD7q4XqY4WZ..."
}Get Mint Keypair
Generates or retrieves a mint keypair for token creation.
Endpoint: POST /api/get-mint-keypair
Request Body:
{
"prefix": "ABC"
}Success Response (200):
{
"publicKey": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"secretKey": [1, 2, 3, ...],
"filename": "mint-abc123.json"
}Vanity Keypair
Generates a vanity keypair with a specific prefix.
Endpoint: POST /api/vanity-keypair
Request Body:
{
"prefix": "FORGE",
"caseSensitive": false
}Success Response (200):
{
"publicKey": "FORGEabc123...",
"secretKey": [1, 2, 3, ...],
"attempts": 15423
}Get Token Distribution
Gets holder distribution data for a specific token.
Endpoint: GET /api/token-distribution/[contractAddress]
Path Parameters:
| Parameter | Description |
|---|---|
contractAddress | Token mint address |
Example: GET /api/token-distribution/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Success Response (200):
{
"holders": [
{
"address": "9WzDXwBbmkg8...",
"balance": "1000000",
"percentage": 10.5
}
],
"totalHolders": 150,
"totalSupply": "1000000000"
}Explore/Discovery
Get Explore Tokens
Fetches tokens for the explore page, organized by category.
Endpoint: POST /api/explore/tokens
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
new | object | No | Filter options for new tokens |
graduating | object | No | Filter options for graduating tokens |
graduated | object | No | Filter options for graduated tokens |
Each category object supports:
| Field | Type | Default | Description |
|---|---|---|---|
timeframe | string | "24h" | "24h", "7d", or "all" |
sortBy | string | varies | Sort field (see below) |
sortDir | string | "desc" | "asc" or "desc" |
Valid sortBy values:
listedTime/launchTimestamp- Launch timebondingCurve/bondingCurveProgress- Bonding curve progressgraduatedAt- Graduation timestampvolume/volume24h- 24h trading volumemcap/marketCap- Market capitalizationusdPrice- Token price in USDliquidity- Pool liquidityholderCount- Number of holders
Example Request:
{
"new": {
"timeframe": "24h",
"sortBy": "launchTimestamp",
"sortDir": "desc"
},
"graduating": {
"timeframe": "7d",
"sortBy": "bondingCurveProgress",
"sortDir": "desc"
},
"graduated": {
"timeframe": "all",
"sortBy": "mcap",
"sortDir": "desc"
}
}Success Response (200):
{
"new": {
"pools": [
{
"tokenMint": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"name": "My Token",
"symbol": "MTK",
"logoUrl": "https://...",
"mcap": 50000,
"volume24h": 12500,
"bondingCurveProgress": 0.45,
"launchTimestamp": "2024-01-15T10:30:00Z",
"migrated": false
}
]
},
"graduating": {
"pools": []
},
"graduated": {
"pools": []
}
}Notes:
- Maximum 30 tokens returned per category
- If request body is empty, returns all three categories with default filters
Get Explore Metrics
Gets platform-wide metrics for the explore page.
Endpoint: GET /api/explore/metrics
Success Response (200):
{
"totalTokens": 1500,
"totalVolume24h": "5000000",
"totalGraduated": 250,
"averageBondingProgress": 0.35
}Explore Stream (SSE)
Server-Sent Events stream for real-time token updates.
Endpoint: GET /api/explore/stream
Response: Server-Sent Events stream
Event Types:
event: token_created
data: {"tokenMint": "...", "name": "...", "symbol": "..."}
event: token_graduated
data: {"tokenMint": "...", "graduatedAt": "..."}
event: price_update
data: {"tokenMint": "...", "price": 0.00001, "mcap": 50000}Competition Leaderboard
Get Competition Leaderboard
Fetches the competition leaderboard with real-time pricing data.
Endpoint: GET /api/competition/leaderboard
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 100 | Max tokens to return (max 500) |
search | string | - | Search by token name or symbol |
badgesOnly | boolean | false | Only return tokens with badges |
Example: GET /api/competition/leaderboard?limit=50&search=FORGE&badgesOnly=true
Success Response (200):
{
"generatedAt": "2024-01-15T10:30:00.000Z",
"dataFreshnessSeconds": 15,
"dbcConfigId": "44VcSFBvrj9pUhXCEzv8436wxYTbiXxGvW79MUWuM2W2",
"tokens": [
{
"tokenMint": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"name": "Forge Token",
"symbol": "FORGE",
"logoUrl": "https://...",
"twitter": "@forgetoken",
"telegram": "https://t.me/forgetoken",
"website": "https://forgepad.fun",
"mcap": 500000,
"mcapAth": 750000,
"volume24h": 125000,
"usdPrice": 0.0005,
"liquidity": 50000,
"fdv": 500000,
"priceChange24h": 15.5,
"badge100k": true,
"badge500k": false,
"badge1m": false,
"leaderboardUpdatedAt": "2024-01-15T10:29:45.000Z",
"marketCapSource": "dbc_sqrt_price",
"priceSource": "dbc_sqrt_price",
"debug": null
}
]
}Badge Thresholds:
badge100k: Market cap reached $100,000badge500k: Market cap reached $500,000badge1m: Market cap reached $1,000,000
Rewards System
The rewards system uses an "ORE" mining metaphor where users earn ORE through trading activity, which can be "smelted" into SOL during smelting cycles.
User Registration
Register User
Registers a user for the rewards program.
Endpoint: POST /api/rewards/user/register
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
walletAddress | string | Yes | User's Solana wallet address |
referralCode | string | No | Referral code from another user |
Example Request:
{
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"referralCode": "FORGE123"
}Success Response (200):
{
"success": true,
"user": {
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"username": null,
"points": 0,
"lifetimePoints": 0,
"referralCode": "USER_ABC123",
"referredBy": "FORGE123",
"tier": "bronze",
"isRegistered": true
},
"isNew": true,
"registered": true,
"referralSet": true
}Check Username Availability
Checks if a username is available.
Endpoint: POST /api/rewards/user/check-username
Request Body:
{
"username": "CryptoKing"
}Success Response (200):
{
"available": true,
"username": "CryptoKing"
}Error Response (409):
{
"available": false,
"error": "Username already taken"
}Set Username
Sets or updates the user's display name.
Endpoint: POST /api/rewards/user/username
Request Body:
{
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"username": "CryptoKing"
}Success Response (200):
{
"success": true,
"username": "CryptoKing"
}Validation Rules:
- 3-20 characters
- Alphanumeric and underscores only
- Case-insensitive uniqueness check
User Data
Get User Dashboard Data
Retrieves comprehensive dashboard data for a user.
Endpoint: GET /api/rewards/user/[wallet]
Path Parameters:
| Parameter | Description |
|---|---|
wallet | User's wallet address |
Example: GET /api/rewards/user/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
Success Response (200):
{
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"username": "CryptoKing",
"isRegistered": true,
"currentEpoch": "2024-01",
"currentOre": 15000,
"oreExpiringSoon": 5000,
"oreLifetime": 150000,
"oreTotalSmelted": 100000,
"volumeCurrentEpoch": "50000000000",
"volumeLifetime": "500000000000",
"referral": {
"referrerWallet": "4xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"referrerUsername": "Referrer123",
"totalReferees": 10,
"totalRefereePoints": 5000,
"selfBonusEarned": 2500
},
"rewards": [
{
"epochId": "2024-01",
"cycleId": "cycle_001",
"points": 10000,
"claimableSol": "0.5",
"claimed": false,
"expiresAt": "2024-02-15T00:00:00.000Z",
"startedAt": "2024-01-01T00:00:00.000Z",
"smelterOpenUntil": "2024-01-03T00:00:00.000Z"
}
]
}Volume Values:
- Volumes are returned as strings representing lamports (1 SOL = 1,000,000,000 lamports)
- Convert to SOL:
parseFloat(volume) / 1e9
Get Points History
Gets a user's point event history.
Endpoint: GET /api/rewards/points/history
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
wallet | string | Required | Wallet address |
limit | number | 50 | Max events to return |
offset | number | 0 | Pagination offset |
Example: GET /api/rewards/points/history?wallet=9WzDXw...&limit=20
Success Response (200):
{
"events": [
{
"eventType": "trade",
"basePoints": 1000,
"selfBonusPoints": 50,
"referrerBonusPoints": 0,
"totalPoints": 1050,
"epochId": "2024-01",
"createdAt": "2024-01-15T10:30:00.000Z",
"expiresAt": "2024-02-14T10:30:00.000Z"
}
],
"pagination": {
"limit": 20,
"offset": 0,
"hasMore": true
}
}Leaderboard
Get ORE/Volume Leaderboard
Fetches the rewards leaderboard.
Endpoint: GET /api/rewards/leaderboard
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
type | string | "ore" | "ore" or "volume" |
limit | number | 50 | Max entries (max 100) |
offset | number | 0 | Pagination offset |
wallet | string | - | Get user's rank |
Example: GET /api/rewards/leaderboard?type=ore&limit=50&wallet=9WzDXw...
Success Response (200):
{
"epochId": "2024-01",
"type": "ore",
"entries": [
{
"rank": 1,
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"username": "TopMiner",
"currentOre": 500000,
"tier": "platinum"
},
{
"rank": 2,
"walletAddress": "4xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"username": null,
"currentOre": 350000,
"tier": "gold"
}
],
"userRank": {
"oreRank": 15,
"volumeRank": 23
},
"pagination": {
"limit": 50,
"offset": 0,
"hasMore": true
}
}Tier Thresholds:
- Bronze: 0+ ORE
- Silver: 10,000+ ORE
- Gold: 100,000+ ORE
- Platinum: 1,000,000+ ORE
Smelting
Get Smelt Status
Gets the current smelter status and user's smelting info.
Endpoint: GET /api/rewards/smelt/status
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
wallet | string | Yes | User's wallet address |
Example: GET /api/rewards/smelt/status?wallet=9WzDXw...
Success Response (200):
{
"smelter": {
"is_open": true,
"manual_override": false,
"current_window": {
"opens": "2024-01-15T00:00:00.000Z",
"closes": "2024-01-17T00:00:00.000Z"
},
"next_window_opens": "2024-01-29T00:00:00.000Z",
"next_window_closes": "2024-01-31T00:00:00.000Z",
"hours_until_open": 0
},
"user": {
"available_ore": 15000,
"ore_expiring_soon": 5000,
"expired_ore": 0,
"already_smelted_ore": 10000,
"pool_balance_sol": "10.5",
"total_unsmelted_ore": 500000,
"estimated_sol": "0.315",
"can_smelt": true,
"message": "Smelter is open! You can smelt your ORE now."
}
}Smelting Schedule:
- Smelter opens every 14 days
- Smelter window: 48 hours
- ORE expires after 30 days if not smelted
- Claims expire 30 days after smelting completes
Execute Smelt
Submits ORE to the current smelting cycle.
Endpoint: POST /api/rewards/smelt/execute
Request Body:
{
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
}Success Response (200):
{
"success": true,
"cycleId": "cycle_001",
"oreSubmitted": 15000,
"estimatedSol": "0.315",
"message": "Successfully submitted 15,000 ORE to smelting cycle"
}Error Response (400):
{
"error": "Smelter is not currently open"
}Claims
Claim Smelted SOL
Claims SOL rewards from a completed smelting cycle.
Endpoint: POST /api/rewards/claim
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
cycleId | string | Yes | Smelting cycle ID |
walletAddress | string | Yes | User's wallet address |
Example Request:
{
"cycleId": "679a1b2c3d4e5f6789012345",
"walletAddress": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
}Success Response (200):
{
"success": true,
"txSignature": "5wHu1qwD7q4XqY4WZ...",
"claimedSol": "0.499000000",
"grossSol": "0.5",
"gasReserve": "0.001"
}Notes:
- Gas reserve of 0.001 SOL is deducted to cover transaction fees
- Rate limited: 60 requests per minute
- Claims expire 30 days after cycle completion
Error Responses:
| Status | Error | Description |
|---|---|---|
| 400 | "Missing cycleId" | Cycle ID not provided |
| 400 | "Invalid cycle ID format" | Invalid MongoDB ObjectId |
| 400 | "Claim amount too small" | Less than gas reserve |
| 400 | "Claim window expired" | 30-day window passed |
| 400 | "Reward has been forfeited" | Already expired |
| 403 | "Wallet banned" | User is banned |
| 403 | "ORE balance verification failed" | Security check failed |
| 404 | "Cycle reward not found" | No reward for this wallet/cycle |
| 409 | "Already claimed" | Reward already claimed |
| 503 | "Claims disabled" | Kill switch activated |
Referrals
Get Referral Stats
Gets referral statistics for a user.
Endpoint: GET /api/rewards/referrals/stats
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
wallet | string | Yes | User's wallet address |
Example: GET /api/rewards/referrals/stats?wallet=9WzDXw...
Success Response (200):
{
"totalTrades": 150,
"totalVolume": "500000000000",
"averageOrePerMiner": 12500,
"topMiner": {
"walletAddress": "4xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"username": "TopReferee",
"totalOre": 50000
},
"miners": [
{
"walletAddress": "4xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"username": "TopReferee",
"totalOre": 50000,
"volumeLifetime": "100000000000",
"joinedAt": "2024-01-10T10:30:00.000Z"
}
]
}Get Referral Earnings
Gets detailed referral earnings breakdown.
Endpoint: GET /api/rewards/referrals/earnings
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
wallet | string | Yes | User's wallet address |
Success Response (200):
{
"totalEarnings": 25000,
"earningsThisEpoch": 5000,
"refereeCount": 10,
"bonusRate": 10
}Bonus Rates:
- Referrer bonus: 10% of referee's earned ORE
- Self bonus: 5% bonus for having a referrer
Bonus Pool
Get Bonus Pool Status
Gets the current status of the ember drop bonus pool.
Endpoint: GET /api/rewards/bonus/status
Success Response (200):
{
"balance": "5.25",
"isActive": true,
"recentDrops": [
{
"amount": "0.05",
"timestamp": "2024-01-15T10:30:00.000Z",
"walletAddress": "9WzDXw..."
}
]
}Ember Drop Mechanics:
- 0.1% probability per qualifying trade
- Maximum 0.5 SOL per drop
- Minimum 0.1 SOL trade volume required
Platform Stats
Get Platform Statistics
Gets platform-wide reward statistics.
Endpoint: GET /api/rewards/stats/platform
Success Response (200):
{
"totalMiners": 1500,
"totalOreEarned": 50000000,
"totalSolDistributed": "1250.5",
"activeCycle": {
"cycleId": "cycle_002",
"status": "active",
"solPool": "15.5",
"totalOre": 750000
},
"currentEpoch": "2024-01"
}Charity
Get Charity Organizations
Fetches available charity organizations from The Giving Block.
Endpoint: GET /api/charity/organizations
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
debug | string | - | Set to "1" for raw response |
Example: GET /api/charity/organizations
Success Response (200):
{
"organizations": [
{
"id": "org_123abc",
"name": "Save the Children",
"logo": "https://...",
"description": "Global children's charity",
"category": "Children & Youth"
},
{
"id": "org_456def",
"name": "Red Cross",
"logo": "https://...",
"description": "Humanitarian aid organization",
"category": "Disaster Relief"
}
]
}Get Charity Transactions
Gets donation transactions for charity tokens.
Endpoint: GET /api/charity/transactions
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
tokenMint | string | No | Filter by token |
limit | number | No | Max results |
Success Response (200):
{
"transactions": [
{
"txSignature": "5wHu1qwD7q4...",
"tokenMint": "7xKXtg2CW87d...",
"organizationId": "org_123abc",
"organizationName": "Save the Children",
"amount": "1.5",
"timestamp": "2024-01-15T10:30:00.000Z"
}
]
}Error Handling
All endpoints follow a consistent error response format:
{
"error": "Human-readable error message"
}HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid input |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Access denied |
| 404 | Not Found - Resource doesn't exist |
| 405 | Method Not Allowed - Wrong HTTP method |
| 409 | Conflict - Resource already exists |
| 429 | Too Many Requests - Rate limited |
| 500 | Internal Server Error |
| 503 | Service Unavailable - System disabled |
Rate Limiting
The API implements rate limiting to prevent abuse:
| Endpoint Category | Limit | Window |
|---|---|---|
| Authentication | 5 requests | 15 minutes |
| General API | 60 requests | 1 minute |
| Claims | 60 requests | 1 minute |
Rate limit responses return:
{
"error": "Too many requests"
}With header: Retry-After: <seconds>
Types Reference
UserTier
type UserTier = 'bronze' | 'silver' | 'gold' | 'platinum';PointEventType
type PointEventType = 'trade' | 'referral' | 'bonus' | 'smelter' | 'adjustment' | 'ember_drop';CycleStatus
type CycleStatus = 'pending' | 'active' | 'smelting' | 'completed' | 'cancelled';TradeDirection
type TradeDirection = 'buy' | 'sell';QuoteMint
type QuoteMint = 'SOL' | 'USDC' | 'USD1' | 'MET';DistributionType
type DistributionType = 'Rewards' | 'Dividends' | 'Burn' | 'Charity';Constants
ORE Economics
| Constant | Value | Description |
|---|---|---|
| ORE per SOL Volume | 1,000 | ORE earned per 1 SOL traded |
| ORE Lifetime | 30 days | Before expiration |
| Claim Window | 30 days | After cycle completion |
| Smelter Window | 48 hours | How long smelter stays open |
| Smelter Interval | 14 days | Between smelting cycles |
Referral Bonuses
| Bonus Type | Rate | Description |
|---|---|---|
| Self Bonus | 5% | Bonus for having a referrer |
| Referrer Bonus | 10% | Bonus from referee's earnings |
Ember Drops
| Setting | Value | Description |
|---|---|---|
| Drop Probability | 0.1% | Per qualifying trade |
| Max Drop Amount | 0.5 SOL | Maximum per drop |
| Min Trade Volume | 0.1 SOL | Minimum to qualify |
WebSocket/SSE Events
The explore stream endpoint (GET /api/explore/stream) provides real-time updates via Server-Sent Events:
Connection
const eventSource = new EventSource('/api/explore/stream');
eventSource.addEventListener('token_created', (event) => {
const data = JSON.parse(event.data);
console.log('New token:', data);
});
eventSource.addEventListener('token_graduated', (event) => {
const data = JSON.parse(event.data);
console.log('Token graduated:', data);
});
eventSource.addEventListener('price_update', (event) => {
const data = JSON.parse(event.data);
console.log('Price update:', data);
});SDK Usage Examples
Creating a Token
// 1. Get mint keypair
const mintRes = await fetch('/api/get-mint-keypair', { method: 'POST' });
const { publicKey, secretKey, filename } = await mintRes.json();
// 2. Create pool transaction
const poolRes = await fetch('/api/upload', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tokenLogo: logoBase64,
mint: publicKey,
tokenName: 'My Token',
tokenSymbol: 'MTK',
userWallet: walletAddress,
tokenSupply: 1000000000,
bondingStartMarketcap: 5000,
bondingMarketcap: 100000,
bondingFee: 1,
migrationFee: 100,
devBuy: 0.5,
quoteMint: 'SOL'
})
});
const { poolTx } = await poolRes.json();
// 3. Sign with wallet
const tx = Transaction.from(Buffer.from(poolTx, 'base64'));
const signedTx = await wallet.signTransaction(tx);
// 4. Send transaction
const sendRes = await fetch('/api/send-transaction', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
walletSignedTransaction: signedTx.serialize().toString('base64'),
mintSecretKey: Array.from(secretKey),
mintFilename: filename,
mintSource: 'bot'
})
});
const { signature } = await sendRes.json();Claiming Rewards
// 1. Check smelt status
const statusRes = await fetch(`/api/rewards/smelt/status?wallet=${walletAddress}`);
const { smelter, user } = await statusRes.json();
// 2. Get user dashboard for available rewards
const dashRes = await fetch(`/api/rewards/user/${walletAddress}`);
const { rewards } = await dashRes.json();
// 3. Claim unclaimed reward
const unclaimedReward = rewards.find(r => !r.claimed && !r.forfeited);
if (unclaimedReward) {
const claimRes = await fetch('/api/rewards/claim', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
cycleId: unclaimedReward.cycleId,
walletAddress
})
});
const { txSignature, claimedSol } = await claimRes.json();
}Documentation generated for Forgepad API v1.0