utils

package
v0.0.0-...-4908023 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecNToFloat

func DecNToFloat(num *big.Int, decN uint8) float64

DecNToFloat converts a decimal N number to the corresponding float number

func IsValidEvmAddr

func IsValidEvmAddr(addr string) bool

Types

type APIBalancesPayload

type APIBalancesPayload struct {
	BlockNumber uint64   `json:"blockNumber"`
	Addresses   []string `json:"addresses"`
}

type APIBalancesResponse

type APIBalancesResponse struct {
	Result []Balance `json:"Result"`
}

type Balance

type Balance struct {
	Address    string  `json:"address"`
	EffBalance float64 `json:"effective_balance"`
}

type Config

type Config struct {
	ConfigFile
	PerpAddr common.Address `json:"perpAddr"`
}

func LoadConfig

func LoadConfig(filePath string) (Config, error)

type ConfigFile

type ConfigFile struct {
	ChainId     int64    `json:"chainId"`
	PoolId      int32    `json:"poolId"`
	Genesis     uint64   `json:"genesisBlock"`
	RpcUrls     []string `json:"rpcUrl"`
	RpcUrlsFltr []string `json:"rpcUrlFilterer"`
}

type FSPageStats

type FSPageStats struct {
	CurrentPageNumber float64 `json:"currentPageNumber"`
	CurrentPageSize   float64 `json:"currentPageSize"`
	TotalRows         float64 `json:"totalRows"`
	TotalPages        float64 `json:"totalPages"`
}

type FSResultSet

type FSResultSet struct {
	ColumnNames      []string               `json:"columnNames"`
	ColumnTypes      []string               `json:"columnTypes"`
	Rows             []interface{}          `json:"rows"`
	Page             FSPageStats            `json:"page"`
	Sql              string                 `json:"sql"`
	Format           string                 `json:"format"`
	OriginalQueryRun map[string]interface{} `json:"originalQueryRun"`
}

type RpcHandler

type RpcHandler struct {
	RpcClients []*ethclient.Client

	Buckets map[*ethclient.Client]*TokenBucket
	// contains filtered or unexported fields
}

func (*RpcHandler) GetNextRpc

func (h *RpcHandler) GetNextRpc() *ethclient.Client

func (*RpcHandler) GetRpc

func (h *RpcHandler) GetRpc() *ethclient.Client

func (*RpcHandler) Init

func (h *RpcHandler) Init(rpcUrls []string, capacity int, refillRate float64) error

func (*RpcHandler) WaitForToken

func (h *RpcHandler) WaitForToken(rpc *ethclient.Client)

type TokenBucket

type TokenBucket struct {
	// contains filtered or unexported fields
}

func NewTokenBucket

func NewTokenBucket(capacity int, refillRate float64) *TokenBucket

func (*TokenBucket) Take

func (tb *TokenBucket) Take() bool

func (*TokenBucket) WaitForToken

func (tb *TokenBucket) WaitForToken(topic string, doLog bool)

Jump to

Keyboard shortcuts

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