2.1.5 • Published 3 years ago

nahmii-ethereum-address v2.1.5

Weekly downloads
10
License
LGPL-3.0-or-later
Repository
github
Last release
3 years ago

ETHEREUM-ADDRESS

This is a small utility library for parsing, validating and converting an ethereum address.

Installation

npm install nahmii-ethereum-address

Usage

Creating a new address from a string:

    const EthereumAddress = require('nahmii-ethereum-address');

    let addr = EthereumAddress.from('0x0011223344556677889900112233445566778899');

    if (!addr)
        console.log('Address is not valid');

EthereumAddress - constructor()

The constructor can be invoked with either a 20 byte Buffer or an already existing EthereumAddress instance.

Invalid input will throw a TypeError.

EthereumAddress - from()

The static from class method is able to construct an EthereumAddress from strings or BSON Binary objects.

It will either return a new instance of an EthereumAddress or null if conversion was not possible.

EthereumAddress - toString()

This method will return a hexadecimal string representation of the address.

EthereumAddress - toBuffer()

This method will return a Buffer containing the address.

EthereumAddress - toBinary()

This method will return a BSON Binary containing the address.

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago