From 269846e1c235cda346eca087364399c845df7bd0 Mon Sep 17 00:00:00 2001 From: kugel3 Date: Wed, 16 Aug 2023 18:06:26 +0200 Subject: [PATCH] Use NonEmptyString --- .../AccountPortfoliosClient+Live.swift | 2 +- Sources/Core/SharedModels/Assets/AssetTag.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/Clients/AccountPortfoliosClient/AccountPortfoliosClient+Live.swift b/Sources/Clients/AccountPortfoliosClient/AccountPortfoliosClient+Live.swift index 2b69767616..75f1457928 100644 --- a/Sources/Clients/AccountPortfoliosClient/AccountPortfoliosClient+Live.swift +++ b/Sources/Clients/AccountPortfoliosClient/AccountPortfoliosClient+Live.swift @@ -803,7 +803,7 @@ extension AccountPortfoliosClient { extension AccountPortfoliosClient { @Sendable static func extractTags(item: GatewayAPI.StateEntityDetailsResponseItem) -> [AssetTag] { - item.metadata.tags?.map(AssetTag.init) ?? [] + item.metadata.tags?.compactMap(NonEmptyString.init(rawValue:)).map(AssetTag.init) ?? [] } } diff --git a/Sources/Core/SharedModels/Assets/AssetTag.swift b/Sources/Core/SharedModels/Assets/AssetTag.swift index a39901328e..892b0906b4 100644 --- a/Sources/Core/SharedModels/Assets/AssetTag.swift +++ b/Sources/Core/SharedModels/Assets/AssetTag.swift @@ -1,13 +1,14 @@ import Foundation +import NonEmpty // MARK: - AssetTag public enum AssetTag: Hashable, Sendable, Codable { case officialRadix - case custom(String) + case custom(NonEmptyString) } extension AssetTag { - public init(_ customString: String) { + public init(_ customString: NonEmptyString) { self = .custom(customString) } }