encodeCredential method

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

Implementation

String encodeCredential(AdaStakeCredential credential,
    [Map<String, dynamic> kwargs = const {}]) {
  final AdaStakeCredential pubSkey =
      AddrKeyValidator.validateAddressArgs<AdaStakeCredential>(
          kwargs, "pub_skey");

  final netTag = kwargs["net_tag"] ?? ADANetwork.mainnet;

  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]!,
      stakeCredential: pubSkey,
      type: ADAAddressType.base);
}