encodeCredential method

String encodeCredential(
  1. AdaStakeCredential credential, [
  2. Map<String, dynamic> kwargs = const {}
])

Implementation

String encodeCredential(AdaStakeCredential credential,
    [Map<String, dynamic> kwargs = const {}]) {
  /// Determine the network tag, defaulting to mainnet if not specified.
  final netTag = kwargs["net_tag"] ?? ADANetwork.mainnet;

  /// Check if the provided network tag is a valid enum value.
  if (netTag is! ADANetwork) {
    throw const AddressConverterException(
        'Address type is not an enumerative of ADANetwork');
  }

  return AdaShelleyAddrUtils.encode(
      credential: credential,
      netTag: netTag,
      hrp: AdaShelleyAddrConst.networkTagToAddrHrp[netTag]!,
      type: ADAAddressType.enterprise);
}