Documentation ¶
Index ¶
- Constants
- Variables
- func Cdc() *codec.Codec
- func CoinAccountsFromDenom(denom string) (Name, Name, error)
- func CoinDenom(creator, symbol Name) string
- func CountSubKeys(pub crypto.PubKey) int
- func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder
- func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder
- func IsNameEq(r, l Name) bool
- func LoadGenesisFile(cdc *codec.Codec, genFile string) (genDoc tmtypes.GenesisDoc, err error)
- func LoadGenesisStateFromBytes(cdc *codec.Codec, appState AppGenesisState, key string, val interface{}) error
- func LoadGenesisStateFromFile(cdc *codec.Codec, genFile, key string, val interface{}) error
- func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool)
- func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error)
- func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, page, limit int, err error)
- func ParseQueryHeightOrReturnBadRequest(w http.ResponseWriter, cliCtx context.CLIContext, r *http.Request) (context.CLIContext, bool)
- func ParseQueryParamBool(r *http.Request, param string) bool
- func ParseUint64OrReturnBadRequest(w http.ResponseWriter, s string) (n uint64, ok bool)
- func PostProcessResponse(w http.ResponseWriter, cliCtx context.CLIContext, resp interface{})
- func PostProcessResponseBare(w http.ResponseWriter, cliCtx context.CLIContext, body interface{})
- func ReadRESTReq(w http.ResponseWriter, r *http.Request, cdc *codec.Codec, req interface{}) bool
- func RegisterCodec(cdc *codec.Codec)
- func SaveGenesisStateToFile(cdc *codec.Codec, genFile, key string, val interface{}) error
- func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, msgs []sdk.Msg, ...) []byte
- func VerifyNameString(str string) bool
- func WriteErrorResponse(w http.ResponseWriter, status int, err string)
- func WriteSimulationResponse(w http.ResponseWriter, cdc *codec.Codec, gas uint64)
- type AccAddress
- type AccountAuther
- type AccountID
- func EmptyAccountID() AccountID
- func NewAccountIDFromAccAdd(add sdk.AccAddress) AccountID
- func NewAccountIDFromAdd(add sdk.Address) AccountID
- func NewAccountIDFromByte(bytes []byte) AccountID
- func NewAccountIDFromConsAdd(add sdk.ConsAddress) AccountID
- func NewAccountIDFromName(n Name) (res AccountID)
- func NewAccountIDFromStoreKey(val []byte) AccountID
- func NewAccountIDFromStr(str string) (AccountID, error)
- func NewAccountIDFromValAdd(add sdk.ValAddress) AccountID
- func (a AccountID) Bytes() []byte
- func (*AccountID) Descriptor() ([]byte, []int)
- func (a AccountID) Empty() bool
- func (a AccountID) Eq(o AccountID) bool
- func (a AccountID) Equal(o *AccountID) bool
- func (a AccountID) Equals(o sdk.Address) bool
- func (a AccountID) Format(s fmt.State, verb rune)
- func (m *AccountID) Marshal() (dAtA []byte, err error)
- func (a AccountID) MarshalJSON() ([]byte, error)
- func (m *AccountID) MarshalTo(dAtA []byte) (int, error)
- func (m *AccountID) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (a AccountID) MarshalYAML() (interface{}, error)
- func (a AccountID) MustAccAddress() sdk.AccAddress
- func (a AccountID) MustAddress() sdk.Address
- func (a AccountID) MustName() Name
- func (*AccountID) ProtoMessage()
- func (m *AccountID) Reset()
- func (m *AccountID) Size() (n int)
- func (a AccountID) StoreKey() []byte
- func (a AccountID) String() string
- func (a AccountID) ToAccAddress() (sdk.AccAddress, bool)
- func (a AccountID) ToAddress() (sdk.Address, bool)
- func (a AccountID) ToName() (Name, bool)
- func (m *AccountID) Unmarshal(dAtA []byte) error
- func (a *AccountID) UnmarshalJSON(data []byte) error
- func (m *AccountID) XXX_DiscardUnknown()
- func (m *AccountID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountID) XXX_Merge(src proto.Message)
- func (m *AccountID) XXX_Size() int
- func (m *AccountID) XXX_Unmarshal(b []byte) error
- type AccountIDes
- func (*AccountIDes) Descriptor() ([]byte, []int)
- func (m *AccountIDes) GetAddresses() []AccountID
- func (m *AccountIDes) Marshal() (dAtA []byte, err error)
- func (m *AccountIDes) MarshalTo(dAtA []byte) (int, error)
- func (m *AccountIDes) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*AccountIDes) ProtoMessage()
- func (m *AccountIDes) Reset()
- func (m *AccountIDes) Size() (n int)
- func (m *AccountIDes) String() string
- func (m *AccountIDes) Unmarshal(dAtA []byte) error
- func (m *AccountIDes) XXX_DiscardUnknown()
- func (m *AccountIDes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AccountIDes) XXX_Merge(src proto.Message)
- func (m *AccountIDes) XXX_Size() int
- func (m *AccountIDes) XXX_Unmarshal(b []byte) error
- type AppGenesisState
- type AssetTransfer
- type BaseReq
- type Coin
- type Coins
- type Context
- func (c Context) Authorize(account ...Name)
- func (c Context) CheckAuths() error
- func (c Context) Context() types.Context
- func (c Context) GetTransf() (from, to AccountID, amount Coins)
- func (c Context) RequireAccount(account ...Name)
- func (c Context) RequireAccountAuth(adds ...AccAddress)
- func (c Context) RequireAuth(permissions ...AccountID)
- func (c Context) RequireTransfer(to AccountID, amount Coins) error
- func (c Context) WithAuths(auths []AccAddress) Context
- func (c Context) WithTransfMsg(msg sdk.Msg) Context
- type DecCoin
- type DecCoins
- type ErrorResponse
- type GasEstimateResponse
- type Int
- type KuMsg
- func (*KuMsg) Descriptor() ([]byte, []int)
- func (msg KuMsg) GetAmount() Coins
- func (msg KuMsg) GetData() []byte
- func (msg KuMsg) GetFrom() AccountID
- func (msg KuMsg) GetSignBytes() []byte
- func (msg KuMsg) GetSigners() []sdk.AccAddress
- func (msg KuMsg) GetTo() AccountID
- func (m *KuMsg) Marshal() (dAtA []byte, err error)
- func (m *KuMsg) MarshalTo(dAtA []byte) (int, error)
- func (m *KuMsg) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (msg KuMsg) PrettifyJSON(cdc *codec.Codec) ([]byte, error)
- func (*KuMsg) ProtoMessage()
- func (m *KuMsg) Reset()
- func (msg KuMsg) Route() string
- func (m *KuMsg) Size() (n int)
- func (m *KuMsg) String() string
- func (msg KuMsg) Type() string
- func (m *KuMsg) Unmarshal(dAtA []byte) error
- func (msg KuMsg) UnmarshalData(cdc *codec.Codec, obj interface{}) error
- func (msg KuMsg) ValidateBasic() error
- func (m *KuMsg) XXX_DiscardUnknown()
- func (m *KuMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KuMsg) XXX_Merge(src proto.Message)
- func (m *KuMsg) XXX_Size() int
- func (m *KuMsg) XXX_Unmarshal(b []byte) error
- type KuMsgData
- type KuTransfMsg
- type Name
- func (n Name) Bytes() []byte
- func (*Name) Descriptor() ([]byte, []int)
- func (n Name) Empty() bool
- func (n Name) Eq(o Name) bool
- func (n Name) Foreach(op func(c byte) bool)
- func (n Name) Format(s fmt.State, verb rune)
- func (n Name) Len() int
- func (m *Name) Marshal() (dAtA []byte, err error)
- func (n Name) MarshalJSON() ([]byte, error)
- func (m *Name) MarshalTo(dAtA []byte) (int, error)
- func (m *Name) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (n Name) MarshalYAML() (interface{}, error)
- func (*Name) ProtoMessage()
- func (m *Name) Reset()
- func (m *Name) Size() (n int)
- func (n Name) String() string
- func (m *Name) Unmarshal(dAtA []byte) error
- func (n *Name) UnmarshalJSON(data []byte) error
- func (n *Name) UnmarshalYAML(data []byte) error
- func (m *Name) XXX_DiscardUnknown()
- func (m *Name) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Name) XXX_Merge(src proto.Message)
- func (m *Name) XXX_Size() int
- func (m *Name) XXX_Unmarshal(b []byte) error
- type Prettifier
- type ResponseWithHeight
- type StdFee
- type StdSignDoc
- type StdSignMsg
- type StdSignature
- type StdTx
- func (tx StdTx) FeePayer() AccountID
- func (tx StdTx) GetFee() sdk.Coins
- func (tx StdTx) GetGas() uint64
- func (tx StdTx) GetMemo() string
- func (tx StdTx) GetMsgs() []sdk.Msg
- func (tx StdTx) GetSignatures() []StdSignature
- func (tx StdTx) GetSigners() []sdk.AccAddress
- func (tx StdTx) PrettifyJSON(cdc *codec.Codec) ([]byte, error)
- func (tx StdTx) ValidateBasic() error
- type Tx
Constants ¶
const ( KuMsgMaxAuth = 3 KuMsgMaxDataLen = 1024 )
const ( NameStrLenMax = 17 NameBytesLen = 16 NameBytesTypeCodeLen = 1 NameBytesVersionLen = 1 NameBytesLengthLen = 1 NameBytesHeaderLen = NameBytesTypeCodeLen + NameBytesVersionLen + NameBytesLengthLen NameStrLengthIdx = 2 )
const ( CharValueSeq byte = 0 // @ CharValueNil byte = 63 // 111111 CharValueDot byte = 49 // . CharValueUnderline byte = 50 // _ )
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 )
const (
AccIDStoreKeyLen = sdk.AddrLen + 1
)
const (
KuCodeSpace = "Kuchain"
)
const (
KuMsgMaxLen = (KuMsgMaxAuth+4)*32 + KuMsgMaxDataLen + 64 // TODO: use fix coins imp
)
Variables ¶
var ( NewCoin = sdk.NewCoin NewInt = sdk.NewInt ParseCoin = sdk.ParseCoin ParseCoins = sdk.ParseCoins NewDecCoin = sdk.NewDecCoin NewDecCoins = sdk.NewDecCoins ParseDecCoins = sdk.ParseDecCoins )
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") )
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") )
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") )
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") ErrTxDecode = sdkerrors.Register(KuCodeSpace, errorCode(txErrorCodeRoot, 5), "tx error decoding") )
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var (
AccAddressFromBech32 = sdk.AccAddressFromBech32
)
var ModuleCdc *codec.Codec
module wide codec
Functions ¶
func CoinAccountsFromDenom ¶
CoinAccountsFromDenom get creator and symbol from denom
func CoinDenom ¶
CoinDenom get denom for coin, in kuchain, all denom for a coin is by creator and symbol
func CountSubKeys ¶
CountSubKeys counts the total number of keys for a multi-sig public key.
func DefaultTxDecoder ¶
DefaultTxDecoder logic for standard transaction decoding
func DefaultTxEncoder ¶
DefaultTxEncoder logic for standard transaction encoding
func LoadGenesisFile ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
RegisterCodec registers concrete types on the codec
func SaveGenesisStateToFile ¶
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 ¶
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 NewAccountIDFromAccAdd ¶
func NewAccountIDFromAccAdd(add sdk.AccAddress) AccountID
NewAccountIDFromAccAdd create AccountID from AccAddress
func NewAccountIDFromAdd ¶
NewAccountIDFromAdd create AccountID from AccAddress
func NewAccountIDFromByte ¶
NewAccountIDFromByte create AccountID from byte
func NewAccountIDFromConsAdd ¶
func NewAccountIDFromConsAdd(add sdk.ConsAddress) AccountID
NewAccountIDFromConsAdd create AccountID from AccAddress
func NewAccountIDFromName ¶
NewAccountIDFromName create AccountID from Name
func NewAccountIDFromStoreKey ¶
NewAccountIDFromStoreKey creates a new accountID from store key
func NewAccountIDFromStr ¶
NewAccountIDFromStr new accountID from string
func NewAccountIDFromValAdd ¶
func NewAccountIDFromValAdd(add sdk.ValAddress) AccountID
NewAccountIDFromValAdd create AccountID from AccAddress
func (*AccountID) Descriptor ¶
func (AccountID) Empty ¶
Empty return is AccountID is empty, if AccountID is a name, return is a empty name
func (AccountID) MarshalJSON ¶
MarshalJSON imp Address interface
func (*AccountID) MarshalToSizedBuffer ¶
func (AccountID) MarshalYAML ¶
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 ¶
MustAddress if a is a address return address( a AccAddress ) and true
func (*AccountID) ProtoMessage ¶
func (*AccountID) ProtoMessage()
func (AccountID) ToAccAddress ¶
func (a AccountID) ToAccAddress() (sdk.AccAddress, bool)
ToAccAddress if a is a account address return AccAddress and true
func (*AccountID) UnmarshalJSON ¶
UnmarshalJSON unmarshal from JSON assuming Bech32 encoding.
func (*AccountID) XXX_DiscardUnknown ¶
func (m *AccountID) XXX_DiscardUnknown()
func (*AccountID) XXX_Marshal ¶
func (*AccountID) XXX_Unmarshal ¶
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) 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 ¶
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) 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 Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context for kuchain msg handler
func NewKuMsgCtx ¶
func (Context) Authorize ¶
Authorize make authorize for account to this msg, it call by handlers to allow kumsg can use this auth
func (Context) CheckAuths ¶
func (Context) RequireAccount ¶
RequireAuth require account auth
func (Context) RequireAccountAuth ¶
func (c Context) RequireAccountAuth(adds ...AccAddress)
RequireAccountAuth require address auth
func (Context) RequireAuth ¶
RequireAuth require account auth
func (Context) RequireTransfer ¶
RequireTransfer require transfer coin large then amount for to
func (Context) WithAuths ¶
func (c Context) WithAuths(auths []AccAddress) Context
WithAuths ctx with trx auths
type ErrorResponse ¶
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 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) ProtoMessage ¶
func (*KuMsg) ProtoMessage()
func (KuMsg) UnmarshalData ¶
UnmarshalData unmarshal data to a obj
func (KuMsg) ValidateBasic ¶
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 (*KuMsg) XXX_Unmarshal ¶
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 NewNameFromBytes ¶
NewNameFromBytes create Name from bytes
func (*Name) Descriptor ¶
func (Name) MarshalJSON ¶
MarshalJSON just return a json string
func (Name) MarshalYAML ¶
MarshalYAML marshals to YAML using Bech32.
func (*Name) ProtoMessage ¶
func (*Name) ProtoMessage()
func (*Name) UnmarshalJSON ¶
UnmarshalJSON unmarshal from JSON assuming Bech32 encoding.
func (*Name) UnmarshalYAML ¶
UnmarshalYAML unmarshals from JSON assuming Bech32 encoding.
func (*Name) XXX_DiscardUnknown ¶
func (m *Name) XXX_DiscardUnknown()
func (*Name) XXX_Unmarshal ¶
type Prettifier ¶
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.
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.
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 (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) ValidateBasic ¶
ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.