View Source Bitcoinex.Address (bitcoinex v0.1.8)
Bitcoinex.Address supports Base58 and Bech32 address encoding and validation.
Link to this section Summary
Types
The address_type describes the address type to use.
Functions
Decodes an address and returns the address_type.
Accepts a public key hash, network, and address_type and returns its address.
Checks if the address is valid. Both encoding and network is checked.
Checks if the address is valid and matches the given address_type. Both encoding and network is checked.
Returns a list of supported address types.
Link to this section Types
@type address_type() :: :p2pkh | :p2sh | :p2wpkh | :p2wsh
The address_type describes the address type to use.
Four address types are supported:
- p2pkh: Pay-to-Public-Key-Hash
- p2sh: Pay-to-Script-Hash
- p2wpkh: Pay-to-Witness-Public-Key-Hash
- p2wsh: Pay-To-Witness-Script-Hash
Link to this section Functions
@spec decode_type(String.t(), Bitcoinex.Network.network_name()) :: {:ok, address_type()} | {:error, :decode_error}
Decodes an address and returns the address_type.
@spec encode(binary(), Bitcoinex.Network.network_name(), address_type()) :: String.t()
Accepts a public key hash, network, and address_type and returns its address.
@spec is_valid?(String.t(), Bitcoinex.Network.network_name()) :: boolean()
Checks if the address is valid. Both encoding and network is checked.
@spec is_valid?(String.t(), Bitcoinex.Network.network_name(), address_type()) :: boolean()
Checks if the address is valid and matches the given address_type. Both encoding and network is checked.
Returns a list of supported address types.