1use celestia_types::blob::RawBlob;
2use celestia_types::state::{
3 AccAddress, Address, Coin, QueryDelegationResponse, QueryRedelegationsResponse,
4 QueryUnbondingDelegationResponse, RawTxResponse, ValAddress,
5};
6use jsonrpsee::core::RpcResult;
7use jsonrpsee::proc_macros::rpc;
8
9use crate::TxConfig;
10
11#[rpc(client, server, namespace = "state", namespace_separator = ".")]
13pub trait State {
14 #[method(name = "AccountAddress")]
16 async fn state_account_address(&self) -> RpcResult<Address>;
17
18 #[method(name = "Balance")]
20 async fn state_balance(&self) -> RpcResult<Coin>;
21
22 #[method(name = "BalanceForAddress")]
25 async fn state_balance_for_address(&self, addr: Address) -> RpcResult<Coin>;
26
27 #[method(name = "BeginRedelegate")]
29 async fn state_begin_redelegate(
30 &self,
31 src: ValAddress,
32 dest: ValAddress,
33 amount: u64,
34 config: TxConfig,
35 ) -> RpcResult<RawTxResponse>;
36
37 #[method(name = "CancelUnbondingDelegation")]
39 async fn state_cancel_unbonding_delegation(
40 &self,
41 addr: ValAddress,
42 amount: u64,
43 height: u64,
44 config: TxConfig,
45 ) -> RpcResult<RawTxResponse>;
46
47 #[method(name = "Delegate")]
49 async fn state_delegate(
50 &self,
51 addr: ValAddress,
52 amount: u64,
53 config: TxConfig,
54 ) -> RpcResult<RawTxResponse>;
55
56 #[method(name = "IsStopped")]
58 async fn state_is_stopped(&self) -> RpcResult<bool>;
59
60 #[method(name = "QueryDelegation")]
62 async fn state_query_delegation(&self, addr: ValAddress) -> RpcResult<QueryDelegationResponse>;
63 #[method(name = "QueryRedelegations")]
67 async fn state_query_redelegations(
68 &self,
69 src: ValAddress,
70 dest: ValAddress,
71 ) -> RpcResult<QueryRedelegationsResponse>;
72
73 #[method(name = "QueryUnbonding")]
75 async fn state_query_unbonding(
76 &self,
77 addr: ValAddress,
78 ) -> RpcResult<QueryUnbondingDelegationResponse>;
79
80 #[method(name = "SubmitPayForBlob")]
82 async fn state_submit_pay_for_blob(
83 &self,
84 blobs: Vec<RawBlob>,
85 config: TxConfig,
86 ) -> RpcResult<RawTxResponse>;
87
88 #[method(name = "Transfer")]
90 async fn state_transfer(
91 &self,
92 to: AccAddress,
93 amount: u64,
94 config: TxConfig,
95 ) -> RpcResult<RawTxResponse>;
96
97 #[method(name = "Undelegate")]
99 async fn state_undelegate(
100 &self,
101 addr: ValAddress,
102 amount: u64,
103 config: TxConfig,
104 ) -> RpcResult<RawTxResponse>;
105}