# 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:
  - bchaddr.js, line 13

### Classes

InvalidAddressError

### Members

#### (static) Format

Source:
  - bchaddr.js, line 29

#### (static) Network

Source:
  - bchaddr.js, line 38

#### (static) Type

Source:
  - bchaddr.js, line 46

### 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:
  - bchaddr.js, line 72

##### 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:
  - bchaddr.js, line 83

##### 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:
  - bchaddr.js, line 94

##### 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:
  - bchaddr.js, line 369

##### 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:
  - bchaddr.js, line 380

##### 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:
  - bchaddr.js, line 358

##### 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:
  - bchaddr.js, line 391

##### 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:
  - bchaddr.js, line 413

##### 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:
  - bchaddr.js, line 424

##### 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:
  - bchaddr.js, line 402

##### 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:
  - bchaddr.js, line 56

##### 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:
  - bchaddr.js, line 120

##### 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:
  - bchaddr.js, line 135

##### 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:
  - bchaddr.js, line 105

##### Throws:

InvalidAddressError

##### Returns:

Type
  string