ADARewardAddress.fromCip1852 constructor

ADARewardAddress.fromCip1852({
  1. required Cip1852 cip1582,
  2. ADANetwork network = ADANetwork.mainnet,
})

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

Implementation

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