SDK Reference
Complete reference for the Fairseq SDK - Rust (primary) and REST API.
The primary Fairseq SDK is written in Rust. For detailed Rust API documentation, see the Prover, Verifier, Config, and Types pages.
This page covers the REST API client for TypeScript/JavaScript and other languages that don't have a native SDK.
Rust SDK (Primary)
The Fairseq Rust SDK provides the most complete integration with native performance:
- Prover — Generate temporal ordering proofs
- Verifier — Verify proof validity
- Config — SDK configuration options
- Types — Type definitions and structures
See the Examples for Rust code samples.
REST API Client
For languages without a native SDK, use the REST API directly.
Constructor
new Fairseq(options: FairseqOptions)Creates a new Fairseq REST API client instance.
Options
| Parameter | Type | Description |
|---|---|---|
apiKey | string | Your Fairseq API key |
baseUrl | string? | Custom API endpoint (default: https://api.fairseq.io) |
timeout | number? | Request timeout in ms (default: 30000) |
Proofs
client.proofs.create()
Generate a new temporal ordering proof.
const proof = await client.proofs.create({
transactions: Transaction[],
options?: ProofOptions,
});client.proofs.get()
Retrieve an existing proof by ID.
const proof = await client.proofs.get(proofId: string);client.proofs.verify()
Verify a proof's validity.
const result = await client.proofs.verify(proofId: string);client.proofs.list()
List proofs with optional filters.
const proofs = await client.proofs.list({
limit?: number,
offset?: number,
status?: 'pending' | 'completed' | 'failed',
});Errors
The SDK throws on non-2xx responses. Prefer a try/catch around network calls:
try {
await client.proofs.create({ transactions })
} catch (error) {
console.error('Create proof failed', error)
}