Interact with Chains
You can get a chain client by calling the chain
's name method on the Kiln
struct.
src/main.rs
use kilnfi_connect_rs::Kiln;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_token: String = std::env::var("KILN_API_TOKEN")
.expect("KILN_API_TOKEN is not set in the environment. It is required.");
let kiln: Kiln = Kiln::builder()
.api_token(api_token)
// no trailing slash, or else it will break
.base_url("https://api.kiln.fi/v1")
.seal()
.build()?;
let dydx_client = kiln.dydx();
let cosmos_client = kiln.cosmos();
let ethereum_client = kiln.ethereum();
let cardano_client = kiln.cardano();
let fetch_ai_client = kiln.fetch_ai();
let injective_client = kiln.injective();
let solana_client = kiln.solana();
let tezos_client = kiln.tezos();
let zetachain_client = kiln.zetachain();
let polkadot_client = kiln.polkadot();
let osmosis_client = kiln.osmosis();
let noble_client = kiln.noble();
let near_client = kiln.near();
let multiversx_client = kiln.multiversx();
let kusama_client = kiln.kusama();
let kava_client = kiln.kava();
Ok(())
}
Most clients will implement the following API
( tx is short for transaction )
- get_stakes
- post_stakes
- get_rewards
- get_operations
- get_network_stats
- get_reports
- post_stake_tx
- post_withdraw_rewards_tx
- post_restake_rewards_tx
- post_unstake_tx
- post_redelegate_tx
- post_broadcast_tx
- get_tx_status
- get_tx_decoding