forked from kaspanet/rusty-kaspa
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
de-couple wRPC from the runtiem wallet making RPC bindings generic
- Loading branch information
Showing
13 changed files
with
146 additions
and
82 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
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,29 @@ | ||
use std::sync::Arc; | ||
|
||
pub use kaspa_rpc_core::api::ctl::RpcCtl; | ||
pub type DynRpcApi = dyn kaspa_rpc_core::api::rpc::RpcApi; | ||
pub type NotificationChannel = kaspa_utils::channel::Channel<kaspa_rpc_core::Notification>; | ||
pub use kaspa_rpc_core::notify::mode::NotificationMode; | ||
pub use kaspa_wrpc_client::WrpcEncoding; | ||
|
||
/// RPC adaptor class that holds the [`RpcApi`](crate::api::RpcApi) | ||
/// and [`RpcCtl`](crate::api::RpcCtl) instances. | ||
#[derive(Clone)] | ||
pub struct Rpc { | ||
pub rpc_api: Arc<DynRpcApi>, | ||
pub rpc_ctl: RpcCtl, | ||
} | ||
|
||
impl Rpc { | ||
pub fn new(rpc_api: Arc<DynRpcApi>, rpc_ctl: RpcCtl) -> Self { | ||
Rpc { rpc_api, rpc_ctl } | ||
} | ||
|
||
pub fn rpc_api(&self) -> &Arc<DynRpcApi> { | ||
&self.rpc_api | ||
} | ||
|
||
pub fn rpc_ctl(&self) -> &RpcCtl { | ||
&self.rpc_ctl | ||
} | ||
} |
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
Oops, something went wrong.