-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49ac075
commit 0922a39
Showing
9 changed files
with
201 additions
and
338 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,12 @@ | ||
[package] | ||
name = "http_api_common" | ||
version = "0.1.0" | ||
authors = ["Paul Hauner <[email protected]>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { version = "1.0.110", features = ["derive"] } | ||
types = { path = "../../consensus/types" } | ||
hex = "0.4.2" |
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,31 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use types::{Checkpoint, Hash256}; | ||
|
||
#[derive(Serialize)] | ||
pub struct GenericResponse<T: Serialize> { | ||
pub data: T, | ||
} | ||
|
||
impl<T: Serialize> From<T> for GenericResponse<T> { | ||
fn from(data: T) -> Self { | ||
Self { data } | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct RootData { | ||
pub root: Hash256, | ||
} | ||
|
||
impl From<Hash256> for RootData { | ||
fn from(root: Hash256) -> Self { | ||
Self { root } | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct FinalityCheckpointsData { | ||
pub previous_justified: Checkpoint, | ||
pub current_justified: Checkpoint, | ||
pub finalized: Checkpoint, | ||
} |