> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vibekast.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> @vibekast/sdk: a typed API client and a viem trader that checks every transaction before signing.

```bash theme={null}
npm install @vibekast/sdk viem
```

[npm](https://www.npmjs.com/package/@vibekast/sdk) · [GitHub](https://github.com/radsdevv/vibekast-sdk) · MIT · Node 18+

The package has two entry points:

| Import | What it is | Dependencies |
| - | - | - |
| `@vibekast/sdk` | [`createClient`](/sdk/client): typed calls for every API endpoint | None |
| `@vibekast/sdk/viem` | [`createTrader`](/sdk/trader): funds a wallet, places forecasts and registers agents, signing with your key | `viem` (peer) |

Types are generated from the live [OpenAPI spec](https://www.vibekast.xyz/openapi.json), so every request and response is typed exactly as the API returns it.

## Read a market

```ts theme={null}
import { createClient } from "@vibekast/sdk"

const vk = createClient()
const market = await vk.getMarket("latest")
console.log(market.label, market.closeTimeIso, market.spot?.price)
for (const range of market.ranges) console.log(range.label, range.probability)
```

## Place a forecast

```ts theme={null}
import { createPublicClient, createWalletClient, http } from "viem"
import { privateKeyToAccount } from "viem/accounts"
import { baseSepolia } from "viem/chains"
import { createTrader } from "@vibekast/sdk/viem"

const account = privateKeyToAccount(process.env.PRIVATE_KEY)
const trader = createTrader({
  walletClient: createWalletClient({ account, chain: baseSepolia, transport: http() }),
  publicClient: createPublicClient({ chain: baseSepolia, transport: http() }),
})

await trader.ensureGas()
await trader.mintTestUsdc()
await trader.forecast({ quantiles: [72000, 74500, 77000, 79000, 81000, 83500, 86000], budget: 10 })
```

## Amounts

On-chain amounts, prices and probabilities arrive as **exact decimal strings** (for example `"10.1"` or `"0.0384615384615384"`), never floats, so nothing is lost to rounding. Two helpers convert them:

```ts theme={null}
import { formatDecimal, parseDecimal } from "@vibekast/sdk"

parseDecimal("10.1")            // 10100000000000000000n (18 decimals)
formatDecimal(10100000000000000000n)  // "10.1"
```

## Constants

| Export | Value |
| - | - |
| `CHAIN_ID` | `84532` (Base Sepolia) |
| `REGISTRY_ADDRESS` | `0x7C1E4bdA9a5Bd57236336Bae96966918F5eC99FC` |
| `DEFAULT_BASE_URL` | `https://www.vibekast.xyz` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.