Skip to content

Commit

Permalink
Merge pull request #833 from novasamatech/fix/redeem-all-parachain
Browse files Browse the repository at this point in the history
Fix redeem all from parachain & crash fix
  • Loading branch information
ERussel authored Sep 25, 2023
2 parents 5f1b63c + 82f4bcd commit ab84756
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions novawallet/Modules/AssetDetails/AssetDetailsInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import UIKit
import RobinHood

final class AssetDetailsInteractor {
weak var presenter: AssetDetailsInteractorOutputProtocol!
weak var presenter: AssetDetailsInteractorOutputProtocol?
let chainAsset: ChainAsset
let selectedMetaAccount: MetaAccountModel
let walletLocalSubscriptionFactory: WalletLocalSubscriptionFactoryProtocol
Expand Down Expand Up @@ -46,7 +46,7 @@ final class AssetDetailsInteractor {
if let priceId = chainAsset.asset.priceId {
priceSubscription = subscribeToPrice(for: priceId, currency: selectedCurrency)
} else {
presenter.didReceive(price: nil)
presenter?.didReceive(price: nil)
}
}

Expand All @@ -71,8 +71,8 @@ final class AssetDetailsInteractor {

operations.insert(.receive)

presenter.didReceive(purchaseActions: actions)
presenter.didReceive(availableOperations: operations)
presenter?.didReceive(purchaseActions: actions)
presenter?.didReceive(availableOperations: operations)
}
}

Expand Down Expand Up @@ -121,12 +121,12 @@ extension AssetDetailsInteractor: WalletLocalStorageSubscriber, WalletLocalSubsc

switch result {
case let .success(balance):
presenter.didReceive(balance: balance ?? AssetBalance.createZero(
presenter?.didReceive(balance: balance ?? AssetBalance.createZero(
for: chainAsset.chainAssetId,
accountId: accountId
))
case let .failure(error):
presenter.didReceive(error: .accountBalance(error))
presenter?.didReceive(error: .accountBalance(error))
}
}

Expand All @@ -144,9 +144,9 @@ extension AssetDetailsInteractor: WalletLocalStorageSubscriber, WalletLocalSubsc

switch result {
case let .failure(error):
presenter.didReceive(error: .locks(error))
presenter?.didReceive(error: .locks(error))
case let .success(changes):
presenter.didReceive(lockChanges: changes)
presenter?.didReceive(lockChanges: changes)
}
}
}
Expand All @@ -155,9 +155,9 @@ extension AssetDetailsInteractor: PriceLocalStorageSubscriber, PriceLocalSubscri
func handlePrice(result: Result<PriceData?, Error>, priceId _: AssetModel.PriceId) {
switch result {
case let .success(priceData):
presenter.didReceive(price: priceData)
presenter?.didReceive(price: priceData)
case let .failure(error):
presenter.didReceive(error: .price(error))
presenter?.didReceive(error: .price(error))
}
}
}
Expand All @@ -178,9 +178,9 @@ extension AssetDetailsInteractor: ExternalAssetBalanceSubscriber, ExternalAssetB
) {
switch result {
case let .success(externalBalanceChanges):
presenter.didReceive(externalBalanceChanges: externalBalanceChanges)
presenter?.didReceive(externalBalanceChanges: externalBalanceChanges)
case let .failure(error):
presenter.didReceive(error: .externalBalances(error))
presenter?.didReceive(error: .externalBalances(error))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class ParaStkRedeemPresenter {
func isRedeemAll() -> Bool {
let staked = delegator?.staked ?? 0
let unstakingCollators = scheduledRequests?.map(\.collatorId) ?? []
let redeemableCollators = redeemableCollators()
let redeemableCollators = redeemableCollators() ?? []

let unstakedAll = Set(unstakingCollators) == redeemableCollators

Expand Down

0 comments on commit ab84756

Please sign in to comment.