Clarinet SDK Workspace

May 18, 2026 ยท View on GitHub

This workspace regroups @stacks/clarinet-sdk for node.js and @stacks/clarinet-sdk-browser for web browsers.
They respectively rely on @stacks/clarinet-sdk-wasm and @stacks/clarinet-sdk-browser-wasm.

Because of the way the wasm packages are build, with wasm-pack, it made sense to have two different packages for Node.js and the browsers, but it has some caveats. Especially, some of the code is duplicated in ./browser/src/sdkProxy.ts and ./node/src/sdkProxy.ts. In the future, we hope to be able to simplify this build, it would require some breaking changes so it could be part of Clarinet 3.x.

Contributing

The clarinet-sdk requires a few steps to be built and tested locally.

Clone the clarinet repo and cd into it:

git clone git@github.com:stx-labs/clarinet.git
cd clarinet

Open the SDK workspace in VSCode, it's especially useful to get rust-analyzer to consider the right files with the right cargo features.

code components/clarinet-sdk/clarinet-sdk.code-workspace

The SDK mainly relies on two components:

  • the Rust component: components/clarinet-sdk-wasm
  • the TS component: components/clarinet-sdk

To work with these two packages locally, the first one needs to be built with wasm-pack (install wasm-pack).

# install dependencies without running prepare scripts
# (the SDK packages' `prepare` hook depends on the wasm build,
# which doesn't exist yet on a fresh clone)
pnpm install --ignore-scripts
# build the wasm package
pnpm run build:sdk-wasm
# install dependencies and build the node package
pnpm install
# make sure the installation works
pnpm test

Release

The Node.js and browser versions can be published with this single command. Make sure to check the check both packages versions first.

# the wasm package must be published first
# $ pnpm run publish:sdk-wasm
pnpm run publish:sdk