ADAByronAddress.fromPublicKey constructor

ADAByronAddress.fromPublicKey({
  1. required List<int> publicKey,
  2. required List<int> chaincode,
  3. List<int>? hdPathKey,
  4. String? hdPath,
  5. ADANetwork network = ADANetwork.mainnet,
})

Factory constructor to create an ADAByronAddress instance from a public key and chaincode.

Implementation

factory ADAByronAddress.fromPublicKey(
    {required List<int> publicKey,
    required List<int> chaincode,
    List<int>? hdPathKey,
    String? hdPath,
    ADANetwork network = ADANetwork.mainnet}) {
  if (hdPath != null && hdPathKey != null) {
    return ADAByronAddress.legacy(
        publicKey: publicKey,
        chaincode: chaincode,
        hdPathKey: hdPathKey,
        hdPath: hdPath,
        network: network);
  }
  final encode = AdaByronIcarusAddrEncoder().encodeKeyWithInfo(
      publicKey, {"net_tag": network, "chain_code": chaincode});
  return ADAByronAddress._(encode.encode(), encode, network);
}