TzKTBalanceMetadata
public struct TzKTBalanceMetadata : Codable
Metadata object for the token
-
A human readbale name
Declaration
Swift
public var name: String?
-
The tokens symbol
Declaration
Swift
public var symbol: String?
-
The number of decimals the token has
Declaration
Swift
public var decimals: String
-
Helper to convert the decimals to an Int
Declaration
Swift
public var decimalsInt: Int { get }
-
Details of the available formats that the media is available in
Declaration
Swift
public var formats: [TzKTBalanceMetadataFormat]?
-
URI to an medium/large image owned by the contract
Declaration
Swift
public var displayUri: String?
-
URI to the raw media artifact owned by the token
Declaration
Swift
public var artifactUri: String?
-
URI to an small image for the token, ususally used as an icon when displayed in lists
Declaration
Swift
public var thumbnailUri: String?
-
Description of the token or NFT
Declaration
Swift
public var description: String?
-
URL to the tool that was used to mint the item
Declaration
Swift
public var mintingTool: String?
-
A list of tags to categorize the token / NFT
Declaration
Swift
public var tags: [String]?
-
The address responsible for creating the token / NFT
Declaration
Swift
public var minter: String?
-
Whether or not the symbol or the name is prefered when displaying the token / NFT in a list
Declaration
Swift
public var shouldPreferSymbol: Bool?
-
A collection of attributes about the token/NFT. Although TZIP-16 intended for this to be filled with info such as license, version, possible error messages etc, It has been adopted by NFT creators as a more free-form dictionary. An example would be for gaming NFT’s, this might be a list of attack/defensive moves the character is able to use It is extremely likely that the actual type will be
[[String: String]]
, however due to various issues and complexities of using a strongly typed language like Swift, the easiest solution was to use[Any]
with a custom decoderDeclaration
Swift
public var attributes: [Any]?
-
Flag, in seconds, indicating how long to wait before refreshing the token to update its metadata. E.g. fxHash will inject a token with a name “[Waiting to be Signed]”. and then, all things going well, 30 seconds later its updated to the correct attributes
Declaration
Swift
public let ttl: Int?
-
init(name:
symbol: decimals: formats: displayUri: artifactUri: thumbnailUri: description: mintingTool: tags: minter: shouldPreferSymbol: attributes: ttl: ) Declaration
Swift
public init(name: String?, symbol: String?, decimals: String, formats: [TzKTBalanceMetadataFormat]?, displayUri: String?, artifactUri: String?, thumbnailUri: String?, description: String?, mintingTool: String?, tags: [String]?, minter: String?, shouldPreferSymbol: Bool?, attributes: [Any]?, ttl: Int?)
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Helper to run the URI through the
MediaProxyService
to generate a useable URL for the thumbnail (if available)Declaration
Swift
public var thumbnailURL: URL? { get }
-
Helper to run the URI through the
MediaProxyService
to generate a useable URL for the display image (if available)Declaration
Swift
public var displayURL: URL? { get }
-
Attributes is a complex free-form object. In a lot of cases when NFT’s are games / collectibles, it should be possible to convert most if not all the elements into more simple String: String key value pairs, which will be easier to manage in table / collection views
Declaration
Swift
public func getKeyValuesFromAttributes() -> [TzKTBalanceMetadataAttributeKeyValue]