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 reading getMarketData on the two market hosts.
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:
nameandsymbol: from the token contractdev: fromDEV()for a token; for a market, fromgetMarketData(address).creator(on a market tokenDEV()is the host)multiplier: fromhybridMultiplier()isPredictionandpredictionType: auto-detected by checking public and private prediction contractsoptions: fromTrancheReader.getAllOutcomes(host, marketToken)(prediction markets only)eventType: fromgetMarketData(address).isPrivate(who may bet; always false on the public host; prediction markets only).predictionTypesays which host the market lives on.
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 };
};