/
v3.0.11Get access

Swarm SDK overview

283 documented methods

Swarm SDK is the sportsbook core of BetChain Core — a typed interface to the Betchain sportsbook platform over WebSocket and HTTP. Open one session, then read live odds and scores, place and settle bets, and manage player accounts and responsible-gaming limits through the same set of React hooks.

What you can build

Live sports data feedsSubscribe to sports, competitions, games, markets and odds, and receive updates as the platform pushes them.
Betting & cashout flowsBuild betslips, place bets, follow settlement and trigger manual or automatic cashout.
Player accounts & 2FARegistration, login, two-factor authentication, verification, balances and banking.
Responsible gaming limitsRead and write deposit, bet, loss and session-duration limits, plus self-exclusion schedules.

How it works

The SDK wraps the Betchain WebSocket and HTTP APIs behind a small set of composable primitives. One session, opened once at app start, backs every subsequent call.

Your React appcomponents + hooks
session handshakeinitSwarmSession()
Swarm SDKinitSwarmSession + hooks
subscribe / requestuseSwarmSubscription · useSwarmGetOnce
TransportWebSocket · HTTP
reconnectonReconnectSuccess
Betchain platformsportsbook services

Choose your call pattern

Every documented method is reachable in more than one way. Pick the pattern that matches how often the data changes.

PatternTransportUpdatesUse it whenReconnects
useSwarmGetOnceWebSocketOnceSnapshot data inside a component: competitions, catalogs, balances.On dependency change
useSwarmSubscriptionWebSocketStreamingAnything that moves: live odds, scores, match state, notifications.Automatic
Direct method callWebSocketPromiseImperative flows outside React: place a bet, log in, log out.Manual

What the SDK guarantees

Typed end to endEvery method ships with request and response type declarations, and the hooks infer their result type from the method reference you pass in.
One client, two transportsStreaming subscriptions and one-off requests share the same session, so you only configure and authenticate once. See the quickstart
Errors come back as dataMethods and hooks resolve with hasError and message alongside the payload, so a failed call does not throw in normal operation. Error codes
Private distributionThe package is published to the private BetChain registry (sdk.betconstruct.com/npm). You need an authenticated .npmrc before it will install. Installation

Requirements

Package@softconstruct/betchain-core-client
Version3.0.11
React19.x (peer dependency)
Module formatESM only
Entry points/swarm · /hooks
Registrysdk.betconstruct.com/npm

Next steps

01InstallationSet up private registry access and install the package.Installation
02QuickstartInitialize a session and make your first call.Quickstart
Was this page helpful?