Skip to content

Commit

Permalink
fix wallet display on confirm screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ERussel committed Dec 17, 2024
1 parent 7af3d0d commit 51ca28b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protocol SwapDetailsViewModelFactoryProtocol: SwapBaseViewModelFactoryProtocol {

func slippageViewModel(slippage: BigRational, locale: Locale) -> String

func walletViewModel(walletAddress: WalletDisplayAddress) -> WalletAccountViewModel?
func walletViewModel(metaAccountResponse: MetaChainAccountResponse) -> WalletAccountViewModel?
}

final class SwapDetailsViewModelFactory: SwapBaseViewModelFactory {
Expand Down Expand Up @@ -72,7 +72,7 @@ extension SwapDetailsViewModelFactory: SwapDetailsViewModelFactoryProtocol {
slippage.decimalValue.map { percentForamatter.value(for: locale).stringFromDecimal($0) ?? "" } ?? ""
}

func walletViewModel(walletAddress: WalletDisplayAddress) -> WalletAccountViewModel? {
try? walletViewModelFactory.createViewModel(from: walletAddress)
func walletViewModel(metaAccountResponse: MetaChainAccountResponse) -> WalletAccountViewModel? {
try? walletViewModelFactory.createViewModel(from: metaAccountResponse)
}
}
6 changes: 1 addition & 5 deletions novawallet/Modules/Swaps/Confirm/SwapConfirmPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,7 @@ extension SwapConfirmPresenter {
return
}

guard let walletAddress = WalletDisplayAddress(response: chainAccountResponse) else {
view?.didReceiveWallet(viewModel: nil)
return
}
let viewModel = viewModelFactory.walletViewModel(walletAddress: walletAddress)
let viewModel = viewModelFactory.walletViewModel(metaAccountResponse: chainAccountResponse)

view?.didReceiveWallet(viewModel: viewModel)
}
Expand Down

0 comments on commit 51ca28b

Please sign in to comment.