ecashaddr library

Classes

DecodedAddress
Represents a decoded cash address with its components
TypeAndHash
Represents the type and hash components of an address

Enums

AddressType

Constants

charset → const String
Charset containing the 32 symbols used in the base32 encoding.
charsetInverseIndex → const Map<String, int>
Inverted index mapping each symbol into its index within the charset.
validPrefixes → const List<String>
All valid address prefixes Note that as of 2.0.0 we do not validate against these prefixes However we do use them to guess prefix for prefixless addrs

Functions

convertBits(Uint8List data, int from, int to, {bool strictMode = false}) Uint8List
Converts an array of integers made up of 'from' bits into an array of integers made up of 'to' bits. The output array is zero-padded if necessary, unless strict mode is true. Throws a ValidationError if input is invalid. Original by Pieter Wuille: https://github.com/sipa/bech32.
decode(dynamic string) Uint8List
Decodes the given base32-encoded string into an array of 5-bit integers.
decodeCashAddress(String address) DecodedAddress
Decodes the given address into its constituting prefix, type and hash.
encode(dynamic data) String
Encodes the given array of 5-bit integers as a base32-encoded string.
encodeCashAddress(String prefix, AddressType type, dynamic hash) String
Encodes a hash from a given type into an eCash address with the given prefix.
getOutputScriptFromTypeAndHash(AddressType type, String hash) String
Get output script from type and hash
getTypeAndHashFromOutputScript(String outputScript) TypeAndHash
Get type and hash from an outputScript
validate(bool condition, String message) → void
Validates a given condition, throwing a ValidationError if the given condition does not hold.

Exceptions / Errors

ValidationError
Error thrown when encoding or decoding fail due to invalid input.