-
Notifications
You must be signed in to change notification settings - Fork 52
feat: add support for Mithril era transition in clients #2633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
94cfe51
8b7959b
f62d1e6
3b684b8
6b428a3
ff7eb10
bd04860
8416957
2cbe20d
e729c13
84aa3b0
26935c3
2dc358e
4987ae5
1ffc3da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| use async_trait::async_trait; | ||
|
|
||
| use mithril_client::{ | ||
| MithrilResult, | ||
| era::{EraFetcher, FetchedEra}, | ||
| }; | ||
|
|
||
| pub struct ForcedEraFetcher { | ||
| era: String, | ||
| } | ||
|
|
||
| impl ForcedEraFetcher { | ||
| pub fn new(era: String) -> Self { | ||
| Self { era } | ||
| } | ||
| } | ||
|
|
||
| #[async_trait] | ||
| impl EraFetcher for ForcedEraFetcher { | ||
| async fn fetch_current_era(&self) -> MithrilResult<FetchedEra> { | ||
| Ok(FetchedEra { | ||
| era: self.era.clone(), | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[tokio::test] | ||
| async fn fetch_current_era_returns_fetched_era_with_forced_era_value() { | ||
| let era_fetcher = ForcedEraFetcher::new("forced_era".to_string()); | ||
|
|
||
| let fetched_era = era_fetcher.fetch_current_era().await.unwrap(); | ||
|
|
||
| assert_eq!( | ||
| FetchedEra { | ||
| era: "forced_era".to_string(), | ||
| }, | ||
| fetched_era | ||
| ); | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.