keeper

package
v0.0.0-...-9863cff Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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

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) 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 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 sdk.StoreKey) Keeper

NewKeeper creates new instances of the nft Keeper

func (Keeper) DeleteNFT

func (k Keeper) DeleteNFT(ctx sdk.Context, denom, id string) (err sdk.Error)

DeleteNFT deletes an existing NFT from store

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) (nft exported.NFT, err sdk.Error)

GetNFT gets the entire NFT metadata struct for a uint64

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, address sdk.AccAddress) (owner types.Owner)

GetOwner gets all the ID Collections owned by an address

func (Keeper) GetOwnerByDenom

func (k Keeper) GetOwnerByDenom(ctx sdk.Context, owner sdk.AccAddress, denom string) (idCollection types.IDCollection, found bool)

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

func (Keeper) GetOwners

func (k Keeper) GetOwners(ctx sdk.Context) (owners []types.Owner)

GetOwners returns all the Owners ID Collections

func (Keeper) IsNFT

func (k Keeper) IsNFT(ctx sdk.Context, denom, id string) (exists bool)

IsNFT returns whether an NFT exists

func (Keeper) IterateCollections

func (k Keeper) IterateCollections(ctx sdk.Context, handler func(collection types.Collection) (stop bool))

IterateCollections iterates over collections and performs a function

func (Keeper) IterateIDCollections

func (k Keeper) IterateIDCollections(ctx sdk.Context, prefix []byte,
	handler func(owner sdk.AccAddress, idCollection types.IDCollection) (stop bool))

IterateIDCollections iterates over the IDCollections by Owner and performs a function

func (Keeper) IterateOwners

func (k Keeper) IterateOwners(ctx sdk.Context, handler func(owner types.Owner) (stop bool))

IterateOwners iterates over all Owners and performs a function

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MintNFT

func (k Keeper) MintNFT(ctx sdk.Context, denom string, nft exported.NFT) (err sdk.Error)

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

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

func (k Keeper) SetOwner(ctx sdk.Context, owner types.Owner)

SetOwner sets an entire Owner

func (Keeper) SetOwnerByDenom

func (k Keeper) SetOwnerByDenom(ctx sdk.Context, owner sdk.AccAddress, denom string, ids []string)

SetOwnerByDenom sets a collection of NFT IDs owned by an address

func (Keeper) SetOwners

func (k Keeper) SetOwners(ctx sdk.Context, owners []types.Owner)

SetOwners sets all Owners

func (Keeper) SwapOwners

func (k Keeper) SwapOwners(ctx sdk.Context, denom string, id string, oldAddress sdk.AccAddress, newAddress sdk.AccAddress) (err sdk.Error)

SwapOwners swaps the owners of a NFT ID

func (Keeper) UpdateNFT

func (k Keeper) UpdateNFT(ctx sdk.Context, denom string, nft exported.NFT) (err sdk.Error)

UpdateNFT updates an already existing NFTs

Jump to

Keyboard shortcuts

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