Encoding and decoding of the new Cash Address format for Bitcoin Cash.
Compliant with the original cashaddr specification: https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
Compliant with the original cashaddr specification: https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
- Source:
Classes
Methods
(static) decode(address) → {object}
Decodes the given address into its constituting prefix, type and hash. See #encode().
Parameters:
Name | Type | Description |
---|---|---|
address |
string | Address to decode. E.g.: 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'. |
- Source:
Throws:
ValidationError
Returns:
- Type
- object
(static) encode(prefix, type, hash) → {string}
Encodes a hash from a given type into a Bitcoin Cash address with the given prefix.
Parameters:
Name | Type | Description |
---|---|---|
prefix |
string | Network prefix. E.g.: 'bitcoincash'. |
type |
string | Type of address to generate. Either 'P2PKH' or 'P2SH'. |
hash |
Uint8Array | Hash to encode represented as an array of 8-bit integers. |
- Source:
Throws:
ValidationError
Returns:
- Type
- string