util

package
v0.0.0-...-865e8ec Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(msg string)

Alert sends alert to

func DecodeNullString

func DecodeNullString(str sql.NullString) ([]byte, error)

DecodeNullString decodes a sql.NullString to bytes

func EncodeToNullString

func EncodeToNullString(bytes []byte) sql.NullString

EncodeToNullString encodes a byte array into a sql.NullString

func LogErr

func LogErr(err error)

LogErr logs error

func ParseEthAddress

func ParseEthAddress(addr string) (common.Address, error)

func SendLarkAlert

func SendLarkAlert(msg string)

func SendSlackAlert

func SendSlackAlert(msg string)

func SetLarkURL

func SetLarkURL(url string)

SetLarkURL sets the lark post url

func SetPrefix

func SetPrefix(s string)

func SetSlackURL

func SetSlackURL(url string)

SetSlackURL sets the slack post url

func UnpackLog

func UnpackLog(a abi.ABI, out interface{}, event string, log types.Log) error

UnpackLog unpacks a log given abi, event, and output type

Types

type Address

type Address interface {
	Bytes() []byte
	String() string
	Address() interface{}
}

func ETHAddressToAddress

func ETHAddressToAddress(addr common.Address) Address

func ParseAddressBytes

func ParseAddressBytes(b []byte) (Address, error)

func SOLAddressToAddress

func SOLAddressToAddress(addr solcommon.PublicKey) Address

type AddressDecoder

type AddressDecoder interface {
	DecodeBytes([]byte) (Address, error)
	DecodeString(string) (Address, error)
}

TODO: remove error return, panic inside if failed

func NewAddressDecoder

func NewAddressDecoder(chain string) AddressDecoder

func NewETHAddressDecoder

func NewETHAddressDecoder() AddressDecoder

func NewSOLAddressDecoder

func NewSOLAddressDecoder() AddressDecoder

type ETHAddressDecoder

type ETHAddressDecoder struct{}

func (*ETHAddressDecoder) DecodeBytes

func (d *ETHAddressDecoder) DecodeBytes(b []byte) (Address, error)

func (*ETHAddressDecoder) DecodeString

func (d *ETHAddressDecoder) DecodeString(addr string) (Address, error)

type Payload

type Payload struct {
	Text string `json:"text,omitempty"`
}

Payload is the message struct for slack

type SOLAddressDecoder

type SOLAddressDecoder struct{}

func (*SOLAddressDecoder) DecodeBytes

func (s *SOLAddressDecoder) DecodeBytes(b []byte) (Address, error)

func (*SOLAddressDecoder) DecodeString

func (s *SOLAddressDecoder) DecodeString(str string) (Address, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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