Copyright | No rights reserved |
---|---|
License | MIT |
Maintainer | jprupp@protonmail.ch |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Support for Bitcoin Cash (BCH) CashAddr format.
Synopsis
- type CashPrefix = Text
- type CashVersion = Word8
- type CashAddr = Text
- type Cash32 = Text
- cashAddrDecode :: Network -> CashAddr -> Maybe (CashVersion, ByteString)
- cashAddrEncode :: Network -> CashVersion -> ByteString -> Maybe CashAddr
- cash32decodeType :: Cash32 -> Maybe (CashPrefix, CashVersion, ByteString)
- cash32encodeType :: CashPrefix -> CashVersion -> ByteString -> Maybe Cash32
- cash32decode :: Cash32 -> Maybe (CashPrefix, ByteString)
- cash32encode :: CashPrefix -> ByteString -> Cash32
CashAddr
type CashPrefix = Text Source #
CashAddr
prefix, usually shown before the colon in addresses, but sometimes
omitted. It is used in the checksum calculation to avoid parsing an address
from the wrong network.
type CashVersion = Word8 Source #
CashAddr
version, until new address schemes appear it will be zero.
High level CashAddr
human-reabale string, with explicit or implicit prefix.
cashAddrDecode :: Network -> CashAddr -> Maybe (CashVersion, ByteString) Source #
cashAddrEncode :: Network -> CashVersion -> ByteString -> Maybe CashAddr Source #
High-Level: encode CashAddr
string for the provided network and hash.
Fails if the CashVersion
or length of hash ByteString
is invalid.
cash32decodeType :: Cash32 -> Maybe (CashPrefix, CashVersion, ByteString) Source #
Mid-Level: decode CashAddr
string containing arbitrary prefix, plus a
version byte before the ByteString
that encodes type and length.
cash32encodeType :: CashPrefix -> CashVersion -> ByteString -> Maybe Cash32 Source #
Mid-Level: encode CashAddr
string containing arbitrary prefix and
CashVersion
. Length must be among those allowed by the standard.
cash32decode :: Cash32 -> Maybe (CashPrefix, ByteString) Source #
Low-Level: decode Cash32
string. CashPrefix
must be part of the string.
No version or hash length validation is performed.
cash32encode :: CashPrefix -> ByteString -> Cash32 Source #
Low-Level: encode Cash32
string for CashPrefix
provided. Can encode
arbitrary data. No prefix or length validation is performed.