autonity


Nameautonity JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryPython library for interacting with Autonity
upload_time2023-05-26 12:39:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords autonity client library rpc web3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Introduction

[Autonity](https://autonity.org) is a protocol that provides smart contract and settlement infrastructure specialized for developing new risk markets.  It is a fork of the [Ethereum protocol](https://ethereum.org/).  See the [Autonity documentation](https://docs.autonity.org) for further information.

This package provides typed wrappers around the Autonity-specific extensions of Ethereum, using the [Web3.py](https://github.com/ethereum/web3.py) framework, for convenient and statically checked interactions with the Autonity network.

# Installation

```console
pip install git+https://github.com/autonity/autonity.py
```

# Usage

The primary utility of this library is the typed wrappers around the Autonity protocol contract, which provides access to Autonity-specific functionality.

```python
from autonity.utils.web3 import create_web3_for_endpoint
from autonity import Autonity, Validator

w3 = create_web3_for_endpoint("<RPC_ENDPOINT>")

# Create the typed wrapper around the Autonity contract.
autonity = Autonity(w3)

# Get total supply of Newton
ntn_supply = autonity.total_supply()

# Get the current validator list
validator_ids = autonity.get_validators()

# Get descriptor for the 0-th validator.  Print LNEW contract address.
validator_desc_0 = autonity.get_validator(validator_ids[0])
print(f"LNEW contract addr: {validator_desc_0.liquid_contract}")

# Typed validator Liquid Newton contract.  Query unclaimed fees for <ADDRESS>.
validator_0 = Validator(w3, validator_desc_0)
unclaimed_rewards = validator_0.unclaimed_rewards("<ADDRESS>")
print(f"unclaimed rewards: {unclaimed_rewards}")
```

Where`<RPC_ENDPOINT>` is the name of the Autonity network being connected to. See https://docs.autonity.org/networks/ for information about specific networks.

# Development

The project uses [hatch](https://hatch.pypa.io/latest/install/#pipx) as build tool.

## Test and linting

For linting use the command:

```console 
make lint
```

To run the test with coverage report use the command:
```
make coverage
```

## Updating the contract ABIs

The script `script/update_abi` generates the contract ABIs using `solc`. Keys are ordered via the `jq` tool, in order to produce deterministic output, and the results written to the `autonity/abi` directory.  Further, it also records the version of solc and the commit used in files in the same directory.

The autonity contract version being compiled is set in the `update_abi` script, to build a different version, it is necessary to set the variable
`AUTONITY_NODE_COMMIT` with the desired git commit hash.

After executing the script against a new version of the code, the diffs can be reviewed to determine which methods have been modified, removed or added.

To run the script use

```console
make update-abi
```

## Reporting a Vulnerability

**Please do not file a public ticket** mentioning the vulnerability.

Instead, please send an email to <security@autonity.org> to report a security issue.

The following PGP key may be used to communicate sensitive information to developers:

Fingerprint: `6006 CCC3 DD11 7885 1A23 4290 7486 F832 6320 219E`

```
-----BEGIN PGP PUBLIC KEY BLOCK-----

xsFNBGL7epsBEADHxcFdpX1a60JFFN4jW3VtvofLFNXAHKT4GlOtIayozySdZI2A
fGRg2brbYdXdlHN3MYZJbMo/kIfMlYqiVFevEtNGDEGKYmqzXiad7RRpmxYyjzhH
VfkMd7V9wjEKiU9jL/GIDEXF32ZQbHwtvT3GRAd9NyPsjF3V8tzF4C5Da2zrSX17
K8jn5Tfi3OLHm2r0oyNaV4MAZD4usXSnvUbKPMe5OALv64oZd+1uSIv2qdZ1HPqs
VLiDSXcY31FkB3Wfc0oeT2rlvqsujFQC1hicI6hXI1e4LpTbXrhQjLzbMfXmrXuC
oqkN4M1aBUpm83M/AbMCBxhJU7ph4n3bmUEK28sX+5iaQZA6jPcH1DvKExO6WPqI
RNMKceYHO1/FILL33fy/Hzo8ehL9n3oYLIJrbDjtiPlB9l5ukPQC51fQCohPnNOh
mZX3XmXeS+SeEwTc/sbS3Wg6BzlbQ+sANN8baOHfdKjKgBo6prE7VaAD/D7+xAXF
XS5uibh01XDHmgmmlzXDtbbTzig2ei2cuRkbHvhZaN95asarSVMjNBLE2pwW2o01
f2lWepfCZCPsB7wEhK/QT2MW+IE8n0eHkty2oYHWHDrM6CnZaP2uST/Kv4UoggP5
cnf3kPnCx63eM8oF9BSv1wChJ/fKFVAmjJ1G45vDrl1QMddARcnfEqvhWwARAQAB
zTFBdXRvbml0eSBQcm9qZ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/CCXWX5uvxeVGrwmvrARfnyOpyR9W0MzJ5xi7n5I
B1LUp7ycX/NeWHviWALjz1ObHeipvErh2n2iD/8swWez6eho1BDJ9sf8hz/gVJbR
dNvOgvIvgW1Bcibq3uqiigQnFYo15bmfIDRCJCBCmqf4Xb8Ip+m/QrLf92KIcDRc
VtiVUMzKBEpmz4LdeSy73Qfr
=12PL
-----END PGP PUBLIC KEY BLOCK-----
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "autonity",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "autonity,client,library,rpc,web3",
    "author": null,
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# Introduction\n\n[Autonity](https://autonity.org) is a protocol that provides smart contract and settlement infrastructure specialized for developing new risk markets.  It is a fork of the [Ethereum protocol](https://ethereum.org/).  See the [Autonity documentation](https://docs.autonity.org) for further information.\n\nThis package provides typed wrappers around the Autonity-specific extensions of Ethereum, using the [Web3.py](https://github.com/ethereum/web3.py) framework, for convenient and statically checked interactions with the Autonity network.\n\n# Installation\n\n```console\npip install git+https://github.com/autonity/autonity.py\n```\n\n# Usage\n\nThe primary utility of this library is the typed wrappers around the Autonity protocol contract, which provides access to Autonity-specific functionality.\n\n```python\nfrom autonity.utils.web3 import create_web3_for_endpoint\nfrom autonity import Autonity, Validator\n\nw3 = create_web3_for_endpoint(\"<RPC_ENDPOINT>\")\n\n# Create the typed wrapper around the Autonity contract.\nautonity = Autonity(w3)\n\n# Get total supply of Newton\nntn_supply = autonity.total_supply()\n\n# Get the current validator list\nvalidator_ids = autonity.get_validators()\n\n# Get descriptor for the 0-th validator.  Print LNEW contract address.\nvalidator_desc_0 = autonity.get_validator(validator_ids[0])\nprint(f\"LNEW contract addr: {validator_desc_0.liquid_contract}\")\n\n# Typed validator Liquid Newton contract.  Query unclaimed fees for <ADDRESS>.\nvalidator_0 = Validator(w3, validator_desc_0)\nunclaimed_rewards = validator_0.unclaimed_rewards(\"<ADDRESS>\")\nprint(f\"unclaimed rewards: {unclaimed_rewards}\")\n```\n\nWhere`<RPC_ENDPOINT>` is the name of the Autonity network being connected to. See https://docs.autonity.org/networks/ for information about specific networks.\n\n# Development\n\nThe project uses [hatch](https://hatch.pypa.io/latest/install/#pipx) as build tool.\n\n## Test and linting\n\nFor linting use the command:\n\n```console \nmake lint\n```\n\nTo run the test with coverage report use the command:\n```\nmake coverage\n```\n\n## Updating the contract ABIs\n\nThe script `script/update_abi` generates the contract ABIs using `solc`. Keys are ordered via the `jq` tool, in order to produce deterministic output, and the results written to the `autonity/abi` directory.  Further, it also records the version of solc and the commit used in files in the same directory.\n\nThe autonity contract version being compiled is set in the `update_abi` script, to build a different version, it is necessary to set the variable\n`AUTONITY_NODE_COMMIT` with the desired git commit hash.\n\nAfter executing the script against a new version of the code, the diffs can be reviewed to determine which methods have been modified, removed or added.\n\nTo run the script use\n\n```console\nmake update-abi\n```\n\n## Reporting a Vulnerability\n\n**Please do not file a public ticket** mentioning the vulnerability.\n\nInstead, please send an email to <security@autonity.org> to report a security issue.\n\nThe following PGP key may be used to communicate sensitive information to developers:\n\nFingerprint: `6006 CCC3 DD11 7885 1A23 4290 7486 F832 6320 219E`\n\n```\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsFNBGL7epsBEADHxcFdpX1a60JFFN4jW3VtvofLFNXAHKT4GlOtIayozySdZI2A\nfGRg2brbYdXdlHN3MYZJbMo/kIfMlYqiVFevEtNGDEGKYmqzXiad7RRpmxYyjzhH\nVfkMd7V9wjEKiU9jL/GIDEXF32ZQbHwtvT3GRAd9NyPsjF3V8tzF4C5Da2zrSX17\nK8jn5Tfi3OLHm2r0oyNaV4MAZD4usXSnvUbKPMe5OALv64oZd+1uSIv2qdZ1HPqs\nVLiDSXcY31FkB3Wfc0oeT2rlvqsujFQC1hicI6hXI1e4LpTbXrhQjLzbMfXmrXuC\noqkN4M1aBUpm83M/AbMCBxhJU7ph4n3bmUEK28sX+5iaQZ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cAWNEQFR6pWGgiPonxSaTN4Cw2f1vKekhxAYXrbm\n7sqEKZl+59D8uzHA0QSORP8FKpextccCtiL2L5b3ttGmrjGiXeL1wm1iWHxuOksm\nOpGFz6WgVZS1MYuomyBb/tm8MOsPabODmW3kJDUd1DcxO99ZFP72IERBTKqonKLW\nVCTV8Evv2agpTwTiP7TxGnl9ep5ZxkXAnQUXMwfVBYg0uGmmMhdcQ2n8wh6f1aR2\nGksOuLSMQTC/RNNHOnS0xTKrlh0uQ5fF0WZJaUpUXjHxCjiBAXUdlwXJET+S2t7H\njLXA1MdBmJp7ymBVRqQQguaH5G2dciSEG/iqMLH76u7c+L1w+esGpwbSu1OH+wd7\n7ys9vJxxJIqch8mzKlRTun+M/CCXWX5uvxeVGrwmvrARfnyOpyR9W0MzJ5xi7n5I\nB1LUp7ycX/NeWHviWALjz1ObHeipvErh2n2iD/8swWez6eho1BDJ9sf8hz/gVJbR\ndNvOgvIvgW1Bcibq3uqiigQnFYo15bmfIDRCJCBCmqf4Xb8Ip+m/QrLf92KIcDRc\nVtiVUMzKBEpmz4LdeSy73Qfr\n=12PL\n-----END PGP PUBLIC KEY BLOCK-----\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for interacting with Autonity",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "autonity",
        "client",
        "library",
        "rpc",
        "web3"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "74c17cc8c3ba072f115536677880a0ac66df7b70caad4cf919ba2cb48419d1fd",
                "md5": "bfe3f6f060938bc175a97b7c9388761b",
                "sha256": "4e7b2e86c90241b9b944e82189651c190676afd5487cb5b4e1a69a51f740828a"
            },
            "downloads": -1,
            "filename": "autonity-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bfe3f6f060938bc175a97b7c9388761b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 28044,
            "upload_time": "2023-05-26T12:39:50",
            "upload_time_iso_8601": "2023-05-26T12:39:50.836355Z",
            "url": "https://files.pythonhosted.org/packages/74/c1/7cc8c3ba072f115536677880a0ac66df7b70caad4cf919ba2cb48419d1fd/autonity-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-26 12:39:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "autonity"
}
        
Elapsed time: 0.11565s