substrate-api-client a library written in Rust for connecting to the substrate's RPC interface via WebSockets allowing to
no_std
buildsIn order to build the substrate-api-client and the examples, Rust and the wasm target are needed. For Linux:
curl https://sh.rustup.rs -sSf | sh
rustup default nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
For more information, please refer to the substrate repository.
To execute the examples, a running substrate node is needed. A slightly extended node-template can be found at https://github.com/scs/substrate-api-client-test-node
To build the test node, execute the following steps:
git clone https://github.com/scs/substrate-api-client-test-node
cd substrate-api-client-test-node/
cargo build --release
Run the node:
./target/release/node-template --dev
There is a detailed tutorial in the tutorials folder.
To run an example, clone the substrate-api-client
repository and run the desired example directly with the cargo command:
bash
git clone https://github.com/scs/substrate-api-client.git
cd substrate-api-client
cargo run --example example_get_storage
Set the output verbosity by prepending RUST_LOG=info
or RUST_LOG=debug
.
The following examples can be found in the examples folder:
Parity offers a Rust client with similar functionality: https://github.com/paritytech/substrate-subxt
The development of substrate-api-client is financed by web3 foundation's grant programme.
We also thank the teams at