gui: add create_recovery command to client
This commit is contained in:
parent
f4afed4d6a
commit
f2facdf164
@ -134,6 +134,14 @@ impl<C: Client + Debug> Daemon for Lianad<C> {
|
||||
fn list_txs(&self, txids: &[Txid]) -> Result<ListTransactionsResult, DaemonError> {
|
||||
self.call("listtransactions", Some(vec![txids]))
|
||||
}
|
||||
|
||||
fn create_recovery(&self, address: Address, feerate_vb: u64) -> Result<Psbt, DaemonError> {
|
||||
let res: CreateSpendResult = self.call(
|
||||
"createrecovery",
|
||||
Some(vec![json!(address), json!(feerate_vb)]),
|
||||
)?;
|
||||
Ok(res.psbt)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
|
||||
@ -193,4 +193,16 @@ impl Daemon for EmbeddedDaemon {
|
||||
.start_rescan(t)
|
||||
.map_err(|e| DaemonError::Unexpected(e.to_string()))
|
||||
}
|
||||
|
||||
fn create_recovery(&self, address: Address, feerate_vb: u64) -> Result<Psbt, DaemonError> {
|
||||
self.handle
|
||||
.as_ref()
|
||||
.ok_or(DaemonError::NoAnswer)?
|
||||
.read()
|
||||
.unwrap()
|
||||
.control
|
||||
.create_recovery(address, feerate_vb)
|
||||
.map_err(|e| DaemonError::Unexpected(e.to_string()))
|
||||
.map(|res| res.psbt)
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,6 +65,7 @@ pub trait Daemon: Debug {
|
||||
_end: u32,
|
||||
_limit: u64,
|
||||
) -> Result<model::ListTransactionsResult, DaemonError>;
|
||||
fn create_recovery(&self, address: Address, feerate_vb: u64) -> Result<Psbt, DaemonError>;
|
||||
fn list_txs(&self, txid: &[Txid]) -> Result<model::ListTransactionsResult, DaemonError>;
|
||||
|
||||
fn list_spend_transactions(&self) -> Result<Vec<model::SpendTx>, DaemonError> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user