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

Developing the SDK

Bindings

  • Define shared behavior and errors in Rust.
  • Regenerate bindings after API changes.
  • Keep UniFFI and browser binding tools compatible.
  • Generate Apple artifacts before opening Xcode.
  • Embed and sign the XCFramework in the app.
  • Test WASM in browsers. Compilation cannot catch every platform limitation.

Testing

just test sdk runs three layers:

LayerChecks
RustBehavior and errors
BindingsPayloads, callbacks, and async work
PackagesArtifact loading and initialization

Apple tests require macOS and Xcode. They are skipped elsewhere. Browser tests run in Chromium, Firefox, and WebKit.

For focused checks, use these commands from the repository root.

Swift contracts:

cargo run --manifest-path tools/Cargo.toml -- check-sdk-bindings apple

Browser:

just generate sdk web
npm test --workspace @eigin/sdk

Adding coverage

  • Test behavior and errors in Rust.
  • Add host tests for new binding contracts.
  • Use ContractTestCase.check in Swift.
  • Call browser cases in contracts.ts from contracts.spec.ts.
  • Keep test-only exports in binding_tests, behind binding-tests.
  • Test async success and failure. Use one operation per case and set timeouts.
  • Test platform-sensitive operations in browsers.

References