encode static method

String encode({
  1. required AdaStakeCredential credential,
  2. AdaStakeCredential? stakeCredential,
  3. Pointer? pointer,
  4. required ADANetwork netTag,
  5. required String hrp,
  6. required ADAAddressType type,
})

Implementation

static String encode(
    {required AdaStakeCredential credential,
    AdaStakeCredential? stakeCredential,
    Pointer? pointer,
    required ADANetwork netTag,
    required String hrp,
    required ADAAddressType type}) {
  /// Encode the address prefix using the header type and network tag.
  final prefixByte = AdaShelleyAddrUtils.encodePrefix(
      type, netTag.value, credential.type,
      stakeType: stakeCredential?.type);

  return Bech32Encoder.encode(
      hrp,
      List<int>.from([
        ...prefixByte,
        ...credential.hash,
        ...stakeCredential?.hash ?? <int>[],
        ...pointer?.toBytes() ?? <int>[]
      ]));
}