findAddress method

UnifiedDerivedAddress findAddress({
  1. required DiversifierIndex from,
  2. UnifiedAddressRequest request = const UnifiedAddressRequest.defaultRequest(),
})

Finds the first unified address starting from the given index that matches the specified request.

Implementation

UnifiedDerivedAddress findAddress({
  required DiversifierIndex from,
  UnifiedAddressRequest request =
      const UnifiedAddressRequest.defaultRequest(),
}) {
  DiversifierIndex? j = from;
  while (j != null) {
    try {
      return _address(index: j, request: request);
    } on SaplingKeyError {
      j = j.tryIncrement();
    }
  }
  throw ZCashKeyError("Diversifier index space exhausted.");
}