Name | nanorpc JSON |
Version |
0.1.7
JSON |
| download |
home_page | https://github.com/gr0vity-dev/nano-rpc-py |
Summary | async nano rpc library with dynamic method generation per node version |
upload_time | 2024-12-16 08:40:57 |
maintainer | None |
docs_url | None |
author | gr0vity |
requires_python | >=3.7 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# NanoRPC
NanoRPC is a Python library for interacting with Nano cryptocurrency nodes via their JSON-RPC API. It provides an easy-to-use interface to execute RPC (Remote Procedure Call) commands supported by different versions of Nano nodes.
## Features
- Compatible with Python 3.7 and higher.
- Supports asynchronous operations using `asyncio` and `aiohttp`.
- Automatically adjusts available RPC methods based on the version of the connected Nano node.
- Provides a simple and intuitive API for executing RPC commands.
## Requirements
- Python 3.7 and higher
- aiohttp library
## Installation
You can install NanoRPC using `pip`:
```bash
pip install nanorpc
```
## Usage
Here's a basic example of how to use NanoRPC to interact with a Nano node:
```python
import asyncio
from nanorpc.client import NanoRpcTyped
async def main():
# Connect to a Nano node
rpc = NanoRpcTyped(url='http://localhost:7076')
# Execute an RPC command
block_count = await rpc.block_count()
print(f"Current block count: {block_count}")
# Execute another RPC command
version_info = await rpc.version()
print(f"Node version: {version_info}")
#pass mandatory input as args* and optional as kwargs*
account = "nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6"
account_info = await rpc.account_info(account, include_confirmed="true", representative="true", receivable="true", weight="true")
print(f"Account info: {account_info}")
# Run the main function within an asyncio event loop
asyncio.run(main())
```
### Error Handling
NanoRPC includes several error handling mechanisms. If an RPC command fails or if a network issue is encountered, the library will retry the request for a specified number of times. If all retries are exhausted, the library will raise a `MaxRetriesExceededError`.
### Available RPC Commands
NanoRPC provides access to various RPC commands based on the connected Nano node version. For a complete list of available commands and their parameters, please refer to the [versions folder](./nanorpc/versions) in this repository.
### Official RPC Documentation
For detailed documentation on the Nano RPC protocol and available commands, please visit the [Nano RPC Documentation](https://docs.nano.org/commands/rpc-protocol/) page.
## Contributing
Contributions to NanoRPC are welcome! If you find any issues, have suggestions, or would like to contribute enhancements or new features, please open an issue or submit a pull request.
## License
NanoRPC is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/gr0vity-dev/nano-rpc-py",
"name": "nanorpc",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "gr0vity",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c0/16/2b984bb89e8af289ee67e65723c76176b125770cd67af252dbad5768e132/nanorpc-0.1.7.tar.gz",
"platform": null,
"description": "# NanoRPC\n\nNanoRPC is a Python library for interacting with Nano cryptocurrency nodes via their JSON-RPC API. It provides an easy-to-use interface to execute RPC (Remote Procedure Call) commands supported by different versions of Nano nodes.\n\n## Features\n\n- Compatible with Python 3.7 and higher.\n- Supports asynchronous operations using `asyncio` and `aiohttp`.\n- Automatically adjusts available RPC methods based on the version of the connected Nano node.\n- Provides a simple and intuitive API for executing RPC commands.\n\n## Requirements\n\n- Python 3.7 and higher\n- aiohttp library\n\n## Installation\n\nYou can install NanoRPC using `pip`:\n\n```bash\npip install nanorpc\n```\n\n## Usage\n\nHere's a basic example of how to use NanoRPC to interact with a Nano node:\n\n```python\nimport asyncio\nfrom nanorpc.client import NanoRpcTyped\n\nasync def main():\n # Connect to a Nano node\n rpc = NanoRpcTyped(url='http://localhost:7076')\n\n # Execute an RPC command\n block_count = await rpc.block_count()\n print(f\"Current block count: {block_count}\")\n\n # Execute another RPC command\n version_info = await rpc.version()\n print(f\"Node version: {version_info}\")\n\n #pass mandatory input as args* and optional as kwargs*\n account = \"nano_3msc38fyn67pgio16dj586pdrceahtn75qgnx7fy19wscixrc8dbb3abhbw6\"\n account_info = await rpc.account_info(account, include_confirmed=\"true\", representative=\"true\", receivable=\"true\", weight=\"true\")\n print(f\"Account info: {account_info}\")\n\n# Run the main function within an asyncio event loop\nasyncio.run(main())\n```\n\n### Error Handling\n\nNanoRPC includes several error handling mechanisms. If an RPC command fails or if a network issue is encountered, the library will retry the request for a specified number of times. If all retries are exhausted, the library will raise a `MaxRetriesExceededError`.\n\n### Available RPC Commands\n\nNanoRPC provides access to various RPC commands based on the connected Nano node version. For a complete list of available commands and their parameters, please refer to the [versions folder](./nanorpc/versions) in this repository.\n\n### Official RPC Documentation\n\nFor detailed documentation on the Nano RPC protocol and available commands, please visit the [Nano RPC Documentation](https://docs.nano.org/commands/rpc-protocol/) page.\n\n## Contributing\n\nContributions to NanoRPC are welcome! If you find any issues, have suggestions, or would like to contribute enhancements or new features, please open an issue or submit a pull request.\n\n## License\n\nNanoRPC is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n",
"bugtrack_url": null,
"license": null,
"summary": "async nano rpc library with dynamic method generation per node version",
"version": "0.1.7",
"project_urls": {
"Homepage": "https://github.com/gr0vity-dev/nano-rpc-py"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "88f9c3c1ede505073e629e2eae540a54dcf775e54707fbdb4e5be2b968f27760",
"md5": "e00ddf345cdb435c69d6519c9a3c4b6c",
"sha256": "178bcf6e4008260df055c804c536801e8c0989b743ee4816769f236c5ee902b6"
},
"downloads": -1,
"filename": "nanorpc-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e00ddf345cdb435c69d6519c9a3c4b6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 31368,
"upload_time": "2024-12-16T08:40:54",
"upload_time_iso_8601": "2024-12-16T08:40:54.985930Z",
"url": "https://files.pythonhosted.org/packages/88/f9/c3c1ede505073e629e2eae540a54dcf775e54707fbdb4e5be2b968f27760/nanorpc-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0162b984bb89e8af289ee67e65723c76176b125770cd67af252dbad5768e132",
"md5": "eeb3f8cfbf2146b3ddba6dfb70a718b8",
"sha256": "4406f9774c06ae4d1e2d35922f0c4ab7356a5e64f8cda7522cf536bbbdf1c6de"
},
"downloads": -1,
"filename": "nanorpc-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "eeb3f8cfbf2146b3ddba6dfb70a718b8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 12138,
"upload_time": "2024-12-16T08:40:57",
"upload_time_iso_8601": "2024-12-16T08:40:57.201839Z",
"url": "https://files.pythonhosted.org/packages/c0/16/2b984bb89e8af289ee67e65723c76176b125770cd67af252dbad5768e132/nanorpc-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 08:40:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gr0vity-dev",
"github_project": "nano-rpc-py",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nanorpc"
}