Documentation ¶
Overview ¶
Package keeper contains the definition of the queries used to interact with the starname module and also the keeper object that takes care of modifying and reading the state of the module.
Index ¶
- Constants
- Variables
- func AvailableQueries() []queries.QueryHandler
- func NewQuerier(k Keeper) sdk.Querier
- func NewTestCodec() *codec.Codec
- func NewTestKeeper(t testing.TB, isCheckTx bool) (Keeper, sdk.Context, *Mocks)
- func RunTests(t *testing.T, tests map[string]SubTest)
- type ConfigurationKeeper
- type ConfigurationSetter
- type DullMsg
- type Keeper
- type Mocks
- type ParamSubspace
- type QueryAccountsInDomain
- type QueryAccountsInDomainResponse
- type QueryAccountsWithOwner
- type QueryAccountsWithOwnerResponse
- type QueryDomainsWithOwner
- type QueryDomainsWithOwnerResponse
- type QueryHandlerFunc
- type QueryResolveAccount
- type QueryResolveAccountResponse
- type QueryResolveDomain
- type QueryResolveDomainResponse
- type QueryResolveResource
- type QueryResolveResourceResponse
- type SubTest
- type SupplyKeeper
Constants ¶
const RegexMatchAll = "^(.*?)?"
const RegexMatchNothing = "$^"
Variables ¶
var AliceKey types.AccAddress = addrs[0]
var BobKey types.AccAddress = addrs[1]
var CharlieKey types.AccAddress = addrs[2]
Functions ¶
func AvailableQueries ¶
func AvailableQueries() []queries.QueryHandler
AvailableQueries returns the list of available queries in the module
func NewQuerier ¶
NewQuerier builds the query handler for the module
func NewTestCodec ¶
NewTestCodec generates aliceAddr mock codec for keeper module
func NewTestKeeper ¶
NewTestKeeper generates aliceAddr keeper and aliceAddr context from it
Types ¶
type ConfigurationKeeper ¶
type ConfigurationKeeper interface { // GetFees gets the fees GetFees(ctx sdk.Context) *configuration.Fees // GetConfiguration returns the configuration GetConfiguration(ctx sdk.Context) configuration.Config // IsOwner returns if the provided address is an owner or not IsOwner(ctx sdk.Context, addr sdk.AccAddress) bool // GetValidDomainNameRegexp returns the regular expression that aliceAddr domain name must match // in order to be valid GetValidDomainNameRegexp(ctx sdk.Context) string // GetDomainRenewDuration returns the default duration of aliceAddr domain renewal GetDomainRenewDuration(ctx sdk.Context) time.Duration // GetDomainGracePeriod returns the grace period duration GetDomainGracePeriod(ctx sdk.Context) time.Duration }
ConfigurationKeeper defines the behaviour of the configuration state checks
type ConfigurationSetter ¶
type ConfigurationSetter interface { SetConfig(ctx types.Context, config configuration.Config) SetFees(ctx types.Context, fees *configuration.Fees) }
since the exposed interface for configuration keeper does not include set config as the domain module should not be able to change configuration state, then only in test cases we expose this method
func GetConfigSetter ¶
func GetConfigSetter(keeper ConfigurationKeeper) ConfigurationSetter
getConfigSetter exposes the configurationSetter interface allowing the module to set configuration state, this should only be used for tests and will panic if the keeper provided can not be cast to configurationSetter
type DullMsg ¶
type DullMsg struct {
// contains filtered or unexported fields
}
func (*DullMsg) FeePayer ¶
func (m *DullMsg) FeePayer() sdk.AccAddress
func (*DullMsg) GetSignBytes ¶
GetSignBytes implements sdk.Msg
func (*DullMsg) GetSigners ¶
func (m *DullMsg) GetSigners() []sdk.AccAddress
GetSigners implements sdk.Msg
func (*DullMsg) ValidateBasic ¶
type Keeper ¶
type Keeper struct { // external keepers ConfigurationKeeper ConfigurationKeeper SupplyKeeper SupplyKeeper // default fields StoreKey sdk.StoreKey // contains the store key for the domain module Cdc *codec.Codec // contains filtered or unexported fields }
Keeper of the domain store TODO split this keeper in sub-struct in order to avoid possible mistakes with keys and not clutter the exposed methods
func NewKeeper ¶
func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, configKeeper ConfigurationKeeper, supply SupplyKeeper, paramspace ParamSubspace) Keeper
NewKeeper creates aliceAddr domain keeper
func (Keeper) AccountStore ¶
AccountStore returns the crud.Store used to interact with account objects
func (Keeper) CollectFees ¶
CollectFees collects the fees of a msg and sends them to the distribution module to validators and stakers
func (Keeper) DomainStore ¶
DomainStore returns the crud.Store used to interact with domain objects
type Mocks ¶
type Mocks struct {
Supply *mock.SupplyKeeperMock
}
type QueryAccountsInDomain ¶
type QueryAccountsInDomain struct { // Domain is the domain name Domain string `json:"domain" arg:"positional"` // ResultsPerPage is the results that each page should contain ResultsPerPage int `json:"results_per_page" arg:"positional"` // Offset is the page number Offset int `json:"offset" arg:"positional"` }
QueryAccountsInDomain is the request model used to query accounts contained in a domain
func (*QueryAccountsInDomain) Description ¶
func (q *QueryAccountsInDomain) Description() string
Description is a placeholder
func (*QueryAccountsInDomain) Handler ¶
func (q *QueryAccountsInDomain) Handler() QueryHandlerFunc
Handler implements queryHandler
func (*QueryAccountsInDomain) QueryPath ¶
func (q *QueryAccountsInDomain) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryAccountsInDomain) Use ¶
func (q *QueryAccountsInDomain) Use() string
Use is a placeholder
func (*QueryAccountsInDomain) Validate ¶
func (q *QueryAccountsInDomain) Validate() error
Validate implements queries.QueryHandler
type QueryAccountsInDomainResponse ¶
type QueryAccountsInDomainResponse struct { // Accounts is a slice of the accounts found Accounts []*types.Account `json:"accounts"` }
QueryAccountsInDomainResponse is the response model returned after a QueryAccountsInDomain query
type QueryAccountsWithOwner ¶
type QueryAccountsWithOwner struct { // Owner is the owner of the accounts Owner sdk.AccAddress `json:"owner"` // ResultsPerPage is the number of results returned in each page ResultsPerPage int `json:"results_per_page"` // Offset is the page number Offset int `json:"offset"` }
QueryAccountsWithOwner queries all the accounts owned by a certain sdk.AccAddress
func (*QueryAccountsWithOwner) Description ¶
func (q *QueryAccountsWithOwner) Description() string
Description is a placeholder
func (*QueryAccountsWithOwner) Handler ¶
func (q *QueryAccountsWithOwner) Handler() QueryHandlerFunc
Handler implements local queryHandler
func (*QueryAccountsWithOwner) QueryPath ¶
func (q *QueryAccountsWithOwner) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryAccountsWithOwner) Use ¶
func (q *QueryAccountsWithOwner) Use() string
Use is a placeholder
func (*QueryAccountsWithOwner) Validate ¶
func (q *QueryAccountsWithOwner) Validate() error
Validate implements queries.QueryHandler
type QueryAccountsWithOwnerResponse ¶
type QueryAccountsWithOwnerResponse struct { // Accounts is a slice containing the accounts // returned by the query Accounts []types.Account `json:"accounts"` }
QueryAccountsWithOwnerResponse is the response model returned by QueryAccountsWithOwner
type QueryDomainsWithOwner ¶
type QueryDomainsWithOwner struct { // Owner is the address of the owner of the domains Owner sdk.AccAddress `json:"owner"` // ResultsPerPage is the number of results displayed in a page ResultsPerPage int `json:"results_per_page"` // Offset is the page number Offset int `json:"offset"` }
QueryDomainsWithOwner is the request model used to query domains owned by a sdk.AccAddress
func (*QueryDomainsWithOwner) Description ¶
func (q *QueryDomainsWithOwner) Description() string
Description is a placeholder
func (*QueryDomainsWithOwner) Handler ¶
func (q *QueryDomainsWithOwner) Handler() QueryHandlerFunc
Handler implements the local queryHandler
func (*QueryDomainsWithOwner) QueryPath ¶
func (q *QueryDomainsWithOwner) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryDomainsWithOwner) Use ¶
func (q *QueryDomainsWithOwner) Use() string
Use is a placeholder
func (*QueryDomainsWithOwner) Validate ¶
func (q *QueryDomainsWithOwner) Validate() error
Validate implements queries.QueryHandler
type QueryDomainsWithOwnerResponse ¶
type QueryDomainsWithOwnerResponse struct { // Domains is a slice of the domains // found by the query Domains []types.Domain }
QueryDomainsWithOwnerResponse is the response returned by the QueryDomainsWithOwner query
type QueryHandlerFunc ¶
type QueryHandlerFunc func(ctx sdk.Context, path []string, query abci.RequestQuery, k Keeper) ([]byte, error)
QueryHandlerFunc defines the query handler for this module
type QueryResolveAccount ¶
type QueryResolveAccount struct { // Domain is the name of the domain of the account Domain string `json:"domain"` // Name is the name of the account Name string `json:"name"` // Starname is the representation of an account in domain*name format Starname string `json:"starname"` }
QueryResolveAccount is the query model used to resolve an account
func (*QueryResolveAccount) Description ¶
func (q *QueryResolveAccount) Description() string
Description is a placeholder
func (*QueryResolveAccount) Handler ¶
func (q *QueryResolveAccount) Handler() QueryHandlerFunc
Handler implements local queryHandler
func (*QueryResolveAccount) QueryPath ¶
func (q *QueryResolveAccount) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryResolveAccount) Validate ¶
func (q *QueryResolveAccount) Validate() error
Validate implements queries.QueryHandler
type QueryResolveAccountResponse ¶
type QueryResolveAccountResponse struct { // Account contains the resolved account Account types.Account `json:"account"` }
QueryResolveAccountResponse is the response returned by the QueryResolveAccount query
type QueryResolveDomain ¶
type QueryResolveDomain struct { // Name is the domain name Name string `json:"name" arg:"positional"` }
QueryResolveDomain is the request model used to resolve a domain
func (*QueryResolveDomain) Description ¶
func (q *QueryResolveDomain) Description() string
Description is a placeholder
func (*QueryResolveDomain) Handler ¶
func (q *QueryResolveDomain) Handler() QueryHandlerFunc
Handler implements the local queryHandler
func (*QueryResolveDomain) QueryPath ¶
func (q *QueryResolveDomain) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryResolveDomain) Validate ¶
func (q *QueryResolveDomain) Validate() error
Validate implements queries.QueryHandler
type QueryResolveDomainResponse ¶
type QueryResolveDomainResponse struct { // Domain contains the queried domain information Domain types.Domain `json:"domain"` }
QueryResolveDomainResponse is response returned by the QueryResolveDomain query
type QueryResolveResource ¶
type QueryResolveResource struct { // Resource is the resource we want to query Resource types.Resource `json:"resource"` // ResultsPerPage is the number of results displayed in a page ResultsPerPage int `json:"results_per_page"` // Offset is the page number Offset int `json:"offset"` }
QueryResolveResource gets accounts from a resource
func (*QueryResolveResource) Handler ¶
func (q *QueryResolveResource) Handler() QueryHandlerFunc
Handler implements queries.QueryHandler
func (*QueryResolveResource) QueryPath ¶
func (q *QueryResolveResource) QueryPath() string
QueryPath implements queries.QueryHandler
func (*QueryResolveResource) Validate ¶
func (q *QueryResolveResource) Validate() error
Validate implements queries.QueryHandler
type QueryResolveResourceResponse ¶
QueryResolveResourceResponse is the response returned by query resource
type SubTest ¶
type SubTest struct { // BeforeTestBlockTime is the block time during before test in unix seconds // WARNING: if block time is given 0, it will be accepted as time.Now() BeforeTestBlockTime int64 // BeforeTest is the function run before doing the test, // used for example to store state, like configurations etc. // Ignored if nil BeforeTest func(t *testing.T, k Keeper, ctx types.Context, mocks *Mocks) // TestBlockTime is the block time during test in unix seconds // WARNING: if block time is given 0, it will be accepted as time.Now() TestBlockTime int64 // Test is the function that runs the actual test Test func(t *testing.T, k Keeper, ctx types.Context, mocks *Mocks) // AfterTestBlockTime is the block time during after test in unix seconds // WARNING: if block time is given 0, it will be accepted as time.Now() AfterTestBlockTime int64 // AfterTest performs actions after the test is run, it can // be used to check if the state after Test is run matches // the result we expect. // Ignored if nil AfterTest func(t *testing.T, k Keeper, ctx types.Context, mocks *Mocks) }
subTest defines a test runner
type SupplyKeeper ¶
type SupplyKeeper interface {
SendCoinsFromAccountToModule(ctx sdk.Context, addr sdk.AccAddress, moduleName string, coins sdk.Coins) error
}
SupplyKeeper defines the behaviour of the supply keeper used to collect and then distribute the fees
Directories ¶
Path | Synopsis |
---|---|
Package executor implements wrappers around starname module keeper that are used to perform actions on objects stored inside the crud.Store
|
Package executor implements wrappers around starname module keeper that are used to perform actions on objects stored inside the crud.Store |