#![allow(non_camel_case_types)] //! This file was automatically generated using the following command: //! //! ```bash //! contrib/msggen/msggen/__main__.py //! ``` //! //! Do not edit this file, it'll be overwritten. Rather edit the schema that //! this file was generated from use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(tag = "method", content = "params")] #[serde(rename_all = "lowercase")] pub enum Request { Getinfo(requests::GetinfoRequest), ListPeers(requests::ListpeersRequest), ListFunds(requests::ListfundsRequest), SendPay(requests::SendpayRequest), ListChannels(requests::ListchannelsRequest), AddGossip(requests::AddgossipRequest), AutoCleanInvoice(requests::AutocleaninvoiceRequest), CheckMessage(requests::CheckmessageRequest), Close(requests::CloseRequest), Connect(requests::ConnectRequest), CreateInvoice(requests::CreateinvoiceRequest), Datastore(requests::DatastoreRequest), CreateOnion(requests::CreateonionRequest), DelDatastore(requests::DeldatastoreRequest), DelExpiredInvoice(requests::DelexpiredinvoiceRequest), DelInvoice(requests::DelinvoiceRequest), Invoice(requests::InvoiceRequest), ListDatastore(requests::ListdatastoreRequest), ListInvoices(requests::ListinvoicesRequest), SendOnion(requests::SendonionRequest), ListSendPays(requests::ListsendpaysRequest), ListTransactions(requests::ListtransactionsRequest), Pay(requests::PayRequest), ListNodes(requests::ListnodesRequest), WaitAnyInvoice(requests::WaitanyinvoiceRequest), WaitInvoice(requests::WaitinvoiceRequest), WaitSendPay(requests::WaitsendpayRequest), NewAddr(requests::NewaddrRequest), Withdraw(requests::WithdrawRequest), KeySend(requests::KeysendRequest), FundPsbt(requests::FundpsbtRequest), SendPsbt(requests::SendpsbtRequest), SignPsbt(requests::SignpsbtRequest), UtxoPsbt(requests::UtxopsbtRequest), TxDiscard(requests::TxdiscardRequest), TxPrepare(requests::TxprepareRequest), TxSend(requests::TxsendRequest), ListPeerChannels(requests::ListpeerchannelsRequest), ListClosedChannels(requests::ListclosedchannelsRequest), DecodePay(requests::DecodepayRequest), Decode(requests::DecodeRequest), Disconnect(requests::DisconnectRequest), Feerates(requests::FeeratesRequest), FundChannel(requests::FundchannelRequest), GetRoute(requests::GetrouteRequest), ListForwards(requests::ListforwardsRequest), ListPays(requests::ListpaysRequest), ListHtlcs(requests::ListhtlcsRequest), Ping(requests::PingRequest), SendCustomMsg(requests::SendcustommsgRequest), SetChannel(requests::SetchannelRequest), SignInvoice(requests::SigninvoiceRequest), SignMessage(requests::SignmessageRequest), Stop(requests::StopRequest), PreApproveKeysend(requests::PreapprovekeysendRequest), PreApproveInvoice(requests::PreapproveinvoiceRequest), StaticBackup(requests::StaticbackupRequest), } #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(tag = "method", content = "result")] #[serde(rename_all = "lowercase")] pub enum Response { Getinfo(responses::GetinfoResponse), ListPeers(responses::ListpeersResponse), ListFunds(responses::ListfundsResponse), SendPay(responses::SendpayResponse), ListChannels(responses::ListchannelsResponse), AddGossip(responses::AddgossipResponse), AutoCleanInvoice(responses::AutocleaninvoiceResponse), CheckMessage(responses::CheckmessageResponse), Close(responses::CloseResponse), Connect(responses::ConnectResponse), CreateInvoice(responses::CreateinvoiceResponse), Datastore(responses::DatastoreResponse), CreateOnion(responses::CreateonionResponse), DelDatastore(responses::DeldatastoreResponse), DelExpiredInvoice(responses::DelexpiredinvoiceResponse), DelInvoice(responses::DelinvoiceResponse), Invoice(responses::InvoiceResponse), ListDatastore(responses::ListdatastoreResponse), ListInvoices(responses::ListinvoicesResponse), SendOnion(responses::SendonionResponse), ListSendPays(responses::ListsendpaysResponse), ListTransactions(responses::ListtransactionsResponse), Pay(responses::PayResponse), ListNodes(responses::ListnodesResponse), WaitAnyInvoice(responses::WaitanyinvoiceResponse), WaitInvoice(responses::WaitinvoiceResponse), WaitSendPay(responses::WaitsendpayResponse), NewAddr(responses::NewaddrResponse), Withdraw(responses::WithdrawResponse), KeySend(responses::KeysendResponse), FundPsbt(responses::FundpsbtResponse), SendPsbt(responses::SendpsbtResponse), SignPsbt(responses::SignpsbtResponse), UtxoPsbt(responses::UtxopsbtResponse), TxDiscard(responses::TxdiscardResponse), TxPrepare(responses::TxprepareResponse), TxSend(responses::TxsendResponse), ListPeerChannels(responses::ListpeerchannelsResponse), ListClosedChannels(responses::ListclosedchannelsResponse), DecodePay(responses::DecodepayResponse), Decode(responses::DecodeResponse), Disconnect(responses::DisconnectResponse), Feerates(responses::FeeratesResponse), FundChannel(responses::FundchannelResponse), GetRoute(responses::GetrouteResponse), ListForwards(responses::ListforwardsResponse), ListPays(responses::ListpaysResponse), ListHtlcs(responses::ListhtlcsResponse), Ping(responses::PingResponse), SendCustomMsg(responses::SendcustommsgResponse), SetChannel(responses::SetchannelResponse), SignInvoice(responses::SigninvoiceResponse), SignMessage(responses::SignmessageResponse), Stop(responses::StopResponse), PreApproveKeysend(responses::PreapprovekeysendResponse), PreApproveInvoice(responses::PreapproveinvoiceResponse), StaticBackup(responses::StaticbackupResponse), } pub trait IntoRequest: Into { type Response: TryFrom; } #[derive(Debug)] pub struct TryFromResponseError; pub mod requests { #[allow(unused_imports)] use crate::primitives::*; #[allow(unused_imports)] use serde::{{Deserialize, Serialize}}; use super::{IntoRequest, Request}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetinfoRequest { } impl From for Request { fn from(r: GetinfoRequest) -> Self { Request::Getinfo(r) } } impl IntoRequest for GetinfoRequest { type Response = super::responses::GetinfoResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersRequest { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub level: Option, } impl From for Request { fn from(r: ListpeersRequest) -> Self { Request::ListPeers(r) } } impl IntoRequest for ListpeersRequest { type Response = super::responses::ListpeersResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListfundsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub spent: Option, } impl From for Request { fn from(r: ListfundsRequest) -> Self { Request::ListFunds(r) } } impl IntoRequest for ListfundsRequest { type Response = super::responses::ListfundsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendpayRoute { pub amount_msat: Amount, pub id: PublicKey, pub delay: u16, pub channel: ShortChannelId, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendpayRequest { pub route: Vec, pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_secret: Option, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub localinvreqid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub groupid: Option, } impl From for Request { fn from(r: SendpayRequest) -> Self { Request::SendPay(r) } } impl IntoRequest for SendpayRequest { type Response = super::responses::SendpayResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListchannelsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, } impl From for Request { fn from(r: ListchannelsRequest) -> Self { Request::ListChannels(r) } } impl IntoRequest for ListchannelsRequest { type Response = super::responses::ListchannelsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AddgossipRequest { pub message: String, } impl From for Request { fn from(r: AddgossipRequest) -> Self { Request::AddGossip(r) } } impl IntoRequest for AddgossipRequest { type Response = super::responses::AddgossipResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AutocleaninvoiceRequest { #[serde(skip_serializing_if = "Option::is_none")] pub expired_by: Option, #[serde(skip_serializing_if = "Option::is_none")] pub cycle_seconds: Option, } impl From for Request { fn from(r: AutocleaninvoiceRequest) -> Self { Request::AutoCleanInvoice(r) } } impl IntoRequest for AutocleaninvoiceRequest { type Response = super::responses::AutocleaninvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CheckmessageRequest { pub message: String, pub zbase: String, #[serde(skip_serializing_if = "Option::is_none")] pub pubkey: Option, } impl From for Request { fn from(r: CheckmessageRequest) -> Self { Request::CheckMessage(r) } } impl IntoRequest for CheckmessageRequest { type Response = super::responses::CheckmessageResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CloseRequest { pub id: String, #[serde(skip_serializing_if = "Option::is_none")] pub unilateraltimeout: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_negotiation_step: Option, #[serde(skip_serializing_if = "Option::is_none")] pub wrong_funding: Option, #[serde(skip_serializing_if = "Option::is_none")] pub force_lease_closed: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub feerange: Option>, } impl From for Request { fn from(r: CloseRequest) -> Self { Request::Close(r) } } impl IntoRequest for CloseRequest { type Response = super::responses::CloseResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ConnectRequest { pub id: String, #[serde(skip_serializing_if = "Option::is_none")] pub host: Option, #[serde(skip_serializing_if = "Option::is_none")] pub port: Option, } impl From for Request { fn from(r: ConnectRequest) -> Self { Request::Connect(r) } } impl IntoRequest for ConnectRequest { type Response = super::responses::ConnectResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateinvoiceRequest { pub invstring: String, pub label: String, pub preimage: String, } impl From for Request { fn from(r: CreateinvoiceRequest) -> Self { Request::CreateInvoice(r) } } impl IntoRequest for CreateinvoiceRequest { type Response = super::responses::CreateinvoiceResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum DatastoreMode { #[serde(rename = "must-create")] MUST_CREATE, #[serde(rename = "must-replace")] MUST_REPLACE, #[serde(rename = "create-or-replace")] CREATE_OR_REPLACE, #[serde(rename = "must-append")] MUST_APPEND, #[serde(rename = "create-or-append")] CREATE_OR_APPEND, } impl TryFrom for DatastoreMode { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(DatastoreMode::MUST_CREATE), 1 => Ok(DatastoreMode::MUST_REPLACE), 2 => Ok(DatastoreMode::CREATE_OR_REPLACE), 3 => Ok(DatastoreMode::MUST_APPEND), 4 => Ok(DatastoreMode::CREATE_OR_APPEND), o => Err(anyhow::anyhow!("Unknown variant {} for enum DatastoreMode", o)), } } } impl ToString for DatastoreMode { fn to_string(&self) -> String { match self { DatastoreMode::MUST_CREATE => "MUST_CREATE", DatastoreMode::MUST_REPLACE => "MUST_REPLACE", DatastoreMode::CREATE_OR_REPLACE => "CREATE_OR_REPLACE", DatastoreMode::MUST_APPEND => "MUST_APPEND", DatastoreMode::CREATE_OR_APPEND => "CREATE_OR_APPEND", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DatastoreRequest { pub key: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub string: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, #[serde(skip_serializing_if = "Option::is_none")] pub mode: Option, #[serde(skip_serializing_if = "Option::is_none")] pub generation: Option, } impl From for Request { fn from(r: DatastoreRequest) -> Self { Request::Datastore(r) } } impl IntoRequest for DatastoreRequest { type Response = super::responses::DatastoreResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateonionHops { pub pubkey: PublicKey, pub payload: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateonionRequest { pub hops: Vec, pub assocdata: String, #[serde(skip_serializing_if = "Option::is_none")] pub session_key: Option, #[serde(skip_serializing_if = "Option::is_none")] pub onion_size: Option, } impl From for Request { fn from(r: CreateonionRequest) -> Self { Request::CreateOnion(r) } } impl IntoRequest for CreateonionRequest { type Response = super::responses::CreateonionResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DeldatastoreRequest { pub key: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub generation: Option, } impl From for Request { fn from(r: DeldatastoreRequest) -> Self { Request::DelDatastore(r) } } impl IntoRequest for DeldatastoreRequest { type Response = super::responses::DeldatastoreResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DelexpiredinvoiceRequest { #[serde(skip_serializing_if = "Option::is_none")] pub maxexpirytime: Option, } impl From for Request { fn from(r: DelexpiredinvoiceRequest) -> Self { Request::DelExpiredInvoice(r) } } impl IntoRequest for DelexpiredinvoiceRequest { type Response = super::responses::DelexpiredinvoiceResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum DelinvoiceStatus { #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, #[serde(rename = "unpaid")] UNPAID, } impl TryFrom for DelinvoiceStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(DelinvoiceStatus::PAID), 1 => Ok(DelinvoiceStatus::EXPIRED), 2 => Ok(DelinvoiceStatus::UNPAID), o => Err(anyhow::anyhow!("Unknown variant {} for enum DelinvoiceStatus", o)), } } } impl ToString for DelinvoiceStatus { fn to_string(&self) -> String { match self { DelinvoiceStatus::PAID => "PAID", DelinvoiceStatus::EXPIRED => "EXPIRED", DelinvoiceStatus::UNPAID => "UNPAID", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DelinvoiceRequest { pub label: String, // Path `DelInvoice.status` pub status: DelinvoiceStatus, #[serde(skip_serializing_if = "Option::is_none")] pub desconly: Option, } impl From for Request { fn from(r: DelinvoiceRequest) -> Self { Request::DelInvoice(r) } } impl IntoRequest for DelinvoiceRequest { type Response = super::responses::DelinvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceRequest { pub amount_msat: AmountOrAny, pub description: String, pub label: String, #[serde(skip_serializing_if = "Option::is_none")] pub expiry: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub fallbacks: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub cltv: Option, #[serde(skip_serializing_if = "Option::is_none")] pub deschashonly: Option, } impl From for Request { fn from(r: InvoiceRequest) -> Self { Request::Invoice(r) } } impl IntoRequest for InvoiceRequest { type Response = super::responses::InvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListdatastoreRequest { #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub key: Option>, } impl From for Request { fn from(r: ListdatastoreRequest) -> Self { Request::ListDatastore(r) } } impl IntoRequest for ListdatastoreRequest { type Response = super::responses::ListdatastoreResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListinvoicesIndex { #[serde(rename = "created")] CREATED, #[serde(rename = "updated")] UPDATED, } impl TryFrom for ListinvoicesIndex { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListinvoicesIndex::CREATED), 1 => Ok(ListinvoicesIndex::UPDATED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListinvoicesIndex", o)), } } } impl ToString for ListinvoicesIndex { fn to_string(&self) -> String { match self { ListinvoicesIndex::CREATED => "CREATED", ListinvoicesIndex::UPDATED => "UPDATED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListinvoicesRequest { #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invstring: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub start: Option, #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, } impl From for Request { fn from(r: ListinvoicesRequest) -> Self { Request::ListInvoices(r) } } impl IntoRequest for ListinvoicesRequest { type Response = super::responses::ListinvoicesResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendonionFirst_hop { pub id: PublicKey, pub amount_msat: Amount, pub delay: u16, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendonionRequest { pub onion: String, pub first_hop: SendonionFirst_hop, pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub shared_secrets: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, #[serde(skip_serializing_if = "Option::is_none")] pub localinvreqid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub groupid: Option, } impl From for Request { fn from(r: SendonionRequest) -> Self { Request::SendOnion(r) } } impl IntoRequest for SendonionRequest { type Response = super::responses::SendonionResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListsendpaysStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "complete")] COMPLETE, #[serde(rename = "failed")] FAILED, } impl TryFrom for ListsendpaysStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListsendpaysStatus::PENDING), 1 => Ok(ListsendpaysStatus::COMPLETE), 2 => Ok(ListsendpaysStatus::FAILED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListsendpaysStatus", o)), } } } impl ToString for ListsendpaysStatus { fn to_string(&self) -> String { match self { ListsendpaysStatus::PENDING => "PENDING", ListsendpaysStatus::COMPLETE => "COMPLETE", ListsendpaysStatus::FAILED => "FAILED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListsendpaysRequest { #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } impl From for Request { fn from(r: ListsendpaysRequest) -> Self { Request::ListSendPays(r) } } impl IntoRequest for ListsendpaysRequest { type Response = super::responses::ListsendpaysResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsRequest { } impl From for Request { fn from(r: ListtransactionsRequest) -> Self { Request::ListTransactions(r) } } impl IntoRequest for ListtransactionsRequest { type Response = super::responses::ListtransactionsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PayRequest { pub bolt11: String, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub riskfactor: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maxfeepercent: Option, #[serde(skip_serializing_if = "Option::is_none")] pub retry_for: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maxdelay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub exemptfee: Option, #[serde(skip_serializing_if = "Option::is_none")] pub localinvreqid: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub exclude: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub maxfee: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, } impl From for Request { fn from(r: PayRequest) -> Self { Request::Pay(r) } } impl IntoRequest for PayRequest { type Response = super::responses::PayResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListnodesRequest { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, } impl From for Request { fn from(r: ListnodesRequest) -> Self { Request::ListNodes(r) } } impl IntoRequest for ListnodesRequest { type Response = super::responses::ListnodesResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitanyinvoiceRequest { #[serde(skip_serializing_if = "Option::is_none")] pub lastpay_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub timeout: Option, } impl From for Request { fn from(r: WaitanyinvoiceRequest) -> Self { Request::WaitAnyInvoice(r) } } impl IntoRequest for WaitanyinvoiceRequest { type Response = super::responses::WaitanyinvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitinvoiceRequest { pub label: String, } impl From for Request { fn from(r: WaitinvoiceRequest) -> Self { Request::WaitInvoice(r) } } impl IntoRequest for WaitinvoiceRequest { type Response = super::responses::WaitinvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitsendpayRequest { pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub timeout: Option, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub groupid: Option, } impl From for Request { fn from(r: WaitsendpayRequest) -> Self { Request::WaitSendPay(r) } } impl IntoRequest for WaitsendpayRequest { type Response = super::responses::WaitsendpayResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum NewaddrAddresstype { #[serde(rename = "bech32")] BECH32, #[serde(rename = "p2tr")] P2TR, #[serde(rename = "all")] ALL, } impl TryFrom for NewaddrAddresstype { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(NewaddrAddresstype::BECH32), 1 => Ok(NewaddrAddresstype::P2TR), 2 => Ok(NewaddrAddresstype::ALL), o => Err(anyhow::anyhow!("Unknown variant {} for enum NewaddrAddresstype", o)), } } } impl ToString for NewaddrAddresstype { fn to_string(&self) -> String { match self { NewaddrAddresstype::BECH32 => "BECH32", NewaddrAddresstype::P2TR => "P2TR", NewaddrAddresstype::ALL => "ALL", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NewaddrRequest { #[serde(skip_serializing_if = "Option::is_none")] pub addresstype: Option, } impl From for Request { fn from(r: NewaddrRequest) -> Self { Request::NewAddr(r) } } impl IntoRequest for NewaddrRequest { type Response = super::responses::NewaddrResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WithdrawRequest { pub destination: String, #[serde(skip_serializing_if = "Option::is_none")] pub satoshi: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minconf: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub utxos: Option>, } impl From for Request { fn from(r: WithdrawRequest) -> Self { Request::Withdraw(r) } } impl IntoRequest for WithdrawRequest { type Response = super::responses::WithdrawResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct KeysendRequest { pub destination: PublicKey, pub amount_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maxfeepercent: Option, #[serde(skip_serializing_if = "Option::is_none")] pub retry_for: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maxdelay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub exemptfee: Option, #[serde(skip_serializing_if = "Option::is_none")] pub routehints: Option, #[serde(skip_serializing_if = "Option::is_none")] pub extratlvs: Option, } impl From for Request { fn from(r: KeysendRequest) -> Self { Request::KeySend(r) } } impl IntoRequest for KeysendRequest { type Response = super::responses::KeysendResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FundpsbtRequest { pub satoshi: AmountOrAll, pub feerate: Feerate, pub startweight: u32, #[serde(skip_serializing_if = "Option::is_none")] pub minconf: Option, #[serde(skip_serializing_if = "Option::is_none")] pub reserve: Option, #[serde(skip_serializing_if = "Option::is_none")] pub locktime: Option, #[serde(skip_serializing_if = "Option::is_none")] pub min_witness_weight: Option, #[serde(skip_serializing_if = "Option::is_none")] pub excess_as_change: Option, #[serde(skip_serializing_if = "Option::is_none")] pub nonwrapped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub opening_anchor_channel: Option, } impl From for Request { fn from(r: FundpsbtRequest) -> Self { Request::FundPsbt(r) } } impl IntoRequest for FundpsbtRequest { type Response = super::responses::FundpsbtResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendpsbtRequest { pub psbt: String, #[serde(skip_serializing_if = "Option::is_none")] pub reserve: Option, } impl From for Request { fn from(r: SendpsbtRequest) -> Self { Request::SendPsbt(r) } } impl IntoRequest for SendpsbtRequest { type Response = super::responses::SendpsbtResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SignpsbtRequest { pub psbt: String, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub signonly: Option>, } impl From for Request { fn from(r: SignpsbtRequest) -> Self { Request::SignPsbt(r) } } impl IntoRequest for SignpsbtRequest { type Response = super::responses::SignpsbtResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UtxopsbtRequest { pub satoshi: Amount, pub feerate: Feerate, pub startweight: u32, pub utxos: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub reserve: Option, #[serde(skip_serializing_if = "Option::is_none")] pub reservedok: Option, #[serde(skip_serializing_if = "Option::is_none")] pub locktime: Option, #[serde(skip_serializing_if = "Option::is_none")] pub min_witness_weight: Option, #[serde(skip_serializing_if = "Option::is_none")] pub excess_as_change: Option, #[serde(skip_serializing_if = "Option::is_none")] pub opening_anchor_channel: Option, } impl From for Request { fn from(r: UtxopsbtRequest) -> Self { Request::UtxoPsbt(r) } } impl IntoRequest for UtxopsbtRequest { type Response = super::responses::UtxopsbtResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxdiscardRequest { pub txid: String, } impl From for Request { fn from(r: TxdiscardRequest) -> Self { Request::TxDiscard(r) } } impl IntoRequest for TxdiscardRequest { type Response = super::responses::TxdiscardResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxprepareRequest { pub outputs: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minconf: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub utxos: Option>, } impl From for Request { fn from(r: TxprepareRequest) -> Self { Request::TxPrepare(r) } } impl IntoRequest for TxprepareRequest { type Response = super::responses::TxprepareResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxsendRequest { pub txid: String, } impl From for Request { fn from(r: TxsendRequest) -> Self { Request::TxSend(r) } } impl IntoRequest for TxsendRequest { type Response = super::responses::TxsendResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, } impl From for Request { fn from(r: ListpeerchannelsRequest) -> Self { Request::ListPeerChannels(r) } } impl IntoRequest for ListpeerchannelsRequest { type Response = super::responses::ListpeerchannelsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListclosedchannelsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, } impl From for Request { fn from(r: ListclosedchannelsRequest) -> Self { Request::ListClosedChannels(r) } } impl IntoRequest for ListclosedchannelsRequest { type Response = super::responses::ListclosedchannelsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodepayRequest { pub bolt11: String, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, } impl From for Request { fn from(r: DecodepayRequest) -> Self { Request::DecodePay(r) } } impl IntoRequest for DecodepayRequest { type Response = super::responses::DecodepayResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeRequest { pub string: String, } impl From for Request { fn from(r: DecodeRequest) -> Self { Request::Decode(r) } } impl IntoRequest for DecodeRequest { type Response = super::responses::DecodeResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DisconnectRequest { pub id: PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub force: Option, } impl From for Request { fn from(r: DisconnectRequest) -> Self { Request::Disconnect(r) } } impl IntoRequest for DisconnectRequest { type Response = super::responses::DisconnectResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum FeeratesStyle { #[serde(rename = "perkb")] PERKB, #[serde(rename = "perkw")] PERKW, } impl TryFrom for FeeratesStyle { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(FeeratesStyle::PERKB), 1 => Ok(FeeratesStyle::PERKW), o => Err(anyhow::anyhow!("Unknown variant {} for enum FeeratesStyle", o)), } } } impl ToString for FeeratesStyle { fn to_string(&self) -> String { match self { FeeratesStyle::PERKB => "PERKB", FeeratesStyle::PERKW => "PERKW", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesRequest { // Path `Feerates.style` pub style: FeeratesStyle, } impl From for Request { fn from(r: FeeratesRequest) -> Self { Request::Feerates(r) } } impl IntoRequest for FeeratesRequest { type Response = super::responses::FeeratesResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FundchannelRequest { pub id: PublicKey, pub amount: AmountOrAll, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub announce: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minconf: Option, #[serde(skip_serializing_if = "Option::is_none")] pub push_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub close_to: Option, #[serde(skip_serializing_if = "Option::is_none")] pub request_amt: Option, #[serde(skip_serializing_if = "Option::is_none")] pub compact_lease: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub utxos: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub mindepth: Option, #[serde(skip_serializing_if = "Option::is_none")] pub reserve: Option, } impl From for Request { fn from(r: FundchannelRequest) -> Self { Request::FundChannel(r) } } impl IntoRequest for FundchannelRequest { type Response = super::responses::FundchannelResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetrouteRequest { pub id: PublicKey, pub amount_msat: Amount, pub riskfactor: u64, #[serde(skip_serializing_if = "Option::is_none")] pub cltv: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fromid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fuzzpercent: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub exclude: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub maxhops: Option, } impl From for Request { fn from(r: GetrouteRequest) -> Self { Request::GetRoute(r) } } impl IntoRequest for GetrouteRequest { type Response = super::responses::GetrouteResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListforwardsStatus { #[serde(rename = "offered")] OFFERED, #[serde(rename = "settled")] SETTLED, #[serde(rename = "local_failed")] LOCAL_FAILED, #[serde(rename = "failed")] FAILED, } impl TryFrom for ListforwardsStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListforwardsStatus::OFFERED), 1 => Ok(ListforwardsStatus::SETTLED), 2 => Ok(ListforwardsStatus::LOCAL_FAILED), 3 => Ok(ListforwardsStatus::FAILED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListforwardsStatus", o)), } } } impl ToString for ListforwardsStatus { fn to_string(&self) -> String { match self { ListforwardsStatus::OFFERED => "OFFERED", ListforwardsStatus::SETTLED => "SETTLED", ListforwardsStatus::LOCAL_FAILED => "LOCAL_FAILED", ListforwardsStatus::FAILED => "FAILED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListforwardsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_channel: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_channel: Option, } impl From for Request { fn from(r: ListforwardsRequest) -> Self { Request::ListForwards(r) } } impl IntoRequest for ListforwardsRequest { type Response = super::responses::ListforwardsResponse; } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpaysStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "complete")] COMPLETE, #[serde(rename = "failed")] FAILED, } impl TryFrom for ListpaysStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpaysStatus::PENDING), 1 => Ok(ListpaysStatus::COMPLETE), 2 => Ok(ListpaysStatus::FAILED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpaysStatus", o)), } } } impl ToString for ListpaysStatus { fn to_string(&self) -> String { match self { ListpaysStatus::PENDING => "PENDING", ListpaysStatus::COMPLETE => "COMPLETE", ListpaysStatus::FAILED => "FAILED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpaysRequest { #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, } impl From for Request { fn from(r: ListpaysRequest) -> Self { Request::ListPays(r) } } impl IntoRequest for ListpaysRequest { type Response = super::responses::ListpaysResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListhtlcsRequest { #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, } impl From for Request { fn from(r: ListhtlcsRequest) -> Self { Request::ListHtlcs(r) } } impl IntoRequest for ListhtlcsRequest { type Response = super::responses::ListhtlcsResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PingRequest { pub id: PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub len: Option, #[serde(skip_serializing_if = "Option::is_none")] pub pongbytes: Option, } impl From for Request { fn from(r: PingRequest) -> Self { Request::Ping(r) } } impl IntoRequest for PingRequest { type Response = super::responses::PingResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendcustommsgRequest { pub node_id: PublicKey, pub msg: String, } impl From for Request { fn from(r: SendcustommsgRequest) -> Self { Request::SendCustomMsg(r) } } impl IntoRequest for SendcustommsgRequest { type Response = super::responses::SendcustommsgResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SetchannelRequest { pub id: String, #[serde(skip_serializing_if = "Option::is_none")] pub feebase: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feeppm: Option, #[serde(skip_serializing_if = "Option::is_none")] pub htlcmin: Option, #[serde(skip_serializing_if = "Option::is_none")] pub htlcmax: Option, #[serde(skip_serializing_if = "Option::is_none")] pub enforcedelay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub ignorefeelimits: Option, } impl From for Request { fn from(r: SetchannelRequest) -> Self { Request::SetChannel(r) } } impl IntoRequest for SetchannelRequest { type Response = super::responses::SetchannelResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SigninvoiceRequest { pub invstring: String, } impl From for Request { fn from(r: SigninvoiceRequest) -> Self { Request::SignInvoice(r) } } impl IntoRequest for SigninvoiceRequest { type Response = super::responses::SigninvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SignmessageRequest { pub message: String, } impl From for Request { fn from(r: SignmessageRequest) -> Self { Request::SignMessage(r) } } impl IntoRequest for SignmessageRequest { type Response = super::responses::SignmessageResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct StopRequest { } impl From for Request { fn from(r: StopRequest) -> Self { Request::Stop(r) } } impl IntoRequest for StopRequest { type Response = super::responses::StopResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PreapprovekeysendRequest { #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, } impl From for Request { fn from(r: PreapprovekeysendRequest) -> Self { Request::PreApproveKeysend(r) } } impl IntoRequest for PreapprovekeysendRequest { type Response = super::responses::PreapprovekeysendResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PreapproveinvoiceRequest { #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, } impl From for Request { fn from(r: PreapproveinvoiceRequest) -> Self { Request::PreApproveInvoice(r) } } impl IntoRequest for PreapproveinvoiceRequest { type Response = super::responses::PreapproveinvoiceResponse; } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct StaticbackupRequest { } impl From for Request { fn from(r: StaticbackupRequest) -> Self { Request::StaticBackup(r) } } impl IntoRequest for StaticbackupRequest { type Response = super::responses::StaticbackupResponse; } } pub mod responses { #[allow(unused_imports)] use crate::primitives::*; #[allow(unused_imports)] use serde::{{Deserialize, Serialize}}; use super::{TryFromResponseError, Response}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetinfoOur_features { pub init: String, pub node: String, pub channel: String, pub invoice: String, } /// Type of connection (until 23.08, `websocket` was also allowed) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum GetinfoAddressType { #[serde(rename = "dns")] DNS, #[serde(rename = "ipv4")] IPV4, #[serde(rename = "ipv6")] IPV6, #[serde(rename = "torv2")] TORV2, #[serde(rename = "torv3")] TORV3, } impl TryFrom for GetinfoAddressType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(GetinfoAddressType::DNS), 1 => Ok(GetinfoAddressType::IPV4), 2 => Ok(GetinfoAddressType::IPV6), 3 => Ok(GetinfoAddressType::TORV2), 4 => Ok(GetinfoAddressType::TORV3), o => Err(anyhow::anyhow!("Unknown variant {} for enum GetinfoAddressType", o)), } } } impl ToString for GetinfoAddressType { fn to_string(&self) -> String { match self { GetinfoAddressType::DNS => "DNS", GetinfoAddressType::IPV4 => "IPV4", GetinfoAddressType::IPV6 => "IPV6", GetinfoAddressType::TORV2 => "TORV2", GetinfoAddressType::TORV3 => "TORV3", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetinfoAddress { // Path `Getinfo.address[].type` #[serde(rename = "type")] pub item_type: GetinfoAddressType, pub port: u16, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, } /// Type of connection #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum GetinfoBindingType { #[serde(rename = "local socket")] LOCAL_SOCKET, #[serde(rename = "websocket")] WEBSOCKET, #[serde(rename = "ipv4")] IPV4, #[serde(rename = "ipv6")] IPV6, #[serde(rename = "torv2")] TORV2, #[serde(rename = "torv3")] TORV3, } impl TryFrom for GetinfoBindingType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(GetinfoBindingType::LOCAL_SOCKET), 1 => Ok(GetinfoBindingType::WEBSOCKET), 2 => Ok(GetinfoBindingType::IPV4), 3 => Ok(GetinfoBindingType::IPV6), 4 => Ok(GetinfoBindingType::TORV2), 5 => Ok(GetinfoBindingType::TORV3), o => Err(anyhow::anyhow!("Unknown variant {} for enum GetinfoBindingType", o)), } } } impl ToString for GetinfoBindingType { fn to_string(&self) -> String { match self { GetinfoBindingType::LOCAL_SOCKET => "LOCAL_SOCKET", GetinfoBindingType::WEBSOCKET => "WEBSOCKET", GetinfoBindingType::IPV4 => "IPV4", GetinfoBindingType::IPV6 => "IPV6", GetinfoBindingType::TORV2 => "TORV2", GetinfoBindingType::TORV3 => "TORV3", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetinfoBinding { // Path `Getinfo.binding[].type` #[serde(rename = "type")] pub item_type: GetinfoBindingType, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(skip_serializing_if = "Option::is_none")] pub port: Option, #[serde(skip_serializing_if = "Option::is_none")] pub socket: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetinfoResponse { pub id: PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option, pub color: String, pub num_peers: u32, pub num_pending_channels: u32, pub num_active_channels: u32, pub num_inactive_channels: u32, pub version: String, #[serde(rename = "lightning-dir")] pub lightning_dir: String, #[serde(skip_serializing_if = "Option::is_none")] pub our_features: Option, pub blockheight: u32, pub network: String, pub fees_collected_msat: Amount, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub address: Option>, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub binding: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub warning_bitcoind_sync: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_lightningd_sync: Option, } impl TryFrom for GetinfoResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Getinfo(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpeersPeersLogType { #[serde(rename = "SKIPPED")] SKIPPED, #[serde(rename = "BROKEN")] BROKEN, #[serde(rename = "UNUSUAL")] UNUSUAL, #[serde(rename = "INFO")] INFO, #[serde(rename = "DEBUG")] DEBUG, #[serde(rename = "IO_IN")] IO_IN, #[serde(rename = "IO_OUT")] IO_OUT, } impl TryFrom for ListpeersPeersLogType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpeersPeersLogType::SKIPPED), 1 => Ok(ListpeersPeersLogType::BROKEN), 2 => Ok(ListpeersPeersLogType::UNUSUAL), 3 => Ok(ListpeersPeersLogType::INFO), 4 => Ok(ListpeersPeersLogType::DEBUG), 5 => Ok(ListpeersPeersLogType::IO_IN), 6 => Ok(ListpeersPeersLogType::IO_OUT), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpeersPeersLogType", o)), } } } impl ToString for ListpeersPeersLogType { fn to_string(&self) -> String { match self { ListpeersPeersLogType::SKIPPED => "SKIPPED", ListpeersPeersLogType::BROKEN => "BROKEN", ListpeersPeersLogType::UNUSUAL => "UNUSUAL", ListpeersPeersLogType::INFO => "INFO", ListpeersPeersLogType::DEBUG => "DEBUG", ListpeersPeersLogType::IO_IN => "IO_IN", ListpeersPeersLogType::IO_OUT => "IO_OUT", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersLog { // Path `ListPeers.peers[].log[].type` #[serde(rename = "type")] pub item_type: ListpeersPeersLogType, #[serde(skip_serializing_if = "Option::is_none")] pub num_skipped: Option, #[serde(skip_serializing_if = "Option::is_none")] pub time: Option, #[serde(skip_serializing_if = "Option::is_none")] pub source: Option, #[serde(skip_serializing_if = "Option::is_none")] pub log: Option, #[serde(skip_serializing_if = "Option::is_none")] pub node_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub data: Option, } /// the channel state, in particular "CHANNELD_NORMAL" means the channel can be used normally #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpeersPeersChannelsState { #[serde(rename = "OPENINGD")] OPENINGD, #[serde(rename = "CHANNELD_AWAITING_LOCKIN")] CHANNELD_AWAITING_LOCKIN, #[serde(rename = "CHANNELD_NORMAL")] CHANNELD_NORMAL, #[serde(rename = "CHANNELD_SHUTTING_DOWN")] CHANNELD_SHUTTING_DOWN, #[serde(rename = "CLOSINGD_SIGEXCHANGE")] CLOSINGD_SIGEXCHANGE, #[serde(rename = "CLOSINGD_COMPLETE")] CLOSINGD_COMPLETE, #[serde(rename = "AWAITING_UNILATERAL")] AWAITING_UNILATERAL, #[serde(rename = "FUNDING_SPEND_SEEN")] FUNDING_SPEND_SEEN, #[serde(rename = "ONCHAIN")] ONCHAIN, #[serde(rename = "DUALOPEND_OPEN_INIT")] DUALOPEND_OPEN_INIT, #[serde(rename = "DUALOPEND_AWAITING_LOCKIN")] DUALOPEND_AWAITING_LOCKIN, } impl TryFrom for ListpeersPeersChannelsState { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpeersPeersChannelsState::OPENINGD), 1 => Ok(ListpeersPeersChannelsState::CHANNELD_AWAITING_LOCKIN), 2 => Ok(ListpeersPeersChannelsState::CHANNELD_NORMAL), 3 => Ok(ListpeersPeersChannelsState::CHANNELD_SHUTTING_DOWN), 4 => Ok(ListpeersPeersChannelsState::CLOSINGD_SIGEXCHANGE), 5 => Ok(ListpeersPeersChannelsState::CLOSINGD_COMPLETE), 6 => Ok(ListpeersPeersChannelsState::AWAITING_UNILATERAL), 7 => Ok(ListpeersPeersChannelsState::FUNDING_SPEND_SEEN), 8 => Ok(ListpeersPeersChannelsState::ONCHAIN), 9 => Ok(ListpeersPeersChannelsState::DUALOPEND_OPEN_INIT), 10 => Ok(ListpeersPeersChannelsState::DUALOPEND_AWAITING_LOCKIN), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpeersPeersChannelsState", o)), } } } impl ToString for ListpeersPeersChannelsState { fn to_string(&self) -> String { match self { ListpeersPeersChannelsState::OPENINGD => "OPENINGD", ListpeersPeersChannelsState::CHANNELD_AWAITING_LOCKIN => "CHANNELD_AWAITING_LOCKIN", ListpeersPeersChannelsState::CHANNELD_NORMAL => "CHANNELD_NORMAL", ListpeersPeersChannelsState::CHANNELD_SHUTTING_DOWN => "CHANNELD_SHUTTING_DOWN", ListpeersPeersChannelsState::CLOSINGD_SIGEXCHANGE => "CLOSINGD_SIGEXCHANGE", ListpeersPeersChannelsState::CLOSINGD_COMPLETE => "CLOSINGD_COMPLETE", ListpeersPeersChannelsState::AWAITING_UNILATERAL => "AWAITING_UNILATERAL", ListpeersPeersChannelsState::FUNDING_SPEND_SEEN => "FUNDING_SPEND_SEEN", ListpeersPeersChannelsState::ONCHAIN => "ONCHAIN", ListpeersPeersChannelsState::DUALOPEND_OPEN_INIT => "DUALOPEND_OPEN_INIT", ListpeersPeersChannelsState::DUALOPEND_AWAITING_LOCKIN => "DUALOPEND_AWAITING_LOCKIN", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsFeerate { pub perkw: u32, pub perkb: u32, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsInflight { pub funding_txid: String, pub funding_outnum: u32, pub feerate: String, pub total_funding_msat: Amount, pub our_funding_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub splice_amount: Option, pub scratch_txid: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsFunding { #[serde(skip_serializing_if = "Option::is_none")] pub pushed_msat: Option, pub local_funds_msat: Amount, pub remote_funds_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub fee_paid_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_rcvd_msat: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsAlias { #[serde(skip_serializing_if = "Option::is_none")] pub local: Option, #[serde(skip_serializing_if = "Option::is_none")] pub remote: Option, } /// Whether it came from peer, or is going to peer #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpeersPeersChannelsHtlcsDirection { #[serde(rename = "in")] IN, #[serde(rename = "out")] OUT, } impl TryFrom for ListpeersPeersChannelsHtlcsDirection { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpeersPeersChannelsHtlcsDirection::IN), 1 => Ok(ListpeersPeersChannelsHtlcsDirection::OUT), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpeersPeersChannelsHtlcsDirection", o)), } } } impl ToString for ListpeersPeersChannelsHtlcsDirection { fn to_string(&self) -> String { match self { ListpeersPeersChannelsHtlcsDirection::IN => "IN", ListpeersPeersChannelsHtlcsDirection::OUT => "OUT", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannelsHtlcs { // Path `ListPeers.peers[].channels[].htlcs[].direction` pub direction: ListpeersPeersChannelsHtlcsDirection, pub id: u64, pub amount_msat: Amount, pub expiry: u32, pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub local_trimmed: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, // Path `ListPeers.peers[].channels[].htlcs[].state` pub state: HtlcState, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeersChannels { // Path `ListPeers.peers[].channels[].state` pub state: ListpeersPeersChannelsState, #[serde(skip_serializing_if = "Option::is_none")] pub scratch_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub owner: Option, #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_outnum: Option, #[serde(skip_serializing_if = "Option::is_none")] pub initial_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub last_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub next_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub next_fee_step: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub inflight: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub close_to: Option, #[serde(skip_serializing_if = "Option::is_none")] pub private: Option, // Path `ListPeers.peers[].channels[].opener` pub opener: ChannelSide, #[serde(skip_serializing_if = "Option::is_none")] pub closer: Option, pub features: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub funding: Option, #[serde(skip_serializing_if = "Option::is_none")] pub to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub min_to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub total_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_base_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_proportional_millionths: Option, #[serde(skip_serializing_if = "Option::is_none")] pub dust_limit_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_total_htlc_in_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub their_reserve_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub our_reserve_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub spendable_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub receivable_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minimum_htlc_in_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minimum_htlc_out_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maximum_htlc_out_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub their_to_self_delay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub our_to_self_delay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_accepted_htlcs: Option, #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub status: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub in_payments_offered: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_offered_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_payments_fulfilled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_fulfilled_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_payments_offered: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_offered_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_payments_fulfilled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_fulfilled_msat: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub htlcs: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub close_to_addr: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersPeers { pub id: PublicKey, pub connected: bool, #[serde(skip_serializing_if = "Option::is_none")] pub num_channels: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub log: Option>, #[deprecated] #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub channels: Option>, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub netaddr: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub remote_addr: Option, #[serde(skip_serializing_if = "Option::is_none")] pub features: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeersResponse { pub peers: Vec, } impl TryFrom for ListpeersResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListPeers(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListfundsOutputsStatus { #[serde(rename = "unconfirmed")] UNCONFIRMED, #[serde(rename = "confirmed")] CONFIRMED, #[serde(rename = "spent")] SPENT, #[serde(rename = "immature")] IMMATURE, } impl TryFrom for ListfundsOutputsStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListfundsOutputsStatus::UNCONFIRMED), 1 => Ok(ListfundsOutputsStatus::CONFIRMED), 2 => Ok(ListfundsOutputsStatus::SPENT), 3 => Ok(ListfundsOutputsStatus::IMMATURE), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListfundsOutputsStatus", o)), } } } impl ToString for ListfundsOutputsStatus { fn to_string(&self) -> String { match self { ListfundsOutputsStatus::UNCONFIRMED => "UNCONFIRMED", ListfundsOutputsStatus::CONFIRMED => "CONFIRMED", ListfundsOutputsStatus::SPENT => "SPENT", ListfundsOutputsStatus::IMMATURE => "IMMATURE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListfundsOutputs { pub txid: String, pub output: u32, pub amount_msat: Amount, pub scriptpubkey: String, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(skip_serializing_if = "Option::is_none")] pub redeemscript: Option, // Path `ListFunds.outputs[].status` pub status: ListfundsOutputsStatus, pub reserved: bool, #[serde(skip_serializing_if = "Option::is_none")] pub blockheight: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListfundsChannels { pub peer_id: PublicKey, pub our_amount_msat: Amount, pub amount_msat: Amount, pub funding_txid: String, pub funding_output: u32, pub connected: bool, // Path `ListFunds.channels[].state` pub state: ChannelState, #[serde(skip_serializing_if = "Option::is_none")] pub channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListfundsResponse { pub outputs: Vec, pub channels: Vec, } impl TryFrom for ListfundsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListFunds(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of the payment (could be complete if already sent previously) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum SendpayStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "complete")] COMPLETE, } impl TryFrom for SendpayStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(SendpayStatus::PENDING), 1 => Ok(SendpayStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum SendpayStatus", o)), } } } impl ToString for SendpayStatus { fn to_string(&self) -> String { match self { SendpayStatus::PENDING => "PENDING", SendpayStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendpayResponse { pub id: u64, #[serde(skip_serializing_if = "Option::is_none")] pub groupid: Option, pub payment_hash: Sha256, // Path `SendPay.status` pub status: SendpayStatus, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub created_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub completed_at: Option, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, } impl TryFrom for SendpayResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SendPay(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListchannelsChannels { pub source: PublicKey, pub destination: PublicKey, pub short_channel_id: ShortChannelId, pub direction: u32, pub public: bool, pub amount_msat: Amount, pub message_flags: u8, pub channel_flags: u8, pub active: bool, pub last_update: u32, pub base_fee_millisatoshi: u32, pub fee_per_millionth: u32, pub delay: u32, pub htlc_minimum_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub htlc_maximum_msat: Option, pub features: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListchannelsResponse { pub channels: Vec, } impl TryFrom for ListchannelsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListChannels(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AddgossipResponse { } impl TryFrom for AddgossipResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::AddGossip(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AutocleaninvoiceResponse { pub enabled: bool, #[serde(skip_serializing_if = "Option::is_none")] pub expired_by: Option, #[serde(skip_serializing_if = "Option::is_none")] pub cycle_seconds: Option, } impl TryFrom for AutocleaninvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::AutoCleanInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CheckmessageResponse { pub verified: bool, pub pubkey: PublicKey, } impl TryFrom for CheckmessageResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::CheckMessage(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether we successfully negotiated a mutual close, closed without them, or discarded not-yet-opened channel #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum CloseType { #[serde(rename = "mutual")] MUTUAL, #[serde(rename = "unilateral")] UNILATERAL, #[serde(rename = "unopened")] UNOPENED, } impl TryFrom for CloseType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(CloseType::MUTUAL), 1 => Ok(CloseType::UNILATERAL), 2 => Ok(CloseType::UNOPENED), o => Err(anyhow::anyhow!("Unknown variant {} for enum CloseType", o)), } } } impl ToString for CloseType { fn to_string(&self) -> String { match self { CloseType::MUTUAL => "MUTUAL", CloseType::UNILATERAL => "UNILATERAL", CloseType::UNOPENED => "UNOPENED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CloseResponse { // Path `Close.type` #[serde(rename = "type")] pub item_type: CloseType, #[serde(skip_serializing_if = "Option::is_none")] pub tx: Option, #[serde(skip_serializing_if = "Option::is_none")] pub txid: Option, } impl TryFrom for CloseResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Close(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether they initiated connection or we did #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ConnectDirection { #[serde(rename = "in")] IN, #[serde(rename = "out")] OUT, } impl TryFrom for ConnectDirection { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ConnectDirection::IN), 1 => Ok(ConnectDirection::OUT), o => Err(anyhow::anyhow!("Unknown variant {} for enum ConnectDirection", o)), } } } impl ToString for ConnectDirection { fn to_string(&self) -> String { match self { ConnectDirection::IN => "IN", ConnectDirection::OUT => "OUT", }.to_string() } } /// Type of connection (*torv2*/*torv3* only if **direction** is *out*) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ConnectAddressType { #[serde(rename = "local socket")] LOCAL_SOCKET, #[serde(rename = "ipv4")] IPV4, #[serde(rename = "ipv6")] IPV6, #[serde(rename = "torv2")] TORV2, #[serde(rename = "torv3")] TORV3, } impl TryFrom for ConnectAddressType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ConnectAddressType::LOCAL_SOCKET), 1 => Ok(ConnectAddressType::IPV4), 2 => Ok(ConnectAddressType::IPV6), 3 => Ok(ConnectAddressType::TORV2), 4 => Ok(ConnectAddressType::TORV3), o => Err(anyhow::anyhow!("Unknown variant {} for enum ConnectAddressType", o)), } } } impl ToString for ConnectAddressType { fn to_string(&self) -> String { match self { ConnectAddressType::LOCAL_SOCKET => "LOCAL_SOCKET", ConnectAddressType::IPV4 => "IPV4", ConnectAddressType::IPV6 => "IPV6", ConnectAddressType::TORV2 => "TORV2", ConnectAddressType::TORV3 => "TORV3", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ConnectAddress { // Path `Connect.address.type` #[serde(rename = "type")] pub item_type: ConnectAddressType, #[serde(skip_serializing_if = "Option::is_none")] pub socket: Option, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, #[serde(skip_serializing_if = "Option::is_none")] pub port: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ConnectResponse { pub id: PublicKey, pub features: String, // Path `Connect.direction` pub direction: ConnectDirection, pub address: ConnectAddress, } impl TryFrom for ConnectResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Connect(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether it has been paid, or can no longer be paid #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum CreateinvoiceStatus { #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, #[serde(rename = "unpaid")] UNPAID, } impl TryFrom for CreateinvoiceStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(CreateinvoiceStatus::PAID), 1 => Ok(CreateinvoiceStatus::EXPIRED), 2 => Ok(CreateinvoiceStatus::UNPAID), o => Err(anyhow::anyhow!("Unknown variant {} for enum CreateinvoiceStatus", o)), } } } impl ToString for CreateinvoiceStatus { fn to_string(&self) -> String { match self { CreateinvoiceStatus::PAID => "PAID", CreateinvoiceStatus::EXPIRED => "EXPIRED", CreateinvoiceStatus::UNPAID => "UNPAID", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateinvoiceResponse { pub label: String, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, // Path `CreateInvoice.status` pub status: CreateinvoiceStatus, pub description: String, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub pay_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_received_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub paid_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub local_offer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_payer_note: Option, } impl TryFrom for CreateinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::CreateInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DatastoreResponse { pub key: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub generation: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, #[serde(skip_serializing_if = "Option::is_none")] pub string: Option, } impl TryFrom for DatastoreResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Datastore(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CreateonionResponse { pub onion: String, pub shared_secrets: Vec, } impl TryFrom for CreateonionResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::CreateOnion(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DeldatastoreResponse { pub key: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub generation: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, #[serde(skip_serializing_if = "Option::is_none")] pub string: Option, } impl TryFrom for DeldatastoreResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::DelDatastore(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DelexpiredinvoiceResponse { } impl TryFrom for DelexpiredinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::DelExpiredInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// State of invoice #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum DelinvoiceStatus { #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, #[serde(rename = "unpaid")] UNPAID, } impl TryFrom for DelinvoiceStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(DelinvoiceStatus::PAID), 1 => Ok(DelinvoiceStatus::EXPIRED), 2 => Ok(DelinvoiceStatus::UNPAID), o => Err(anyhow::anyhow!("Unknown variant {} for enum DelinvoiceStatus", o)), } } } impl ToString for DelinvoiceStatus { fn to_string(&self) -> String { match self { DelinvoiceStatus::PAID => "PAID", DelinvoiceStatus::EXPIRED => "EXPIRED", DelinvoiceStatus::UNPAID => "UNPAID", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DelinvoiceResponse { pub label: String, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, pub payment_hash: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub updated_index: Option, // Path `DelInvoice.status` pub status: DelinvoiceStatus, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub local_offer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_payer_note: Option, } impl TryFrom for DelinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::DelInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct InvoiceResponse { pub bolt11: String, pub payment_hash: Sha256, pub payment_secret: Secret, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_capacity: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_offline: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_deadends: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_private_unused: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_mpp: Option, } impl TryFrom for InvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Invoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListdatastoreDatastore { pub key: Vec, #[serde(skip_serializing_if = "Option::is_none")] pub generation: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, #[serde(skip_serializing_if = "Option::is_none")] pub string: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListdatastoreResponse { pub datastore: Vec, } impl TryFrom for ListdatastoreResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListDatastore(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether it's paid, unpaid or unpayable #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListinvoicesInvoicesStatus { #[serde(rename = "unpaid")] UNPAID, #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, } impl TryFrom for ListinvoicesInvoicesStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListinvoicesInvoicesStatus::UNPAID), 1 => Ok(ListinvoicesInvoicesStatus::PAID), 2 => Ok(ListinvoicesInvoicesStatus::EXPIRED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListinvoicesInvoicesStatus", o)), } } } impl ToString for ListinvoicesInvoicesStatus { fn to_string(&self) -> String { match self { ListinvoicesInvoicesStatus::UNPAID => "UNPAID", ListinvoicesInvoicesStatus::PAID => "PAID", ListinvoicesInvoicesStatus::EXPIRED => "EXPIRED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListinvoicesInvoices { pub label: String, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, pub payment_hash: Sha256, // Path `ListInvoices.invoices[].status` pub status: ListinvoicesInvoicesStatus, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub local_offer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_payer_note: Option, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub updated_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub pay_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_received_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub paid_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListinvoicesResponse { pub invoices: Vec, } impl TryFrom for ListinvoicesResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListInvoices(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of the payment (could be complete if already sent previously) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum SendonionStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "complete")] COMPLETE, } impl TryFrom for SendonionStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(SendonionStatus::PENDING), 1 => Ok(SendonionStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum SendonionStatus", o)), } } } impl ToString for SendonionStatus { fn to_string(&self) -> String { match self { SendonionStatus::PENDING => "PENDING", SendonionStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendonionResponse { pub id: u64, pub payment_hash: Sha256, // Path `SendOnion.status` pub status: SendonionStatus, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub created_at: u64, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub message: Option, } impl TryFrom for SendonionResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SendOnion(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of the payment #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListsendpaysPaymentsStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "failed")] FAILED, #[serde(rename = "complete")] COMPLETE, } impl TryFrom for ListsendpaysPaymentsStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListsendpaysPaymentsStatus::PENDING), 1 => Ok(ListsendpaysPaymentsStatus::FAILED), 2 => Ok(ListsendpaysPaymentsStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListsendpaysPaymentsStatus", o)), } } } impl ToString for ListsendpaysPaymentsStatus { fn to_string(&self) -> String { match self { ListsendpaysPaymentsStatus::PENDING => "PENDING", ListsendpaysPaymentsStatus::FAILED => "FAILED", ListsendpaysPaymentsStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListsendpaysPayments { pub id: u64, pub groupid: u64, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, pub payment_hash: Sha256, // Path `ListSendPays.payments[].status` pub status: ListsendpaysPaymentsStatus, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub created_at: u64, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub erroronion: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListsendpaysResponse { pub payments: Vec, } impl TryFrom for ListsendpaysResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListSendPays(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsTransactionsInputs { pub txid: String, pub index: u32, pub sequence: u32, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsTransactionsOutputs { pub index: u32, pub amount_msat: Amount, #[serde(rename = "scriptPubKey")] pub script_pub_key: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsTransactions { pub hash: String, pub rawtx: String, pub blockheight: u32, pub txindex: u32, pub locktime: u32, pub version: u32, pub inputs: Vec, pub outputs: Vec, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsResponse { pub transactions: Vec, } impl TryFrom for ListtransactionsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListTransactions(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of payment #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum PayStatus { #[serde(rename = "complete")] COMPLETE, #[serde(rename = "pending")] PENDING, #[serde(rename = "failed")] FAILED, } impl TryFrom for PayStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(PayStatus::COMPLETE), 1 => Ok(PayStatus::PENDING), 2 => Ok(PayStatus::FAILED), o => Err(anyhow::anyhow!("Unknown variant {} for enum PayStatus", o)), } } } impl ToString for PayStatus { fn to_string(&self) -> String { match self { PayStatus::COMPLETE => "COMPLETE", PayStatus::PENDING => "PENDING", PayStatus::FAILED => "FAILED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PayResponse { pub payment_preimage: Secret, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub payment_hash: Sha256, pub created_at: f64, pub parts: u32, pub amount_msat: Amount, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub warning_partial_completion: Option, // Path `Pay.status` pub status: PayStatus, } impl TryFrom for PayResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Pay(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Type of connection (until 23.08, `websocket` was also allowed) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListnodesNodesAddressesType { #[serde(rename = "dns")] DNS, #[serde(rename = "ipv4")] IPV4, #[serde(rename = "ipv6")] IPV6, #[serde(rename = "torv2")] TORV2, #[serde(rename = "torv3")] TORV3, } impl TryFrom for ListnodesNodesAddressesType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListnodesNodesAddressesType::DNS), 1 => Ok(ListnodesNodesAddressesType::IPV4), 2 => Ok(ListnodesNodesAddressesType::IPV6), 3 => Ok(ListnodesNodesAddressesType::TORV2), 4 => Ok(ListnodesNodesAddressesType::TORV3), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListnodesNodesAddressesType", o)), } } } impl ToString for ListnodesNodesAddressesType { fn to_string(&self) -> String { match self { ListnodesNodesAddressesType::DNS => "DNS", ListnodesNodesAddressesType::IPV4 => "IPV4", ListnodesNodesAddressesType::IPV6 => "IPV6", ListnodesNodesAddressesType::TORV2 => "TORV2", ListnodesNodesAddressesType::TORV3 => "TORV3", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListnodesNodesAddresses { // Path `ListNodes.nodes[].addresses[].type` #[serde(rename = "type")] pub item_type: ListnodesNodesAddressesType, pub port: u16, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListnodesNodes { pub nodeid: PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub last_timestamp: Option, #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option, #[serde(skip_serializing_if = "Option::is_none")] pub color: Option, #[serde(skip_serializing_if = "Option::is_none")] pub features: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub addresses: Option>, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListnodesResponse { pub nodes: Vec, } impl TryFrom for ListnodesResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListNodes(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether it's paid or expired #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum WaitanyinvoiceStatus { #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, } impl TryFrom for WaitanyinvoiceStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(WaitanyinvoiceStatus::PAID), 1 => Ok(WaitanyinvoiceStatus::EXPIRED), o => Err(anyhow::anyhow!("Unknown variant {} for enum WaitanyinvoiceStatus", o)), } } } impl ToString for WaitanyinvoiceStatus { fn to_string(&self) -> String { match self { WaitanyinvoiceStatus::PAID => "PAID", WaitanyinvoiceStatus::EXPIRED => "EXPIRED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitanyinvoiceResponse { pub label: String, pub description: String, pub payment_hash: Sha256, // Path `WaitAnyInvoice.status` pub status: WaitanyinvoiceStatus, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub updated_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub pay_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_received_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub paid_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, } impl TryFrom for WaitanyinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::WaitAnyInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// Whether it's paid or expired #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum WaitinvoiceStatus { #[serde(rename = "paid")] PAID, #[serde(rename = "expired")] EXPIRED, } impl TryFrom for WaitinvoiceStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(WaitinvoiceStatus::PAID), 1 => Ok(WaitinvoiceStatus::EXPIRED), o => Err(anyhow::anyhow!("Unknown variant {} for enum WaitinvoiceStatus", o)), } } } impl ToString for WaitinvoiceStatus { fn to_string(&self) -> String { match self { WaitinvoiceStatus::PAID => "PAID", WaitinvoiceStatus::EXPIRED => "EXPIRED", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitinvoiceResponse { pub label: String, pub description: String, pub payment_hash: Sha256, // Path `WaitInvoice.status` pub status: WaitinvoiceStatus, pub expires_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub created_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub updated_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub pay_index: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_received_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub paid_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, } impl TryFrom for WaitinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::WaitInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of the payment #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum WaitsendpayStatus { #[serde(rename = "complete")] COMPLETE, } impl TryFrom for WaitsendpayStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(WaitsendpayStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum WaitsendpayStatus", o)), } } } impl ToString for WaitsendpayStatus { fn to_string(&self) -> String { match self { WaitsendpayStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WaitsendpayResponse { pub id: u64, #[serde(skip_serializing_if = "Option::is_none")] pub groupid: Option, pub payment_hash: Sha256, // Path `WaitSendPay.status` pub status: WaitsendpayStatus, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub created_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub completed_at: Option, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub partid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_preimage: Option, } impl TryFrom for WaitsendpayResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::WaitSendPay(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct NewaddrResponse { #[serde(skip_serializing_if = "Option::is_none")] pub p2tr: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bech32: Option, #[deprecated] #[serde(rename = "p2sh-segwit")] #[serde(skip_serializing_if = "Option::is_none")] pub p2sh_segwit: Option, } impl TryFrom for NewaddrResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::NewAddr(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct WithdrawResponse { pub tx: String, pub txid: String, pub psbt: String, } impl TryFrom for WithdrawResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Withdraw(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of payment #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum KeysendStatus { #[serde(rename = "complete")] COMPLETE, } impl TryFrom for KeysendStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(KeysendStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum KeysendStatus", o)), } } } impl ToString for KeysendStatus { fn to_string(&self) -> String { match self { KeysendStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct KeysendResponse { pub payment_preimage: Secret, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub payment_hash: Sha256, pub created_at: f64, pub parts: u32, pub amount_msat: Amount, pub amount_sent_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub warning_partial_completion: Option, // Path `KeySend.status` pub status: KeysendStatus, } impl TryFrom for KeysendResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::KeySend(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FundpsbtReservations { pub txid: String, pub vout: u32, pub was_reserved: bool, pub reserved: bool, pub reserved_to_block: u32, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FundpsbtResponse { pub psbt: String, pub feerate_per_kw: u32, pub estimated_final_weight: u32, pub excess_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub change_outnum: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub reservations: Option>, } impl TryFrom for FundpsbtResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::FundPsbt(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendpsbtResponse { pub tx: String, pub txid: String, } impl TryFrom for SendpsbtResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SendPsbt(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SignpsbtResponse { pub signed_psbt: String, } impl TryFrom for SignpsbtResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SignPsbt(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UtxopsbtReservations { pub txid: String, pub vout: u32, pub was_reserved: bool, pub reserved: bool, pub reserved_to_block: u32, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UtxopsbtResponse { pub psbt: String, pub feerate_per_kw: u32, pub estimated_final_weight: u32, pub excess_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub change_outnum: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub reservations: Option>, } impl TryFrom for UtxopsbtResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::UtxoPsbt(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxdiscardResponse { pub unsigned_tx: String, pub txid: String, } impl TryFrom for TxdiscardResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::TxDiscard(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxprepareResponse { pub psbt: String, pub unsigned_tx: String, pub txid: String, } impl TryFrom for TxprepareResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::TxPrepare(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct TxsendResponse { pub psbt: String, pub tx: String, pub txid: String, } impl TryFrom for TxsendResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::TxSend(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// the channel state, in particular "CHANNELD_NORMAL" means the channel can be used normally #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpeerchannelsChannelsState { #[serde(rename = "OPENINGD")] OPENINGD, #[serde(rename = "CHANNELD_AWAITING_LOCKIN")] CHANNELD_AWAITING_LOCKIN, #[serde(rename = "CHANNELD_NORMAL")] CHANNELD_NORMAL, #[serde(rename = "CHANNELD_SHUTTING_DOWN")] CHANNELD_SHUTTING_DOWN, #[serde(rename = "CLOSINGD_SIGEXCHANGE")] CLOSINGD_SIGEXCHANGE, #[serde(rename = "CLOSINGD_COMPLETE")] CLOSINGD_COMPLETE, #[serde(rename = "AWAITING_UNILATERAL")] AWAITING_UNILATERAL, #[serde(rename = "FUNDING_SPEND_SEEN")] FUNDING_SPEND_SEEN, #[serde(rename = "ONCHAIN")] ONCHAIN, #[serde(rename = "DUALOPEND_OPEN_INIT")] DUALOPEND_OPEN_INIT, #[serde(rename = "DUALOPEND_AWAITING_LOCKIN")] DUALOPEND_AWAITING_LOCKIN, #[serde(rename = "CHANNELD_AWAITING_SPLICE")] CHANNELD_AWAITING_SPLICE, } impl TryFrom for ListpeerchannelsChannelsState { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpeerchannelsChannelsState::OPENINGD), 1 => Ok(ListpeerchannelsChannelsState::CHANNELD_AWAITING_LOCKIN), 2 => Ok(ListpeerchannelsChannelsState::CHANNELD_NORMAL), 3 => Ok(ListpeerchannelsChannelsState::CHANNELD_SHUTTING_DOWN), 4 => Ok(ListpeerchannelsChannelsState::CLOSINGD_SIGEXCHANGE), 5 => Ok(ListpeerchannelsChannelsState::CLOSINGD_COMPLETE), 6 => Ok(ListpeerchannelsChannelsState::AWAITING_UNILATERAL), 7 => Ok(ListpeerchannelsChannelsState::FUNDING_SPEND_SEEN), 8 => Ok(ListpeerchannelsChannelsState::ONCHAIN), 9 => Ok(ListpeerchannelsChannelsState::DUALOPEND_OPEN_INIT), 10 => Ok(ListpeerchannelsChannelsState::DUALOPEND_AWAITING_LOCKIN), 11 => Ok(ListpeerchannelsChannelsState::CHANNELD_AWAITING_SPLICE), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpeerchannelsChannelsState", o)), } } } impl ToString for ListpeerchannelsChannelsState { fn to_string(&self) -> String { match self { ListpeerchannelsChannelsState::OPENINGD => "OPENINGD", ListpeerchannelsChannelsState::CHANNELD_AWAITING_LOCKIN => "CHANNELD_AWAITING_LOCKIN", ListpeerchannelsChannelsState::CHANNELD_NORMAL => "CHANNELD_NORMAL", ListpeerchannelsChannelsState::CHANNELD_SHUTTING_DOWN => "CHANNELD_SHUTTING_DOWN", ListpeerchannelsChannelsState::CLOSINGD_SIGEXCHANGE => "CLOSINGD_SIGEXCHANGE", ListpeerchannelsChannelsState::CLOSINGD_COMPLETE => "CLOSINGD_COMPLETE", ListpeerchannelsChannelsState::AWAITING_UNILATERAL => "AWAITING_UNILATERAL", ListpeerchannelsChannelsState::FUNDING_SPEND_SEEN => "FUNDING_SPEND_SEEN", ListpeerchannelsChannelsState::ONCHAIN => "ONCHAIN", ListpeerchannelsChannelsState::DUALOPEND_OPEN_INIT => "DUALOPEND_OPEN_INIT", ListpeerchannelsChannelsState::DUALOPEND_AWAITING_LOCKIN => "DUALOPEND_AWAITING_LOCKIN", ListpeerchannelsChannelsState::CHANNELD_AWAITING_SPLICE => "CHANNELD_AWAITING_SPLICE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannelsFeerate { #[serde(skip_serializing_if = "Option::is_none")] pub perkw: Option, #[serde(skip_serializing_if = "Option::is_none")] pub perkb: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannelsInflight { #[serde(skip_serializing_if = "Option::is_none")] pub funding_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_outnum: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub total_funding_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub splice_amount: Option, #[serde(skip_serializing_if = "Option::is_none")] pub our_funding_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub scratch_txid: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannelsFunding { #[serde(skip_serializing_if = "Option::is_none")] pub pushed_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub local_funds_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub remote_funds_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_paid_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_rcvd_msat: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannelsAlias { #[serde(skip_serializing_if = "Option::is_none")] pub local: Option, #[serde(skip_serializing_if = "Option::is_none")] pub remote: Option, } /// Whether it came from peer, or is going to peer #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpeerchannelsChannelsHtlcsDirection { #[serde(rename = "in")] IN, #[serde(rename = "out")] OUT, } impl TryFrom for ListpeerchannelsChannelsHtlcsDirection { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpeerchannelsChannelsHtlcsDirection::IN), 1 => Ok(ListpeerchannelsChannelsHtlcsDirection::OUT), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpeerchannelsChannelsHtlcsDirection", o)), } } } impl ToString for ListpeerchannelsChannelsHtlcsDirection { fn to_string(&self) -> String { match self { ListpeerchannelsChannelsHtlcsDirection::IN => "IN", ListpeerchannelsChannelsHtlcsDirection::OUT => "OUT", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannelsHtlcs { #[serde(skip_serializing_if = "Option::is_none")] pub direction: Option, #[serde(skip_serializing_if = "Option::is_none")] pub id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub expiry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub local_trimmed: Option, #[serde(skip_serializing_if = "Option::is_none")] pub status: Option, #[serde(skip_serializing_if = "Option::is_none")] pub state: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsChannels { #[serde(skip_serializing_if = "Option::is_none")] pub peer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub peer_connected: Option, #[serde(skip_serializing_if = "Option::is_none")] pub state: Option, #[serde(skip_serializing_if = "Option::is_none")] pub scratch_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub ignore_fee_limits: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub owner: Option, #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_outnum: Option, #[serde(skip_serializing_if = "Option::is_none")] pub initial_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub last_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub next_feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub next_fee_step: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub inflight: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub close_to: Option, #[serde(skip_serializing_if = "Option::is_none")] pub private: Option, #[serde(skip_serializing_if = "Option::is_none")] pub opener: Option, #[serde(skip_serializing_if = "Option::is_none")] pub closer: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding: Option, #[serde(skip_serializing_if = "Option::is_none")] pub to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub min_to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_to_us_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub total_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_base_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_proportional_millionths: Option, #[serde(skip_serializing_if = "Option::is_none")] pub dust_limit_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_total_htlc_in_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub their_reserve_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub our_reserve_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub spendable_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub receivable_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minimum_htlc_in_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub minimum_htlc_out_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub maximum_htlc_out_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub their_to_self_delay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub our_to_self_delay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub max_accepted_htlcs: Option, #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub status: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub in_payments_offered: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_offered_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_payments_fulfilled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub in_fulfilled_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_payments_offered: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_offered_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_payments_fulfilled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_fulfilled_msat: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub htlcs: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub close_to_addr: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpeerchannelsResponse { #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub channels: Option>, } impl TryFrom for ListpeerchannelsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListPeerChannels(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListclosedchannelsClosedchannelsAlias { #[serde(skip_serializing_if = "Option::is_none")] pub local: Option, #[serde(skip_serializing_if = "Option::is_none")] pub remote: Option, } /// What caused the channel to close #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListclosedchannelsClosedchannelsClose_cause { #[serde(rename = "unknown")] UNKNOWN, #[serde(rename = "local")] LOCAL, #[serde(rename = "user")] USER, #[serde(rename = "remote")] REMOTE, #[serde(rename = "protocol")] PROTOCOL, #[serde(rename = "onchain")] ONCHAIN, } impl TryFrom for ListclosedchannelsClosedchannelsClose_cause { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListclosedchannelsClosedchannelsClose_cause::UNKNOWN), 1 => Ok(ListclosedchannelsClosedchannelsClose_cause::LOCAL), 2 => Ok(ListclosedchannelsClosedchannelsClose_cause::USER), 3 => Ok(ListclosedchannelsClosedchannelsClose_cause::REMOTE), 4 => Ok(ListclosedchannelsClosedchannelsClose_cause::PROTOCOL), 5 => Ok(ListclosedchannelsClosedchannelsClose_cause::ONCHAIN), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListclosedchannelsClosedchannelsClose_cause", o)), } } } impl ToString for ListclosedchannelsClosedchannelsClose_cause { fn to_string(&self) -> String { match self { ListclosedchannelsClosedchannelsClose_cause::UNKNOWN => "UNKNOWN", ListclosedchannelsClosedchannelsClose_cause::LOCAL => "LOCAL", ListclosedchannelsClosedchannelsClose_cause::USER => "USER", ListclosedchannelsClosedchannelsClose_cause::REMOTE => "REMOTE", ListclosedchannelsClosedchannelsClose_cause::PROTOCOL => "PROTOCOL", ListclosedchannelsClosedchannelsClose_cause::ONCHAIN => "ONCHAIN", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListclosedchannelsClosedchannels { #[serde(skip_serializing_if = "Option::is_none")] pub peer_id: Option, pub channel_id: Sha256, #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub alias: Option, // Path `ListClosedChannels.closedchannels[].opener` pub opener: ChannelSide, #[serde(skip_serializing_if = "Option::is_none")] pub closer: Option, pub private: bool, pub total_local_commitments: u64, pub total_remote_commitments: u64, pub total_htlcs_sent: u64, pub funding_txid: String, pub funding_outnum: u32, pub leased: bool, #[serde(skip_serializing_if = "Option::is_none")] pub funding_fee_paid_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_fee_rcvd_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub funding_pushed_msat: Option, pub total_msat: Amount, pub final_to_us_msat: Amount, pub min_to_us_msat: Amount, pub max_to_us_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub last_commitment_txid: Option, #[serde(skip_serializing_if = "Option::is_none")] pub last_commitment_fee_msat: Option, // Path `ListClosedChannels.closedchannels[].close_cause` pub close_cause: ListclosedchannelsClosedchannelsClose_cause, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListclosedchannelsResponse { pub closedchannels: Vec, } impl TryFrom for ListclosedchannelsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListClosedChannels(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// the address type (if known) #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum DecodepayFallbacksType { #[serde(rename = "P2PKH")] P2PKH, #[serde(rename = "P2SH")] P2SH, #[serde(rename = "P2WPKH")] P2WPKH, #[serde(rename = "P2WSH")] P2WSH, } impl TryFrom for DecodepayFallbacksType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(DecodepayFallbacksType::P2PKH), 1 => Ok(DecodepayFallbacksType::P2SH), 2 => Ok(DecodepayFallbacksType::P2WPKH), 3 => Ok(DecodepayFallbacksType::P2WSH), o => Err(anyhow::anyhow!("Unknown variant {} for enum DecodepayFallbacksType", o)), } } } impl ToString for DecodepayFallbacksType { fn to_string(&self) -> String { match self { DecodepayFallbacksType::P2PKH => "P2PKH", DecodepayFallbacksType::P2SH => "P2SH", DecodepayFallbacksType::P2WPKH => "P2WPKH", DecodepayFallbacksType::P2WSH => "P2WSH", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodepayFallbacks { // Path `DecodePay.fallbacks[].type` #[serde(rename = "type")] pub item_type: DecodepayFallbacksType, #[serde(skip_serializing_if = "Option::is_none")] pub addr: Option, pub hex: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodepayExtra { pub tag: String, pub data: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodepayResponse { pub currency: String, pub created_at: u64, pub expiry: u64, pub payee: PublicKey, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, pub payment_hash: Sha256, pub signature: String, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description_hash: Option, pub min_final_cltv_expiry: u32, #[serde(skip_serializing_if = "Option::is_none")] pub payment_secret: Option, #[serde(skip_serializing_if = "Option::is_none")] pub features: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_metadata: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub fallbacks: Option>, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub extra: Option>, } impl TryFrom for DecodepayResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::DecodePay(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// what kind of object it decoded to #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum DecodeType { #[serde(rename = "bolt12 offer")] BOLT12_OFFER, #[serde(rename = "bolt12 invoice")] BOLT12_INVOICE, #[serde(rename = "bolt12 invoice_request")] BOLT12_INVOICE_REQUEST, #[serde(rename = "bolt11 invoice")] BOLT11_INVOICE, #[serde(rename = "rune")] RUNE, } impl TryFrom for DecodeType { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(DecodeType::BOLT12_OFFER), 1 => Ok(DecodeType::BOLT12_INVOICE), 2 => Ok(DecodeType::BOLT12_INVOICE_REQUEST), 3 => Ok(DecodeType::BOLT11_INVOICE), 4 => Ok(DecodeType::RUNE), o => Err(anyhow::anyhow!("Unknown variant {} for enum DecodeType", o)), } } } impl ToString for DecodeType { fn to_string(&self) -> String { match self { DecodeType::BOLT12_OFFER => "BOLT12_OFFER", DecodeType::BOLT12_INVOICE => "BOLT12_INVOICE", DecodeType::BOLT12_INVOICE_REQUEST => "BOLT12_INVOICE_REQUEST", DecodeType::BOLT11_INVOICE => "BOLT11_INVOICE", DecodeType::RUNE => "RUNE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeOffer_paths { pub first_node_id: PublicKey, pub blinding: PublicKey, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeInvoice_fallbacks { pub version: u8, pub hex: String, #[serde(skip_serializing_if = "Option::is_none")] pub address: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeFallbacks { #[serde(skip_serializing_if = "Option::is_none")] pub warning_invoice_fallbacks_version_invalid: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeExtra { pub tag: String, pub data: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeRestrictions { pub alternatives: Vec, pub summary: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DecodeResponse { // Path `Decode.type` #[serde(rename = "type")] pub item_type: DecodeType, pub valid: bool, #[serde(skip_serializing_if = "Option::is_none")] pub offer_id: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub offer_chains: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub offer_metadata: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_currency: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_unknown_offer_currency: Option, #[serde(skip_serializing_if = "Option::is_none")] pub currency_minor_unit: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_amount: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_issuer: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_features: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_absolute_expiry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub offer_quantity_max: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub offer_paths: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub offer_node_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_offer_node_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_offer_description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_offer_description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_offer_currency: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_offer_issuer: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_metadata: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_payer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_chain: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_features: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_quantity: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_payer_note: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_recurrence_counter: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invreq_recurrence_start: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invreq_metadata: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invreq_payer_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_invreq_payer_note: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_request_signature: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_invoice_request_signature: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_created_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_relative_expiry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_amount_msat: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub invoice_fallbacks: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_features: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_node_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub invoice_recurrence_basetime: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_paths: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_blindedpay: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_created_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_amount: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_recurrence_basetime: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_node_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_invoice_signature: Option, #[serde(skip_serializing_if = "Option::is_none")] pub warning_invalid_invoice_signature: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub fallbacks: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub created_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub expiry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payee: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description_hash: Option, #[serde(skip_serializing_if = "Option::is_none")] pub min_final_cltv_expiry: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_secret: Option, #[serde(skip_serializing_if = "Option::is_none")] pub payment_metadata: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub extra: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub unique_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub version: Option, #[serde(skip_serializing_if = "Option::is_none")] pub string: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub restrictions: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub warning_rune_invalid_utf8: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hex: Option, } impl TryFrom for DecodeResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Decode(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct DisconnectResponse { } impl TryFrom for DisconnectResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Disconnect(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesPerkbEstimates { #[serde(skip_serializing_if = "Option::is_none")] pub blockcount: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub smoothed_feerate: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesPerkb { pub min_acceptable: u32, pub max_acceptable: u32, #[serde(skip_serializing_if = "Option::is_none")] pub floor: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub estimates: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub opening: Option, #[serde(skip_serializing_if = "Option::is_none")] pub mutual_close: Option, #[serde(skip_serializing_if = "Option::is_none")] pub unilateral_close: Option, #[serde(skip_serializing_if = "Option::is_none")] pub unilateral_anchor_close: Option, #[deprecated] #[serde(skip_serializing_if = "Option::is_none")] pub delayed_to_us: Option, #[deprecated] #[serde(skip_serializing_if = "Option::is_none")] pub htlc_resolution: Option, #[serde(skip_serializing_if = "Option::is_none")] pub penalty: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesPerkwEstimates { #[serde(skip_serializing_if = "Option::is_none")] pub blockcount: Option, #[serde(skip_serializing_if = "Option::is_none")] pub feerate: Option, #[serde(skip_serializing_if = "Option::is_none")] pub smoothed_feerate: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesPerkw { pub min_acceptable: u32, pub max_acceptable: u32, #[serde(skip_serializing_if = "Option::is_none")] pub floor: Option, #[serde(skip_serializing_if = "crate::is_none_or_empty")] pub estimates: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub opening: Option, #[serde(skip_serializing_if = "Option::is_none")] pub mutual_close: Option, #[serde(skip_serializing_if = "Option::is_none")] pub unilateral_close: Option, #[serde(skip_serializing_if = "Option::is_none")] pub unilateral_anchor_close: Option, #[deprecated] #[serde(skip_serializing_if = "Option::is_none")] pub delayed_to_us: Option, #[deprecated] #[serde(skip_serializing_if = "Option::is_none")] pub htlc_resolution: Option, #[serde(skip_serializing_if = "Option::is_none")] pub penalty: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesOnchain_fee_estimates { pub opening_channel_satoshis: u64, pub mutual_close_satoshis: u64, pub unilateral_close_satoshis: u64, #[serde(skip_serializing_if = "Option::is_none")] pub unilateral_close_nonanchor_satoshis: Option, pub htlc_timeout_satoshis: u64, pub htlc_success_satoshis: u64, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FeeratesResponse { #[serde(skip_serializing_if = "Option::is_none")] pub warning_missing_feerates: Option, #[serde(skip_serializing_if = "Option::is_none")] pub perkb: Option, #[serde(skip_serializing_if = "Option::is_none")] pub perkw: Option, #[serde(skip_serializing_if = "Option::is_none")] pub onchain_fee_estimates: Option, } impl TryFrom for FeeratesResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Feerates(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct FundchannelResponse { pub tx: String, pub txid: String, pub outnum: u32, pub channel_id: String, #[serde(skip_serializing_if = "Option::is_none")] pub close_to: Option, #[serde(skip_serializing_if = "Option::is_none")] pub mindepth: Option, } impl TryFrom for FundchannelResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::FundChannel(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// The features understood by the destination node #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum GetrouteRouteStyle { #[serde(rename = "tlv")] TLV, } impl TryFrom for GetrouteRouteStyle { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(GetrouteRouteStyle::TLV), o => Err(anyhow::anyhow!("Unknown variant {} for enum GetrouteRouteStyle", o)), } } } impl ToString for GetrouteRouteStyle { fn to_string(&self) -> String { match self { GetrouteRouteStyle::TLV => "TLV", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetrouteRoute { pub id: PublicKey, pub channel: ShortChannelId, pub direction: u32, pub amount_msat: Amount, pub delay: u32, // Path `GetRoute.route[].style` pub style: GetrouteRouteStyle, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct GetrouteResponse { pub route: Vec, } impl TryFrom for GetrouteResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::GetRoute(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// still ongoing, completed, failed locally, or failed after forwarding #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListforwardsForwardsStatus { #[serde(rename = "offered")] OFFERED, #[serde(rename = "settled")] SETTLED, #[serde(rename = "local_failed")] LOCAL_FAILED, #[serde(rename = "failed")] FAILED, } impl TryFrom for ListforwardsForwardsStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListforwardsForwardsStatus::OFFERED), 1 => Ok(ListforwardsForwardsStatus::SETTLED), 2 => Ok(ListforwardsForwardsStatus::LOCAL_FAILED), 3 => Ok(ListforwardsForwardsStatus::FAILED), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListforwardsForwardsStatus", o)), } } } impl ToString for ListforwardsForwardsStatus { fn to_string(&self) -> String { match self { ListforwardsForwardsStatus::OFFERED => "OFFERED", ListforwardsForwardsStatus::SETTLED => "SETTLED", ListforwardsForwardsStatus::LOCAL_FAILED => "LOCAL_FAILED", ListforwardsForwardsStatus::FAILED => "FAILED", }.to_string() } } /// Either a legacy onion format or a modern tlv format #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListforwardsForwardsStyle { #[serde(rename = "legacy")] LEGACY, #[serde(rename = "tlv")] TLV, } impl TryFrom for ListforwardsForwardsStyle { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListforwardsForwardsStyle::LEGACY), 1 => Ok(ListforwardsForwardsStyle::TLV), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListforwardsForwardsStyle", o)), } } } impl ToString for ListforwardsForwardsStyle { fn to_string(&self) -> String { match self { ListforwardsForwardsStyle::LEGACY => "LEGACY", ListforwardsForwardsStyle::TLV => "TLV", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListforwardsForwards { pub in_channel: ShortChannelId, #[serde(skip_serializing_if = "Option::is_none")] pub in_htlc_id: Option, pub in_msat: Amount, // Path `ListForwards.forwards[].status` pub status: ListforwardsForwardsStatus, pub received_time: f64, #[serde(skip_serializing_if = "Option::is_none")] pub out_channel: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_htlc_id: Option, #[serde(skip_serializing_if = "Option::is_none")] pub style: Option, #[serde(skip_serializing_if = "Option::is_none")] pub fee_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub out_msat: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListforwardsResponse { pub forwards: Vec, } impl TryFrom for ListforwardsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListForwards(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// status of the payment #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListpaysPaysStatus { #[serde(rename = "pending")] PENDING, #[serde(rename = "failed")] FAILED, #[serde(rename = "complete")] COMPLETE, } impl TryFrom for ListpaysPaysStatus { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListpaysPaysStatus::PENDING), 1 => Ok(ListpaysPaysStatus::FAILED), 2 => Ok(ListpaysPaysStatus::COMPLETE), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListpaysPaysStatus", o)), } } } impl ToString for ListpaysPaysStatus { fn to_string(&self) -> String { match self { ListpaysPaysStatus::PENDING => "PENDING", ListpaysPaysStatus::FAILED => "FAILED", ListpaysPaysStatus::COMPLETE => "COMPLETE", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpaysPays { pub payment_hash: Sha256, // Path `ListPays.pays[].status` pub status: ListpaysPaysStatus, #[serde(skip_serializing_if = "Option::is_none")] pub destination: Option, pub created_at: u64, #[serde(skip_serializing_if = "Option::is_none")] pub completed_at: Option, #[serde(skip_serializing_if = "Option::is_none")] pub label: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt11: Option, #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(skip_serializing_if = "Option::is_none")] pub bolt12: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub amount_sent_msat: Option, #[serde(skip_serializing_if = "Option::is_none")] pub preimage: Option, #[serde(skip_serializing_if = "Option::is_none")] pub number_of_parts: Option, #[serde(skip_serializing_if = "Option::is_none")] pub erroronion: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListpaysResponse { pub pays: Vec, } impl TryFrom for ListpaysResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListPays(response) => Ok(response), _ => Err(TryFromResponseError) } } } /// out if we offered this to the peer, in if they offered it #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub enum ListhtlcsHtlcsDirection { #[serde(rename = "out")] OUT, #[serde(rename = "in")] IN, } impl TryFrom for ListhtlcsHtlcsDirection { type Error = anyhow::Error; fn try_from(c: i32) -> Result { match c { 0 => Ok(ListhtlcsHtlcsDirection::OUT), 1 => Ok(ListhtlcsHtlcsDirection::IN), o => Err(anyhow::anyhow!("Unknown variant {} for enum ListhtlcsHtlcsDirection", o)), } } } impl ToString for ListhtlcsHtlcsDirection { fn to_string(&self) -> String { match self { ListhtlcsHtlcsDirection::OUT => "OUT", ListhtlcsHtlcsDirection::IN => "IN", }.to_string() } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListhtlcsHtlcs { pub short_channel_id: ShortChannelId, pub id: u64, pub expiry: u32, pub amount_msat: Amount, // Path `ListHtlcs.htlcs[].direction` pub direction: ListhtlcsHtlcsDirection, pub payment_hash: Sha256, // Path `ListHtlcs.htlcs[].state` pub state: HtlcState, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListhtlcsResponse { pub htlcs: Vec, } impl TryFrom for ListhtlcsResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::ListHtlcs(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PingResponse { pub totlen: u16, } impl TryFrom for PingResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Ping(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SendcustommsgResponse { pub status: String, } impl TryFrom for SendcustommsgResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SendCustomMsg(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SetchannelChannels { pub peer_id: PublicKey, pub channel_id: String, #[serde(skip_serializing_if = "Option::is_none")] pub short_channel_id: Option, pub fee_base_msat: Amount, pub fee_proportional_millionths: u32, #[serde(skip_serializing_if = "Option::is_none")] pub ignore_fee_limits: Option, pub minimum_htlc_out_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub warning_htlcmin_too_low: Option, pub maximum_htlc_out_msat: Amount, #[serde(skip_serializing_if = "Option::is_none")] pub warning_htlcmax_too_high: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SetchannelResponse { pub channels: Vec, } impl TryFrom for SetchannelResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SetChannel(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SigninvoiceResponse { pub bolt11: String, } impl TryFrom for SigninvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SignInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SignmessageResponse { pub signature: String, pub recid: String, pub zbase: String, } impl TryFrom for SignmessageResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::SignMessage(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct StopResponse { } impl TryFrom for StopResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::Stop(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PreapprovekeysendResponse { } impl TryFrom for PreapprovekeysendResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::PreApproveKeysend(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PreapproveinvoiceResponse { } impl TryFrom for PreapproveinvoiceResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::PreApproveInvoice(response) => Ok(response), _ => Err(TryFromResponseError) } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct StaticbackupResponse { pub scb: Vec, } impl TryFrom for StaticbackupResponse { type Error = super::TryFromResponseError; fn try_from(response: Response) -> Result { match response { Response::StaticBackup(response) => Ok(response), _ => Err(TryFromResponseError) } } } }