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

TS
new Fairseq(options: FairseqOptions)

Creates a new Fairseq REST API client instance.

Options

ParameterTypeDescription
apiKeystringYour Fairseq API key
baseUrlstring?Custom API endpoint (default: https://api.fairseq.io)
timeoutnumber?Request timeout in ms (default: 30000)

Proofs

client.proofs.create()

Generate a new temporal ordering proof.

TS
const proof = await client.proofs.create({
  transactions: Transaction[],
  options?: ProofOptions,
});

client.proofs.get()

Retrieve an existing proof by ID.

TS
const proof = await client.proofs.get(proofId: string);

client.proofs.verify()

Verify a proof's validity.

TS
const result = await client.proofs.verify(proofId: string);

client.proofs.list()

List proofs with optional filters.

TS
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:

TS
try {
  await client.proofs.create({ transactions })
} catch (error) {
  console.error('Create proof failed', error)
}

Related docs

Was this page helpful? /
Back to docs