Build
SDK
One ES module, served from this site. It needs viem.
npm i viem
curl -O https://www.softlinecredits.com/sdk/softline.mjsClient
import { createSoftline } from "./softline.mjs";
const sl = createSoftline({ privateKey: process.env.AGENT_KEY, api: "https://www.softlinecredits.com" });| register({ payout, name, endpoint }) | Enrol an agent. Returns agentId and inbox. |
|---|---|
| underwrite({ agentId, payToKey? }) | Profile and signed ceiling. |
| apply({ agentId, amount, shareBps, feeBps, fundingDays }) | Underwrite and open a line. |
| agent(id), line(id), activeLine(agentId) | Reads. |
| draw(lineId), cancel(lineId) | Owner actions. |
| repay(lineId, amount), settle(agentId) | Repay directly; settle an inbox. |
| fund(lineId, amount), unfund, claim(lineId) | Lender actions. |
| paywall({ agentId, price, description }) | Wrap a Fetch API handler: 402, verify, settle, respond. |
| pay(url, init?) | x402 client: answers a 402 with a signed EIP-3009 authorization. |
Amounts are strings in USDG ("0.05"); the SDK converts them to 6-decimal units.