nameservice

package
v0.0.0-...-e7c82ff Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = types.ModuleName
	RouterKey  = types.RouterKey
	StoreKey   = types.StoreKey
)
View Source
const (
	// 传入一个域名返回nameservice给定的解析值。类似于DNS查询。
	QueryResolve = "resolve"
	// 传入一个域名返回价格,解析值和域名的所有者。用于确定你想要购买名称的成本。
	QueryWhois = "whois"
	QueryNames = "names"
)

query endpoints supported by the nameservice Querier

Variables

View Source
var (
	NewMsgBuyName = types.NewMsgBuyName
	NewMsgSetName = types.NewMsgSetName
	NewWhois      = types.NewWhois
	ModuleCdc     = types.ModuleCdc
	RegisterCodec = types.RegisterCodec
)

Functions

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState) []abci.ValidatorUpdate

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler本质上是一个子路由,它将进入该模块的msg路由到正确的handler做处理。 NewHandler returns a handler for "nameservice" type messages.

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

该函数充当查询此模块的子路由器 因为querier没有类似于Msg的接口,所以需要手动定义switch语句(它们无法从query.Route()函数中删除) NewQuerier is the module level router for state queries

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

func NewAppModule

func NewAppModule(k Keeper, bankKeeper bank.Keeper) AppModule

NewAppModule creates a new AppModule Object

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) sdk.Tags

func (AppModule) EndBlock

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

func (AppModule) Name

func (AppModule) Name() string

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

func (AppModule) Route

func (am AppModule) Route() string

type AppModuleBasic

type AppModuleBasic struct{}

app module Basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

Get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

Get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

Register rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

Validation check of the Genesis

type GenesisState

type GenesisState struct {
	WhoisRecords []Whois `json:"whois_records"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

func NewGenesisState

func NewGenesisState(whoIsRecords []Whois) GenesisState

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(coinKeeper bank.Keeper, storeKey sdk.StoreKey, cdc *codec.Codec) Keeper

Keeper的构造函数 NewKeeper creates new instances of the nameservice Keeper

func (Keeper) GetNamesIterator

func (k Keeper) GetNamesIterator(ctx sdk.Context) sdk.Iterator

获得迭代器,用于遍历指定 store 中的所有 <Key, Value> 对。 Get an iterator over all names in which the keys are the names and the values are the whois

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, name string) sdk.AccAddress

获取地址所有者 GetOwner - get the current owner of a name

func (Keeper) GetPrice

func (k Keeper) GetPrice(ctx sdk.Context, name string) sdk.Coins

获取价格 GetPrice - gets the current price of a name

func (Keeper) GetWhois

func (k Keeper) GetWhois(ctx sdk.Context, name string) Whois

Gets the entire Whois metadata struct for a name 添加一个函数来解析域名(即查找域名对应的解析值)

func (Keeper) HasOwner

func (k Keeper) HasOwner(ctx sdk.Context, name string) bool

判断地址是否已被使用 HasOwner - returns whether or not the name already has an owner

func (Keeper) ResolveName

func (k Keeper) ResolveName(ctx sdk.Context, name string) string

ResolveName - returns the string that the name resolves to 根据名称返回域名解析出的值

func (Keeper) SetName

func (k Keeper) SetName(ctx sdk.Context, name string, value string)

SetName - sets the value string that a name resolves to 设置已有name的whois值为新name

func (Keeper) SetOwner

func (k Keeper) SetOwner(ctx sdk.Context, name string, owner sdk.AccAddress)

设置地址所有者 SetOwner - sets the current owner of a name

func (Keeper) SetPrice

func (k Keeper) SetPrice(ctx sdk.Context, name string, price sdk.Coins)

设置价格 SetPrice - sets the current price of a name

func (Keeper) SetWhois

func (k Keeper) SetWhois(ctx sdk.Context, name string, whois Whois)

Sets the entire Whois metadata struct for a name 添加一个函数来为指定域名设置解析字符串值

type MsgBuyName

type MsgBuyName = types.MsgBuyName

type MsgSetName

type MsgSetName = types.MsgSetName

type QueryResNames

type QueryResNames = types.QueryResNames

type QueryResResolve

type QueryResResolve = types.QueryResResolve

type Whois

type Whois = types.Whois

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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