TypeScript Client
Call the Fairseq API from a TypeScript service.
type Tx = { hash: string; timestamp: number }
export async function createProof(apiKey: string, transactions: Tx[]) {
const res = await fetch('https://fairseq.io/api/v1/proofs', {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: `Bearer ${apiKey}`,
},
body: JSON.stringify({ transactions, options: { orderingRule: 'fifo' } }),
})
if (!res.ok) throw new Error(`createProof failed: ${res.status}`)
return await res.json()
}