keeper

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all supply invariants

func SupplyInvariant

func SupplyInvariant(k Keeper) sdk.Invariant

SupplyInvariant checks that the total amount of NFTs on collections matches the total amount owned by addresses

Types

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc codec.Codec,
	storeKey storetypes.StoreKey,
	ak nft.AccountKeeper,
	bk nft.BankKeeper,
) Keeper

NewKeeper creates a new instance of the NFT Keeper

func (Keeper) Authorize

func (k Keeper) Authorize(ctx sdk.Context, denomID, tokenID string, owner sdk.AccAddress) error

Authorize checks if the sender is the owner of the given NFT Return the NFT if true, an error otherwise

func (Keeper) BurnNFT

func (k Keeper) BurnNFT(goCtx context.Context, msg *types.MsgBurnNFT) (*types.MsgBurnNFTResponse, error)

func (Keeper) Collection

Collection queries the NFTs of the specified denom

func (Keeper) Denom

Denom queries the definition of a given denom

func (Keeper) Denoms

Denoms queries all the denoms

func (Keeper) EditNFT

func (k Keeper) EditNFT(goCtx context.Context, msg *types.MsgEditNFT) (*types.MsgEditNFTResponse, error)

func (Keeper) ExportGenesis added in v0.2.5

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

ExportGenesis returns a GenesisState for a given context and keeper.

func (Keeper) GetCollection

func (k Keeper) GetCollection(ctx sdk.Context, denomID string) (types.Collection, error)

GetCollection returns the collection by the specified denom ID

func (Keeper) GetCollections

func (k Keeper) GetCollections(ctx sdk.Context) (cs []types.Collection, err error)

GetCollections returns all the collections

func (Keeper) GetDenomInfo

func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, error)

GetDenomInfo return the denom information

func (Keeper) GetNFT

func (k Keeper) GetNFT(ctx sdk.Context, denomID, tokenID string) (nft exported.NFT, err error)

GetNFT gets the specified NFT

func (Keeper) GetNFTs

func (k Keeper) GetNFTs(ctx sdk.Context, denom string) (nfts []exported.NFT, err error)

GetNFTs returns all NFTs by the specified denom ID

func (Keeper) GetTotalSupply

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

GetTotalSupply returns the number of NFTs by the specified denom ID

func (Keeper) GetTotalSupplyOfOwner

func (k Keeper) GetTotalSupplyOfOwner(ctx sdk.Context, id string, owner sdk.AccAddress) (supply uint64)

GetTotalSupplyOfOwner returns the amount of NFTs by the specified conditions

func (Keeper) HasDenom added in v0.2.5

func (k Keeper) HasDenom(ctx sdk.Context, denomID string) bool

HasDenom determine whether denom exists

func (Keeper) HasNFT

func (k Keeper) HasNFT(ctx sdk.Context, denomID, tokenID string) bool

HasNFT checks if the specified NFT exists

func (Keeper) InitGenesis added in v0.2.5

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

InitGenesis stores the NFT genesis.

func (Keeper) IssueDenom

func (k Keeper) IssueDenom(goCtx context.Context, msg *types.MsgIssueDenom) (*types.MsgIssueDenomResponse, error)

IssueDenom issue a new denom.

func (Keeper) Logger added in v0.2.5

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MintNFT

func (k Keeper) MintNFT(goCtx context.Context, msg *types.MsgMintNFT) (*types.MsgMintNFTResponse, error)

nolint: dupl

func (Keeper) NFT

NFT queries the NFT for the given denom and token ID

func (Keeper) NFTkeeper added in v0.2.5

func (k Keeper) NFTkeeper() nftkeeper.Keeper

NFTkeeper returns a cosmos-sdk nftkeeper.Keeper.

func (Keeper) NFTsOfOwner

NFTsOfOwner queries the NFTs of the specified owner

func (Keeper) RemoveNFT added in v0.2.5

func (k Keeper) RemoveNFT(ctx sdk.Context, denomID, tokenID string, owner sdk.AccAddress) error

RemoveNFT deletes a specified NFT

func (Keeper) SaveCollection added in v0.2.5

func (k Keeper) SaveCollection(ctx sdk.Context, collection types.Collection) error

SaveCollection saves all NFTs and returns an error if there already exists

func (Keeper) SaveDenom added in v0.2.5

func (k Keeper) SaveDenom(ctx sdk.Context, id,
	name,
	schema,
	symbol string,
	creator sdk.AccAddress,
	mintRestricted,
	updateRestricted bool,
	description,
	uri,
	uriHash,
	data string,
) error

SaveDenom issues a denom according to the given params

func (Keeper) SaveNFT added in v0.2.5

func (k Keeper) SaveNFT(ctx sdk.Context, denomID,
	tokenID,
	tokenNm,
	tokenURI,
	tokenUriHash,
	tokenData string,
	receiver sdk.AccAddress,
) error

SaveNFT mints an NFT and manages the NFT's existence within Collections and Owners

func (Keeper) SetCollection

func (k Keeper) SetCollection(ctx sdk.Context, collection types.Collection) error

SetCollection saves all NFTs and returns an error if there already exists

func (Keeper) Supply

Supply queries the total supply of a given denom or owner

func (Keeper) TransferDenom added in v0.2.5

func (Keeper) TransferDenomOwner

func (k Keeper) TransferDenomOwner(
	ctx sdk.Context,
	denomID string,
	srcOwner,
	dstOwner sdk.AccAddress,
) error

TransferDenomOwner transfers the ownership of the given denom to the new owner

func (Keeper) TransferNFT added in v0.2.5

func (Keeper) TransferOwnership

func (k Keeper) TransferOwnership(ctx sdk.Context, denomID,
	tokenID,
	tokenNm,
	tokenURI,
	tokenURIHash,
	tokenData string,
	srcOwner,
	dstOwner sdk.AccAddress,
) error

TransferOwnership transfers the ownership of the given NFT to the new owner

func (Keeper) UpdateNFT added in v0.2.5

func (k Keeper) UpdateNFT(ctx sdk.Context, denomID,
	tokenID,
	tokenNm,
	tokenURI,
	tokenURIHash,
	tokenData string,
	owner sdk.AccAddress,
) error

UpdateNFT updates an already existing NFT

type Migrator added in v0.2.5

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v0.2.5

func NewMigrator(k Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v0.2.5

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

Jump to

Keyboard shortcuts

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