Skip to content

Commit 3ef67e3

Browse files
committed
msggen: add source argument for currencyrate
Changelog-None
1 parent 5d6023d commit 3ef67e3

File tree

6 files changed

+116
-46
lines changed

6 files changed

+116
-46
lines changed

.msggen.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,8 @@
13231323
"CurrencyConvert.msat": 1
13241324
},
13251325
"CurrencyrateRequest": {
1326-
"CurrencyRate.currency": 1
1326+
"CurrencyRate.currency": 1,
1327+
"CurrencyRate.source": 2
13271328
},
13281329
"CurrencyrateResponse": {
13291330
"CurrencyRate.rate": 1
@@ -6085,6 +6086,10 @@
60856086
"added": "v26.04",
60866087
"deprecated": null
60876088
},
6089+
"CurrencyRate.source": {
6090+
"added": "v26.06",
6091+
"deprecated": null
6092+
},
60886093
"Datastore": {
60896094
"added": "pre-v0.10.1",
60906095
"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
@@ -7433,11 +7433,24 @@
74337433
"$schema": "../rpc-schema-draft.json",
74347434
"type": "object",
74357435
"rpc": "currencyrate",
7436-
"title": "Command to determine a reasonable rate of conversion for a given currency",
7436+
"title": "Command to determine a reasonable BTC exchange rate for a given currency",
74377437
"added": "v26.04",
74387438
"description": [
7439-
"The **currencyrate** RPC command provides the conversion of one BTC into the given currency",
7440-
"It uses the median of the available exchange-rate sources for the requested currency."
7439+
"The **currencyrate** RPC command returns the exchange rate of one BTC in the given currency.",
7440+
"Rates are rounded to 3 decimal places as specified by ISO 4217.",
7441+
"",
7442+
"Without the optional *source* argument the command returns the median rate across all",
7443+
"configured exchange-rate sources.",
7444+
"",
7445+
"With *source* specified, the rate reported by that specific source is returned.",
7446+
"The list of active source names can be obtained via **listcurrencyrates**.",
7447+
"",
7448+
"To add or disable sources see the *currencyrate-add-source* and *currencyrate-disable-source*",
7449+
"options in **lightningd-config(5)**.",
7450+
"",
7451+
"EXAMPLE USAGE:",
7452+
"Get the median USD rate: `lightning-cli currencyrate USD`",
7453+
"Get the Binance USD rate: `lightning-cli currencyrate USD binance`"
74417454
],
74427455
"request": {
74437456
"required": [
@@ -7448,8 +7461,18 @@
74487461
"currency": {
74497462
"type": "string",
74507463
"description": [
7451-
"The ISO-4217 currency code (e.g. USD) to convert to.",
7452-
"The plugin normalizes this value to uppercase before querying sources."
7464+
"The ISO 4217 currency code (e.g. USD) to convert to.",
7465+
"The plugin normalises this value to uppercase before querying sources."
7466+
]
7467+
},
7468+
"source": {
7469+
"added": "v26.06",
7470+
"type": "string",
7471+
"description": [
7472+
"The name of a specific exchange-rate source to query.",
7473+
"If omitted, the median across all available sources is returned.",
7474+
"An error is returned if the source name is not recognised or has no",
7475+
"cached data for the requested currency."
74537476
]
74547477
}
74557478
}
@@ -7463,7 +7486,9 @@
74637486
"rate": {
74647487
"type": "number",
74657488
"description": [
7466-
"The median value of one BTC, computed using the median result from the available sources."
7489+
"The number of currency units per 1 BTC, rounded to 3 decimal places (ISO 4217).",
7490+
"When *source* is omitted this is the median across all available sources.",
7491+
"When *source* is specified this is the rate reported by that source."
74677492
]
74687493
}
74697494
}
@@ -7472,10 +7497,45 @@
74727497
"daywalker90 is mainly responsible."
74737498
],
74747499
"see_also": [
7475-
"lightning-listcurrencyrates(7)"
7500+
"lightning-listcurrencyrates(7)",
7501+
"lightning-currencyconvert(7)",
7502+
"lightningd-config(5)"
74767503
],
74777504
"resources": [
74787505
"Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
7506+
],
7507+
"examples": [
7508+
{
7509+
"description": [
7510+
"Get the median BTC/USD rate across all configured sources:"
7511+
],
7512+
"request": {
7513+
"id": "example:currencyrate#1",
7514+
"method": "currencyrate",
7515+
"params": {
7516+
"currency": "USD"
7517+
}
7518+
},
7519+
"response": {
7520+
"rate": 67889.825
7521+
}
7522+
},
7523+
{
7524+
"description": [
7525+
"Get the BTC/USD rate from the Binance source only:"
7526+
],
7527+
"request": {
7528+
"id": "example:currencyrate#2",
7529+
"method": "currencyrate",
7530+
"params": {
7531+
"currency": "USD",
7532+
"source": "binance"
7533+
}
7534+
},
7535+
"response": {
7536+
"rate": 67931.9
7537+
}
7538+
}
74797539
]
74807540
},
74817541
"datastore.json": {

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

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

0 commit comments

Comments
 (0)