Module: bchaddr

General purpose Bitcoin Cash address detection and translation.
Supports all major Bitcoin Cash address formats.
Currently:
  • Legacy format
  • Bitpay format
  • Cashaddr format
Source:

Classes

InvalidAddressError

Members

(static) Format

Source:

(static) Network

Source:

(static) Type

Source:

Methods

(static) detectAddressFormat(address) → {string}

Detects what is the given address' format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string

(static) detectAddressNetwork(address) → {string}

Detects what is the given address' network.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string

(static) detectAddressType(address) → {string}

Detects what is the given address' type.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string

(static) isBitpayAddress(address) → {boolean}

Returns a boolean indicating whether the address is in bitpay format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isCashAddress(address) → {boolean}

Returns a boolean indicating whether the address is in cashaddr format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isLegacyAddress(address) → {boolean}

Returns a boolean indicating whether the address is in legacy format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isMainnetAddress(address) → {boolean}

Returns a boolean indicating whether the address is a mainnet address.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isP2PKHAddress(address) → {boolean}

Returns a boolean indicating whether the address is a p2pkh address.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isP2SHAddress(address) → {boolean}

Returns a boolean indicating whether the address is a p2sh address.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isTestnetAddress(address) → {boolean}

Returns a boolean indicating whether the address is a testnet address.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
boolean

(static) isValidAddress(input) → {boolean}

Returns a boolean indicating whether the given input is a valid Bitcoin Cash address.
Parameters:
Name Type Description
input * Any input to check for validity.
Source:
Returns:
Type
boolean

(static) toBitpayAddress(address) → {string}

Translates the given address into bitpay format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string

(static) toCashAddress(address) → {string}

Translates the given address into cashaddr format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string

(static) toLegacyAddress(address) → {string}

Translates the given address into legacy format.
Parameters:
Name Type Description
address string A valid Bitcoin Cash address in any format.
Source:
Throws:
InvalidAddressError
Returns:
Type
string