diff --git a/cln-grpc/src/convert.rs b/cln-grpc/src/convert.rs index 71b6f101f..0d34dafb3 100644 --- a/cln-grpc/src/convert.rs +++ b/cln-grpc/src/convert.rs @@ -1135,6 +1135,593 @@ impl From for pb::StopResponse { } } +#[allow(unused_variables)] +impl From for pb::GetinfoRequest { + fn from(c: requests::GetinfoRequest) -> Self { + Self { + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListpeersRequest { + fn from(c: requests::ListpeersRequest) -> Self { + Self { + id: c.id.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + level: c.level, // Rule #2 for type string? + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListfundsRequest { + fn from(c: requests::ListfundsRequest) -> Self { + Self { + spent: c.spent, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SendpayRoute { + fn from(c: requests::SendpayRoute) -> Self { + Self { + amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + delay: c.delay.into(), // Rule #2 for type u16 + channel: c.channel.to_string(), // Rule #2 for type short_channel_id + } + } +} + +#[allow(unused_variables)] +impl From for pb::SendpayRequest { + fn from(c: requests::SendpayRequest) -> Self { + Self { + route: c.route.into_iter().map(|i| i.into()).collect(), // Rule #3 for type SendpayRoute + payment_hash: c.payment_hash.to_vec(), // Rule #2 for type hash + label: c.label, // Rule #2 for type string? + amount_msat: c.amount_msat.map(|f| f.into()), // Rule #2 for type msat? + bolt11: c.bolt11, // Rule #2 for type string? + payment_secret: c.payment_secret.map(|v| v.to_vec()), // Rule #2 for type secret? + partid: c.partid.map(|v| v.into()), // Rule #2 for type u16? + localinvreqid: c.localinvreqid.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex? + groupid: c.groupid, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListchannelsRequest { + fn from(c: requests::ListchannelsRequest) -> Self { + Self { + short_channel_id: c.short_channel_id.map(|v| v.to_string()), // Rule #2 for type short_channel_id? + source: c.source.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + destination: c.destination.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + } + } +} + +#[allow(unused_variables)] +impl From for pb::AddgossipRequest { + fn from(c: requests::AddgossipRequest) -> Self { + Self { + message: hex::decode(&c.message).unwrap(), // Rule #2 for type hex + } + } +} + +#[allow(unused_variables)] +impl From for pb::AutocleaninvoiceRequest { + fn from(c: requests::AutocleaninvoiceRequest) -> Self { + Self { + expired_by: c.expired_by, // Rule #2 for type u64? + cycle_seconds: c.cycle_seconds, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::CheckmessageRequest { + fn from(c: requests::CheckmessageRequest) -> Self { + Self { + message: c.message, // Rule #2 for type string + zbase: c.zbase, // Rule #2 for type string + pubkey: c.pubkey.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + } + } +} + +#[allow(unused_variables)] +impl From for pb::CloseRequest { + fn from(c: requests::CloseRequest) -> Self { + Self { + id: c.id, // Rule #2 for type string + unilateraltimeout: c.unilateraltimeout, // Rule #2 for type u32? + destination: c.destination, // Rule #2 for type string? + fee_negotiation_step: c.fee_negotiation_step, // Rule #2 for type string? + wrong_funding: c.wrong_funding.map(|o|o.into()), // Rule #2 for type outpoint? + force_lease_closed: c.force_lease_closed, // Rule #2 for type boolean? + feerange: c.feerange.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + } + } +} + +#[allow(unused_variables)] +impl From for pb::ConnectRequest { + fn from(c: requests::ConnectRequest) -> Self { + Self { + id: c.id, // Rule #2 for type string + host: c.host, // Rule #2 for type string? + port: c.port.map(|v| v.into()), // Rule #2 for type u16? + } + } +} + +#[allow(unused_variables)] +impl From for pb::CreateinvoiceRequest { + fn from(c: requests::CreateinvoiceRequest) -> Self { + Self { + invstring: c.invstring, // Rule #2 for type string + label: c.label, // Rule #2 for type string + preimage: hex::decode(&c.preimage).unwrap(), // Rule #2 for type hex + } + } +} + +#[allow(unused_variables)] +impl From for pb::DatastoreRequest { + fn from(c: requests::DatastoreRequest) -> Self { + Self { + key: c.key.into_iter().map(|i| i.into()).collect(), // Rule #3 for type string + string: c.string, // Rule #2 for type string? + hex: c.hex.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex? + mode: c.mode.map(|v| v as i32), + generation: c.generation, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::CreateonionHops { + fn from(c: requests::CreateonionHops) -> Self { + Self { + pubkey: c.pubkey.serialize().to_vec(), // Rule #2 for type pubkey + payload: hex::decode(&c.payload).unwrap(), // Rule #2 for type hex + } + } +} + +#[allow(unused_variables)] +impl From for pb::CreateonionRequest { + fn from(c: requests::CreateonionRequest) -> Self { + Self { + hops: c.hops.into_iter().map(|i| i.into()).collect(), // Rule #3 for type CreateonionHops + assocdata: hex::decode(&c.assocdata).unwrap(), // Rule #2 for type hex + session_key: c.session_key.map(|v| v.to_vec()), // Rule #2 for type secret? + onion_size: c.onion_size.map(|v| v.into()), // Rule #2 for type u16? + } + } +} + +#[allow(unused_variables)] +impl From for pb::DeldatastoreRequest { + fn from(c: requests::DeldatastoreRequest) -> Self { + Self { + key: c.key.into_iter().map(|i| i.into()).collect(), // Rule #3 for type string + generation: c.generation, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::DelexpiredinvoiceRequest { + fn from(c: requests::DelexpiredinvoiceRequest) -> Self { + Self { + maxexpirytime: c.maxexpirytime, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::DelinvoiceRequest { + fn from(c: requests::DelinvoiceRequest) -> Self { + Self { + label: c.label, // Rule #2 for type string + status: c.status as i32, + desconly: c.desconly, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::InvoiceRequest { + fn from(c: requests::InvoiceRequest) -> Self { + Self { + amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat_or_any + description: c.description, // Rule #2 for type string + label: c.label, // Rule #2 for type string + expiry: c.expiry, // Rule #2 for type u64? + fallbacks: c.fallbacks.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + preimage: c.preimage.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex? + exposeprivatechannels: c.exposeprivatechannels, // Rule #2 for type boolean? + cltv: c.cltv, // Rule #2 for type u32? + deschashonly: c.deschashonly, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From 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![]), // Rule #3 + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListinvoicesRequest { + fn from(c: requests::ListinvoicesRequest) -> Self { + Self { + label: c.label, // Rule #2 for type string? + invstring: c.invstring, // Rule #2 for type string? + payment_hash: c.payment_hash.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex? + offer_id: c.offer_id, // Rule #2 for type string? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SendonionFirstHop { + fn from(c: requests::SendonionFirst_hop) -> Self { + Self { + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat + delay: c.delay.into(), // Rule #2 for type u16 + } + } +} + +#[allow(unused_variables)] +impl From for pb::SendonionRequest { + fn from(c: requests::SendonionRequest) -> Self { + Self { + onion: hex::decode(&c.onion).unwrap(), // Rule #2 for type hex + first_hop: Some(c.first_hop.into()), + payment_hash: c.payment_hash.to_vec(), // Rule #2 for type hash + label: c.label, // Rule #2 for type string? + shared_secrets: c.shared_secrets.map(|arr| arr.into_iter().map(|i| i.to_vec()).collect()).unwrap_or(vec![]), // Rule #3 + partid: c.partid.map(|v| v.into()), // Rule #2 for type u16? + bolt11: c.bolt11, // Rule #2 for type string? + amount_msat: c.amount_msat.map(|f| f.into()), // Rule #2 for type msat? + destination: c.destination.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + localinvreqid: c.localinvreqid.map(|v| v.to_vec()), // Rule #2 for type hash? + groupid: c.groupid, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListsendpaysRequest { + fn from(c: requests::ListsendpaysRequest) -> Self { + Self { + bolt11: c.bolt11, // Rule #2 for type string? + payment_hash: c.payment_hash.map(|v| v.to_vec()), // Rule #2 for type hash? + status: c.status.map(|v| v as i32), + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListtransactionsRequest { + fn from(c: requests::ListtransactionsRequest) -> Self { + Self { + } + } +} + +#[allow(unused_variables)] +impl From for pb::PayRequest { + fn from(c: requests::PayRequest) -> Self { + Self { + bolt11: c.bolt11, // Rule #2 for type string + amount_msat: c.amount_msat.map(|f| f.into()), // Rule #2 for type msat? + label: c.label, // Rule #2 for type string? + riskfactor: c.riskfactor, // Rule #2 for type number? + maxfeepercent: c.maxfeepercent, // Rule #2 for type number? + retry_for: c.retry_for.map(|v| v.into()), // Rule #2 for type u16? + maxdelay: c.maxdelay.map(|v| v.into()), // Rule #2 for type u16? + exemptfee: c.exemptfee.map(|f| f.into()), // Rule #2 for type msat? + localinvreqid: c.localinvreqid.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex? + exclude: c.exclude.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + maxfee: c.maxfee.map(|f| f.into()), // Rule #2 for type msat? + description: c.description, // Rule #2 for type string? + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListnodesRequest { + fn from(c: requests::ListnodesRequest) -> Self { + Self { + id: c.id.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + } + } +} + +#[allow(unused_variables)] +impl From for pb::WaitanyinvoiceRequest { + fn from(c: requests::WaitanyinvoiceRequest) -> Self { + Self { + lastpay_index: c.lastpay_index, // Rule #2 for type u64? + timeout: c.timeout, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::WaitinvoiceRequest { + fn from(c: requests::WaitinvoiceRequest) -> Self { + Self { + label: c.label, // Rule #2 for type string + } + } +} + +#[allow(unused_variables)] +impl From for pb::WaitsendpayRequest { + fn from(c: requests::WaitsendpayRequest) -> Self { + Self { + payment_hash: c.payment_hash.to_vec(), // Rule #2 for type hash + timeout: c.timeout, // Rule #2 for type u32? + partid: c.partid, // Rule #2 for type u64? + groupid: c.groupid, // Rule #2 for type u64? + } + } +} + +#[allow(unused_variables)] +impl From for pb::NewaddrRequest { + fn from(c: requests::NewaddrRequest) -> Self { + Self { + addresstype: c.addresstype.map(|v| v as i32), + } + } +} + +#[allow(unused_variables)] +impl From for pb::WithdrawRequest { + fn from(c: requests::WithdrawRequest) -> Self { + Self { + destination: c.destination, // Rule #2 for type string + satoshi: c.satoshi.map(|o|o.into()), // Rule #2 for type msat_or_all? + feerate: c.feerate.map(|o|o.into()), // Rule #2 for type feerate? + minconf: c.minconf.map(|v| v.into()), // Rule #2 for type u16? + utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + } + } +} + +#[allow(unused_variables)] +impl From for pb::KeysendRequest { + fn from(c: requests::KeysendRequest) -> Self { + Self { + destination: c.destination.serialize().to_vec(), // Rule #2 for type pubkey + amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat + label: c.label, // Rule #2 for type string? + maxfeepercent: c.maxfeepercent, // Rule #2 for type number? + retry_for: c.retry_for, // Rule #2 for type u32? + maxdelay: c.maxdelay, // Rule #2 for type u32? + exemptfee: c.exemptfee.map(|f| f.into()), // Rule #2 for type msat? + routehints: c.routehints.map(|rl| rl.into()), // Rule #2 for type RoutehintList? + extratlvs: c.extratlvs.map(|s| s.into()), // Rule #2 for type TlvStream? + } + } +} + +#[allow(unused_variables)] +impl From for pb::FundpsbtRequest { + fn from(c: requests::FundpsbtRequest) -> Self { + Self { + satoshi: Some(c.satoshi.into()), // Rule #2 for type msat_or_all + feerate: Some(c.feerate.into()), // Rule #2 for type feerate + startweight: c.startweight, // Rule #2 for type u32 + minconf: c.minconf, // Rule #2 for type u32? + reserve: c.reserve, // Rule #2 for type u32? + locktime: c.locktime, // Rule #2 for type u32? + min_witness_weight: c.min_witness_weight, // Rule #2 for type u32? + excess_as_change: c.excess_as_change, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SendpsbtRequest { + fn from(c: requests::SendpsbtRequest) -> Self { + Self { + psbt: c.psbt, // Rule #2 for type string + reserve: c.reserve, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SignpsbtRequest { + fn from(c: requests::SignpsbtRequest) -> Self { + Self { + psbt: c.psbt, // Rule #2 for type string + signonly: c.signonly.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + } + } +} + +#[allow(unused_variables)] +impl From for pb::UtxopsbtRequest { + fn from(c: requests::UtxopsbtRequest) -> Self { + Self { + satoshi: Some(c.satoshi.into()), // Rule #2 for type msat + feerate: Some(c.feerate.into()), // Rule #2 for type feerate + startweight: c.startweight, // Rule #2 for type u32 + utxos: c.utxos.into_iter().map(|i| i.into()).collect(), // Rule #3 for type outpoint + reserve: c.reserve, // Rule #2 for type u32? + reservedok: c.reservedok, // Rule #2 for type boolean? + locktime: c.locktime, // Rule #2 for type u32? + min_witness_weight: c.min_witness_weight, // Rule #2 for type u32? + excess_as_change: c.excess_as_change, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::TxdiscardRequest { + fn from(c: requests::TxdiscardRequest) -> Self { + Self { + txid: hex::decode(&c.txid).unwrap(), // Rule #2 for type txid + } + } +} + +#[allow(unused_variables)] +impl From for pb::TxprepareRequest { + fn from(c: requests::TxprepareRequest) -> Self { + Self { + outputs: c.outputs.into_iter().map(|i| i.into()).collect(), // Rule #3 for type outputdesc + feerate: c.feerate.map(|o|o.into()), // Rule #2 for type feerate? + minconf: c.minconf, // Rule #2 for type u32? + utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + } + } +} + +#[allow(unused_variables)] +impl From for pb::TxsendRequest { + fn from(c: requests::TxsendRequest) -> Self { + Self { + txid: hex::decode(&c.txid).unwrap(), // Rule #2 for type txid + } + } +} + +#[allow(unused_variables)] +impl From for pb::DisconnectRequest { + fn from(c: requests::DisconnectRequest) -> Self { + Self { + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + force: c.force, // Rule #2 for type boolean? + } + } +} + +#[allow(unused_variables)] +impl From for pb::FeeratesRequest { + fn from(c: requests::FeeratesRequest) -> Self { + Self { + style: c.style as i32, + } + } +} + +#[allow(unused_variables)] +impl From for pb::FundchannelRequest { + fn from(c: requests::FundchannelRequest) -> Self { + Self { + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + amount: Some(c.amount.into()), // Rule #2 for type msat_or_all + feerate: c.feerate.map(|o|o.into()), // Rule #2 for type feerate? + announce: c.announce, // Rule #2 for type boolean? + minconf: c.minconf, // Rule #2 for type u32? + push_msat: c.push_msat.map(|f| f.into()), // Rule #2 for type msat? + close_to: c.close_to, // Rule #2 for type string? + request_amt: c.request_amt.map(|f| f.into()), // Rule #2 for type msat? + compact_lease: c.compact_lease, // Rule #2 for type string? + utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + mindepth: c.mindepth, // Rule #2 for type u32? + reserve: c.reserve.map(|f| f.into()), // Rule #2 for type msat? + } + } +} + +#[allow(unused_variables)] +impl From for pb::GetrouteRequest { + fn from(c: requests::GetrouteRequest) -> Self { + Self { + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat + riskfactor: c.riskfactor, // Rule #2 for type u64 + cltv: c.cltv, // Rule #2 for type number? + fromid: c.fromid.map(|v| v.serialize().to_vec()), // Rule #2 for type pubkey? + fuzzpercent: c.fuzzpercent, // Rule #2 for type u32? + exclude: c.exclude.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3 + maxhops: c.maxhops, // Rule #2 for type u32? + } + } +} + +#[allow(unused_variables)] +impl From 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()), // Rule #2 for type short_channel_id? + out_channel: c.out_channel.map(|v| v.to_string()), // Rule #2 for type short_channel_id? + } + } +} + +#[allow(unused_variables)] +impl From for pb::ListpaysRequest { + fn from(c: requests::ListpaysRequest) -> Self { + Self { + bolt11: c.bolt11, // Rule #2 for type string? + payment_hash: c.payment_hash.map(|v| v.to_vec()), // Rule #2 for type hash? + status: c.status.map(|v| v as i32), + } + } +} + +#[allow(unused_variables)] +impl From for pb::PingRequest { + fn from(c: requests::PingRequest) -> Self { + Self { + id: c.id.serialize().to_vec(), // Rule #2 for type pubkey + len: c.len.map(|v| v.into()), // Rule #2 for type u16? + pongbytes: c.pongbytes.map(|v| v.into()), // Rule #2 for type u16? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SetchannelRequest { + fn from(c: requests::SetchannelRequest) -> Self { + Self { + id: c.id, // Rule #2 for type string + feebase: c.feebase.map(|f| f.into()), // Rule #2 for type msat? + feeppm: c.feeppm, // Rule #2 for type u32? + htlcmin: c.htlcmin.map(|f| f.into()), // Rule #2 for type msat? + htlcmax: c.htlcmax.map(|f| f.into()), // Rule #2 for type msat? + enforcedelay: c.enforcedelay, // Rule #2 for type u32? + } + } +} + +#[allow(unused_variables)] +impl From for pb::SignmessageRequest { + fn from(c: requests::SignmessageRequest) -> Self { + Self { + message: c.message, // Rule #2 for type string + } + } +} + +#[allow(unused_variables)] +impl From for pb::StopRequest { + fn from(c: requests::StopRequest) -> Self { + Self { + } + } +} + #[allow(unused_variables)] impl From for requests::GetinfoRequest { fn from(c: pb::GetinfoRequest) -> Self { diff --git a/cln-grpc/src/pb.rs b/cln-grpc/src/pb.rs index 7e0cd9722..37572900d 100644 --- a/cln-grpc/src/pb.rs +++ b/cln-grpc/src/pb.rs @@ -50,6 +50,20 @@ impl From for cln_rpc::primitives::Feerate { } } +impl From for Feerate { + fn from(f: cln_rpc::primitives::Feerate) -> Feerate { + use feerate::Style; + let style = Some(match f { + JFeerate::Slow => Style::Slow(true), + JFeerate::Normal => Style::Normal(true), + JFeerate::Urgent => Style::Urgent(true), + JFeerate::PerKb(i) => Style::Perkb(i), + JFeerate::PerKw(i) => Style::Perkw(i), + }); + Self { style } + } +} + impl From for JOutputDesc { fn from(od: OutputDesc) -> JOutputDesc { JOutputDesc { @@ -59,6 +73,15 @@ impl From for JOutputDesc { } } +impl From for OutputDesc { + fn from(od: JOutputDesc) -> Self { + Self { + address: od.address, + amount: Some(od.amount.into()), + } + } +} + impl From for AmountOrAll { fn from(a: JAmountOrAll) -> Self { match a { @@ -131,6 +154,34 @@ impl From for cln_rpc::primitives::RoutehintList { } } +impl From for RouteHop { + fn from(c: cln_rpc::primitives::Routehop) -> Self { + Self { + id: c.id.serialize().to_vec(), + feebase: Some(c.feebase.into()), + feeprop: c.feeprop, + expirydelta: c.expirydelta as u32, + short_channel_id: c.scid.to_string(), + } + } +} + +impl From for Routehint { + fn from(c: cln_rpc::primitives::Routehint) -> Self { + Self { + hops: c.hops.into_iter().map(|h| h.into()).collect(), + } + } +} + +impl From for RoutehintList { + fn from(c: cln_rpc::primitives::RoutehintList) -> Self { + Self { + hints: c.hints.into_iter().map(|e| e.into()).collect(), + } + } +} + impl From for cln_rpc::primitives::TlvStream { fn from(s: TlvStream) -> Self { Self { @@ -148,6 +199,23 @@ impl From for cln_rpc::primitives::TlvEntry { } } +impl From for TlvStream { + fn from(s: cln_rpc::primitives::TlvStream) -> Self { + Self { + entries: s.entries.into_iter().map(|e| e.into()).collect(), + } + } +} + +impl From for TlvEntry { + fn from(e: cln_rpc::primitives::TlvEntry) -> Self { + Self { + r#type: e.typ, + value: e.value, + } + } +} + #[cfg(test)] mod test { use super::*; diff --git a/contrib/msggen/msggen/gen/grpc.py b/contrib/msggen/msggen/gen/grpc.py index f70dabf32..e0a85dd1d 100644 --- a/contrib/msggen/msggen/gen/grpc.py +++ b/contrib/msggen/msggen/gen/grpc.py @@ -322,6 +322,17 @@ class GrpcConverterGenerator(IGenerator): 'hash?': f'c.{name}.map(|v| v.to_vec())', 'secret': f'c.{name}.to_vec()', 'secret?': f'c.{name}.map(|v| v.to_vec())', + + 'msat_or_any': f'Some(c.{name}.into())', + 'msat_or_all': f'Some(c.{name}.into())', + 'msat_or_all?': f'c.{name}.map(|o|o.into())', + 'feerate?': f'c.{name}.map(|o|o.into())', + 'feerate': f'Some(c.{name}.into())', + 'outpoint?': f'c.{name}.map(|o|o.into())', + 'TlvStream?': f'c.{name}.map(|s| s.into())', + 'RoutehintList?': f'c.{name}.map(|rl| rl.into())', + + }.get( typ, f'c.{name}' # default to just assignment @@ -379,6 +390,7 @@ class GrpcConverterGenerator(IGenerator): """) self.generate_responses(service) + self.generate_requests(service) def write(self, text: str, numindent: int = 0) -> None: raw = dedent(text)