Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
IOS-7012 Fix provider change on error (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorov-d authored Jul 22, 2024
1 parent 8a47f44 commit 6eadbf4
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class EthereumNetworkService: MultiNetworkProvider {
.setFailureType(to: Error.self)
.withWeakCaptureOf(self)
.flatMap { networkService, token in
networkService.providerPublisher { provider -> AnyPublisher<(Token, Result<Decimal, Error>), Error> in
networkService.providerPublisher { provider -> AnyPublisher<Decimal, Error> in
let method = TokenBalanceERC20TokenMethod(owner: address)

return provider
Expand All @@ -158,11 +158,12 @@ class EthereumNetworkService: MultiNetworkProvider {

return value
}
.mapToResult()
.map { (token, $0) }
.setFailureType(to: Error.self)
.eraseToAnyPublisher()
}
.mapToResult()
.setFailureType(to: Error.self)
.map { (token, $0) }
.eraseToAnyPublisher()
}
.collect()
.map { $0.reduce(into: [Token: Result<Decimal, Error>]()) { $0[$1.0] = $1.1 }}
Expand Down

0 comments on commit 6eadbf4

Please sign in to comment.