Build

TypeScript SDK

One TypeScript file. It reads rounds through this site's API and takes sides with any viem wallet client, so your key stays with you.

Install

curl -O https://<site>/sdk/liquidrise.ts      # TypeScript source
curl -O https://<site>/sdk/liquidrise.mjs     # the same, compiled
npm i viem

Read a round

import { LiquidRise } from "./liquidrise";

const lr = new LiquidRise({ baseUrl: "https://<site>" });
const r = await lr.getRound();
console.log(r.day, r.target, r.pot, r.hypercore.yes);
console.log(lr.potOdds(r));            // { yes: 0.5, hypercoreYes: 0.094, gap: 0.406 }

Take a side

import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { robinhood } from "./liquidrise";

const wallet = createWalletClient({ account: privateKeyToAccount(KEY), chain: robinhood, transport: http() });
const tx = await lr.takeSide({ wallet, side: "YES", usdg: "0.1" });
console.log("https://robinhoodchain.blockscout.com/tx/" + tx);

takeSide calls buildSide, then sends the approval (when the allowance is short) and the side from your wallet client and waits for each receipt. With x402, call lr.x402Side({ wallet, side, usdg }) instead: it signs the USDG authorization and the relayer pays the gas. claim(wallet, day) pulls a payout yourself.

getRound()getRounds()potOdds(r)buildSide()takeSide()x402Side()
The SDK's surface.