encodeKeyWithInfo method

ADAByronAddr encodeKeyWithInfo(
  1. List<int> pubKey, {
  2. ADANetwork network = ADANetwork.mainnet,
  3. List<int>? chainCode,
})

Encodes an Ada Byron address with the provided public key and chain code.

The pubKey parameter is the public key to be encoded. The optional kwargs parameter is a map of additional arguments, where "chain_code" can be set to specify the chain code.

Returns a ADAByronAddr representing the encoded Ada Byron address.

Throws an AddressConverterException if the provided chain code is invalid.

Implementation

ADAByronAddr encodeKeyWithInfo(
  List<int> pubKey, {
  ADANetwork network = ADANetwork.mainnet,
  List<int>? chainCode,
}) {
  final List<int> chainCodeBytes = AddrKeyValidator.getAddrArg(
    chainCode,
    "chainCode",
  );
  final pubkeyBytes =
      AddrKeyValidator.validateAndGetEd25519Key(pubKey).compressed;
  return _AdaByronAddrUtils.encodeKey(
    pubkeyBytes,
    chainCodeBytes,
    ADAByronAddrTypes.publicKey,
    networkMagic: network.protocolMagic,
  );
}