Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Develop WalletKit

This page describes how to set up a development environment and run the checks that CI runs. For platform bindings, see iOS and Swift, Android and Kotlin, and the browser package.

Before you begin

  • Install Nix. The repository’s flake provides development shells with pinned toolchains: default for host development, android for Android, wasm for WebAssembly, and docs for this book. Without Nix, you can run the same shells in Docker; see Nix development environments.
  • To run the integration tests, install Foundry. The tests use Anvil to fork World Chain from the RPC endpoint in WORLDCHAIN_RPC_URL, which defaults to the public World Chain RPC. You can set it in a .env file.

Run every command on this page from the repository root.

Lint and format

WalletKit gates code paths behind Cargo features, so a warning can appear in only one feature combination. To lint every combination, as CI does, run the following commands:

nix develop --command cargo clippy --workspace --all-targets --all-features -- -D warnings
nix develop --command cargo clippy --workspace --all-targets -- -D warnings
nix develop --command cargo clippy --workspace --all-targets --no-default-features -- -D warnings

To check formatting, run the following command:

nix develop --command cargo fmt -- --check

Test

To run the workspace tests with the default features, run the following command:

nix develop --command cargo test --workspace

CI runs the tests with all features enabled, using cargo nextest, on several Rust toolchains. Locally, --all-features also enables compress-zkeys, which makes every test that loads the proving keys decompress them, so expect much slower runs.

Write documentation

The sources of this book are in docs/, and docs/SUMMARY.md defines its table of contents. To preview the book while you edit it, run the following command and open the URL that it prints:

nix develop .#docs --command mdbook serve

Link to other pages of the book with relative paths. Link to files outside docs/ with absolute GitHub URLs, because the book is served without the rest of the repository.

The docs.yml workflow builds the book and publishes it to GitHub Pages on every push to main. Pull requests don’t build the book, so preview your changes locally with mdbook serve before you merge them.