From 0dc778f5d4b402544b7dc8567a5befb05f93ca45 Mon Sep 17 00:00:00 2001 From: Rui <102453770+ruixhuang@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:35:42 -0500 Subject: [PATCH] MOB-297: Fix total dydx amount not populated from Profile tab (#101) * MOB-297: Fix total dydx amount not populated from Profile tab * Address feedback --- dydx/Podfile.lock | 2 +- dydx/Pods/Manifest.lock | 2 +- .../dydxProfileBalancesViewPresenter.swift | 29 ++++++++++++------- .../AbacusState+Combine.swift | 4 +-- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/dydx/Podfile.lock b/dydx/Podfile.lock index 4a71328ec..1c639f726 100644 --- a/dydx/Podfile.lock +++ b/dydx/Podfile.lock @@ -445,4 +445,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9e6e5d5e9ea0594fa77a099c8fd30545318f1cb9 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/dydx/Pods/Manifest.lock b/dydx/Pods/Manifest.lock index 4a71328ec..1c639f726 100644 --- a/dydx/Pods/Manifest.lock +++ b/dydx/Pods/Manifest.lock @@ -445,4 +445,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9e6e5d5e9ea0594fa77a099c8fd30545318f1cb9 -COCOAPODS: 1.14.3 +COCOAPODS: 1.15.2 diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/Profile/Components/dydxProfileBalancesViewPresenter.swift b/dydx/dydxPresenters/dydxPresenters/_v4/Profile/Components/dydxProfileBalancesViewPresenter.swift index 8700410b8..02429e782 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/Profile/Components/dydxProfileBalancesViewPresenter.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/Profile/Components/dydxProfileBalancesViewPresenter.swift @@ -32,10 +32,16 @@ public class dydxProfileBalancesViewPresenter: HostedViewPresenter AnyPublisher { + public func stakingBalance(of tokenDenom: String?) -> AnyPublisher { account .map { account in - self.parser.asDecimal(account?.stakingBalances?[tokenDenom]?.amount)?.doubleValue + self.parser.asDecimal(account?.stakingBalances?[tokenDenom ?? ""]?.amount)?.doubleValue } .removeDuplicates() .share()