Documentation ¶
Index ¶
- func AmountToFloat64(amount uint64, decimals uint8) float64
- func AmountToString(amount uint64, decimals uint8) string
- func AmountToUint64(amount float64, decimals uint8) uint64
- func Base58ToBytes(s string) ([]byte, error)
- func Base64ToBytes(s string) ([]byte, error)
- func BytesToBase64(b []byte) string
- func DecodeTransaction(base64Tx string) (types.Transaction, error)
- func EncodeTransaction(tx types.Transaction) (string, error)
- func Float64ToString(amount float64) string
- func GetFileTypeByURI(uri string) string
- func GetVarType(v interface{}) string
- func IntAmountToFloat64(amount int64, decimals uint8) float64
- func MapToStruct(m map[string]interface{}, s interface{}) error
- func Pointer[T any](i T) *T
- func PrettyPrint(s interface{})
- func PrettyString(s interface{}) string
- func StackErrors(errs ...error) error
- func TrimRightZeros(str string) string
- func TrimStringBetween(str, start, end string) string
- func WrapError(errs ...error) error
- type StakedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AmountToFloat64 ¶
AmountToFloat64 converts amount lamports to float64 with given decimals.
func AmountToString ¶
AmountToString converts amount lamports to string with given decimals.
func AmountToUint64 ¶
AmountToUint64 converts amount from float64 to uint64 with given decimals.
func Base58ToBytes ¶
Base58ToBytes converts base58 string to bytes.
func Base64ToBytes ¶
Base64ToBytes converts base64 string to bytes.
func BytesToBase64 ¶
BytesToBase64 converts bytes to base64 string.
func DecodeTransaction ¶
func DecodeTransaction(base64Tx string) (types.Transaction, error)
DecodeTransaction returns a transaction from a base64 encoded transaction.
func EncodeTransaction ¶
func EncodeTransaction(tx types.Transaction) (string, error)
EncodeTransaction returns a base64 encoded transaction.
func Float64ToString ¶
Float64ToString converts float64 to string with minimum number of decimals. For example, 1.000000000 will be converted to "1", 1.100000000 will be converted to "1.1".
func GetFileTypeByURI ¶
GetFileTypeByURI returns the file type of the given URI
func GetVarType ¶
func GetVarType(v interface{}) string
GetVarType returns the type of the given variable as a string.
func IntAmountToFloat64 ¶
IntAmountToFloat64 converts int64 amount lamports to float64 with given decimals.
func MapToStruct ¶
MapToStruct converts a map to a struct.
func Pointer ¶
func Pointer[T any](i T) *T
Pointer converts any type to a pointer. This is useful for passing a value to a function that expects a pointer.
func PrettyPrint ¶
func PrettyPrint(s interface{})
PrettyPrint returns a pretty-printed string representation of a struct or a map.
func PrettyString ¶
func PrettyString(s interface{}) string
PrettyString returns a pretty-printed string representation of a struct or a map.
func StackErrors ¶
StackErrors wraps multiple errors into a single error.
func TrimRightZeros ¶
TrimRightZeros trims trailing zeros from string.
func TrimStringBetween ¶
Trim string between two substrings and return the string without it and substrings.
Types ¶
type StakedError ¶
type StakedError struct {
// contains filtered or unexported fields
}
StakedError is a struct that holds multiple errors and returns them as a single error.
func NewStakedError ¶
func NewStakedError(errs ...error) *StakedError
NewStakedError creates a new StakedError instance.
func (*StakedError) As ¶
func (e *StakedError) As(target interface{}) bool
As returns the first error that matches target.
func (*StakedError) Error ¶
func (e *StakedError) Error() string
Error returns the error message. Implements the error interface.
func (*StakedError) Is ¶
func (e *StakedError) Is(target error) bool
Is returns true if the error is equal to target.
func (*StakedError) Unwrap ¶
func (e *StakedError) Unwrap() error
Unwrap returns the underlying error. Implements the errors.Unwrap interface.