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
import { createYolko } from "@yolko/sdk";
import { createPublicClient, http } from "viem";
import { base } from "viem/chains";
const yolko = createYolko({
publicClient: createPublicClient({ chain: base, transport: http() }),
});// 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);// 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
| Method | Does |
|---|---|
read listEligibleStocks() | Allowlisted stocks a collection can be created in. |
read quoteMint({ drop, quantity, pay }) | Measured mint: USDC in, stock out, ETH cost when paying in ETH, price impact, feed gap, mint fee. |
read quoteCreate({ stock, priceUsdc }) | The stock one mint at a given price would buy now, before the collection exists. |
read getBacking(drop, tokenId) | Stock held by one NFT. |
read getPendingBacking(drop, tokenId) | Royalty backing still waiting as ETH / USDC, before it is converted to stock. |
read getCreatorPending(creator) | What a creator can claim, per collection. |
read claimableStock(drop, holder) | Stock booked to a holder after a transfer could not go through. |
read rewardsBalance(address) | Unwithdrawn mint fee rewards of an address. |
write createDrop(wallet, params) | Creates a collection. Sale terms are fixed from here on. |
write mint(wallet, { drop, quantity, pay }) | Mints in USDC or ETH; the stock is bought in the same transaction. |
write redeem(wallet, { drop, tokenId }) | Sends the NFT to the Redeemer, which burns it and pays its backing. |
write transfer(wallet, { drop, tokenId, to }) | Safe transfer that refuses recipients that would lose the NFT. |
write claim(wallet, { creator, drops }) | Pays a creator's earnings out. |
write withdrawStock(wallet, drop) | Withdraws claimable stock to the same address. |
write withdrawRewards(wallet, to?) | Withdraws mint fee rewards. |
Units and conventions
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. nullmeans 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
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.https://api.yolko.xyzCollections
- GET
/v1/dropsPublic collections (drop contracts), newest first. Team collections are left out.
Query:
creator,stock,limit,offset - GET
/v1/drops/:dropOne collection, with pending creator funds and backing held, read from chain at the returned block.
- GET
/v1/drops/:drop/mintsRecent 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/activityMints (with comment) and redeems in one feed, newest first.
Query:
limit,offset
NFTs
- GET
/v1/drops/:drop/tokensMinted 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/:idOne NFT: owner, burned, and its backing: the stock it holds, plus royalty backing still pending as ETH / USDC.
- GET
/v1/drops/:drop/tokens/:id/historyOne NFT's provenance: mint, transfers, royalty backing added, redeem. Newest first.
Accounts
- GET
/v1/holders/:address/tokensNFTs an address holds now.
Query:
limit,offset,withBacking=1 - GET
/v1/creators/:creatorCreator panel: per-collection pending, mint fee rewards, held payouts, royalty estimate.
Protocol
- GET
/v1/stocksAllowlisted stocks with their limits.
- GET
/v1/protocol/revenueProtocol fee (1%) booked and flushed, per asset.
Rules worth knowing
Redeem only through the Redeemer
redeem (it calls safeTransferFrom to the Redeemer). A plain burn or transferFrom leaves the backing to the creator.Sale terms are fixed at creation
Fees
Claims never lock funds