Struct barreleye_client::Network
source · pub struct Network { /* private fields */ }
Implementations§
source§impl Network
impl Network
sourcepub async fn create(
client: &Barreleye,
name: &str,
tag: &str,
env: Env,
blockchain: Blockchain,
chain_id: u64,
block_time_ms: u64,
rpc_endpoints: Vec<&str>,
rps: u32
) -> Response<Self>
pub async fn create(
client: &Barreleye,
name: &str,
tag: &str,
env: Env,
blockchain: Blockchain,
chain_id: u64,
block_time_ms: u64,
rpc_endpoints: Vec<&str>,
rps: u32
) -> Response<Self>
Examples found in repository?
examples/create_new_network.rs (lines 12-22)
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn main() {
// Define the client
let url = "http://localhost:22775";
let api_key = Some("7f9e9182-122d-45e1-b4be-d73fc99e9bc9");
let client = Barreleye::new(url, api_key);
// Create a new network
let rpc_endpoint = "http://127.0.0.1:8545";
let network = Network::create(
&client,
"Ethereum", // name
"Ethereum", // tag
Env::Mainnet, // env
Blockchain::Evm, // blockchain
1, // chain id
12_000, // block time in milliseconds
vec![rpc_endpoint], // rpc endpoints
100, // rate limiter (requests per second)
)
.await;
println!("{:?}", network);
}
pub async fn list(client: &Barreleye) -> Response<Vec<Self>>
pub async fn get(client: &Barreleye, id: &str) -> Response<Self>
pub async fn update(
client: &Barreleye,
id: &str,
data: NetworkData
) -> Response<()>
pub async fn delete(client: &Barreleye, id: &str) -> Response<()>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Network
impl<'de> Deserialize<'de> for Network
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more