types

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: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// module name
	ModuleName = "nameservice"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file

Variables

View Source
var MinNamePrice = sdk.Coins{sdk.NewInt64Coin("nametoken", 1)}

Initial Starting Price for a name that was never previously owned 如果名称尚未有所有者,我们希望使用 MinPrice 对其进行初始化。

View Source
var ModuleCdc = codec.New()

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

创建的任何接口和实现接口的任何结构都需要在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) Type

func (msg MsgBuyName) Type() string

Type should return the action

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 QueryResNames

type QueryResNames []string

Query Result Payload for a names query

func (QueryResNames) String

func (n QueryResNames) String() string

implement fmt.Stringer

type QueryResResolve

type QueryResResolve struct {
	Value string `json:"value"`
}

Query Result Payload for a resolve query

func (QueryResResolve) String

func (r QueryResResolve) String() string

implement fmt.Stringer

type Whois

type Whois struct {
	//域名解析出的值。这是任意字符串,
	//但将来您可以修改它以要求它适合特定格式,
	//例如IP地址,DNS区域文件或区块链地址。
	Value string `json:"value"`
	//该域名当前所有者的地址
	Owner sdk.AccAddress `json:"owner"`
	//你需要为购买域名支付的费用
	Price sdk.Coins `json:"price"`
}

Whois is a struct that contains all the metadata of a name

func NewWhois

func NewWhois() Whois

Returns a new Whois with the minprice as the price

func (Whois) String

func (w Whois) String() string

implement fmt.Stringer

Jump to

Keyboard shortcuts

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