types

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Default coin codespace
	DefaultCodespace string = ModuleName

	CodeInvalidCollection             CodeType = 101
	CodeUnknownCollection             CodeType = 102
	CodeInvalidNFT                    CodeType = 103
	CodeUnknownNFT                    CodeType = 104
	CodeNFTAlreadyExists              CodeType = 105
	CodeEmptyMetadata                 CodeType = 106
	CodeInvalidQuantity               CodeType = 107
	CodeInvalidReserve                CodeType = 108
	CodeNotAllowedBurn                CodeType = 109
	CodeNotAllowedMint                CodeType = 110
	CodeInvalidDenom                  CodeType = 111
	CodeInvalidTokenID                CodeType = 112
	CodeNotUniqueSubTokenIDs          CodeType = 113
	CodeNotUniqueTokenURI             CodeType = 114
	CodeOwnerDoesNotOwnSubTokenID     CodeType = 115
	CodeInvalidSenderAddress          CodeType = 116
	CodeInvalidRecipientAddress       CodeType = 117
	CodeForbiddenToTransferToYourself CodeType = 118
	CodeNotUniqueTokenID              CodeType = 119
	CodeNotAllowedUpdateNFTReserve    CodeType = 120
	CodeNotSetValueLowerNow           CodeType = 121
	CodeNotEnoughFunds                CodeType = 122
)
View Source
const (
	// ModuleName is the name of the module
	ModuleName = "nft"

	// StoreKey is the default store key for NFT
	StoreKey = coin.StoreKey

	// QuerierRoute is the querier route for the NFT store.
	QuerierRoute = ModuleName

	// RouterKey is the message route for the NFT module
	RouterKey = ModuleName
)
View Source
const NFTPrefix = 0x60
View Source
const OwnerKeyHashLength = 54
View Source
const ReservedPool = "reserved_pool"

Variables

View Source
var (
	EventTypeTransfer         = "transfer_nft"
	EventTypeEditNFTMetadata  = "edit_nft_metadata"
	EventTypeMintNFT          = "mint_nft"
	EventTypeBurnNFT          = "burn_nft"
	EventTypeUpdateReserveNFT = "update_nft_reserve"

	AttributeValueCategory = ModuleName

	AttributeKeySender               = "sender"
	AttributeKeyRecipient            = "recipient"
	AttributeKeyOwner                = "owner"
	AttributeKeyNFTID                = "nft_id"
	AttributeKeyNFTTokenURI          = "token_uri"
	AttributeKeyDenom                = "denom"
	AttributeKeySubTokenIDStartRange = "sub_token_id_start_range"
)

NFT module event types

View Source
var (
	CollectionsKeyPrefix    = []byte{NFTPrefix, 0x00} // key for NFT collections
	OwnersKeyPrefix         = []byte{NFTPrefix, 0x01} // key for balance of NFTs held by an address
	SubTokenKeyPrefix       = []byte{NFTPrefix, 0x02}
	LastSubTokenIDKeyPrefix = []byte{NFTPrefix, 0x03}
	TokenURIKeyPrefix       = []byte{NFTPrefix, 0x04}
	TokenIDKeyPrefix        = []byte{NFTPrefix, 0x05}
)
View Source
var (
	Addrs = CreateTestAddrs(100)

	Denom1    = "test_denom1"
	Denom2    = "test_denom2"
	Denom3    = "test_denom3"
	ID1       = "1"
	ID2       = "2"
	ID3       = "3"
	TokenURI1 = "https://google.com/token-1.json"
	TokenURI2 = "https://google.com/token-2.json"
)

nolint: deadcode unused

View Source
var MinReserve = sdk.NewInt(100)
View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout this module

View Source
var NewMinReserve = helpers.BipToPip(sdk.NewInt(100))
View Source
var NewMinReserve2 = helpers.BipToPip(sdk.NewInt(1))

Functions

func CheckUnique

func CheckUnique(arr []int64) bool

---------------------------------------------------------------------------

func CreateTestAddrs

func CreateTestAddrs(numAddrs int) []sdk.AccAddress

CreateTestAddrs creates test addresses

func ErrEmptyMetadata

func ErrEmptyMetadata() *sdkerrors.Error

func ErrForbiddenToTransferToYourself

func ErrForbiddenToTransferToYourself() *sdkerrors.Error

func ErrInvalidCollection

func ErrInvalidCollection(denom string) *sdkerrors.Error

func ErrInvalidDenom

func ErrInvalidDenom(denom string) *sdkerrors.Error

func ErrInvalidNFT

func ErrInvalidNFT(id string) *sdkerrors.Error

func ErrInvalidQuantity

func ErrInvalidQuantity(quantity string) *sdkerrors.Error

func ErrInvalidRecipientAddress

func ErrInvalidRecipientAddress(address string) *sdkerrors.Error

func ErrInvalidReserve

func ErrInvalidReserve(reserve string) *sdkerrors.Error

func ErrInvalidSenderAddress

func ErrInvalidSenderAddress(address string) *sdkerrors.Error

func ErrInvalidTokenID

func ErrInvalidTokenID(name string) *sdkerrors.Error

func ErrNFTAlreadyExists

func ErrNFTAlreadyExists(id string) *sdkerrors.Error

func ErrNotAllowedBurn

func ErrNotAllowedBurn() *sdkerrors.Error

func ErrNotAllowedMint

func ErrNotAllowedMint() *sdkerrors.Error

func ErrNotAllowedUpdateReserve added in v1.2.6

func ErrNotAllowedUpdateReserve() *sdkerrors.Error

func ErrNotEnoughFunds added in v1.2.6

func ErrNotEnoughFunds(reserve string) *sdkerrors.Error

func ErrNotSetValueLowerNow added in v1.2.6

func ErrNotSetValueLowerNow() *sdkerrors.Error

func ErrNotUniqueSubTokenIDs

func ErrNotUniqueSubTokenIDs() *sdkerrors.Error

func ErrNotUniqueTokenID

func ErrNotUniqueTokenID() *sdkerrors.Error

func ErrNotUniqueTokenURI

func ErrNotUniqueTokenURI() *sdkerrors.Error

func ErrOwnerDoesNotOwnSubTokenID

func ErrOwnerDoesNotOwnSubTokenID(owner string, subTokenID string) *sdkerrors.Error

func ErrUnknownCollection

func ErrUnknownCollection(denom string) *sdkerrors.Error

func ErrUnknownNFT

func ErrUnknownNFT(denom string, id string) *sdkerrors.Error

func FindUtil

func FindUtil(group Findable, el string) int

FindUtil is a binary search funcion for types that support the Findable interface (elements must be sorted)

func FindUtilInt64

func FindUtilInt64(group FindableInt64, el int64) int

func GetCollectionKey

func GetCollectionKey(denom string) []byte

GetCollectionKey gets the key of a collection

func GetLastSubTokenIDKey

func GetLastSubTokenIDKey(denom, id string) []byte

func GetOwnerKey

func GetOwnerKey(address sdk.AccAddress, denom string) []byte

GetOwnerKey gets the key of a collection owned by an account address

func GetOwnersKey

func GetOwnersKey(address sdk.AccAddress) []byte

GetOwnersKey gets the key prefix for all the collections owned by an account address

func GetSubTokenKey

func GetSubTokenKey(denom, id string, subTokenID int64) []byte

func GetTokenIDKey

func GetTokenIDKey(id string) []byte

func GetTokenURIKey

func GetTokenURIKey(tokenURI string) []byte

func NewBaseNFT

func NewBaseNFT(id string, creator, owner sdk.AccAddress, tokenURI string, reserve sdk.Int, subTokenIDs []int64, allowMint bool) exported.NFT

NewBaseNFT creates a new NFT instance

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec concrete types on codec

func SplitOwnerKey

func SplitOwnerKey(key []byte) (sdk.AccAddress, []byte)

SplitOwnerKey gets an address and denom from an owner key

func TransferNFT

func TransferNFT(nft exported.NFT, sender, recipient sdk.AccAddress, subTokenIDs []int64) (exported.NFT, error)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis performs basic validation of nfts genesis data returning an error for any failed validation criteria.

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
}

AccountKeeper defines the expected account keeper (noalias)

type BaseNFT

type BaseNFT struct {
	ID        string               `json:"id,omitempty" yaml:"id"` // id of the token; not exported to clients
	Owners    exported.TokenOwners `json:"owners" yaml:"owners"`   // account addresses that owns the NFT
	Creator   sdk.AccAddress       `json:"creator" yaml:"creator"`
	TokenURI  string               `json:"token_uri" yaml:"token_uri"` // optional extra properties available for querying
	Reserve   sdk.Int              `json:"reserve" yaml:"reserve"`
	AllowMint bool                 `json:"allow_mint" yaml:"allow_mint"`
}

BaseNFT non fungible token definition

func (BaseNFT) EditMetadata

func (bnft BaseNFT) EditMetadata(tokenURI string) exported.NFT

EditMetadata edits metadata of an nft

func (BaseNFT) GetAllowMint

func (bnft BaseNFT) GetAllowMint() bool

func (BaseNFT) GetCreator

func (bnft BaseNFT) GetCreator() sdk.AccAddress

func (BaseNFT) GetID

func (bnft BaseNFT) GetID() string

GetID returns the ID of the token

func (BaseNFT) GetOwners

func (bnft BaseNFT) GetOwners() exported.TokenOwners

GetOwner returns the account address that owns the NFT

func (BaseNFT) GetReserve

func (bnft BaseNFT) GetReserve() sdk.Int

func (BaseNFT) GetTokenURI

func (bnft BaseNFT) GetTokenURI() string

GetTokenURI returns the path to optional extra properties

func (BaseNFT) MarshalJSON

func (bnft BaseNFT) MarshalJSON() ([]byte, error)

func (BaseNFT) SetOwners

func (bnft BaseNFT) SetOwners(owners exported.TokenOwners) exported.NFT

func (BaseNFT) String

func (bnft BaseNFT) String() string

func (*BaseNFT) UnmarshalJSON

func (bnft *BaseNFT) UnmarshalJSON(b []byte) error

type BaseNFTJSON

type BaseNFTJSON struct {
	ID        string         `json:"id,omitempty" yaml:"id"` // id of the token; not exported to clients
	Owners    TokenOwners    `json:"owners" yaml:"owners"`   // account addresses that owns the NFT
	Creator   sdk.AccAddress `json:"creator" yaml:"creator"`
	TokenURI  string         `json:"token_uri" yaml:"token_uri"` // optional extra properties available for querying
	Reserve   sdk.Int        `json:"reserve" yaml:"reserve"`
	AllowMint bool           `json:"allow_mint" yaml:"allow_mint"`
}

NFTJSON is the exported NFT format for clients

type CodeType

type CodeType = uint32

type Collection

type Collection struct {
	Denom string `json:"denom,omitempty" yaml:"denom"` // name of the collection; not exported to clients
	NFTs  NFTs   `json:"nfts" yaml:"nfts"`             // NFTs that belong to a collection
}

Collection of non fungible tokens

func EmptyCollection

func EmptyCollection() Collection

EmptyCollection returns an empty collection

func NewCollection

func NewCollection(denom string, nfts NFTs) Collection

NewCollection creates a new NFT Collection

func (Collection) AddNFT

func (collection Collection) AddNFT(nft exported.NFT) (Collection, error)

AddNFT adds an NFT to the collection

func (Collection) ContainsNFT

func (collection Collection) ContainsNFT(id string) bool

ContainsNFT returns whether or not a Collection contains an NFT

func (Collection) DeleteNFT

func (collection Collection) DeleteNFT(nft exported.NFT) (Collection, error)

DeleteNFT deletes an NFT from a collection

func (Collection) GetNFT

func (collection Collection) GetNFT(id string) (nft exported.NFT, err error)

GetNFT gets a NFT from the collection

func (Collection) String

func (collection Collection) String() string

String follows stringer interface

func (Collection) Supply

func (collection Collection) Supply() int

Supply gets the total supply of NFTs of a collection

func (Collection) UpdateNFT

func (collection Collection) UpdateNFT(nft exported.NFT) (Collection, error)

UpdateNFT updates an NFT from a collection

type CollectionJSON

type CollectionJSON map[string]Collection

CollectionJSON is the exported Collection format for clients

type Collections

type Collections []Collection

Collections define an array of Collection

func NewCollections

func NewCollections(collections ...Collection) Collections

NewCollections creates a new set of NFTs

func (Collections) Append

func (collections Collections) Append(collectionsB ...Collection) Collections

Append appends two sets of Collections

func (Collections) ElAtIndex

func (collections Collections) ElAtIndex(index int) string

func (Collections) Empty

func (collections Collections) Empty() bool

Empty returns true if there are no collections and false otherwise.

func (Collections) Find

func (collections Collections) Find(denom string) (Collection, bool)

Find returns the searched collection from the set

func (Collections) Len

func (collections Collections) Len() int

func (Collections) Less

func (collections Collections) Less(i, j int) bool

func (Collections) MarshalJSON

func (collections Collections) MarshalJSON() ([]byte, error)

MarshalJSON for Collections

func (Collections) Remove

func (collections Collections) Remove(denom string) (Collections, bool)

Remove removes a collection from the set of collections

func (Collections) Sort

func (collections Collections) Sort() Collections

Sort is a helper function to sort the set of coins inplace

func (Collections) String

func (collections Collections) String() string

String follows stringer interface

func (Collections) Swap

func (collections Collections) Swap(i, j int)

func (*Collections) UnmarshalJSON

func (collections *Collections) UnmarshalJSON(b []byte) error

UnmarshalJSON for Collections

type Findable

type Findable interface {
	ElAtIndex(index int) string
	Len() int
}

Findable is an interface for iterable types that allows the FindUtil function to work

type FindableInt64

type FindableInt64 interface {
	ElAtIndex(index int) int64
	Len() int
}

type GenesisState

type GenesisState struct {
	Owners      []Owner     `json:"owners"`
	Collections Collections `json:"collections"`
}

GenesisState is the state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func NewGenesisState

func NewGenesisState(owners []Owner, collections Collections) GenesisState

NewGenesisState creates a new genesis state.

type IDCollection

type IDCollection struct {
	Denom string            `json:"denom" yaml:"denom"`
	IDs   SortedStringArray `json:"ids" yaml:"ids"`
}

IDCollection defines a set of nft ids that belong to a specific collection

func NewIDCollection

func NewIDCollection(denom string, ids []string) IDCollection

NewIDCollection creates a new IDCollection instance

func (IDCollection) AddID

func (idCollection IDCollection) AddID(id string) IDCollection

AddID adds an ID to the idCollection

func (IDCollection) DeleteID

func (idCollection IDCollection) DeleteID(id string) (IDCollection, error)

DeleteID deletes an ID from an ID Collection

func (IDCollection) Exists

func (idCollection IDCollection) Exists(id string) (exists bool)

Exists determines whether an ID is in the IDCollection

func (IDCollection) String

func (idCollection IDCollection) String() string

String follows stringer interface

func (IDCollection) Supply

func (idCollection IDCollection) Supply() int

Supply gets the total supply of NFTIDs of a balance

type IDCollections

type IDCollections []IDCollection

IDCollections is an array of ID Collections whose sole purpose is for find

func (IDCollections) Append

func (idCollections IDCollections) Append(idCollections2 ...IDCollection) IDCollections

Append appends IDCollections to IDCollections

func (IDCollections) ElAtIndex

func (idCollections IDCollections) ElAtIndex(index int) string

func (IDCollections) Len

func (idCollections IDCollections) Len() int

func (IDCollections) Less

func (idCollections IDCollections) Less(i, j int) bool

func (IDCollections) Sort

func (idCollections IDCollections) Sort() IDCollections

Sort is a helper function to sort the set of strings in place

func (IDCollections) String

func (idCollections IDCollections) String() string

String follows stringer interface

func (IDCollections) Swap

func (idCollections IDCollections) Swap(i, j int)

type MsgBurnNFT

type MsgBurnNFT struct {
	Sender      sdk.AccAddress `json:"sender"`
	ID          string         `json:"id"`
	Denom       string         `json:"denom"`
	SubTokenIDs []int64        `json:"sub_token_ids"`
}

func NewMsgBurnNFT

func NewMsgBurnNFT(sender sdk.AccAddress, id string, denom string, subTokenIDs []int64) MsgBurnNFT

NewMsgBurnNFT is a constructor function for MsgBurnNFT

func (MsgBurnNFT) GetSignBytes

func (msg MsgBurnNFT) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgBurnNFT) GetSigners

func (msg MsgBurnNFT) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgBurnNFT) Route

func (msg MsgBurnNFT) Route() string

Route Implements Msg

func (MsgBurnNFT) Type

func (msg MsgBurnNFT) Type() string

Type Implements Msg

func (MsgBurnNFT) ValidateBasic

func (msg MsgBurnNFT) ValidateBasic() error

ValidateBasic Implements Msg.

type MsgEditNFTMetadata

type MsgEditNFTMetadata struct {
	Sender   sdk.AccAddress `json:"sender"`
	ID       string         `json:"id"`
	Denom    string         `json:"denom"`
	TokenURI string         `json:"token_uri"`
}

func NewMsgEditNFTMetadata

func NewMsgEditNFTMetadata(sender sdk.AccAddress, id,
	denom, tokenURI string,
) MsgEditNFTMetadata

NewMsgEditNFTMetadata is a constructor function for MsgSetName

func (MsgEditNFTMetadata) GetSignBytes

func (msg MsgEditNFTMetadata) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgEditNFTMetadata) GetSigners

func (msg MsgEditNFTMetadata) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgEditNFTMetadata) Route

func (msg MsgEditNFTMetadata) Route() string

Route Implements Msg

func (MsgEditNFTMetadata) Type

func (msg MsgEditNFTMetadata) Type() string

Type Implements Msg

func (MsgEditNFTMetadata) ValidateBasic

func (msg MsgEditNFTMetadata) ValidateBasic() error

ValidateBasic Implements Msg.

type MsgMintNFT

type MsgMintNFT struct {
	Sender    sdk.AccAddress `json:"sender"`
	Recipient sdk.AccAddress `json:"recipient"`
	ID        string         `json:"id"`
	Denom     string         `json:"denom"`
	Quantity  sdk.Int        `json:"quantity"`
	TokenURI  string         `json:"token_uri"`
	Reserve   sdk.Int        `json:"reserve"`
	AllowMint bool           `json:"allow_mint"`
}

func NewMsgMintNFT

func NewMsgMintNFT(sender, recipient sdk.AccAddress, id, denom, tokenURI string, quantity, reserve sdk.Int, allowMint bool) MsgMintNFT

NewMsgMintNFT is a constructor function for MsgMintNFT

func (MsgMintNFT) GetSignBytes

func (msg MsgMintNFT) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgMintNFT) GetSigners

func (msg MsgMintNFT) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgMintNFT) Route

func (msg MsgMintNFT) Route() string

Route Implements Msg

func (MsgMintNFT) Type

func (msg MsgMintNFT) Type() string

Type Implements Msg

func (MsgMintNFT) ValidateBasic

func (msg MsgMintNFT) ValidateBasic() error

ValidateBasic Implements Msg.

type MsgTransferNFT

type MsgTransferNFT struct {
	Sender      sdk.AccAddress `json:"sender"`
	Recipient   sdk.AccAddress `json:"recipient"`
	ID          string         `json:"id"`
	Denom       string         `json:"denom"`
	SubTokenIDs []int64        `json:"sub_token_ids"`
}

func NewMsgTransferNFT

func NewMsgTransferNFT(sender, recipient sdk.AccAddress, denom, id string, subTokenIDs []int64) MsgTransferNFT

NewMsgTransferNFT is a constructor function for MsgSetName

func (MsgTransferNFT) GetSignBytes

func (msg MsgTransferNFT) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgTransferNFT) GetSigners

func (msg MsgTransferNFT) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgTransferNFT) Route

func (msg MsgTransferNFT) Route() string

Route Implements Msg

func (MsgTransferNFT) Type

func (msg MsgTransferNFT) Type() string

Type Implements Msg

func (MsgTransferNFT) ValidateBasic

func (msg MsgTransferNFT) ValidateBasic() error

ValidateBasic Implements Msg.

type MsgUpdateReserveNFT added in v1.2.6

type MsgUpdateReserveNFT struct {
	Sender        sdk.AccAddress `json:"sender"`
	ID            string         `json:"id"`
	Denom         string         `json:"denom"`
	SubTokenIDs   []int64        `json:"sub_token_ids"`
	NewReserveNFT sdk.Int        `json:"reserve"`
}
---------------------------------------------------------------------------

MsgUpdateReservNFT

---------------------------------------------------------------------------

func NewMsgUpdateReserveNFT added in v1.2.6

func NewMsgUpdateReserveNFT(sender sdk.AccAddress, id string, denom string, subTokenIDs []int64, newReserveNFT sdk.Int) MsgUpdateReserveNFT

NewUpdateReservNFT is a constructor function for MsgUpdateReservNFT

func (MsgUpdateReserveNFT) GetSignBytes added in v1.2.6

func (msg MsgUpdateReserveNFT) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgUpdateReserveNFT) GetSigners added in v1.2.6

func (msg MsgUpdateReserveNFT) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgUpdateReserveNFT) Route added in v1.2.6

func (msg MsgUpdateReserveNFT) Route() string

Route Implements Msg

func (MsgUpdateReserveNFT) Type added in v1.2.6

func (msg MsgUpdateReserveNFT) Type() string

Type Implements Msg

func (MsgUpdateReserveNFT) ValidateBasic added in v1.2.6

func (msg MsgUpdateReserveNFT) ValidateBasic() error

ValidateBasic Implements Msg.

type NFTJSON

type NFTJSON map[string]BaseNFT

NFTJSON is the exported NFT format for clients

type NFTs

type NFTs []exported.NFT

NFTs define a list of NFT

func NewNFTs

func NewNFTs(nfts ...exported.NFT) NFTs

NewNFTs creates a new set of NFTs

func (NFTs) Append

func (nfts NFTs) Append(nftsB ...exported.NFT) NFTs

Append appends two sets of NFTs

func (NFTs) ElAtIndex

func (nfts NFTs) ElAtIndex(index int) string

Findable and Sort interfaces

func (NFTs) Empty

func (nfts NFTs) Empty() bool

Empty returns true if there are no NFTs and false otherwise.

func (NFTs) Find

func (nfts NFTs) Find(id string) (nft exported.NFT, found bool)

Find returns the searched collection from the set

func (NFTs) Len

func (nfts NFTs) Len() int

func (NFTs) Less

func (nfts NFTs) Less(i, j int) bool

func (NFTs) MarshalJSON

func (nfts NFTs) MarshalJSON() ([]byte, error)

MarshalJSON for NFTs

func (NFTs) Remove

func (nfts NFTs) Remove(id string) (NFTs, bool)

Remove removes an NFT from the set of NFTs

func (NFTs) Sort

func (nfts NFTs) Sort() NFTs

Sort is a helper function to sort the set of coins in place

func (NFTs) String

func (nfts NFTs) String() string

String follows stringer interface

func (NFTs) Swap

func (nfts NFTs) Swap(i, j int)

func (*NFTs) UnmarshalJSON

func (nfts *NFTs) UnmarshalJSON(b []byte) error

UnmarshalJSON for NFTs

func (NFTs) Update

func (nfts NFTs) Update(id string, nft exported.NFT) (NFTs, bool)

Update removes and replaces an NFT from the set

type Owner

type Owner struct {
	Address       sdk.AccAddress `json:"address" yaml:"address"`
	IDCollections IDCollections  `json:"idCollections" yaml:"idCollections"`
}

Owner of non fungible tokens

func NewOwner

func NewOwner(owner sdk.AccAddress, idCollections ...IDCollection) Owner

NewOwner creates a new Owner

func (Owner) DeleteID

func (owner Owner) DeleteID(denom string, id string) (Owner, error)

DeleteID deletes an ID from an owners ID Collection

func (Owner) GetIDCollection

func (owner Owner) GetIDCollection(denom string) (IDCollection, bool)

GetIDCollection gets the IDCollection from the owner

func (Owner) String

func (owner Owner) String() string

String follows stringer interface

func (Owner) Supply

func (owner Owner) Supply() int

Supply gets the total supply of an Owner

func (Owner) UpdateIDCollection

func (owner Owner) UpdateIDCollection(idCollection IDCollection) (Owner, error)

UpdateIDCollection updates the ID Collection of an owner

type QueryBalanceParams

type QueryBalanceParams struct {
	Owner sdk.AccAddress
	Denom string // optional
}

QueryBalanceParams params for query 'custom/nfts/balance'

func NewQueryBalanceParams

func NewQueryBalanceParams(owner sdk.AccAddress, denom ...string) QueryBalanceParams

NewQueryBalanceParams creates a new instance of QuerySupplyParams

type QueryCollectionParams

type QueryCollectionParams struct {
	Denom string `json:"denom"`
}

QueryCollectionParams defines the params for queries: - 'custom/nft/supply' - 'custom/nft/collection'

func NewQueryCollectionParams

func NewQueryCollectionParams(denom string) QueryCollectionParams

NewQueryCollectionParams creates a new instance of QuerySupplyParams

func (QueryCollectionParams) Bytes

func (q QueryCollectionParams) Bytes() []byte

Bytes exports the Denom as bytes

type QueryNFTParams

type QueryNFTParams struct {
	Denom   string `json:"denom"`
	TokenID string `json:"token_id"`
}

QueryNFTParams params for query 'custom/nfts/nft'

func NewQueryNFTParams

func NewQueryNFTParams(denom, id string) QueryNFTParams

NewQueryNFTParams creates a new instance of QueryNFTParams

type QuerySubTokensParams

type QuerySubTokensParams struct {
	Denom       string  `json:"denom"`
	TokenID     string  `json:"token_id"`
	SubTokenIDs []int64 `json:"sub_token_ids"`
}

QuerySubTokensParams params for query 'custom/nfts/sub_tokens'

func NewQuerySubTokensParams

func NewQuerySubTokensParams(denom, id string, subTokenIDs []int64) QuerySubTokensParams

NewQuerySubTokensParams creates a new instance of QuerySubTokensParams

type ResponseSubToken

type ResponseSubToken struct {
	ID      int64
	Reserve sdk.Int
}

type ResponseSubTokens

type ResponseSubTokens []ResponseSubToken

type SortedIntArray

type SortedIntArray []int64

func (SortedIntArray) ElAtIndex

func (sa SortedIntArray) ElAtIndex(index int) int64

func (SortedIntArray) Find

func (sa SortedIntArray) Find(el int64) (idx int)

func (SortedIntArray) Len

func (sa SortedIntArray) Len() int

func (SortedIntArray) Less

func (sa SortedIntArray) Less(i, j int) bool

func (SortedIntArray) Sort

func (sa SortedIntArray) Sort() SortedIntArray

Sort is a helper function to sort the set of strings in place

func (SortedIntArray) String

func (sa SortedIntArray) String() string

String is the string representation

func (SortedIntArray) Swap

func (sa SortedIntArray) Swap(i, j int)

type SortedStringArray

type SortedStringArray []string

SortedStringArray is an array of strings whose sole purpose is to help with find

func (SortedStringArray) ElAtIndex

func (sa SortedStringArray) ElAtIndex(index int) string

func (SortedStringArray) Len

func (sa SortedStringArray) Len() int

func (SortedStringArray) Less

func (sa SortedStringArray) Less(i, j int) bool

func (SortedStringArray) Sort

Sort is a helper function to sort the set of strings in place

func (SortedStringArray) String

func (sa SortedStringArray) String() string

String is the string representation

func (SortedStringArray) Swap

func (sa SortedStringArray) Swap(i, j int)

type TokenOwner

type TokenOwner struct {
	Address     sdk.AccAddress `json:"address"`
	SubTokenIDs SortedIntArray `json:"sub_token_ids"`
}

func NewTokenOwner

func NewTokenOwner(address sdk.AccAddress, subTokenIDs []int64) TokenOwner

func (TokenOwner) GetAddress

func (t TokenOwner) GetAddress() sdk.AccAddress

func (TokenOwner) GetSubTokenIDs

func (t TokenOwner) GetSubTokenIDs() []int64

func (TokenOwner) RemoveSubTokenID

func (t TokenOwner) RemoveSubTokenID(subTokenID int64) exported.TokenOwner

func (TokenOwner) SetSubTokenID

func (t TokenOwner) SetSubTokenID(subTokenID int64) exported.TokenOwner

func (TokenOwner) SortSubTokensFix added in v1.2.4

func (t TokenOwner) SortSubTokensFix() exported.TokenOwner

func (TokenOwner) String

func (t TokenOwner) String() string

type TokenOwners

type TokenOwners struct {
	Owners []exported.TokenOwner `json:"owners"`
}

func (TokenOwners) GetOwner

func (t TokenOwners) GetOwner(address sdk.AccAddress) exported.TokenOwner

func (TokenOwners) GetOwners

func (t TokenOwners) GetOwners() []exported.TokenOwner

func (TokenOwners) SetOwner

func (TokenOwners) String

func (t TokenOwners) String() string

func (*TokenOwners) UnmarshalJSON

func (t *TokenOwners) UnmarshalJSON(b []byte) error

type TokenOwnersJSON

type TokenOwnersJSON struct {
	Owners []TokenOwner `json:"owners"`
}

Jump to

Keyboard shortcuts

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