RSTAR

Integration

The engine ships a TypeScript SDK (engine/sdk/chair.ts) that builds every instruction and decodes every account without a framework. Instruction data is one tag byte followed by little-endian fields.

Addresses

import { configPda, treasuryPda, marketPda, marketAccounts, USDC_MINT } from "./chair";

const [config] = configPda();
const [market] = marketPda(2026, 12);              // DEC26
const { longMint, shortMint, vault } = marketAccounts(market);

Seeds: ["config"], ["treasury"], ["market", year u16 LE, month u8], ["long", market], ["short", market], ["vault", market].

Read a market

import { decodeMarket, longValue, RATE_UNITS_PER_PERCENT } from "./chair";

const info = await connection.getAccountInfo(market, "confirmed");
const m = decodeMarket(info!.data);

const collar = [m.collarLo / RATE_UNITS_PER_PERCENT, m.collarHi / RATE_UNITS_PER_PERCENT]; // [1.375, 6.375]
const soFar = m.daysAccounted ? Number(m.rateSum) / m.daysAccounted / RATE_UNITS_PER_PERCENT : null;
const settled = m.status === 1 ? m.settledAvg / RATE_UNITS_PER_PERCENT : null;

longValue(avgUnits, lo, hi) returns the LONG payout in dollars for any average, the same rule the program applies. impliedAverage(longPrice, lo, hi) turns a LONG price back into the average it implies, and averageSoFar(m) gives the unrounded average over folded days.

Mint a pair

import { mintPairWithAccounts } from "./chair";

// 25 pairs = 25,000,000 base units; adds the two idempotent token-account creates
const ixs = mintPairWithAccounts(wallet.publicKey, market, 25_000_000n);
const tx = new Transaction().add(...ixs);

The first mint in a month is the largest user transaction at 659 bytes as a legacy transaction with one signer, inside the wallet budget without a lookup table. Simulate before asking for a signature and set the compute limit from the simulation.

Redeem

import { redeemPair, redeemSettled, Side } from "./chair";

redeemPair(wallet.publicKey, market, 10_000_000n);                // 10 LONG + 10 SHORT -> $10
redeemSettled(wallet.publicKey, market, Side.Long, 25_000_000n);  // after settlement

Errors

Program errors arrive as custom program error: 0x... errorName(code) from the SDK turns the number into its name; see the error reference.

Running the keeper

The keeper reads the NY Fed API (/api/rates/unsecured/effr/...), and for each market posts every new print with postPrint(poster, market, yyyymmdd, rateUnits, isFinal) after 19:30 UTC on the day after its date. It resumes from chain state alone: the latest pending or folded date in the market tells it what to post next.