{"id":26189066,"url":"https://github.com/pvolnov/py-near","last_synced_at":"2025-04-06T12:11:38.163Z","repository":{"id":64431438,"uuid":"575247124","full_name":"pvolnov/py-near","owner":"pvolnov","description":"Python high-level framework for NEAR Protocol","archived":false,"fork":false,"pushed_at":"2024-05-23T04:12:48.000Z","size":131,"stargazers_count":144,"open_issues_count":13,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-23T05:50:41.511Z","etag":null,"topics":["asynchronous","near","near-protocol","nearprotocol","python","web3py"],"latest_commit_sha":null,"homepage":"https://py-near.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pvolnov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-07T04:29:42.000Z","updated_at":"2024-08-09T09:01:01.779Z","dependencies_parsed_at":"2023-02-14T03:45:55.826Z","dependency_job_id":"bab56e80-149d-438a-9b4c-cf9fb8f5c2f5","html_url":"https://github.com/pvolnov/py-near","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvolnov%2Fpy-near","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvolnov%2Fpy-near/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvolnov%2Fpy-near/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pvolnov%2Fpy-near/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pvolnov","download_url":"https://codeload.github.com/pvolnov/py-near/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478324,"owners_count":20945266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","near","near-protocol","nearprotocol","python","web3py"],"created_at":"2025-03-12T00:30:11.913Z","updated_at":"2025-04-06T12:11:38.138Z","avatar_url":"https://github.com/pvolnov.png","language":"Python","funding_links":["https://opencollective.com/py-near"],"categories":[],"sub_categories":[],"readme":"# py-near\n\n[![Financial Contributors on Open Collective](https://opencollective.com/py-near/all/badge.svg?style=flat-square)](https://opencollective.com/py-near) \n[![PyPi Package Version](https://img.shields.io/pypi/v/py-near?style=flat-square)](https://pypi.org/project/py-near)\n[![Supported python versions](https://img.shields.io/pypi/pyversions/py-near)](https://pypi.python.org/pypi/py-near)\n[![Documentation Status](https://img.shields.io/readthedocs/py-near?style=flat-square)](https://py-near.readthedocs.io/en/latest)\n[![Github issues](https://img.shields.io/github/issues/pvolnov/py-near.svg?style=flat-square)](https://github.com/pvolnov/py-near/issues)\n[![MIT License](https://img.shields.io/pypi/l/py-near.svg?style=flat-square?style=flat-square)](https://opensource.org/licenses/MIT)\n[![Twitter](https://img.shields.io/twitter/follow/p_volnov?label=Follow)](https://twitter.com/p_volnov)\n\n[//]: # ([![downloads]\u0026#40;https://img.shields.io/github/downloads/pvolnov/py-near/total?style=flat-square\u0026#41;]\u0026#40;https://pypi.org/project/py-near\u0026#41;)\n\n\n**py-near** is a pretty simple and fully asynchronous framework for working with NEAR blockchain.\n\n## Examples\n\u003cdetails\u003e\n  \u003csummary\u003e📚 Click to see some basic examples\u003c/summary\u003e\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\u003c/details\u003e\n\n\n## Official py-near resources:\n - News: [@herewallet](https://t.me/herewallet)\n - Social media:\n   - 🇺🇸 [Telegram](https://t.me/neafiol)\n   - 🇺🇸 [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\u003ca href=\"https://github.com/pvolnov/py-near/graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/py-near/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvolnov%2Fpy-near","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpvolnov%2Fpy-near","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpvolnov%2Fpy-near/lists"}