ADABaseAddress.fromPublicKey constructor

ADABaseAddress.fromPublicKey({
  1. required List<int> basePubkeyBytes,
  2. required List<int> stakePubkeyBytes,
  3. ADANetwork network = ADANetwork.mainnet,
})

Factory method to create an ADABaseAddress instance from base and stake public keys.

Implementation

factory ADABaseAddress.fromPublicKey(
    {required List<int> basePubkeyBytes,
    required List<int> stakePubkeyBytes,
    ADANetwork network = ADANetwork.mainnet}) {
  final baseCredential =
      AdaAddressUtils.publicKeyToCredential(basePubkeyBytes);
  final stakeCredential =
      AdaAddressUtils.publicKeyToCredential(stakePubkeyBytes);
  final encode = AdaShelleyAddrEncoder().encodeCredential(
      AdaAddressUtils.toAdaStakeCredential(baseCredential), {
    "net_tag": network,
    "pub_skey": AdaAddressUtils.toAdaStakeCredential(stakeCredential)
  });
  return ADABaseAddress._(
      paymentCredential: baseCredential,
      stakeCredential: stakeCredential,
      address: encode,
      network: network);
}