Bitcoinex.Address (bitcoinex v0.1.2) View Source
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
Specs
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
Specs
decode_type(String.t(), Bitcoinex.Network.network_name()) :: {:ok, address_type()} | {:error, :decode_error}
Decodes an address and returns the address_type.
Specs
encode(binary(), Bitcoinex.Network.network_name(), address_type()) :: String.t()
Accepts a public key hash, network, and address_type and returns its address.
Specs
is_valid?(String.t(), Bitcoinex.Network.network_name()) :: boolean()
Checks if the address is valid. Both encoding and network is checked.
Specs
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.