Developers

API Reference

Endpoints

All endpoints are served from the same origin as the app.

MethodPathDescription
POST/api/launchBuild an unsigned launch transaction
POST/api/launch/submitSubmit the signed launch + index the coin
POST/api/tradeBuild an unsigned buy/sell transaction
GET/api/coinsList launched coins
GET/api/coins/[mint]Read a single coin + its stats

Quote & trade

Trades execute against the coin's pool. You can quote and build a swap directly with the Meteora dynamic bonding curve SDK:

trade.ts
import { DynamicBondingCurveClient } from "@meteora-ag/dynamic-bonding-curve-sdk"
import { Connection, PublicKey } from "@solana/web3.js"
import BN from "bn.js"

const connection = new Connection(process.env.RPC_URL!, "confirmed")
const client = new DynamicBondingCurveClient(connection, "confirmed")

const pool = await client.state.getPoolByBaseMint(new PublicKey(mint))

// Quote a 1 SOL buy (quote -> base).
const quote = await client.pool.swapQuote({
  virtualPool: pool.account,
  config: poolConfig,
  swapBaseForQuote: false, // false = buy the token with SOL
  amountIn: new BN(1e9), // 1 SOL (9 decimals)
  slippageBps: 100, // 1%
  hasReferral: false,
  currentPoint: new BN(0),
})

const tx = await client.pool.swap({
  owner: wallet.publicKey,
  pool: pool.publicKey,
  amountIn: new BN(1e9),
  minimumAmountOut: quote.minimumAmountOut,
  swapBaseForQuote: false,
  referralTokenAccount: null,
})

Graduation progress

Track how close a live coin is to migrating into a DAMM v2 pool. The curve's quote reserve, measured against the config threshold, is all you need:

progress.ts
import { getDbcClient, fetchConfigDetails } from "@/lib/meteora"
import { PublicKey } from "@solana/web3.js"

export async function graduationProgress(mint: string) {
  const client = getDbcClient()
  const pool = await client.state.getPoolByBaseMint(new PublicKey(mint))
  if (pool.account.isMigrated) return { migrated: true, progress: 1 }

  const config = await fetchConfigDetails()
  const raised = Number(pool.account.quoteReserve) / 1e9
  const target = config!.migrationQuoteThresholdSol

  return {
    migrated: false,
    raisedSol: raised,
    targetSol: target,
    progress: Math.min(1, raised / target), // 0 -> 1
  }
}

Read a coin

read.ts
const coin = await fetch(
  `https://dreams.cash/api/coins/${mint}`,
).then((r) => r.json())

// {
//   mint, name, symbol, image, creator,
//   flywheel, marketCap, isMigrated, ...
// }
console.log(coin.symbol, coin.marketCap)
Running on $DREAM