Browser SDK Reference
The browser build of the Clarinet SDK lets you interact with simnet directly from web experiences, so you can run Clarity tests without standing up a Node.js server.
Installation
npm install @stacks/clarinet-sdk-browserUsage
The browser SDK implements the same API as the Node.js Clarinet SDK. All methods, properties, and custom matchers work identically.
Empty session
import { initSimnet } from '@stacks/clarinet-sdk-browser';
const simnet = await initSimnet();
await simnet.initEmptySession();
// Execute Clarity code directly
const result = simnet.runSnippet("(+ 1 2)");
console.log(result); // 3With a Clarinet project
For testing with an existing Clarinet project using a virtual file system:
Common use cases
Interactive contract playground
Testing in browser-based IDEs
Browser compatibility
The browser SDK works in all modern browsers that support:
ES2020+ JavaScript features
WebAssembly
Dynamic imports
Tested browsers include:
Chrome/Edge 90+
Firefox 89+
Safari 15+
Last updated
Was this helpful?
