api

package
v0.0.0-...-8556144 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ApiURLPrefix = "https://apielectraexplorer.herokuapp.com/ext"
View Source
const CoinbaseAddress = "coinbase"

CoinbaseAddress is a constant which tells us that the address in the transaction is done using coinbase. We want to avoid adding this to the database

View Source
const ErrMalformedResponseFromUpstreamAPI = "The response from electra API is malformed"
View Source
const MaxReq = 5

Variables

This section is empty.

Functions

func GetAddressData

func GetAddressData(address string) (*models.Address, error)

GetAddressData gets the balance and other related information for the provided address

func GetAddressDatas

func GetAddressDatas(addresses ...string) chan models.Address

GetAddressDatas gets data related to addresses in the form of a channel

func GetPreviousBlocks

func GetPreviousBlocks(ctx context.Context, topBlockHash string) (chan BlockResponse, error)

func GetTransactions

func GetTransactions(blockHash string) ([]*models.Transaction, error)

GetTransactions fetches all the transactions based off of the block hash

func GetUniqueAddresses

func GetUniqueAddresses(txns ...*models.Transaction) []string

GetUniqueAddresses takes a variate number of transactions and returns all unique address present in them as strings

Types

type BlockResponse

type BlockResponse struct {
	Active        string
	Confirmations uint
	Block         *models.Block         `json:"block" bson:"block"`
	Txs           []*models.Transaction `json:"txs" bson:"txs"`
}

func GetBlock

func GetBlock(blockHash string) (*BlockResponse, error)

type LatestBlockResponse

type LatestBlockResponse struct {
	Hash   string
	Height uint
}

func GetLatestBlock

func GetLatestBlock() (*LatestBlockResponse, error)

GetLatestBlock gets the top most block from the chain

Jump to

Keyboard shortcuts

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