Name | py-near JSON |
Version |
1.1.59
JSON |
| download |
home_page | None |
Summary | Pretty simple and fully asynchronous framework for working with NEAR blockchain |
upload_time | 2025-08-18 22:42:19 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
|
keywords |
python
near
async
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# py-near
[](https://opencollective.com/py-near)
[](https://pypi.org/project/py-near)
[](https://pypi.python.org/pypi/py-near)
[](https://py-near.readthedocs.io/en/latest)
[](https://github.com/pvolnov/py-near/issues)
[](https://opensource.org/licenses/MIT)
[](https://twitter.com/p_volnov)
[//]: # ([](https://pypi.org/project/py-near))
**py-near** is a pretty simple and fully asynchronous framework for working with NEAR blockchain.
## Examples
<details>
<summary>π Click to see some basic examples</summary>
**Few steps before getting started...**
- Install the latest stable version of py-near, simply running `pip install py-near`
- Create NEAR account and get your private key [wallet](https://wallet.near.org/create)
### Simple money transfer
```python
from py_near.account import Account
import asyncio
from py_near.dapps.core import NEAR
ACCOUNT_ID = "bob.near"
PRIVATE_KEY = "ed25519:..."
async def main():
acc = Account(ACCOUNT_ID, PRIVATE_KEY)
await acc.startup()
print(await acc.get_balance() / NEAR)
print(await acc.get_balance("bob.near") / NEAR)
tr = await acc.send_money("bob.near", NEAR * 2)
print(tr.transaction.hash)
print(tr.logs)
asyncio.run(main())
```
### Transfer money by phone number
```python
from py_near.account import Account
import asyncio
from py_near.dapps.core import NEAR
ACCOUNT_ID = "bob.near"
PRIVATE_KEY = "ed25519:..."
async def main():
acc = Account(ACCOUNT_ID, PRIVATE_KEY)
await acc.startup()
tr = await acc.phone.send_near_to_phone("+15626200911", NEAR // 10)
print(tr.transaction.hash)
asyncio.run(main())
```
### Parallel requests
Only one parallel request can be made from one private key.
All transaction calls execute sequentially.
To make several parallel calls you need to use several private keys
```python3
acc = Account("bob.near", private_key1)
for i in range(2):
signer = InMemorySigner.from_random(AccountId("bob.near"), KeyType.ED25519)
await acc.add_full_access_public_key(str(signer.public_key))
print(signer.secret_key)
```
Now we can call transactions in parallel
```python3
acc = Account("bob.near", [private_key1, private_key2, private_key3])
# request time = count transactions / count public keys
tasks = [
asyncio.create_task(acc.send_money("alisa.near", 1)),
asyncio.create_task(acc.send_money("alisa.near", 1)),
asyncio.create_task(acc.send_money("alisa.near", 1)),
]
for t in task:
await t
```
</details>
## Official py-near resources:
- News: [@herewallet](https://t.me/herewallet)
- Social media:
- πΊπΈ [Telegram](https://t.me/neafiol)
- πΊπΈ [Twitter](https://twitter.com/p_volnov)
- PyPI: [py-near](https://pypi.python.org/pypi/py-near)
- Documentation: [py-near.readthedocs.io](https://py-near.readthedocs.io/en/latest)
- Source: [Github repo](https://github.com/pvolnov/py-near)
- Issues/Bug tracker: [Github issues tracker](https://github.com/pvolnov/py-near/issues)
## Contributors
### Code Contributors
This project exists thanks to all the people who contribute. [[Code of conduct](CODE_OF_CONDUCT.md)].
<a href="https://github.com/pvolnov/py-near/graphs/contributors"><img src="https://opencollective.com/py-near/contributors.svg?width=890&button=false" /></a>
Raw data
{
"_id": null,
"home_page": null,
"name": "py-near",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, near, async",
"author": null,
"author_email": "pvolnov <petr@herewallet.app>",
"download_url": "https://files.pythonhosted.org/packages/9f/4f/0f18243f5f43034f99d53a72013d4acf098616033f00a81222ebcd892dc4/py_near-1.1.59.tar.gz",
"platform": null,
"description": "# py-near\n\n[](https://opencollective.com/py-near) \n[](https://pypi.org/project/py-near)\n[](https://pypi.python.org/pypi/py-near)\n[](https://py-near.readthedocs.io/en/latest)\n[](https://github.com/pvolnov/py-near/issues)\n[](https://opensource.org/licenses/MIT)\n[](https://twitter.com/p_volnov)\n\n[//]: # ([](https://pypi.org/project/py-near))\n\n\n**py-near** is a pretty simple and fully asynchronous framework for working with NEAR blockchain.\n\n## Examples\n<details>\n <summary>\ud83d\udcda Click to see some basic examples</summary>\n\n\n**Few steps before getting started...**\n- Install the latest stable version of py-near, simply running `pip install py-near`\n- Create NEAR account and get your private key [wallet](https://wallet.near.org/create)\n\n### Simple money transfer\n\n```python\nfrom py_near.account import Account\nimport asyncio\nfrom py_near.dapps.core import NEAR\n\nACCOUNT_ID = \"bob.near\"\nPRIVATE_KEY = \"ed25519:...\"\n\n\nasync def main():\n acc = Account(ACCOUNT_ID, PRIVATE_KEY)\n\n await acc.startup()\n print(await acc.get_balance() / NEAR)\n print(await acc.get_balance(\"bob.near\") / NEAR)\n\n tr = await acc.send_money(\"bob.near\", NEAR * 2)\n print(tr.transaction.hash)\n print(tr.logs)\n\n\nasyncio.run(main())\n```\n\n### Transfer money by phone number\n\n```python\nfrom py_near.account import Account\nimport asyncio\nfrom py_near.dapps.core import NEAR\n\nACCOUNT_ID = \"bob.near\"\nPRIVATE_KEY = \"ed25519:...\"\n\n\nasync def main():\n acc = Account(ACCOUNT_ID, PRIVATE_KEY)\n\n await acc.startup()\n tr = await acc.phone.send_near_to_phone(\"+15626200911\", NEAR // 10)\n print(tr.transaction.hash)\n\n\nasyncio.run(main())\n```\n\n### Parallel requests\n\nOnly one parallel request can be made from one private key.\nAll transaction calls execute sequentially.\nTo make several parallel calls you need to use several private keys\n\n\n\n```python3\nacc = Account(\"bob.near\", private_key1)\n\nfor i in range(2):\n signer = InMemorySigner.from_random(AccountId(\"bob.near\"), KeyType.ED25519)\n await acc.add_full_access_public_key(str(signer.public_key))\n print(signer.secret_key)\n```\n\nNow we can call transactions in parallel\n\n```python3\nacc = Account(\"bob.near\", [private_key1, private_key2, private_key3])\n# request time = count transactions / count public keys\ntasks = [\n asyncio.create_task(acc.send_money(\"alisa.near\", 1)),\n asyncio.create_task(acc.send_money(\"alisa.near\", 1)),\n asyncio.create_task(acc.send_money(\"alisa.near\", 1)),\n]\nfor t in task:\n await t\n```\n\n</details>\n\n\n## Official py-near resources:\n - News: [@herewallet](https://t.me/herewallet)\n - Social media:\n - \ud83c\uddfa\ud83c\uddf8 [Telegram](https://t.me/neafiol)\n - \ud83c\uddfa\ud83c\uddf8 [Twitter](https://twitter.com/p_volnov)\n - PyPI: [py-near](https://pypi.python.org/pypi/py-near)\n - Documentation: [py-near.readthedocs.io](https://py-near.readthedocs.io/en/latest)\n - Source: [Github repo](https://github.com/pvolnov/py-near)\n - Issues/Bug tracker: [Github issues tracker](https://github.com/pvolnov/py-near/issues)\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Code of conduct](CODE_OF_CONDUCT.md)].\n<a href=\"https://github.com/pvolnov/py-near/graphs/contributors\"><img src=\"https://opencollective.com/py-near/contributors.svg?width=890&button=false\" /></a>\n",
"bugtrack_url": null,
"license": "Permission is hereby granted, free of charge, to any\n person obtaining a copy of this software and associated\n documentation files (the \"Software\"), to deal in the\n Software without restriction, including without\n limitation the rights to use, copy, modify, merge,\n publish, distribute, sublicense, and/or sell copies of\n the Software, and to permit persons to whom the Software\n is furnished to do so, subject to the following\n conditions:\n \n The above copyright notice and this permission notice\n shall be included in all copies or substantial portions\n of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\n ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\n TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\n IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n DEALINGS IN THE SOFTWARE.\n ",
"summary": "Pretty simple and fully asynchronous framework for working with NEAR blockchain",
"version": "1.1.59",
"project_urls": {
"changelog": "https://github.com/pvolnov/py-near/blob/main/CHANGELOG.md",
"documentation": "https://py-near.readthedocs.io/en/latest",
"funding": "https://opencollective.com/py-near",
"homepage": "https://github.com/pvolnov/py-near",
"repository": "https://github.com/pvolnov/py-near",
"twitter": "https://twitter.com/p_volnov"
},
"split_keywords": [
"python",
" near",
" async"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "51b7bb2dd05905974b04cb920b366e5e1679a53878a4f7d498945000f796de29",
"md5": "6c85df047117cc2ba993e5d72eb352bc",
"sha256": "069f85e127bdf668b8a665c34274c0afd54c71d6120f2ab567d7b63fbaa7be0a"
},
"downloads": -1,
"filename": "py_near-1.1.59-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c85df047117cc2ba993e5d72eb352bc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 33723,
"upload_time": "2025-08-18T22:42:15",
"upload_time_iso_8601": "2025-08-18T22:42:15.782730Z",
"url": "https://files.pythonhosted.org/packages/51/b7/bb2dd05905974b04cb920b366e5e1679a53878a4f7d498945000f796de29/py_near-1.1.59-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9f4f0f18243f5f43034f99d53a72013d4acf098616033f00a81222ebcd892dc4",
"md5": "66bb61a0d451e63b3bff00f1ce8b5ee7",
"sha256": "f15885a36132096ffb5cd771e9c454576ead51752b0259544cc40b72a3814646"
},
"downloads": -1,
"filename": "py_near-1.1.59.tar.gz",
"has_sig": false,
"md5_digest": "66bb61a0d451e63b3bff00f1ce8b5ee7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27488,
"upload_time": "2025-08-18T22:42:19",
"upload_time_iso_8601": "2025-08-18T22:42:19.577327Z",
"url": "https://files.pythonhosted.org/packages/9f/4f/0f18243f5f43034f99d53a72013d4acf098616033f00a81222ebcd892dc4/py_near-1.1.59.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 22:42:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pvolnov",
"github_project": "py-near",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "py-near"
}