PSBT save to file
MODIFY
WalletWasabi.Fluent/Helpers/FileDialogHelper.cs
WalletWasabi.Fluent/Helpers/FileDialogHelper.cs
@@ -25,6 +25,24 @@ namespace WalletWasabi.Fluent.Helpers
return await GetDialogResultAsync(ofd);
}
+ public static async Task<string?> ShowSaveFileDialogAsync(string title, params string[] filterExtTypes)
+ {
+ var sfd = CreateSaveFileDialog(title, filterExtTypes);
+ sfd.Filters = GenerateFilters(filterExtTypes);
+ return await GetDialogResultAsync(sfd);
+ }
+
+ private static SaveFileDialog CreateSaveFileDialog(string title, IEnumerable<string> filterExtTypes)
+ {
+ var sfd = new SaveFileDialog
+ {
+ DefaultExtension = filterExtTypes.First(),
+ Title = title
+ };
+
+ return sfd;
+ }
+
private static async Task<string?> GetDialogResultAsync(OpenFileDialog ofd)
{
var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime).MainWindow;
@@ -33,6 +51,14 @@ namespace WalletWasabi.Fluent.Helpers
return selected.FirstOrDefault();
}
+ private static async Task<string?> GetDialogResultAsync(SaveFileDialog sfd)
+ {
+ var window = ((IClassicDesktopStyleApplicationLifetime) Application.Current.ApplicationLifetime).MainWindow;
+ var selected = await sfd.ShowAsync(window);
+
+ return selected;
+ }
+
private static OpenFileDialog CreateOpenFileDialog(string title)
{
var ofd = new OpenFileDialog

MODIFY
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
WalletWasabi.Fluent/Helpers/TransactionHelpers.cs
@@ -90,5 +90,21 @@ namespace WalletWasabi.Fluent.Helpers
return psbt.ExtractSmartTransaction();
}
+
+ public static async Task ExportTransactionToBinaryAsync(BuildTransactionResult transaction)
+ {
+ var psbtExtension = "psbt";
+ var filePath = await FileDialogHelper.ShowSaveFileDialogAsync("Export transaction", psbtExtension);
+
+ if (!string.IsNullOrWhiteSpace(filePath))
+ {
+ var ext = Path.GetExtension(filePath);
+ if (string.IsNullOrWhiteSpace(ext))
+ {
+ filePath = $"{filePath}.{psbtExtension}";
+ }
+ await File.WriteAllBytesAsync(filePath, transaction.Psbt.ToBytes());
+ }
+ }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -23,6 +23,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
private readonly TransactionInfo _info;
[AutoNotify] private string _confirmationTimeText;
+ [AutoNotify] private string _nextButtonText;
[AutoNotify] private SmartLabel _labels;
public TransactionPreviewViewModel(Wallet wallet, TransactionInfo info, BuildTransactionResult transaction)
@@ -49,7 +50,17 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
PayJoinUrl = info.PayJoinClient?.PaymentUrl.AbsoluteUri;
IsPayJoin = PayJoinUrl is not null;
- NextCommand = ReactiveCommand.CreateFromTask(async () => await OnNextAsync(transaction));
+ if (Services.UiConfig.UsePsbtWorkflow)
+ {
+ NextCommand = ReactiveCommand.CreateFromTask(async () => await TransactionHelpers.ExportTransactionToBinaryAsync(transaction));
+ _nextButtonText = "Save to file";
+ }
+ else
+ {
+ NextCommand = ReactiveCommand.CreateFromTask(async () => await OnConfirmAsync(transaction));
+ _nextButtonText = "Confirm";
+ }
+
}
public string AmountText { get; }
@@ -67,10 +78,11 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
base.OnNavigatedTo(isInHistory, disposables);
ConfirmationTimeText = $"Approximately {TextHelpers.TimeSpanToFriendlyString(_info.ConfirmationTimeSpan)} ";
+ Console.WriteLine(_info.Labels);
Labels = _info.Labels;
}
- private async Task OnNextAsync(BuildTransactionResult transaction)
+ private async Task OnConfirmAsync(BuildTransactionResult transaction)
{
var transactionAuthorizationInfo = new TransactionAuthorizationInfo(transaction);

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/TransactionPreviewView.axaml
<c:ContentArea Title="Send - Preview Transaction" Caption=""
EnableCancel="{Binding EnableCancel}"
EnableBack="{Binding EnableBack}"
- EnableNext="True" NextContent="Confirm"
+ EnableNext="True" NextContent="{Binding NextButtonText}"
IsBusy="{Binding IsBusy}"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<StackPanel Spacing="20">

PSBT save to file