How to use web3-eth-ens - 3 common examples

To help you get started, we’ve selected a few web3-eth-ens examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereum / web3.js / packages / web3-eth / src / index.js View on Github external
set: function (value) {
            if(value) {
                try {
                    defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(value));
                } catch(error) {
                    if (value.match(/^[a-z]+([\.\-]?[a-z]+)?$/)) {
                        ens.getAddress(value).then(function (address) {
                            _this._address = address;
                            value = address;
                        }).catch(function () {
                            throw new Error('Given ENS address "'+ value +'" does not exist.');
                        });
                    } else {
                        throw error;
                    }
                }
            }

            // also set on the Contract object
            _this.Contract.defaultAccount = defaultAccount;
            _this.personal.defaultAccount = defaultAccount;

            // update defaultBlock
github ethereum / web3.js / packages / web3-eth-contract / src / index.js View on Github external
set: function(value){
            if(value) {
                try {
                    _this._address = utils.toChecksumAddress(formatters.inputAddressFormatter(value));
                } catch (error) {
                    if (value.match(/^[a-z]+([\.\-]?[a-z]+)?$/)) {
                        ens.getAddress(value).then(function (address) {
                            _this._address = address;
                        }).catch(function () {
                            throw new Error('Given ENS address "'+ value +'" does not exist.');
                        });
                    } else {
                        throw error;
                    }

                }
            }
        },
        get: function(){

web3-eth-ens

This package has ENS functions for interacting with Ethereum Name Service.

LGPL-3.0
Latest version published 1 month ago

Package Health Score

98 / 100
Full package analysis

Popular web3-eth-ens functions

Similar packages