use std::convert::From;
#[allow(unused_imports)]
use cln_rpc::model::{responses,requests};
use crate::pb;
use std::str::FromStr;
use bitcoin::hashes::sha256::Hash as Sha256;
use bitcoin::hashes::Hash;
use cln_rpc::primitives::PublicKey;
#[allow(unused_variables)]
impl From<responses::GetinfoOur_features> for pb::GetinfoOurFeatures {
fn from(c: responses::GetinfoOur_features) -> Self {
Self {
init: hex::decode(&c.init).unwrap(), node: hex::decode(&c.node).unwrap(), channel: hex::decode(&c.channel).unwrap(), invoice: hex::decode(&c.invoice).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::GetinfoAddress> for pb::GetinfoAddress {
fn from(c: responses::GetinfoAddress) -> Self {
Self {
item_type: c.item_type as i32,
port: c.port.into(), address: c.address, }
}
}
#[allow(unused_variables)]
impl From<responses::GetinfoBinding> for pb::GetinfoBinding {
fn from(c: responses::GetinfoBinding) -> Self {
Self {
item_type: c.item_type as i32,
address: c.address, port: c.port.map(|v| v.into()), socket: c.socket, }
}
}
#[allow(unused_variables)]
impl From<responses::GetinfoResponse> for pb::GetinfoResponse {
fn from(c: responses::GetinfoResponse) -> Self {
Self {
id: c.id.serialize().to_vec(), alias: c.alias, color: hex::decode(&c.color).unwrap(), num_peers: c.num_peers, num_pending_channels: c.num_pending_channels, num_active_channels: c.num_active_channels, num_inactive_channels: c.num_inactive_channels, version: c.version, lightning_dir: c.lightning_dir, our_features: c.our_features.map(|v| v.into()),
blockheight: c.blockheight, network: c.network, fees_collected_msat: Some(c.fees_collected_msat.into()), address: c.address.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), binding: c.binding.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), warning_bitcoind_sync: c.warning_bitcoind_sync, warning_lightningd_sync: c.warning_lightningd_sync, }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersLog> for pb::ListpeersPeersLog {
fn from(c: responses::ListpeersPeersLog) -> Self {
Self {
item_type: c.item_type as i32,
num_skipped: c.num_skipped, time: c.time, source: c.source, log: c.log, node_id: c.node_id.map(|v| v.serialize().to_vec()), data: c.data.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannelsFeerate> for pb::ListpeersPeersChannelsFeerate {
fn from(c: responses::ListpeersPeersChannelsFeerate) -> Self {
Self {
perkw: c.perkw, perkb: c.perkb, }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannelsInflight> for pb::ListpeersPeersChannelsInflight {
fn from(c: responses::ListpeersPeersChannelsInflight) -> Self {
Self {
funding_txid: hex::decode(&c.funding_txid).unwrap(), funding_outnum: c.funding_outnum, feerate: c.feerate, total_funding_msat: Some(c.total_funding_msat.into()), our_funding_msat: Some(c.our_funding_msat.into()), splice_amount: c.splice_amount, scratch_txid: hex::decode(&c.scratch_txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannelsFunding> for pb::ListpeersPeersChannelsFunding {
fn from(c: responses::ListpeersPeersChannelsFunding) -> Self {
Self {
pushed_msat: c.pushed_msat.map(|f| f.into()), local_funds_msat: Some(c.local_funds_msat.into()), remote_funds_msat: Some(c.remote_funds_msat.into()), fee_paid_msat: c.fee_paid_msat.map(|f| f.into()), fee_rcvd_msat: c.fee_rcvd_msat.map(|f| f.into()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannelsAlias> for pb::ListpeersPeersChannelsAlias {
fn from(c: responses::ListpeersPeersChannelsAlias) -> Self {
Self {
local: c.local.map(|v| v.to_string()), remote: c.remote.map(|v| v.to_string()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannelsHtlcs> for pb::ListpeersPeersChannelsHtlcs {
fn from(c: responses::ListpeersPeersChannelsHtlcs) -> Self {
Self {
direction: c.direction as i32,
id: c.id, amount_msat: Some(c.amount_msat.into()), expiry: c.expiry, payment_hash: c.payment_hash.to_vec(), local_trimmed: c.local_trimmed, status: c.status, state: c.state as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersPeersChannels> for pb::ListpeersPeersChannels {
fn from(c: responses::ListpeersPeersChannels) -> Self {
Self {
state: c.state as i32,
scratch_txid: c.scratch_txid.map(|v| hex::decode(v).unwrap()), feerate: c.feerate.map(|v| v.into()),
owner: c.owner, short_channel_id: c.short_channel_id.map(|v| v.to_string()), channel_id: c.channel_id.map(|v| v.to_vec()), funding_txid: c.funding_txid.map(|v| hex::decode(v).unwrap()), funding_outnum: c.funding_outnum, initial_feerate: c.initial_feerate, last_feerate: c.last_feerate, next_feerate: c.next_feerate, next_fee_step: c.next_fee_step, inflight: c.inflight.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), close_to: c.close_to.map(|v| hex::decode(v).unwrap()), private: c.private, opener: c.opener as i32,
closer: c.closer.map(|v| v as i32),
features: c.features.into_iter().map(|i| i.into()).collect(), funding: c.funding.map(|v| v.into()),
to_us_msat: c.to_us_msat.map(|f| f.into()), min_to_us_msat: c.min_to_us_msat.map(|f| f.into()), max_to_us_msat: c.max_to_us_msat.map(|f| f.into()), total_msat: c.total_msat.map(|f| f.into()), fee_base_msat: c.fee_base_msat.map(|f| f.into()), fee_proportional_millionths: c.fee_proportional_millionths, dust_limit_msat: c.dust_limit_msat.map(|f| f.into()), max_total_htlc_in_msat: c.max_total_htlc_in_msat.map(|f| f.into()), their_reserve_msat: c.their_reserve_msat.map(|f| f.into()), our_reserve_msat: c.our_reserve_msat.map(|f| f.into()), spendable_msat: c.spendable_msat.map(|f| f.into()), receivable_msat: c.receivable_msat.map(|f| f.into()), minimum_htlc_in_msat: c.minimum_htlc_in_msat.map(|f| f.into()), minimum_htlc_out_msat: c.minimum_htlc_out_msat.map(|f| f.into()), maximum_htlc_out_msat: c.maximum_htlc_out_msat.map(|f| f.into()), their_to_self_delay: c.their_to_self_delay, our_to_self_delay: c.our_to_self_delay, max_accepted_htlcs: c.max_accepted_htlcs, alias: c.alias.map(|v| v.into()),
status: c.status.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), in_payments_offered: c.in_payments_offered, in_offered_msat: c.in_offered_msat.map(|f| f.into()), in_payments_fulfilled: c.in_payments_fulfilled, in_fulfilled_msat: c.in_fulfilled_msat.map(|f| f.into()), out_payments_offered: c.out_payments_offered, out_offered_msat: c.out_offered_msat.map(|f| f.into()), out_payments_fulfilled: c.out_payments_fulfilled, out_fulfilled_msat: c.out_fulfilled_msat.map(|f| f.into()), htlcs: c.htlcs.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), close_to_addr: c.close_to_addr, }
}
}
#[allow(unused_variables,deprecated)]
impl From<responses::ListpeersPeers> for pb::ListpeersPeers {
fn from(c: responses::ListpeersPeers) -> Self {
Self {
id: c.id.serialize().to_vec(), connected: c.connected, num_channels: c.num_channels, log: c.log.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), channels: c.channels.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), netaddr: c.netaddr.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), remote_addr: c.remote_addr, features: c.features.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeersResponse> for pb::ListpeersResponse {
fn from(c: responses::ListpeersResponse) -> Self {
Self {
peers: c.peers.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListfundsOutputs> for pb::ListfundsOutputs {
fn from(c: responses::ListfundsOutputs) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), output: c.output, amount_msat: Some(c.amount_msat.into()), scriptpubkey: hex::decode(&c.scriptpubkey).unwrap(), address: c.address, redeemscript: c.redeemscript.map(|v| hex::decode(v).unwrap()), status: c.status as i32,
reserved: c.reserved, blockheight: c.blockheight, }
}
}
#[allow(unused_variables)]
impl From<responses::ListfundsChannels> for pb::ListfundsChannels {
fn from(c: responses::ListfundsChannels) -> Self {
Self {
peer_id: c.peer_id.serialize().to_vec(), our_amount_msat: Some(c.our_amount_msat.into()), amount_msat: Some(c.amount_msat.into()), funding_txid: hex::decode(&c.funding_txid).unwrap(), funding_output: c.funding_output, connected: c.connected, state: c.state as i32,
channel_id: c.channel_id.map(|v| v.to_vec()), short_channel_id: c.short_channel_id.map(|v| v.to_string()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListfundsResponse> for pb::ListfundsResponse {
fn from(c: responses::ListfundsResponse) -> Self {
Self {
outputs: c.outputs.into_iter().map(|i| i.into()).collect(), channels: c.channels.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::SendpayResponse> for pb::SendpayResponse {
fn from(c: responses::SendpayResponse) -> Self {
Self {
id: c.id, groupid: c.groupid, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
amount_msat: c.amount_msat.map(|f| f.into()), destination: c.destination.map(|v| v.serialize().to_vec()), created_at: c.created_at, completed_at: c.completed_at, amount_sent_msat: Some(c.amount_sent_msat.into()), label: c.label, partid: c.partid, bolt11: c.bolt11, bolt12: c.bolt12, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), message: c.message, }
}
}
#[allow(unused_variables)]
impl From<responses::ListchannelsChannels> for pb::ListchannelsChannels {
fn from(c: responses::ListchannelsChannels) -> Self {
Self {
source: c.source.serialize().to_vec(), destination: c.destination.serialize().to_vec(), short_channel_id: c.short_channel_id.to_string(), direction: c.direction, public: c.public, amount_msat: Some(c.amount_msat.into()), message_flags: c.message_flags.into(), channel_flags: c.channel_flags.into(), active: c.active, last_update: c.last_update, base_fee_millisatoshi: c.base_fee_millisatoshi, fee_per_millionth: c.fee_per_millionth, delay: c.delay, htlc_minimum_msat: Some(c.htlc_minimum_msat.into()), htlc_maximum_msat: c.htlc_maximum_msat.map(|f| f.into()), features: hex::decode(&c.features).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListchannelsResponse> for pb::ListchannelsResponse {
fn from(c: responses::ListchannelsResponse) -> Self {
Self {
channels: c.channels.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::AddgossipResponse> for pb::AddgossipResponse {
fn from(c: responses::AddgossipResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::AutocleaninvoiceResponse> for pb::AutocleaninvoiceResponse {
fn from(c: responses::AutocleaninvoiceResponse) -> Self {
Self {
enabled: c.enabled, expired_by: c.expired_by, cycle_seconds: c.cycle_seconds, }
}
}
#[allow(unused_variables)]
impl From<responses::CheckmessageResponse> for pb::CheckmessageResponse {
fn from(c: responses::CheckmessageResponse) -> Self {
Self {
verified: c.verified, pubkey: c.pubkey.serialize().to_vec(), }
}
}
#[allow(unused_variables)]
impl From<responses::CloseResponse> for pb::CloseResponse {
fn from(c: responses::CloseResponse) -> Self {
Self {
item_type: c.item_type as i32,
tx: c.tx.map(|v| hex::decode(v).unwrap()), txid: c.txid.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ConnectAddress> for pb::ConnectAddress {
fn from(c: responses::ConnectAddress) -> Self {
Self {
item_type: c.item_type as i32,
socket: c.socket, address: c.address, port: c.port.map(|v| v.into()), }
}
}
#[allow(unused_variables)]
impl From<responses::ConnectResponse> for pb::ConnectResponse {
fn from(c: responses::ConnectResponse) -> Self {
Self {
id: c.id.serialize().to_vec(), features: hex::decode(&c.features).unwrap(), direction: c.direction as i32,
address: Some(c.address.into()),
}
}
}
#[allow(unused_variables)]
impl From<responses::CreateinvoiceResponse> for pb::CreateinvoiceResponse {
fn from(c: responses::CreateinvoiceResponse) -> Self {
Self {
label: c.label, bolt11: c.bolt11, bolt12: c.bolt12, payment_hash: c.payment_hash.to_vec(), amount_msat: c.amount_msat.map(|f| f.into()), status: c.status as i32,
description: c.description, expires_at: c.expires_at, created_index: c.created_index, pay_index: c.pay_index, amount_received_msat: c.amount_received_msat.map(|f| f.into()), paid_at: c.paid_at, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), local_offer_id: c.local_offer_id.map(|v| hex::decode(v).unwrap()), invreq_payer_note: c.invreq_payer_note, }
}
}
#[allow(unused_variables)]
impl From<responses::DatastoreResponse> for pb::DatastoreResponse {
fn from(c: responses::DatastoreResponse) -> Self {
Self {
key: c.key.into_iter().map(|i| i.into()).collect(), generation: c.generation, hex: c.hex.map(|v| hex::decode(v).unwrap()), string: c.string, }
}
}
#[allow(unused_variables)]
impl From<responses::CreateonionResponse> for pb::CreateonionResponse {
fn from(c: responses::CreateonionResponse) -> Self {
Self {
onion: hex::decode(&c.onion).unwrap(), shared_secrets: c.shared_secrets.into_iter().map(|i| i.to_vec()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::DeldatastoreResponse> for pb::DeldatastoreResponse {
fn from(c: responses::DeldatastoreResponse) -> Self {
Self {
key: c.key.into_iter().map(|i| i.into()).collect(), generation: c.generation, hex: c.hex.map(|v| hex::decode(v).unwrap()), string: c.string, }
}
}
#[allow(unused_variables)]
impl From<responses::DelexpiredinvoiceResponse> for pb::DelexpiredinvoiceResponse {
fn from(c: responses::DelexpiredinvoiceResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::DelinvoiceResponse> for pb::DelinvoiceResponse {
fn from(c: responses::DelinvoiceResponse) -> Self {
Self {
label: c.label, bolt11: c.bolt11, bolt12: c.bolt12, amount_msat: c.amount_msat.map(|f| f.into()), description: c.description, payment_hash: c.payment_hash.to_vec(), created_index: c.created_index, updated_index: c.updated_index, status: c.status as i32,
expires_at: c.expires_at, local_offer_id: c.local_offer_id.map(|v| hex::decode(v).unwrap()), invreq_payer_note: c.invreq_payer_note, }
}
}
#[allow(unused_variables)]
impl From<responses::InvoiceResponse> for pb::InvoiceResponse {
fn from(c: responses::InvoiceResponse) -> Self {
Self {
bolt11: c.bolt11, payment_hash: c.payment_hash.to_vec(), payment_secret: c.payment_secret.to_vec(), expires_at: c.expires_at, created_index: c.created_index, warning_capacity: c.warning_capacity, warning_offline: c.warning_offline, warning_deadends: c.warning_deadends, warning_private_unused: c.warning_private_unused, warning_mpp: c.warning_mpp, }
}
}
#[allow(unused_variables)]
impl From<responses::ListdatastoreDatastore> for pb::ListdatastoreDatastore {
fn from(c: responses::ListdatastoreDatastore) -> Self {
Self {
key: c.key.into_iter().map(|i| i.into()).collect(), generation: c.generation, hex: c.hex.map(|v| hex::decode(v).unwrap()), string: c.string, }
}
}
#[allow(unused_variables)]
impl From<responses::ListdatastoreResponse> for pb::ListdatastoreResponse {
fn from(c: responses::ListdatastoreResponse) -> Self {
Self {
datastore: c.datastore.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListinvoicesInvoices> for pb::ListinvoicesInvoices {
fn from(c: responses::ListinvoicesInvoices) -> Self {
Self {
label: c.label, description: c.description, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
expires_at: c.expires_at, amount_msat: c.amount_msat.map(|f| f.into()), bolt11: c.bolt11, bolt12: c.bolt12, local_offer_id: c.local_offer_id.map(|v| v.to_vec()), invreq_payer_note: c.invreq_payer_note, created_index: c.created_index, updated_index: c.updated_index, pay_index: c.pay_index, amount_received_msat: c.amount_received_msat.map(|f| f.into()), paid_at: c.paid_at, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListinvoicesResponse> for pb::ListinvoicesResponse {
fn from(c: responses::ListinvoicesResponse) -> Self {
Self {
invoices: c.invoices.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::SendonionResponse> for pb::SendonionResponse {
fn from(c: responses::SendonionResponse) -> Self {
Self {
id: c.id, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
amount_msat: c.amount_msat.map(|f| f.into()), destination: c.destination.map(|v| v.serialize().to_vec()), created_at: c.created_at, amount_sent_msat: Some(c.amount_sent_msat.into()), label: c.label, bolt11: c.bolt11, bolt12: c.bolt12, partid: c.partid, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), message: c.message, }
}
}
#[allow(unused_variables)]
impl From<responses::ListsendpaysPayments> for pb::ListsendpaysPayments {
fn from(c: responses::ListsendpaysPayments) -> Self {
Self {
id: c.id, groupid: c.groupid, partid: c.partid, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
amount_msat: c.amount_msat.map(|f| f.into()), destination: c.destination.map(|v| v.serialize().to_vec()), created_at: c.created_at, amount_sent_msat: Some(c.amount_sent_msat.into()), label: c.label, bolt11: c.bolt11, description: c.description, bolt12: c.bolt12, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), erroronion: c.erroronion.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListsendpaysResponse> for pb::ListsendpaysResponse {
fn from(c: responses::ListsendpaysResponse) -> Self {
Self {
payments: c.payments.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListtransactionsTransactionsInputs> for pb::ListtransactionsTransactionsInputs {
fn from(c: responses::ListtransactionsTransactionsInputs) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), index: c.index, sequence: c.sequence, }
}
}
#[allow(unused_variables)]
impl From<responses::ListtransactionsTransactionsOutputs> for pb::ListtransactionsTransactionsOutputs {
fn from(c: responses::ListtransactionsTransactionsOutputs) -> Self {
Self {
index: c.index, amount_msat: Some(c.amount_msat.into()), script_pub_key: hex::decode(&c.script_pub_key).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListtransactionsTransactions> for pb::ListtransactionsTransactions {
fn from(c: responses::ListtransactionsTransactions) -> Self {
Self {
hash: hex::decode(&c.hash).unwrap(), rawtx: hex::decode(&c.rawtx).unwrap(), blockheight: c.blockheight, txindex: c.txindex, locktime: c.locktime, version: c.version, inputs: c.inputs.into_iter().map(|i| i.into()).collect(), outputs: c.outputs.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListtransactionsResponse> for pb::ListtransactionsResponse {
fn from(c: responses::ListtransactionsResponse) -> Self {
Self {
transactions: c.transactions.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::PayResponse> for pb::PayResponse {
fn from(c: responses::PayResponse) -> Self {
Self {
payment_preimage: c.payment_preimage.to_vec(), destination: c.destination.map(|v| v.serialize().to_vec()), payment_hash: c.payment_hash.to_vec(), created_at: c.created_at, parts: c.parts, amount_msat: Some(c.amount_msat.into()), amount_sent_msat: Some(c.amount_sent_msat.into()), warning_partial_completion: c.warning_partial_completion, status: c.status as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::ListnodesNodesAddresses> for pb::ListnodesNodesAddresses {
fn from(c: responses::ListnodesNodesAddresses) -> Self {
Self {
item_type: c.item_type as i32,
port: c.port.into(), address: c.address, }
}
}
#[allow(unused_variables)]
impl From<responses::ListnodesNodes> for pb::ListnodesNodes {
fn from(c: responses::ListnodesNodes) -> Self {
Self {
nodeid: c.nodeid.serialize().to_vec(), last_timestamp: c.last_timestamp, alias: c.alias, color: c.color.map(|v| hex::decode(v).unwrap()), features: c.features.map(|v| hex::decode(v).unwrap()), addresses: c.addresses.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<responses::ListnodesResponse> for pb::ListnodesResponse {
fn from(c: responses::ListnodesResponse) -> Self {
Self {
nodes: c.nodes.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::WaitanyinvoiceResponse> for pb::WaitanyinvoiceResponse {
fn from(c: responses::WaitanyinvoiceResponse) -> Self {
Self {
label: c.label, description: c.description, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
expires_at: c.expires_at, amount_msat: c.amount_msat.map(|f| f.into()), bolt11: c.bolt11, bolt12: c.bolt12, created_index: c.created_index, updated_index: c.updated_index, pay_index: c.pay_index, amount_received_msat: c.amount_received_msat.map(|f| f.into()), paid_at: c.paid_at, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), }
}
}
#[allow(unused_variables)]
impl From<responses::WaitinvoiceResponse> for pb::WaitinvoiceResponse {
fn from(c: responses::WaitinvoiceResponse) -> Self {
Self {
label: c.label, description: c.description, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
expires_at: c.expires_at, amount_msat: c.amount_msat.map(|f| f.into()), bolt11: c.bolt11, bolt12: c.bolt12, created_index: c.created_index, updated_index: c.updated_index, pay_index: c.pay_index, amount_received_msat: c.amount_received_msat.map(|f| f.into()), paid_at: c.paid_at, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), }
}
}
#[allow(unused_variables)]
impl From<responses::WaitsendpayResponse> for pb::WaitsendpayResponse {
fn from(c: responses::WaitsendpayResponse) -> Self {
Self {
id: c.id, groupid: c.groupid, payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
amount_msat: c.amount_msat.map(|f| f.into()), destination: c.destination.map(|v| v.serialize().to_vec()), created_at: c.created_at, completed_at: c.completed_at, amount_sent_msat: Some(c.amount_sent_msat.into()), label: c.label, partid: c.partid, bolt11: c.bolt11, bolt12: c.bolt12, payment_preimage: c.payment_preimage.map(|v| v.to_vec()), }
}
}
#[allow(unused_variables,deprecated)]
impl From<responses::NewaddrResponse> for pb::NewaddrResponse {
fn from(c: responses::NewaddrResponse) -> Self {
Self {
p2tr: c.p2tr, bech32: c.bech32, #[allow(deprecated)]
p2sh_segwit: c.p2sh_segwit, }
}
}
#[allow(unused_variables)]
impl From<responses::WithdrawResponse> for pb::WithdrawResponse {
fn from(c: responses::WithdrawResponse) -> Self {
Self {
tx: hex::decode(&c.tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), psbt: c.psbt, }
}
}
#[allow(unused_variables)]
impl From<responses::KeysendResponse> for pb::KeysendResponse {
fn from(c: responses::KeysendResponse) -> Self {
Self {
payment_preimage: c.payment_preimage.to_vec(), destination: c.destination.map(|v| v.serialize().to_vec()), payment_hash: c.payment_hash.to_vec(), created_at: c.created_at, parts: c.parts, amount_msat: Some(c.amount_msat.into()), amount_sent_msat: Some(c.amount_sent_msat.into()), warning_partial_completion: c.warning_partial_completion, status: c.status as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::FundpsbtReservations> for pb::FundpsbtReservations {
fn from(c: responses::FundpsbtReservations) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), vout: c.vout, was_reserved: c.was_reserved, reserved: c.reserved, reserved_to_block: c.reserved_to_block, }
}
}
#[allow(unused_variables)]
impl From<responses::FundpsbtResponse> for pb::FundpsbtResponse {
fn from(c: responses::FundpsbtResponse) -> Self {
Self {
psbt: c.psbt, feerate_per_kw: c.feerate_per_kw, estimated_final_weight: c.estimated_final_weight, excess_msat: Some(c.excess_msat.into()), change_outnum: c.change_outnum, reservations: c.reservations.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<responses::SendpsbtResponse> for pb::SendpsbtResponse {
fn from(c: responses::SendpsbtResponse) -> Self {
Self {
tx: hex::decode(&c.tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::SignpsbtResponse> for pb::SignpsbtResponse {
fn from(c: responses::SignpsbtResponse) -> Self {
Self {
signed_psbt: c.signed_psbt, }
}
}
#[allow(unused_variables)]
impl From<responses::UtxopsbtReservations> for pb::UtxopsbtReservations {
fn from(c: responses::UtxopsbtReservations) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), vout: c.vout, was_reserved: c.was_reserved, reserved: c.reserved, reserved_to_block: c.reserved_to_block, }
}
}
#[allow(unused_variables)]
impl From<responses::UtxopsbtResponse> for pb::UtxopsbtResponse {
fn from(c: responses::UtxopsbtResponse) -> Self {
Self {
psbt: c.psbt, feerate_per_kw: c.feerate_per_kw, estimated_final_weight: c.estimated_final_weight, excess_msat: Some(c.excess_msat.into()), change_outnum: c.change_outnum, reservations: c.reservations.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<responses::TxdiscardResponse> for pb::TxdiscardResponse {
fn from(c: responses::TxdiscardResponse) -> Self {
Self {
unsigned_tx: hex::decode(&c.unsigned_tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::TxprepareResponse> for pb::TxprepareResponse {
fn from(c: responses::TxprepareResponse) -> Self {
Self {
psbt: c.psbt, unsigned_tx: hex::decode(&c.unsigned_tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::TxsendResponse> for pb::TxsendResponse {
fn from(c: responses::TxsendResponse) -> Self {
Self {
psbt: c.psbt, tx: hex::decode(&c.tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannelsFeerate> for pb::ListpeerchannelsChannelsFeerate {
fn from(c: responses::ListpeerchannelsChannelsFeerate) -> Self {
Self {
perkw: c.perkw, perkb: c.perkb, }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannelsInflight> for pb::ListpeerchannelsChannelsInflight {
fn from(c: responses::ListpeerchannelsChannelsInflight) -> Self {
Self {
funding_txid: c.funding_txid.map(|v| hex::decode(v).unwrap()), funding_outnum: c.funding_outnum, feerate: c.feerate, total_funding_msat: c.total_funding_msat.map(|f| f.into()), splice_amount: c.splice_amount, our_funding_msat: c.our_funding_msat.map(|f| f.into()), scratch_txid: c.scratch_txid.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannelsFunding> for pb::ListpeerchannelsChannelsFunding {
fn from(c: responses::ListpeerchannelsChannelsFunding) -> Self {
Self {
pushed_msat: c.pushed_msat.map(|f| f.into()), local_funds_msat: c.local_funds_msat.map(|f| f.into()), remote_funds_msat: c.remote_funds_msat.map(|f| f.into()), fee_paid_msat: c.fee_paid_msat.map(|f| f.into()), fee_rcvd_msat: c.fee_rcvd_msat.map(|f| f.into()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannelsAlias> for pb::ListpeerchannelsChannelsAlias {
fn from(c: responses::ListpeerchannelsChannelsAlias) -> Self {
Self {
local: c.local.map(|v| v.to_string()), remote: c.remote.map(|v| v.to_string()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannelsHtlcs> for pb::ListpeerchannelsChannelsHtlcs {
fn from(c: responses::ListpeerchannelsChannelsHtlcs) -> Self {
Self {
direction: c.direction.map(|v| v as i32),
id: c.id, amount_msat: c.amount_msat.map(|f| f.into()), expiry: c.expiry, payment_hash: c.payment_hash.map(|v| v.to_vec()), local_trimmed: c.local_trimmed, status: c.status, state: c.state.map(|v| v as i32),
}
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsChannels> for pb::ListpeerchannelsChannels {
fn from(c: responses::ListpeerchannelsChannels) -> Self {
Self {
peer_id: c.peer_id.map(|v| v.serialize().to_vec()), peer_connected: c.peer_connected, state: c.state.map(|v| v as i32),
scratch_txid: c.scratch_txid.map(|v| hex::decode(v).unwrap()), ignore_fee_limits: c.ignore_fee_limits, feerate: c.feerate.map(|v| v.into()),
owner: c.owner, short_channel_id: c.short_channel_id.map(|v| v.to_string()), channel_id: c.channel_id.map(|v| v.to_vec()), funding_txid: c.funding_txid.map(|v| hex::decode(v).unwrap()), funding_outnum: c.funding_outnum, initial_feerate: c.initial_feerate, last_feerate: c.last_feerate, next_feerate: c.next_feerate, next_fee_step: c.next_fee_step, inflight: c.inflight.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), close_to: c.close_to.map(|v| hex::decode(v).unwrap()), private: c.private, opener: c.opener.map(|v| v as i32),
closer: c.closer.map(|v| v as i32),
funding: c.funding.map(|v| v.into()),
to_us_msat: c.to_us_msat.map(|f| f.into()), min_to_us_msat: c.min_to_us_msat.map(|f| f.into()), max_to_us_msat: c.max_to_us_msat.map(|f| f.into()), total_msat: c.total_msat.map(|f| f.into()), fee_base_msat: c.fee_base_msat.map(|f| f.into()), fee_proportional_millionths: c.fee_proportional_millionths, dust_limit_msat: c.dust_limit_msat.map(|f| f.into()), max_total_htlc_in_msat: c.max_total_htlc_in_msat.map(|f| f.into()), their_reserve_msat: c.their_reserve_msat.map(|f| f.into()), our_reserve_msat: c.our_reserve_msat.map(|f| f.into()), spendable_msat: c.spendable_msat.map(|f| f.into()), receivable_msat: c.receivable_msat.map(|f| f.into()), minimum_htlc_in_msat: c.minimum_htlc_in_msat.map(|f| f.into()), minimum_htlc_out_msat: c.minimum_htlc_out_msat.map(|f| f.into()), maximum_htlc_out_msat: c.maximum_htlc_out_msat.map(|f| f.into()), their_to_self_delay: c.their_to_self_delay, our_to_self_delay: c.our_to_self_delay, max_accepted_htlcs: c.max_accepted_htlcs, alias: c.alias.map(|v| v.into()),
status: c.status.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), in_payments_offered: c.in_payments_offered, in_offered_msat: c.in_offered_msat.map(|f| f.into()), in_payments_fulfilled: c.in_payments_fulfilled, in_fulfilled_msat: c.in_fulfilled_msat.map(|f| f.into()), out_payments_offered: c.out_payments_offered, out_offered_msat: c.out_offered_msat.map(|f| f.into()), out_payments_fulfilled: c.out_payments_fulfilled, out_fulfilled_msat: c.out_fulfilled_msat.map(|f| f.into()), htlcs: c.htlcs.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), close_to_addr: c.close_to_addr, }
}
}
#[allow(unused_variables)]
impl From<responses::ListpeerchannelsResponse> for pb::ListpeerchannelsResponse {
fn from(c: responses::ListpeerchannelsResponse) -> Self {
Self {
channels: c.channels.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<responses::ListclosedchannelsClosedchannelsAlias> for pb::ListclosedchannelsClosedchannelsAlias {
fn from(c: responses::ListclosedchannelsClosedchannelsAlias) -> Self {
Self {
local: c.local.map(|v| v.to_string()), remote: c.remote.map(|v| v.to_string()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListclosedchannelsClosedchannels> for pb::ListclosedchannelsClosedchannels {
fn from(c: responses::ListclosedchannelsClosedchannels) -> Self {
Self {
peer_id: c.peer_id.map(|v| v.serialize().to_vec()), channel_id: c.channel_id.to_vec(), short_channel_id: c.short_channel_id.map(|v| v.to_string()), alias: c.alias.map(|v| v.into()),
opener: c.opener as i32,
closer: c.closer.map(|v| v as i32),
private: c.private, total_local_commitments: c.total_local_commitments, total_remote_commitments: c.total_remote_commitments, total_htlcs_sent: c.total_htlcs_sent, funding_txid: hex::decode(&c.funding_txid).unwrap(), funding_outnum: c.funding_outnum, leased: c.leased, funding_fee_paid_msat: c.funding_fee_paid_msat.map(|f| f.into()), funding_fee_rcvd_msat: c.funding_fee_rcvd_msat.map(|f| f.into()), funding_pushed_msat: c.funding_pushed_msat.map(|f| f.into()), total_msat: Some(c.total_msat.into()), final_to_us_msat: Some(c.final_to_us_msat.into()), min_to_us_msat: Some(c.min_to_us_msat.into()), max_to_us_msat: Some(c.max_to_us_msat.into()), last_commitment_txid: c.last_commitment_txid.map(|v| v.to_vec()), last_commitment_fee_msat: c.last_commitment_fee_msat.map(|f| f.into()), close_cause: c.close_cause as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::ListclosedchannelsResponse> for pb::ListclosedchannelsResponse {
fn from(c: responses::ListclosedchannelsResponse) -> Self {
Self {
closedchannels: c.closedchannels.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::DecodepayFallbacks> for pb::DecodepayFallbacks {
fn from(c: responses::DecodepayFallbacks) -> Self {
Self {
item_type: c.item_type as i32,
addr: c.addr, hex: hex::decode(&c.hex).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<responses::DecodepayExtra> for pb::DecodepayExtra {
fn from(c: responses::DecodepayExtra) -> Self {
Self {
tag: c.tag, data: c.data, }
}
}
#[allow(unused_variables)]
impl From<responses::DecodepayResponse> for pb::DecodepayResponse {
fn from(c: responses::DecodepayResponse) -> Self {
Self {
currency: c.currency, created_at: c.created_at, expiry: c.expiry, payee: c.payee.serialize().to_vec(), amount_msat: c.amount_msat.map(|f| f.into()), payment_hash: c.payment_hash.to_vec(), signature: c.signature, description: c.description, description_hash: c.description_hash.map(|v| v.to_vec()), min_final_cltv_expiry: c.min_final_cltv_expiry, payment_secret: c.payment_secret.map(|v| v.to_vec()), features: c.features.map(|v| hex::decode(v).unwrap()), payment_metadata: c.payment_metadata.map(|v| hex::decode(v).unwrap()), fallbacks: c.fallbacks.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), extra: c.extra.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeOffer_paths> for pb::DecodeOfferPaths {
fn from(c: responses::DecodeOffer_paths) -> Self {
Self {
first_node_id: c.first_node_id.serialize().to_vec(), blinding: c.blinding.serialize().to_vec(), }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeInvoice_fallbacks> for pb::DecodeInvoiceFallbacks {
fn from(c: responses::DecodeInvoice_fallbacks) -> Self {
Self {
version: c.version.into(), hex: hex::decode(&c.hex).unwrap(), address: c.address, }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeFallbacks> for pb::DecodeFallbacks {
fn from(c: responses::DecodeFallbacks) -> Self {
Self {
warning_invoice_fallbacks_version_invalid: c.warning_invoice_fallbacks_version_invalid, }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeExtra> for pb::DecodeExtra {
fn from(c: responses::DecodeExtra) -> Self {
Self {
tag: c.tag, data: c.data, }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeRestrictions> for pb::DecodeRestrictions {
fn from(c: responses::DecodeRestrictions) -> Self {
Self {
alternatives: c.alternatives.into_iter().map(|i| i.into()).collect(), summary: c.summary, }
}
}
#[allow(unused_variables)]
impl From<responses::DecodeResponse> for pb::DecodeResponse {
fn from(c: responses::DecodeResponse) -> Self {
Self {
item_type: c.item_type as i32,
valid: c.valid, offer_id: c.offer_id.map(|v| hex::decode(v).unwrap()), offer_chains: c.offer_chains.map(|arr| arr.into_iter().map(|i| i.to_vec()).collect()).unwrap_or(vec![]), offer_metadata: c.offer_metadata.map(|v| hex::decode(v).unwrap()), offer_currency: c.offer_currency, warning_unknown_offer_currency: c.warning_unknown_offer_currency, currency_minor_unit: c.currency_minor_unit, offer_amount: c.offer_amount, offer_amount_msat: c.offer_amount_msat.map(|f| f.into()), offer_description: c.offer_description, offer_issuer: c.offer_issuer, offer_features: c.offer_features.map(|v| hex::decode(v).unwrap()), offer_absolute_expiry: c.offer_absolute_expiry, offer_quantity_max: c.offer_quantity_max, offer_paths: c.offer_paths.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), offer_node_id: c.offer_node_id.map(|v| v.serialize().to_vec()), warning_missing_offer_node_id: c.warning_missing_offer_node_id, warning_invalid_offer_description: c.warning_invalid_offer_description, warning_missing_offer_description: c.warning_missing_offer_description, warning_invalid_offer_currency: c.warning_invalid_offer_currency, warning_invalid_offer_issuer: c.warning_invalid_offer_issuer, invreq_metadata: c.invreq_metadata.map(|v| hex::decode(v).unwrap()), invreq_payer_id: c.invreq_payer_id.map(|v| hex::decode(v).unwrap()), invreq_chain: c.invreq_chain.map(|v| hex::decode(v).unwrap()), invreq_amount_msat: c.invreq_amount_msat.map(|f| f.into()), invreq_features: c.invreq_features.map(|v| hex::decode(v).unwrap()), invreq_quantity: c.invreq_quantity, invreq_payer_note: c.invreq_payer_note, invreq_recurrence_counter: c.invreq_recurrence_counter, invreq_recurrence_start: c.invreq_recurrence_start, warning_missing_invreq_metadata: c.warning_missing_invreq_metadata, warning_missing_invreq_payer_id: c.warning_missing_invreq_payer_id, warning_invalid_invreq_payer_note: c.warning_invalid_invreq_payer_note, warning_missing_invoice_request_signature: c.warning_missing_invoice_request_signature, warning_invalid_invoice_request_signature: c.warning_invalid_invoice_request_signature, invoice_created_at: c.invoice_created_at, invoice_relative_expiry: c.invoice_relative_expiry, invoice_payment_hash: c.invoice_payment_hash.map(|v| hex::decode(v).unwrap()), invoice_amount_msat: c.invoice_amount_msat.map(|f| f.into()), invoice_fallbacks: c.invoice_fallbacks.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), invoice_features: c.invoice_features.map(|v| hex::decode(v).unwrap()), invoice_node_id: c.invoice_node_id.map(|v| v.serialize().to_vec()), invoice_recurrence_basetime: c.invoice_recurrence_basetime, warning_missing_invoice_paths: c.warning_missing_invoice_paths, warning_missing_invoice_blindedpay: c.warning_missing_invoice_blindedpay, warning_missing_invoice_created_at: c.warning_missing_invoice_created_at, warning_missing_invoice_payment_hash: c.warning_missing_invoice_payment_hash, warning_missing_invoice_amount: c.warning_missing_invoice_amount, warning_missing_invoice_recurrence_basetime: c.warning_missing_invoice_recurrence_basetime, warning_missing_invoice_node_id: c.warning_missing_invoice_node_id, warning_missing_invoice_signature: c.warning_missing_invoice_signature, warning_invalid_invoice_signature: c.warning_invalid_invoice_signature, fallbacks: c.fallbacks.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), created_at: c.created_at, expiry: c.expiry, payee: c.payee.map(|v| v.serialize().to_vec()), payment_hash: c.payment_hash.map(|v| v.to_vec()), description_hash: c.description_hash.map(|v| v.to_vec()), min_final_cltv_expiry: c.min_final_cltv_expiry, payment_secret: c.payment_secret.map(|v| v.to_vec()), payment_metadata: c.payment_metadata.map(|v| hex::decode(v).unwrap()), extra: c.extra.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), unique_id: c.unique_id, version: c.version, string: c.string, restrictions: c.restrictions.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), warning_rune_invalid_utf8: c.warning_rune_invalid_utf8, hex: c.hex.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::DisconnectResponse> for pb::DisconnectResponse {
fn from(c: responses::DisconnectResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::FeeratesPerkbEstimates> for pb::FeeratesPerkbEstimates {
fn from(c: responses::FeeratesPerkbEstimates) -> Self {
Self {
blockcount: c.blockcount, feerate: c.feerate, smoothed_feerate: c.smoothed_feerate, }
}
}
#[allow(unused_variables,deprecated)]
impl From<responses::FeeratesPerkb> for pb::FeeratesPerkb {
fn from(c: responses::FeeratesPerkb) -> Self {
Self {
min_acceptable: c.min_acceptable, max_acceptable: c.max_acceptable, floor: c.floor, estimates: c.estimates.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), opening: c.opening, mutual_close: c.mutual_close, unilateral_close: c.unilateral_close, unilateral_anchor_close: c.unilateral_anchor_close, #[allow(deprecated)]
delayed_to_us: c.delayed_to_us, #[allow(deprecated)]
htlc_resolution: c.htlc_resolution, penalty: c.penalty, }
}
}
#[allow(unused_variables)]
impl From<responses::FeeratesPerkwEstimates> for pb::FeeratesPerkwEstimates {
fn from(c: responses::FeeratesPerkwEstimates) -> Self {
Self {
blockcount: c.blockcount, feerate: c.feerate, smoothed_feerate: c.smoothed_feerate, }
}
}
#[allow(unused_variables,deprecated)]
impl From<responses::FeeratesPerkw> for pb::FeeratesPerkw {
fn from(c: responses::FeeratesPerkw) -> Self {
Self {
min_acceptable: c.min_acceptable, max_acceptable: c.max_acceptable, floor: c.floor, estimates: c.estimates.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), opening: c.opening, mutual_close: c.mutual_close, unilateral_close: c.unilateral_close, unilateral_anchor_close: c.unilateral_anchor_close, #[allow(deprecated)]
delayed_to_us: c.delayed_to_us, #[allow(deprecated)]
htlc_resolution: c.htlc_resolution, penalty: c.penalty, }
}
}
#[allow(unused_variables)]
impl From<responses::FeeratesOnchain_fee_estimates> for pb::FeeratesOnchainFeeEstimates {
fn from(c: responses::FeeratesOnchain_fee_estimates) -> Self {
Self {
opening_channel_satoshis: c.opening_channel_satoshis, mutual_close_satoshis: c.mutual_close_satoshis, unilateral_close_satoshis: c.unilateral_close_satoshis, unilateral_close_nonanchor_satoshis: c.unilateral_close_nonanchor_satoshis, htlc_timeout_satoshis: c.htlc_timeout_satoshis, htlc_success_satoshis: c.htlc_success_satoshis, }
}
}
#[allow(unused_variables)]
impl From<responses::FeeratesResponse> for pb::FeeratesResponse {
fn from(c: responses::FeeratesResponse) -> Self {
Self {
warning_missing_feerates: c.warning_missing_feerates, perkb: c.perkb.map(|v| v.into()),
perkw: c.perkw.map(|v| v.into()),
onchain_fee_estimates: c.onchain_fee_estimates.map(|v| v.into()),
}
}
}
#[allow(unused_variables)]
impl From<responses::FundchannelResponse> for pb::FundchannelResponse {
fn from(c: responses::FundchannelResponse) -> Self {
Self {
tx: hex::decode(&c.tx).unwrap(), txid: hex::decode(&c.txid).unwrap(), outnum: c.outnum, channel_id: hex::decode(&c.channel_id).unwrap(), close_to: c.close_to.map(|v| hex::decode(v).unwrap()), mindepth: c.mindepth, }
}
}
#[allow(unused_variables)]
impl From<responses::GetrouteRoute> for pb::GetrouteRoute {
fn from(c: responses::GetrouteRoute) -> Self {
Self {
id: c.id.serialize().to_vec(), channel: c.channel.to_string(), direction: c.direction, amount_msat: Some(c.amount_msat.into()), delay: c.delay, style: c.style as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::GetrouteResponse> for pb::GetrouteResponse {
fn from(c: responses::GetrouteResponse) -> Self {
Self {
route: c.route.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListforwardsForwards> for pb::ListforwardsForwards {
fn from(c: responses::ListforwardsForwards) -> Self {
Self {
in_channel: c.in_channel.to_string(), in_htlc_id: c.in_htlc_id, in_msat: Some(c.in_msat.into()), status: c.status as i32,
received_time: c.received_time, out_channel: c.out_channel.map(|v| v.to_string()), out_htlc_id: c.out_htlc_id, style: c.style.map(|v| v as i32),
fee_msat: c.fee_msat.map(|f| f.into()), out_msat: c.out_msat.map(|f| f.into()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListforwardsResponse> for pb::ListforwardsResponse {
fn from(c: responses::ListforwardsResponse) -> Self {
Self {
forwards: c.forwards.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpaysPays> for pb::ListpaysPays {
fn from(c: responses::ListpaysPays) -> Self {
Self {
payment_hash: c.payment_hash.to_vec(), status: c.status as i32,
destination: c.destination.map(|v| v.serialize().to_vec()), created_at: c.created_at, completed_at: c.completed_at, label: c.label, bolt11: c.bolt11, description: c.description, bolt12: c.bolt12, amount_msat: c.amount_msat.map(|f| f.into()), amount_sent_msat: c.amount_sent_msat.map(|f| f.into()), preimage: c.preimage.map(|v| v.to_vec()), number_of_parts: c.number_of_parts, erroronion: c.erroronion.map(|v| hex::decode(v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<responses::ListpaysResponse> for pb::ListpaysResponse {
fn from(c: responses::ListpaysResponse) -> Self {
Self {
pays: c.pays.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::ListhtlcsHtlcs> for pb::ListhtlcsHtlcs {
fn from(c: responses::ListhtlcsHtlcs) -> Self {
Self {
short_channel_id: c.short_channel_id.to_string(), id: c.id, expiry: c.expiry, amount_msat: Some(c.amount_msat.into()), direction: c.direction as i32,
payment_hash: c.payment_hash.to_vec(), state: c.state as i32,
}
}
}
#[allow(unused_variables)]
impl From<responses::ListhtlcsResponse> for pb::ListhtlcsResponse {
fn from(c: responses::ListhtlcsResponse) -> Self {
Self {
htlcs: c.htlcs.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::PingResponse> for pb::PingResponse {
fn from(c: responses::PingResponse) -> Self {
Self {
totlen: c.totlen.into(), }
}
}
#[allow(unused_variables)]
impl From<responses::SendcustommsgResponse> for pb::SendcustommsgResponse {
fn from(c: responses::SendcustommsgResponse) -> Self {
Self {
status: c.status, }
}
}
#[allow(unused_variables)]
impl From<responses::SetchannelChannels> for pb::SetchannelChannels {
fn from(c: responses::SetchannelChannels) -> Self {
Self {
peer_id: c.peer_id.serialize().to_vec(), channel_id: hex::decode(&c.channel_id).unwrap(), short_channel_id: c.short_channel_id.map(|v| v.to_string()), fee_base_msat: Some(c.fee_base_msat.into()), fee_proportional_millionths: c.fee_proportional_millionths, ignore_fee_limits: c.ignore_fee_limits, minimum_htlc_out_msat: Some(c.minimum_htlc_out_msat.into()), warning_htlcmin_too_low: c.warning_htlcmin_too_low, maximum_htlc_out_msat: Some(c.maximum_htlc_out_msat.into()), warning_htlcmax_too_high: c.warning_htlcmax_too_high, }
}
}
#[allow(unused_variables)]
impl From<responses::SetchannelResponse> for pb::SetchannelResponse {
fn from(c: responses::SetchannelResponse) -> Self {
Self {
channels: c.channels.into_iter().map(|i| i.into()).collect(), }
}
}
#[allow(unused_variables)]
impl From<responses::SigninvoiceResponse> for pb::SigninvoiceResponse {
fn from(c: responses::SigninvoiceResponse) -> Self {
Self {
bolt11: c.bolt11, }
}
}
#[allow(unused_variables)]
impl From<responses::SignmessageResponse> for pb::SignmessageResponse {
fn from(c: responses::SignmessageResponse) -> Self {
Self {
signature: hex::decode(&c.signature).unwrap(), recid: hex::decode(&c.recid).unwrap(), zbase: c.zbase, }
}
}
#[allow(unused_variables)]
impl From<responses::StopResponse> for pb::StopResponse {
fn from(c: responses::StopResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::PreapprovekeysendResponse> for pb::PreapprovekeysendResponse {
fn from(c: responses::PreapprovekeysendResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::PreapproveinvoiceResponse> for pb::PreapproveinvoiceResponse {
fn from(c: responses::PreapproveinvoiceResponse) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<responses::StaticbackupResponse> for pb::StaticbackupResponse {
fn from(c: responses::StaticbackupResponse) -> Self {
Self {
scb: c.scb.into_iter().map(|i| hex::decode(i).unwrap()).collect(), }
}
}
#[allow(unused_variables)]
impl From<requests::GetinfoRequest> for pb::GetinfoRequest {
fn from(c: requests::GetinfoRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<requests::ListpeersRequest> for pb::ListpeersRequest {
fn from(c: requests::ListpeersRequest) -> Self {
Self {
id: c.id.map(|v| v.serialize().to_vec()), level: c.level, }
}
}
#[allow(unused_variables)]
impl From<requests::ListfundsRequest> for pb::ListfundsRequest {
fn from(c: requests::ListfundsRequest) -> Self {
Self {
spent: c.spent, }
}
}
#[allow(unused_variables)]
impl From<requests::SendpayRoute> for pb::SendpayRoute {
fn from(c: requests::SendpayRoute) -> Self {
Self {
amount_msat: Some(c.amount_msat.into()), id: c.id.serialize().to_vec(), delay: c.delay.into(), channel: c.channel.to_string(), }
}
}
#[allow(unused_variables)]
impl From<requests::SendpayRequest> for pb::SendpayRequest {
fn from(c: requests::SendpayRequest) -> Self {
Self {
route: c.route.into_iter().map(|i| i.into()).collect(), payment_hash: c.payment_hash.to_vec(), label: c.label, amount_msat: c.amount_msat.map(|f| f.into()), bolt11: c.bolt11, payment_secret: c.payment_secret.map(|v| v.to_vec()), partid: c.partid.map(|v| v.into()), localinvreqid: c.localinvreqid.map(|v| hex::decode(v).unwrap()), groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<requests::ListchannelsRequest> for pb::ListchannelsRequest {
fn from(c: requests::ListchannelsRequest) -> Self {
Self {
short_channel_id: c.short_channel_id.map(|v| v.to_string()), source: c.source.map(|v| v.serialize().to_vec()), destination: c.destination.map(|v| v.serialize().to_vec()), }
}
}
#[allow(unused_variables)]
impl From<requests::AddgossipRequest> for pb::AddgossipRequest {
fn from(c: requests::AddgossipRequest) -> Self {
Self {
message: hex::decode(&c.message).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::AutocleaninvoiceRequest> for pb::AutocleaninvoiceRequest {
fn from(c: requests::AutocleaninvoiceRequest) -> Self {
Self {
expired_by: c.expired_by, cycle_seconds: c.cycle_seconds, }
}
}
#[allow(unused_variables)]
impl From<requests::CheckmessageRequest> for pb::CheckmessageRequest {
fn from(c: requests::CheckmessageRequest) -> Self {
Self {
message: c.message, zbase: c.zbase, pubkey: c.pubkey.map(|v| v.serialize().to_vec()), }
}
}
#[allow(unused_variables)]
impl From<requests::CloseRequest> for pb::CloseRequest {
fn from(c: requests::CloseRequest) -> Self {
Self {
id: c.id, unilateraltimeout: c.unilateraltimeout, destination: c.destination, fee_negotiation_step: c.fee_negotiation_step, wrong_funding: c.wrong_funding.map(|o|o.into()), force_lease_closed: c.force_lease_closed, feerange: c.feerange.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<requests::ConnectRequest> for pb::ConnectRequest {
fn from(c: requests::ConnectRequest) -> Self {
Self {
id: c.id, host: c.host, port: c.port.map(|v| v.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::CreateinvoiceRequest> for pb::CreateinvoiceRequest {
fn from(c: requests::CreateinvoiceRequest) -> Self {
Self {
invstring: c.invstring, label: c.label, preimage: hex::decode(&c.preimage).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::DatastoreRequest> for pb::DatastoreRequest {
fn from(c: requests::DatastoreRequest) -> Self {
Self {
key: c.key.into_iter().map(|i| i.into()).collect(), string: c.string, hex: c.hex.map(|v| hex::decode(v).unwrap()), mode: c.mode.map(|v| v as i32),
generation: c.generation, }
}
}
#[allow(unused_variables)]
impl From<requests::CreateonionHops> for pb::CreateonionHops {
fn from(c: requests::CreateonionHops) -> Self {
Self {
pubkey: c.pubkey.serialize().to_vec(), payload: hex::decode(&c.payload).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::CreateonionRequest> for pb::CreateonionRequest {
fn from(c: requests::CreateonionRequest) -> Self {
Self {
hops: c.hops.into_iter().map(|i| i.into()).collect(), assocdata: hex::decode(&c.assocdata).unwrap(), session_key: c.session_key.map(|v| v.to_vec()), onion_size: c.onion_size.map(|v| v.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::DeldatastoreRequest> for pb::DeldatastoreRequest {
fn from(c: requests::DeldatastoreRequest) -> Self {
Self {
key: c.key.into_iter().map(|i| i.into()).collect(), generation: c.generation, }
}
}
#[allow(unused_variables)]
impl From<requests::DelexpiredinvoiceRequest> for pb::DelexpiredinvoiceRequest {
fn from(c: requests::DelexpiredinvoiceRequest) -> Self {
Self {
maxexpirytime: c.maxexpirytime, }
}
}
#[allow(unused_variables)]
impl From<requests::DelinvoiceRequest> for pb::DelinvoiceRequest {
fn from(c: requests::DelinvoiceRequest) -> Self {
Self {
label: c.label, status: c.status as i32,
desconly: c.desconly, }
}
}
#[allow(unused_variables)]
impl From<requests::InvoiceRequest> for pb::InvoiceRequest {
fn from(c: requests::InvoiceRequest) -> Self {
Self {
amount_msat: Some(c.amount_msat.into()), description: c.description, label: c.label, expiry: c.expiry, fallbacks: c.fallbacks.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), preimage: c.preimage.map(|v| hex::decode(v).unwrap()), cltv: c.cltv, deschashonly: c.deschashonly, }
}
}
#[allow(unused_variables)]
impl From<requests::ListdatastoreRequest> for pb::ListdatastoreRequest {
fn from(c: requests::ListdatastoreRequest) -> Self {
Self {
key: c.key.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<requests::ListinvoicesRequest> for pb::ListinvoicesRequest {
fn from(c: requests::ListinvoicesRequest) -> Self {
Self {
label: c.label, invstring: c.invstring, payment_hash: c.payment_hash.map(|v| hex::decode(v).unwrap()), offer_id: c.offer_id, index: c.index.map(|v| v as i32),
start: c.start, limit: c.limit, }
}
}
#[allow(unused_variables)]
impl From<requests::SendonionFirst_hop> for pb::SendonionFirstHop {
fn from(c: requests::SendonionFirst_hop) -> Self {
Self {
id: c.id.serialize().to_vec(), amount_msat: Some(c.amount_msat.into()), delay: c.delay.into(), }
}
}
#[allow(unused_variables)]
impl From<requests::SendonionRequest> for pb::SendonionRequest {
fn from(c: requests::SendonionRequest) -> Self {
Self {
onion: hex::decode(&c.onion).unwrap(), first_hop: Some(c.first_hop.into()),
payment_hash: c.payment_hash.to_vec(), label: c.label, shared_secrets: c.shared_secrets.map(|arr| arr.into_iter().map(|i| i.to_vec()).collect()).unwrap_or(vec![]), partid: c.partid.map(|v| v.into()), bolt11: c.bolt11, amount_msat: c.amount_msat.map(|f| f.into()), destination: c.destination.map(|v| v.serialize().to_vec()), localinvreqid: c.localinvreqid.map(|v| v.to_vec()), groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<requests::ListsendpaysRequest> for pb::ListsendpaysRequest {
fn from(c: requests::ListsendpaysRequest) -> Self {
Self {
bolt11: c.bolt11, payment_hash: c.payment_hash.map(|v| v.to_vec()), status: c.status.map(|v| v as i32),
}
}
}
#[allow(unused_variables)]
impl From<requests::ListtransactionsRequest> for pb::ListtransactionsRequest {
fn from(c: requests::ListtransactionsRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<requests::PayRequest> for pb::PayRequest {
fn from(c: requests::PayRequest) -> Self {
Self {
bolt11: c.bolt11, amount_msat: c.amount_msat.map(|f| f.into()), label: c.label, riskfactor: c.riskfactor, maxfeepercent: c.maxfeepercent, retry_for: c.retry_for.map(|v| v.into()), maxdelay: c.maxdelay.map(|v| v.into()), exemptfee: c.exemptfee.map(|f| f.into()), localinvreqid: c.localinvreqid.map(|v| hex::decode(v).unwrap()), exclude: c.exclude.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), maxfee: c.maxfee.map(|f| f.into()), description: c.description, }
}
}
#[allow(unused_variables)]
impl From<requests::ListnodesRequest> for pb::ListnodesRequest {
fn from(c: requests::ListnodesRequest) -> Self {
Self {
id: c.id.map(|v| v.serialize().to_vec()), }
}
}
#[allow(unused_variables)]
impl From<requests::WaitanyinvoiceRequest> for pb::WaitanyinvoiceRequest {
fn from(c: requests::WaitanyinvoiceRequest) -> Self {
Self {
lastpay_index: c.lastpay_index, timeout: c.timeout, }
}
}
#[allow(unused_variables)]
impl From<requests::WaitinvoiceRequest> for pb::WaitinvoiceRequest {
fn from(c: requests::WaitinvoiceRequest) -> Self {
Self {
label: c.label, }
}
}
#[allow(unused_variables)]
impl From<requests::WaitsendpayRequest> for pb::WaitsendpayRequest {
fn from(c: requests::WaitsendpayRequest) -> Self {
Self {
payment_hash: c.payment_hash.to_vec(), timeout: c.timeout, partid: c.partid, groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<requests::NewaddrRequest> for pb::NewaddrRequest {
fn from(c: requests::NewaddrRequest) -> Self {
Self {
addresstype: c.addresstype.map(|v| v as i32),
}
}
}
#[allow(unused_variables)]
impl From<requests::WithdrawRequest> for pb::WithdrawRequest {
fn from(c: requests::WithdrawRequest) -> Self {
Self {
destination: c.destination, satoshi: c.satoshi.map(|o|o.into()), feerate: c.feerate.map(|o|o.into()), minconf: c.minconf.map(|v| v.into()), utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<requests::KeysendRequest> for pb::KeysendRequest {
fn from(c: requests::KeysendRequest) -> Self {
Self {
destination: c.destination.serialize().to_vec(), amount_msat: Some(c.amount_msat.into()), label: c.label, maxfeepercent: c.maxfeepercent, retry_for: c.retry_for, maxdelay: c.maxdelay, exemptfee: c.exemptfee.map(|f| f.into()), routehints: c.routehints.map(|rl| rl.into()), extratlvs: c.extratlvs.map(|s| s.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::FundpsbtRequest> for pb::FundpsbtRequest {
fn from(c: requests::FundpsbtRequest) -> Self {
Self {
satoshi: Some(c.satoshi.into()), feerate: Some(c.feerate.into()), startweight: c.startweight, minconf: c.minconf, reserve: c.reserve, locktime: c.locktime, min_witness_weight: c.min_witness_weight, excess_as_change: c.excess_as_change, nonwrapped: c.nonwrapped, opening_anchor_channel: c.opening_anchor_channel, }
}
}
#[allow(unused_variables)]
impl From<requests::SendpsbtRequest> for pb::SendpsbtRequest {
fn from(c: requests::SendpsbtRequest) -> Self {
Self {
psbt: c.psbt, reserve: c.reserve, }
}
}
#[allow(unused_variables)]
impl From<requests::SignpsbtRequest> for pb::SignpsbtRequest {
fn from(c: requests::SignpsbtRequest) -> Self {
Self {
psbt: c.psbt, signonly: c.signonly.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<requests::UtxopsbtRequest> for pb::UtxopsbtRequest {
fn from(c: requests::UtxopsbtRequest) -> Self {
Self {
satoshi: Some(c.satoshi.into()), feerate: Some(c.feerate.into()), startweight: c.startweight, utxos: c.utxos.into_iter().map(|i| i.into()).collect(), reserve: c.reserve, reservedok: c.reservedok, locktime: c.locktime, min_witness_weight: c.min_witness_weight, excess_as_change: c.excess_as_change, opening_anchor_channel: c.opening_anchor_channel, }
}
}
#[allow(unused_variables)]
impl From<requests::TxdiscardRequest> for pb::TxdiscardRequest {
fn from(c: requests::TxdiscardRequest) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::TxprepareRequest> for pb::TxprepareRequest {
fn from(c: requests::TxprepareRequest) -> Self {
Self {
outputs: c.outputs.into_iter().map(|i| i.into()).collect(), feerate: c.feerate.map(|o|o.into()), minconf: c.minconf, utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), }
}
}
#[allow(unused_variables)]
impl From<requests::TxsendRequest> for pb::TxsendRequest {
fn from(c: requests::TxsendRequest) -> Self {
Self {
txid: hex::decode(&c.txid).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::ListpeerchannelsRequest> for pb::ListpeerchannelsRequest {
fn from(c: requests::ListpeerchannelsRequest) -> Self {
Self {
id: c.id.map(|v| v.serialize().to_vec()), }
}
}
#[allow(unused_variables)]
impl From<requests::ListclosedchannelsRequest> for pb::ListclosedchannelsRequest {
fn from(c: requests::ListclosedchannelsRequest) -> Self {
Self {
id: c.id.map(|v| v.serialize().to_vec()), }
}
}
#[allow(unused_variables)]
impl From<requests::DecodepayRequest> for pb::DecodepayRequest {
fn from(c: requests::DecodepayRequest) -> Self {
Self {
bolt11: c.bolt11, description: c.description, }
}
}
#[allow(unused_variables)]
impl From<requests::DecodeRequest> for pb::DecodeRequest {
fn from(c: requests::DecodeRequest) -> Self {
Self {
string: c.string, }
}
}
#[allow(unused_variables)]
impl From<requests::DisconnectRequest> for pb::DisconnectRequest {
fn from(c: requests::DisconnectRequest) -> Self {
Self {
id: c.id.serialize().to_vec(), force: c.force, }
}
}
#[allow(unused_variables)]
impl From<requests::FeeratesRequest> for pb::FeeratesRequest {
fn from(c: requests::FeeratesRequest) -> Self {
Self {
style: c.style as i32,
}
}
}
#[allow(unused_variables)]
impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
fn from(c: requests::FundchannelRequest) -> Self {
Self {
id: c.id.serialize().to_vec(), amount: Some(c.amount.into()), feerate: c.feerate.map(|o|o.into()), announce: c.announce, minconf: c.minconf, push_msat: c.push_msat.map(|f| f.into()), close_to: c.close_to, request_amt: c.request_amt.map(|f| f.into()), compact_lease: c.compact_lease, utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), mindepth: c.mindepth, reserve: c.reserve.map(|f| f.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::GetrouteRequest> for pb::GetrouteRequest {
fn from(c: requests::GetrouteRequest) -> Self {
Self {
id: c.id.serialize().to_vec(), amount_msat: Some(c.amount_msat.into()), riskfactor: c.riskfactor, cltv: c.cltv, fromid: c.fromid.map(|v| v.serialize().to_vec()), fuzzpercent: c.fuzzpercent, exclude: c.exclude.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), maxhops: c.maxhops, }
}
}
#[allow(unused_variables)]
impl From<requests::ListforwardsRequest> for pb::ListforwardsRequest {
fn from(c: requests::ListforwardsRequest) -> Self {
Self {
status: c.status.map(|v| v as i32),
in_channel: c.in_channel.map(|v| v.to_string()), out_channel: c.out_channel.map(|v| v.to_string()), }
}
}
#[allow(unused_variables)]
impl From<requests::ListpaysRequest> for pb::ListpaysRequest {
fn from(c: requests::ListpaysRequest) -> Self {
Self {
bolt11: c.bolt11, payment_hash: c.payment_hash.map(|v| v.to_vec()), status: c.status.map(|v| v as i32),
}
}
}
#[allow(unused_variables)]
impl From<requests::ListhtlcsRequest> for pb::ListhtlcsRequest {
fn from(c: requests::ListhtlcsRequest) -> Self {
Self {
id: c.id, }
}
}
#[allow(unused_variables)]
impl From<requests::PingRequest> for pb::PingRequest {
fn from(c: requests::PingRequest) -> Self {
Self {
id: c.id.serialize().to_vec(), len: c.len.map(|v| v.into()), pongbytes: c.pongbytes.map(|v| v.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::SendcustommsgRequest> for pb::SendcustommsgRequest {
fn from(c: requests::SendcustommsgRequest) -> Self {
Self {
node_id: c.node_id.serialize().to_vec(), msg: hex::decode(&c.msg).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<requests::SetchannelRequest> for pb::SetchannelRequest {
fn from(c: requests::SetchannelRequest) -> Self {
Self {
id: c.id, feebase: c.feebase.map(|f| f.into()), feeppm: c.feeppm, htlcmin: c.htlcmin.map(|f| f.into()), htlcmax: c.htlcmax.map(|f| f.into()), enforcedelay: c.enforcedelay, ignorefeelimits: c.ignorefeelimits, }
}
}
#[allow(unused_variables)]
impl From<requests::SigninvoiceRequest> for pb::SigninvoiceRequest {
fn from(c: requests::SigninvoiceRequest) -> Self {
Self {
invstring: c.invstring, }
}
}
#[allow(unused_variables)]
impl From<requests::SignmessageRequest> for pb::SignmessageRequest {
fn from(c: requests::SignmessageRequest) -> Self {
Self {
message: c.message, }
}
}
#[allow(unused_variables)]
impl From<requests::StopRequest> for pb::StopRequest {
fn from(c: requests::StopRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<requests::PreapprovekeysendRequest> for pb::PreapprovekeysendRequest {
fn from(c: requests::PreapprovekeysendRequest) -> Self {
Self {
destination: c.destination.map(|v| v.serialize().to_vec()), payment_hash: c.payment_hash.map(|v| hex::decode(v).unwrap()), amount_msat: c.amount_msat.map(|f| f.into()), }
}
}
#[allow(unused_variables)]
impl From<requests::PreapproveinvoiceRequest> for pb::PreapproveinvoiceRequest {
fn from(c: requests::PreapproveinvoiceRequest) -> Self {
Self {
bolt11: c.bolt11, }
}
}
#[allow(unused_variables)]
impl From<requests::StaticbackupRequest> for pb::StaticbackupRequest {
fn from(c: requests::StaticbackupRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<pb::GetinfoRequest> for requests::GetinfoRequest {
fn from(c: pb::GetinfoRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<pb::ListpeersRequest> for requests::ListpeersRequest {
fn from(c: pb::ListpeersRequest) -> Self {
Self {
id: c.id.map(|v| PublicKey::from_slice(&v).unwrap()), level: c.level, }
}
}
#[allow(unused_variables)]
impl From<pb::ListfundsRequest> for requests::ListfundsRequest {
fn from(c: pb::ListfundsRequest) -> Self {
Self {
spent: c.spent, }
}
}
#[allow(unused_variables)]
impl From<pb::SendpayRoute> for requests::SendpayRoute {
fn from(c: pb::SendpayRoute) -> Self {
Self {
amount_msat: c.amount_msat.unwrap().into(), id: PublicKey::from_slice(&c.id).unwrap(), delay: c.delay as u16, channel: cln_rpc::primitives::ShortChannelId::from_str(&c.channel).unwrap(), }
}
}
#[allow(unused_variables)]
impl From<pb::SendpayRequest> for requests::SendpayRequest {
fn from(c: pb::SendpayRequest) -> Self {
Self {
route: c.route.into_iter().map(|s| s.into()).collect(), payment_hash: Sha256::from_slice(&c.payment_hash).unwrap(), label: c.label, amount_msat: c.amount_msat.map(|a| a.into()), bolt11: c.bolt11, payment_secret: c.payment_secret.map(|v| v.try_into().unwrap()), partid: c.partid.map(|v| v as u16), localinvreqid: c.localinvreqid.map(|v| hex::encode(v)), groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<pb::ListchannelsRequest> for requests::ListchannelsRequest {
fn from(c: pb::ListchannelsRequest) -> Self {
Self {
short_channel_id: c.short_channel_id.map(|v| cln_rpc::primitives::ShortChannelId::from_str(&v).unwrap()), source: c.source.map(|v| PublicKey::from_slice(&v).unwrap()), destination: c.destination.map(|v| PublicKey::from_slice(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::AddgossipRequest> for requests::AddgossipRequest {
fn from(c: pb::AddgossipRequest) -> Self {
Self {
message: hex::encode(&c.message), }
}
}
#[allow(unused_variables)]
impl From<pb::AutocleaninvoiceRequest> for requests::AutocleaninvoiceRequest {
fn from(c: pb::AutocleaninvoiceRequest) -> Self {
Self {
expired_by: c.expired_by, cycle_seconds: c.cycle_seconds, }
}
}
#[allow(unused_variables)]
impl From<pb::CheckmessageRequest> for requests::CheckmessageRequest {
fn from(c: pb::CheckmessageRequest) -> Self {
Self {
message: c.message, zbase: c.zbase, pubkey: c.pubkey.map(|v| PublicKey::from_slice(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::CloseRequest> for requests::CloseRequest {
fn from(c: pb::CloseRequest) -> Self {
Self {
id: c.id, unilateraltimeout: c.unilateraltimeout, destination: c.destination, fee_negotiation_step: c.fee_negotiation_step, wrong_funding: c.wrong_funding.map(|a| a.into()), force_lease_closed: c.force_lease_closed, feerange: Some(c.feerange.into_iter().map(|s| s.into()).collect()), }
}
}
#[allow(unused_variables)]
impl From<pb::ConnectRequest> for requests::ConnectRequest {
fn from(c: pb::ConnectRequest) -> Self {
Self {
id: c.id, host: c.host, port: c.port.map(|v| v as u16), }
}
}
#[allow(unused_variables)]
impl From<pb::CreateinvoiceRequest> for requests::CreateinvoiceRequest {
fn from(c: pb::CreateinvoiceRequest) -> Self {
Self {
invstring: c.invstring, label: c.label, preimage: hex::encode(&c.preimage), }
}
}
#[allow(unused_variables)]
impl From<pb::DatastoreRequest> for requests::DatastoreRequest {
fn from(c: pb::DatastoreRequest) -> Self {
Self {
key: c.key.into_iter().map(|s| s.into()).collect(), string: c.string, hex: c.hex.map(|v| hex::encode(v)), mode: c.mode.map(|v| v.try_into().unwrap()),
generation: c.generation, }
}
}
#[allow(unused_variables)]
impl From<pb::CreateonionHops> for requests::CreateonionHops {
fn from(c: pb::CreateonionHops) -> Self {
Self {
pubkey: PublicKey::from_slice(&c.pubkey).unwrap(), payload: hex::encode(&c.payload), }
}
}
#[allow(unused_variables)]
impl From<pb::CreateonionRequest> for requests::CreateonionRequest {
fn from(c: pb::CreateonionRequest) -> Self {
Self {
hops: c.hops.into_iter().map(|s| s.into()).collect(), assocdata: hex::encode(&c.assocdata), session_key: c.session_key.map(|v| v.try_into().unwrap()), onion_size: c.onion_size.map(|v| v as u16), }
}
}
#[allow(unused_variables)]
impl From<pb::DeldatastoreRequest> for requests::DeldatastoreRequest {
fn from(c: pb::DeldatastoreRequest) -> Self {
Self {
key: c.key.into_iter().map(|s| s.into()).collect(), generation: c.generation, }
}
}
#[allow(unused_variables)]
impl From<pb::DelexpiredinvoiceRequest> for requests::DelexpiredinvoiceRequest {
fn from(c: pb::DelexpiredinvoiceRequest) -> Self {
Self {
maxexpirytime: c.maxexpirytime, }
}
}
#[allow(unused_variables)]
impl From<pb::DelinvoiceRequest> for requests::DelinvoiceRequest {
fn from(c: pb::DelinvoiceRequest) -> Self {
Self {
label: c.label, status: c.status.try_into().unwrap(),
desconly: c.desconly, }
}
}
#[allow(unused_variables)]
impl From<pb::InvoiceRequest> for requests::InvoiceRequest {
fn from(c: pb::InvoiceRequest) -> Self {
Self {
amount_msat: c.amount_msat.unwrap().into(), description: c.description, label: c.label, expiry: c.expiry, fallbacks: Some(c.fallbacks.into_iter().map(|s| s.into()).collect()), preimage: c.preimage.map(|v| hex::encode(v)), cltv: c.cltv, deschashonly: c.deschashonly, }
}
}
#[allow(unused_variables)]
impl From<pb::ListdatastoreRequest> for requests::ListdatastoreRequest {
fn from(c: pb::ListdatastoreRequest) -> Self {
Self {
key: Some(c.key.into_iter().map(|s| s.into()).collect()), }
}
}
#[allow(unused_variables)]
impl From<pb::ListinvoicesRequest> for requests::ListinvoicesRequest {
fn from(c: pb::ListinvoicesRequest) -> Self {
Self {
label: c.label, invstring: c.invstring, payment_hash: c.payment_hash.map(|v| hex::encode(v)), offer_id: c.offer_id, index: c.index.map(|v| v.try_into().unwrap()),
start: c.start, limit: c.limit, }
}
}
#[allow(unused_variables)]
impl From<pb::SendonionFirstHop> for requests::SendonionFirst_hop {
fn from(c: pb::SendonionFirstHop) -> Self {
Self {
id: PublicKey::from_slice(&c.id).unwrap(), amount_msat: c.amount_msat.unwrap().into(), delay: c.delay as u16, }
}
}
#[allow(unused_variables)]
impl From<pb::SendonionRequest> for requests::SendonionRequest {
fn from(c: pb::SendonionRequest) -> Self {
Self {
onion: hex::encode(&c.onion), first_hop: c.first_hop.unwrap().into(),
payment_hash: Sha256::from_slice(&c.payment_hash).unwrap(), label: c.label, shared_secrets: Some(c.shared_secrets.into_iter().map(|s| s.try_into().unwrap()).collect()), partid: c.partid.map(|v| v as u16), bolt11: c.bolt11, amount_msat: c.amount_msat.map(|a| a.into()), destination: c.destination.map(|v| PublicKey::from_slice(&v).unwrap()), localinvreqid: c.localinvreqid.map(|v| Sha256::from_slice(&v).unwrap()), groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<pb::ListsendpaysRequest> for requests::ListsendpaysRequest {
fn from(c: pb::ListsendpaysRequest) -> Self {
Self {
bolt11: c.bolt11, payment_hash: c.payment_hash.map(|v| Sha256::from_slice(&v).unwrap()), status: c.status.map(|v| v.try_into().unwrap()),
}
}
}
#[allow(unused_variables)]
impl From<pb::ListtransactionsRequest> for requests::ListtransactionsRequest {
fn from(c: pb::ListtransactionsRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<pb::PayRequest> for requests::PayRequest {
fn from(c: pb::PayRequest) -> Self {
Self {
bolt11: c.bolt11, amount_msat: c.amount_msat.map(|a| a.into()), label: c.label, riskfactor: c.riskfactor, maxfeepercent: c.maxfeepercent, retry_for: c.retry_for.map(|v| v as u16), maxdelay: c.maxdelay.map(|v| v as u16), exemptfee: c.exemptfee.map(|a| a.into()), localinvreqid: c.localinvreqid.map(|v| hex::encode(v)), exclude: Some(c.exclude.into_iter().map(|s| s.into()).collect()), maxfee: c.maxfee.map(|a| a.into()), description: c.description, }
}
}
#[allow(unused_variables)]
impl From<pb::ListnodesRequest> for requests::ListnodesRequest {
fn from(c: pb::ListnodesRequest) -> Self {
Self {
id: c.id.map(|v| PublicKey::from_slice(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::WaitanyinvoiceRequest> for requests::WaitanyinvoiceRequest {
fn from(c: pb::WaitanyinvoiceRequest) -> Self {
Self {
lastpay_index: c.lastpay_index, timeout: c.timeout, }
}
}
#[allow(unused_variables)]
impl From<pb::WaitinvoiceRequest> for requests::WaitinvoiceRequest {
fn from(c: pb::WaitinvoiceRequest) -> Self {
Self {
label: c.label, }
}
}
#[allow(unused_variables)]
impl From<pb::WaitsendpayRequest> for requests::WaitsendpayRequest {
fn from(c: pb::WaitsendpayRequest) -> Self {
Self {
payment_hash: Sha256::from_slice(&c.payment_hash).unwrap(), timeout: c.timeout, partid: c.partid, groupid: c.groupid, }
}
}
#[allow(unused_variables)]
impl From<pb::NewaddrRequest> for requests::NewaddrRequest {
fn from(c: pb::NewaddrRequest) -> Self {
Self {
addresstype: c.addresstype.map(|v| v.try_into().unwrap()),
}
}
}
#[allow(unused_variables)]
impl From<pb::WithdrawRequest> for requests::WithdrawRequest {
fn from(c: pb::WithdrawRequest) -> Self {
Self {
destination: c.destination, satoshi: c.satoshi.map(|a| a.into()), feerate: c.feerate.map(|a| a.into()), minconf: c.minconf.map(|v| v as u16), utxos: Some(c.utxos.into_iter().map(|s| s.into()).collect()), }
}
}
#[allow(unused_variables)]
impl From<pb::KeysendRequest> for requests::KeysendRequest {
fn from(c: pb::KeysendRequest) -> Self {
Self {
destination: PublicKey::from_slice(&c.destination).unwrap(), amount_msat: c.amount_msat.unwrap().into(), label: c.label, maxfeepercent: c.maxfeepercent, retry_for: c.retry_for, maxdelay: c.maxdelay, exemptfee: c.exemptfee.map(|a| a.into()), routehints: c.routehints.map(|rl| rl.into()), extratlvs: c.extratlvs.map(|s| s.into()), }
}
}
#[allow(unused_variables)]
impl From<pb::FundpsbtRequest> for requests::FundpsbtRequest {
fn from(c: pb::FundpsbtRequest) -> Self {
Self {
satoshi: c.satoshi.unwrap().into(), feerate: c.feerate.unwrap().into(), startweight: c.startweight, minconf: c.minconf, reserve: c.reserve, locktime: c.locktime, min_witness_weight: c.min_witness_weight, excess_as_change: c.excess_as_change, nonwrapped: c.nonwrapped, opening_anchor_channel: c.opening_anchor_channel, }
}
}
#[allow(unused_variables)]
impl From<pb::SendpsbtRequest> for requests::SendpsbtRequest {
fn from(c: pb::SendpsbtRequest) -> Self {
Self {
psbt: c.psbt, reserve: c.reserve, }
}
}
#[allow(unused_variables)]
impl From<pb::SignpsbtRequest> for requests::SignpsbtRequest {
fn from(c: pb::SignpsbtRequest) -> Self {
Self {
psbt: c.psbt, signonly: Some(c.signonly.into_iter().map(|s| s).collect()), }
}
}
#[allow(unused_variables)]
impl From<pb::UtxopsbtRequest> for requests::UtxopsbtRequest {
fn from(c: pb::UtxopsbtRequest) -> Self {
Self {
satoshi: c.satoshi.unwrap().into(), feerate: c.feerate.unwrap().into(), startweight: c.startweight, utxos: c.utxos.into_iter().map(|s| s.into()).collect(), reserve: c.reserve, reservedok: c.reservedok, locktime: c.locktime, min_witness_weight: c.min_witness_weight, excess_as_change: c.excess_as_change, opening_anchor_channel: c.opening_anchor_channel, }
}
}
#[allow(unused_variables)]
impl From<pb::TxdiscardRequest> for requests::TxdiscardRequest {
fn from(c: pb::TxdiscardRequest) -> Self {
Self {
txid: hex::encode(&c.txid), }
}
}
#[allow(unused_variables)]
impl From<pb::TxprepareRequest> for requests::TxprepareRequest {
fn from(c: pb::TxprepareRequest) -> Self {
Self {
outputs: c.outputs.into_iter().map(|s| s.into()).collect(), feerate: c.feerate.map(|a| a.into()), minconf: c.minconf, utxos: Some(c.utxos.into_iter().map(|s| s.into()).collect()), }
}
}
#[allow(unused_variables)]
impl From<pb::TxsendRequest> for requests::TxsendRequest {
fn from(c: pb::TxsendRequest) -> Self {
Self {
txid: hex::encode(&c.txid), }
}
}
#[allow(unused_variables)]
impl From<pb::ListpeerchannelsRequest> for requests::ListpeerchannelsRequest {
fn from(c: pb::ListpeerchannelsRequest) -> Self {
Self {
id: c.id.map(|v| PublicKey::from_slice(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::ListclosedchannelsRequest> for requests::ListclosedchannelsRequest {
fn from(c: pb::ListclosedchannelsRequest) -> Self {
Self {
id: c.id.map(|v| PublicKey::from_slice(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::DecodepayRequest> for requests::DecodepayRequest {
fn from(c: pb::DecodepayRequest) -> Self {
Self {
bolt11: c.bolt11, description: c.description, }
}
}
#[allow(unused_variables)]
impl From<pb::DecodeRequest> for requests::DecodeRequest {
fn from(c: pb::DecodeRequest) -> Self {
Self {
string: c.string, }
}
}
#[allow(unused_variables)]
impl From<pb::DisconnectRequest> for requests::DisconnectRequest {
fn from(c: pb::DisconnectRequest) -> Self {
Self {
id: PublicKey::from_slice(&c.id).unwrap(), force: c.force, }
}
}
#[allow(unused_variables)]
impl From<pb::FeeratesRequest> for requests::FeeratesRequest {
fn from(c: pb::FeeratesRequest) -> Self {
Self {
style: c.style.try_into().unwrap(),
}
}
}
#[allow(unused_variables)]
impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
fn from(c: pb::FundchannelRequest) -> Self {
Self {
id: PublicKey::from_slice(&c.id).unwrap(), amount: c.amount.unwrap().into(), feerate: c.feerate.map(|a| a.into()), announce: c.announce, minconf: c.minconf, push_msat: c.push_msat.map(|a| a.into()), close_to: c.close_to, request_amt: c.request_amt.map(|a| a.into()), compact_lease: c.compact_lease, utxos: Some(c.utxos.into_iter().map(|s| s.into()).collect()), mindepth: c.mindepth, reserve: c.reserve.map(|a| a.into()), }
}
}
#[allow(unused_variables)]
impl From<pb::GetrouteRequest> for requests::GetrouteRequest {
fn from(c: pb::GetrouteRequest) -> Self {
Self {
id: PublicKey::from_slice(&c.id).unwrap(), amount_msat: c.amount_msat.unwrap().into(), riskfactor: c.riskfactor, cltv: c.cltv, fromid: c.fromid.map(|v| PublicKey::from_slice(&v).unwrap()), fuzzpercent: c.fuzzpercent, exclude: Some(c.exclude.into_iter().map(|s| s.into()).collect()), maxhops: c.maxhops, }
}
}
#[allow(unused_variables)]
impl From<pb::ListforwardsRequest> for requests::ListforwardsRequest {
fn from(c: pb::ListforwardsRequest) -> Self {
Self {
status: c.status.map(|v| v.try_into().unwrap()),
in_channel: c.in_channel.map(|v| cln_rpc::primitives::ShortChannelId::from_str(&v).unwrap()), out_channel: c.out_channel.map(|v| cln_rpc::primitives::ShortChannelId::from_str(&v).unwrap()), }
}
}
#[allow(unused_variables)]
impl From<pb::ListpaysRequest> for requests::ListpaysRequest {
fn from(c: pb::ListpaysRequest) -> Self {
Self {
bolt11: c.bolt11, payment_hash: c.payment_hash.map(|v| Sha256::from_slice(&v).unwrap()), status: c.status.map(|v| v.try_into().unwrap()),
}
}
}
#[allow(unused_variables)]
impl From<pb::ListhtlcsRequest> for requests::ListhtlcsRequest {
fn from(c: pb::ListhtlcsRequest) -> Self {
Self {
id: c.id, }
}
}
#[allow(unused_variables)]
impl From<pb::PingRequest> for requests::PingRequest {
fn from(c: pb::PingRequest) -> Self {
Self {
id: PublicKey::from_slice(&c.id).unwrap(), len: c.len.map(|v| v as u16), pongbytes: c.pongbytes.map(|v| v as u16), }
}
}
#[allow(unused_variables)]
impl From<pb::SendcustommsgRequest> for requests::SendcustommsgRequest {
fn from(c: pb::SendcustommsgRequest) -> Self {
Self {
node_id: PublicKey::from_slice(&c.node_id).unwrap(), msg: hex::encode(&c.msg), }
}
}
#[allow(unused_variables)]
impl From<pb::SetchannelRequest> for requests::SetchannelRequest {
fn from(c: pb::SetchannelRequest) -> Self {
Self {
id: c.id, feebase: c.feebase.map(|a| a.into()), feeppm: c.feeppm, htlcmin: c.htlcmin.map(|a| a.into()), htlcmax: c.htlcmax.map(|a| a.into()), enforcedelay: c.enforcedelay, ignorefeelimits: c.ignorefeelimits, }
}
}
#[allow(unused_variables)]
impl From<pb::SigninvoiceRequest> for requests::SigninvoiceRequest {
fn from(c: pb::SigninvoiceRequest) -> Self {
Self {
invstring: c.invstring, }
}
}
#[allow(unused_variables)]
impl From<pb::SignmessageRequest> for requests::SignmessageRequest {
fn from(c: pb::SignmessageRequest) -> Self {
Self {
message: c.message, }
}
}
#[allow(unused_variables)]
impl From<pb::StopRequest> for requests::StopRequest {
fn from(c: pb::StopRequest) -> Self {
Self {
}
}
}
#[allow(unused_variables)]
impl From<pb::PreapprovekeysendRequest> for requests::PreapprovekeysendRequest {
fn from(c: pb::PreapprovekeysendRequest) -> Self {
Self {
destination: c.destination.map(|v| PublicKey::from_slice(&v).unwrap()), payment_hash: c.payment_hash.map(|v| hex::encode(v)), amount_msat: c.amount_msat.map(|a| a.into()), }
}
}
#[allow(unused_variables)]
impl From<pb::PreapproveinvoiceRequest> for requests::PreapproveinvoiceRequest {
fn from(c: pb::PreapproveinvoiceRequest) -> Self {
Self {
bolt11: c.bolt11, }
}
}
#[allow(unused_variables)]
impl From<pb::StaticbackupRequest> for requests::StaticbackupRequest {
fn from(c: pb::StaticbackupRequest) -> Self {
Self {
}
}
}