mirror of
https://github.com/ElementsProject/lightning.git
synced 2026-08-13 12:32:55 +02:00
schemas: added source field to currencyrate
Changelog-Added: `currencyrate` can now take a `source` argument to get the rate of a specific source
This commit is contained in:
parent
6175642e72
commit
4f8b0416d7
7 changed files with 283 additions and 153 deletions
|
|
@ -1440,7 +1440,8 @@
|
|||
"CurrencyConvert.msat": 1
|
||||
},
|
||||
"CurrencyrateRequest": {
|
||||
"CurrencyRate.currency": 1
|
||||
"CurrencyRate.currency": 1,
|
||||
"CurrencyRate.source": 2
|
||||
},
|
||||
"CurrencyrateResponse": {
|
||||
"CurrencyRate.rate": 1
|
||||
|
|
@ -6464,6 +6465,10 @@
|
|||
"added": "v26.04",
|
||||
"deprecated": null
|
||||
},
|
||||
"CurrencyRate.source": {
|
||||
"added": "v26.06",
|
||||
"deprecated": null
|
||||
},
|
||||
"Datastore": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
|
|
|
|||
1
cln-grpc/proto/node.proto
generated
1
cln-grpc/proto/node.proto
generated
|
|
@ -4439,6 +4439,7 @@ message CurrencyconvertResponse {
|
|||
|
||||
message CurrencyrateRequest {
|
||||
string currency = 1;
|
||||
optional string source = 2;
|
||||
}
|
||||
|
||||
message CurrencyrateResponse {
|
||||
|
|
|
|||
2
cln-grpc/src/convert.rs
generated
2
cln-grpc/src/convert.rs
generated
|
|
@ -6954,6 +6954,7 @@ impl From<requests::CurrencyrateRequest> for pb::CurrencyrateRequest {
|
|||
fn from(c: requests::CurrencyrateRequest) -> Self {
|
||||
Self {
|
||||
currency: c.currency, // Rule #2 for type string
|
||||
source: c.source, // Rule #2 for type string?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8974,6 +8975,7 @@ impl From<pb::CurrencyrateRequest> for requests::CurrencyrateRequest {
|
|||
fn from(c: pb::CurrencyrateRequest) -> Self {
|
||||
Self {
|
||||
currency: c.currency, // Rule #1 for type string
|
||||
source: c.source, // Rule #1 for type string?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
cln-rpc/src/model.rs
generated
2
cln-rpc/src/model.rs
generated
|
|
@ -5279,6 +5279,8 @@ pub mod requests {
|
|||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CurrencyrateRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub source: Option<String>,
|
||||
pub currency: String,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7669,11 +7669,24 @@
|
|||
"$schema": "../rpc-schema-draft.json",
|
||||
"type": "object",
|
||||
"rpc": "currencyrate",
|
||||
"title": "Command to determine a reasonable rate of conversion for a given currency",
|
||||
"title": "Command to determine a reasonable BTC exchange rate for a given currency",
|
||||
"added": "v26.04",
|
||||
"description": [
|
||||
"The **currencyrate** RPC command provides the conversion of one BTC into the given currency",
|
||||
"It uses the median of the available exchange-rate sources for the requested currency."
|
||||
"The **currencyrate** RPC command returns the exchange rate of one BTC in the given currency.",
|
||||
"Rates are rounded to 3 decimal places as specified by ISO 4217.",
|
||||
"",
|
||||
"Without the optional *source* argument the command returns the median rate across all",
|
||||
"configured exchange-rate sources.",
|
||||
"",
|
||||
"With *source* specified, the rate reported by that specific source is returned.",
|
||||
"The list of active source names can be obtained via **listcurrencyrates**.",
|
||||
"",
|
||||
"To add or disable sources see the *currencyrate-add-source* and *currencyrate-disable-source*",
|
||||
"options in **lightningd-config(5)**.",
|
||||
"",
|
||||
"EXAMPLE USAGE:",
|
||||
"Get the median USD rate: `lightning-cli currencyrate USD`",
|
||||
"Get the Binance USD rate: `lightning-cli currencyrate USD binance`"
|
||||
],
|
||||
"request": {
|
||||
"required": [
|
||||
|
|
@ -7684,8 +7697,18 @@
|
|||
"currency": {
|
||||
"type": "string",
|
||||
"description": [
|
||||
"The ISO-4217 currency code (e.g. USD) to convert to.",
|
||||
"The plugin normalizes this value to uppercase before querying sources."
|
||||
"The ISO 4217 currency code (e.g. USD) to convert to.",
|
||||
"The plugin normalises this value to uppercase before querying sources."
|
||||
]
|
||||
},
|
||||
"source": {
|
||||
"added": "v26.06",
|
||||
"type": "string",
|
||||
"description": [
|
||||
"The name of a specific exchange-rate source to query.",
|
||||
"If omitted, the median across all available sources is returned.",
|
||||
"An error is returned if the source name is not recognised or has no",
|
||||
"cached data for the requested currency."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -7699,7 +7722,9 @@
|
|||
"rate": {
|
||||
"type": "number",
|
||||
"description": [
|
||||
"The median value of one BTC, computed using the median result from the available sources."
|
||||
"The number of currency units per 1 BTC, rounded to 3 decimal places (ISO 4217).",
|
||||
"When *source* is omitted this is the median across all available sources.",
|
||||
"When *source* is specified this is the rate reported by that source."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -7708,10 +7733,45 @@
|
|||
"daywalker90 is mainly responsible."
|
||||
],
|
||||
"see_also": [
|
||||
"lightning-listcurrencyrates(7)"
|
||||
"lightning-listcurrencyrates(7)",
|
||||
"lightning-currencyconvert(7)",
|
||||
"lightningd-config(5)"
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"description": [
|
||||
"Get the median BTC/USD rate across all configured sources:"
|
||||
],
|
||||
"request": {
|
||||
"id": "example:currencyrate#1",
|
||||
"method": "currencyrate",
|
||||
"params": {
|
||||
"currency": "USD"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"rate": 67889.825
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": [
|
||||
"Get the BTC/USD rate from the Binance source only:"
|
||||
],
|
||||
"request": {
|
||||
"id": "example:currencyrate#2",
|
||||
"method": "currencyrate",
|
||||
"params": {
|
||||
"currency": "USD",
|
||||
"source": "binance"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"rate": 67931.9
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"datastore.json": {
|
||||
|
|
|
|||
276
contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py
generated
276
contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py
generated
File diff suppressed because one or more lines are too long
|
|
@ -2,11 +2,24 @@
|
|||
"$schema": "../rpc-schema-draft.json",
|
||||
"type": "object",
|
||||
"rpc": "currencyrate",
|
||||
"title": "Command to determine a reasonable rate of conversion for a given currency",
|
||||
"title": "Command to determine a reasonable BTC exchange rate for a given currency",
|
||||
"added": "v26.04",
|
||||
"description": [
|
||||
"The **currencyrate** RPC command provides the conversion of one BTC into the given currency",
|
||||
"It uses the median of the available exchange-rate sources for the requested currency."
|
||||
"The **currencyrate** RPC command returns the exchange rate of one BTC in the given currency.",
|
||||
"Rates are rounded to 3 decimal places as specified by ISO 4217.",
|
||||
"",
|
||||
"Without the optional *source* argument the command returns the median rate across all",
|
||||
"configured exchange-rate sources.",
|
||||
"",
|
||||
"With *source* specified, the rate reported by that specific source is returned.",
|
||||
"The list of active source names can be obtained via **listcurrencyrates**.",
|
||||
"",
|
||||
"To add or disable sources see the *currencyrate-add-source* and *currencyrate-disable-source*",
|
||||
"options in **lightningd-config(5)**.",
|
||||
"",
|
||||
"EXAMPLE USAGE:",
|
||||
"Get the median USD rate: `lightning-cli currencyrate USD`",
|
||||
"Get the Binance USD rate: `lightning-cli currencyrate USD binance`"
|
||||
],
|
||||
"request": {
|
||||
"required": [
|
||||
|
|
@ -17,8 +30,18 @@
|
|||
"currency": {
|
||||
"type": "string",
|
||||
"description": [
|
||||
"The ISO-4217 currency code (e.g. USD) to convert to.",
|
||||
"The plugin normalizes this value to uppercase before querying sources."
|
||||
"The ISO 4217 currency code (e.g. USD) to convert to.",
|
||||
"The plugin normalises this value to uppercase before querying sources."
|
||||
]
|
||||
},
|
||||
"source": {
|
||||
"added": "v26.06",
|
||||
"type": "string",
|
||||
"description": [
|
||||
"The name of a specific exchange-rate source to query.",
|
||||
"If omitted, the median across all available sources is returned.",
|
||||
"An error is returned if the source name is not recognised or has no",
|
||||
"cached data for the requested currency."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +55,9 @@
|
|||
"rate": {
|
||||
"type": "number",
|
||||
"description": [
|
||||
"The median value of one BTC, computed using the median result from the available sources."
|
||||
"The number of currency units per 1 BTC, rounded to 3 decimal places (ISO 4217).",
|
||||
"When *source* is omitted this is the median across all available sources.",
|
||||
"When *source* is specified this is the rate reported by that source."
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -41,9 +66,44 @@
|
|||
"daywalker90 is mainly responsible."
|
||||
],
|
||||
"see_also": [
|
||||
"lightning-listcurrencyrates(7)"
|
||||
"lightning-listcurrencyrates(7)",
|
||||
"lightning-currencyconvert(7)",
|
||||
"lightningd-config(5)"
|
||||
],
|
||||
"resources": [
|
||||
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
|
||||
],
|
||||
"examples": [
|
||||
{
|
||||
"description": [
|
||||
"Get the median BTC/USD rate across all configured sources:"
|
||||
],
|
||||
"request": {
|
||||
"id": "example:currencyrate#1",
|
||||
"method": "currencyrate",
|
||||
"params": {
|
||||
"currency": "USD"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"rate": 67889.825
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": [
|
||||
"Get the BTC/USD rate from the Binance source only:"
|
||||
],
|
||||
"request": {
|
||||
"id": "example:currencyrate#2",
|
||||
"method": "currencyrate",
|
||||
"params": {
|
||||
"currency": "USD",
|
||||
"source": "binance"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"rate": 67931.9
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue