findAndEncodeAddress method

String? findAndEncodeAddress({
  1. DiversifierIndex? from,
  2. Bip44Changes scope = Bip44Changes.chainExt,
})

Implementation

String? findAndEncodeAddress({
  DiversifierIndex? from,
  Bip44Changes scope = Bip44Changes.chainExt,
}) {
  final address = findAddress(from: from, scope: scope);
  if (address == null) return null;
  final addressBytes = address.toBytes();
  switch (coinConf.type) {
    case EllipticCurveTypes.redJubJub:
      return coinConf.encodeAddress(
        EncodeAddressDefaultParams(pubKey: addressBytes),
      );
    default:
      return ZCashUnifiedAddrEncoder().encodeUnifiedReceivers([
        ReceiverOrchard(
          data: addressBytes,
          mode: UnifiedReceiverMode.address,
        ),
      ]);
  }
}