api

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics

func InitMetrics()

InitMetrics initialize metrics

Types

type BlocksMap

type BlocksMap struct {
	sync.Mutex
	Blocks      map[uint64]structs.Block
	NumTxs      uint64
	StartHeight uint64
	EndHeight   uint64
}

BlocksMap map of blocks to control block map with extra summary of number of transactions

type Client

type Client struct {
	Sbc *SimpleBlockCache
	// contains filtered or unexported fields
}

Client is a Tendermint RPC client for cosmos using figmentnetworks datahub

func NewClient

func NewClient(chainID string, logger *zap.Logger, cli *grpc.ClientConn, cfg *ClientConfig) *Client

NewClient returns a new client for a given endpoint

func (*Client) GetBlock added in v0.2.2

func (c *Client) GetBlock(ctx context.Context, params structs.HeightHash) (block structs.Block, er error)

GetBlock fetches most recent block from chain

func (*Client) GetRewardBalances added in v0.5.0

func (c *Client) GetRewardBalances(ctx context.Context, pparams []structs.HeightAccount) (resps map[uint64]structs.GetRewardResponse, err error)

GetReward fetches total rewards for delegator account

func (*Client) GetTx added in v0.5.0

func (c *Client) GetTx(ctx context.Context, qstring []string) (txs []*tx.GetTxsEventResponse, err error)

SearchTx is making search api call

func (*Client) GetValidatorRewardsFromTx added in v0.5.0

func (c *Client) GetValidatorRewardsFromTx(txResp *types.TxResponse, cc map[rstructs.ValidatorAndCurrency]structs.RewardAmount, v map[string]bool) (err error)

func (*Client) SearchTx

func (c *Client) SearchTx(ctx context.Context, r structs.HeightHash, block structs.Block, perPage uint64) (txs []structs.Transaction, err error)

SearchTx is making search api call

type ClientConfig added in v0.2.3

type ClientConfig struct {
	ReqPerSecond        int
	TimeoutBlockCall    time.Duration
	TimeoutSearchTxCall time.Duration
}

type SimpleBlockCache added in v0.2.3

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

SimpleBlockCache simple in memory block cache to store latest blocks

func NewSimpleBlockCache added in v0.2.3

func NewSimpleBlockCache(cap int) *SimpleBlockCache

NewSimpleBlockCache a SimpleBlockCache constructor

func (*SimpleBlockCache) Add added in v0.2.3

func (sbc *SimpleBlockCache) Add(bl structs.Block)

Add blocks to the cache (thread safe)

func (*SimpleBlockCache) Get added in v0.2.3

func (sbc *SimpleBlockCache) Get(height uint64) (bl structs.Block, ok bool)

Get and check block of given height (thread safe)

type TxLogError

type TxLogError struct {
	Codespace string  `json:"codespace"`
	Code      float64 `json:"code"`
	Message   string  `json:"message"`
}

TxLogError Error message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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