nanowallet


Namenanowallet JSON
Version 0.0.18 PyPI version JSON
download
home_pagehttps://github.com/gr0vity-dev/nanowallet_py
Summaryasync nano library for easy account management
upload_time2024-12-28 20:58:07
maintainerNone
docs_urlNone
authorgr0vity
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements nano_lib_py nanorpc setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NanoWallet Library


**nanowallet_py** is a Python library that provides an easy-to-use interface for interacting with Nano nodes. This library allows you to manage your Nano account inside a wallet. It allows you to send and receive transactions, and interact with the Nano network using the `NanoRpcTyped` client.

## Installation

You can install NanoWallet using pip:

```
pip install nanowallet
```

## Usage

Here's a basic example of how to use the NanoWallet library:

```python
import asyncio
from nanorpc.client import NanoRpcTyped
from nanowallet import NanoWallet

async def main():
    # Replace with your RPC endpoint
    rpc = NanoRpcTyped(url='http://localhost:7076')
    seed = '4f2dd...'  # Replace with your seed
    index = 0

    wallet = NanoWallet(rpc, seed, index)
    await wallet.reload()  # Optional - loads all account data
    print(wallet.account)
    print(wallet.receivable_blocks)

    response = await wallet.receive_all()
    if response.success:
        print(response.value)  # list of received block hashes

asyncio.run(main())
```

## Features

- Create and manage Nano wallets
- Send and receive Nano transactions
- Check account balance and pending blocks
- Use work peers for PoW (Proof of Work) generation.
- Handle errors with a robust error handling system
- Seamlessly reload wallet state.

## Available Methods

- `reload()`:  
  Loads the current state of the wallet, including balance, receivable blocks, account info, and more.

- `send(destination_account: str, amount: float)`:  
  Sends a specified amount of Nano to the destination account. Returns the hash of the sent block.

- `receive_by_hash(block_hash: str)`:  
  Receives a specific receivable block by its hash. Returns the hash of the received block.

- `sweep(destination_account: str)`:  
  Sends all available funds from the current wallet to the specified destination account.

- `receive_all(threshold: float = None)`:  
  Receives all pending receivable blocks. Optionally, a threshold can be set to only receive blocks with amounts greater than the threshold.

- `list_receivables(threshold: float = None)`:  
  Lists all receivable blocks, sorted by the amount in descending order. A threshold can be used to filter the results.

- `refund_first_sender()`:  
  Receives all receivable blocks and sends the entire funds back to the first sender (i.e., the account opener or eldest unreceived block).


## Contributing

Contributions are welcome! Please feel free to submit a Pull Request or create an issue for any bugs or feature requests.

## License

This project is licensed under an open-source license that allows free use and modification for both commercial and private use. For more details, please see the LICENSE file in the repository.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gr0vity-dev/nanowallet_py",
    "name": "nanowallet",
    "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/f6/cc/d10c63b8d1b527771731c0e5bf1b97da87737bc18566d33080a6afba86d9/nanowallet-0.0.18.tar.gz",
    "platform": null,
    "description": "# NanoWallet Library\n\n\n**nanowallet_py** is a Python library that provides an easy-to-use interface for interacting with Nano nodes. This library allows you to manage your Nano account inside a wallet. It allows you to send and receive transactions, and interact with the Nano network using the `NanoRpcTyped` client.\n\n## Installation\n\nYou can install NanoWallet using pip:\n\n```\npip install nanowallet\n```\n\n## Usage\n\nHere's a basic example of how to use the NanoWallet library:\n\n```python\nimport asyncio\nfrom nanorpc.client import NanoRpcTyped\nfrom nanowallet import NanoWallet\n\nasync def main():\n    # Replace with your RPC endpoint\n    rpc = NanoRpcTyped(url='http://localhost:7076')\n    seed = '4f2dd...'  # Replace with your seed\n    index = 0\n\n    wallet = NanoWallet(rpc, seed, index)\n    await wallet.reload()  # Optional - loads all account data\n    print(wallet.account)\n    print(wallet.receivable_blocks)\n\n    response = await wallet.receive_all()\n    if response.success:\n        print(response.value)  # list of received block hashes\n\nasyncio.run(main())\n```\n\n## Features\n\n- Create and manage Nano wallets\n- Send and receive Nano transactions\n- Check account balance and pending blocks\n- Use work peers for PoW (Proof of Work) generation.\n- Handle errors with a robust error handling system\n- Seamlessly reload wallet state.\n\n## Available Methods\n\n- `reload()`:  \n  Loads the current state of the wallet, including balance, receivable blocks, account info, and more.\n\n- `send(destination_account: str, amount: float)`:  \n  Sends a specified amount of Nano to the destination account. Returns the hash of the sent block.\n\n- `receive_by_hash(block_hash: str)`:  \n  Receives a specific receivable block by its hash. Returns the hash of the received block.\n\n- `sweep(destination_account: str)`:  \n  Sends all available funds from the current wallet to the specified destination account.\n\n- `receive_all(threshold: float = None)`:  \n  Receives all pending receivable blocks. Optionally, a threshold can be set to only receive blocks with amounts greater than the threshold.\n\n- `list_receivables(threshold: float = None)`:  \n  Lists all receivable blocks, sorted by the amount in descending order. A threshold can be used to filter the results.\n\n- `refund_first_sender()`:  \n  Receives all receivable blocks and sends the entire funds back to the first sender (i.e., the account opener or eldest unreceived block).\n\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request or create an issue for any bugs or feature requests.\n\n## License\n\nThis project is licensed under an open-source license that allows free use and modification for both commercial and private use. For more details, please see the LICENSE file in the repository.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "async nano library for easy account management",
    "version": "0.0.18",
    "project_urls": {
        "Homepage": "https://github.com/gr0vity-dev/nanowallet_py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6ca682cf1c7c619236f8637bb25061aedf72f92da3427f5e73fd330257e3962",
                "md5": "d29d02158a402a17f9839c4363899d79",
                "sha256": "915ac31d0f9622eab009b09b5ace99c9164bf1d66e2701aec18f084d9557535c"
            },
            "downloads": -1,
            "filename": "nanowallet-0.0.18-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d29d02158a402a17f9839c4363899d79",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11622,
            "upload_time": "2024-12-28T20:58:04",
            "upload_time_iso_8601": "2024-12-28T20:58:04.788260Z",
            "url": "https://files.pythonhosted.org/packages/c6/ca/682cf1c7c619236f8637bb25061aedf72f92da3427f5e73fd330257e3962/nanowallet-0.0.18-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6ccd10c63b8d1b527771731c0e5bf1b97da87737bc18566d33080a6afba86d9",
                "md5": "a91e58d6130e41ea1854823b3f87f982",
                "sha256": "6ae51eb1ed23249286721ffbf964748eaf15ebbe1e92529bcd9410a6989dbf3f"
            },
            "downloads": -1,
            "filename": "nanowallet-0.0.18.tar.gz",
            "has_sig": false,
            "md5_digest": "a91e58d6130e41ea1854823b3f87f982",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 18479,
            "upload_time": "2024-12-28T20:58:07",
            "upload_time_iso_8601": "2024-12-28T20:58:07.052688Z",
            "url": "https://files.pythonhosted.org/packages/f6/cc/d10c63b8d1b527771731c0e5bf1b97da87737bc18566d33080a6afba86d9/nanowallet-0.0.18.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-28 20:58:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gr0vity-dev",
    "github_project": "nanowallet_py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "nano_lib_py",
            "specs": []
        },
        {
            "name": "nanorpc",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        }
    ],
    "lcname": "nanowallet"
}
        
Elapsed time: 0.38060s