diff --git a/CHANGELOG.md b/CHANGELOG.md index 2344cd8..60fe67f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## v0.4.0-beta - May 25, 2025 +* Added new endpoint method: + * `get_monero_mining_stats()`: Returns a dictionary containing various statistics related to Monero mining, such as pool and network hashrates, network difficulty, block height, and other relevant pool/miner data. + * Since the reward for each block of monero is `0.6 XMR`, we have added a small formula that allows us to calculate approximate rewards. +* Some internal libraries have been updated to fix known vulnerabilities. +* Since the : `/block-height` endpoint is going to be removed, a message has been added to the `get_block_height()` method to warn that it is recommended to use the `get_tick_info()` method instead to ensure maximum compatibility. +* Donation addresses have been added to help cover operational costs, spend more time on new features, bug fixes and full documentation, ensuring that QubiPy remains a robust tool for everyone. More information in our [README](https://github.com/QubiPy-Labs/QubiPy/blob/main/README.md) and our [online documentation](https://qubipy.readthedocs.io/en/latest/about/#community-and-support). + ## v0.3.0-beta - May 7, 2025 * Added new endpoints methods : * get_assets_issuances(): Returns a list of issued assets. diff --git a/README.md b/README.md index c8c395e..ae0df20 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Currently, QubiPy is in a very early development phase, so please take this into Please visit the [Change log](https://github.com/QubiPy-Labs/QubiPy/blob/main/docs/changelog.md) to see all changes. -![release](https://img.shields.io/badge/release-v0.3.0--beta-blue) +![release](https://img.shields.io/badge/release-v0.4.0--beta-blue) ![python](https://img.shields.io/badge/python-3.10_%7C_3.11_%7C_3.12-blue) ![Python Package](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/python-package.yml/badge.svg) ![Code Quality](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/pylint.yml/badge.svg) @@ -96,6 +96,24 @@ $ { ``` +### Support Our Work (Donations) + +#### Your Contribution Matters + QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community. + + Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources. + + If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated. + + Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone. + + You can send your generous contributions to the following addresses: + + * QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`** + * USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`** + + A huge thank you for being a part of the QubiPy journey! + ### Technical notes This library is using `crypto.dll` which is a C extension of Qubic key utility functions and bind it to Python. To build this `crypto.dll`, this repository was used: [https://github.com/serendipity-seeker/key-utils-binding](https://github.com/serendipity-seeker/key-utils-binding). diff --git a/docs/about.md b/docs/about.md index a260938..9d39e87 100644 --- a/docs/about.md +++ b/docs/about.md @@ -60,6 +60,24 @@ Check our [Contributing Guidelines](contributing.md) for more details. - Check our [Documentation](https://qubipy.readthedocs.io) - Ask questions on [GitHub Issues](https://github.com/QubiPy-Labs/QubiPy/issues) +### Support Our Work (Donations) + +!!! tip "Your Contribution Matters" + QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community. + + Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources. + + If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated. + + Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone. + + You can send your generous contributions to the following addresses: + + * QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`** + * USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`** + + A huge thank you for being a part of the QubiPy journey! + ## Technical notes This library uses crypto.dll, which is a C extension of the Qubic key utility functions and binds them to Python. To build this crypto.dll, this [repository](https://github.com/serendipity-seeker/key-utils-binding) was used. diff --git a/docs/changelog.md b/docs/changelog.md index 2344cd8..006aa1a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,13 @@ # Change Log +## v0.4.0-beta - May 25, 2025 +* Added new endpoint method: + * `get_monero_mining_stats()`: Returns a dictionary containing various statistics related to Monero mining, such as pool and network hashrates, network difficulty, block height, and other relevant pool/miner data. + * Since the reward for each block of monero is `0.6 XMR`, we have added a small formula that allows us to calculate approximate rewards. +* Some internal libraries have been updated to fix known vulnerabilities. +* Since the : `/block-height` endpoint is going to be removed, a message has been added to the `get_block_height()` method to warn that it is recommended to use the `get_tick_info()` method instead to ensure maximum compatibility. +* Donation addresses have been added to help cover operational costs, spend more time on new features, bug fixes and full documentation, ensuring that QubiPy remains a robust tool for everyone. + ## v0.3.0-beta - May 7, 2025 * Added new endpoints methods : * get_assets_issuances(): Returns a list of issued assets. diff --git a/docs/index.md b/docs/index.md index 0fe68dc..3a3c56b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,11 +1,11 @@ # Welcome to the **QubiPy** official documentation, a Python Library for the QUBIC RPC API -!!! note "Beta Version: 0.3.0" +!!! note "Beta Version: 0.4.0" QubiPy is currently in beta. While functional, some features might change before the stable release. **QubiPy** is a Python library that provides RPC and Core client functionality. You can interact quickly and easily with the Qubic RPC API using the different methods offered by this library. -![release](https://img.shields.io/badge/release-v0.3.0--beta-blue) +![release](https://img.shields.io/badge/release-v0.4.0--beta-blue) ![python](https://img.shields.io/badge/python-3.10_%7C_3.11_%7C_3.12-blue) ![Python Package](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/python-package.yml/badge.svg) ![Code Quality](https://github.com/QubiPy-Labs/QubiPy/actions/workflows/pylint.yml/badge.svg) @@ -74,6 +74,24 @@ We welcome all contributions to QubiPy! Whether you want to: You can learn how to contribute [here](contributing.md) +## Support Our Work (Donations) + +!!! tip "Your Contribution Matters" + QubiPy is developed and maintained by QubiPy Labs as a free, open-source project for the Qubic community. + + Our dedication to providing high-quality tools is driven by passion, but maintaining and enhancing the library requires time, effort, and resources. + + If you find QubiPy valuable and wish to support its continued development, any contribution is greatly appreciated. + + Your donations help us cover operational costs, dedicate more time to new features, bug fixes, and comprehensive documentation, ensuring QubiPy remains a robust tool for everyone. + + You can send your generous contributions to the following addresses: + + * QUBIC : **`CNSLISZCRHAVHADBQCZWVYAVTYXCVNQREGVVTWKBLHSJXFHRFEGNLORCHRSE`** + * USDT (ETH, ARB, BSC or Polygon) : **`0x453471Cc01868895b833841Ce7DbaE11fd9D1933`** + + A huge thank you for being a part of the QubiPy journey! + ## Community diff --git a/docs/requirements-doc.txt b/docs/requirements-doc.txt index 2c34522..8fbb6be 100644 --- a/docs/requirements-doc.txt +++ b/docs/requirements-doc.txt @@ -17,4 +17,4 @@ GitPython==3.1.43 Pygments==2.18.0 PyYAML==6.0.2 Markdown==3.7 -Jinja2==3.1.5 \ No newline at end of file +Jinja2==3.1.6 \ No newline at end of file diff --git a/qubipy/config.py b/qubipy/config.py index d84a2a2..b4626b3 100644 --- a/qubipy/config.py +++ b/qubipy/config.py @@ -7,6 +7,8 @@ CORE_URL = 'https://api.qubic.org/v1' +MONERO_URL = 'https://xmr-stats.qubic.org' # This URL is only used to obtain monero mining stats. + TIMEOUT = 5 HEADERS = { diff --git a/qubipy/core/core_client.py b/qubipy/core/core_client.py index 3895c6c..8cdbeee 100644 --- a/qubipy/core/core_client.py +++ b/qubipy/core/core_client.py @@ -541,4 +541,35 @@ def get_qx_fees(self) -> Dict[str, Any]: return data except requests.RequestException as E: raise QubiPy_Exceptions(f"Error when getting QX fees: {str(E)}") from None + + def get_monero_mining_stats(self) -> Dict[str, Any]: + + """ + Retrieves current Monero mining statistics from the external Monero system. + + This function makes an API call to fetch real-time or recent data related + to Monero network mining. + + Returns: + Dict[str, Any]: A dictionary containing various statistics related to Monero mining, + such as pool and network hashrates, network difficulty, block height, + and other relevant pool/miner data. The exact structure and content + depend on the Monero API response. + + Raises: + QubiPy_Exceptions: If there is an issue during the API request execution (e.g., + a network connection error, a non-2xx HTTP status code from the + API server, a timeout during the request, or if the API + response cannot be parsed as valid JSON). + """ + try: + REWARD_PER_MONERO_BLOCK = 0.6 + response = requests.get(f'{MONERO_URL}{MONERO_MINING_STATS}', headers=HEADERS, timeout=self.timeout) + response.raise_for_status() # Raise an exception for bad HTTP status codes + data = response.json() + raw_rewards = data.get('pool_blocks_found', 0) * REWARD_PER_MONERO_BLOCK + data['monero_amount_rewards'] = round(raw_rewards, 8) + return data + except requests.RequestException as E: + raise QubiPy_Exceptions(f"Error when getting the monero mining stats: {str(E)}") from None diff --git a/qubipy/endpoints_core.py b/qubipy/endpoints_core.py index 9808b2f..2fbe7b3 100644 --- a/qubipy/endpoints_core.py +++ b/qubipy/endpoints_core.py @@ -42,4 +42,8 @@ QX_ENTITY_BID_ORDERS = '/qx/getEntityBidOrders' -QX_FEES = '/qx/getFees' \ No newline at end of file +QX_FEES = '/qx/getFees' + +# MONERO MINING STATS + +MONERO_MINING_STATS = '/stats' \ No newline at end of file diff --git a/qubipy/endpoints_rpc.py b/qubipy/endpoints_rpc.py index 58a5626..565bd0d 100644 --- a/qubipy/endpoints_rpc.py +++ b/qubipy/endpoints_rpc.py @@ -48,7 +48,7 @@ RICH_LIST = '/rich-list' -# Testing +# ASSETS ASSETS_ISSUANCE = '/assets/issuances' diff --git a/qubipy/rpc/rpc_client.py b/qubipy/rpc/rpc_client.py index d1323da..50bbd42 100644 --- a/qubipy/rpc/rpc_client.py +++ b/qubipy/rpc/rpc_client.py @@ -7,6 +7,7 @@ import requests from typing import Dict, Any import json +import warnings from qubipy.exceptions import * from qubipy.config import * @@ -586,6 +587,10 @@ def get_block_height(self) -> Dict[str, Any]: """ Retrieves the current block height from the API. + ..deprecated:: 0.4.0 + The `get_block_height()` function is deprecated and will be removed in a future version of QubiPy. + Please use `get_tick_info()` instead for future compatibility. + Returns: Dict[str, Any]: A dictionary containing the current block height. If the block height is not found, an empty dictionary is returned. @@ -593,7 +598,12 @@ def get_block_height(self) -> Dict[str, Any]: Raises: QubiPy_Exceptions: If there is an issue with the API request (e.g., network error, invalid response, or timeout). """ - + warnings.warn( + "The 'get_block_height()' function is deprecated and will be removed in a future version of QubiPy. " + "Please use 'get_tick_info()' instead for maximum compatibility.", + DeprecationWarning, + stacklevel=2 + ) try: response = requests.get(f'{self.rpc_url}{BLOCK_HEIGHT}', headers=HEADERS, timeout=self.timeout) response.raise_for_status() diff --git a/requirements.txt b/requirements.txt index 04278d5..023d6a6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,5 +14,5 @@ pluggy==1.5.0 # Development & Formatting black==24.10.0 -setuptools==75.3.0 +setuptools==78.1.1 watchdog==6.0.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 75c0c0a..30476e5 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -__version__ = '0.3.0' +__version__ = '0.4.0' with open("README.md", "r", encoding="utf-8") as fh: