Developers
Build on the market contract
The app uses the same three pieces you can: a TypeScript SDK, the contract ABIs with deployment addresses, and a read-only indexer API. The contracts are the source of truth; the packages are generated from them.
@coverline-fi/sdkTyped calls for every user-facing write, simulate-before-sign helpers, contract errors in plain language, mirrors of the contract math (collateral, fees, payoffs) and a pricing model whose outputs are labelled “model”.
@coverline-fi/contracts-abiABIs and deployment addresses per chain, exported from the contracts build. Never copy an ABI or an address by hand.
Indexer API
JSON over HTTP at [INDEXER URL]: offers, bids, positions, fills, settlements, claims and agent actions, each with the block it was read at.
Packages are on GitHub Packages and private for now: [PACKAGE ACCESS].
Using an AI client? Connect it with MCP: a local server that reads the market and prepares orders, holds no keys and sends nothing.
Simulate, then sign
import { createPublicClient, http } from 'viem';
import { getDeployment, marketCalls, simulateMarketCall, sendSimulated,
explainMarketError, fillBreakdown, getOffer, marketConfig } from '@coverline-fi/sdk';
const d = getDeployment(chainId);
const ctx = { client: createPublicClient({ transport: http(rpcUrl) }), market: d.market };
// What the buyer pays and the writer receives: the contract's own integer math.
const offer = await getOffer(ctx, offerId);
const { feeBps } = await marketConfig(ctx);
const cost = fillBreakdown(offer.premiumPerLot, 2, feeBps);
// Simulate first; sign only what simulated.
try {
const sim = await simulateMarketCall(ctx, account, marketCalls.fillOffer(offerId, 2));
await sendSimulated(walletClient, sim);
} catch (e) {
console.error(explainMarketError(e).message); // plain language
}Indexer API
Every list route uses keyset pagination: the first page carries an X-Next-Cursor header, later pages are requested with after. Amounts are integer strings in token units, addresses are checksummed, and nothing the indexer returns is estimated: model values come from the SDK and are labelled.
| Route | Returns |
|---|---|
/health | Indexed block, chain head and lag |
/market | Market parameters: fees, settlement policy, paused and frozen tokens |
/offers | Offers, with the block they were read at |
/bids | Resting bids and their escrow |
/positions | Non-zero position balances |
/portfolio | Positions, open offers, open bids and unclaimed amounts of one account |
/fills | Fills (OfferFilled events) |
/settlements | Settlement prices and settled offers |
/claims | Holder and writer claims |
/agent-actions | Every action an agent took for an owner |
/agent-grants | Grants and revocations |
/events | Raw events of one type |
Contract reference
Functions, events, errors, fees and settlement rules of the market contract: [CONTRACT DOCS]. Agent grants are described on Agents.
Local test network
For development, the contracts deploy to a local Anvil chain (chain id 31337) with test tokens that anyone can mint. Those tokens and the Anvil test accounts exist only on local chains. Never use them, or any private key, on a public network.