dusk-wallet-core 0.21.7
Install from the command line:
Learn more about npm packages
$ npm install @dusk-network/dusk-wallet-core@0.21.7
Install via package.json:
"@dusk-network/dusk-wallet-core": "0.21.7"
About this version
A WASM library to provide business logic for Dusk wallet implementations.
Check the available methods under the FFI module.
Every function expects a fat pointer to its arguments already allocated to the WASM memory. For the arguments definition, check the JSON Schema. It will consume this pointer region and free it after execution. The return of the function will also be in accordance to the schema, and the user will have to free the memory himself after fetching the data.
For maximum compatibility, every WASM function returns a i64
with the status of the operation and an embedded pointer. The structure of the bytes in big-endian is as follows:
[(pointer) x 4bytes (length) x 3bytes (status) x 1bit]
The pointer will be a maximum u32
number, and the length a u24
number. The status of the operation is the least significant bit of the number, and will be 0
if the operation is successful.
Here is an algorithm to split the result into meaningful parts:
let ptr = (result >> 32) as u64;
let len = ((result << 32) >> 48) as u64;
let success = ((result << 63) >> 63) == 0;
For an example usage, check the wallet-cli implementation that consumes this library.
- Rust 1.71.0
- target.wasm32-unknown-unknown
- binaryen to generate packages
To build a distributable package:
make package
To run the tests, there is an automated Makefile script
make test