Documentation
¶
Index ¶
- func Average(values []*big.Int) *big.Int
- func BlockscanFormat(typ string, value string) string
- func CodeQuote(s string) string
- func FormatBlockscanHyperlink(typ string, displayValue string, value string) string
- func FormatDecimals(n *big.Int, decimals uint8) string
- func FormatEventInfo(eventFields shared.EventFields, topics map[string]interface{}, ...) (string, string)
- func GetTxSender(tx *types.Transaction) *common.Address
- func IsDeploymentTx(tx *types.Transaction) bool
- func RemoveDuplicates[T comparable](sliceList []T) []T
- func ShortenAddress(addr common.Address) string
- func ShortenHash(hsh common.Hash) string
- func Sum(values []*big.Int) *big.Int
- func TrimFirstInstance(s, prefix string) string
- type AddressBalanceRetriever
- type CurrentRatesData
- type Rate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockscanFormat ¶
format into block scanner URL, like etherscan should return unformatted value if blockscanner data for it doesnt exist `typ` - type of entity, such as address, block, tx, token
func FormatDecimals ¶
formats n given its decimal places. truncate to 2 decimal places if formatted number > 0 returns 0 if number == 0
func FormatEventInfo ¶
func GetTxSender ¶
func GetTxSender(tx *types.Transaction) *common.Address
returns who sent the transaction
func IsDeploymentTx ¶
func IsDeploymentTx(tx *types.Transaction) bool
returns whether a tx is a deployment or not useful instead of `determineTxType` as it does not require a query
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](sliceList []T) []T
func ShortenAddress ¶
makes addresses hex shorter e.g. 0xf05285270B723f389803cf6dCf15d253d087782b becomes 0xf0528...7782b
func TrimFirstInstance ¶
Types ¶
type AddressBalanceRetriever ¶
type AddressBalanceRetriever struct {
// contains filtered or unexported fields
}
func NewAddressBalanceRetriever ¶
func NewAddressBalanceRetriever(coinApiKey string, tokens []common.Address) *AddressBalanceRetriever
returns AddressBalanceRetriever can be used to get USD balance of an address, which is native ETH value + ERC20 token value you specify which ERC20 tokens to check balance for uses coinAPI to get token price, not all ERC20 tokens will have price data
func (*AddressBalanceRetriever) GetAddressUSDbalance ¶
func (a *AddressBalanceRetriever) GetAddressUSDbalance(contract common.Address, blockNum *big.Int) float64
calculates balance of contract, in USD, balance = native ETH bal + token bal
func (*AddressBalanceRetriever) GetERC20BalanceOf ¶
func (*AddressBalanceRetriever) UpdateTokenPrices ¶
func (a *AddressBalanceRetriever) UpdateTokenPrices()