keeper

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuerySupply       = "supply"
	QueryOwner        = "owner"
	QueryOwnerByDenom = "ownerByDenom"
	QueryCollection   = "collection"
	QueryDenoms       = "denoms"
	QueryNFT          = "nft"
	QuerySubTokens    = "sub_tokens"
)

query endpoints supported by the NFT Querier

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the nfts module.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

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 nfts in store

Types

type Keeper

type Keeper struct {
	BaseDenom *string
	// 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.BinaryCodec, storeKey sdk.StoreKey, bankKeeper keeper.Keeper, baseDenom string) *Keeper

NewKeeper creates new instances of the nft Keeper

func (Keeper) BurnNFT

func (Keeper) DeleteNFTSubTokens

func (k Keeper) DeleteNFTSubTokens(ctx sdk.Context, denom, id string, subTokenIDsToDelete []uint64) error

DeleteNFTSubTokens deletes an NFT sub tokens from store

func (Keeper) EditNFT

func (k Keeper) EditNFT(ctx sdk.Context, denom, id string, tokenURI string) error

EditNFT edits an existing NFT meta info

func (Keeper) GenAndMintSubTokens

func (k Keeper) GenAndMintSubTokens(
	ctx sdk.Context,
	denom, id string,
	reserve, quantity sdk.Int,
	creator string,
) (types.SortedUintArray, error)

func (Keeper) GetCollection

func (k Keeper) GetCollection(ctx sdk.Context, denom string) (collection types.Collection, found bool)

GetCollection returns a collection of NFTs

func (Keeper) GetCollections

func (k Keeper) GetCollections(ctx sdk.Context) (collections []types.Collection)

GetCollections returns all the NFTs collections

func (Keeper) GetDenoms

func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []string)

GetDenoms returns all the NFT denoms

func (Keeper) GetNFT

func (k Keeper) GetNFT(ctx sdk.Context, denom, id string) (types.BaseNFT, error)

GetNFT gets the entire NFT metadata struct for a uint64

func (Keeper) GetNFTs

func (k Keeper) GetNFTs(ctx sdk.Context) (nfts []types.BaseNFT)

GetNFTs returns all matched NFTs

func (Keeper) GetOwnerCollectionByDenom

func (k Keeper) GetOwnerCollectionByDenom(ctx sdk.Context, address sdk.AccAddress, denom string) (oc types.OwnerCollection, found bool)

GetOwnerCollectionByDenom gets the ID Collection owned by an address of a specific denom

func (Keeper) GetOwnerCollections

func (k Keeper) GetOwnerCollections(ctx sdk.Context, address sdk.AccAddress) []types.OwnerCollection

GetOwnerCollections gets all the ID Collections owned by an address

func (Keeper) GetSubToken

func (k Keeper) GetSubToken(ctx sdk.Context, nftID string, subTokenID uint64) (types.SubToken, bool)

func (Keeper) GetSubTokens

func (k Keeper) GetSubTokens(ctx sdk.Context, nftID string) (subTokens []types.SubToken)

func (Keeper) HasTokenID

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

HasTokenID check if nft exists

func (Keeper) HasTokenURI

func (k Keeper) HasTokenURI(ctx sdk.Context, tokenURI string) bool

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Mint

func (k Keeper) Mint(
	ctx sdk.Context,
	denom, id string,
	reserve, quantity sdk.Int,
	creator, owner string,
	tokenURI string,
	allowMint bool,
) (uint64, error)

func (Keeper) MintNFT

func (Keeper) MintNFTAndCollection

func (k Keeper) MintNFTAndCollection(
	ctx sdk.Context,
	denom, id string,
	reserve sdk.Int,
	creator, owner string,
	tokenURI string,
	allowMint bool,
	subTokenIDs []uint64,
) error

MintNFTAndCollection mints an NFT and manages that NFTs existence within Collections and Owners

func (Keeper) MintSubTokens

func (k Keeper) MintSubTokens(
	ctx sdk.Context,
	id string,
	subTokens []types.SubToken,
)

func (Keeper) QueryDenoms

func (Keeper) QueryNFT

func (Keeper) RemoveSubToken

func (k Keeper) RemoveSubToken(ctx sdk.Context, nftID string, subTokenID uint64)

func (Keeper) ReserveTokens

func (k Keeper) ReserveTokens(ctx sdk.Context, amount sdk.Coins, address sdk.AccAddress) error

func (Keeper) ReturnTokensTo

func (k Keeper) ReturnTokensTo(ctx sdk.Context, amount sdk.Coins, address sdk.AccAddress) error

func (Keeper) SetCollection

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

SetCollection sets the entire collection of a single denom

func (Keeper) SetNFT

func (k Keeper) SetNFT(ctx sdk.Context, denom, id string, nft types.BaseNFT) error

SetNFT sets nft to store

func (Keeper) SetOwnerCollectionByDenom

func (k Keeper) SetOwnerCollectionByDenom(ctx sdk.Context, owner sdk.AccAddress, denom string, ownerCollection types.OwnerCollection)

SetOwnerCollectionByDenom sets a collection of NFT IDs owned by an address

func (Keeper) SetSubToken

func (k Keeper) SetSubToken(ctx sdk.Context, nftID string, subToken types.SubToken)

func (Keeper) Transfer

func (k Keeper) Transfer(ctx sdk.Context, denom, id string, sender, recipient string, subTokenIDsToTransfer []uint64) (types.BaseNFT, error)

func (Keeper) TransferNFT

func (Keeper) UpdateNFTReserve

func (k Keeper) UpdateNFTReserve(ctx sdk.Context, denom, id string, subTokenIDs []uint64, newReserve sdk.Int) error

UpdateNFTReserve increases the minimum reserve of the NFT token

Jump to

Keyboard shortcuts

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