Documentation ¶
Index ¶
Constants ¶
const ( // module name ModuleName = "nameservice" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
const RouterKey = ModuleName // this was defined in your key.go file
Variables ¶
var MinNamePrice = sdk.Coins{sdk.NewInt64Coin("nametoken", 1)}
Initial Starting Price for a name that was never previously owned 如果名称尚未有所有者,我们希望使用 MinPrice 对其进行初始化。
var ModuleCdc = codec.New()
Functions ¶
func RegisterCodec ¶
创建的任何接口和实现接口的任何结构都需要在RegisterCodec函数中声明。 在此模块中,需要注册两个Msg的实现(SetName和BuyName), 但你的Whois查询返回的类型不需要 RegisterCodec registers concrete types on the Amino codec
Types ¶
type MsgBuyName ¶
type MsgBuyName struct { Name string `json:"name"` Bid sdk.Coins `json:"bid"` Buyer sdk.AccAddress `json:"buyer"` }
MsgBuyName defines the BuyName message
func NewMsgBuyName ¶
func NewMsgBuyName(name string, bid sdk.Coins, buyer sdk.AccAddress) MsgBuyName
定义购买域名的Msg NewMsgBuyName is the constructor function for MsgBuyName
func (MsgBuyName) GetSignBytes ¶
func (msg MsgBuyName) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgBuyName) GetSigners ¶
func (msg MsgBuyName) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgBuyName) Route ¶
func (msg MsgBuyName) Route() string
Route should return the name of the module
func (MsgBuyName) ValidateBasic ¶
func (msg MsgBuyName) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type MsgSetName ¶
type MsgSetName struct { Name string `json:"name"` Value string `json:"value"` Owner sdk.AccAddress `json:"owner"` }
SDK中Msg的命令约束是 Msg{.Action}。 要实现的第一个操作是SetName,因此命名为MsgSetName。 此Msg允许域名的所有者设置该域名的解析返回值。 MsgSetName defines a SetName message
func NewMsgSetName ¶
func NewMsgSetName(name string, value string, owner sdk.AccAddress) MsgSetName
NewMsgSetName is a constructor function for MsgSetName
func (MsgSetName) GetSignBytes ¶
func (msg MsgSetName) GetSignBytes() []byte
GetSignBytes定义了如何编码Msg以进行签名。 在大多数情形下,要编码成排好序的JSON。不应修改输出。 GetSignBytes encodes the message for signing
func (MsgSetName) GetSigners ¶
func (msg MsgSetName) GetSigners() []sdk.AccAddress
GetSigners定义一个Tx上需要哪些人的签名才能使其有效。 在这种情形下,MsgSetName要求域名所有者在尝试重置域名解析值时要对该交易签名。 GetSigners defines whose signature is required
func (MsgSetName) Route ¶
func (msg MsgSetName) Route() string
实现Msg接口 SDK使用上述函数将Msg路由至合适的模块进行处理。它们还为用于索引的数据库标签添加了可读性的名称。 Route should return the name of the module
func (MsgSetName) Type ¶
func (msg MsgSetName) Type() string
实现Msg接口 SDK使用上述函数将Msg路由至合适的模块进行处理。它们还为用于索引的数据库标签添加了可读性的名称。 Type should return the action
func (MsgSetName) ValidateBasic ¶
func (msg MsgSetName) ValidateBasic() sdk.Error
ValidateBasic用于对Msg的有效性进行一些基本的无状态检查。在此情形下,请检查没有属性为空。 请注意这里使用sdk.Error类型。 SDK提供了一组应用开发人员经常遇到的错误类型。 ValidateBasic runs stateless checks on the message
type QueryResResolve ¶
type QueryResResolve struct {
Value string `json:"value"`
}
Query Result Payload for a resolve query