Skip to content

Commit

Permalink
Minimal Decoupling TransactionSummaryViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
ichthus1604 committed Apr 17, 2024
1 parent e23b106 commit a7947ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions WalletWasabi.Fluent/Models/Wallets/WalletTransactionsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public async Task<SmartTransaction> LoadFromFileAsync(string path)

public TimeSpan? TryEstimateConfirmationTime(TransactionModel model) => TryEstimateConfirmationTime(model.Id);

public TimeSpan? TryEstimateConfirmationTime(TransactionInfo info)
{
TransactionFeeHelper.TryEstimateConfirmationTime(_wallet, info.FeeRate, out var estimate);
return estimate;
}

public TransactionInfo Create(string address, decimal amount, string label) =>
Create(address, amount, new LabelsArray(label));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;

public partial class TransactionSummaryViewModel : ViewModelBase
{
private readonly Wallet _wallet;
private readonly IWalletModel _wallet;
private BuildTransactionResult? _transaction;
[AutoNotify] private bool _transactionHasChange;
[AutoNotify] private TimeSpan? _confirmationTime;
Expand All @@ -24,7 +24,7 @@ public partial class TransactionSummaryViewModel : ViewModelBase
[AutoNotify] private double? _amountDiff;
[AutoNotify] private double? _feeDiff;

private TransactionSummaryViewModel(TransactionPreviewViewModel parent, Wallet wallet, TransactionInfo info, bool isPreview = false)
private TransactionSummaryViewModel(TransactionPreviewViewModel parent, IWalletModel wallet, TransactionInfo info, bool isPreview = false)
{
Parent = parent;
_wallet = wallet;
Expand All @@ -48,8 +48,7 @@ public void UpdateTransaction(BuildTransactionResult transactionResult, Transact
{
_transaction = transactionResult;

TransactionFeeHelper.TryEstimateConfirmationTime(_wallet, info.FeeRate, out var estimate);
ConfirmationTime = estimate;
ConfirmationTime = _wallet.Transactions.TryEstimateConfirmationTime(info);

var destinationAmount = _transaction.CalculateDestinationAmount(info.Destination);

Expand Down

0 comments on commit a7947ec

Please sign in to comment.