Docs · Overview
Trustain Platform Docs
Trustain is a cross-chain legal operating platform for institutional law firms. These docs cover the four surfaces a developer needs to integrate with: the REST API, the typed v1 SDK, the on-chain Move & Anchor modules, and the workflow automations that tie them together.
What's in here
Introduction
Features, auth model, users & roles, pricing, PWA delivery, and the platform disclaimer. Start here if you're new.
On-Chain
Six Move packages on Sui (trustain_escrow, trustain_dao_escrow, trustain_token, trustain_governance, trustain_swap, trustain_bridge) and two Anchor programs on Solana (trustain_wtrust, trustain_wtrust_bridge).
API Reference
The typed v1 client — every namespace, every method, every payload. Generated from lib/api/v1.js.
Architecture & REST Endpoints
How the repo is organised: api/, lib/, hooks/, services/, and the REST endpoints backing the SDK.
Connection
- Base URL:
https://app.trustain.io/api/v1/ - Auth: Base44 session cookie (frontend) or Bearer token (server-to-server).
- Content type:
application/jsonon every request and response. - Transport: direct
fetchagainst REST endpoints, or — preferred — the typedv1wrapper which invokes the matching backend function.
Response envelope
Standard response shape// Success
{ "success": true, "data": { /* payload */ } }
// Error
{ "success": false, "error": { "code": "string", "message": "string" } }Quickstart
From the frontend, prefer the typed client over raw fetch:
@/lib/api/v1import { v1 } from "@/lib/api/v1";
const summary = await v1.clientPortal.summary("legal@aethelgard.co");
const { url } = await v1.checkout.bulkSettle({ /* ... */ });
await v1.documents.sign({ documentId, documentName, signerEmail, signerName });Core modules
- Client Portal — aggregated billing summary for paying clients.
- Documents & Signing — tamper-evident e-signature on engagement letters, contracts, invoice acknowledgements.
- Invoices & Checkout — Stripe-backed bulk settle, retainer top-ups, firm subscriptions.
- Contract Reviews — AI risk pipeline for uploaded contracts.
- Encrypted Messaging — AES-GCM envelope relay; server never sees plaintext.
- Consultation Bookings — partner discovery, booking, Stripe pre-auth, escrow-backed payout.
- On-Chain Escrow — milestone-bound retainer vaults (
trustain_escrow) and invoice vaults (trustain_dao_escrow) on Sui.
Versioning
The REST surface is versioned at the path prefix (/api/v1). Breaking changes ship behind a new prefix; the current version is maintained until every first-party surface has migrated.