Skip to main content

serialization_api/
lib.rs

1// Generated code - committed to git for visibility
2pub mod v2 {
3    include!("espresso.api.v2.rs");
4}
5
6pub use v2::*;
7
8pub trait ApiSerializations {
9    type Address;
10    type RewardClaimInput;
11    type RewardBalance;
12    type RewardAccountQueryData;
13    type RewardBalances;
14    type RewardMerkleTreeData;
15    type NamespaceProof;
16    type IncorrectEncodingProof;
17    type StateCertificate;
18    type StakeTable;
19    type PeerConfig;
20    type LightClientCert;
21    type NsProof;
22
23    fn deserialize_address(&self, s: &str) -> anyhow::Result<Self::Address>;
24
25    fn serialize_reward_claim_input(
26        &self,
27        address: &str,
28        value: &Self::RewardClaimInput,
29    ) -> anyhow::Result<RewardClaimInput>;
30
31    fn serialize_reward_balance(
32        &self,
33        value: &Self::RewardBalance,
34    ) -> anyhow::Result<RewardBalance>;
35
36    fn serialize_reward_account_query_data(
37        &self,
38        value: &Self::RewardAccountQueryData,
39    ) -> anyhow::Result<RewardAccountQueryDataV2>;
40
41    fn serialize_reward_balances(
42        &self,
43        value: &Self::RewardBalances,
44    ) -> anyhow::Result<RewardBalances>;
45
46    fn serialize_reward_merkle_tree_data(
47        &self,
48        value: &Self::RewardMerkleTreeData,
49    ) -> anyhow::Result<RewardMerkleTreeV2Data>;
50
51    fn serialize_namespace_proof(
52        &self,
53        value: &Self::NamespaceProof,
54    ) -> anyhow::Result<NamespaceProofResponse>;
55
56    fn serialize_incorrect_encoding_proof(
57        &self,
58        value: &Self::IncorrectEncodingProof,
59    ) -> anyhow::Result<IncorrectEncodingProofResponse>;
60
61    fn serialize_state_certificate(
62        &self,
63        value: &Self::StateCertificate,
64    ) -> anyhow::Result<StateCertificateResponse>;
65
66    fn serialize_stake_table(&self, value: &Self::StakeTable)
67    -> anyhow::Result<StakeTableResponse>;
68
69    fn serialize_peer_config(&self, peer: &Self::PeerConfig) -> anyhow::Result<PeerConfig>
70    where
71        Self::PeerConfig: Sized;
72
73    fn serialize_light_client_cert(
74        &self,
75        cert: &Self::LightClientCert,
76    ) -> anyhow::Result<LightClientStateUpdateCertificateV2>
77    where
78        Self::LightClientCert: Sized;
79
80    fn serialize_ns_proof(&self, proof: &Self::NsProof) -> anyhow::Result<NsProof>
81    where
82        Self::NsProof: Sized;
83}