keeper

package
v0.46.13-rc.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const StoreKey = nft.ModuleName

StoreKey is the store key string for nft

Variables

View Source
var (
	ClassKey             = []byte{0x01}
	NFTKey               = []byte{0x02}
	NFTOfClassByOwnerKey = []byte{0x03}
	OwnerKey             = []byte{0x04}
	ClassTotalSupply     = []byte{0x05}

	Delimiter   = []byte{0x00}
	Placeholder = []byte{0x01}
)

Functions

This section is empty.

Types

type Keeper

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

Keeper of the nft store

func NewKeeper

NewKeeper creates a new nft Keeper instance

func (Keeper) Balance

Balance return the number of NFTs of a given class owned by the owner, same as balanceOf in ERC721

func (Keeper) Burn

func (k Keeper) Burn(ctx sdk.Context, classID string, nftID string) error

Burn defines a method for burning a nft from a specific account. Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) Class

Class return an NFT class based on its id

func (Keeper) Classes

Classes return all NFT classes

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *nft.GenesisState

ExportGenesis returns a GenesisState for a given context.

func (Keeper) GetBalance

func (k Keeper) GetBalance(ctx sdk.Context, classID string, owner sdk.AccAddress) uint64

GetBalance returns the specified account, the number of all nfts under the specified classID

func (Keeper) GetClass

func (k Keeper) GetClass(ctx sdk.Context, classID string) (nft.Class, bool)

GetClass defines a method for returning the class information of the specified id

func (Keeper) GetClasses

func (k Keeper) GetClasses(ctx sdk.Context) (classes []*nft.Class)

GetClasses defines a method for returning all classes information

func (Keeper) GetNFT

func (k Keeper) GetNFT(ctx sdk.Context, classID, nftID string) (nft.NFT, bool)

GetNFT returns the nft information of the specified classID and nftID

func (Keeper) GetNFTsOfClass

func (k Keeper) GetNFTsOfClass(ctx sdk.Context, classID string) (nfts []nft.NFT)

GetNFTsOfClass returns all nft information under the specified classID

func (Keeper) GetNFTsOfClassByOwner

func (k Keeper) GetNFTsOfClassByOwner(ctx sdk.Context, classID string, owner sdk.AccAddress) (nfts []nft.NFT)

GetNFTsOfClassByOwner returns all nft information of the specified classID under the specified owner

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, classID string, nftID string) sdk.AccAddress

GetOwner returns the owner information of the specified nft

func (Keeper) GetTotalSupply

func (k Keeper) GetTotalSupply(ctx sdk.Context, classID string) uint64

GetTotalSupply returns the number of all nfts under the specified classID

func (Keeper) HasClass

func (k Keeper) HasClass(ctx sdk.Context, classID string) bool

HasClass determines whether the specified classID exist

func (Keeper) HasNFT

func (k Keeper) HasNFT(ctx sdk.Context, classID, id string) bool

HasNFT determines whether the specified classID and nftID exist

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *nft.GenesisState)

InitGenesis new nft genesis

func (Keeper) Mint

func (k Keeper) Mint(ctx sdk.Context, token nft.NFT, receiver sdk.AccAddress) error

Mint defines a method for minting a new nft

func (Keeper) NFT

NFT return an NFT based on its class and id.

func (Keeper) NFTs

NFTs queries all NFTs of a given class or owner (at least one must be provided), similar to tokenByIndex in ERC721Enumerable

func (Keeper) Owner

Owner return the owner of the NFT based on its class and id, same as ownerOf in ERC721

func (Keeper) SaveClass

func (k Keeper) SaveClass(ctx sdk.Context, class nft.Class) error

SaveClass defines a method for creating a new nft class

func (Keeper) Send

func (k Keeper) Send(goCtx context.Context, msg *nft.MsgSend) (*nft.MsgSendResponse, error)

Send implement Send method of the types.MsgServer.

func (Keeper) Supply

Supply return the number of NFTs from the given class, same as totalSupply of ERC721.

func (Keeper) Transfer

func (k Keeper) Transfer(ctx sdk.Context,
	classID string,
	nftID string,
	receiver sdk.AccAddress,
) error

Transfer defines a method for sending a nft from one account to another account. Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) Update

func (k Keeper) Update(ctx sdk.Context, token nft.NFT) error

Update defines a method for updating an exist nft Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) UpdateClass

func (k Keeper) UpdateClass(ctx sdk.Context, class nft.Class) error

UpdateClass defines a method for updating a exist nft class

Jump to

Keyboard shortcuts

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