Skip to content

Commit

Permalink
rpc: Add unimplemented new RPC functions for the future.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Aug 22, 2024
1 parent 2cc3976 commit dfb76b7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/rpc/adapter/rawtransactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ pub fn sendrawtransaction(
Ok(txid)
}

pub fn fundrawtransaction(
_client: &Client,
_hexstring: String,
_options: Option<String>,
_iswitness: Option<bool>,
) -> Result<String, Error> {
todo!()
}

pub fn signrawtransactionwithwallet(
_client: &Client,
_hexstring: String,
_prevtxs: Option<String>,
_sighashtype: Option<bool>,
) -> Result<String, Error> {
todo!()
}

#[cfg(test)]
mod tests {
use crate::{
Expand Down
41 changes: 41 additions & 0 deletions src/rpc/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ pub trait Rpc {
estimate_mode: Option<&str>,
avoid_reuse: Option<bool>,
) -> Result<String, ErrorObjectOwned>;

#[method(name = "fundrawtransaction")]
async fn fundrawtransaction(
&self,
hexstring: String,
options: Option<String>,
iswitness: Option<bool>,
) -> Result<String, ErrorObjectOwned>;

#[method(name = "signrawtransactionwithwallet")]
async fn signrawtransactionwithwallet(
&self,
hexstring: String,
prevtxs: Option<String>,
sighashtype: Option<bool>,
) -> Result<String, ErrorObjectOwned>;
}

#[async_trait]
Expand Down Expand Up @@ -208,6 +224,31 @@ impl RpcServer for Client {
avoid_reuse,
))
}

async fn fundrawtransaction(
&self,
hexstring: String,
options: Option<String>,
iswitness: Option<bool>,
) -> Result<String, ErrorObjectOwned> {
to_jsonrpsee_error(adapter::fundrawtransaction(
self, hexstring, options, iswitness,
))
}

async fn signrawtransactionwithwallet(
&self,
hexstring: String,
prevtxs: Option<String>,
sighashtype: Option<bool>,
) -> Result<String, ErrorObjectOwned> {
to_jsonrpsee_error(adapter::signrawtransactionwithwallet(
self,
hexstring,
prevtxs,
sighashtype,
))
}
}

/// Helper for converting ledger error to [`jsonrpsee`] error.
Expand Down

0 comments on commit dfb76b7

Please sign in to comment.