utils

package
v0.0.0-...-0ab412c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SANITIZER_OK = iota
	SANITIZER_BAD
)

Variables

This section is empty.

Functions

func ConvertAddressArrayPrefixes

func ConvertAddressArrayPrefixes(addrs []string, prefixes []string) []string

basically it's `addrs.flatMap((addr) => ConvertAddressPrefixes(addr, prefixes))`

func ConvertAddressPrefix

func ConvertAddressPrefix(addr, prefix string) (string, error)

func ConvertAddressPrefixes

func ConvertAddressPrefixes(addr string, prefixes []string) []string

func Env

func Env(key, defaultValue string) string

func EnvInt

func EnvInt(key string, defaultValue int) int

func GetEventStrings

func GetEventStrings(events types.StringEvents) []string

func GetEventValue

func GetEventValue(event *types.StringEvent, key string) string

func GetEventsValue

func GetEventsValue(events types.StringEvents, t string, key string) string

func ParseCoinFromEventString

func ParseCoinFromEventString(coinStr string) (uint64, error)

func ParseEvents

func ParseEvents(query []string) (events types.StringEvents, err error)

func ParseKeywords

func ParseKeywords(keyword string) []string

func SanitizeJSON

func SanitizeJSON(bz []byte) []byte

Need to remove \u0000 and Unicode surrogate pairs. \u0000 is not allowed in Postgres. JSON may contain UTF-16 sequences that is more than 16 bits, e.g. "\uD83D\uDE02" = "😂". These pairs are called surrogate pairs. They are converted into single character in Postgres JSONB storage. So Postgres don't accept one single dangling surrogate code point (they are actually invalid). But somehow these invalid code points appear in JSON...

Types

type RawIncome

type RawIncome struct {
	Address   string
	Amount    uint64
	IsRoyalty bool
}

func AggregateRawIncomes

func AggregateRawIncomes(rawIncomes []RawIncome) []RawIncome

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL