ape-ens


Nameape-ens JSON
Version 0.8.1 PyPI version JSON
download
home_pagehttps://github.com/ApeWorX/ape-ens
Summaryape-ens: Ape plugin for ENS argument conversion and contracts
upload_time2024-12-09 22:04:58
maintainerNone
docs_urlNone
authorApeWorX Ltd.
requires_python<4,>=3.9
licenseApache-2.0
keywords ethereum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Quick Start

Ape plugin for ENS argument conversion and contracts

## Dependencies

- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.

## Installation

### via `pip`

You can install the latest release via [`pip`](https://pypi.org/project/pip/):

```bash
pip install ape-ens
```

### via `setuptools`

You can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:

```bash
git clone https://github.com/ApeWorX/ape-ens.git
cd ape-ens
python3 setup.py install
```

## Quick Usage

The ENS plugin requires a mainnet connection to resolve ENS names because ENS contracts are only deployed to mainnet.
Thus, the first thing you should do is ensure you have configured a mainnet provider.
For example, if you use `infura` or `alchemy`, install the associated plugin:

```bash
ape plugins install infura
```

Afterwards, you should see it in the output of the `list` command:

```bash
$ ape plugins list

Installed Plugins:
  infura      0.4.0
  ...
```

After your provider plugin of choice is installed, configure it to be your default mainnet provider in your `ape-config.yaml` file:

```yaml
ethereum:
  mainnet:
    default_provider: infura
```

Finally, you can start the ape console using any network of your choice:

```bash
ape console --network :rinkeby:infura
```

Then, convert an `ens` domain to an `AddressType`:

```python
In [1]: from ape.types import AddressType
In [2]: convert("vitalik.eth", AddressType)
Out[2]: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
```

Get the Ethereum Name Service (ENS) namehash using the `namehash` function:

```py
from ape_ens.utils import namehash
# or
# from ape_ens.utils.namehash import namehash
>> namehash("eth").hex()
"0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae"

>> namehash("foo.eth")
HexBytes("0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f")

>> namehash("ape.rocks.eth").hex()
"0x6294e43e29c5c1573554a68e6ff302fa867ab0d56b800f623c1abb77609d2b8d"
```

The ENS plugin temporarily connects to mainnet, caches the address resolution, and then your original network uses the result.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ApeWorX/ape-ens",
    "name": "ape-ens",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "ethereum",
    "author": "ApeWorX Ltd.",
    "author_email": "admin@apeworx.io",
    "download_url": "https://files.pythonhosted.org/packages/49/a6/f1bb5aeb6006999e659515bd4cfb8cd1a51ac68e9e1f5f5de3eb131848bc/ape_ens-0.8.1.tar.gz",
    "platform": null,
    "description": "# Quick Start\n\nApe plugin for ENS argument conversion and contracts\n\n## Dependencies\n\n- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.\n\n## Installation\n\n### via `pip`\n\nYou can install the latest release via [`pip`](https://pypi.org/project/pip/):\n\n```bash\npip install ape-ens\n```\n\n### via `setuptools`\n\nYou can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:\n\n```bash\ngit clone https://github.com/ApeWorX/ape-ens.git\ncd ape-ens\npython3 setup.py install\n```\n\n## Quick Usage\n\nThe ENS plugin requires a mainnet connection to resolve ENS names because ENS contracts are only deployed to mainnet.\nThus, the first thing you should do is ensure you have configured a mainnet provider.\nFor example, if you use `infura` or `alchemy`, install the associated plugin:\n\n```bash\nape plugins install infura\n```\n\nAfterwards, you should see it in the output of the `list` command:\n\n```bash\n$ ape plugins list\n\nInstalled Plugins:\n  infura      0.4.0\n  ...\n```\n\nAfter your provider plugin of choice is installed, configure it to be your default mainnet provider in your `ape-config.yaml` file:\n\n```yaml\nethereum:\n  mainnet:\n    default_provider: infura\n```\n\nFinally, you can start the ape console using any network of your choice:\n\n```bash\nape console --network :rinkeby:infura\n```\n\nThen, convert an `ens` domain to an `AddressType`:\n\n```python\nIn [1]: from ape.types import AddressType\nIn [2]: convert(\"vitalik.eth\", AddressType)\nOut[2]: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'\n```\n\nGet the Ethereum Name Service (ENS) namehash using the `namehash` function:\n\n```py\nfrom ape_ens.utils import namehash\n# or\n# from ape_ens.utils.namehash import namehash\n>> namehash(\"eth\").hex()\n\"0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae\"\n\n>> namehash(\"foo.eth\")\nHexBytes(\"0xde9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f\")\n\n>> namehash(\"ape.rocks.eth\").hex()\n\"0x6294e43e29c5c1573554a68e6ff302fa867ab0d56b800f623c1abb77609d2b8d\"\n```\n\nThe ENS plugin temporarily connects to mainnet, caches the address resolution, and then your original network uses the result.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "ape-ens: Ape plugin for ENS argument conversion and contracts",
    "version": "0.8.1",
    "project_urls": {
        "Homepage": "https://github.com/ApeWorX/ape-ens"
    },
    "split_keywords": [
        "ethereum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4fd377bdc5263ef64fa9183d9658804436822eb352dce9f90aaa0194bdc606aa",
                "md5": "1a59044246517c5cb9f54805b6b232e9",
                "sha256": "345719cb8a8c6d00668e97d3cd89676c700f7752d236013740739412945c05a3"
            },
            "downloads": -1,
            "filename": "ape_ens-0.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a59044246517c5cb9f54805b6b232e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 9921,
            "upload_time": "2024-12-09T22:04:56",
            "upload_time_iso_8601": "2024-12-09T22:04:56.339945Z",
            "url": "https://files.pythonhosted.org/packages/4f/d3/77bdc5263ef64fa9183d9658804436822eb352dce9f90aaa0194bdc606aa/ape_ens-0.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49a6f1bb5aeb6006999e659515bd4cfb8cd1a51ac68e9e1f5f5de3eb131848bc",
                "md5": "27ddb857ef921d4b12b4a30221c7e76b",
                "sha256": "dd6351e004d2c9863146c525d09b4d6d1e7f24726070114af009d1b35a2ca076"
            },
            "downloads": -1,
            "filename": "ape_ens-0.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "27ddb857ef921d4b12b4a30221c7e76b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 18691,
            "upload_time": "2024-12-09T22:04:58",
            "upload_time_iso_8601": "2024-12-09T22:04:58.163092Z",
            "url": "https://files.pythonhosted.org/packages/49/a6/f1bb5aeb6006999e659515bd4cfb8cd1a51ac68e9e1f5f5de3eb131848bc/ape_ens-0.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-09 22:04:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ApeWorX",
    "github_project": "ape-ens",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ape-ens"
}
        
Elapsed time: 0.42297s