yolko

Developers

Build on Yolko

Everything the site does is available to your app: a TypeScript SDK for reads and transactions, and a read-only REST API for what has happened on chain.

Chain
Base · 8453
SDK
TypeScript, viem
REST
Read only, JSON
Rate limit
60 req / 10 s per IP

Quickstart

Create a client from any viem public client. Every write is simulated first, so a contract refusal throws before anything is sent or signed.
setup.ts
import { createYolko } from "@yolko/sdk";
import { createPublicClient, http } from "viem";
import { base } from "viem/chains";

const yolko = createYolko({
  publicClient: createPublicClient({ chain: base, transport: http() }),
});
read.ts
// Stocks a collection can be backed by
const stocks = await yolko.listEligibleStocks();

// Price a mint: stockOut (8 decimals) for the fixed USDC price,
// plus price impact, feed gap and the mint fee in wei
const quote = await yolko.quoteMint({ drop, quantity: 1n, pay: "usdc" });

// The stock one NFT holds (8 decimals)
const backing = await yolko.getBacking(drop, tokenId);
write.ts
// wallet = a viem WalletClient with an account

// Mint; minStockOut defaults to the quote minus 1 %
const { tokenIds } = await yolko.mint(wallet, {
  drop, quantity: 1n, pay: "usdc", quote, referrer,
}); // or pay: "eth"

// Redeem: burns the NFT and pays its stock as it is, no swap
const outcome = await yolko.redeem(wallet, { drop, tokenId });

// Creator: claim what your collections earned
await yolko.claim(wallet, { creator, drops: [drop] });

Not on npm yet

@yolko/sdk is not published to a registry yet. Until it is, the REST API below and the contracts are the public surface.

SDK reference

The methods most apps need. Amounts are bigint in the asset's smallest unit.
MethodDoes
readlistEligibleStocks()
Allowlisted stocks a collection can be created in.
readquoteMint({ drop, quantity, pay })
Measured mint: USDC in, stock out, ETH cost when paying in ETH, price impact, feed gap, mint fee.
readquoteCreate({ stock, priceUsdc })
The stock one mint at a given price would buy now, before the collection exists.
readgetBacking(drop, tokenId)
Stock held by one NFT.
readgetPendingBacking(drop, tokenId)
Royalty backing still waiting as ETH / USDC, before it is converted to stock.
readgetCreatorPending(creator)
What a creator can claim, per collection.
readclaimableStock(drop, holder)
Stock booked to a holder after a transfer could not go through.
readrewardsBalance(address)
Unwithdrawn mint fee rewards of an address.
writecreateDrop(wallet, params)
Creates a collection. Sale terms are fixed from here on.
writemint(wallet, { drop, quantity, pay })
Mints in USDC or ETH; the stock is bought in the same transaction.
writeredeem(wallet, { drop, tokenId })
Sends the NFT to the Redeemer, which burns it and pays its backing.
writetransfer(wallet, { drop, tokenId, to })
Safe transfer that refuses recipients that would lose the NFT.
writeclaim(wallet, { creator, drops })
Pays a creator's earnings out.
writewithdrawStock(wallet, drop)
Withdraws claimable stock to the same address.
writewithdrawRewards(wallet, to?)
Withdraws mint fee rewards.

Units and conventions

The same rules hold in the SDK and the API.

ETH

18 decimals

wei

USDC

6 decimals

price, royalties

Stock (B20)

8 decimals

backing, payouts

  • API amounts are integer strings in the smallest unit; parse them with BigInt(), never as floats.
  • null means not measured (a read failed or there is no row), never zero.
  • Every response carries chainId. Check it before trusting the numbers.
  • Different stocks are never summed together, and no amount is converted to dollars by the API.

REST API

All endpoints are GET. Lists take limit (1–100, default 50) and offset. A bad address answers 400 with { "error": "bad_address" }; past the rate limit you get 429 with a retry-after header.
Base URLhttps://api.yolko.xyz

Collections

  • GET/v1/drops

    Public collections (drop contracts), newest first. Team collections are left out.

    Query: creator, stock, limit, offset

  • GET/v1/drops/:drop

    One collection, with pending creator funds and backing held, read from chain at the returned block.

  • GET/v1/drops/:drop/mints

    Recent mints, newest first: the USDC price, the stock it bought, what was paid (USDC or ETH) and the on-chain comment, or null.

    Query: limit, offset

  • GET/v1/drops/:drop/activity

    Mints (with comment) and redeems in one feed, newest first.

    Query: limit, offset

NFTs

  • GET/v1/drops/:drop/tokens

    Minted NFTs, newest first, redeemed (burned) ones flagged. withBacking=1 adds each NFT's backing, read in one block.

    Query: limit, offset, withBacking=1

  • GET/v1/drops/:drop/tokens/:id

    One NFT: owner, burned, and its backing: the stock it holds, plus royalty backing still pending as ETH / USDC.

  • GET/v1/drops/:drop/tokens/:id/history

    One NFT's provenance: mint, transfers, royalty backing added, redeem. Newest first.

Accounts

  • GET/v1/holders/:address/tokens

    NFTs an address holds now.

    Query: limit, offset, withBacking=1

  • GET/v1/creators/:creator

    Creator panel: per-collection pending, mint fee rewards, held payouts, royalty estimate.

Protocol

  • GET/v1/stocks

    Allowlisted stocks with their limits.

  • GET/v1/protocol/revenue

    Protocol fee (1%) booked and flushed, per asset.

Rules worth knowing

The contract behaviour an integration most often gets wrong.

Redeem only through the Redeemer

Use redeem (it calls safeTransferFrom to the Redeemer). A plain burn or transferFrom leaves the backing to the creator.

Sale terms are fixed at creation

Price, sale window, per-wallet limit, backing rates and royalty cannot change after a collection is created.

Fees

A protocol fee of 5% of each mint price and 10% of royalties, and a mint fee of 0.000777 ETH per NFT, paid by the minter. See Protocol.

Claims never lock funds

When stock cannot be delivered (a blocked transfer, a pause) it is booked as claimable to the same address instead of failing.
/llms.txtA plain-text summary of this page for language models.