types

package
v0.0.0-...-8551cdf Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	KuMsgMaxAuth    = 3
	KuMsgMaxDataLen = 1024
)
View Source
const (
	NameStrLenMax = 17

	NameBytesLen         = 16
	NameBytesTypeCodeLen = 1
	NameBytesVersionLen  = 1
	NameBytesLengthLen   = 1
	NameBytesHeaderLen   = NameBytesTypeCodeLen + NameBytesVersionLen + NameBytesLengthLen

	NameStrLengthIdx = 2
)
View Source
const (
	CharValueSeq       byte = 0  // @
	CharValueNil       byte = 63 // 111111
	CharValueDot       byte = 49 // .
	CharValueUnderline byte = 50 // _
)
View Source
const (
	DefaultPage    = 1
	DefaultLimit   = 30             // should be consistent with tendermint/tendermint/rpc/core/pipe.go:19
	TxMinHeightKey = "tx.minheight" // Inclusive minimum height filter
	TxMaxHeightKey = "tx.maxheight" // Inclusive maximum height filter
)
View Source
const (
	AccIDStoreKeyLen = sdk.AddrLen + 1
)
View Source
const (
	KuCodeSpace = "Kuchain"
)
View Source
const (
	KuMsgMaxLen = (KuMsgMaxAuth+4)*32 + KuMsgMaxDataLen + 64 // TODO: use fix coins imp
)

Variables

View Source
var (
	NewCoin       = sdk.NewCoin
	NewInt        = sdk.NewInt
	ParseCoin     = sdk.ParseCoin
	ParseCoins    = sdk.ParseCoins
	NewDecCoin    = sdk.NewDecCoin
	NewDecCoins   = sdk.NewDecCoins
	ParseDecCoins = sdk.ParseDecCoins
)
View Source
var (
	ErrNameParseTooLen = sdkerrors.Register(KuCodeSpace, errorCode(nameErrorCodeRoot, 1), "ErrNameParseTooLen")
	ErrNameNilString   = sdkerrors.Register(KuCodeSpace, errorCode(nameErrorCodeRoot, 2), "ErrNameNilString")
	ErrNameCharError   = sdkerrors.Register(KuCodeSpace, errorCode(nameErrorCodeRoot, 3), "ErrNameCharError")
	ErrNameStrNoValid  = sdkerrors.Register(KuCodeSpace, errorCode(nameErrorCodeRoot, 4), "ErrNameStrNoValid")
)
View Source
var (
	ErrKuMsgAuthCountTooLarge = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 1), fmt.Sprintf("KuMsg Auth Count should less then %d", KuMsgMaxAuth))
	ErrKuMsgMissingFrom       = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 2), "KuMsg missing from accountID")
	ErrKuMsgMissingTo         = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 3), "KuMsg missing to accountID")
	ErrKuMsgMissingRouter     = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 4), "KuMsg missing router name")
	ErrKuMsgMissingType       = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 5), "KuMsg missing type name")
	ErrKuMsgMissingAuth       = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 6), "KuMsg missing auth for msg")
	ErrKuMsgDataTooLarge      = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 7), fmt.Sprintf("KuMsg msg data should <= %d", KuMsgMaxDataLen))
	ErrKuMsgDataUnmarshal     = sdkerrors.Register(KuCodeSpace, errorCode(kuMsgErrorCodeRoot, 8), "KuMsg msg data unmarshal error")
)
View Source
var (
	ErrMissingAuth    = sdkerrors.Register(KuCodeSpace, errorCode(authErrorCodeRoot, 1), "Msg missing auth required")
	ErrTransfNoEnough = sdkerrors.Register(KuCodeSpace, errorCode(authErrorCodeRoot, 2), "Msg coin transf no enough")
	ErrTransfNotTo    = sdkerrors.Register(KuCodeSpace, errorCode(authErrorCodeRoot, 3), "Msg to account error")
)
View Source
var (
	ErrGasOverflow     = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 1), "tx invalid gas supplied")
	ErrInsufficientFee = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 2), "tx invalid fee amount provided")
	ErrNoSignatures    = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 3), "tx no signers")
	ErrUnauthorized    = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 4), "tx wrong number of signers")
	ErrTxDecode        = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 5), "tx error decoding")
)
View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	AccAddressFromBech32 = sdk.AccAddressFromBech32
)
View Source
var ModuleCdc *codec.Codec

module wide codec

Functions

func Cdc

func Cdc() *codec.Codec

Cdc get codec for types

func CoinAccountsFromDenom

func CoinAccountsFromDenom(denom string) (Name, Name, error)

CoinAccountsFromDenom get creator and symbol from denom

func CoinDenom

func CoinDenom(creator, symbol Name) string

CoinDenom get denom for coin, in kuchain, all denom for a coin is by creator and symbol

func CountSubKeys

func CountSubKeys(pub crypto.PubKey) int

CountSubKeys counts the total number of keys for a multi-sig public key.

func DefaultTxDecoder

func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder

DefaultTxDecoder logic for standard transaction decoding

func DefaultTxEncoder

func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder

DefaultTxEncoder logic for standard transaction encoding

func IsNameEq

func IsNameEq(r, l Name) bool

IsNameEq return is r eq l

func LoadGenesisFile

func LoadGenesisFile(cdc *codec.Codec, genFile string) (genDoc tmtypes.GenesisDoc, err error)

LoadGenesisFile reads and unmarshals GenesisDoc from the given file.

func LoadGenesisStateFromBytes

func LoadGenesisStateFromBytes(cdc *codec.Codec, appState AppGenesisState, key string, val interface{}) error

LoadGenesisStateFromBytes

func LoadGenesisStateFromFile

func LoadGenesisStateFromFile(cdc *codec.Codec, genFile, key string, val interface{}) error

LoadGenesisStateFromFile

func ParseFloat64OrReturnBadRequest

func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool)

ParseFloat64OrReturnBadRequest converts s to a float64 value. It returns a default value, defaultIfEmpty, if the string is empty.

func ParseHTTPArgs

func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error)

ParseHTTPArgs parses the request's URL and returns a slice containing all arguments pairs. It separates page and limit used for pagination.

func ParseHTTPArgsWithLimit

func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, page, limit int, err error)

ParseHTTPArgsWithLimit parses the request's URL and returns a slice containing all arguments pairs. It separates page and limit used for pagination where a default limit can be provided.

func ParseQueryHeightOrReturnBadRequest

func ParseQueryHeightOrReturnBadRequest(w http.ResponseWriter, cliCtx context.CLIContext, r *http.Request) (context.CLIContext, bool)

ParseQueryHeightOrReturnBadRequest sets the height to execute a query if set by the http request. It returns false if there was an error parsing the height.

func ParseQueryParamBool

func ParseQueryParamBool(r *http.Request, param string) bool

ParseQueryParamBool parses the given param to a boolean. It returns false by default if the string is not parseable to bool.

func ParseUint64OrReturnBadRequest

func ParseUint64OrReturnBadRequest(w http.ResponseWriter, s string) (n uint64, ok bool)

ParseUint64OrReturnBadRequest converts s to a uint64 value.

func PostProcessResponse

func PostProcessResponse(w http.ResponseWriter, cliCtx context.CLIContext, resp interface{})

PostProcessResponse performs post processing for a REST response. The result returned to clients will contain two fields, the height at which the resource was queried at and the original result.

func PostProcessResponseBare

func PostProcessResponseBare(w http.ResponseWriter, cliCtx context.CLIContext, body interface{})

PostProcessResponseBare post processes a body similar to PostProcessResponse except it does not wrap the body and inject the height.

func ReadRESTReq

func ReadRESTReq(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req interface{}) bool

ReadRESTReq reads and unmarshals a Request's body to the the BaseReq stuct. Writes an error response to ResponseWriter and returns true if errors occurred.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

func SaveGenesisStateToFile

func SaveGenesisStateToFile(cdc *codec.Codec, genFile, key string, val interface{}) error

SaveGenesisStateToFile

func StdSignBytes

func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte

StdSignBytes returns the bytes to sign for a transaction.

func VerifyNameString

func VerifyNameString(str string) bool

VerifyNameString return if str is valid for name

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, status int, err string)

WriteErrorResponse prepares and writes a HTTP error given a status code and an error message.

func WriteSimulationResponse

func WriteSimulationResponse(w http.ResponseWriter, cdc *codec.Codec, gas uint64)

WriteSimulationResponse prepares and writes an HTTP response for transactions simulations.

Types

type AccAddress

type AccAddress = sdk.AccAddress

func MustAccAddressFromBech32

func MustAccAddressFromBech32(str string) AccAddress

MustAccAddressFromBech32 AccAddressFromBech32 if error then panic

type AccountAuther

type AccountAuther interface {
	GetAuth(ctx sdk.Context, account Name) (AccAddress, error)
}

AccountAuther a interface for account auth getter

type AccountID

type AccountID struct {
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"`
}

AccountID a id for the entity which can own asset, now the accountID will be a AccAddress or a name for a account

func EmptyAccountID

func EmptyAccountID() AccountID

EmptyAccountID return a empty accountID

func NewAccountIDFromAccAdd

func NewAccountIDFromAccAdd(add sdk.AccAddress) AccountID

NewAccountIDFromAccAdd create AccountID from AccAddress

func NewAccountIDFromAdd

func NewAccountIDFromAdd(add sdk.Address) AccountID

NewAccountIDFromAdd create AccountID from AccAddress

func NewAccountIDFromByte

func NewAccountIDFromByte(bytes []byte) AccountID

NewAccountIDFromByte create AccountID from byte

func NewAccountIDFromConsAdd

func NewAccountIDFromConsAdd(add sdk.ConsAddress) AccountID

NewAccountIDFromConsAdd create AccountID from AccAddress

func NewAccountIDFromName

func NewAccountIDFromName(n Name) (res AccountID)

NewAccountIDFromName create AccountID from Name

func NewAccountIDFromStoreKey

func NewAccountIDFromStoreKey(val []byte) AccountID

NewAccountIDFromStoreKey creates a new accountID from store key

func NewAccountIDFromStr

func NewAccountIDFromStr(str string) (AccountID, error)

NewAccountIDFromStr new accountID from string

func NewAccountIDFromValAdd

func NewAccountIDFromValAdd(add sdk.ValAddress) AccountID

NewAccountIDFromValAdd create AccountID from AccAddress

func (AccountID) Bytes

func (a AccountID) Bytes() []byte

Bytes imp Address interface

func (*AccountID) Descriptor

func (*AccountID) Descriptor() ([]byte, []int)

func (AccountID) Empty

func (a AccountID) Empty() bool

Empty return is AccountID is empty, if AccountID is a name, return is a empty name

func (AccountID) Eq

func (a AccountID) Eq(o AccountID) bool

Equals if is same byte

func (AccountID) Equal

func (a AccountID) Equal(o *AccountID) bool

Equals if is same byte

func (AccountID) Equals

func (a AccountID) Equals(o sdk.Address) bool

Equals if is same byte

func (AccountID) Format

func (a AccountID) Format(s fmt.State, verb rune)

Format imp Address interface

func (*AccountID) Marshal

func (m *AccountID) Marshal() (dAtA []byte, err error)

func (AccountID) MarshalJSON

func (a AccountID) MarshalJSON() ([]byte, error)

MarshalJSON imp Address interface

func (*AccountID) MarshalTo

func (m *AccountID) MarshalTo(dAtA []byte) (int, error)

func (*AccountID) MarshalToSizedBuffer

func (m *AccountID) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (AccountID) MarshalYAML

func (a AccountID) MarshalYAML() (interface{}, error)

MarshalYAML imp to yaml

func (AccountID) MustAccAddress

func (a AccountID) MustAccAddress() sdk.AccAddress

MustAccAddress if a is a account address return AccAddress and true

func (AccountID) MustAddress

func (a AccountID) MustAddress() sdk.Address

MustAddress if a is a address return address( a AccAddress ) and true

func (AccountID) MustName

func (a AccountID) MustName() Name

MustName if `a` is a name return name and true

func (*AccountID) ProtoMessage

func (*AccountID) ProtoMessage()

func (*AccountID) Reset

func (m *AccountID) Reset()

func (*AccountID) Size

func (m *AccountID) Size() (n int)

func (AccountID) StoreKey

func (a AccountID) StoreKey() []byte

StoreKey get bytes for store key

func (AccountID) String

func (a AccountID) String() string

String imp Address interface

func (AccountID) ToAccAddress

func (a AccountID) ToAccAddress() (sdk.AccAddress, bool)

ToAccAddress if a is a account address return AccAddress and true

func (AccountID) ToAddress

func (a AccountID) ToAddress() (sdk.Address, bool)

ToAddress if a is a address return address( a AccAddress ) and true

func (AccountID) ToName

func (a AccountID) ToName() (Name, bool)

ToName if `a` is a name return name and true

func (*AccountID) Unmarshal

func (m *AccountID) Unmarshal(dAtA []byte) error

func (*AccountID) UnmarshalJSON

func (a *AccountID) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal from JSON assuming Bech32 encoding.

func (*AccountID) XXX_DiscardUnknown

func (m *AccountID) XXX_DiscardUnknown()

func (*AccountID) XXX_Marshal

func (m *AccountID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountID) XXX_Merge

func (m *AccountID) XXX_Merge(src proto.Message)

func (*AccountID) XXX_Size

func (m *AccountID) XXX_Size() int

func (*AccountID) XXX_Unmarshal

func (m *AccountID) XXX_Unmarshal(b []byte) error

type AccountIDes

type AccountIDes struct {
	Addresses []AccountID `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses"`
}

AccountIDes defines a repeated set of AccountIDes.

func (*AccountIDes) Descriptor

func (*AccountIDes) Descriptor() ([]byte, []int)

func (*AccountIDes) GetAddresses

func (m *AccountIDes) GetAddresses() []AccountID

func (*AccountIDes) Marshal

func (m *AccountIDes) Marshal() (dAtA []byte, err error)

func (*AccountIDes) MarshalTo

func (m *AccountIDes) MarshalTo(dAtA []byte) (int, error)

func (*AccountIDes) MarshalToSizedBuffer

func (m *AccountIDes) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AccountIDes) ProtoMessage

func (*AccountIDes) ProtoMessage()

func (*AccountIDes) Reset

func (m *AccountIDes) Reset()

func (*AccountIDes) Size

func (m *AccountIDes) Size() (n int)

func (*AccountIDes) String

func (m *AccountIDes) String() string

func (*AccountIDes) Unmarshal

func (m *AccountIDes) Unmarshal(dAtA []byte) error

func (*AccountIDes) XXX_DiscardUnknown

func (m *AccountIDes) XXX_DiscardUnknown()

func (*AccountIDes) XXX_Marshal

func (m *AccountIDes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountIDes) XXX_Merge

func (m *AccountIDes) XXX_Merge(src proto.Message)

func (*AccountIDes) XXX_Size

func (m *AccountIDes) XXX_Size() int

func (*AccountIDes) XXX_Unmarshal

func (m *AccountIDes) XXX_Unmarshal(b []byte) error

type AppGenesisState

type AppGenesisState map[string]json.RawMessage

AppGenesisState type for app 's genesis state, every k-v is for a module

func (AppGenesisState) MarshalGenesis

func (s AppGenesisState) MarshalGenesis(cdc *codec.Codec, key string, val interface{}) error

MarshalGenesis marshals the genesis state for a module in app genesis

func (AppGenesisState) UnmarshalGenesis

func (s AppGenesisState) UnmarshalGenesis(cdc *codec.Codec, key string, val interface{}) error

UnmarshalGenesis unmarshal a genesis state for a module in app genesis

type AssetTransfer

type AssetTransfer interface {
	Transfer(ctx sdk.Context, from, to AccountID, amount Coins) error
}

AssetTransfer a interface for asset coins transfer

type BaseReq

type BaseReq struct {
	From          string   `json:"from"`
	Memo          string   `json:"memo"`
	ChainID       string   `json:"chain_id"`
	AccountNumber uint64   `json:"account_number"`
	Sequence      uint64   `json:"sequence"`
	Fees          Coins    `json:"fees"`
	GasPrices     DecCoins `json:"gas_prices"`
	Gas           string   `json:"gas"`
	GasAdjustment string   `json:"gas_adjustment"`
	Simulate      bool     `json:"simulate"`
	Payer         string   `json:"payer"`
}

BaseReq defines a structure that can be embedded in other request structures that all share common "base" fields.

func NewBaseReq

func NewBaseReq(
	from, memo, chainID string, gas, gasAdjustment string, accNumber, seq uint64,
	fees Coins, gasPrices DecCoins, simulate bool, payer string,
) BaseReq

NewBaseReq creates a new basic request instance and sanitizes its values

func (BaseReq) Sanitize

func (br BaseReq) Sanitize() BaseReq

Sanitize performs basic sanitization on a BaseReq object.

func (BaseReq) ValidateBasic

func (br BaseReq) ValidateBasic(w http.ResponseWriter) bool

ValidateBasic performs basic validation of a BaseReq. If custom validation logic is needed, the implementing request handler should perform those checks manually.

type Coin

type Coin = sdk.Coin

type Coins

type Coins = sdk.Coins

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context for kuchain msg handler

func NewKuMsgCtx

func NewKuMsgCtx(ctx types.Context, auther AccountAuther, msg sdk.Msg) Context

func (Context) Authorize

func (c Context) Authorize(account ...Name)

Authorize make authorize for account to this msg, it call by handlers to allow kumsg can use this auth

func (Context) CheckAuths

func (c Context) CheckAuths() error

func (Context) Context

func (c Context) Context() types.Context

Context get sdk context wrapped

func (Context) GetTransf

func (c Context) GetTransf() (from, to AccountID, amount Coins)

GetTransf get transfer info from msg

func (Context) RequireAccount

func (c Context) RequireAccount(account ...Name)

RequireAuth require account auth

func (Context) RequireAccountAuth

func (c Context) RequireAccountAuth(adds ...AccAddress)

RequireAccountAuth require address auth

func (Context) RequireAuth

func (c Context) RequireAuth(permissions ...AccountID)

RequireAuth require account auth

func (Context) RequireTransfer

func (c Context) RequireTransfer(to AccountID, amount Coins) error

RequireTransfer require transfer coin large then amount for to

func (Context) WithAuths

func (c Context) WithAuths(auths []AccAddress) Context

WithAuths ctx with trx auths

func (Context) WithTransfMsg

func (c Context) WithTransfMsg(msg sdk.Msg) Context

WithTransfer ctx with transfer

type DecCoin

type DecCoin = sdk.DecCoin

type DecCoins

type DecCoins = sdk.DecCoins

type ErrorResponse

type ErrorResponse struct {
	Code  int    `json:"code,omitempty"`
	Error string `json:"error"`
}

ErrorResponse defines the attributes of a JSON error response.

func NewErrorResponse

func NewErrorResponse(code int, err string) ErrorResponse

NewErrorResponse creates a new ErrorResponse instance.

type GasEstimateResponse

type GasEstimateResponse struct {
	GasEstimate uint64 `json:"gas_estimate"`
}

GasEstimateResponse defines a response definition for tx gas estimation.

type Int

type Int = sdk.Int

type KuMsg

type KuMsg struct {
	Auth   []github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 128-byte string literal not displayed */
	From   AccountID                                       `protobuf:"bytes,2,opt,name=from,proto3" json:"from" yaml:"from"`
	To     AccountID                                       `protobuf:"bytes,3,opt,name=to,proto3" json:"to" yaml:"to"`
	Amount github_com_cosmos_cosmos_sdk_types.Coins        `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"`
	Router Name                                            `protobuf:"bytes,5,opt,name=router,proto3" json:"router" yaml:"router"`
	Action Name                                            `protobuf:"bytes,6,opt,name=action,proto3" json:"action" yaml:"action"`
	Data   []byte                                          `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty" yaml:"data"`
}

KuMsg is the base msg for token transfer msg

func (*KuMsg) Descriptor

func (*KuMsg) Descriptor() ([]byte, []int)

func (KuMsg) GetAmount

func (msg KuMsg) GetAmount() Coins

GetAmount get amount coin

func (KuMsg) GetData

func (msg KuMsg) GetData() []byte

func (KuMsg) GetFrom

func (msg KuMsg) GetFrom() AccountID

GetFrom get from account

func (KuMsg) GetSignBytes

func (msg KuMsg) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (KuMsg) GetSigners

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

GetSigners Implements Msg.

func (KuMsg) GetTo

func (msg KuMsg) GetTo() AccountID

GetTo get to account

func (*KuMsg) Marshal

func (m *KuMsg) Marshal() (dAtA []byte, err error)

func (*KuMsg) MarshalTo

func (m *KuMsg) MarshalTo(dAtA []byte) (int, error)

func (*KuMsg) MarshalToSizedBuffer

func (m *KuMsg) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (KuMsg) PrettifyJSON

func (msg KuMsg) PrettifyJSON(cdc *codec.Codec) ([]byte, error)

func (*KuMsg) ProtoMessage

func (*KuMsg) ProtoMessage()

func (*KuMsg) Reset

func (m *KuMsg) Reset()

func (KuMsg) Route

func (msg KuMsg) Route() string

Route Implements Msg.

func (*KuMsg) Size

func (m *KuMsg) Size() (n int)

func (*KuMsg) String

func (m *KuMsg) String() string

func (KuMsg) Type

func (msg KuMsg) Type() string

Type Implements Msg

func (*KuMsg) Unmarshal

func (m *KuMsg) Unmarshal(dAtA []byte) error

func (KuMsg) UnmarshalData

func (msg KuMsg) UnmarshalData(cdc *codec.Codec, obj interface{}) error

UnmarshalData unmarshal data to a obj

func (KuMsg) ValidateBasic

func (msg KuMsg) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

func (*KuMsg) XXX_DiscardUnknown

func (m *KuMsg) XXX_DiscardUnknown()

func (*KuMsg) XXX_Marshal

func (m *KuMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KuMsg) XXX_Merge

func (m *KuMsg) XXX_Merge(src proto.Message)

func (*KuMsg) XXX_Size

func (m *KuMsg) XXX_Size() int

func (*KuMsg) XXX_Unmarshal

func (m *KuMsg) XXX_Unmarshal(b []byte) error

type KuMsgData

type KuMsgData interface {
	Type() Name
}

type KuTransfMsg

type KuTransfMsg interface {
	sdk.Msg

	GetFrom() AccountID
	GetTo() AccountID
	GetAmount() Coins
	Type() string
	GetData() []byte
}

KuTransfMsg ku Msg

type Name

type Name struct {
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty" yaml:"value"`
}

Name defines a account string name imp by 128 length byte.

func MustName

func MustName(str string) Name

MustName create Name by string if name is error then panic

func NewName

func NewName(str string) (Name, error)

NewName create Name by string

func NewNameFromBytes

func NewNameFromBytes(b []byte) Name

NewNameFromBytes create Name from bytes

func (Name) Bytes

func (n Name) Bytes() []byte

Bytes returns the raw address bytes.

func (*Name) Descriptor

func (*Name) Descriptor() ([]byte, []int)

func (Name) Empty

func (n Name) Empty() bool

Empty return is name a empty

func (Name) Eq

func (n Name) Eq(o Name) bool

Eq if name is eq to other

func (Name) Foreach

func (n Name) Foreach(op func(c byte) bool)

ForEach for each char to iter

func (Name) Format

func (n Name) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (Name) Len

func (n Name) Len() int

Len return name string len

func (*Name) Marshal

func (m *Name) Marshal() (dAtA []byte, err error)

func (Name) MarshalJSON

func (n Name) MarshalJSON() ([]byte, error)

MarshalJSON just return a json string

func (*Name) MarshalTo

func (m *Name) MarshalTo(dAtA []byte) (int, error)

func (*Name) MarshalToSizedBuffer

func (m *Name) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Name) MarshalYAML

func (n Name) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (*Name) ProtoMessage

func (*Name) ProtoMessage()

func (*Name) Reset

func (m *Name) Reset()

func (*Name) Size

func (m *Name) Size() (n int)

func (Name) String

func (n Name) String() string

String get name readable string

func (*Name) Unmarshal

func (m *Name) Unmarshal(dAtA []byte) error

func (*Name) UnmarshalJSON

func (n *Name) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal from JSON assuming Bech32 encoding.

func (*Name) UnmarshalYAML

func (n *Name) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from JSON assuming Bech32 encoding.

func (*Name) XXX_DiscardUnknown

func (m *Name) XXX_DiscardUnknown()

func (*Name) XXX_Marshal

func (m *Name) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Name) XXX_Merge

func (m *Name) XXX_Merge(src proto.Message)

func (*Name) XXX_Size

func (m *Name) XXX_Size() int

func (*Name) XXX_Unmarshal

func (m *Name) XXX_Unmarshal(b []byte) error

type Prettifier

type Prettifier interface {
	PrettifyJSON(cdc *codec.Codec) ([]byte, error)
}

Prettifier a type can prettify a byte

type ResponseWithHeight

type ResponseWithHeight struct {
	Height int64           `json:"height"`
	Result json.RawMessage `json:"result"`
}

ResponseWithHeight defines a response object type that wraps an original response with a height.

func NewResponseWithHeight

func NewResponseWithHeight(height int64, result json.RawMessage) ResponseWithHeight

NewResponseWithHeight creates a new ResponseWithHeight instance

type StdFee

type StdFee struct {
	Amount sdk.Coins `json:"amount" yaml:"amount"`
	Gas    uint64    `json:"gas" yaml:"gas"`
	Payer  AccountID `json:"payer" yaml:"payer"`
}

StdFee includes the amount of coins paid in fees and the maximum gas to be used by the transaction. The ratio yields an effective "gasprice", which must be above some miminum to be accepted into the mempool.

func NewStdFee

func NewStdFee(gas uint64, payer AccountID, amount sdk.Coins) StdFee

NewStdFee returns a new instance of StdFee

func (StdFee) Bytes

func (fee StdFee) Bytes() []byte

Bytes for signing later

func (StdFee) GasPrices

func (fee StdFee) GasPrices() sdk.DecCoins

GasPrices returns the gas prices for a StdFee.

NOTE: The gas prices returned are not the true gas prices that were originally part of the submitted transaction because the fee is computed as fee = ceil(gasWanted * gasPrices).

type StdSignDoc

type StdSignDoc struct {
	AccountNumber uint64            `json:"account_number" yaml:"account_number"`
	ChainID       string            `json:"chain_id" yaml:"chain_id"`
	Fee           json.RawMessage   `json:"fee" yaml:"fee"`
	Memo          string            `json:"memo" yaml:"memo"`
	Msg           []json.RawMessage `json:"msg" yaml:"msg"`
	Sequence      uint64            `json:"sequence" yaml:"sequence"`
}

StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account).

type StdSignMsg

type StdSignMsg struct {
	ChainID       string    `json:"chain_id" yaml:"chain_id"`
	AccountNumber uint64    `json:"account_number" yaml:"account_number"`
	Sequence      uint64    `json:"sequence" yaml:"sequence"`
	Fee           StdFee    `json:"fee" yaml:"fee"`
	Msg           []sdk.Msg `json:"msg" yaml:"msg"`
	Memo          string    `json:"memo" yaml:"memo"`
}

StdSignMsg is a convenience structure for passing along a Msg with the other requirements for a StdSignDoc before it is signed. For use in the CLI.

func (StdSignMsg) Bytes

func (msg StdSignMsg) Bytes() []byte

get message bytes

type StdSignature

type StdSignature struct {
	crypto.PubKey `json:"pub_key" yaml:"pub_key"` // optional
	Signature     []byte                          `json:"signature" yaml:"signature"`
}

StdSignature represents a sig

func (StdSignature) MarshalYAML

func (ss StdSignature) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of the signature.

type StdTx

type StdTx struct {
	Msgs       []sdk.Msg      `json:"msg" yaml:"msg"`
	Fee        StdFee         `json:"fee" yaml:"fee"`
	Signatures []StdSignature `json:"signatures" yaml:"signatures"`
	Memo       string         `json:"memo" yaml:"memo"`
}

StdTx is a standard way to wrap a Msg with Fee and Signatures. NOTE: the first signature is the fee payer (Signatures must not be nil).

func NewStdTx

func NewStdTx(msgs []sdk.Msg, fee StdFee, sigs []StdSignature, memo string) StdTx

func (StdTx) FeePayer

func (tx StdTx) FeePayer() AccountID

func (StdTx) GetFee

func (tx StdTx) GetFee() sdk.Coins

GetFee returns the FeeAmount in StdFee

func (StdTx) GetGas

func (tx StdTx) GetGas() uint64

GetGas returns the Gas in StdFee

func (StdTx) GetMemo

func (tx StdTx) GetMemo() string

GetMemo returns the memo

func (StdTx) GetMsgs

func (tx StdTx) GetMsgs() []sdk.Msg

GetMsgs returns the all the transaction's messages.

func (StdTx) GetSignatures

func (tx StdTx) GetSignatures() []StdSignature

GetSignatures returns the signature of signers who signed the Msg. GetSignatures returns the signature of signers who signed the Msg. CONTRACT: Length returned is same as length of pubkeys returned from MsgKeySigners, and the order matches. CONTRACT: If the signature is missing (ie the Msg is invalid), then the corresponding signature is .Empty().

func (StdTx) GetSigners

func (tx StdTx) GetSigners() []sdk.AccAddress

GetSigners returns the addresses that must sign the transaction. Addresses are returned in a deterministic order. They are accumulated from the GetSigners method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses will be omitted.

func (StdTx) PrettifyJSON

func (tx StdTx) PrettifyJSON(cdc *codec.Codec) ([]byte, error)

func (StdTx) ValidateBasic

func (tx StdTx) ValidateBasic() error

ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.

type Tx

type Tx = sdk.Tx

Jump to

Keyboard shortcuts

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