ADARewardAddress.fromBip32 constructor

ADARewardAddress.fromBip32({
  1. required CardanoByronLegacyBip32 bip32,
  2. ADANetwork network = ADANetwork.mainnet,
})

Factory method to create an ADARewardAddress instance from a Bip32 structure.

Implementation

factory ADARewardAddress.fromBip32(
    {required CardanoByronLegacyBip32 bip32,
    ADANetwork network = ADANetwork.mainnet}) {
  final credential =
      AdaAddressUtils.publicKeyToCredential(bip32.publicKey.compressed);
  final encode = AdaShelleyStakingAddrEncoder().encodeCredential(
      AdaAddressUtils.toAdaStakeCredential(credential), {"net_tag": network});
  return ADARewardAddress._(
      paymentCredential: credential, address: encode, network: network);
}