chia-client
is a simple Rust library to interact with the Chia RPC API (fullnode/wallet/harvester). Currently, most of the RPC endpoints are available and some utility functions to encode and decode puzzle hashes.
To use chia-client
in your Rust project, add the following to your Cargo.toml:
[dependencies]
chia-client = { git = "https://github.com/mpwsh/chia-client" }
Please checkout a basic example at ./examples/get_balance.rs
Run the example:
cargo run --example get_balance
#output
Balance: 0.000000000001 XCH
There's another example to create a simple CLI
called chiactl
to get balance as well, that you can expand with more useful commands.
Update the contents of ./examples/ctlconfig.yaml to suit your needs, and then run the following to fetch the balance for a wallet address:
cargo run --example chiactl -- get balance <wallet_address> --config examples/ctlconfig.yaml
Get 'transactions' for a given wallet
cargo run --example chiactl -- get transactions <wallet_address> --config examples/ctlconfig.yaml
You could also provide these values using command arguments, or specify the path of the config file in an arg as well. Use --help to get all available arguments.
More commands:
cargo run --example chiactl -- get blockchain --config examples/ctlconfig.yaml
cargo run --example chiactl -- get network --config examples/ctlconfig.yaml
cargo run --example chiactl -- get blockmetrics --config examples/ctlconfig.yaml
cargo run --example chiactl -- get block 3392968 --config examples/ctlconfig.yaml
All get
commands
SUBCOMMANDS:
balance
block
blockchain
blockmetrics
coin
network
transactions
If you'd like to contribute to the development of chia-client
, feel free to submit a pull request or create an issue on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for more information.
This is a fork of crate chia-node-rs
from Mike Cronce: https://gitlab.cronce.io/foss/`chia-client`
Please note that this library is provided "as-is" and the author is not responsible for any harm or misuse that may arise from the use of this library. Users are advised to use this library at their own risk and are encouraged to review the source code and understand the workings of the library before using it in any application or project.