blockbook

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDirection

func GetDirection(address, from, to string) types.Direction

func NormalizePage

func NormalizePage(srcPage TransactionsList, address, token string, coinIndex uint) (txs types.Txs)

func NormalizeToken

func NormalizeToken(srcToken *Token, coinIndex uint) types.Token

func NormalizeTokens

func NormalizeTokens(tokens []Token, coinIndex uint) []types.Token

Types

type Blockbook

type Blockbook struct {
	BestHeight int64 `json:"bestHeight"`
	InSync     bool  `json:"inSync"`
}

type Client

type Client struct {
	client.Request
}

func (*Client) GetAddressesFromXpub

func (c *Client) GetAddressesFromXpub(xpub string) (tokens []Token, err error)

func (*Client) GetAllTransactionsByBlockNumber

func (c *Client) GetAllTransactionsByBlockNumber(num int64) ([]Transaction, error)

Transactions

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(num int64, coinIndex uint) (*types.Block, error)

func (*Client) GetCurrentBlockNumber

func (c *Client) GetCurrentBlockNumber() (int64, error)

func (*Client) GetTokenList

func (c *Client) GetTokenList(address string, coinIndex uint) ([]types.Token, error)

func (*Client) GetTokenTxs

func (c *Client) GetTokenTxs(address, token string, coinIndex uint) (types.Txs, error)

func (*Client) GetTokens

func (c *Client) GetTokens(address string) ([]Token, error)

func (*Client) GetTransactions

func (c *Client) GetTransactions(address string, coinIndex uint) (types.Txs, error)

func (*Client) GetTransactionsByBlockNumber

func (c *Client) GetTransactionsByBlockNumber(number int64, page int64) (block TransactionsList, err error)

func (*Client) GetTransactionsByXpub

func (c *Client) GetTransactionsByXpub(xpub string) (transactions TransactionsList, err error)

func (*Client) GetTxs

func (c *Client) GetTxs(address string) (TransactionsList, error)

func (*Client) GetTxsWithContract

func (c *Client) GetTxsWithContract(address, contract string) (TransactionsList, error)

type ClientError

type ClientError struct {
	Err string `json:"error"`
}

func (*ClientError) Error

func (c *ClientError) Error() string

type EthereumSpecific

type EthereumSpecific struct {
	Status   int      `json:"status"` // -1 pending, 0 Fail, 1 OK
	Nonce    uint64   `json:"nonce"`
	GasLimit *big.Int `json:"gasLimit"`
	GasUsed  *big.Int `json:"gasUsed"`
	GasPrice string   `json:"gasPrice"`
	Data     string   `json:"data,omitempty"`
}

EthereumSpecific contains ethereum specific transaction data

func (*EthereumSpecific) GetStatus

func (s *EthereumSpecific) GetStatus() (types.Status, string)

type NodeInfo

type NodeInfo struct {
	Blockbook *Blockbook `json:"blockbook"`
}

type Output

type Output struct {
	TxId         string       `json:"txid,omitempty"`
	Value        string       `json:"value,omitempty"`
	Addresses    []string     `json:"addresses,omitempty"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey,omitempty"`
}

func (Output) OutputAddress

func (o Output) OutputAddress() []string

type ScriptPubKey

type ScriptPubKey struct {
	Addresses []string `json:"addresses,omitempty"`
}

type Token

type Token struct {
	Balance  string          `json:"balance,omitempty"`
	Contract string          `json:"contract"`
	Decimals uint            `json:"decimals"`
	Name     string          `json:"name"`
	Symbol   string          `json:"symbol"`
	Type     types.TokenType `json:"type"`
}

Token contains info about tokens held by an address

type TokenTransfer

type TokenTransfer struct {
	Decimals uint   `json:"decimals"`
	From     string `json:"from"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	To       string `json:"to"`
	Token    string `json:"token"`
	Type     string `json:"type"`
	Value    string `json:"value"`
}

type Transaction

type Transaction struct {
	ID               string            `json:"txid"`
	Version          uint64            `json:"version"`
	Vin              []Output          `json:"vin"`
	Vout             []Output          `json:"vout"`
	BlockHash        string            `json:"blockHash"`
	BlockHeight      int64             `json:"blockHeight"`
	Confirmations    uint64            `json:"confirmations"`
	BlockTime        int64             `json:"blockTime"`
	Value            string            `json:"value"`
	ValueOut         string            `json:"valueOut"`
	Fees             string            `json:"fees"`
	TokenTransfers   []TokenTransfer   `json:"tokenTransfers,omitempty"`
	EthereumSpecific *EthereumSpecific `json:"ethereumSpecific,omitempty"`
}

func (Transaction) Amount

func (transaction Transaction) Amount() string

func (*Transaction) FromAddress

func (transaction *Transaction) FromAddress() string

func (Transaction) GetBlockHeight

func (transaction Transaction) GetBlockHeight() uint64

func (*Transaction) GetFee

func (transaction *Transaction) GetFee() string

func (Transaction) GetStatus

func (transaction Transaction) GetStatus() types.Status

func (*Transaction) ToAddress

func (transaction *Transaction) ToAddress() string

type TransactionsList

type TransactionsList struct {
	Page         int64         `json:"page"`
	TotalPages   int64         `json:"totalPages"`
	ItemsOnPage  int64         `json:"itemsOnPage"`
	Transactions []Transaction `json:"transactions,omitempty"`
	Txs          interface{}   `json:"txs,omitempty"`
	Tokens       []Token       `json:"tokens,omitempty"`
	TxCount      int64         `json:"txCount,omitempty"`
	Hash         string        `json:"hash,omitempty"`
}

func (*TransactionsList) TransactionList

func (tl *TransactionsList) TransactionList() []Transaction

Jump to

Keyboard shortcuts

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