Skip to content

Commit 1a74aaa

Browse files
committed
msggen: add source argument for currencyrate
Changelog-None
1 parent 2dab5a3 commit 1a74aaa

File tree

6 files changed

+212
-142
lines changed

6 files changed

+212
-142
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,8 @@
14251425
"CurrencyConvert.msat": 1
14261426
},
14271427
"CurrencyrateRequest": {
1428-
"CurrencyRate.currency": 1
1428+
"CurrencyRate.currency": 1,
1429+
"CurrencyRate.source": 2
14291430
},
14301431
"CurrencyrateResponse": {
14311432
"CurrencyRate.rate": 1
@@ -6339,6 +6340,10 @@
63396340
"added": "v26.04",
63406341
"deprecated": null
63416342
},
6343+
"CurrencyRate.source": {
6344+
"added": "v26.06",
6345+
"deprecated": null
6346+
},
63426347
"Datastore": {
63436348
"added": "pre-v0.10.1",
63446349
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-rpc/src/model.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/msggen/msggen/schema.json

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7458,11 +7458,24 @@
74587458
"$schema": "../rpc-schema-draft.json",
74597459
"type": "object",
74607460
"rpc": "currencyrate",
7461-
"title": "Command to determine a reasonable rate of conversion for a given currency",
7461+
"title": "Command to determine a reasonable BTC exchange rate for a given currency",
74627462
"added": "v26.04",
74637463
"description": [
7464-
"The **currencyrate** RPC command provides the conversion of one BTC into the given currency",
7465-
"It uses the median of the available exchange-rate sources for the requested currency."
7464+
"The **currencyrate** RPC command returns the exchange rate of one BTC in the given currency.",
7465+
"Rates are rounded to 3 decimal places as specified by ISO 4217.",
7466+
"",
7467+
"Without the optional *source* argument the command returns the median rate across all",
7468+
"configured exchange-rate sources.",
7469+
"",
7470+
"With *source* specified, the rate reported by that specific source is returned.",
7471+
"The list of active source names can be obtained via **listcurrencyrates**.",
7472+
"",
7473+
"To add or disable sources see the *currencyrate-add-source* and *currencyrate-disable-source*",
7474+
"options in **lightningd-config(5)**.",
7475+
"",
7476+
"EXAMPLE USAGE:",
7477+
"Get the median USD rate: `lightning-cli currencyrate USD`",
7478+
"Get the Binance USD rate: `lightning-cli currencyrate USD binance`"
74667479
],
74677480
"request": {
74687481
"required": [
@@ -7473,8 +7486,18 @@
74737486
"currency": {
74747487
"type": "string",
74757488
"description": [
7476-
"The ISO-4217 currency code (e.g. USD) to convert to.",
7477-
"The plugin normalizes this value to uppercase before querying sources."
7489+
"The ISO 4217 currency code (e.g. USD) to convert to.",
7490+
"The plugin normalises this value to uppercase before querying sources."
7491+
]
7492+
},
7493+
"source": {
7494+
"added": "v26.06",
7495+
"type": "string",
7496+
"description": [
7497+
"The name of a specific exchange-rate source to query.",
7498+
"If omitted, the median across all available sources is returned.",
7499+
"An error is returned if the source name is not recognised or has no",
7500+
"cached data for the requested currency."
74787501
]
74797502
}
74807503
}
@@ -7488,7 +7511,9 @@
74887511
"rate": {
74897512
"type": "number",
74907513
"description": [
7491-
"The median value of one BTC, computed using the median result from the available sources."
7514+
"The number of currency units per 1 BTC, rounded to 3 decimal places (ISO 4217).",
7515+
"When *source* is omitted this is the median across all available sources.",
7516+
"When *source* is specified this is the rate reported by that source."
74927517
]
74937518
}
74947519
}
@@ -7497,10 +7522,45 @@
74977522
"daywalker90 is mainly responsible."
74987523
],
74997524
"see_also": [
7500-
"lightning-listcurrencyrates(7)"
7525+
"lightning-listcurrencyrates(7)",
7526+
"lightning-currencyconvert(7)",
7527+
"lightningd-config(5)"
75017528
],
75027529
"resources": [
75037530
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
7531+
],
7532+
"examples": [
7533+
{
7534+
"description": [
7535+
"Get the median BTC/USD rate across all configured sources:"
7536+
],
7537+
"request": {
7538+
"id": "example:currencyrate#1",
7539+
"method": "currencyrate",
7540+
"params": {
7541+
"currency": "USD"
7542+
}
7543+
},
7544+
"response": {
7545+
"rate": 67889.825
7546+
}
7547+
},
7548+
{
7549+
"description": [
7550+
"Get the BTC/USD rate from the Binance source only:"
7551+
],
7552+
"request": {
7553+
"id": "example:currencyrate#2",
7554+
"method": "currencyrate",
7555+
"params": {
7556+
"currency": "USD",
7557+
"source": "binance"
7558+
}
7559+
},
7560+
"response": {
7561+
"rate": 67931.9
7562+
}
7563+
}
75047564
]
75057565
},
75067566
"datastore.json": {

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 134 additions & 134 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)