Pure package detail
utils
gno.land/p/gnoswap/utils
Indexed deployment identity with independently loaded latest RPC source. Functions and Render are realm-only RPC capabilities.
Indexed deployment
Identity
- Package path
- gno.land/p/gnoswap/utils
- Block
- 192935
- Deployed (UTC)
- Transaction
- VQ/UB59i+ksQtKyzEoNIdc/C5jxISkPkG8ggZhliOAg=
Latest RPC state
Source
package utils
import (
"strconv"
ufmt "gno.land/p/nt/ufmt/v0"
)
// FormatInt converts any signed integer type to its base-10 string
// representation. It accepts int8, int16, int32, int64 and int, and panics on
// any other type.
func FormatInt(v any) string {
switch v := v.(type) {
case int8:
return strconv.FormatInt(int64(v), 10)
case int16:
return strconv.FormatInt(int64(v), 10)
case int32:
return strconv.FormatInt(int64(v), 10)
case int64:
return strconv.FormatInt(v, 10)
case int:
return strconv.Itoa(v)
default:
panic(ufmt.Sprintf("invalid type for FormatInt: %T", v))
}
}
// FormatUint converts any unsigned integer type to its base-10 string
// representation. It accepts uint8, uint16, uint32, uint64 and uint, and panics
// on any other type.
func FormatUint(v any) string {
switch v := v.(type) {
case uint8:
return strconv.FormatUint(uint64(v), 10)
case uint16:
return strconv.FormatUint(uint64(v), 10)
case uint32:
return strconv.FormatUint(uint64(v), 10)
case uint64:
return strconv.FormatUint(v, 10)
case uint:
return strconv.FormatUint(uint64(v), 10)
default:
panic(ufmt.Sprintf("invalid type for FormatUint: %T", v))
}
}
// FormatBool converts a boolean to "true" or "false".
func FormatBool(v bool) string {
return strconv.FormatBool(v)
}
// Uint64ToString returns the base-10 string representation of a uint64.
func Uint64ToString(v uint64) string {
return strconv.FormatUint(v, 10)
}
// Int64ToString returns the base-10 string representation of an int64.
func Int64ToString(v int64) string {
return strconv.FormatInt(v, 10)
}
// SafeParseInt64 parses a base-10 string into an int64, panicking when the
// input is not a valid int64.
func SafeParseInt64(value string) int64 {
parsed, err := strconv.ParseInt(value, 10, 64)
if err != nil {
panic(err)
}
return parsed
}
The verified vm/qfuncs operation accepts realm paths only.
Pure packages expose source files but do not have Realm Render.