aioeosabi


Nameaioeosabi JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/MajicGit/aioeos
SummaryAsync library for interacting with EOS.io blockchain
upload_time2024-02-22 12:27:33
maintainer
docs_urlNone
authorMajicGit
requires_python>=3.8,<4.0
licenseMIT
keywords blockchain eos async eosio cryptocurrency
VCS
bugtrack_url
requirements aiohttp base58 ecdsa antelopy pycryptodome sphinx sphinx_rtd_theme sphinx_autodoc_typehints
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aioeosabi
Updated version of aioeos to no longer rely on API calls to serialize data. Integrates https://github.com/stuckatsixpm/antelopy to serialize instead.
Should be usable as a drop-in replacement for the original aioeos.

For Documentation: See the original aioeos Docs. Only difference is that `sign_and_push_transaction` now lets you specify if you want to use a stored ABI or fetch a new one. Also two new helper functions. 

- smart_sign_and_push_transaction: Signs and pushes a transaction using the cached ABI, refetching the ABI if the first try fails.

- push_actions: Pushed out a transaction, trying out various endpoints until one succeeds. 

[![Documentation Status](https://readthedocs.org/projects/aioeos/badge/?version=latest)](http://aioeos.readthedocs.io/en/latest/?badge=latest)  ![Python package](https://github.com/ulamlabs/aioeos/workflows/Python%20package/badge.svg) ![Upload Python Package](https://github.com/ulamlabs/aioeos/workflows/Upload%20Python%20Package/badge.svg)

Async Python library for interacting with EOS.io blockchain. 

## Features

1. Async JSON-RPC client.
2. Signing and verifying transactions using private and public keys.
3. Serializer for basic EOS.io blockchain ABI types.
4. Helpers which provide an easy way to generate common actions, such as token
   transfer.

## Installation

Library is available on PyPi, you can simply install it using `pip`.
```shell
$ pip install aioeosabi
```

## Usage

### Importing a private key

```python
from aioeosabi import EosAccount

account = EosAccount(private_key='your key')
```

### Transferring funds

```python
from aioeosabi import EosJsonRpc, EosTransaction
from aioeosabi.contracts import eosio_token


rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

transaction = EosTransaction(
   ref_block_num=block['block_num'] & 65535,
   ref_block_prefix=block['ref_block_prefix'],
   actions=[
      eosio_token.transfer(
         from_addr=account.name,
         to_addr='mysecondacc1',
         quantity='1.0000 EOS',
         authorization=[account.authorization('active')]
      )
   ]
)
await rpc.sign_and_push_transaction(transaction, keys=[account.key])
```

### Creating a new account

```python
from aioeosabi import EosJsonRpc, EosTransaction, EosAuthority
from aioeosabi.contracts import eosio


main_account = EosAccount(name='mainaccount1', private_key='private key')
new_account = EosAccount(name='mysecondacc1')
owner = EosAuthority(
   threshold=1,
   keys=[new_account.key.to_key_weight(1)]
)

rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

await rpc.sign_and_push_transaction(
   EosTransaction(
      ref_block_num=block['block_num'] & 65535,
      ref_block_prefix=block['ref_block_prefix'],
      actions=[
            eosio.newaccount(
               main_account.name,
               new_account.name,
               owner=owner,
               authorization=[main_account.authorization('active')]
            ),
            eosio.buyrambytes(
               main_account.name,
               new_account.name,
               2048,
               authorization=[main_account.authorization('active')]
            )
      ],
   ),
   keys=[main_account.key]
)
```

## Documentation

Docs and usage examples are available [here](https://aioeos.readthedocs.io/en/latest).

## Unit testing

To run unit tests, you need to bootstrap an EOS testnet node first. Use the provided `ensure_eosio.sh` script.

```shell
$ ./ensure_eosio.sh
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MajicGit/aioeos",
    "name": "aioeosabi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "blockchain,eos,async,eosio,cryptocurrency",
    "author": "MajicGit",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/e9/3b/a952f3642f03e405f870af5dc281fdb290d039cbf4e5946e0c188be9a4c2/aioeosabi-0.1.2.tar.gz",
    "platform": null,
    "description": "# aioeosabi\nUpdated version of aioeos to no longer rely on API calls to serialize data. Integrates https://github.com/stuckatsixpm/antelopy to serialize instead.\nShould be usable as a drop-in replacement for the original aioeos.\n\nFor Documentation: See the original aioeos Docs. Only difference is that `sign_and_push_transaction` now lets you specify if you want to use a stored ABI or fetch a new one. Also two new helper functions. \n\n- smart_sign_and_push_transaction: Signs and pushes a transaction using the cached ABI, refetching the ABI if the first try fails.\n\n- push_actions: Pushed out a transaction, trying out various endpoints until one succeeds. \n\n[![Documentation Status](https://readthedocs.org/projects/aioeos/badge/?version=latest)](http://aioeos.readthedocs.io/en/latest/?badge=latest)  ![Python package](https://github.com/ulamlabs/aioeos/workflows/Python%20package/badge.svg) ![Upload Python Package](https://github.com/ulamlabs/aioeos/workflows/Upload%20Python%20Package/badge.svg)\n\nAsync Python library for interacting with EOS.io blockchain. \n\n## Features\n\n1. Async JSON-RPC client.\n2. Signing and verifying transactions using private and public keys.\n3. Serializer for basic EOS.io blockchain ABI types.\n4. Helpers which provide an easy way to generate common actions, such as token\n   transfer.\n\n## Installation\n\nLibrary is available on PyPi, you can simply install it using `pip`.\n```shell\n$ pip install aioeosabi\n```\n\n## Usage\n\n### Importing a private key\n\n```python\nfrom aioeosabi import EosAccount\n\naccount = EosAccount(private_key='your key')\n```\n\n### Transferring funds\n\n```python\nfrom aioeosabi import EosJsonRpc, EosTransaction\nfrom aioeosabi.contracts import eosio_token\n\n\nrpc = EosJsonRpc(url='http://127.0.0.1:8888')\nblock = await rpc.get_head_block()\n\ntransaction = EosTransaction(\n   ref_block_num=block['block_num'] & 65535,\n   ref_block_prefix=block['ref_block_prefix'],\n   actions=[\n      eosio_token.transfer(\n         from_addr=account.name,\n         to_addr='mysecondacc1',\n         quantity='1.0000 EOS',\n         authorization=[account.authorization('active')]\n      )\n   ]\n)\nawait rpc.sign_and_push_transaction(transaction, keys=[account.key])\n```\n\n### Creating a new account\n\n```python\nfrom aioeosabi import EosJsonRpc, EosTransaction, EosAuthority\nfrom aioeosabi.contracts import eosio\n\n\nmain_account = EosAccount(name='mainaccount1', private_key='private key')\nnew_account = EosAccount(name='mysecondacc1')\nowner = EosAuthority(\n   threshold=1,\n   keys=[new_account.key.to_key_weight(1)]\n)\n\nrpc = EosJsonRpc(url='http://127.0.0.1:8888')\nblock = await rpc.get_head_block()\n\nawait rpc.sign_and_push_transaction(\n   EosTransaction(\n      ref_block_num=block['block_num'] & 65535,\n      ref_block_prefix=block['ref_block_prefix'],\n      actions=[\n            eosio.newaccount(\n               main_account.name,\n               new_account.name,\n               owner=owner,\n               authorization=[main_account.authorization('active')]\n            ),\n            eosio.buyrambytes(\n               main_account.name,\n               new_account.name,\n               2048,\n               authorization=[main_account.authorization('active')]\n            )\n      ],\n   ),\n   keys=[main_account.key]\n)\n```\n\n## Documentation\n\nDocs and usage examples are available [here](https://aioeos.readthedocs.io/en/latest).\n\n## Unit testing\n\nTo run unit tests, you need to bootstrap an EOS testnet node first. Use the provided `ensure_eosio.sh` script.\n\n```shell\n$ ./ensure_eosio.sh\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async library for interacting with EOS.io blockchain",
    "version": "0.1.2",
    "project_urls": {
        "Documentation": "https://aioeos.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/MajicGit/aioeos",
        "Repository": "https://github.com/MajicGit/aioeos"
    },
    "split_keywords": [
        "blockchain",
        "eos",
        "async",
        "eosio",
        "cryptocurrency"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f364acc875bbbff8cf126e7f0b8adb044ae2547603321f3081e0452cc7ceb92",
                "md5": "fbef7967503f7aec065c68a3d7d9df4e",
                "sha256": "00288f5f3af5885a3d5521f683bf3d3902b11c8dda84cb083011e0c3e5118ad5"
            },
            "downloads": -1,
            "filename": "aioeosabi-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fbef7967503f7aec065c68a3d7d9df4e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 18042,
            "upload_time": "2024-02-22T12:27:31",
            "upload_time_iso_8601": "2024-02-22T12:27:31.531882Z",
            "url": "https://files.pythonhosted.org/packages/0f/36/4acc875bbbff8cf126e7f0b8adb044ae2547603321f3081e0452cc7ceb92/aioeosabi-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e93ba952f3642f03e405f870af5dc281fdb290d039cbf4e5946e0c188be9a4c2",
                "md5": "5560bf7acc0e3db357dabf96e59bb05c",
                "sha256": "62c05a4b45dfcda42541b9eb04d8a63238807a497d7e42599ddd252895cdfe22"
            },
            "downloads": -1,
            "filename": "aioeosabi-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5560bf7acc0e3db357dabf96e59bb05c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 15437,
            "upload_time": "2024-02-22T12:27:33",
            "upload_time_iso_8601": "2024-02-22T12:27:33.164401Z",
            "url": "https://files.pythonhosted.org/packages/e9/3b/a952f3642f03e405f870af5dc281fdb290d039cbf4e5946e0c188be9a4c2/aioeosabi-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 12:27:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MajicGit",
    "github_project": "aioeos",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": [
                [
                    "==",
                    "3.8.0"
                ]
            ]
        },
        {
            "name": "base58",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "ecdsa",
            "specs": [
                [
                    "==",
                    "0.15.0"
                ]
            ]
        },
        {
            "name": "antelopy",
            "specs": [
                [
                    "==",
                    "0.2.0"
                ]
            ]
        },
        {
            "name": "pycryptodome",
            "specs": []
        },
        {
            "name": "sphinx",
            "specs": [
                [
                    "==",
                    "2.4.4"
                ]
            ]
        },
        {
            "name": "sphinx_rtd_theme",
            "specs": [
                [
                    "==",
                    "0.4.3"
                ]
            ]
        },
        {
            "name": "sphinx_autodoc_typehints",
            "specs": [
                [
                    "==",
                    "1.10.3"
                ]
            ]
        }
    ],
    "lcname": "aioeosabi"
}
        
Elapsed time: 0.47688s