Make use of NBitcoin's built-in `TryParse` methods.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/TransactionBroadcasterViewModel.cs
@@ -167,7 +167,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
SmartTransaction transaction;
- if (NBitcoinHelpers.TryParsePSBT(TransactionString, Global.Network, out var signedPsbt))
+ if (PSBT.TryParse(TransactionString, Global.Network ?? Network.Main, out var signedPsbt))
{
if (!signedPsbt.IsAllFinalized())
{
@@ -178,7 +178,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
else
{
- if (NBitcoinHelpers.TryParseTransactionHex(TransactionString, Global.Network, out var txn))
+ if (Transaction.TryParse(TransactionString, Global.Network, out var txn))
{
transaction = new SmartTransaction(txn, WalletWasabi.Models.Height.Unknown);
}

MODIFY
WalletWasabi/Helpers/NBitcoinHelpers.cs
WalletWasabi/Helpers/NBitcoinHelpers.cs
@@ -12,42 +12,6 @@ namespace WalletWasabi.Helpers
{
public static class NBitcoinHelpers
{
- public static bool TryParsePSBT(string transactionString, Network network, out PSBT psbt)
- {
- try
- {
- psbt = PSBT.Parse(transactionString, network ?? Network.Main);
- return true;
- }
- catch (PSBTException)
- {
- psbt = null;
- return false;
- }
- catch
- {
- throw;
- }
- }
-
- public static bool TryParseTransactionHex(string transactionString, Network network, out Transaction txn)
- {
- try
- {
- txn = Transaction.Parse(transactionString, network ?? Network.Main);
- return true;
- }
- catch (FormatException)
- {
- txn = null;
- return false;
- }
- catch
- {
- throw;
- }
- }
-
public static string HashOutpoints(IEnumerable<OutPoint> outPoints)
{
var sb = new StringBuilder();

Make use of NBitcoin's built-in `TryParse` methods.