midgard_rs/
lib.rs

1#![warn(clippy::pedantic, clippy::nursery, clippy::all, clippy::cargo)]
2#![allow(clippy::multiple_crate_versions)]
3
4//! # Midgard
5//! Consumer information relating to swaps, pools, and volume. Midgard returns time-series information regarding the `THORChain` network, such as volume, pool information, users, liquidity providers and more. It also proxies to `THORNode` to reduce burden on the network. Runs on every node.
6//! 
7//! ## midgard-rs
8//! This crate aims to provide fully typed client for the `THORChain` Midgard API. 
9//! * By default it references the `https://midgard.thorswap.net/v2/` base url but this can be changed by creating a new `Configuration` object and passing it to the `Midgard::with_config()` method.
10//! * The client is rate limited to 1 request per second by default but this can be changed by creating a new `Configuration` object and passing it to the `Midgard::with_config()` method.
11//! 
12//! ## Basic Usage
13//! 
14//! ```rust
15//! use midgard_rs::Midgard;
16//! # tokio_test::block_on(async {
17//! let mut midgard = Midgard::new();
18//! let address = "thor102y0m3uptg0vvudeyh00r2fnz70wq7d8y7mu2g";
19//! let balance = midgard.get_balance(address, None, None).await.unwrap();
20//! assert!(*balance.get_height() > 0);
21//! # });
22//! ```
23//! 
24//! ## Configuration
25//! 
26//! ```rust
27//! use midgard_rs::Midgard;
28//! use midgard_rs::Configuration;
29//! # tokio_test::block_on(async {
30//! let config = Configuration::new("https://midgard.ninerealms.com/v2/".to_string(), 1000); // base_url, rate_limit_ms
31//! let mut midgard = Midgard::with_config(config);
32//! let address = "thor102y0m3uptg0vvudeyh00r2fnz70wq7d8y7mu2g";
33//! let balance = midgard.get_balance(address, None, None).await.unwrap(); // address, timestamp, height
34//! assert!(*balance.get_height() > 0);
35//! # });
36//! ```
37//! 
38
39pub(crate) use api::{api_get_action_list, api_get_balance, api_get_borrowers_details, api_get_borrowers_list, api_get_churn_list, api_get_depth_and_price_history, api_get_details_of_pool, api_get_earnings_history, api_get_global_stats, api_get_health_info, api_get_known_pool_list, api_get_liquidity_change_history, api_get_member_details, api_get_member_list, api_get_network_data, api_get_node_list, api_get_pool_list, api_get_savers_details, api_get_savers_units_and_depth_history, api_get_statistics_of_pool, api_get_swaps_history, api_get_thorname_details, api_get_thorname_owner, api_get_thorname_reverse_lookup, api_get_total_value_locked_history};
40pub use midgard::*;
41pub use types::*;
42
43mod api;
44mod midgard;
45mod types;
46
47