Skip to content

Commit

Permalink
Use NonEmptyString
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Aug 16, 2023
1 parent 57b47d2 commit 269846e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) ?? []
}
}

Expand Down
5 changes: 3 additions & 2 deletions Sources/Core/SharedModels/Assets/AssetTag.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit 269846e

Please sign in to comment.