Documentation ¶
Index ¶
- Constants
- type Attribute
- type AttributeDisplayType
- type Collection
- type File
- type FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) Build() (*Metadata, error)
- func (b *FungibleAssetMetadataBuilder) SetAnimationURL(animationURL string) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetAttribute(key string, value any) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetAttributeStruct(attr Attribute) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetAttributes(attributes []Attribute) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetDescription(description string) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetExternalURL(externalURL string) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetImage(image string) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetName(name string) *FungibleAssetMetadataBuilder
- func (b *FungibleAssetMetadataBuilder) SetSymbol(symbol string) *FungibleAssetMetadataBuilder
- type FungibleTokenMetadataBuilder
- func (b *FungibleTokenMetadataBuilder) Build() (*Metadata, error)
- func (b *FungibleTokenMetadataBuilder) SetDescription(description string) *FungibleTokenMetadataBuilder
- func (b *FungibleTokenMetadataBuilder) SetExternalURL(externalURL string) *FungibleTokenMetadataBuilder
- func (b *FungibleTokenMetadataBuilder) SetImage(image string) *FungibleTokenMetadataBuilder
- func (b *FungibleTokenMetadataBuilder) SetName(name string) *FungibleTokenMetadataBuilder
- func (b *FungibleTokenMetadataBuilder) SetSymbol(symbol string) *FungibleTokenMetadataBuilder
- type Metadata
- type NFTMetadataBuilder
- func (b *NFTMetadataBuilder) Build() (*Metadata, error)
- func (b *NFTMetadataBuilder) SetAnimationURL(animationURL string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetAttribute(key string, value any) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetAttributeStruct(attr Attribute) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetAttributes(attributes []Attribute) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetCategory(category PropertyCategory) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetCollection(name, family string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetCustomProperties(properties map[string]interface{}) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetCustomProperty(key string, value any) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetDescription(description string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetExternalURL(externalURL string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetFile(fileURI string, fileType string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetFileWithCDN(fileURI string, fileType string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetFiles(files []File) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetImage(image string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetName(name string) *NFTMetadataBuilder
- func (b *NFTMetadataBuilder) SetSymbol(symbol string) *NFTMetadataBuilder
- type Properties
- type PropertiesMap
- type PropertyCategory
- type TokenList
- type TokenListTag
- type TokenListToken
Constants ¶
const ( ChainIdMainnet = 101 // Mainnet-beta ChainIdTestnet = 102 // Testnet )
Token list chain IDs
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { TraitType string `json:"trait_type"` Value interface{} `json:"value"` // Optional DisplayType AttributeDisplayType `json:"display_type,omitempty"` // string, number, boolean, date MaxValue int64 `json:"max_value,omitempty"` TraitCount int64 `json:"trait_count,omitempty"` }
Attribute represents the attribute of a non-fungible token
type AttributeDisplayType ¶
type AttributeDisplayType string
Attribute represents a display type of attribute of a non-fungible token
const ( AttributeDisplayString AttributeDisplayType = "string" AttributeDisplayNumber AttributeDisplayType = "number" AttributeDisplayBoolean AttributeDisplayType = "boolean" AttributeDisplayDate AttributeDisplayType = "date" AttributeDisplayTime AttributeDisplayType = "time" AttributeDisplayDateTime AttributeDisplayType = "datetime" )
Predefined nft attribute display types
type Collection ¶
type Collection struct { Name string `json:"name"` Family string `json:"family,omitempty"` // Optional }
@deprecated Collection represents the collection of a non-fungible token Do not use - may be removed in a future release. Use on-chain data instead.
type File ¶
type File struct { // Mandatory URI string `json:"uri"` Type string `json:"type,omitempty"` // Optional CDN bool `json:"cdn,omitempty"` }
File represents the file of a non-fungible token
type FungibleAssetMetadataBuilder ¶
type FungibleAssetMetadataBuilder struct {
// contains filtered or unexported fields
}
FungibleAssetMetadataBuilder is a builder to build fungible asset metadata
func NewFungibleAssetMetadataBuilder ¶
func NewFungibleAssetMetadataBuilder() *FungibleAssetMetadataBuilder
NewFungibleAssetMetadataBuilder creates a new FungibleAssetMetadataBuilder
func (*FungibleAssetMetadataBuilder) Build ¶
func (b *FungibleAssetMetadataBuilder) Build() (*Metadata, error)
Build builds the fungible asset metadata
func (*FungibleAssetMetadataBuilder) SetAnimationURL ¶
func (b *FungibleAssetMetadataBuilder) SetAnimationURL(animationURL string) *FungibleAssetMetadataBuilder
SetAnimationURL sets the animation URL of the asset
func (*FungibleAssetMetadataBuilder) SetAttribute ¶
func (b *FungibleAssetMetadataBuilder) SetAttribute(key string, value any) *FungibleAssetMetadataBuilder
SetAttribute adds an attribute to the asset
func (*FungibleAssetMetadataBuilder) SetAttributeStruct ¶
func (b *FungibleAssetMetadataBuilder) SetAttributeStruct(attr Attribute) *FungibleAssetMetadataBuilder
SetAttributeStruct adds an attribute to the asset
func (*FungibleAssetMetadataBuilder) SetAttributes ¶
func (b *FungibleAssetMetadataBuilder) SetAttributes(attributes []Attribute) *FungibleAssetMetadataBuilder
SetAttributes sets the attributes of the asset
func (*FungibleAssetMetadataBuilder) SetDescription ¶
func (b *FungibleAssetMetadataBuilder) SetDescription(description string) *FungibleAssetMetadataBuilder
SetDescription sets the description of the asset
func (*FungibleAssetMetadataBuilder) SetExternalURL ¶
func (b *FungibleAssetMetadataBuilder) SetExternalURL(externalURL string) *FungibleAssetMetadataBuilder
SetExternalURL sets the external URL of the asset
func (*FungibleAssetMetadataBuilder) SetImage ¶
func (b *FungibleAssetMetadataBuilder) SetImage(image string) *FungibleAssetMetadataBuilder
SetImage sets the image of the asset
func (*FungibleAssetMetadataBuilder) SetName ¶
func (b *FungibleAssetMetadataBuilder) SetName(name string) *FungibleAssetMetadataBuilder
SetName sets the name of the asset
func (*FungibleAssetMetadataBuilder) SetSymbol ¶
func (b *FungibleAssetMetadataBuilder) SetSymbol(symbol string) *FungibleAssetMetadataBuilder
SetSymbol sets the symbol of the asset
type FungibleTokenMetadataBuilder ¶
type FungibleTokenMetadataBuilder struct {
// contains filtered or unexported fields
}
FungibleTokenMetadataBuilder is a builder to build fungible token metadata
func NewFungibleTokenMetadataBuilder ¶
func NewFungibleTokenMetadataBuilder() *FungibleTokenMetadataBuilder
NewFungibleTokenMetadataBuilder creates a new FungibleTokenMetadataBuilder
func (*FungibleTokenMetadataBuilder) Build ¶
func (b *FungibleTokenMetadataBuilder) Build() (*Metadata, error)
Build builds the fungible token metadata
func (*FungibleTokenMetadataBuilder) SetDescription ¶
func (b *FungibleTokenMetadataBuilder) SetDescription(description string) *FungibleTokenMetadataBuilder
SetDescription sets the description of the token
func (*FungibleTokenMetadataBuilder) SetExternalURL ¶
func (b *FungibleTokenMetadataBuilder) SetExternalURL(externalURL string) *FungibleTokenMetadataBuilder
SetExternalURL sets the external url of the token
func (*FungibleTokenMetadataBuilder) SetImage ¶
func (b *FungibleTokenMetadataBuilder) SetImage(image string) *FungibleTokenMetadataBuilder
SetImage sets the image of the token
func (*FungibleTokenMetadataBuilder) SetName ¶
func (b *FungibleTokenMetadataBuilder) SetName(name string) *FungibleTokenMetadataBuilder
SetName sets the name of the token
func (*FungibleTokenMetadataBuilder) SetSymbol ¶
func (b *FungibleTokenMetadataBuilder) SetSymbol(symbol string) *FungibleTokenMetadataBuilder
SetSymbol sets the symbol of the token
type Metadata ¶
type Metadata struct { // The name of the asset. Name string `json:"name"` // The symbol of the asset. Symbol string `json:"symbol"` // Human readable description of the asset. Description string `json:"description,omitempty"` // URL to the image of the asset. PNG, GIF and JPG file formats are supported. // You may use the ?ext={file_extension} query to provide information on the file type. Image string `json:"image,omitempty"` // URL to a multi-media attachment of the asset. // The supported file formats are // MP4 and MOV for video, // MP3, FLAC and WAV for audio, // GLB for AR/3D assets, // You may use the ?ext={file_extension} query to provide information on the file type. AnimationURL string `json:"animation_url,omitempty"` // URL to an external application or website where users can also view the asset. ExternalURL string `json:"external_url,omitempty"` // Attribute represents the attribute of a token Attributes []Attribute `json:"attributes,omitempty"` // Properties represents the properties of a non-fungible token Properties PropertiesMap `json:"properties,omitempty"` }
Metadata represents the metadata of a fungible/semi-fungible/non-fungible token
func MetadataFromJSON ¶
MetadataFromJSON parses the metadata from JSON The JSON must be a valid JSON string that can be unmarshalled into a Metadata struct
func MetadataFromURI ¶
MetadataFromURI parses the metadata from a URI The URI must be a valid HTTP(S) URL
type NFTMetadataBuilder ¶
type NFTMetadataBuilder struct {
// contains filtered or unexported fields
}
NFTMetadataBuilder is a builder to build non-fungible asset metadata
func NewNFTMetadataBuilder ¶
func NewNFTMetadataBuilder() *NFTMetadataBuilder
NewNFTMetadataBuilder creates a new NFTMetadataBuilder
func (*NFTMetadataBuilder) Build ¶
func (b *NFTMetadataBuilder) Build() (*Metadata, error)
Build builds the fungible asset metadata
func (*NFTMetadataBuilder) SetAnimationURL ¶
func (b *NFTMetadataBuilder) SetAnimationURL(animationURL string) *NFTMetadataBuilder
SetAnimationURL sets the animation URL of the asset
func (*NFTMetadataBuilder) SetAttribute ¶
func (b *NFTMetadataBuilder) SetAttribute(key string, value any) *NFTMetadataBuilder
SetAttribute adds an attribute to the asset
func (*NFTMetadataBuilder) SetAttributeStruct ¶
func (b *NFTMetadataBuilder) SetAttributeStruct(attr Attribute) *NFTMetadataBuilder
SetAttributeStruct adds an attribute to the asset
func (*NFTMetadataBuilder) SetAttributes ¶
func (b *NFTMetadataBuilder) SetAttributes(attributes []Attribute) *NFTMetadataBuilder
Attributes sets the attributes of the asset
func (*NFTMetadataBuilder) SetCategory ¶
func (b *NFTMetadataBuilder) SetCategory(category PropertyCategory) *NFTMetadataBuilder
SetCategory sets the category of the non-fungible token
func (*NFTMetadataBuilder) SetCollection ¶
func (b *NFTMetadataBuilder) SetCollection(name, family string) *NFTMetadataBuilder
@deprecated SetCollection sets the collection of the non-fungible token
func (*NFTMetadataBuilder) SetCustomProperties ¶
func (b *NFTMetadataBuilder) SetCustomProperties(properties map[string]interface{}) *NFTMetadataBuilder
SetCustomProperties adds custom properties to the non-fungible token
func (*NFTMetadataBuilder) SetCustomProperty ¶
func (b *NFTMetadataBuilder) SetCustomProperty(key string, value any) *NFTMetadataBuilder
SetCustomProperty adds a custom property to the non-fungible token
func (*NFTMetadataBuilder) SetDescription ¶
func (b *NFTMetadataBuilder) SetDescription(description string) *NFTMetadataBuilder
SetDescription sets the description of the asset
func (*NFTMetadataBuilder) SetExternalURL ¶
func (b *NFTMetadataBuilder) SetExternalURL(externalURL string) *NFTMetadataBuilder
SetExternalURL sets the external URL of the asset
func (*NFTMetadataBuilder) SetFile ¶
func (b *NFTMetadataBuilder) SetFile(fileURI string, fileType string) *NFTMetadataBuilder
SetFile adds a file to the non-fungible token
func (*NFTMetadataBuilder) SetFileWithCDN ¶
func (b *NFTMetadataBuilder) SetFileWithCDN(fileURI string, fileType string) *NFTMetadataBuilder
SetFileWithCDN adds a file to the non-fungible token
func (*NFTMetadataBuilder) SetFiles ¶
func (b *NFTMetadataBuilder) SetFiles(files []File) *NFTMetadataBuilder
SetFiles sets the files of the non-fungible token
func (*NFTMetadataBuilder) SetImage ¶
func (b *NFTMetadataBuilder) SetImage(image string) *NFTMetadataBuilder
SetImage sets the image of the asset
func (*NFTMetadataBuilder) SetName ¶
func (b *NFTMetadataBuilder) SetName(name string) *NFTMetadataBuilder
SetName sets the name of the asset
func (*NFTMetadataBuilder) SetSymbol ¶
func (b *NFTMetadataBuilder) SetSymbol(symbol string) *NFTMetadataBuilder
SetSymbol sets the symbol of the asset
type Properties ¶
type Properties struct { Files []File `json:"files"` Category PropertyCategory `json:"category,omitempty"` CustomFields map[string]interface{} `json:"ext,omitempty"` Collection *Collection `json:"collection,omitempty"` }
Properties represents the properties of a non-fungible token
type PropertyCategory ¶
type PropertyCategory string
PropertyCategory represents the category of a non-fungible token E.g. image, video, audio, vr, html
const ( PropertyCategoryImage PropertyCategory = "image" // PNG, GIF, JPG PropertyCategoryVideo PropertyCategory = "video" // MP4, MOV PropertyCategoryAudio PropertyCategory = "audio" // MP3, FLAC, WAV PropertyCategoryVr PropertyCategory = "vr" // 3D models; GLB, GLTF PropertyCategoryHtml PropertyCategory = "html" // HTML pages; scripts and relative paths within the HTML page are also supported )
Supported property categories
type TokenList ¶
type TokenList struct { Name string `json:"name"` LogoURI string `json:"logoURI"` Keywords []string `json:"keywords"` Tags map[string]TokenListTag `json:"tags"` Tokens []TokenListToken `json:"tokens"` }
@deprecated This is a temporary solution to support the deprecated metadata format.
type TokenListTag ¶
@deprecated This is a temporary solution to support the deprecated metadata format.
type TokenListToken ¶
type TokenListToken struct { ChainID int `json:"chainId"` Address string `json:"address"` Symbol string `json:"symbol"` Name string `json:"name"` Decimals int `json:"decimals"` LogoURI string `json:"logoURI"` Tags []string `json:"tags,omitempty"` Extensions map[string]interface{} `json:"extensions,omitempty"` }
@deprecated This is a temporary solution to support the deprecated metadata format.