common

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package common includes common utilities

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingRelayPubkey = fmt.Errorf("missing relay public key")

	// Aliases maps a string (the main builder identifier) to a function that
	// returns if an input string is an alias of that builder identifier.
	BuilderAliases = map[string]func(string) bool{
		"builder0x69": func(in string) bool {
			return strings.Contains(in, "builder0x69")
		},
		"bob the builder": func(in string) bool {
			match, _ := regexp.MatchString("s[0-9]+e[0-9].*(t|f)", in)
			return match
		},
	}
)
View Source
var RelayURLs = []string{
	"https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net",
	"https://0x8b5d2e73e2a3a55c6c87b8b6eb92e0149a125c852751db1422fa951e42a09b82c142c3ea98d0d9930b056a3bc9896b8f@bloxroute.max-profit.blxrbdn.com",
	"https://0xad0a8bb54565c2211cee576363f3a347089d2f07cf72679d16911d740262694cadb62d7fd7483f27afd714ca0f1b9118@bloxroute.ethical.blxrbdn.com",
	"https://0xb0b07cd0abef743db4260b0ed50619cf6ad4d82064cb4fbec9d3ec530f7c5e6793d9f286c4e082c0244ffb9f2658fe88@bloxroute.regulated.blxrbdn.com",
	"https://0x9000009807ed12c1f08bf4e81c6da3ba8e3fc3d953898ce0102433094e5f22f21102ec057841fcb81978ed1ea0fa8246@builder-relay-mainnet.blocknative.com",
	"https://0xb3ee7afcf27f1f1259ac1787876318c6584ee353097a50ed84f51a1f21a323b3736f271a895c7ce918c038e4265918be@relay.edennetwork.io",
	"https://0x98650451ba02064f7b000f5768cf0cf4d4e492317d82871bdc87ef841a0743f69f0f1eea11168503240ac35d101c9135@mainnet-relay.securerpc.com",
	"https://0xa1559ace749633b997cb3fdacffb890aeebdb0f5a3b6aaa7eeeaf1a38af0a8fe88b9e4b1f61f236d2e64d95733327a62@relay.ultrasound.money",
	"https://0xa7ab7a996c8584251c8f925da3170bdfd6ebc75d50f5ddc4050a6fdc77f2a3b5fce2cc750d0865e05d7228af97d69561@agnostic-relay.net",
	"https://0xa15b52576bcbf1072f4a011c0f99f9fb6c66f3e1ff321f11f461d15e31b1cb359caa092c71bbded0bae5b5ea401aab7e@aestus.live",
}

Functions

func BuilderNameFromExtraData added in v1.3.0

func BuilderNameFromExtraData(extraData string) string

func EthToWei

func EthToWei(eth *big.Int) *big.Float

func GetURI

func GetURI(url *url.URL, path string) string

GetURI returns the full request URI with scheme, host, path and args.

func LogSetup

func LogSetup(json bool, logLevel string, logDebug bool) *logrus.Entry

func PercentDiff

func PercentDiff(x, y *big.Int) *big.Float

func RelayEntriesToStrings

func RelayEntriesToStrings(relays []RelayEntry) []string

RelayEntriesToStrings returns the string representation of a list of relay entries

func RelayEntryToStrings

func RelayEntryToStrings(relays []RelayEntry) []string

func SendHTTPRequest

func SendHTTPRequest(ctx context.Context, client http.Client, method, url string, payload, dst any) (code int, err error)

func StrToBigInt

func StrToBigInt(s string) *big.Int

func StringSliceContains

func StringSliceContains(haystack []string, needle string) bool

func WeiStrToEthStr

func WeiStrToEthStr(wei string, decimals int) string

func WeiToEth

func WeiToEth(wei *big.Int) (ethValue *big.Float)

func WeiToEthStr

func WeiToEthStr(wei *big.Int) string

Types

type RelayEntry

type RelayEntry struct {
	PublicKey types.PublicKey
	URL       *url.URL
}

RelayEntry represents a relay that mev-boost connects to.

func GetRelays

func GetRelays() ([]RelayEntry, error)

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

Jump to

Keyboard shortcuts

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