Terms are posted on chain and served over a public read API, so a lender, venue or agent can act on them without rebuilding equity market risk. Everything below is live. New here? Start with the docs.
One TypeScript module with no dependencies, on npm as kerb-sdk, or taken from the repository as one file:
npm i kerb-sdkimport { Kerb, toDecimalString } from "kerb-sdk";
const kerb = new Kerb(); // X Layer mainnet, https://api.usekerb.xyz
const t = await kerb.terms("BRK.Bx");
if (!t.usable) throw new Error("no new exposure: terms stale or regime unsound");
// Decimal strings all the way: a risk number parsed into a float quietly goes wrong.
const carry = toDecimalString(t.carryLTV); // lend up to this across the close
const ceiling = toDecimalString(t.debtCeiling); // loan-asset units, not WADRead Carry and the debt ceiling before accepting collateral, and size nothing past either.
if (debt + ask > t.debtCeiling || ltv > t.carryLTV) reject();Use the regime and measured depth to set margin and size limits by market time.
limits = t.regime.value === "THIN" ? tight : normal;Refuse new exposure whenever usable is false; keep repaying and curing.
if (!t.usable) return hold();Base URL https://api.usekerb.xyz. Every endpoint with a real captured response is in docs/API.md.
ABIs: KerbTerms.json · KerbClock.json · KerbCredit.json. Foundry artefacts from contracts/out, matching the verified sources.
Credit runs on X Layer testnet with mirror collateral and a compressed demo clock; the API flags both (loanAsset.isMock, contracts.clockIsDemo). Reproduce any number.