pub struct CovalentClient {
    pub base_url: String,
    pub chain_id: String,
    pub api_key: String,
}

Fields

base_url: Stringchain_id: Stringapi_key: String

Implementations

Create a new CovalentClient bound to a crtain chain_id

Klaytn Client Example
#[tokio::main]
async fn main() {
    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);
}

Create a new CovalentClient bound to a certain chain_id takes the environment variable COVALENT_API_KEY

#[tokio::main]
async fn main() {
// In shell: export COVALENT_API_KEY = <YOUR_API_KEY>
    let klaytn_client = covalent_class_a::CovalentClient::new_env_api_key("8217").unwrap();
// Make a get_token_balances request with pagination options page_size set to 10 and page_number set to 1
    let balances: covalent_class_a::resources::BalancesData = klaytn_client.get_token_balances("0xf4024faad5fafd0755875e3161524c9c4e1a1111", Some("10".to_string()), Some("1".to_string())).await.unwrap();
}

Get token balance information for an address

Get historicial portfolio values for an address

Get ERC20 Token Transfers for an address and token contract address

Get token holders at a block height for an address

Get changes in token holders between 2 block heights

Get transactions for an address

Get information on a single transaction

Get information on a block given a block height

Get block heights given a start and end date

Get log events by contract address within a start and end block

Get log events by topic hash(es)

Get all contract metadata

Get all chains

Get all chain statuses

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more