Documentation ¶
Index ¶
- Constants
- func BlackHoleAddress() sdk.AccAddress
- func BytesToInt64(buf []byte) int64
- func CheckSignerAddress(signers, delegators []sdk.AccAddress) bool
- func ErrCreateAddrFromBech32Failed(addr string, msg string) sdk.EnvelopedErr
- func ErrInsufficientCoins(codespace string, msg string) sdk.EnvelopedErr
- func ErrInvalidPaginateParam(page int, perPage int) sdk.EnvelopedErr
- func ErrInvalidParam(msg string) sdk.EnvelopedErr
- func ErrMarshalJSONFailed(msg string) sdk.EnvelopedErr
- func ErrStrconvFailed(msg string) sdk.EnvelopedErr
- func ErrUnMarshalJSONFailed(msg string) sdk.EnvelopedErr
- func ErrUnknownProposalType(codespace string, msg string) sdk.EnvelopedErr
- func GetErrorResponseJSON(code uint32, msg, detailMsg string) []byte
- func GetFixedLengthRandomString(n int) string
- func GetPage(page, perPage int) (offset, limit int)
- func HandleErrorMsg(w http.ResponseWriter, cliCtx context.CLIContext, code uint32, msg string)
- func HandleErrorResponseV2(w http.ResponseWriter, statusCode int, errCode errorCodeV2)
- func HandleResponseV2(w http.ResponseWriter, data []byte, err error)
- func HandleSuccessResponseV2(w http.ResponseWriter, data []byte)
- func HasSufficientCoins(addr sdk.AccAddress, availableCoins, amt sdk.Coins) (err error)
- func InitConfig()
- func Int64ToBytes(i int64) []byte
- func JSONMarshalV2(v interface{}) ([]byte, error)
- func JSONUnmarshalV2(data []byte, v interface{}) error
- func MulAndQuo(a, b, c sdk.Dec) sdk.Dec
- func Paginate(pageStr, perPageStr string) (page int, perPage int, err error)
- func PanicTrace(kb int)
- func SanityCheckHandler(res *sdk.Result, err error)
- func SkipSysTestChecker(t *testing.T)
- func ValidateBool(param string) subspace.ValueValidatorFn
- func ValidateConsensusType(param string) subspace.ValueValidatorFn
- func ValidateDecNotNeg(param string) subspace.ValueValidatorFn
- func ValidateDecPositive(param string) subspace.ValueValidatorFn
- func ValidateDenom(param string) subspace.ValueValidatorFn
- func ValidateDurationPositive(param string) subspace.ValueValidatorFn
- func ValidateInt64Positive(param string) subspace.ValueValidatorFn
- func ValidateRateNotNeg(param string) subspace.ValueValidatorFn
- func ValidateSysCoin(param string) subspace.ValueValidatorFn
- func ValidateSysCoins(param string) subspace.ValueValidatorFn
- func ValidateUint16Positive(param string) subspace.ValueValidatorFn
- func ValidateUint64Positive(param string) subspace.ValueValidatorFn
- type BaseResponse
- type ConsensusType
- type ListDataRes
- type ListResponse
- type ParamPage
- type SDKError
Constants ¶
const ( NativeToken = sdk.DefaultBondDenom TestToken = "xxb" )
const
const ( DefaultCodespace = "common" CodeInternalError uint32 = 60100 CodeInvalidPaginateParam uint32 = 60101 CodeCreateAddrFromBech32Failed uint32 = 60102 CodeMarshalJSONFailed uint32 = 60103 CodeUnMarshalJSONFailed uint32 = 60104 //"incorrectly formatted request data", err.Error() CodeStrconvFailed uint32 = 60105 CodeUnknownProposalType uint32 = 60106 CodeInsufficientCoins uint32 = 60107 CodeMissingRequiredParam uint32 = 60108 CodeInvalidParam uint32 = 60109 CodeServerException uint32 = 60110 CodeDataNotExist uint32 = 60111 CodeCodecFails uint32 = 60112 CodeABCIQueryFails uint32 = 60113 CodeArgsWithLimit uint32 = 60114 )
const uint32
const ( // common error ErrorMissingRequiredParam errorCodeV2 = 60108 ErrorInvalidParam errorCodeV2 = 60109 ErrorServerException errorCodeV2 = 60110 ErrorDataNotExist errorCodeV2 = 60111 ErrorCodecFails errorCodeV2 = 60112 ErrorABCIQueryFails errorCodeV2 = 60113 ErrorArgsWithLimit errorCodeV2 = 60114 // account error ErrorInvalidAddress errorCodeV2 = 60007 // order error ErrorOrderNotExist errorCodeV2 = 60300 ErrorInvalidCurrency errorCodeV2 = 60301 ErrorEmptyInstrumentID errorCodeV2 = 60302 ErrorInstrumentIDNotExist errorCodeV2 = 60303 // staking error ErrorInvalidValidatorAddress errorCodeV2 = 60700 ErrorInvalidDelegatorAddress errorCodeV2 = 60701 )
const
Variables ¶
This section is empty.
Functions ¶
func BlackHoleAddress ¶
func BlackHoleAddress() sdk.AccAddress
BlackHoleAddress returns the black hole address
func CheckSignerAddress ¶
func CheckSignerAddress(signers, delegators []sdk.AccAddress) bool
CheckSignerAddress delegators must be the same as to the signers and amount only one
func ErrCreateAddrFromBech32Failed ¶
func ErrCreateAddrFromBech32Failed(addr string, msg string) sdk.EnvelopedErr
invalid address
func ErrInsufficientCoins ¶
func ErrInsufficientCoins(codespace string, msg string) sdk.EnvelopedErr
func ErrInvalidPaginateParam ¶
func ErrInvalidPaginateParam(page int, perPage int) sdk.EnvelopedErr
invalid paginate param
func ErrInvalidParam ¶
func ErrInvalidParam(msg string) sdk.EnvelopedErr
func ErrMarshalJSONFailed ¶
func ErrMarshalJSONFailed(msg string) sdk.EnvelopedErr
could not marshal result to JSON
func ErrStrconvFailed ¶
func ErrStrconvFailed(msg string) sdk.EnvelopedErr
func ErrUnMarshalJSONFailed ¶
func ErrUnMarshalJSONFailed(msg string) sdk.EnvelopedErr
could not unmarshal result to origin
func ErrUnknownProposalType ¶
func ErrUnknownProposalType(codespace string, msg string) sdk.EnvelopedErr
func GetErrorResponseJSON ¶
GetErrorResponseJSON marshals the base response into JSON bytes
func HandleErrorMsg ¶
func HandleErrorMsg(w http.ResponseWriter, cliCtx context.CLIContext, code uint32, msg string)
HandleErrorMsg handles the error msg
func HandleErrorResponseV2 ¶
func HandleErrorResponseV2(w http.ResponseWriter, statusCode int, errCode errorCodeV2)
HandleErrorResponseV2 is the handler of error response with V2 standard
func HandleResponseV2 ¶
func HandleResponseV2(w http.ResponseWriter, data []byte, err error)
HandleResponseV2 handles the response of V2 standard
func HandleSuccessResponseV2 ¶
func HandleSuccessResponseV2(w http.ResponseWriter, data []byte)
HandleSuccessResponseV2 is the handler of successful response with V2 standard
func HasSufficientCoins ¶
func HasSufficientCoins(addr sdk.AccAddress, availableCoins, amt sdk.Coins) (err error)
HasSufficientCoins checks whether the account has sufficient coins
func InitConfig ¶
func InitConfig()
func JSONMarshalV2 ¶
JSONMarshalV2 marshals info into JSON based on V2 standard
func JSONUnmarshalV2 ¶
JSONUnmarshalV2 unmarshals JSON bytes based on V2 standard
func PanicTrace ¶
func PanicTrace(kb int)
func SanityCheckHandler ¶
func SkipSysTestChecker ¶
SkipSysTestChecker is supported to used in System Unit Test (described in http://gitlab.okcoin-inc.com/dex/brczero/issues/472) if System environment variables "SYS_TEST_ALL" is set to 1, all of the system test will be enable. \n if System environment variables "ORM_MYSQL_SYS_TEST" is set to 1,
all of the system test in orm_mysql_sys_test.go will be enble.
func ValidateBool ¶
func ValidateBool(param string) subspace.ValueValidatorFn
func ValidateConsensusType ¶
func ValidateConsensusType(param string) subspace.ValueValidatorFn
func ValidateDecNotNeg ¶
func ValidateDecNotNeg(param string) subspace.ValueValidatorFn
func ValidateDecPositive ¶
func ValidateDecPositive(param string) subspace.ValueValidatorFn
func ValidateDenom ¶
func ValidateDenom(param string) subspace.ValueValidatorFn
func ValidateDurationPositive ¶
func ValidateDurationPositive(param string) subspace.ValueValidatorFn
func ValidateInt64Positive ¶
func ValidateInt64Positive(param string) subspace.ValueValidatorFn
func ValidateRateNotNeg ¶
func ValidateRateNotNeg(param string) subspace.ValueValidatorFn
func ValidateSysCoin ¶
func ValidateSysCoin(param string) subspace.ValueValidatorFn
func ValidateSysCoins ¶
func ValidateSysCoins(param string) subspace.ValueValidatorFn
func ValidateUint16Positive ¶
func ValidateUint16Positive(param string) subspace.ValueValidatorFn
func ValidateUint64Positive ¶
func ValidateUint64Positive(param string) subspace.ValueValidatorFn
Types ¶
type BaseResponse ¶
type BaseResponse struct { Code uint32 `json:"code"` Msg string `json:"msg"` DetailMsg string `json:"detail_msg"` Data interface{} `json:"data"` }
BaseResponse is the main frame of response
func GetBaseResponse ¶
func GetBaseResponse(data interface{}) *BaseResponse
GetBaseResponse gets a default base response
func GetErrorResponse ¶
func GetErrorResponse(code uint32, msg, detailMsg string) *BaseResponse
GetErrorResponse creates an error base response
type ConsensusType ¶
type ConsensusType string
const ( PoA ConsensusType = "poa" DPoS ConsensusType = "dpos" )
type ListDataRes ¶
type ListDataRes struct { Data interface{} `json:"data"` ParamPage ParamPage `json:"param_page"` }
ListDataRes is the struct of list data result
type ListResponse ¶
type ListResponse struct { Code int `json:"code"` Msg string `json:"msg"` DetailMsg string `json:"detail_msg"` Data ListDataRes `json:"data"` }
ListResponse is the frame of list response
func GetEmptyListResponse ¶
func GetEmptyListResponse(total, page, perPage int) *ListResponse
GetEmptyListResponse returns an empty list response
func GetListResponse ¶
func GetListResponse(total, page, perPage int, data interface{}) *ListResponse
GetListResponse returns a list response