decodeAddr method

  1. @override
List<int> decodeAddr(
  1. String addr, [
  2. Map<String, dynamic> kwargs = const {}
])
override

Decodes an Ada Byron address and returns its components.

The addr parameter is the Ada Byron address to decode. The optional kwargs parameter is a map of additional arguments, where "addr_type" can be set to specify the address type (default is ADAByronAddrTypes.publicKey).

Returns a List<int> representing the decoded address components, including root hash and HD path if available.

Throws an ArgumentException if the provided address type is invalid or if the address type in the decoded address does not match the expected type.

Implementation

@override
List<int> decodeAddr(String addr, [Map<String, dynamic> kwargs = const {}]) {
  final args = Map<String, dynamic>.from(kwargs);
  args["addr_type"] = args["addr_type"] ?? ADAByronAddrTypes.publicKey;
  final decAddr = _decodeAddr(addr, args);
  return List<int>.from([
    ...decAddr.rootHashBytes,
    if (decAddr.attrs.hdPathEncBytes != null)
      ...decAddr.attrs.hdPathEncBytes!,
  ]);
}