decodeAddres static method

AdaGenericAddrDecoderResult decodeAddres(
  1. String address, {
  2. ADAAddressType? addrType,
  3. ADANetwork? network,
})

Decode an ADA address string.

address: The address to decode. addrType: The expected address type. If provided, the decoded address type must match this. network: The network type.

Returns a AdaGenericAddrDecoderResult object containing the decoded address.

Implementation

static AdaGenericAddrDecoderResult decodeAddres(String address,
    {ADAAddressType? addrType, ADANetwork? network}) {
  final decodeAddr =
      AdaGenericAddrDecoder().decode(address, {"net_tag": network});
  if (addrType != null) {
    if (decodeAddr.type.header != addrType.header) {
      throw MessageException("Incorrect address type. ",
          details: {"Excepted": addrType.name, "type": decodeAddr.type});
    }
  }
  return decodeAddr;
}