Validation for correct address
MODIFY
WalletWasabi.Fluent/Models/WebcamQrReader.cs
WalletWasabi.Fluent/Models/WebcamQrReader.cs
@@ -87,11 +87,19 @@ namespace WalletWasabi.Fluent.Models
if (qRCodeDetector.Detect(frame, out Point2f[] points))
{
string qrCode = qRCodeDetector.Decode(frame, points, new Mat());
- if (!string.IsNullOrWhiteSpace(qrCode) && AddressStringParser.TryParse(qrCode, Network, out _))
+ if (string.IsNullOrWhiteSpace(qrCode))
+ {
+ continue;
+ }
+ if (AddressStringParser.TryParse(qrCode, Network, out _))
{
BitcoinAddressFound?.Invoke(this, qrCode);
break;
}
+ else
+ {
+ InvalidAddressFound?.Invoke(this, qrCode);
+ }
}
}
catch (OpenCVException exc)
@@ -147,6 +155,8 @@ namespace WalletWasabi.Fluent.Models
public event EventHandler<string>? BitcoinAddressFound;
+ public event EventHandler<string>? InvalidAddressFound;
+
public event EventHandler<Exception>? ErrorOccured;
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -77,6 +77,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
IsQrPanelVisible = false;
});
+ Observable.FromEventPattern<string>(_qrReader, nameof(_qrReader.InvalidAddressFound))
+ .Subscribe(args => To = args.EventArgs);
+
Observable.FromEventPattern<Exception>(_qrReader, nameof(_qrReader.ErrorOccured))
.Subscribe(async args =>
{

Validation for correct address