mintDiversifiedAddress method

  1. @override
Future<WalletMintedAddress> mintDiversifiedAddress()
override

Mint the NEXT public diversified receive address (FR-8 / Recv-4, ADR-0537): a fresh unlinkable unified address for a contact/invoice that still credits this one wallet โ€” payments to it are detected by the normal shielded scan (including after a seed-only restore), with no extra host work. Same receiver set as currentAddress (shielded-only), so no compatibility downgrade. Every call returns a NEW address from the SDK's never-recycle, restore-surviving counter; deterministic per WalletMintedAddress.diversifierIndex โ€” keep the index as the durable host-side attribution key. Cheap, local, no network, not gated on sync. Throws the typed bridge error before an account is provisioned (exotic โ€” accounts import eagerly at create). ยง5.4 NEVER-LOG applies to BOTH fields.

Implementation

@override
Future<WalletMintedAddress> mintDiversifiedAddress() {
  mintDiversifiedAddressCount++;
  if (mintDiversifiedAddressThrows != null) {
    return Future<WalletMintedAddress>.error(mintDiversifiedAddressThrows!);
  }
  if (mintDiversifiedAddressNeverCompletes) {
    return Completer<WalletMintedAddress>().future;
  }
  final address = mintDiversifiedAddressCount == 1
      ? mintDiversifiedAddressResult
      : '$mintDiversifiedAddressResult$mintDiversifiedAddressCount';
  return Future<WalletMintedAddress>.value(
    WalletMintedAddress(
      address: address,
      diversifierIndex: mintDiversifiedAddressIndex++,
    ),
  );
}