Developers
TypeScript SDK
Install
The SDK is one ES module served from this site, with its types next to it. It uses four packages from npm.
curl -sO https://<this site>/sdk/hyperwafer.mjs
curl -sO https://<this site>/sdk/hyperwafer.d.ts
npm i @solana/web3.js @solana/spl-token tweetnacl bs58Calls and batches
import { createClient } from "./hyperwafer.mjs";
const hw = createClient({ url: "https://<this site>/rpc" });
const book = await hw.call("hyper_getBook", { coin: "BTC", depth: 5 });
const ok = await hw.verify("hyper_getBook", { coin: "BTC", depth: 5 }, book);
const { json } = await hw.batch([["getSlot"], ["hyper_getFunding", { coin: "SOL" }]]);Paying
Give the client a payer keypair that holds USDC and it answers 402s itself. alwaysPay: true skips the free tier, which is what the house agent does every hour.
const hw = createClient({ url: "https://<this site>/rpc", payer: Keypair.fromSecretKey(secret) });
const { payment } = await hw.batch([["hyper_getFunding", { coin: "BTC" }]]);
// payment.transaction is the Solana signature of the USDC transferTypes
hyperwafer.d.ts types the client, the result envelope and the proof.