token_metadata

package
v0.1.7-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2023 License: AGPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PubNil = common.PublicKey{}

PubNil is a nil public key

Functions

func DeriveCollectionAuthorityRecord

func DeriveCollectionAuthorityRecord(mint, authority common.PublicKey) (common.PublicKey, error)

DeriveCollectionAuthorityRecord returns the collection authority record public key.

func DeriveEditionMarkerPubkey

func DeriveEditionMarkerPubkey(mint common.PublicKey, edition uint64) (common.PublicKey, error)

DeriveEditionMarkerPubkey returns the edition marker public key.

func DeriveEditionPubkey

func DeriveEditionPubkey(mint common.PublicKey) (common.PublicKey, error)

DeriveEditionPubkey returns the edition public key.

func DeriveTokenMetadataPubkey

func DeriveTokenMetadataPubkey(mint common.PublicKey) (common.PublicKey, error)

DeriveTokenMetadataPubkey returns the token metadata program public key.

func DeriveUseAuthorityRecord

func DeriveUseAuthorityRecord(mint, authority common.PublicKey) (common.PublicKey, error)

DeriveUseAuthorityRecord returns the use authority record public key.

Types

type Collection

type Collection struct {
	Verified bool   `json:"verified"`
	Key      string `json:"key"`
	Size     uint64 `json:"size,omitempty"`
}

type Creator

type Creator struct {
	Address  string `json:"address"`
	Verified bool   `json:"verified"`
	Share    uint8  `json:"share"`
}

type Edition

type Edition struct {
	Type      string `json:"type,omitempty"`
	Supply    uint64 `json:"supply,omitempty"`
	MaxSupply uint64 `json:"max_supply,omitempty"`
	Edition   uint64 `json:"edition,omitempty"`
}

func DeserializeEdition

func DeserializeEdition(data []byte, getAccountInfo getAccountInfoFunc) (*Edition, error)

DeserializeEdition deserializes the edition.

func DeserializeMasterEdition

func DeserializeMasterEdition(data []byte) (*Edition, error)

DeserializeMasterEdition deserializes the master edition data.

type EditionData

type EditionData struct {
	Key     token_metadata.Key
	Parent  common.PublicKey
	Edition uint64
}

type EditionKey

type EditionKey struct {
	Key token_metadata.Key
}

type Key

type Key string

Token metadata edition key

const (
	KeyUndefined                 Key = "undefined"
	KeyMasterEdition             Key = "master_edition"
	KeyPrintedEdition            Key = "edition"
	KeyReservationList           Key = "reservation_list"
	KeyMetadata                  Key = "metadata"
	KeyEditionMarker             Key = "edition_marker"
	KeyUseAuthorityRecord        Key = "use_authority_record"
	KeyCollectionAuthorityRecord Key = "collection_authority_record"
)

Predefined token editions

func CastToKey

func CastToKey(k token_metadata.Key) Key

Cast token_metadata.Key to Key

func (Key) String

func (k Key) String() string

String returns the string representation of the key.

type Metadata

type Metadata struct {
	UpdateAuthority      string             `json:"update_authority"`
	Mint                 string             `json:"mint"`
	PrimarySaleHappened  bool               `json:"primary_sale_happened,omitempty"`
	IsMutable            bool               `json:"is_mutable"`
	EditionNonce         *uint8             `json:"edition_nonce,omitempty"`
	TokenStandard        string             `json:"token_standard"`
	Collection           *Collection        `json:"collection,omitempty"`
	Uses                 *Uses              `json:"uses,omitempty"`
	Edition              *Edition           `json:"edition,omitempty"`
	MetadataUri          string             `json:"metadata_uri,omitempty"`
	SellerFeeBasisPoints uint16             `json:"seller_fee_basis_points,omitempty"`
	Creators             []Creator          `json:"creators,omitempty"`
	Data                 *metadata.Metadata `json:"data,omitempty"`
}

Metadata represents the metadata of a token.

func DeserializeMetadata

func DeserializeMetadata(data []byte) (*Metadata, error)

DeserializeMetadata deserializes the metadata.

type TokenMetadataInstructionBuilder

type TokenMetadataInstructionBuilder struct {
	// contains filtered or unexported fields
}

TokenMetadataInstructionBuilder is a builder for token metadata instructions

func NewTokenMetadataInstructionBuilder

func NewTokenMetadataInstructionBuilder() *TokenMetadataInstructionBuilder

NewTokenMetadataInstructionBuilder creates a new TokenMetadataInstructionBuilder

func (*TokenMetadataInstructionBuilder) Build

func (b *TokenMetadataInstructionBuilder) Build() (meta common.PublicKey, instruction types.Instruction, err error)

Build builds the instruction

func (*TokenMetadataInstructionBuilder) IsMutable

IsMutable sets the is mutable

func (*TokenMetadataInstructionBuilder) SetCollection

SetCollection sets the on-chain collection This is used to group tokens together. Collection should be verified by the owner of the collection.

func (*TokenMetadataInstructionBuilder) SetCollectionBase58

func (b *TokenMetadataInstructionBuilder) SetCollectionBase58(collection string) *TokenMetadataInstructionBuilder

SetCollectionBase58 sets the on-chain collection public key encoded in base58

func (*TokenMetadataInstructionBuilder) SetCreator

SetCreator sets

func (*TokenMetadataInstructionBuilder) SetCreatorBase58

func (b *TokenMetadataInstructionBuilder) SetCreatorBase58(creator string, share uint8) *TokenMetadataInstructionBuilder

SetCreatorBase58 sets the creator public key encoded in base58

func (*TokenMetadataInstructionBuilder) SetData

SetData sets the data

func (*TokenMetadataInstructionBuilder) SetMetadata

SetMetadata sets the metadata public key

func (*TokenMetadataInstructionBuilder) SetMetadataBase58

SetMetadataBase58 sets the metadata public key from base58 string

func (*TokenMetadataInstructionBuilder) SetMint

SetMint sets the mint public key

func (*TokenMetadataInstructionBuilder) SetMintAuthority

SetMintAuthority sets the mint authority public key

func (*TokenMetadataInstructionBuilder) SetMintAuthorityBase58

func (b *TokenMetadataInstructionBuilder) SetMintAuthorityBase58(mintAuthority string) *TokenMetadataInstructionBuilder

SetMintAuthorityBase58 sets the mint authority public key from base58 string

func (*TokenMetadataInstructionBuilder) SetMintBase58

SetMintBase58 sets the mint public key from base58 string

func (*TokenMetadataInstructionBuilder) SetName

SetName sets the name

func (*TokenMetadataInstructionBuilder) SetPayer

SetPayer sets the payer public key

func (*TokenMetadataInstructionBuilder) SetPayerBase58

SetPayerBase58 sets the payer public key from base58 string

func (*TokenMetadataInstructionBuilder) SetSellerFeeBasisPoints

func (b *TokenMetadataInstructionBuilder) SetSellerFeeBasisPoints(sellerFeeBasisPoints uint16) *TokenMetadataInstructionBuilder

SetSellerFeeBasisPoints sets the seller fee basis points

func (*TokenMetadataInstructionBuilder) SetSymbol

SetSymbol sets the symbol

func (*TokenMetadataInstructionBuilder) SetUpdateAuthority

func (b *TokenMetadataInstructionBuilder) SetUpdateAuthority(updateAuthority common.PublicKey) *TokenMetadataInstructionBuilder

SetUpdateAuthority sets the update authority public key

func (*TokenMetadataInstructionBuilder) SetUpdateAuthorityBase58

func (b *TokenMetadataInstructionBuilder) SetUpdateAuthorityBase58(updateAuthority string) *TokenMetadataInstructionBuilder

SetUpdateAuthorityBase58 sets the update authority public key from base58 string

func (*TokenMetadataInstructionBuilder) SetUri

SetUri sets the uri

func (*TokenMetadataInstructionBuilder) SetUses

SetUses provides a way to set the number of times a token can be used. This is useful for NFTs that can be used multiple times. For example, a ticket NFT that can be used once.

func (*TokenMetadataInstructionBuilder) UpdateAuthorityIsSigner

func (b *TokenMetadataInstructionBuilder) UpdateAuthorityIsSigner(updateAuthorityIsSigner bool) *TokenMetadataInstructionBuilder

UpdateAuthorityIsSigner sets the update authority is signer

type TokenStandard

type TokenStandard string

TokenStandard represents the standard of a token.

const (
	TokenStandardUndefined               TokenStandard = "undefined"
	TokenStandardNonFungible             TokenStandard = "non_fungible"
	TokenStandardNonFungibleEdition      TokenStandard = "non_fungible_edition"
	TokenStandardFungibleAsset           TokenStandard = "fungible_asset"
	TokenStandardFungible                TokenStandard = "fungible"
	TokenStandardProgrammableNonFungible TokenStandard = "programmable_non_fungible"
)

Token standards enum

func CastToTokenStandard

func CastToTokenStandard(s token_metadata.TokenStandard) TokenStandard

CastToTokenStandard casts token_metadata.TokenStandard to TokenStandard.

func (TokenStandard) String

func (s TokenStandard) String() string

String returns the string representation of the token standard.

func (TokenStandard) ToSystemTokenStandard

func (s TokenStandard) ToSystemTokenStandard() token_metadata.TokenStandard

ToSystemTokenStandard returns the system token standard.

func (TokenStandard) Valid

func (s TokenStandard) Valid() bool

Valid returns true if the token standard is valid.

type TokenUseMethod

type TokenUseMethod string

TokenUseMethod represents the use method of a token.

const (
	TokenUseMethodUnknown TokenUseMethod = "unknown"
	TokenUseMethodBurn    TokenUseMethod = "burn"
	TokenUseMethodSingle  TokenUseMethod = "single"
	TokenUseMethodMulti   TokenUseMethod = "multiple"
)

TokenUseMethod enum.

func CastMetadataUseMethod

func CastMetadataUseMethod(m token_metadata.UseMethod) TokenUseMethod

CastMetadataUseMethod converts the token_metadata.UseMethod to TokenUseMethod.

func (TokenUseMethod) String

func (m TokenUseMethod) String() string

String returns the string representation of the token use method.

func (TokenUseMethod) ToMetadataUseMethod

func (m TokenUseMethod) ToMetadataUseMethod() token_metadata.UseMethod

ToMetadataUseMethod converts the token use method to token_metadata.UseMethod.

func (TokenUseMethod) Valid

func (m TokenUseMethod) Valid() bool

Valid returns true if the token use method is valid.

type Uses

type Uses struct {
	UseMethod string `json:"use_method"`
	Total     uint64 `json:"total"`
	Remaining uint64 `json:"remaining"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL