Documentation ¶
Index ¶
- Constants
- func GetAddressData(address string) (*models.Address, error)
- func GetAddressDatas(addresses ...string) chan models.Address
- func GetPreviousBlocks(ctx context.Context, topBlockHash string) (chan BlockResponse, error)
- func GetTransactions(blockHash string) ([]*models.Transaction, error)
- func GetUniqueAddresses(txns ...*models.Transaction) []string
- type BlockResponse
- type LatestBlockResponse
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 ¶
GetAddressData gets the balance and other related information for the provided address
func GetAddressDatas ¶
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 ¶
func GetLatestBlock ¶
func GetLatestBlock() (*LatestBlockResponse, error)
GetLatestBlock gets the top most block from the chain
Click to show internal directories.
Click to hide internal directories.