1mod r#impl;
2
3use super::pool::OtxPool;
4
5use otx_format::{jsonrpc_types::OpenTransaction, types::OpenTxStatus};
6
7use ckb_types::H256;
8use jsonrpc_core::Result as RpcResult;
9use jsonrpc_derive::rpc;
10
11use std::sync::Arc;
12
13#[rpc(server)]
14pub trait OtxPoolRpc {
15 #[rpc(name = "submit_otx")]
16 fn submit_otx(&self, otx: OpenTransaction) -> RpcResult<H256>;
17
18 #[rpc(name = "query_otx_status_by_id")]
19 fn query_otx_status_by_id(&self, id: H256) -> RpcResult<Option<OpenTxStatus>>;
20}
21
22pub struct OtxPoolRpcImpl {
23 otx_pool: Arc<OtxPool>,
24}
25
26impl OtxPoolRpcImpl {
27 pub fn new(otx_pool: Arc<OtxPool>) -> Self {
28 OtxPoolRpcImpl { otx_pool }
29 }
30}