Documentation ¶
Overview ¶
Package common includes common utilities
Index ¶
- Variables
- func BeginningOfDay(t time.Time) time.Time
- func Check(err error)
- func EthToWei(eth *big.Int) *big.Float
- func GetMemMB() uint64
- func GetURI(url *url.URL, path string) string
- func GetURIWithQuery(url *url.URL, path string, queryArgs map[string]string) string
- func HumanBytes(n uint64) string
- func LogSetup(json bool, logLevel string, logDebug bool) *logrus.Entry
- func MustConnectBeaconNode(log *logrus.Entry, beaconNodeURI string, allowSyncing bool) (bn *beaconclient.ProdBeaconInstance, headSlot uint64)
- func MustGetLatestSlot() uint64
- func MustParseDateTimeStr(s string) time.Time
- func PercentDiff(x, y *big.Int) *big.Float
- func RelayEntriesToHostnameStrings(relays []RelayEntry) []string
- func RelayEntriesToStrings(relays []RelayEntry) []string
- func ReverseBytes(src []byte) []byte
- func SendHTTPRequest(ctx context.Context, client http.Client, method, url string, payload, dst any) (code int, err error)
- func SlotToTime(slot uint64) time.Time
- func StrToBigInt(s string) *big.Int
- func StringSliceContains(haystack []string, needle string) bool
- func TimeToSlot(t time.Time) uint64
- func WeiStrToEthStr(wei string, decimals int) string
- func WeiToEth(wei *big.Int) (ethValue *big.Float)
- func WeiToEthStr(wei *big.Int) string
- type Address
- type EthNode
- type Hash
- type PublicKey
- type RelayEntry
- type U256
- type U64
- type UltrasoundStreamBid
- func (u *UltrasoundStreamBid) GetTree() (*ssz.Node, error)
- func (u *UltrasoundStreamBid) HashTreeRoot() ([32]byte, error)
- func (u *UltrasoundStreamBid) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (u *UltrasoundStreamBid) MarshalSSZ() ([]byte, error)
- func (u *UltrasoundStreamBid) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (u *UltrasoundStreamBid) SizeSSZ() (size int)
- func (u *UltrasoundStreamBid) UnmarshalSSZ(buf []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingRelayPubkey = fmt.Errorf("missing relay public key") ErrURLEmpty = errors.New("url is empty") )
var Logger = LogSetup(vars.LogJSON, vars.DefaultLogLevel, vars.LogDebug)
Functions ¶
func GetURIWithQuery ¶ added in v1.8.2
func HumanBytes ¶ added in v1.8.2
HumanBytes returns size in the same format as AWS S3
func MustConnectBeaconNode ¶ added in v1.8.2
func MustConnectBeaconNode(log *logrus.Entry, beaconNodeURI string, allowSyncing bool) (bn *beaconclient.ProdBeaconInstance, headSlot uint64)
func MustGetLatestSlot ¶ added in v1.9.0
func MustGetLatestSlot() uint64
func MustParseDateTimeStr ¶ added in v1.8.2
func RelayEntriesToHostnameStrings ¶ added in v1.8.2
func RelayEntriesToHostnameStrings(relays []RelayEntry) []string
RelayEntriesToHostnameStrings returns the hostnames of a list of relay entries
func RelayEntriesToStrings ¶
func RelayEntriesToStrings(relays []RelayEntry) []string
RelayEntriesToStrings returns the string representation of a list of relay entries
func ReverseBytes ¶ added in v1.8.2
func SendHTTPRequest ¶
func SlotToTime ¶ added in v1.8.2
func StrToBigInt ¶
func StringSliceContains ¶
func TimeToSlot ¶ added in v1.8.2
func WeiStrToEthStr ¶
func WeiToEthStr ¶
Types ¶
type EthNode ¶ added in v1.8.2
func NewEthNode ¶ added in v1.8.2
func (*EthNode) BlockByHash ¶ added in v1.8.2
func (*EthNode) BlockByNumber ¶ added in v1.8.2
type RelayEntry ¶
RelayEntry represents a relay that mev-boost connects to.
func GetRelays ¶
func GetRelays() ([]RelayEntry, error)
func MustGetRelays ¶ added in v1.8.2
func MustGetRelays() []RelayEntry
func MustNewRelayEntry ¶ added in v1.8.2
func MustNewRelayEntry(relayURL string, requireUser bool) (entry RelayEntry)
func NewRelayEntry ¶
func NewRelayEntry(relayURL string, requireUser bool) (entry RelayEntry, err error)
NewRelayEntry creates a new instance based on an input string relayURL can be IP@PORT, PUBKEY@IP:PORT, https://IP, etc.
func (*RelayEntry) GetURI ¶
func (r *RelayEntry) GetURI(path string) string
GetURI returns the full request URI with scheme, host, path and args for the relay.
func (*RelayEntry) Hostname ¶
func (r *RelayEntry) Hostname() string
func (*RelayEntry) String ¶
func (r *RelayEntry) String() string
type UltrasoundStreamBid ¶ added in v1.8.2
type UltrasoundStreamBid struct { Timestamp uint64 `json:"timestamp"` Slot uint64 `json:"slot"` BlockNumber uint64 `json:"block_number"` BlockHash Hash `json:"block_hash" ssz-size:"32"` ParentHash Hash `json:"parent_hash" ssz-size:"32"` BuilderPubkey PublicKey `json:"builder_pubkey" ssz-size:"48"` FeeRecipient Address `json:"fee_recipient" ssz-size:"20"` Value U256 `json:"value" ssz-size:"32"` }
func (*UltrasoundStreamBid) GetTree ¶ added in v1.8.2
func (u *UltrasoundStreamBid) GetTree() (*ssz.Node, error)
GetTree ssz hashes the UltrasoundStreamBid object
func (*UltrasoundStreamBid) HashTreeRoot ¶ added in v1.8.2
func (u *UltrasoundStreamBid) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the UltrasoundStreamBid object
func (*UltrasoundStreamBid) HashTreeRootWith ¶ added in v1.8.2
func (u *UltrasoundStreamBid) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the UltrasoundStreamBid object with a hasher
func (*UltrasoundStreamBid) MarshalSSZ ¶ added in v1.8.2
func (u *UltrasoundStreamBid) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the UltrasoundStreamBid object
func (*UltrasoundStreamBid) MarshalSSZTo ¶ added in v1.8.2
func (u *UltrasoundStreamBid) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the UltrasoundStreamBid object to a target array
func (*UltrasoundStreamBid) SizeSSZ ¶ added in v1.8.2
func (u *UltrasoundStreamBid) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the UltrasoundStreamBid object
func (*UltrasoundStreamBid) UnmarshalSSZ ¶ added in v1.8.2
func (u *UltrasoundStreamBid) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the UltrasoundStreamBid object