Documentation ¶
Index ¶
- Constants
- func BlackHoleAddress() sdk.AccAddress
- func BytesToInt64(buf []byte) int64
- func GetErrorResponseJSON(code int, msg, detailMsg string) []byte
- func GetPage(page, perPage int) (offset, limit int)
- func HandleErrorMsg(w http.ResponseWriter, cliCtx context.CLIContext, 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 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 SkipSysTestChecker(t *testing.T)
- type BaseResponse
- type ListDataRes
- type ListResponse
- type ParamPage
Constants ¶
const ( NativeToken = sdk.DefaultBondDenom TestToken = "xxb" )
const
const ( // common error ErrorMissingRequiredParam errorCodeV2 = 60001 ErrorInvalidParam errorCodeV2 = 60002 ErrorServerException errorCodeV2 = 60003 ErrorDataNotExist errorCodeV2 = 60004 ErrorCodecFails errorCodeV2 = 60005 ErrorABCIQueryFails errorCodeV2 = 60006 ErrorArgsWithLimit errorCodeV2 = 60007 // account error ErrorInvalidAddress errorCodeV2 = 61001 // order error ErrorOrderNotExist errorCodeV2 = 62001 ErrorInvalidCurrency errorCodeV2 = 62002 ErrorEmptyInstrumentID errorCodeV2 = 62003 ErrorInstrumentIDNotExist errorCodeV2 = 62004 // staking error ErrorInvalidValidatorAddress errorCodeV2 = 63001 ErrorInvalidDelegatorAddress errorCodeV2 = 63002 )
const
Variables ¶
This section is empty.
Functions ¶
func BlackHoleAddress ¶
func BlackHoleAddress() sdk.AccAddress
BlackHoleAddress returns the black hole address
func GetErrorResponseJSON ¶
GetErrorResponseJSON marshals the base response into JSON bytes
func HandleErrorMsg ¶
func HandleErrorMsg(w http.ResponseWriter, cliCtx context.CLIContext, 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 JSONMarshalV2 ¶
JSONMarshalV2 marshals info into JSON based on V2 standard
func JSONUnmarshalV2 ¶
JSONUnmarshalV2 unmarshals JSON bytes based on V2 standard
func SkipSysTestChecker ¶
SkipSysTestChecker is supported to used in System Unit Test (described in http://gitlab.okcoin-inc.com/dex/okexchain/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.
Types ¶
type BaseResponse ¶
type BaseResponse struct { Code int `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 int, msg, detailMsg string) *BaseResponse
GetErrorResponse creates an error base response
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