Developers

FRACTAL API

The JSON API behind this site. Everything is read from the Solana chain on request (there is no database), plus the engine's published snapshot for tree data. No key is needed. Responses are cached at the edge for the time listed on each endpoint, so polling faster than that returns the same data.

  • Base URL: https://fractalsolana.site
  • Errors are {"error": "message"} with a 4xx or 5xx status.
  • Token amounts are UI units (decimals applied). FRACTAL and every coin have 6 decimals; SOL has 9.
  • quote is the pair's quote token: SOL for FRACTAL, FRACTAL for every other coin. Fields ending in Sol are converted to SOL at FRACTAL's current price.
  • Timestamps are Unix milliseconds.

Read

Build and send transactions

These endpoints never hold keys. They return unsigned transactions for the caller's wallet to sign, and every transaction is simulated before it is returned, so failures surface as readable errors.

Example: buy a coin with SOL

// 1. price it
const q = await fetch(`/api/quote?mint=${MINT}&side=buy&pay=sol&amount=0.5&slippageBps=300`).then(r => r.json())

// 2. build it for your wallet (simulated server-side)
const t = await fetch('/api/trade', {
  method: 'POST', headers: { 'content-type': 'application/json' },
  body: JSON.stringify({ mint: MINT, side: 'buy', pay: 'sol', amount: 0.5, slippageBps: 300, owner: wallet.publicKey.toBase58() }),
}).then(r => r.json())

// 3. sign and send with the wallet
const tx = t.kind === 'versioned'
  ? VersionedTransaction.deserialize(Buffer.from(t.tx, 'base64'))
  : Transaction.from(Buffer.from(t.tx, 'base64'))
const { signature } = await window.phantom.solana.signAndSendTransaction(tx)