Introduction
This documentation covers Kaspa WASM SDK - Rust infrastructure (Rusty Kaspa) WASM bindings that allow Rust code to be used from within JavaScript/TypeScript environments.
Please contribute! This mdbook
is very easy to edit. If you would like to suggest any changes or add anything, please check the Contributing page.
Technologies
This project is built using multi-platform Rust crates (libraries). The Rust framework is exposed to JavaScript via WASM, while the Rust framework itself can be built to run on any native platform (i.e. for Windows, Linux and MacOS).
WASM32 is compatible with all major browsers and Node.js as well as environments such as NWJS.
WASM SDK
This WASM SDK is generated directly from the Rusty Kaspa codebase, where Rust functions are compiled into WebAssembly and then are offered in the JavaScript environment as native JavaScript functions.
Since the WASM SDK has an integrated WebSocket support, it offers RPC connectivity turning all RPC calls into async function calls in JavaScript (in Rust these functions are also async).
The WASM SDK offers bindings for Transaction generation, address management, transaction signing as well as various helper classes for UTXO management.
Documentation
Please note that documentation is very much a work in progress.
JavaScript and Rust API documentation is available at the following URLs:
- Rust documentation (Rustdoc)
- JavaScript documentation (JSDoc)
Various examples can be found here:
Discord
You can find help on the Kaspa Discord server, in the #development
channel.
Redistributables
WASM redistributables are available prebuilt for web browsers and for nodejs. The entire framework can also be built from Rusty Kaspa sources (into WASM) or used within Rust directly for Rust-based application integration.
You can currently download the latest version of the WASM SDK and the gRPC proxy from: https://aspectron.com/en/projects/kaspa-wasm.html
Git
This SDK is a part of a larger Rusty Kaspa framework available at https://github.com/rusty-kaspa/rusty-kaspa
The following crates implement key functionality exposed by this SDK:
- Kaspa Consensus Core: https://github.com/kaspanet/rusty-kaspa/tree/master/consensus/core/src
- WASM SDK: https://github.com/kaspanet/rusty-kaspa/tree/master/wasm
- Wallet Core: https://github.com/kaspanet/rusty-kaspa/tree/master/wallet/core/src
- RPC Client: https://github.com/kaspanet/rusty-kaspa/tree/master/rpc/wrpc/client/src