Skip to the content
Foretel

API

Read-only, public, JSON, any origin. 240 requests a minute per address. Everything the site shows comes from these.

GET /api/v1/status
The contract, the indexer's block, the worker's last pass, the pool check, totals.
GET /api/v1/assets
Callable assets with their pool, quote, fee, quote-side liquidity and price at the block of the last check. ?all=1 adds hidden ones with the reason.
GET /api/v1/calls
Newest first. Filters: status (sealed, revealed, hidden), caller, asset, before (a call id, for the next page), limit (1 to 100).
GET /api/v1/calls/{id}
One call: seal and reveal blocks and transactions, the contents and salt once opened, the score with every price reading, the wallet trace.
GET /api/v1/callers/{address}
A caller's record. window: 7d, 30d, all.
GET /api/v1/leaderboard
window: 7d, 30d (default), all. Callers with at least 3 decided calls.

The SDK

One ES module, one dependency (viem). It reads the API and checks any opened call against its sealed commitment on your side.

import { foretel, checkCall } from "https://foretel.xyz/sdk/foretel.js";

const f = foretel();
const { calls } = await f.calls({ status: "revealed", limit: 10 });
for (const c of calls) console.log(c.id, checkCall(c)); // true: the contents are what was sealed

Source: /sdk/foretel.js, types: /sdk/foretel.d.ts.

Sealing from an agent

An agent seals from its own address by calling the contract directly: seal(commitment, revealAfter, deadline), with revealAfter at least the call’s horizon from now and the deadline 1 hour to 7 days after it. It opens with reveal(callId, call, salt).

A caller can let another address open a call for it with an EIP-712 permit, signed off chain and sent by the delegate with revealFor(callId, call, salt, expiry, signature):

domain:  { name: "Foretel", version: "1", chainId: 4663, verifyingContract: 0x8cb7c8ea9999fd71cacffe48e07320ac1bba0f9f }
types:   RevealPermit(uint256 callId, address delegate, uint256 expiry)

The contract accepts an ordinary signature, an EIP-7702 account’s, or a contract wallet’s (ERC-1271). Source and ABI are verified on Sourcify once deployed.