Crates.io | toncenter |
lib.rs | toncenter |
version | 0.1.0 |
source | src |
created_at | 2024-06-09 07:25:28.985174 |
updated_at | 2024-06-09 07:25:28.985174 |
description | SDK for integrating Toncenter into Rust applications. |
homepage | |
repository | https://github.com/liketurbo/toncenter-rs |
max_upload_size | |
id | 1266216 |
size | 82,510 |
SDK for integrating Toncenter into Rust applications. Connect and interact with the Toncenter API effortlessly.
# Cargo.toml
[dependencies]
toncenter = "0.1.0"
use toncenter::client::{ApiClientV2, ApiKey, Network};
#[tokio::main]
async fn main() {
let api_key = "a8b61ced4be11488cb6e82d65b93e3d4a29d20af406aed9688b9e0077e2dc742".to_string();
let address = "0QCbOix87iy37AwRCWaYhJHzc2gXE_WnAG5vVEAySNT7zClz";
let api_client = ApiClientV2::new(Network::Testnet, Some(ApiKey::Header(api_key)));
match api_client.get_address_information(address).await {
Ok(info) => println!("Address info: {:#?}", info),
Err(e) => {
eprintln!("{:?}", e);
}
}
let params = serde_json::json!({
"address": address,
});
match api_client
.json_rpc("getAddressInformation", params, serde_json::json!(1))
.await
{
Ok(response) => println!("Response: {:#?}", response),
Err(e) => {
eprintln!("{:?}", e);
}
};
}
Contributions to this library is welcomed! If you'd like to contribute, please feel free to open a pull request on GitHub.
This project is licensed under the MIT License.
Special thanks to the Toncenter team for providing a robust API to interact with the TON blockchain.