Crates.io | covalent_class_a |
lib.rs | covalent_class_a |
version | 0.1.3 |
source | src |
created_at | 2022-05-22 14:31:41.947195 |
updated_at | 2022-05-23 09:39:10.156874 |
description | Rust wrapper for the Covalent Class A Endpoints https://www.covalenthq.com/docs/api |
homepage | https://github.com/mark-ruddy/covctl/tree/main/covalent_class_a |
repository | https://github.com/mark-ruddy/covctl/tree/main/covalent_class_a |
max_upload_size | |
id | 591155 |
size | 36,822 |
Rust wrapper for the Covalent Class A Endpoints: https://www.covalenthq.com/docs/api
Set your API key as an environment variable: export COVALENT_API_KEY=<YOUR_API_KEY>
, or you can use the CovalentClient::new("8217", "<YOUR_API_KEY>")
function to pass the API key in as a code parameter
In the below example a client is created which will use the Klaytn Mainnet(8217) and a unified covalent API call is made to the Get Token Balances endpoint:
let klaytn_client = covalent_class_a::CovalentClient::new_env_api_key("8217").unwrap();
let balances: covalent_class_a::resources::BalancesData = klaytn_client.get_token_balances("0xf4024faad5fafd0755875e3161524c9c4e1a1111", None, None).await.unwrap();
println!("Address: {}", balances.data.address);
For more examples see the docs: https://docs.rs/covalent_class_a/0.1.1/covalent_class_a/struct.CovalentClient.html
See covctl
at https://github.com/mark-ruddy/covctl for the CLI interface to this library
The tests will send actual API calls to the covalent API. They require an API key to be set in the environment variable COVALENT_API_KEY:
export COVALENT_API_KEY=<YOUR_API_KEY>
cargo test
The tests cover that the API calls for each library method return successfully and in some tests check for specific expected data.