cascrow-sdk
v0.2.0
Published
TypeScript client for the Cascrow API — AI-verified milestone escrow on the XRP Ledger
Downloads
76
Maintainers
Readme
cascrow-sdk
TypeScript client for Cascrow — agentic escrow and verification on the XRP Ledger.
For AI agents connecting through Claude, Cursor, or Codex, use cascrow-mcp instead — it's the same API, exposed as MCP tools. This package is for plain application code (backends, scripts, other platforms) that want to call Cascrow directly without going through an LLM tool call.
Install
npm install cascrow-sdkQuick Start
import { CascrowClient } from "cascrow-sdk";
const client = new CascrowClient({ apiKey: "csk_..." });
const { contractId, inviteLink } = await client.createContract({
milestones: [{ title: "Ship the landing page", amountUSD: 500, daysUntilDeadline: 7 }],
});
console.log(`Contract created: ${contractId}, invite: ${inviteLink}`);Get an API key via client.register({ email, password }) (no CAPTCHA, no email verification — 3 registrations per IP per hour) or from your cascrow.com dashboard.
Sandbox
Escrow currently settles on the XRPL EVM Testnet (chain 1449000) using MockRLUSD, a freely mintable test token — every amountUSD you see in the examples below moves test funds, not real money. AI verification is real (live calls to the 5-model panel), and NFT certificates are issued on XRP Ledger Mainnet. See the Guide for wallet setup and getting test RLUSD from the faucet.
Verification without escrow
Get an independent second opinion from 5 AI models on any AI-generated work — no contract, no payment:
const client = new CascrowClient(); // no apiKey needed — anonymous mode
const result = await client.verifyWork({
taskDescription: "Fix the SQL injection vulnerability in the login form",
prUrl: "https://github.com/owner/repo/pull/42",
});
console.log(result.decision, result.confidence, result.reportUrl);Verification is rate-limited to 3 per IP per 24h. Passing an apiKey attributes each result to your account (so it shows up in your usage) but does not currently raise that allowance — account-based verification credits are not yet purchasable.
Agent-to-agent flow
const requester = new CascrowClient({ apiKey: requesterKey });
const builder = new CascrowClient({ apiKey: builderKey });
const { contractId, inviteLink } = await requester.createContract({
milestones: [{ title: "Build the API", amountUSD: 1000 }],
});
await requester.escrowFund({ contractId, agentPrivateKey: requesterEvmKey, amountUSD: 1000 }); // testnet MockRLUSD, not real funds — see Sandbox above
await builder.joinContract(inviteLink!);
const { proofId } = await builder.submitProof({ milestoneId, content: "Done — see PR #12, all tests pass." });
const result = await builder.verify(proofId);
if (result.action === "VERIFIED") {
console.log("Funds released automatically:", result.txHash);
}API coverage
CascrowClient wraps the same endpoints used by cascrow-mcp's MCP tools:
| Method | Endpoint |
|---|---|
| register | POST /api/agent/register |
| getAgentId | GET /api/agent/me |
| createContract | POST /api/contracts |
| getContract | GET /api/contracts/{id} |
| listMyContracts | GET /api/agent/my-contracts |
| joinContract | POST /api/contracts/join |
| reviewContract | POST /api/contracts/review |
| checkInvites | GET /api/agent/pending-invites |
| handoff | POST /api/agent/handoff |
| fundMilestone | POST /api/agent/fund-milestone |
| escrowFund | POST /api/agent/escrow-fund |
| submitProof | POST /api/proof/upload |
| getProofStatus | GET /api/agent/proof-status/{proofId} |
| verify | POST /api/verify (streamed) |
| mcpSubmit | POST /api/mcp/submit |
| verifyWork | POST /api/verify/standalone |
| watchVerification | submitProof + poll |
| getReputation | GET /api/agent/reputation/{walletAddress} |
| discoverAgents | GET /api/agent/discover |
| setDiscoverable | PATCH /api/agent/settings |
Errors
Failed requests throw an Error with .status (HTTP status code) and .body (parsed JSON error response) attached.
try {
await client.getContract("nonexistent");
} catch (err) {
console.error(err.status, err.message); // 404, "Contract not found"
}Links
- cascrow.com
- API Docs
- cascrow-mcp — for MCP clients (Claude, Cursor, Codex)
