From 5829f30a740d5b9c507e189a7ac2b70f19fc957a Mon Sep 17 00:00:00 2001 From: enaples Date: Tue, 14 Jul 2026 15:06:53 +0200 Subject: [PATCH 1/7] tests: added 'bkpr-report' RPC example --- doc/schemas/bkpr-report.json | 18 +++++++++++++++--- doc/schemas/listhtlcs.json | 2 +- tests/autogenerate-rpc-examples.py | 8 +++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/doc/schemas/bkpr-report.json b/doc/schemas/bkpr-report.json index 3232247f5595..dad8df8726b7 100644 --- a/doc/schemas/bkpr-report.json +++ b/doc/schemas/bkpr-report.json @@ -129,9 +129,21 @@ "response": { "report": [ "Date,Tag,Account,Description,Credit,Debit,BTC/USD,Credit (USD),Debit(USD)", - "2026-04-02 12:42:03,deposit,wallet,Onchain output 37562cf0b3a5d6783ae02925bcc486bb89afe156abf15e692736e5da9a060018:1,+0.02000000000,0,67140.89,$1342.81,$0.00", - "2026-04-02 12:42:04,invoice,9b3114c8003dc8dedbcf3b7bc9fb04e1575a1112aea33be8369ae9670aff64f4,Invoice description test_bkpr_report_invoice,0,-0.00000123456,67140.89,$0.00,$0.08", - "2026-04-02 12:42:04,onchain_fee,9b3114c8003dc8dedbcf3b7bc9fb04e1575a1112aea33be8369ae9670aff64f4,Onchain transaction f464ff0a67e99a36e83ba3ae12115a57e104fbc97b3bcfdbdec83d00c814319b,0,-0.00004927000,67140.89,$0.00,$3.30" + "2025-01-27 18:46:41,deposit,wallet,Invoice description edited utxo description,+2.00000000000,0,,$,$", + "2025-01-27 18:46:43,deposit,wallet,Onchain output 130def5c51ac7024c2d21c9b45c91e63fd0f9b1081c9f30de18a5eb3f7ffc86d:0,+0.02000000000,0,,$,$", + "2025-01-27 18:46:47,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description edited invoice description from description send some sats l2 to l3,+0.00500000000,0,,$,$", + "2025-01-27 18:46:48,invoice,f8f6216a51c6d73e2a759d1de6f675c3780f42957e27bd2f7d8bd0fb373b9006,Invoice description description send some sats l3 to l4,0,-0.00500000000,,$,$", + "2025-01-27 18:46:49,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description Invoice description l31,+0.00000010000,0,,$,$", + "2025-01-27 18:46:50,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description keysend,+0.00000010000,0,,$,$", + "2025-01-27 18:46:51,routed,f8f6216a51c6d73e2a759d1de6f675c3780f42957e27bd2f7d8bd0fb373b9006,,+0.00000000101,0,,$,$", + "2025-01-27 18:46:53,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description keysend,+0.00000010000,0,,$,$", + "2025-01-27 18:46:54,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description l32 description,+0.00000050000,0,,$,$", + "2025-01-27 18:46:55,invoice,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Invoice description l33 description,+0.00000100000,0,,$,$", + "2025-01-27 18:46:56,routed,f8f6216a51c6d73e2a759d1de6f675c3780f42957e27bd2f7d8bd0fb373b9006,,+0.00000000001,0,,$,$", + "2025-01-27 18:47:04,deposit,wallet,Onchain output c8035875a93de7342073e9ff85a3ae70fe346f634cda125d4fbce1714cc64b4d:1,+0.02000000000,0,,$,$", + "2025-01-27 18:47:07,onchain_fee,16e2e64cfffd6603c0697aa9df4f99c769e6697400d4c28acf7ad25a72fe5429,Onchain transaction 23c5b3b5733c26f6cfa450e27d9ac122a626b36626fa0ced8206f488cc8e310a,0,-0.00004927000,,$,$", + "2025-01-27 18:46:46,onchain_fee,f8f6216a51c6d73e2a759d1de6f675c3780f42957e27bd2f7d8bd0fb373b9006,Onchain transaction 7e4d853f75800aac4e510424ca030027b1e1192c0b6ba51d221452b39a8f57e2,0,-0.00004927000,,$,$", + "2025-01-27 18:47:01,onchain_fee,c51daaf63cd67a9092a021076a8b3def61b38dea85019b0a074ddada3e1a4e6c,Onchain transaction dc446777a9b3d6d5962f502f5d22f66b01452389c1bbe8460491e7376f44a1eb,0,-0.00000000102,,$,$" ], "format-hint": "simple" } diff --git a/doc/schemas/listhtlcs.json b/doc/schemas/listhtlcs.json index b3d317b5cfda..7e1c21efe276 100644 --- a/doc/schemas/listhtlcs.json +++ b/doc/schemas/listhtlcs.json @@ -399,7 +399,7 @@ }, { "created_index": 21, - "updated_index": 179, + "updated_index": 181, "short_channel_id": "116x1x1", "id": 19, "expiry": 180, diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index 4d8e171d5349..b10518a451fa 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'currencyconvert', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'currencyrate', 'spliceout', 'askrene-bias-node', 'bkpr-report', 'xkeysend', 'listcurrencyrates', 'delnetworkevent', 'cancelrecurringinvoice', 'listnetworkevents', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'currencyconvert', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'currencyrate', 'spliceout', 'askrene-bias-node', 'xkeysend', 'listcurrencyrates', 'delnetworkevent', 'cancelrecurringinvoice', 'listnetworkevents', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -866,6 +866,12 @@ def generate_bookkeeper_examples(l2, l3, c23_2_chan_id): update_example(node=l3, method='bkpr-listincome', params={'consolidate_fees': False}, response=bkprlistincome_res1) bkprlistincome_res2 = l3.rpc.bkpr_listincome() update_example(node=l3, method='bkpr-listincome', params={}, response=bkprlistincome_res2) + bkprreport_res = l3.rpc.bkpr_report(headers=["Date,Tag,Account,Description,Credit,Debit,BTC/USD,Credit (USD),Debit(USD)"], + format="{localtime},{tag},{account},{description?Invoice description {description}:{outpoint?Onchain output {outpoint}:{txid?Onchain transaction {txid}}}},{credit?+{credit}:0},{debit?-{debit}:0},{currencyrate},${currencycredit},${currencydebit}", + escape="csv") + update_example(node=l3, method='bkpr-report', params={'headers': ["Date,Tag,Account,Description,Credit,Debit,BTC/USD,Credit (USD),Debit(USD)"], + 'format': "{localtime},{tag},{account},{description?Invoice description {description}:{outpoint?Onchain output {outpoint}:{txid?Onchain transaction {txid}}}},{credit?+{credit}:0},{debit?-{debit}:0},{currencyrate},${currencycredit},${currencydebit}", + 'escape': 'csv'}, response=bkprreport_res) logger.info('Bookkeeper Done!') except Exception as e: logger.error(f'Error in generating bookkeeper examples: {e}') From f6253ba365d3e9d61d91296ec2e9d5a31736468e Mon Sep 17 00:00:00 2001 From: enaples Date: Thu, 16 Jul 2026 10:13:02 +0200 Subject: [PATCH 2/7] tests: added 'listnetworkevents' RPC example --- doc/schemas/listhtlcs.json | 2 +- doc/schemas/listnetworkevents.json | 117 +++++++++++++++++++++++++++++ tests/autogenerate-rpc-examples.py | 6 +- 3 files changed, 123 insertions(+), 2 deletions(-) diff --git a/doc/schemas/listhtlcs.json b/doc/schemas/listhtlcs.json index 7e1c21efe276..b3d317b5cfda 100644 --- a/doc/schemas/listhtlcs.json +++ b/doc/schemas/listhtlcs.json @@ -399,7 +399,7 @@ }, { "created_index": 21, - "updated_index": 181, + "updated_index": 179, "short_channel_id": "116x1x1", "id": 19, "expiry": 180, diff --git a/doc/schemas/listnetworkevents.json b/doc/schemas/listnetworkevents.json index abee95c68d5c..581134296138 100644 --- a/doc/schemas/listnetworkevents.json +++ b/doc/schemas/listnetworkevents.json @@ -149,5 +149,122 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:listnetworkevents#1", + "method": "listnetworkevents", + "params": {} + }, + "response": { + "networkevents": [ + { + "created_index": 1, + "peer_id": "038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b", + "type": "connect", + "timestamp": 1738000000 + }, + { + "created_index": 2, + "peer_id": "03cecbfdc68544cc596223b68ce0710c9e5d2c9cb317ee07822d95079acc703d31", + "type": "connect", + "timestamp": 1738000000, + "reason": "connect command \"pytest:connect#22\"", + "duration_nsec": 2331000 + }, + { + "created_index": 3, + "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", + "type": "connect", + "timestamp": 1738000000, + "reason": "connect command \"pytest:connect#24\"", + "duration_nsec": 1476000 + }, + { + "created_index": 4, + "peer_id": "038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b", + "type": "ping", + "timestamp": 1738000000, + "duration_nsec": 327000 + }, + { + "created_index": 5, + "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", + "type": "connect", + "timestamp": 1738000000, + "reason": "connect command \"pytest:connect#420\"", + "duration_nsec": 2546000 + }, + { + "created_index": 6, + "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", + "type": "disconnect", + "timestamp": 1738000000, + "duration_nsec": 8447000 + }, + { + "created_index": 7, + "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", + "type": "disconnect", + "timestamp": 1738000000, + "duration_nsec": 81968678000 + }, + { + "created_index": 8, + "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", + "type": "connect", + "timestamp": 1738000000, + "reason": "reconnect by timer", + "duration_nsec": 4035000 + }, + { + "created_index": 9, + "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", + "type": "connect", + "timestamp": 1738000000, + "reason": "connect command \"pytest:connect#462\"", + "duration_nsec": 918000 + }, + { + "created_index": 10, + "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", + "type": "disconnect", + "timestamp": 1738000000, + "duration_nsec": 6087454000 + }, + { + "created_index": 11, + "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", + "type": "disconnect", + "timestamp": 1738000000, + "duration_nsec": 58975900000 + } + ] + } + }, + { + "request": { + "id": "example:listnetworkevents#2", + "method": "listnetworkevents", + "params": { + "id": "03cecbfdc68544cc596223b68ce0710c9e5d2c9cb317ee07822d95079acc703d31", + "index": "created", + "limit": 3 + } + }, + "response": { + "networkevents": [ + { + "created_index": 2, + "peer_id": "03cecbfdc68544cc596223b68ce0710c9e5d2c9cb317ee07822d95079acc703d31", + "type": "connect", + "timestamp": 1738000000, + "reason": "connect command \"pytest:connect#22\"", + "duration_nsec": 2331000 + } + ] + } + } ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index b10518a451fa..aa4f513c21e5 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'currencyconvert', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'currencyrate', 'spliceout', 'askrene-bias-node', 'xkeysend', 'listcurrencyrates', 'delnetworkevent', 'cancelrecurringinvoice', 'listnetworkevents', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'currencyconvert', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'currencyrate', 'spliceout', 'askrene-bias-node', 'xkeysend', 'listcurrencyrates', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -1643,6 +1643,10 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o update_example(node=l2, method='listinvoicerequests', params={}, response=listinvoicerequests_res2) update_example(node=l2, method='listaddresses', params=[address_l22['p2tr']]) update_example(node=l2, method='listaddresses', params={'start': 6, 'limit': 2}) + listnetworkevents_res1 = l2.rpc.listnetworkevents() + update_example(node=l3, method='listnetworkevents', params={}, response=listnetworkevents_res1) + listnetworkevents_res2 = l2.rpc.listnetworkevents(id=l3.info['id'], index='created', limit=3) + update_example(node=l2, method='listnetworkevents', params={'id': l3.info['id'], 'index': 'created', 'limit': 3}, response=listnetworkevents_res2) logger.info('Lists Done!') except Exception as e: logger.error(f'Error in generating lists examples: {e}') From e72efe889134ec0c5b0d079e398ccaf5cc3b1cf0 Mon Sep 17 00:00:00 2001 From: enaples Date: Thu, 16 Jul 2026 14:12:51 +0200 Subject: [PATCH 3/7] tests: added example of currencyrate plugin RPC calls --- doc/schemas/currencyconvert.json | 15 ++++++++++++ doc/schemas/currencyrate.json | 4 +-- doc/schemas/listcurrencyrates.json | 39 ++++++++++++++++++++++++++++++ doc/schemas/listnetworkevents.json | 26 ++++++++++---------- tests/autogenerate-rpc-examples.py | 20 ++++++++++++++- 5 files changed, 88 insertions(+), 16 deletions(-) diff --git a/doc/schemas/currencyconvert.json b/doc/schemas/currencyconvert.json index bbe780c93e19..cb6073d69755 100644 --- a/doc/schemas/currencyconvert.json +++ b/doc/schemas/currencyconvert.json @@ -52,5 +52,20 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:currencyconvert#1", + "method": "currencyconvert", + "params": { + "amount": 100, + "currency": "USD" + } + }, + "response": { + "msat": 155974480 + } + } ] } diff --git a/doc/schemas/currencyrate.json b/doc/schemas/currencyrate.json index 13f39630d2a8..b8a2e26252d4 100644 --- a/doc/schemas/currencyrate.json +++ b/doc/schemas/currencyrate.json @@ -86,7 +86,7 @@ } }, "response": { - "rate": 67889.825 + "rate": 64113.052 } }, { @@ -102,7 +102,7 @@ } }, "response": { - "rate": 67931.9 + "rate": 64130.09 } } ] diff --git a/doc/schemas/listcurrencyrates.json b/doc/schemas/listcurrencyrates.json index 9b37a7922536..6da9e5836a60 100644 --- a/doc/schemas/listcurrencyrates.json +++ b/doc/schemas/listcurrencyrates.json @@ -63,5 +63,44 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:listcurrencyrates#1", + "method": "listcurrencyrates", + "params": { + "currency": "USD" + } + }, + "response": { + "currencyrates": [ + { + "amount": 64130.09, + "source": "binance" + }, + { + "amount": 64099.33, + "source": "blockchain.info" + }, + { + "amount": 64117.405, + "source": "coinbase" + }, + { + "amount": 64117.67, + "source": "bitstamp" + }, + { + "amount": 64108.7, + "source": "kraken" + }, + { + "amount": 64103.0, + "source": "coingecko" + } + ] + } + } ] } diff --git a/doc/schemas/listnetworkevents.json b/doc/schemas/listnetworkevents.json index 581134296138..6575a2ffd8a6 100644 --- a/doc/schemas/listnetworkevents.json +++ b/doc/schemas/listnetworkevents.json @@ -171,7 +171,7 @@ "type": "connect", "timestamp": 1738000000, "reason": "connect command \"pytest:connect#22\"", - "duration_nsec": 2331000 + "duration_nsec": 1477000 }, { "created_index": 3, @@ -179,36 +179,36 @@ "type": "connect", "timestamp": 1738000000, "reason": "connect command \"pytest:connect#24\"", - "duration_nsec": 1476000 + "duration_nsec": 949000 }, { "created_index": 4, "peer_id": "038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b", "type": "ping", "timestamp": 1738000000, - "duration_nsec": 327000 + "duration_nsec": 364000 }, { "created_index": 5, "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", "type": "connect", "timestamp": 1738000000, - "reason": "connect command \"pytest:connect#420\"", - "duration_nsec": 2546000 + "reason": "connect command \"pytest:connect#416\"", + "duration_nsec": 1844000 }, { "created_index": 6, "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", "type": "disconnect", "timestamp": 1738000000, - "duration_nsec": 8447000 + "duration_nsec": 7947000 }, { "created_index": 7, "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", "type": "disconnect", "timestamp": 1738000000, - "duration_nsec": 81968678000 + "duration_nsec": 78635382000 }, { "created_index": 8, @@ -216,29 +216,29 @@ "type": "connect", "timestamp": 1738000000, "reason": "reconnect by timer", - "duration_nsec": 4035000 + "duration_nsec": 3529000 }, { "created_index": 9, "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", "type": "connect", "timestamp": 1738000000, - "reason": "connect command \"pytest:connect#462\"", - "duration_nsec": 918000 + "reason": "connect command \"pytest:connect#458\"", + "duration_nsec": 633000 }, { "created_index": 10, "peer_id": "02287bfac8b99b35477ebe9334eede1e32b189e24644eb701c079614712331cec0", "type": "disconnect", "timestamp": 1738000000, - "duration_nsec": 6087454000 + "duration_nsec": 6094786000 }, { "created_index": 11, "peer_id": "0258f3ff3e0853ccc09f6fe89823056d7c0c55c95fab97674df5e1ad97a72f6265", "type": "disconnect", "timestamp": 1738000000, - "duration_nsec": 58975900000 + "duration_nsec": 58905461000 } ] } @@ -261,7 +261,7 @@ "type": "connect", "timestamp": 1738000000, "reason": "connect command \"pytest:connect#22\"", - "duration_nsec": 2331000 + "duration_nsec": 1477000 } ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index aa4f513c21e5..1190da69795a 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'currencyconvert', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'currencyrate', 'spliceout', 'askrene-bias-node', 'xkeysend', 'listcurrencyrates', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -1653,6 +1653,23 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o raise +def generate_currencyrate_examples(l3): + """Generates plugin currencyrate examples""" + try: + logger.info('Currencyrate Start...') + list_currencies_res1 = l3.rpc.listcurrencyrates(currency='USD') + update_example(node=l3, method='listcurrencyrates', params={'currency': 'USD'}, response=list_currencies_res1) + currencyconvert_res1 = l3.rpc.currencyconvert(amount=100, currency='USD') + update_example(node=l3, method='currencyconvert', params={'amount': 100, 'currency': 'USD'}, response=currencyconvert_res1) + currencyrate_res1 = l3.rpc.currencyrate(currency="USD") + update_example(node=l3, method='currencyrate', params={'currency': 'USD'}, description=["Get the median BTC/USD rate across all configured sources:"], response=currencyrate_res1) + currencyrate_res2 = l3.rpc.currencyrate(currency='USD', source='binance') + update_example(node=l3, method='currencyrate', params={'currency': 'USD', 'source': 'binance'}, description=["Get the BTC/USD rate from the Binance source only:"], response=currencyrate_res2) + logger.info('Currencyrate Done!') + except Exception as e: + logger.error(f'Error in generating currencyrate examples: {e}') + + @pytest.fixture(autouse=True) def setup_logging(): logger.setLevel(logging.DEBUG) @@ -1770,6 +1787,7 @@ def list_missing_examples(): generate_autoclean_delete_examples(l1, l2, l3, l4, l5, c12, c23) generate_backup_recovery_examples(node_factory, l4, l5, l6, regenerate_blockchain) generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, offer_l23, inv_req_l1_l22, address_l22) + generate_currencyrate_examples(l3) update_examples_in_schema_files() logger.info('All Done!!!') except Exception as e: From 7edd542b4370069b765ba62d18656dfa7931cad5 Mon Sep 17 00:00:00 2001 From: enaples Date: Thu, 16 Jul 2026 14:51:24 +0200 Subject: [PATCH 4/7] tests: added 'sendamount' RPC call example --- doc/schemas/sendamount.json | 20 +++++++++++++++++++- tests/autogenerate-rpc-examples.py | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/schemas/sendamount.json b/doc/schemas/sendamount.json index 23a01f5a379d..c4ad5c41f106 100644 --- a/doc/schemas/sendamount.json +++ b/doc/schemas/sendamount.json @@ -133,5 +133,23 @@ "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" ], - "examples": [] + "examples": [ + { + "request": { + "id": "example:sendamount#1", + "method": "sendamount", + "params": { + "invstring": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2zefkjmtsd3jjqar9wd6zqum9dejxzmt0w4h8g93pqg58h7kghxdn23m7h6fnfmk7rcetrz0zgezwkuquq7tpgufrx88vq", + "amount_msat": "1000sat" + } + }, + "response": { + "payment_preimage": "542e377929e51aa1542e377929e51aa1542e377929e51aa1542e377929e51aa1", + "amount_msat": 1000000, + "amount_sent_msat": 1000000, + "failed_parts": 0, + "successful_parts": 1 + } + } + ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index 1190da69795a..fabb94950ca2 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'sendamount', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -731,6 +731,9 @@ def generate_transactions_examples(l1, l2, l3, l4, l5, c25, bitcoind): 'groupid': 0}) wait_for_htlcs_settled([l1, l2, l3, l4, l5]) update_example(node=l1, method='fetchbip353', params={'address': 'send.some@satsto.me'}, description=['Example of fetching BIP-353 payment details.']) + offer_l43 = l4.rpc.offer(amount='any', description='Simple test sendamount') + send_amt = l3.rpc.sendamount(invstring=offer_l43['bolt12'], amount_msat='1000sat') + update_example(node=l3, method='sendamount', params={'invstring': offer_l43['bolt12'], 'amount_msat': '1000sat'}, response=send_amt) logger.info('Simple Transactions Done!') return c23_2, c23res2, c34_2, inv_l11, inv_l21, inv_l22, inv_l31, inv_l32, inv_l34 except Exception as e: From 04a4855e9112bce674a3c35bbd74858c6ca3ae37 Mon Sep 17 00:00:00 2001 From: enaples Date: Thu, 16 Jul 2026 15:58:48 +0200 Subject: [PATCH 5/7] tests: added 'createproof' RPC call example --- doc/schemas/createproof.json | 33 ++++++++++++++++++++++++++++++ tests/autogenerate-rpc-examples.py | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/doc/schemas/createproof.json b/doc/schemas/createproof.json index 2579ee0cab3c..db659e2eeb56 100644 --- a/doc/schemas/createproof.json +++ b/doc/schemas/createproof.json @@ -160,5 +160,38 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:createproof#1", + "method": "createproof", + "params": { + "invstring": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2zegxz7tdv4h8ggrjv4ch26tjv4ejqurjdahkv93pqg58h7kghxdn23m7h6fnfmk7rcetrz0zgezwkuquq7tpgufrx88vq" + } + }, + "response": { + "proofs": [ + { + "bolt12": "lnp1pgt9qcted4jkuapqwfjhzatfwfjhxgrswfhk7eskyypzs7l6ezuekd2806lfxd8wmc0r9vvfufryf6msrsrev9r3yvcuaszcyypyzanz3eyn5zgclm7wpz20wcq0e4ykpsuugryk95lvgv2gy6dy9r4yq3ne035q4qs8s5r64x52g8drh6sfvl3eudl3crjy7spfg0t56sch67h5weq8fsa2qvr6zg9wqvpqqq9syypzs7l6ezuekd2806lfxd8wmc0r9vvfufryf6msrsrev9r3yvcuas8sgp5ytk6gtg9uwn7m5scae2rctte4y7c2sl030tvepsyygw77wxm7460ne9s3d93cg3x76mdsu5xzyz4j3ph825dp6ve5n78ynz0fx9nl79qxq25pz0xdmh8qjj9yg2avdrplmppqvq0gne3tk0gz5y27y69vzf9vquk8j2k7mq7w9u99zm9vd5dwvz4c7nf4324sgehn0q3yynyuzn7s86fq2shrw7ffu5d2y4pwxaujneg65f2zudme98j34gj59cmhj209r2306ql2qcq3wxqet9d06qltsp8977rjak289nv62vujc0fpm5lh4rywk3zh4lmq7d36esq20fm24pkmtzjw4085srpgxwcxh8yqs3weexndsed53q8vrymuvxjxhr9jpnszuw3fdplrfwyjyemect2dzx8vxhgmlx7zw567ucd3gq9v37hkyacdps886zge3q6a2xcdk42dmezhm7uqtzrapawhrca06rf74chaq0k06qgqcazxey889hytdkl58r4z77y4psut06ckhdnerkck2fr54h09jgxv9zpfyxc7vqkpymzsx558p9kcxnu6rnn094vjn5t8l2te453hqezvrj0s2wxuvdn7g4a02ctntty0hy83nypvwhr8dkwg54tj9zx69ahs8zd23hczsc39cfq6yyn0mp702p273cakgfk5j9dg4rqsukcrpanhtwh7pzy4x9q5cvykg68d7rqg2e7wysgt7007pzy9qpk238l2g0xskct9ynva35tey440dxlpe4m3e4qk6yllqakmzf745xt9ps4jajk7kj2dr56atazvlvhcf2lzv8rsvdracjd4452z2wkdv0zdepl90z3pvx2h5kyqtvntqp680a7kyhgvmpfhcfqcjdlksx29r30cey", + "offer_fields_included": [ + "offer_description", + "offer_issuer_id" + ], + "invreq_fields_included": [ + "invreq_payer_id" + ], + "invoice_fields_included": [ + "invoice_created_at", + "invoice_payment_hash", + "invoice_amount", + "invoice_features", + "invoice_node_id", + "signature" + ] + } + ] + } + } ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index fabb94950ca2..24d4d2a14511 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -1103,6 +1103,10 @@ def generate_utils_examples(l1, l2, l3, l4, l5, l6, c23_2, c34_2, inv_l11, inv_l update_example(node=l2, method='signmessagewithkey', params={'message': 'signing this message with key', 'address': addr}) update_example(node=l2, method='decode', params=[rune_l21['rune']]) update_example(node=l2, method='decode', params=[inv_l22['bolt11']]) + inv_req = l4.rpc.offer(amount='any', description='Payment requires proof') + l3.rpc.sendamount(invstring=inv_req['bolt12'], amount_msat='1000sat') + res_inv_req = l3.rpc.createproof(invstring=inv_req['bolt12']) + update_example(node=l3, method='createproof', params={'invstring': inv_req['bolt12']}, response=res_inv_req) # PSBT amount1 = 1000000 From 10e2389ba68b639279665cc8e4a170fd276a00ec Mon Sep 17 00:00:00 2001 From: enaples Date: Fri, 17 Jul 2026 14:25:40 +0200 Subject: [PATCH 6/7] tests: added 'delnetworkevent' RPC call example --- doc/schemas/delnetworkevent.json | 12 ++++++++++++ tests/autogenerate-rpc-examples.py | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/schemas/delnetworkevent.json b/doc/schemas/delnetworkevent.json index e80fcadef111..2be58ab591ba 100644 --- a/doc/schemas/delnetworkevent.json +++ b/doc/schemas/delnetworkevent.json @@ -41,5 +41,17 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:delnetworkevent#1", + "method": "delnetworkevent", + "params": { + "created_index": 2 + } + }, + "response": {} + } ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index 24d4d2a14511..858e91d960ce 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'delnetworkevent', 'cancelrecurringinvoice', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'cancelrecurringinvoice', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -1494,6 +1494,10 @@ def generate_autoclean_delete_examples(l1, l2, l3, l4, l5, c12, c23): update_example(node=l2, method='delforward', params={'in_channel': c12, 'in_htlc_id': failed_forwards[0]['in_htlc_id'], 'status': 'failed'}) update_example(node=l2, method='dev-forget-channel', params={'id': l3.info['id'], 'short_channel_id': c23, 'force': True}, description=[f'Forget a channel by short channel id when peer has multiple channels:']) + # Delnetworkevent + dl_nwk_res1 = l2.rpc.listnetworkevents(id=l3.info['id'], index='created', limit=3) + update_example(node=l2, method='delnetworkevent', params={'created_index': dl_nwk_res1['networkevents'][-1]['created_index']}) + # Autoclean update_example(node=l2, method='autoclean-once', params=['failedpays', 1]) update_example(node=l2, method='autoclean-once', params=['succeededpays', 1]) From 351a2e685863c75e338e220e2ad983a34da14b80 Mon Sep 17 00:00:00 2001 From: enaples Date: Fri, 17 Jul 2026 15:59:59 +0200 Subject: [PATCH 7/7] tests: added 'cancelrecurringinvoice' RPC call example --- doc/schemas/cancelrecurringinvoice.json | 19 ++++++++++++++++++- tests/autogenerate-rpc-examples.py | 7 ++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/schemas/cancelrecurringinvoice.json b/doc/schemas/cancelrecurringinvoice.json index 49041d3e2f9d..a7c61581bfb0 100644 --- a/doc/schemas/cancelrecurringinvoice.json +++ b/doc/schemas/cancelrecurringinvoice.json @@ -50,7 +50,7 @@ "bip353": { "type": "string", "description": [ - "BIP353 string (optionally with ₿) indicating where we fetched the offer from" + "BIP353 string (optionally with \u20bf) indicating where we fetched the offer from" ] } } @@ -77,5 +77,22 @@ ], "resources": [ "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)" + ], + "examples": [ + { + "request": { + "id": "example:cancelrecurringinvoice#1", + "method": "cancelrecurringinvoice", + "params": { + "offer": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqv85ysq2zefx2cm4wfexjmn8ypeh2cnnvdexjur5d9hku93pqg58h7kghxdn23m7h6fnfmk7rcetrz0zgezwkuquq7tpgufrx88vpl3mnt9psqsq8s", + "recurrence_counter": 1, + "recurrence_label": "subscription l3", + "payer_note": "Cancelling subscription" + } + }, + "response": { + "bolt12": "lnr1qqsquux3chfhckgak29er5ljyamfzyln7uka69lf6fddl7te7k20w0gzyqrzymjxzydqkkw24ufxqslttwlj3s608f0rx2slc7etw0833zgs7zqrpapyqzsk2fjkxatjwf5kueeqwd6kyumrwf5hqarfdahpvggz9pal4j9env65wl47jv6wahs7x2ccncjxgn4hq8q8jc28zge3emq9qgqxyfhyvyg6pdvu4tcjvpp7kkal9rp57wj7xv4pl3ajku70rzy3pa2qqkppqtpdhn70ts2jyn6f0x8zf7p3sqfrglh2v4s7zqg5pxlfq8gs8f9dckghgdskucm9d3kxjmn8ypeh2cnnvdexjur5d9hkauzqthdkt4nhqfewafy75t27xycdfgmyak7wsfpjwu6wc3l9r3dqspfnjzeda9xslw7q8k9c6wzxcsyzegn49rl43ykntut4x0dktle4re878wdv5xqzqq70uae4j3wqzq07wu6eghsq" + } + } ] } diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py index 858e91d960ce..b265c6d92a64 100644 --- a/tests/autogenerate-rpc-examples.py +++ b/tests/autogenerate-rpc-examples.py @@ -33,7 +33,7 @@ ALL_RPC_EXAMPLES = {} EXAMPLES_JSON = {} LOG_FILE = './tests/autogenerate-examples-status.log' -IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'cancelrecurringinvoice', 'injectonionmessage'] +IGNORE_RPCS_LIST = ['dev-splice', 'reckless', 'sql-template', 'splicein', 'createproof', 'clnrest-register-path', 'graceful', 'askrene-remove-channel-update', 'spliceout', 'askrene-bias-node', 'xkeysend', 'injectonionmessage'] EXPECTED_WALLET_TXIDS = defaultdict(set) @@ -1108,6 +1108,11 @@ def generate_utils_examples(l1, l2, l3, l4, l5, l6, c23_2, c34_2, inv_l11, inv_l res_inv_req = l3.rpc.createproof(invstring=inv_req['bolt12']) update_example(node=l3, method='createproof', params={'invstring': inv_req['bolt12']}, response=res_inv_req) + offer_rec = update_example(node=l4, method='offer', params={'amount': '1000sat', 'description': 'Recurring subscription', 'recurrence': '1minutes'}) + rec_inv_l3 = l3.rpc.fetchinvoice(offer=offer_rec['bolt12'], recurrence_counter=0, recurrence_label='subscription l3') + l3.rpc.pay(rec_inv_l3['invoice'], label='subscription l3') + update_example(node=l3, method='cancelrecurringinvoice', params={'offer': offer_rec['bolt12'], 'recurrence_counter': 1, 'recurrence_label': 'subscription l3', 'payer_note': 'Cancelling subscription'}) + # PSBT amount1 = 1000000 amount2 = 3333333