encodeKey method

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

Encodes a public key into a blockchain address.

This method takes a public key in the form of a List

  • pubKey: The public key to be encoded as a blockchain address.
  • kwargs: Optional keyword arguments for encoder-specific options.

Returns the blockchain address string representing the encoded public key.

Implementation

@override
String encodeKey(List<int> hash, [Map<String, dynamic> kwargs = const {}]) {
  final int workChain =
      AddrKeyValidator.validateAddressArgs(kwargs, "workchain");
  final bool bounceable = AddrKeyValidator.nullOrValidateAddressArgs<bool>(
          kwargs, "bounceable") ??
      true;
  final bool urlSafe =
      AddrKeyValidator.nullOrValidateAddressArgs<bool>(kwargs, "url_safe") ??
          true;

  return TonAddressUtils.encodeAddress(
      hash: hash,
      workChain: workChain,
      bounceable: bounceable,
      urlSafe: urlSafe);
}