Merge Pr #5585: client and types additions for IBC

This commit is contained in:
Federico Kunze
2020-01-30 10:13:42 -05:00
committed by GitHub
parent ea10d1cfc9
commit 5a0a36a8c9
7 changed files with 75 additions and 30 deletions
+2 -2
View File
@@ -580,8 +580,8 @@ func (coins Coins) Sort() Coins {
// Parsing
var (
// Denominations can be 3 ~ 16 characters long.
reDnmString = `[a-z][a-z0-9]{2,15}`
// Denominations can be 3 ~ 32 characters long.
reDnmString = `[a-z][a-z0-9/]{2,31}`
reAmt = `[[:digit:]]+`
reDecAmt = `[[:digit:]]*\.[[:digit:]]+`
reSpc = `[[:space:]]*`
+11
View File
@@ -375,3 +375,14 @@ func ParseHTTPArgsWithLimit(r *http.Request, defaultLimit int) (tags []string, p
func ParseHTTPArgs(r *http.Request) (tags []string, page, limit int, err error) {
return ParseHTTPArgsWithLimit(r, DefaultLimit)
}
// ParseQueryParamBool parses the given param to a boolean. It returns false by
// default if the string is not parseable to bool.
func ParseQueryParamBool(r *http.Request, param string) bool {
valueStr := r.FormValue(param)
value := false
if ok, err := strconv.ParseBool(valueStr); err == nil {
value = ok
}
return value
}
+1
View File
@@ -81,6 +81,7 @@ const (
// nolint - reexport
type (
StoreKey = types.StoreKey
CapabilityKey = types.CapabilityKey
KVStoreKey = types.KVStoreKey
TransientStoreKey = types.TransientStoreKey
)