mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-12 02:08:15 +01:00
schemas: use sat and sat_or_all again where appropiate
Changelog-None
This commit is contained in:
parent
964c0732cf
commit
0eb65e4bb5
20 changed files with 79 additions and 48 deletions
48
cln-grpc/src/convert.rs
generated
48
cln-grpc/src/convert.rs
generated
|
@ -4045,7 +4045,7 @@ impl From<requests::AddpsbtoutputRequest> for pb::AddpsbtoutputRequest {
|
|||
destination: c.destination, // Rule #2 for type string?
|
||||
initialpsbt: c.initialpsbt, // Rule #2 for type string?
|
||||
locktime: c.locktime, // Rule #2 for type u32?
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type msat
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type sat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4455,7 +4455,7 @@ impl From<requests::WithdrawRequest> for pb::WithdrawRequest {
|
|||
destination: c.destination, // Rule #2 for type string
|
||||
feerate: c.feerate.map(|o|o.into()), // Rule #2 for type feerate?
|
||||
minconf: c.minconf.map(|v| v.into()), // Rule #2 for type u16?
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type msat_or_all
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type sat_or_all
|
||||
// Field: Withdraw.utxos[]
|
||||
utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
}
|
||||
|
@ -4491,7 +4491,7 @@ impl From<requests::FundpsbtRequest> for pb::FundpsbtRequest {
|
|||
nonwrapped: c.nonwrapped, // Rule #2 for type boolean?
|
||||
opening_anchor_channel: c.opening_anchor_channel, // Rule #2 for type boolean?
|
||||
reserve: c.reserve, // Rule #2 for type u32?
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type msat_or_all
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type sat_or_all
|
||||
startweight: c.startweight, // Rule #2 for type u32
|
||||
}
|
||||
}
|
||||
|
@ -4529,7 +4529,7 @@ impl From<requests::UtxopsbtRequest> for pb::UtxopsbtRequest {
|
|||
opening_anchor_channel: c.opening_anchor_channel, // Rule #2 for type boolean?
|
||||
reserve: c.reserve, // Rule #2 for type u32?
|
||||
reservedok: c.reservedok, // Rule #2 for type boolean?
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type msat_or_all
|
||||
satoshi: Some(c.satoshi.into()), // Rule #2 for type sat_or_all
|
||||
startweight: c.startweight, // Rule #2 for type u32
|
||||
// Field: UtxoPsbt.utxos[]
|
||||
utxos: c.utxos.into_iter().map(|i| i.into()).collect(), // Rule #3 for type outpoint
|
||||
|
@ -4696,7 +4696,7 @@ impl From<requests::Fundchannel_completeRequest> for pb::FundchannelCompleteRequ
|
|||
impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
|
||||
fn from(c: requests::FundchannelRequest) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat_or_all
|
||||
amount: Some(c.amount.into()), // Rule #2 for type sat_or_all
|
||||
announce: c.announce, // Rule #2 for type boolean?
|
||||
// Field: FundChannel.channel_type[]
|
||||
channel_type: c.channel_type.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
|
@ -4708,7 +4708,7 @@ impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
|
|||
mindepth: c.mindepth, // Rule #2 for type u32?
|
||||
push_msat: c.push_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
request_amt: c.request_amt.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type sat?
|
||||
// Field: FundChannel.utxos[]
|
||||
utxos: c.utxos.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
}
|
||||
|
@ -4719,7 +4719,7 @@ impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
|
|||
impl From<requests::Fundchannel_startRequest> for pb::FundchannelStartRequest {
|
||||
fn from(c: requests::Fundchannel_startRequest) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat
|
||||
amount: Some(c.amount.into()), // Rule #2 for type sat
|
||||
announce: c.announce, // Rule #2 for type boolean?
|
||||
// Field: FundChannel_Start.channel_type[]
|
||||
channel_type: c.channel_type.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
|
@ -4728,7 +4728,7 @@ impl From<requests::Fundchannel_startRequest> for pb::FundchannelStartRequest {
|
|||
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
mindepth: c.mindepth, // Rule #2 for type u32?
|
||||
push_msat: c.push_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type sat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4831,7 +4831,7 @@ impl From<requests::ListhtlcsRequest> for pb::ListhtlcsRequest {
|
|||
impl From<requests::MultifundchannelDestinations> for pb::MultifundchannelDestinations {
|
||||
fn from(c: requests::MultifundchannelDestinations) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat_or_all
|
||||
amount: Some(c.amount.into()), // Rule #2 for type sat_or_all
|
||||
announce: c.announce, // Rule #2 for type boolean?
|
||||
close_to: c.close_to, // Rule #2 for type string?
|
||||
compact_lease: c.compact_lease, // Rule #2 for type string?
|
||||
|
@ -4839,7 +4839,7 @@ impl From<requests::MultifundchannelDestinations> for pb::MultifundchannelDestin
|
|||
mindepth: c.mindepth, // Rule #2 for type u32?
|
||||
push_msat: c.push_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
request_amt: c.request_amt.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type sat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4906,7 +4906,7 @@ impl From<requests::Openchannel_abortRequest> for pb::OpenchannelAbortRequest {
|
|||
impl From<requests::Openchannel_bumpRequest> for pb::OpenchannelBumpRequest {
|
||||
fn from(c: requests::Openchannel_bumpRequest) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat
|
||||
amount: Some(c.amount.into()), // Rule #2 for type sat
|
||||
channel_id: <Sha256 as AsRef<[u8]>>::as_ref(&c.channel_id).to_vec(), // Rule #2 for type hash
|
||||
funding_feerate: c.funding_feerate.map(|o|o.into()), // Rule #2 for type feerate?
|
||||
initialpsbt: c.initialpsbt, // Rule #2 for type string
|
||||
|
@ -4918,7 +4918,7 @@ impl From<requests::Openchannel_bumpRequest> for pb::OpenchannelBumpRequest {
|
|||
impl From<requests::Openchannel_initRequest> for pb::OpenchannelInitRequest {
|
||||
fn from(c: requests::Openchannel_initRequest) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat
|
||||
amount: Some(c.amount.into()), // Rule #2 for type sat
|
||||
announce: c.announce, // Rule #2 for type boolean?
|
||||
// Field: OpenChannel_Init.channel_type[]
|
||||
channel_type: c.channel_type.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
|
@ -5469,7 +5469,7 @@ impl From<pb::AddpsbtoutputRequest> for requests::AddpsbtoutputRequest {
|
|||
destination: c.destination, // Rule #1 for type string?
|
||||
initialpsbt: c.initialpsbt, // Rule #1 for type string?
|
||||
locktime: c.locktime, // Rule #1 for type u32?
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type msat
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type sat
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5868,7 +5868,7 @@ impl From<pb::WithdrawRequest> for requests::WithdrawRequest {
|
|||
destination: c.destination, // Rule #1 for type string
|
||||
feerate: c.feerate.map(|a| a.into()), // Rule #1 for type feerate?
|
||||
minconf: c.minconf.map(|v| v as u16), // Rule #1 for type u16?
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type msat_or_all
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type sat_or_all
|
||||
utxos: Some(c.utxos.into_iter().map(|s| s.into()).collect()), // Rule #4
|
||||
}
|
||||
}
|
||||
|
@ -5903,7 +5903,7 @@ impl From<pb::FundpsbtRequest> for requests::FundpsbtRequest {
|
|||
nonwrapped: c.nonwrapped, // Rule #1 for type boolean?
|
||||
opening_anchor_channel: c.opening_anchor_channel, // Rule #1 for type boolean?
|
||||
reserve: c.reserve, // Rule #1 for type u32?
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type msat_or_all
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type sat_or_all
|
||||
startweight: c.startweight, // Rule #1 for type u32
|
||||
}
|
||||
}
|
||||
|
@ -5940,7 +5940,7 @@ impl From<pb::UtxopsbtRequest> for requests::UtxopsbtRequest {
|
|||
opening_anchor_channel: c.opening_anchor_channel, // Rule #1 for type boolean?
|
||||
reserve: c.reserve, // Rule #1 for type u32?
|
||||
reservedok: c.reservedok, // Rule #1 for type boolean?
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type msat_or_all
|
||||
satoshi: c.satoshi.unwrap().into(), // Rule #1 for type sat_or_all
|
||||
startweight: c.startweight, // Rule #1 for type u32
|
||||
utxos: c.utxos.into_iter().map(|s| s.into()).collect(), // Rule #4
|
||||
}
|
||||
|
@ -6104,7 +6104,7 @@ impl From<pb::FundchannelCompleteRequest> for requests::Fundchannel_completeRequ
|
|||
impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
|
||||
fn from(c: pb::FundchannelRequest) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat_or_all
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type sat_or_all
|
||||
announce: c.announce, // Rule #1 for type boolean?
|
||||
channel_type: Some(c.channel_type.into_iter().map(|s| s).collect()), // Rule #4
|
||||
close_to: c.close_to, // Rule #1 for type string?
|
||||
|
@ -6115,7 +6115,7 @@ impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
|
|||
mindepth: c.mindepth, // Rule #1 for type u32?
|
||||
push_msat: c.push_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
request_amt: c.request_amt.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type sat?
|
||||
utxos: Some(c.utxos.into_iter().map(|s| s.into()).collect()), // Rule #4
|
||||
}
|
||||
}
|
||||
|
@ -6125,7 +6125,7 @@ impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
|
|||
impl From<pb::FundchannelStartRequest> for requests::Fundchannel_startRequest {
|
||||
fn from(c: pb::FundchannelStartRequest) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type sat
|
||||
announce: c.announce, // Rule #1 for type boolean?
|
||||
channel_type: Some(c.channel_type.into_iter().map(|s| s).collect()), // Rule #4
|
||||
close_to: c.close_to, // Rule #1 for type string?
|
||||
|
@ -6133,7 +6133,7 @@ impl From<pb::FundchannelStartRequest> for requests::Fundchannel_startRequest {
|
|||
id: PublicKey::from_slice(&c.id).unwrap(), // Rule #1 for type pubkey
|
||||
mindepth: c.mindepth, // Rule #1 for type u32?
|
||||
push_msat: c.push_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type sat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6235,7 +6235,7 @@ impl From<pb::ListhtlcsRequest> for requests::ListhtlcsRequest {
|
|||
impl From<pb::MultifundchannelDestinations> for requests::MultifundchannelDestinations {
|
||||
fn from(c: pb::MultifundchannelDestinations) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat_or_all
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type sat_or_all
|
||||
announce: c.announce, // Rule #1 for type boolean?
|
||||
close_to: c.close_to, // Rule #1 for type string?
|
||||
compact_lease: c.compact_lease, // Rule #1 for type string?
|
||||
|
@ -6243,7 +6243,7 @@ impl From<pb::MultifundchannelDestinations> for requests::MultifundchannelDestin
|
|||
mindepth: c.mindepth, // Rule #1 for type u32?
|
||||
push_msat: c.push_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
request_amt: c.request_amt.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type sat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6306,7 +6306,7 @@ impl From<pb::OpenchannelAbortRequest> for requests::Openchannel_abortRequest {
|
|||
impl From<pb::OpenchannelBumpRequest> for requests::Openchannel_bumpRequest {
|
||||
fn from(c: pb::OpenchannelBumpRequest) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type sat
|
||||
channel_id: Sha256::from_slice(&c.channel_id).unwrap(), // Rule #1 for type hash
|
||||
funding_feerate: c.funding_feerate.map(|a| a.into()), // Rule #1 for type feerate?
|
||||
initialpsbt: c.initialpsbt, // Rule #1 for type string
|
||||
|
@ -6318,7 +6318,7 @@ impl From<pb::OpenchannelBumpRequest> for requests::Openchannel_bumpRequest {
|
|||
impl From<pb::OpenchannelInitRequest> for requests::Openchannel_initRequest {
|
||||
fn from(c: pb::OpenchannelInitRequest) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type sat
|
||||
announce: c.announce, // Rule #1 for type boolean?
|
||||
channel_type: Some(c.channel_type.into_iter().map(|s| s).collect()), // Rule #4
|
||||
close_to: c.close_to, // Rule #1 for type string?
|
||||
|
|
|
@ -100,6 +100,8 @@ class GrpcConverterGenerator(IGenerator):
|
|||
"u16?": f"c.{name}.map(|v| v.into())",
|
||||
"msat": f"Some(c.{name}.into())",
|
||||
"msat?": f"c.{name}.map(|f| f.into())",
|
||||
"sat": f"Some(c.{name}.into())",
|
||||
"sat?": f"c.{name}.map(|f| f.into())",
|
||||
"pubkey": f"c.{name}.serialize().to_vec()",
|
||||
"pubkey?": f"c.{name}.map(|v| v.serialize().to_vec())",
|
||||
"hex": f"hex::decode(&c.{name}).unwrap()",
|
||||
|
@ -115,6 +117,8 @@ class GrpcConverterGenerator(IGenerator):
|
|||
"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())",
|
||||
"sat_or_all": f"Some(c.{name}.into())",
|
||||
"sat_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())",
|
||||
|
|
|
@ -110,6 +110,10 @@ class GrpcUnconverterGenerator(GrpcConverterGenerator):
|
|||
"msat_or_all?": f"c.{name}.map(|a| a.into())",
|
||||
"msat_or_any": f"c.{name}.unwrap().into()",
|
||||
"msat_or_any?": f"c.{name}.map(|a| a.into())",
|
||||
"sat": f"c.{name}.unwrap().into()",
|
||||
"sat?": f"c.{name}.map(|a| a.into())",
|
||||
"sat_or_all": f"c.{name}.unwrap().into()",
|
||||
"sat_or_all?": f"c.{name}.map(|a| a.into())",
|
||||
"feerate": f"c.{name}.unwrap().into()",
|
||||
"feerate?": f"c.{name}.map(|a| a.into())",
|
||||
"outpoint?": f"c.{name}.map(|a| a.into())",
|
||||
|
|
|
@ -9,6 +9,8 @@ typemap = {
|
|||
"msat": "Amount",
|
||||
"msat_or_all": "AmountOrAll",
|
||||
"msat_or_any": "AmountOrAny",
|
||||
"sat": "Amount",
|
||||
"sat_or_all": "AmountOrAll",
|
||||
"currency": "string",
|
||||
"number": "double",
|
||||
"pubkey": "bytes",
|
||||
|
|
|
@ -54,6 +54,7 @@ class Grpc2PyGenerator(IGenerator):
|
|||
"boolean": "m.{name}",
|
||||
"short_channel_id": "m.{name}",
|
||||
"msat": "amount2msat(m.{name})",
|
||||
"sat": "amount2sat(m.{name})",
|
||||
"currency": "m.{name}",
|
||||
"number": "m.{name}",
|
||||
}
|
||||
|
@ -87,6 +88,10 @@ class Grpc2PyGenerator(IGenerator):
|
|||
return a.msat
|
||||
|
||||
|
||||
def amount2sat(a):
|
||||
return a.msat / 1000
|
||||
|
||||
|
||||
def remove_default(d):
|
||||
# grpc is really not good at empty values, they get replaced with the type's default value...
|
||||
return {k: v for k, v in d.items() if v is not None and v != ""}
|
||||
|
|
|
@ -27,6 +27,8 @@ typemap = {
|
|||
"msat": "Amount",
|
||||
"msat_or_all": "AmountOrAll",
|
||||
"msat_or_any": "AmountOrAny",
|
||||
"sat": "Amount",
|
||||
"sat_or_all": "AmountOrAll",
|
||||
"currency": "String",
|
||||
"number": "f64",
|
||||
"pubkey": "PublicKey",
|
||||
|
|
|
@ -415,6 +415,8 @@ class PrimitiveField(Field):
|
|||
"msat",
|
||||
"msat_or_any",
|
||||
"msat_or_all",
|
||||
"sat",
|
||||
"sat_or_all",
|
||||
"currency",
|
||||
"hex",
|
||||
"short_channel_id",
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The satoshi value of the output. It can be a whole number, a whole number ending in *sat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
@ -10047,7 +10047,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at least `min-emergency- msat` as change). The string *all* can be used to specify all available funds (or 16777215 satoshi if more is available and large channels were not negotiated with the peer). Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*. The value cannot be less than the dust limit, currently set to 546, nor more than 16777215 satoshi (unless large channels were negotiated with the peer)."
|
||||
]
|
||||
|
@ -10113,7 +10113,7 @@
|
|||
"type": "u32"
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
],
|
||||
|
@ -10544,7 +10544,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that the channel will be funded at. This value MUST be accurate, otherwise the negotiated commitment transactions will not encompass the correct channel value."
|
||||
]
|
||||
|
@ -10580,7 +10580,7 @@
|
|||
]
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The amount we want the peer to maintain on its side."
|
||||
]
|
||||
|
@ -11132,7 +11132,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The minimum satoshi value of the output(s) needed (or the string `all` meaning use all unreserved inputs). If a value, it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
@ -22271,7 +22271,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"Amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). The string *all* can be used to specify all available funds (or 16,777,215 satoshi if more is available and large channels were not negotiated with the peer). Otherwise it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*. The value cannot be less than the dust limit, currently 546 satoshi as of this writing, nor more than 16,777,215 satoshi (unless large channels were negotiated with the peer)."
|
||||
]
|
||||
|
@ -22314,7 +22314,7 @@
|
|||
]
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
],
|
||||
|
@ -23376,7 +23376,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that we will contribute to the channel. This value will be _added_ to the provided PSBT in the output which is encumbered by the 2-of-2 script for this channel."
|
||||
]
|
||||
|
@ -23546,7 +23546,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that we will contribute to the channel. This value will be _added_ to the provided PSBT in the output which is encumbered by the 2-of-2 script for this channel."
|
||||
]
|
||||
|
@ -29426,7 +29426,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The minimum satoshi value of the output(s) needed (or the string `all` meaning use all unreserved inputs). If a value, it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
@ -30953,7 +30953,7 @@
|
|||
]
|
||||
},
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The amount to be withdrawn from the internal wallet (expressed, as name suggests, in satoshi). The string *all* can be used to specify withdrawal of all available funds (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
|
|
@ -392,6 +392,12 @@ def _extra_validator(is_request: bool):
|
|||
return True
|
||||
return is_msat_request(checker, instance)
|
||||
|
||||
def is_sat_or_all(checker, instance):
|
||||
"""sat field, or 'all'"""
|
||||
if instance == "all":
|
||||
return True
|
||||
return is_sat(checker, instance)
|
||||
|
||||
def is_currency(checker, instance):
|
||||
"""currency including currency code"""
|
||||
pattern = re.compile(r'^\d+(\.\d+)?[A-Z][A-Z][A-Z]$')
|
||||
|
@ -414,6 +420,7 @@ def _extra_validator(is_request: bool):
|
|||
"u8": is_u8,
|
||||
"pubkey": is_pubkey,
|
||||
"sat": is_sat,
|
||||
"sat_or_all": is_sat_or_all,
|
||||
"msat": is_msat,
|
||||
"msat_or_all": is_msat_or_all,
|
||||
"msat_or_any": is_msat_or_any,
|
||||
|
|
|
@ -13,6 +13,10 @@ def amount2msat(a):
|
|||
return a.msat
|
||||
|
||||
|
||||
def amount2sat(a):
|
||||
return a.msat / 1000
|
||||
|
||||
|
||||
def remove_default(d):
|
||||
# grpc is really not good at empty values, they get replaced with the type's default value...
|
||||
return {k: v for k, v in d.items() if v is not None and v != ""}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"u8",
|
||||
"pubkey",
|
||||
"sat",
|
||||
"sat_or_all",
|
||||
"msat",
|
||||
"msat_or_all",
|
||||
"msat_or_any",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The satoshi value of the output. It can be a whole number, a whole number ending in *sat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at least `min-emergency- msat` as change). The string *all* can be used to specify all available funds (or 16777215 satoshi if more is available and large channels were not negotiated with the peer). Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*. The value cannot be less than the dust limit, currently set to 546, nor more than 16777215 satoshi (unless large channels were negotiated with the peer)."
|
||||
]
|
||||
|
@ -92,7 +92,7 @@
|
|||
"type": "u32"
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
],
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that the channel will be funded at. This value MUST be accurate, otherwise the negotiated commitment transactions will not encompass the correct channel value."
|
||||
]
|
||||
|
@ -58,7 +58,7 @@
|
|||
]
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"The amount we want the peer to maintain on its side."
|
||||
]
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The minimum satoshi value of the output(s) needed (or the string `all` meaning use all unreserved inputs). If a value, it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"Amount in satoshis taken from the internal wallet to fund the channel (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). The string *all* can be used to specify all available funds (or 16,777,215 satoshi if more is available and large channels were not negotiated with the peer). Otherwise it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*. The value cannot be less than the dust limit, currently 546 satoshi as of this writing, nor more than 16,777,215 satoshi (unless large channels were negotiated with the peer)."
|
||||
]
|
||||
|
@ -79,7 +79,7 @@
|
|||
]
|
||||
},
|
||||
"reserve": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Amount we want the peer to maintain on its side of the channel. It can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
],
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that we will contribute to the channel. This value will be _added_ to the provided PSBT in the output which is encumbered by the 2-of-2 script for this channel."
|
||||
]
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "msat",
|
||||
"type": "sat",
|
||||
"description": [
|
||||
"Satoshi value that we will contribute to the channel. This value will be _added_ to the provided PSBT in the output which is encumbered by the 2-of-2 script for this channel."
|
||||
]
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The minimum satoshi value of the output(s) needed (or the string `all` meaning use all unreserved inputs). If a value, it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
]
|
||||
},
|
||||
"satoshi": {
|
||||
"type": "msat_or_all",
|
||||
"type": "sat_or_all",
|
||||
"description": [
|
||||
"The amount to be withdrawn from the internal wallet (expressed, as name suggests, in satoshi). The string *all* can be used to specify withdrawal of all available funds (but if we have any anchor channels, this will always leave at least `min-emergency-msat` as change). Otherwise, it is in satoshi precision; it can be a whole number, a whole number ending in *sat*, a whole number ending in *000msat*, or a number with 1 to 8 decimal places ending in *btc*."
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue