Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethereum-waffle/ens

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereum-waffle/ens

A mock ens implementation for testing.

  • 4.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
47K
decreased by-16.85%
Maintainers
1
Weekly downloads
 
Created
Source

CI

Ethereum Waffle

@ethereum-waffle/ens

A simple ENS for testing.

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.

ENS

The ENS class allows to create ENS domains for testing.

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

To create ENS, 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 ENS:

import {MockProvider} from '@ethereum-waffle/provider';
import {deployENS, ENS} from '@ethereum-waffle/ens';

const provider = new MockProvider();
const [wallet] = provider.getWallets();
const ens: ENS = await deployENS(wallet);

Usage

Use createTopLevelDomain function to create a top level domain:

await ens.createTopLevelDomain('test');

Use createSubDomain function for creating a sub domain:

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

Also, it's possible to create a sub domain recursively, if the top domain doesn't exist, by specifying the appropriate option:

await ens.createSubDomain('ethworks.tld', {recursive: true});

Use setAddress function for setting address for the domain:

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

Also, it's possible to set an address for the domain recursively, if the domain doesn't exist, by specifying the appropriate option:

await ens.setAddress('vlad.ethworks.tld', '0x001...03', {recursive: true});

Use setAddressWithReverse function for setting address for the domain and make this domain reverse. Add recursive option if the domain doesn't exist:

await ens.setAddressWithReverse('vlad.ethworks.tld', wallet, {recursive: true});

Keywords

FAQs

Package last updated on 26 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc