Documentation ¶
Index ¶
- Variables
- func NewQuerier(keeper Keeper) sdk.Querier
- type Keeper
- func (keeper Keeper) AddTrustedMinter(ctx sdk.Context, minter sdk.AccAddress)
- func (keeper Keeper) AssignMembership(ctx sdk.Context, user sdk.AccAddress, membershipType string) (string, error)
- func (keeper Keeper) GetMembership(ctx sdk.Context, user sdk.AccAddress) (exported.NFT, bool)
- func (keeper Keeper) GetMembershipType(membership exported.NFT) string
- func (keeper Keeper) GetMembershipsSet(ctx sdk.Context) []types.Membership
- func (keeper Keeper) GetTrustedMinters(ctx sdk.Context) types.Minters
- func (keeper Keeper) RemoveMembership(ctx sdk.Context, user sdk.AccAddress) (bool, error)
- type MembershipResult
Constants ¶
This section is empty.
Variables ¶
var TestMembershipType = "green"
var TestSignerAddress, _ = sdk.AccAddressFromBech32("cosmos1lwmppctrr6ssnrmuyzu554dzf50apkfvd53jx0")
Test variables
var TestUserAddress, _ = sdk.AccAddressFromBech32("cosmos1lwmppctrr6ssnrmuyzu554dzf50apkfvd53jx0")
Functions ¶
func NewQuerier ¶
NewQuerier is the module level router for state queries
Types ¶
type Keeper ¶
type Keeper struct { StoreKey sdk.StoreKey // NFT keeper to mint tokens NftKeeper nft.Keeper // Pointer to the codec that is used by Amino to encode and decode binary structs. Cdc *codec.Codec }
func SetupTestInput ¶
This function create an environment to test modules
func (Keeper) AddTrustedMinter ¶
func (keeper Keeper) AddTrustedMinter(ctx sdk.Context, minter sdk.AccAddress)
AddTrustedMinter allows to add the given minter as a trusted address that can sign the minting of new memberships tokens
func (Keeper) AssignMembership ¶
func (keeper Keeper) AssignMembership(ctx sdk.Context, user sdk.AccAddress, membershipType string) (string, error)
AssignMembership allow to mint and assign a membership of the given membershipType to the specified user. If the user already has a membership assigned, deletes the current one and assigns to it the new one. Returns the URI of the new minted token represented the assigned membership, or an error if something goes wrong
func (Keeper) GetMembership ¶
GetMembership allows to retrieve any existent membership for the specified user. The second returned false (the boolean one) tells if the NFT token representing the membership was found or not
func (Keeper) GetMembershipType ¶
GetMembershipType returns the type of the membership represented by the given NFT token
func (Keeper) GetMembershipsSet ¶
func (keeper Keeper) GetMembershipsSet(ctx sdk.Context) []types.Membership
Get GetMembershipsSet returns the list of all the memberships that have been minted and are currently stored inside the store
func (Keeper) GetTrustedMinters ¶
GetTrustedMinters returns the list of the current addresses that are allowed to mint a new membership token when necessary
func (Keeper) RemoveMembership ¶
RemoveMembership allows to remove any existing membership associated with the given user.
type MembershipResult ¶
type MembershipResult struct { User sdk.AccAddress `json:"user"` MembershipType string `json:"membership_type"` }
MembershipResult represents the data returned when a search is performed to know the membership of a given user