types

package
Version: v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName

	CodeBadQueryRequest        sdk.CodeType = 400
	CodeNoRegisteredReadableID sdk.CodeType = 404
)
View Source
const (
	// ModuleName uses for schema name in key-value store
	ModuleName = "nickname"

	// StoreKey sets schema name from ModuleName
	StoreKey = ModuleName
)
View Source
const RouterKey = ModuleName

RouterKey is not in sense yet

Variables

View Source
var ModuleCdc = codec.New()

ModuleCdc is used as a codec in types package

Functions

func ErrBadQueryRequest

func ErrBadQueryRequest(codespace sdk.CodespaceType) sdk.Error

ErrBadQueryRequest - malform query request

func ErrNoRegisteredReadableID

func ErrNoRegisteredReadableID(codespace sdk.CodespaceType, readableid string) sdk.Error

ErrNoRegisteredReadableID - no registered readable name

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type MsgChangeKey

type MsgChangeKey struct {
	Nickname   string         `json:"nickname"`
	OldAddress sdk.AccAddress `json:"old_address"`
	NewAddress sdk.AccAddress `json:"new_address"`
}

MsgChangeKey defines a ChangeKey message

func NewMsgChangeKey

func NewMsgChangeKey(name string,
	oldAddress, newAddress sdk.AccAddress,
) MsgChangeKey

NewMsgChangeKey is a constructor function for MsgChangeKey

func (MsgChangeKey) GetSignBytes

func (msg MsgChangeKey) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgChangeKey) GetSigners

func (msg MsgChangeKey) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgChangeKey) Route

func (msg MsgChangeKey) Route() string

Route should return the name of the module

func (MsgChangeKey) Type

func (msg MsgChangeKey) Type() string

Type should return the action

func (MsgChangeKey) ValidateBasic

func (msg MsgChangeKey) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgSetNickname

type MsgSetNickname struct {
	Nickname Name           `json:"nickname"`
	Address  sdk.AccAddress `json:"address"`
}

MsgSetAccount defines a SetAccount message

func NewMsgSetNickname

func NewMsgSetNickname(name Name, address sdk.AccAddress) MsgSetNickname

NewMsgSetNickname is a constructor function for MsgSetName

func (MsgSetNickname) GetSignBytes

func (msg MsgSetNickname) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgSetNickname) GetSigners

func (msg MsgSetNickname) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgSetNickname) Route

func (msg MsgSetNickname) Route() string

Route should return the name of the module

func (MsgSetNickname) Type

func (msg MsgSetNickname) Type() string

Type should return the action

func (MsgSetNickname) ValidateBasic

func (msg MsgSetNickname) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type Name

type Name struct {
	H, L uint64
}

Name is uint128 datatype, and supports redable ID which contains up to 20 letters. But, Golang has no uint128 in native, so it should be created manually. ID fills H uint64 first 10 letters, and fills L next 10 letters.

func NewName

func NewName(stringName string) Name

NewName acts like a constuctor of "Name"

func (*Name) Equal

func (N *Name) Equal(comp Name) bool

Equal compares between two name objects

func (*Name) Init

func (N *Name) Init(stringName string) error

Init work as a initializer of Name

func (*Name) MustToString

func (N *Name) MustToString() string

MustToString works as like ToString but no error return

func (*Name) ToString

func (N *Name) ToString() (string, error)

ToString extracts string form from uint128 "Name" struct

type QueryReqUnitAccount

type QueryReqUnitAccount struct {
	Nickname string `json:"nickname"`
}

QueryReqUnitAccount payload for a UnitAccount query

type QueryResUnitAccount

type QueryResUnitAccount struct {
	Nickname string         `json:"nickname"`
	Address  sdk.AccAddress `json:"address"`
}

QueryResUnitAccount is response of a UnitAccount query

func (QueryResUnitAccount) String

func (r QueryResUnitAccount) String() string

implement fmt.Stringer

type UnitAccount

type UnitAccount struct {
	Nickname Name           `json:"nick"`
	Address  sdk.AccAddress `json:"address"`
}

UnitAccount used to define Unit account structure

func NewUnitAccount

func NewUnitAccount(name Name, address sdk.AccAddress) UnitAccount

NewUnitAccount returns a new UnitAccount

func (UnitAccount) String

func (w UnitAccount) String() string

implement fmt.Stringer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL