Content

Token & Market Metadata

Creates the initial metadata for a newly deployed token or prediction market. This must be called after the on-chain transaction is confirmed. The server reads the token name, symbol, creator, and options directly from the blockchain — you only supply the off-chain fields (description, socials, image).

POST
/api/metadata
Creates metadata JSON on IPFS for a new token or prediction market.
Auth: Session required + wallet must be the on-chain creator

Request Body (JSON)

Response
{
  "address": "0x...",           // Contract address (required)
  "description": "string",     // Optional
  "website": "string",         // Optional
  "telegram": "string",        // Optional
  "twitterx": "string",        // Optional
  "image": "string"            // IPFS URL from /api/images (optional)
}

The server automatically detects whether the address is a regular token, public prediction market, or private prediction market by checking the on-chain contracts.

Response

Response
{ "url": "https://...pinata.cloud/ipfs/...", "cid": "bafy..." }
200 Created400 Not an ecosystem token401 Not signed in403 Not the token creator409 Metadata already exists

Server-Side Verification

The server reads the following directly from the blockchain:

  • name and symbol — from the token contract
  • dev — from DEV() or marketData[1]
  • multiplier — from hybridMultiplier()
  • isPrediction and predictionType — auto-detected by checking public and private prediction contracts
  • options — from getAllOutcomes() (prediction markets only)
  • eventType — from marketData[11] (prediction markets only)
Example Code
// Create metadata for a newly deployed token or prediction market
// The server auto-detects whether it's a token, public market, or private market
async function createMetadata(contractAddress, imageUrl, sessionCookie) {
  const res = await fetch("https://launchonbasis.com/api/metadata", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Cookie": sessionCookie,
    },
    body: JSON.stringify({
      address: contractAddress,
      description: "My awesome project",
      website: "https://example.com",
      telegram: "https://t.me/myproject",
      twitterx: "https://x.com/myproject",
      image: imageUrl,
    }),
  });

  const { url, cid } = await res.json();
  return { url, cid };
};