Test the SDK
Verify @bento.fun/sdk from npm with the integration sandbox before shipping your app.
Use the sdk-sandbox repo, a standalone project that installs @bento.fun/sdk from npm rather than a local link. This catches publish issues, broken exports, and live API mismatches early.
By the end: you'll have run the published SDK against the live API in a clean project.
Setup
git clone https://github.com/Bentodotfun/sdk-sandbox.git
cd sdk-sandbox
cp .env.example .env
# BENTO_URL=https://internal-server.bento.fun
# BENTO_BUILDER_API_KEY=bnt_… # mint at docs /concepts/builder-api-key
# PARLAY_TOURNAMENT_URL=https://your-tournaments-host
npm install
npm run test:import # start here: no network
npm test # full live public API checksWhat npm test runs
| Step | Checks |
|---|---|
| import-smoke | Package imports, createBentoSdk() factory |
| markets-public | listDuels, protocolStats, getDuelById (with duelId) |
| tournaments-public | tournaments.list |
Individual scripts:
npm run test:import
npm run test:markets
npm run test:tournamentsEnvironment
| Variable | Purpose |
|---|---|
BENTO_URL | Markets host (https://internal-server.bento.fun) |
BENTO_BUILDER_API_KEY | Builder API key (createBentoSdk requires it) |
PARLAY_TOURNAMENT_URL | Tournaments host |
Omit PARLAY_TOURNAMENT_URL to skip tournaments checks.
When to run
- After publishing a new
@bento.fun/sdkversion to npm - Before updating docs examples or integration guides
- When debugging “works locally but not from npm”
- Onboarding new developers or interns testing the SDK
Where a mismatch comes from
| Symptom | What it means, and what to do |
|---|---|
| A route or method the SDK calls is wrong or missing | An SDK bug. Pin your last working @bento.fun/sdk version, report it to the Bento team; the fix ships in a new release. |
| A code example in these docs is wrong | A docs bug. Report it; check the changelog for a corrected pattern. |
| A gap in your test coverage | Add a case to your sdk-sandbox clone. |
| A response shape or field changed | Upgrade to the latest @bento.fun/sdk; its types track the API. See the changelog. |
| A response shape you did not expect | Confirm you are on the latest SDK, then see common patterns (duelId, wrapped responses, auth). |
Related
- sdk-sandbox on GitHub
- Common patterns:
duelId, wrapped responses, auth