prototyping stuff...
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerView.xaml
<controls:GroupBox Title="{Binding Title}" TextBlock.FontSize="30" Padding="20" Margin="10">
<Grid Classes="content">
<DockPanel LastChildFill="True">
- <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal" Spacing="10">
+ <StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal" Spacing="10" Margin="5,0">
<Button Command="{Binding OpenTransactionBroadcaster}" Content="Open Transaction Broadcaster" />
- <Button Command="{Binding ExportBinaryPsbt}" Content="Export Binary PSBT" />
+ <!-- <Button Command="{Binding ExportBinaryPsbt}" Content="Export Binary PSBT" /> -->
+ <Button Command="{Binding CopyTransactionHex}" Content="Copy Transaction Hex" />
+ <Button Command="{Binding CopyBase64Psbt}" Content="Copy Base64 PSBT" />
</StackPanel>
- <Grid ScrollViewer.VerticalScrollBarVisibility="Auto" RowDefinitions="26,1*,1*,1*">
+ <Grid ScrollViewer.VerticalScrollBarVisibility="Auto" RowDefinitions="26,1*">
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0 8 0 0" Spacing="5">
<TextBlock Text="Transaction ID:" FontWeight="Bold" />
<controls:ExtendedTextBox Text="{Binding TxId, ConverterParameter=50, Converter={StaticResource LurkingWifeModeStringConverter}, Mode=OneWay}" Classes="selectableTextBlock" />
</StackPanel>
<DockPanel LastChildFill="True" Grid.Row="1" Margin="0 8 0 0">
- <TextBlock DockPanel.Dock="Top" Text="PSBT Json" FontWeight="Bold" />
- <controls:MultiTextBox Margin="0 8 0 0" Text="{Binding PsbtJsonText, ConverterParameter=1536, Converter={StaticResource LurkingWifeModeStringConverter}, Mode=OneWay}" CopyOnClick="{Binding !IsLurkingWifeMode}" IsSelectable="False" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" />
- </DockPanel>
- <DockPanel LastChildFill="True" Grid.Row="2" Margin="0 8 0 0">
- <TextBlock DockPanel.Dock="Top" Text="Transaction Hex" FontWeight="Bold" />
- <controls:MultiTextBox Margin="0 8 0 0" Text="{Binding TransactionHexText, ConverterParameter=382, Converter={StaticResource LurkingWifeModeStringConverter}, Mode=OneWay}" CopyOnClick="{Binding !IsLurkingWifeMode}" IsSelectable="False" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" />
- </DockPanel>
- <DockPanel LastChildFill="True" Grid.Row="3" Margin="0 8 0 0">
- <TextBlock DockPanel.Dock="Top" Text="PSBT Base64 String" FontWeight="Bold" />
- <controls:MultiTextBox Margin="0 8" VerticalAlignment="Stretch" Text="{Binding PsbtBase64Text, ConverterParameter=472, Converter={StaticResource LurkingWifeModeStringConverter}, Mode=OneWay}" CopyOnClick="{Binding !IsLurkingWifeMode}" IsSelectable="False" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" />
+ <TextBlock DockPanel.Dock="Top" Text="{Binding PsbtJsonTextHeader}" FontWeight="Bold" />
+ <controls:MultiTextBox Margin="0 8 0 0" Text="{Binding TruncatedPsbtJsonText, ConverterParameter=1536, Converter={StaticResource LurkingWifeModeStringConverter}, Mode=OneWay}" IsSelectable="False" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" />
</DockPanel>
</Grid>
</DockPanel>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/TransactionViewerViewModel.cs
@@ -24,8 +24,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class TransactionViewerViewModel : WasabiDocumentTabViewModel
{
+ private readonly int _jsonCharLimit = 5_0;
private string _txId;
private string _psbtJsonText;
+ private string _psbtJsonTextHeader;
+ private string _truncatedPsbtJsonText;
private string _psbtHexText;
private string _psbtBase64Text;
private byte[] _psbtBytes;
@@ -35,6 +38,19 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Global = Locator.Current.GetService<Global>();
OpenTransactionBroadcaster = ReactiveCommand.Create(() => IoC.Get<IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel()));
+
+ CopyBase64Psbt = ReactiveCommand.CreateFromTask(async () =>
+ {
+ await Application.Current.Clipboard.SetTextAsync(PsbtBase64Text);
+ NotificationHelpers.Information("The PSBT Base64 string is now copied on your clipboard!");
+ });
+
+ CopyTransactionHex = ReactiveCommand.CreateFromTask(async () =>
+ {
+ await Application.Current.Clipboard.SetTextAsync(TransactionHexText);
+ NotificationHelpers.Information("The Transaction hex string is now copied on your clipboard!");
+ });
+
ExportBinaryPsbt = ReactiveCommand.CreateFromTask(async () =>
{
var psbtExtension = "psbt";
@@ -86,6 +102,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Global Global { get; }
public ReactiveCommand<Unit, Unit> ExportBinaryPsbt { get; set; }
+ public ReactiveCommand<Unit, Unit> CopyTransactionHex { get; set; }
+ public ReactiveCommand<Unit, Unit> CopyBase64Psbt { get; set; }
+
public ReactiveCommand<Unit, Unit> OpenTransactionBroadcaster { get; set; }
public bool? IsLurkingWifeMode => Global.UiConfig.LurkingWifeMode;
@@ -102,6 +121,20 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _psbtJsonText, value);
}
+ public string PsbtJsonTextHeader
+ {
+ get => _psbtJsonTextHeader;
+ set => this.RaiseAndSetIfChanged(ref _psbtJsonTextHeader, value);
+ }
+
+ public string TruncatedPsbtJsonText
+ {
+ get => _truncatedPsbtJsonText;
+ set => this.RaiseAndSetIfChanged(ref _truncatedPsbtJsonText, value);
+ }
+
+
+
public string TransactionHexText
{
get => _psbtHexText;
@@ -131,6 +164,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
this.RaisePropertyChanged(nameof(IsLurkingWifeMode));
this.RaisePropertyChanged(nameof(TxId));
this.RaisePropertyChanged(nameof(PsbtJsonText));
+ this.RaisePropertyChanged(nameof(TruncatedPsbtJsonText));
this.RaisePropertyChanged(nameof(TransactionHexText));
this.RaisePropertyChanged(nameof(PsbtBase64Text));
}).DisposeWith(disposables);
@@ -142,6 +176,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
TxId = result.Transaction.GetHash().ToString();
PsbtJsonText = result.Psbt.ToString();
+
+ var isTruncated = PsbtJsonText.Length > _jsonCharLimit;
+
+ TruncatedPsbtJsonText = isTruncated ? $"{PsbtJsonText[0.._jsonCharLimit]}..." : PsbtJsonText;
+ PsbtJsonTextHeader = isTruncated ? "PSBT Json (Truncated)" : "PSBT Json";
+
TransactionHexText = result.Transaction.Transaction.ToHex();
PsbtBase64Text = result.Psbt.ToBase64();
PsbtBytes = result.Psbt.ToBytes();

prototyping stuff...