ankr

package
v0.0.0-...-efbd42f Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnkrSDK

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

func NewAnkrSDK

func NewAnkrSDK(url string, rl ratelimit.Limiter, metrics metrics.Metrics) *AnkrSDK

func (AnkrSDK) GetBlockchainStats

func (s AnkrSDK) GetBlockchainStats(ctx context.Context, blockchain string) (*BlockchainStatsResponse, error)

func (AnkrSDK) GetTransactionsByAddress

func (s AnkrSDK) GetTransactionsByAddress(ctx context.Context, request TransactionsByAddressRequest) (*TransactionsByAddressResponse, error)

type BlockchainStatsResponse

type BlockchainStatsResponse struct {
	ID      int64  `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Result  struct {
		Stats []struct {
			BlockTimeMs            int64  `json:"blockTimeMs"`
			Blockchain             string `json:"blockchain"`
			LatestBlockNumber      int64  `json:"latestBlockNumber"`
			NativeCoinUsdPrice     string `json:"nativeCoinUsdPrice"`
			TotalEventsCount       int64  `json:"totalEventsCount"`
			TotalTransactionsCount int64  `json:"totalTransactionsCount"`
		} `json:"stats"`
	} `json:"result"`
}

type MaultichainOption

type MaultichainOption func(*TransactionsByAddressRequest)

func WithBlochchain

func WithBlochchain(blockchain string) MaultichainOption

func WithBlocks

func WithBlocks(fromBlock int64, toBlock int64) MaultichainOption

func WithContract

func WithContract(address []string) MaultichainOption

func WithPageToken

func WithPageToken(pageToken string) MaultichainOption

type RequestParams

type RequestParams struct {
	Address       []string `json:"address"`
	Blockchain    string   `json:"blockchain"`
	FromBlock     int64    `json:"fromBlock,omitempty"`
	ToBlock       int64    `json:"toBlock,omitempty"`
	FromTimestamp int64    `json:"fromTimestamp,omitempty"`
	ToTimestamp   int64    `json:"toTimestamp,omitempty"`
	IncludeLogs   bool     `json:"includeLogs,omitempty"`
	DescOrder     bool     `json:"descOrder,omitempty"`
	PageSize      int64    `json:"pageSize,omitempty"`
	PageToken     string   `json:"pageToken,omitempty"`
}

type TransactionsByAddressRequest

type TransactionsByAddressRequest struct {
	ID            int64         `json:"id"`
	Jsonrpc       string        `json:"jsonrpc"`
	Method        string        `json:"method"`
	RequestParams RequestParams `json:"params"`
}

func NewTransactionsByAddressRequest

func NewTransactionsByAddressRequest(opts ...MaultichainOption) *TransactionsByAddressRequest

type TransactionsByAddressResponse

type TransactionsByAddressResponse struct {
	ID      int64  `json:"id"`
	Jsonrpc string `json:"jsonrpc"`
	Result  struct {
		NextPageToken string `json:"nextPageToken"`
		Transactions  []struct {
			BlockHash         string `json:"blockHash"`
			BlockNumber       string `json:"blockNumber"`
			Blockchain        string `json:"blockchain"`
			CumulativeGasUsed string `json:"cumulativeGasUsed"`
			From              string `json:"from"`
			Gas               string `json:"gas"`
			GasPrice          string `json:"gasPrice"`
			GasUsed           string `json:"gasUsed"`
			Hash              string `json:"hash"`
			Input             string `json:"input"`
			Logs              []struct {
				Address          string   `json:"address"`
				BlockHash        string   `json:"blockHash"`
				BlockNumber      string   `json:"blockNumber"`
				Blockchain       string   `json:"blockchain"`
				Data             string   `json:"data"`
				LogIndex         string   `json:"logIndex"`
				Removed          bool     `json:"removed"`
				Topics           []string `json:"topics"`
				TransactionHash  string   `json:"transactionHash"`
				TransactionIndex string   `json:"transactionIndex"`
			} `json:"logs"`
			Nonce            string `json:"nonce"`
			R                string `json:"r"`
			S                string `json:"s"`
			Status           string `json:"status"`
			Timestamp        string `json:"timestamp"`
			To               string `json:"to"`
			TransactionIndex string `json:"transactionIndex"`
			Type             string `json:"type"`
			V                string `json:"v"`
			Value            string `json:"value"`
		} `json:"transactions"`
	} `json:"result"`
}

Jump to

Keyboard shortcuts

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