-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for
GetWinningBakersEpoch
(#117)
* GetWinningBakersEpoch * Example for getting winning bakers. * Formatting. * Changelog. * Address review comments. * Doc. * Address review comments.. * Implement `GetFirstBlockEpoch` and example. (#119) * Fix. * Fix a fix. * Doc. * Better documentation for `get_winning_bakers_epoch`. * Fix links
- Loading branch information
1 parent
7dbaf45
commit 4a35d6f
Showing
6 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//! Test the `GetFirstBlockEpoch` endpoint. | ||
use anyhow::Context; | ||
use clap::AppSettings; | ||
use concordium_rust_sdk::v2; | ||
use structopt::StructOpt; | ||
|
||
#[derive(StructOpt)] | ||
struct App { | ||
#[structopt( | ||
long = "node", | ||
help = "GRPC interface of the node.", | ||
default_value = "http://localhost:20000" | ||
)] | ||
endpoint: v2::Endpoint, | ||
|
||
#[structopt(long = "epoch", help = "Epoch identifier", default_value = "%5,0")] | ||
epoch: v2::EpochIdentifier, | ||
} | ||
|
||
#[tokio::main(flavor = "multi_thread")] | ||
async fn main() -> anyhow::Result<()> { | ||
let app = { | ||
let app = App::clap().global_setting(AppSettings::ColoredHelp); | ||
let matches = app.get_matches(); | ||
App::from_clap(&matches) | ||
}; | ||
|
||
let mut client = v2::Client::new(app.endpoint) | ||
.await | ||
.context("Cannot connect.")?; | ||
let fb = client.get_first_block_epoch(app.epoch).await?; | ||
println!("{:?}", fb); | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! Test the `GetWinningBakersEpoch` endpoint. | ||
use anyhow::Context; | ||
use clap::AppSettings; | ||
use concordium_rust_sdk::v2; | ||
use futures::StreamExt; | ||
use structopt::StructOpt; | ||
|
||
#[derive(StructOpt)] | ||
struct App { | ||
#[structopt( | ||
long = "node", | ||
help = "GRPC interface of the node.", | ||
default_value = "http://localhost:20000" | ||
)] | ||
endpoint: v2::Endpoint, | ||
|
||
#[structopt(long = "epoch", help = "Epoch identifier", default_value = "%5,1")] | ||
epoch: v2::EpochIdentifier, | ||
} | ||
|
||
#[tokio::main(flavor = "multi_thread")] | ||
async fn main() -> anyhow::Result<()> { | ||
let app = { | ||
let app = App::clap().global_setting(AppSettings::ColoredHelp); | ||
let matches = app.get_matches(); | ||
App::from_clap(&matches) | ||
}; | ||
|
||
let mut client = v2::Client::new(app.endpoint) | ||
.await | ||
.context("Cannot connect.")?; | ||
let mut wbs = client.get_winning_bakers_epoch(app.epoch).await?; | ||
while let Some(wb) = wbs.next().await { | ||
println!("{:?}", wb?); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters