Merge pull request #3173 from AlphaWallet/remove-forced-unwrap

Remove forced unwrap
pull/3164/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit 09cf1ca8b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      AlphaWallet/Core/Coordinators/WalletBalance/PrivateBalanceFetcher.swift

@ -295,10 +295,9 @@ class PrivateBalanceFetcher: PrivateBalanceFetcherType {
private func fetchErc1155NonFungibleJsons(contractsTokenIdsAndValue: Erc1155TokenIds.ContractsTokenIdsAndValues, tokens: [Activity.AssignedToken]) -> Promise<[TokenIdMetaData]> {
var allGuarantees: [Guarantee<TokenIdMetaData>] = .init()
for (contract, tokenIdsAndValues) in contractsTokenIdsAndValue {
let tokenIds = tokenIdsAndValues.keys
let guarantees: [Guarantee<TokenIdMetaData>] = tokenIds.map { tokenId -> Guarantee<TokenIdMetaData> in
let guarantees: [Guarantee<TokenIdMetaData>] = tokenIdsAndValues.map { tokenId, value -> Guarantee<TokenIdMetaData> in
fetchNonFungibleJson(forTokenId: String(tokenId), address: contract, tokens: tokens).map { jsonString -> TokenIdMetaData in
(contract: contract, tokenId: tokenId, json: jsonString, value: tokenIdsAndValues[tokenId]!)
(contract: contract, tokenId: tokenId, json: jsonString, value: value)
}
}
allGuarantees.append(contentsOf: guarantees)

Loading…
Cancel
Save