JSPM

@ethereum-waffle/ens

2.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 66181
  • Score
    100M100P100Q173960F
  • License MIT

A mock ens implementation for testing.

Package Exports

  • @ethereum-waffle/ens

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ethereum-waffle/ens) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

CircleCI

Ethereum Waffle

@ethereum-waffle/ens

A simple ens builder for testing with ENS.

Installation

In the current version of waffle (v2.x.x) you will install this package as a dependency of the main waffle package - ethereum-waffle.

yarn add --dev ethereum-waffle
npm install --save-dev ethereum-waffle

If you want to use this package directly please install it via:

yarn add --dev @ethereum-waffle/ens
npm install --save-dev @ethereum-waffle/ens

Feature overview

NOTE: You do not need to use this package directly. You can install it through the main package (ethereum-waffle) and use it instead.

ENSBuilder

The ENSBuilder class allows to create ENS domains for testing.

It will deploy ENS smart contracts system to your test node.

To create ENSBuilder, you should submit your wallet, available in MockProvider class in package @ethereum-waffle/provider.

You can read more about ENS in the ENS's documentation.

Examples:

Creating of ENSBuilder:

import {MockProvider} from '@ethereum-waffle/provider';
import {createENSBuilder, ENSBuilder} from '@ethereum-waffle/ens';

const provider = new MockProvider();
const [wallet] = provider.getWallets();
const ensBuilder: ENSBuilder = await createENSBuilder(wallet);

Usage

Use createTopLevelDomain function to creating top level domain:

await ensBuilder.createTopLevelDomain('test');

Use createSubDomain function to creating sub domain for exiting domain:

await ensBuilder.createSubDomain('ethworks.test');

And use setAddress function for setting address for existing domain:

await ensBuilder.setAddress('vlad.ethworks.test', '0x001...03');