blockbook

package
Version: v0.0.0-...-c20a5fa Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Page               int      `json:"page"`
	TotalPages         int      `json:"totalPages"`
	ItemsOnPage        int      `json:"itemsOnPage"`
	Address            string   `json:"address"`
	Balance            string   `json:"balance"`
	TotalReceived      string   `json:"totalReceived"`
	TotalSent          string   `json:"totalSent"`
	UnconfirmedBalance string   `json:"unconfirmedBalance"`
	UnconfirmedTxs     int      `json:"unconfirmedTxs"`
	Txs                int      `json:"txs"`
	Txids              []string `json:"txids"`
}

type BlockBook

type BlockBook struct {
	Url string
	// contains filtered or unexported fields
}

Blockbook is a struct wrapper with the blockbook url and a client with a specific timeout.

func NewBlockBookWrapper

func NewBlockBookWrapper(url string) *BlockBook

NewBlockBookWrapper creates a new wrapper for the blockbook API

func (*BlockBook) GetAddress

func (b *BlockBook) GetAddress(address string) (*Address, error)

GetAddress return the information of a specified address

func (*BlockBook) GetFee

func (b *BlockBook) GetFee(nBlocks string) (*Fee, error)

GetFee returns the fee rates

func (*BlockBook) GetTx

func (b *BlockBook) GetTx(txid string) (*Tx, error)

GetTx returns the transaction data

func (*BlockBook) GetUtxo

func (b *BlockBook) GetUtxo(xpub string, confirmed bool) ([]Utxo, error)

GetUtxo returns the utxos for a extended public key

func (*BlockBook) GetXpub

func (b *BlockBook) GetXpub(xpub string) (*Xpub, error)

GetXpub returns the information from a extended public key

func (*BlockBook) SendTx

func (b *BlockBook) SendTx(rawTx string) (string, error)

SendTx broadcasts a transaction using the blockbook API.

type Fee

type Fee struct {
	Result string `json:"result"`
}

type SendTx

type SendTx struct {
	Error  string `json:"error"`
	Result string `json:"result"`
}

type Status

type Status struct {
	Backend struct {
		BestBlockHash   string `json:"bestBlockHash"`
		Blocks          int    `json:"blocks"`
		Chain           string `json:"chain"`
		Difficulty      string `json:"difficulty"`
		Headers         int    `json:"headers"`
		ProtocolVersion string `json:"protocolVersion"`
		SizeOnDisk      int    `json:"sizeOnDisk"`
		Subversion      string `json:"subversion"`
		Version         string `json:"version"`
	} `json:"backend"`
	Blockbook struct {
		About           string `json:"about"`
		BestHeight      int    `json:"bestHeight"`
		BuildTime       string `json:"buildTime"`
		Coin            string `json:"coin"`
		DbSize          int    `json:"dbSize"`
		Decimals        int    `json:"decimals"`
		GitCommit       string `json:"gitCommit"`
		Host            string `json:"host"`
		InSync          bool   `json:"inSync"`
		InSyncMempool   bool   `json:"inSyncMempool"`
		InitialSync     bool   `json:"initialSync"`
		LastBlockTime   string `json:"lastBlockTime"`
		LastMempoolTime string `json:"lastMempoolTime"`
		MempoolSize     int    `json:"mempoolSize"`
		SyncMode        bool   `json:"syncMode"`
		Version         string `json:"version"`
	} `json:"blockbook"`
}

type TokenTransfer

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

type Tokens

type Tokens struct {
	Balance       string `json:"balance"`
	Decimals      int    `json:"decimals"`
	Name          string `json:"name"`
	Path          string `json:"path"`
	TotalReceived string `json:"totalReceived"`
	TotalSent     string `json:"totalSent"`
	Transfers     int    `json:"transfers"`
	Type          string `json:"type"`
}

type Tx

type Tx struct {
	BlockHash      string          `json:"blockHash"`
	BlockHeight    int             `json:"blockHeight"`
	BlockTime      int             `json:"blockTime"`
	Confirmations  int             `json:"confirmations"`
	Fees           string          `json:"fees"`
	Hex            string          `json:"hex"`
	LockTime       int             `json:"lockTime"`
	Txid           string          `json:"txid"`
	Value          string          `json:"value"`
	ValueIn        string          `json:"valueIn"`
	Version        int             `json:"version"`
	Vin            []TxVin         `json:"vin"`
	Vout           []TxVout        `json:"vout"`
	TokenTransfers []TokenTransfer `json:"tokenTransfers"`
}

type TxVin

type TxVin struct {
	Addresses []string `json:"addresses"`
	Hex       string   `json:"hex"`
	N         int      `json:"n"`
	Sequence  int      `json:"sequence"`
	Txid      string   `json:"txid"`
	Value     string   `json:"value"`
	Vout      int      `json:"vout"`
}

type TxVout

type TxVout struct {
	Addresses []string `json:"addresses"`
	Hex       string   `json:"hex"`
	N         int      `json:"n"`
	Spent     bool     `json:"spent"`
	Value     string   `json:"value"`
}

type Utxo

type Utxo struct {
	Address       string `json:"address"`
	Confirmations int    `json:"confirmations"`
	Height        int    `json:"height"`
	Path          string `json:"path"`
	Txid          string `json:"txid"`
	Value         string `json:"value"`
	Vout          int    `json:"vout"`
}

type Xpub

type Xpub struct {
	Address            string   `json:"address"`
	Balance            string   `json:"balance"`
	ItemsOnPage        int      `json:"itemsOnPage"`
	Page               int      `json:"page"`
	Tokens             []Tokens `json:"tokens"`
	TotalPages         int      `json:"totalPages"`
	TotalReceived      string   `json:"totalReceived"`
	TotalSent          string   `json:"totalSent"`
	Transactions       []Tx     `json:"transactions"`
	Txs                int      `json:"txs"`
	UnconfirmedBalance string   `json:"unconfirmedBalance"`
	UnconfirmedTxs     int      `json:"unconfirmedTxs"`
	UsedTokens         int      `json:"usedTokens"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL