|
33 | 33 | ALL_RPC_EXAMPLES = {} |
34 | 34 | EXAMPLES_JSON = {} |
35 | 35 | LOG_FILE = './tests/autogenerate-examples-status.log' |
36 | | -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'] |
| 36 | +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'] |
37 | 37 | EXPECTED_WALLET_TXIDS = defaultdict(set) |
38 | 38 |
|
39 | 39 |
|
@@ -1653,6 +1653,23 @@ def generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, o |
1653 | 1653 | raise |
1654 | 1654 |
|
1655 | 1655 |
|
| 1656 | +def generate_currencyrate_examples(l3): |
| 1657 | + """Generates plugin currencyrate examples""" |
| 1658 | + try: |
| 1659 | + logger.info('Currencyrate Start...') |
| 1660 | + list_currencies_res1 = l3.rpc.listcurrencyrates(currency='USD') |
| 1661 | + update_example(node=l3, method='listcurrencyrates', params={'currency': 'USD'}, response=list_currencies_res1) |
| 1662 | + currencyconvert_res1 = l3.rpc.currencyconvert(amount=100, currency='USD') |
| 1663 | + update_example(node=l3, method='currencyconvert', params={'amount': 100, 'currency': 'USD'}, response=currencyconvert_res1) |
| 1664 | + currencyrate_res1 = l3.rpc.currencyrate(currency="USD") |
| 1665 | + update_example(node=l3, method='currencyrate', params={'currency': 'USD'}, description=["Get the median BTC/USD rate across all configured sources:"], response=currencyrate_res1) |
| 1666 | + currencyrate_res2 = l3.rpc.currencyrate(currency='USD', source='binance') |
| 1667 | + 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) |
| 1668 | + logger.info('Currencyrate Done!') |
| 1669 | + except Exception as e: |
| 1670 | + logger.error(f'Error in generating currencyrate examples: {e}') |
| 1671 | + |
| 1672 | + |
1656 | 1673 | @pytest.fixture(autouse=True) |
1657 | 1674 | def setup_logging(): |
1658 | 1675 | logger.setLevel(logging.DEBUG) |
@@ -1770,6 +1787,7 @@ def list_missing_examples(): |
1770 | 1787 | generate_autoclean_delete_examples(l1, l2, l3, l4, l5, c12, c23) |
1771 | 1788 | generate_backup_recovery_examples(node_factory, l4, l5, l6, regenerate_blockchain) |
1772 | 1789 | generate_list_examples(bitcoind, l1, l2, l3, c12, c23_2, inv_l31, inv_l32, offer_l23, inv_req_l1_l22, address_l22) |
| 1790 | + generate_currencyrate_examples(l3) |
1773 | 1791 | update_examples_in_schema_files() |
1774 | 1792 | logger.info('All Done!!!') |
1775 | 1793 | except Exception as e: |
|
0 commit comments