utils

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HTTP = &HTTPClient{}

Functions

func CreateHTTPClient added in v0.4.0

func CreateHTTPClient(requestTimeout time.Duration, tlsVersion uint16) (*http.Client, error)

func EtherToWei added in v0.4.0

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

EtherToWei converts an ether value to wei. (https://github.com/ethereum/go-ethereum/issues/21221#issuecomment-802092592)

func EtherToWeiFloat added in v0.10.0

func EtherToWeiFloat(ether *big.Float) *big.Float

func GetEtherscanAddressURL added in v0.11.0

func GetEtherscanAddressURL(address *common.Address) string

func GetEtherscanTokenURL added in v0.4.0

func GetEtherscanTokenURL(address *common.Address) string

func GetEtherscanTokenURLForAddress added in v0.11.1

func GetEtherscanTokenURLForAddress(address common.Address) string

func GetEtherscanTxURL added in v0.4.0

func GetEtherscanTxURL(txHash string) string

etherscan.io.

func GetLinks(txHash common.Hash, contractAddress common.Address, tokenID int64) (string, string, string)

GetLinks returns the links to etherscan, opensea and blur.

func GetMetricValue added in v0.11.0

func GetMetricValue(col prometheus.Collector) float64

GetMetricValue returns the value of a prometheus.Collector (https://stackoverflow.com/a/58875389/13180763)

func GetOpenseaCollectionLink(slug string) string
func GetOpenseaItemLink(contractAddress string, tokenID int64) string

opensea.io.

func PrepareURL added in v0.4.0

func PrepareURL(url string) string

PrepareURL removes not allowed characters and replaces the ipfs:// scheme or "https://ipfs.io" with the configured ipfs gateway.

func WalletShortAddress

func WalletShortAddress(address common.Address) string

func WeiToEther added in v0.4.0

func WeiToEther(wei *big.Int) *big.Float

func WeiToGwei added in v0.4.0

func WeiToGwei(wei *big.Int) *big.Float

Types

type HTTPClient

type HTTPClient struct{}

func (*HTTPClient) Get

func (h *HTTPClient) Get(ctx context.Context, url string) (*http.Response, error)

func (*HTTPClient) GetWithHeader

func (h *HTTPClient) GetWithHeader(ctx context.Context, url string, customHeader http.Header) (*http.Response, error)

func (*HTTPClient) GetWithTLS12

func (h *HTTPClient) GetWithTLS12(ctx context.Context, url string) (*http.Response, error)

func (*HTTPClient) GetWithTLS12AndHeader added in v0.11.0

func (h *HTTPClient) GetWithTLS12AndHeader(ctx context.Context, url string, customHeader http.Header) (*http.Response, error)

func (*HTTPClient) Head added in v0.4.0

func (h *HTTPClient) Head(ctx context.Context, url string) (*http.Response, error)

func (*HTTPClient) Post added in v0.4.0

func (h *HTTPClient) Post(ctx context.Context, url string, payload *strings.Reader) (*http.Response, error)

func (*HTTPClient) PostWithHeader added in v0.4.0

func (h *HTTPClient) PostWithHeader(ctx context.Context, url string, customHeader http.Header, payload *strings.Reader) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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