Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trepa.io/llms.txt

Use this file to discover all available pages before exploring further.

Most automation stays on trepa.bots.run. The tables below are for everything else: manual prediction calls, rewards, withdrawals, raw HTTP, and configuration you rarely touch on day one. Multiple bots in one process (see Swarms) mean several { apiKey, privateKey } entries inside credentials. For full HTTP field lists, open the API Reference tab in the sidebar.

The client

import { credentialsFromEnv, Trepa } from '@trepa/sdk'

const trepa = new Trepa({ credentials: credentialsFromEnv() })

Trepa configuration

new Trepa({ ... }) accepts:
FieldPurpose
credentialsList of { apiKey, privateKey }. One bot per entry when using bots.run.
baseUrlTrepa API origin (defaults to production).
solanaRpcUrlSolana HTTPS RPC URL for on-chain helpers. Defaults to https://api.mainnet-beta.solana.com.
solanaRpcSubscriptionsUrlSolana WebSocket RPC URL. Defaults to wss://api.mainnet-beta.solana.com.
The client exposes:
NamespacePurpose
trepa.botsPrimary: prediction loop with predict and optional hooks.
trepa.authCurrent user, refresh, logout.
trepa.usersProfiles, predictions, statistics, portfolios.
trepa.poolsList and fetch pools.
trepa.streaksBitcoin streak helpers, pool details, streak rewards.
trepa.predictionsCreate, update value, update stake (outside bots.run if you build your own flow).
trepa.rewardsClaim pool payouts.
trepa.withdrawalsSend USDC to an external wallet.
trepa.rawTyped HTTP escape hatch with the same auth jar.

auth

trepa.auth.me()
trepa.auth.refresh()
trepa.auth.logout()
refresh() is rarely needed. The SDK refreshes on 401 / 403 automatically.

users

trepa.users.get(userId, {})
trepa.users.predictions(userId, {})
trepa.users.statistics(userId)
trepa.users.portfolio(userId)
trepa.users.streakDetails(userId, streakId)
Pass filters and includes in the second argument where the API supports them (see API Reference).

pools

trepa.pools.list({})
trepa.pools.get(poolId, {})

streaks

trepa.streaks.bitcoin()
trepa.streaks.poolDetails(streakId)
trepa.streaks.pools(streakId, { ... })
trepa.streaks.userDetails(streakId, {})
trepa.streaks.claimReward({ streakRewardId })
claimReward builds, signs, and submits on-chain work. It needs privateKey on the matching credential.

predictions

trepa.predictions.create({ poolId, value, stake })
trepa.predictions.update({ predictionId, value })
trepa.predictions.updateStake({ predictionId, stake })
Each call is end-to-end (build, sign, submit) and needs privateKey on the credential.

rewards

trepa.rewards.claim({ poolId, rewardId })
To surface rewards next to predictions, pass includes on the predictions query:
const me = await trepa.auth.me()
const predictions = await trepa.users.predictions(me.id, {
  includes: ['reward'],
})

withdrawals

trepa.withdrawals.create({ toAddress, amount, mintAddress })
Withdrawals are heavily rate-limited. Read Rate limits.

bots

await trepa.bots.run({
  predict: (pool) => ({ value: 65_000, stake: pool.min_stake }),
})
predict can take (pool, ctx). Hooks onStart, onPredicted, onPoolSkipped, onError are documented in Writing bots. Multi-account ctx details are in Swarms.

raw

const { data } = await trepa.raw.GET('/pools/{id}', {
  params: { path: { id: poolId } },
})
Needing raw for something common is a good reason to open an issue so the typed helpers can grow.

Errors

Non-2xx responses throw TrepaError:
import { isTrepaError } from '@trepa/sdk'

try {
  await trepa.predictions.create({ poolId, value, stake })
} catch (err) {
  if (!isTrepaError(err)) throw err
  console.error(err.status, err.code, err.message, err.body)
}

Helpers

import { signTransaction } from '@trepa/sdk'
signTransaction signs a base64 Solana transaction with a base58 secret key. Resource methods call it internally. Next: Direct REST access.
Last modified on May 2, 2026