Skip to main content

ape-ens: Ape plugin for ENS argument conversion and contracts

Project description

Quick Start

Ape plugin for ENS argument conversion and contracts

Dependencies

Installation

via pip

You can install the latest release via pip:

pip install ape-ens

via setuptools

You can clone the repository and use setuptools for the most up-to-date version:

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:

ape plugins install infura

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

$ 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:

ethereum:
  mainnet:
    default_provider: infura

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

ape console --network :rinkeby:infura

Then, convert an ens domain to an AddressType:

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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ape-ens-0.7.1.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

ape_ens-0.7.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file ape-ens-0.7.1.tar.gz.

File metadata

  • Download URL: ape-ens-0.7.1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for ape-ens-0.7.1.tar.gz
Algorithm Hash digest
SHA256 d33b0ed5d2210ed59e16e53cc167bd9d8e027a1e44e300ab17f63265235d42cf
MD5 002f4b8fcf6c73c6af15120e3c86c97c
BLAKE2b-256 b478d4e21e7e56709e4abef697289e1e9753752aa4a8906e1e5ca89ccfc4029b

See more details on using hashes here.

File details

Details for the file ape_ens-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: ape_ens-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.14

File hashes

Hashes for ape_ens-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 541a7bec95c397c3366c1a6cd027628fb8cda96b6443831e1d43cda81678899a
MD5 fcfc82da38146111f2224ced2262d1fa
BLAKE2b-256 4ae568b52038b101e5512de6771f12577313c35e8740683345a3a5bd8295215c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page