ADABaseAddress.shellyWallet constructor

ADABaseAddress.shellyWallet({
  1. required CardanoShelley shelleyWallet,
  2. ADANetwork network = ADANetwork.mainnet,
})

Factory method to create an ADABaseAddress instance from a Shelley wallet.

Implementation

factory ADABaseAddress.shellyWallet(
    {required CardanoShelley shelleyWallet,
    ADANetwork network = ADANetwork.mainnet}) {
  final baseCredential = AdaAddressUtils.publicKeyToCredential(
      shelleyWallet.bip44.publicKey.compressed);
  final stakeCredential = AdaAddressUtils.publicKeyToCredential(
      shelleyWallet.bip44Sk.publicKey.compressed);
  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);
}