keeper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 87

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

func NewKeeper(storeService store.KVStoreService,
	cdc codec.BinaryCodec, ak nft.AccountKeeper, bk nft.BankKeeper,
) Keeper

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) BatchBurn

func (k Keeper) BatchBurn(ctx context.Context, classID string, nftIDs []string) error

BatchBurn defines a method for burning a batch of nfts from a specific classID. Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) BatchMint

func (k Keeper) BatchMint(ctx context.Context,
	tokens []nft.NFT,
	receiver sdk.AccAddress,
) error

BatchMint defines a method for minting a batch of nfts

func (Keeper) BatchTransfer

func (k Keeper) BatchTransfer(ctx context.Context,
	classID string,
	nftIDs []string,
	receiver sdk.AccAddress,
) error

BatchTransfer defines a method for sending a batch of nfts from one account to another account from a specific classID. Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) BatchUpdate

func (k Keeper) BatchUpdate(ctx context.Context, tokens []nft.NFT) error

BatchUpdate defines a method for updating a batch of exist nfts Note: When the upper module uses this method, it needs to authenticate nft

func (Keeper) Burn

func (k Keeper) Burn(ctx context.Context, classID, 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 context.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 context.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 context.Context) (classes []*nft.Class)

GetClasses defines a method for returning all classes information

func (Keeper) GetNFT

func (k Keeper) GetNFT(ctx context.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 context.Context, classID string) (nfts []nft.NFT)

GetNFTsOfClass returns all nft information under the specified classID

func (Keeper) GetNFTsOfClassByOwner

func (k Keeper) GetNFTsOfClassByOwner(ctx context.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 context.Context, classID, nftID string) sdk.AccAddress

GetOwner returns the owner information of the specified nft

func (Keeper) GetTotalSupply

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

GetTotalSupply returns the number of all nfts under the specified classID

func (Keeper) HasClass

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

HasClass determines whether the specified classID exist

func (Keeper) HasNFT

func (k Keeper) HasNFT(ctx context.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 initializes the nft module's genesis state from a given genesis state.

func (Keeper) Mint

func (k Keeper) Mint(ctx context.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 context.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 implements 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 context.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 context.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 context.Context, class nft.Class) error

UpdateClass defines a method for updating an exist nft class

Jump to

Keyboard shortcuts

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