ape-ens


Nameape-ens JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://github.com/ApeWorX/ape-ens
Summaryape-ens: Ape plugin for ENS argument conversion and contracts
upload_time2024-04-30 14:29:06
maintainerNone
docs_urlNone
authorApeWorX Ltd.
requires_python<4,>=3.8
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.8 up to 3.11.

## 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.8",
    "maintainer_email": null,
    "keywords": "ethereum",
    "author": "ApeWorX Ltd.",
    "author_email": "admin@apeworx.io",
    "download_url": "https://files.pythonhosted.org/packages/b4/78/d4e21e7e56709e4abef697289e1e9753752aa4a8906e1e5ca89ccfc4029b/ape-ens-0.7.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.8 up to 3.11.\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.7.1",
    "project_urls": {
        "Homepage": "https://github.com/ApeWorX/ape-ens"
    },
    "split_keywords": [
        "ethereum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ae568b52038b101e5512de6771f12577313c35e8740683345a3a5bd8295215c",
                "md5": "fcfc82da38146111f2224ced2262d1fa",
                "sha256": "541a7bec95c397c3366c1a6cd027628fb8cda96b6443831e1d43cda81678899a"
            },
            "downloads": -1,
            "filename": "ape_ens-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fcfc82da38146111f2224ced2262d1fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8",
            "size": 9840,
            "upload_time": "2024-04-30T14:29:03",
            "upload_time_iso_8601": "2024-04-30T14:29:03.505143Z",
            "url": "https://files.pythonhosted.org/packages/4a/e5/68b52038b101e5512de6771f12577313c35e8740683345a3a5bd8295215c/ape_ens-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b478d4e21e7e56709e4abef697289e1e9753752aa4a8906e1e5ca89ccfc4029b",
                "md5": "002f4b8fcf6c73c6af15120e3c86c97c",
                "sha256": "d33b0ed5d2210ed59e16e53cc167bd9d8e027a1e44e300ab17f63265235d42cf"
            },
            "downloads": -1,
            "filename": "ape-ens-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "002f4b8fcf6c73c6af15120e3c86c97c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8",
            "size": 17580,
            "upload_time": "2024-04-30T14:29:06",
            "upload_time_iso_8601": "2024-04-30T14:29:06.259567Z",
            "url": "https://files.pythonhosted.org/packages/b4/78/d4e21e7e56709e4abef697289e1e9753752aa4a8906e1e5ca89ccfc4029b/ape-ens-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-30 14:29:06",
    "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.24864s