-
Notifications
You must be signed in to change notification settings - Fork 220
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
Showing
4 changed files
with
65 additions
and
0 deletions.
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
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,52 @@ | ||
//! `/genesis` endpoint JSON-RPC wrapper | ||
|
||
use alloc::{string::String, vec::Vec}; | ||
use serde::{Deserialize, Serialize}; | ||
use tendermint_proto::serializers; | ||
|
||
use crate::{dialect::Dialect, request::RequestMessage}; | ||
|
||
/// Get the genesis state in multiple chunks for the current chain | ||
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] | ||
pub struct Request { | ||
pub chunk: Option<String>, | ||
} | ||
|
||
impl Request { | ||
pub fn new(chunk: Option<String>) -> Self { | ||
Self { chunk } | ||
} | ||
} | ||
|
||
impl RequestMessage for Request { | ||
fn method(&self) -> crate::Method { | ||
crate::Method::GenesisChunked | ||
} | ||
} | ||
|
||
impl<S> crate::Request<S> for Request | ||
where | ||
S: Dialect, | ||
{ | ||
type Response = Response; | ||
} | ||
|
||
impl<S> crate::SimpleRequest<S> for Request | ||
where | ||
S: Dialect, | ||
{ | ||
type Output = Response; | ||
} | ||
|
||
/// Block responses | ||
#[derive(Clone, Debug, Deserialize, Serialize)] | ||
pub struct Response { | ||
#[serde(with = "serializers::from_str")] | ||
pub chunk: u64, | ||
#[serde(with = "serializers::from_str")] | ||
pub total: u64, | ||
#[serde(with = "serializers::bytes::base64string")] | ||
pub data: Vec<u8>, | ||
} | ||
|
||
impl crate::Response for Response {} |
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