utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 16 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 CreateRequest added in v0.4.0

func CreateRequest(ctx context.Context, url string, method string, customHeader http.Header, payload *strings.Reader) (*http.Request, error)

func createGetRequest(url string, customHeader http.Header) (*http.Request, error) {.

func EtherToWei added in v0.4.0

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

func GetERC1155TokenID added in v0.4.0

func GetERC1155TokenID(data []byte) *big.Int

TODO MERGE SOMEHOW WITH duplicated methods.

func GetERC1155TokenIDAndAmount added in v0.4.0

func GetERC1155TokenIDAndAmount(data []byte) (*big.Int, *big.Int)

func GetERC1155TokenValue added in v0.4.0

func GetERC1155TokenValue(data []byte) *big.Int

func GetEtherscanTokenURL added in v0.4.0

func GetEtherscanTokenURL(txHash string) string

etherscan.io.

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 ParseFirstTopic added in v0.4.0

func ParseFirstTopic(topics []common.Hash) topic.Topic

func ParseTopics

func ParseTopics(topics []common.Hash) (topic.Topic, common.Address, common.Address, *big.Int)

func PrepareURL added in v0.4.0

func PrepareURL(url string) string

PrepareURL 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) 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