api

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitMetrics

func InitMetrics()

InitMetrics initialise metrics

func RawToTransaction

func RawToTransaction(logger *zap.Logger, cdc *amino.Codec, in []TxResponse, blocks map[uint64]structs.Block, out chan cStruct.OutResp) error

func RawToTransactionCh

func RawToTransactionCh(logger *zap.Logger, cdc *amino.Codec, wg *sync.WaitGroup, in <-chan TxResponse, blocks map[uint64]structs.Block, out chan cStruct.OutResp)

Types

type Block

type Block struct {
	Header BlockHeader `json:"header"`
}

Block is cosmos block data

type BlockHeader

type BlockHeader struct {
	Height  string `json:"height"`
	ChainID string `json:"chain_id"`
	Time    string `json:"time"`
	NumTxs  string `json:"num_txs"`
}

type BlockHeaderV4

type BlockHeaderV4 struct {
	Height  string `json:"height"`
	ChainID string `json:"chain_id"`
	Time    string `json:"time"`
}

BlockMetaV4 is block header

type BlockID

type BlockID struct {
	Hash string `json:"hash"`
}

BlockID info

type BlockMeta

type BlockMeta struct {
	BlockID BlockID     `json:"block_id"`
	Header  BlockHeader `json:"header"`
}

BlockMeta is block metadata

type BlockMetaV4

type BlockMetaV4 struct {
	BlockID BlockID       `json:"block_id"`
	Header  BlockHeaderV4 `json:"header"`
	NumTxs  string        `json:"num_txs"`
}

BlockMetaV4 is block metadata

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 {
	// contains filtered or unexported fields
}

Client is a Tendermint RPC client for cosmos using figmentnetworks datahub

func NewClient

func NewClient(url, key string, logger *zap.Logger, c *http.Client, reqPerSecLimit int) *Client

NewClient returns a new client for a given endpoint

func (*Client) CDC

func (c *Client) CDC() *amino.Codec

func (*Client) GetAccountBalance added in v0.0.6

func (c *Client) GetAccountBalance(ctx context.Context, params structs.HeightAccount) (resp structs.GetAccountBalanceResponse, err error)

GetAccountBalance fetches account balance

func (Client) GetBlocksMeta

func (c Client) GetBlocksMeta(ctx context.Context, params structs.HeightRange, limit uint64, blocks *BlocksMap, end chan<- error)

GetBlocksMeta fetches block metadata from given range of blocks

func (*Client) GetFromRaw added in v0.0.3

func (c *Client) GetFromRaw(logger *zap.Logger, txReader io.Reader) []map[string]interface{}

GetFromRaw returns raw data for plugin use;

func (*Client) GetReward added in v0.0.5

func (c *Client) GetReward(ctx context.Context, params structs.HeightAccount) (resp structs.GetRewardResponse, err error)

GetReward fetches total rewards for delegator account

func (*Client) SearchTx

func (c *Client) SearchTx(ctx context.Context, r structs.HeightRange, chain_id string, blocks map[uint64]structs.Block, out chan cStruct.OutResp, page, perPage int, fin chan string)

SearchTx is making search api call

func (*Client) SearchTxSingularHeight

func (c *Client) SearchTxSingularHeight(ctx context.Context, height uint64, page, perPage int) (txSearch []TxResponse, err error)

SearchTxSingularHeight is making search api call for

func (*Client) SingularHeightWorker

func (c *Client) SingularHeightWorker(ctx context.Context, wg *sync.WaitGroup, out chan TxResponse, in chan ToGet)

type Error

type Error struct {
	Code      int    `json:"code"`
	CodeSpace string `json:"codespace"`
	Message   string `json:"message"`
	Data      string `json:"data"`
}

type GetBlockchainResponse

type GetBlockchainResponse struct {
	ID     string           `json:"id"`
	RPC    string           `json:"jsonrpc"`
	Result ResultBlockchain `json:"result"`
	Error  Error            `json:"error"`
}

GetBlockchainResponse cosmos response from blockchain

type GetBlockchainResponseV4

type GetBlockchainResponseV4 struct {
	ID     int                `json:"id"`
	RPC    string             `json:"jsonrpc"`
	Result ResultBlockchainV4 `json:"result"`
	Error  Error              `json:"error"`
}

GetBlockchainResponseV4 cosmos response from blockchain

type GetTxSearchResponse

type GetTxSearchResponse struct {
	//	ID     string         `json:"id"`
	RPC    string         `json:"jsonrpc"`
	Result ResultTxSearch `json:"result"`
	Error  Error          `json:"error"`
}

GetTxSearchResponse cosmos response for search

type LogFormat

type LogFormat struct {
	MsgIndex float64      `json:"msg_index,omitempty"`
	Success  bool         `json:"success,omitempty"`
	Log      LogFormatLog `json:"log,omitempty"`
	Events   []TxEvents   `json:"events,omitempty"`
}

func (*LogFormat) UnmarshalJSON

func (lf *LogFormat) UnmarshalJSON(b []byte) error

type LogFormatLog

type LogFormatLog struct {
	Error
}

type ResponseDeliverTx

type ResponseDeliverTx struct {
	Log string `json:"log"`

	GasWanted string     `json:"gasWanted"`
	GasUsed   string     `json:"gasUsed"`
	Events    []TxEvents `json:"tags"`
}

type ResultBlockchain

type ResultBlockchain struct {
	LastHeight string      `json:"last_height"`
	BlockMetas []BlockMeta `json:"block_metas"`
}

ResultBlockchain is result of fetching block

type ResultBlockchainV4

type ResultBlockchainV4 struct {
	LastHeight string        `json:"last_height"`
	BlockMetas []BlockMetaV4 `json:"block_metas"`
}

ResultBlockchainV4 is result of fetching block

type ResultTxSearch

type ResultTxSearch struct {
	Txs        []TxResponse `json:"txs,omitempty"`
	TotalCount string       `json:"total_count,omitempty"`
	Error      Error        `json:"error"`
}

Result of searching for txs

type RewardResponse added in v0.0.5

type RewardResponse struct {
	Height string       `json:"height"`
	Result RewardResult `json:"result"`
}

RewardResponse is terra response for querying /rewards

type RewardResult added in v0.0.5

type RewardResult struct {
	Total sdk.DecCoins `json:"total"`
}

type ToGet

type ToGet struct {
	Height  uint64
	Page    int
	PerPage int
}

type TxEvents

type TxEvents struct {
	Type string `json:"type,omitempty"`
	//Attributes []string `json:"attributes"`
	Attributes *TxEventsAttributes `json:"attributes,omitempty"`
}

type TxEventsAttributes

type TxEventsAttributes struct {
	Module    string
	Action    string
	Amount    []string
	Sender    []string
	Validator map[string][]string
	Withdraw  map[string][]string
	Recipient []string
	Voter     []string
	Feeder    []string

	CompletionTime string
	Commission     []string

	Denom []string

	Others map[string][]string
}

func (*TxEventsAttributes) UnmarshalJSON

func (lea *TxEventsAttributes) UnmarshalJSON(b []byte) error

UnmarshalJSON LogEvents into a different format, to be able to parse it later more easily thats fulfillment of json.Unmarshaler inferface

type TxLogError

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

TxLogError Error message

type TxResponse

type TxResponse struct {
	Hash     string            `json:"hash"`
	Height   string            `json:"height"`
	TxResult ResponseDeliverTx `json:"tx_result"`

	// TxData is base64 encoded transaction data
	TxData string `json:"tx"`
}

TxResponse is result of querying for a tx

type TxTags

type TxTags struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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