api

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Text struct {
	BlockbookAbout, TOSLink string
}

Text contains static overridable texts used in explorer

Functions

func NewAPIError added in v0.1.1

func NewAPIError(s string, public bool) error

NewAPIError creates ApiError

func UniqueTxidsInReverse

func UniqueTxidsInReverse(txids []string) []string

UniqueTxidsInReverse reverts the order of transactions (so that newest are first) and removes duplicate transactions

Types

type APIError added in v0.1.1

type APIError struct {
	Text   string
	Public bool
}

APIError extends error by information if the error details should be returned to the end user

func (*APIError) Error added in v0.1.1

func (e *APIError) Error() string

type Address

type Address struct {
	Paging
	AddrStr                 string   `json:"addrStr"`
	Balance                 string   `json:"balance"`
	TotalReceived           string   `json:"totalReceived"`
	TotalSent               string   `json:"totalSent"`
	UnconfirmedBalance      string   `json:"unconfirmedBalance"`
	UnconfirmedTxApperances int      `json:"unconfirmedTxApperances"`
	TxApperances            int      `json:"txApperances"`
	Transactions            []*Tx    `json:"txs,omitempty"`
	Txids                   []string `json:"transactions,omitempty"`
}

Address holds information about address and its transactions

type AddressUtxo added in v0.1.1

type AddressUtxo struct {
	Txid          string  `json:"txid"`
	Vout          uint32  `json:"vout"`
	Amount        string  `json:"amount"`
	AmountSat     big.Int `json:"satoshis"`
	Height        int     `json:"height,omitempty"`
	Confirmations int     `json:"confirmations"`
}

AddressUtxo holds information about address and its transactions

type Block added in v0.1.0

type Block struct {
	Paging
	bchain.BlockInfo
	TxCount      int   `json:"TxCount"`
	Transactions []*Tx `json:"txs,omitempty"`
}

Block contains information about block

type BlockbookInfo added in v0.1.0

type BlockbookInfo struct {
	Coin              string                       `json:"coin"`
	Host              string                       `json:"host"`
	Version           string                       `json:"version"`
	GitCommit         string                       `json:"gitcommit"`
	BuildTime         string                       `json:"buildtime"`
	SyncMode          bool                         `json:"syncMode"`
	InitialSync       bool                         `json:"initialsync"`
	InSync            bool                         `json:"inSync"`
	BestHeight        uint32                       `json:"bestHeight"`
	LastBlockTime     time.Time                    `json:"lastBlockTime"`
	InSyncMempool     bool                         `json:"inSyncMempool"`
	LastMempoolTime   time.Time                    `json:"lastMempoolTime"`
	MempoolSize       int                          `json:"mempoolSize"`
	DbSize            int64                        `json:"dbSize"`
	DbSizeFromColumns int64                        `json:"dbSizeFromColumns,omitempty"`
	DbColumns         []common.InternalStateColumn `json:"dbColumns,omitempty"`
	About             string                       `json:"about"`
}

BlockbookInfo contains information about the running blockbook instance

type Blocks added in v0.1.0

type Blocks struct {
	Paging
	Blocks []db.BlockInfo `json:"blocks"`
}

Blocks is list of blocks with paging information

type Paging added in v0.1.0

type Paging struct {
	Page        int `json:"page"`
	TotalPages  int `json:"totalPages"`
	ItemsOnPage int `json:"itemsOnPage"`
}

Paging contains information about paging for address, blocks and block

type ScriptPubKey

type ScriptPubKey struct {
	Hex        string                   `json:"hex"`
	Asm        string                   `json:"asm,omitempty"`
	AddrDesc   bchain.AddressDescriptor `json:"-"`
	Addresses  []string                 `json:"addresses"`
	Searchable bool                     `json:"-"`
	Type       string                   `json:"type,omitempty"`
}

ScriptPubKey contains output script and addresses derived from it

type ScriptSig

type ScriptSig struct {
	Hex string `json:"hex"`
	Asm string `json:"asm,omitempty"`
}

ScriptSig contains input script

type SystemInfo added in v0.1.0

type SystemInfo struct {
	Blockbook *BlockbookInfo    `json:"blockbook"`
	Backend   *bchain.ChainInfo `json:"backend"`
}

SystemInfo contains information about the running blockbook and backend instance

type Tx

type Tx struct {
	Txid          string  `json:"txid"`
	Version       int32   `json:"version,omitempty"`
	Locktime      uint32  `json:"locktime,omitempty"`
	Vin           []Vin   `json:"vin"`
	Vout          []Vout  `json:"vout"`
	Blockhash     string  `json:"blockhash,omitempty"`
	Blockheight   int     `json:"blockheight"`
	Confirmations uint32  `json:"confirmations"`
	Time          int64   `json:"time,omitempty"`
	Blocktime     int64   `json:"blocktime"`
	ValueOut      string  `json:"valueOut"`
	ValueOutSat   big.Int `json:"-"`
	Size          int     `json:"size,omitempty"`
	ValueIn       string  `json:"valueIn"`
	ValueInSat    big.Int `json:"-"`
	Fees          string  `json:"fees"`
	FeesSat       big.Int `json:"-"`
	Hex           string  `json:"hex"`
}

Tx holds information about a transaction

type Vin

type Vin struct {
	Txid       string                   `json:"txid"`
	Vout       uint32                   `json:"vout"`
	Sequence   int64                    `json:"sequence,omitempty"`
	N          int                      `json:"n"`
	ScriptSig  ScriptSig                `json:"scriptSig"`
	AddrDesc   bchain.AddressDescriptor `json:"-"`
	Addresses  []string                 `json:"addresses"`
	Searchable bool                     `json:"-"`
	Value      string                   `json:"value"`
	ValueSat   big.Int                  `json:"-"`
}

Vin contains information about single transaction input

type Vout

type Vout struct {
	Value        string       `json:"value"`
	ValueSat     big.Int      `json:"-"`
	N            int          `json:"n"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
	Spent        bool         `json:"spent"`
	SpentTxID    string       `json:"spentTxId,omitempty"`
	SpentIndex   int          `json:"spentIndex,omitempty"`
	SpentHeight  int          `json:"spentHeight,omitempty"`
}

Vout contains information about single transaction output

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker is handle to api worker

func NewWorker

func NewWorker(db *db.RocksDB, chain bchain.BlockChain, txCache *db.TxCache, is *common.InternalState) (*Worker, error)

NewWorker creates new api worker

func (*Worker) GetAddress

func (w *Worker) GetAddress(address string, page int, txsOnPage int, onlyTxids bool) (*Address, error)

GetAddress computes address value and gets transactions for given address

func (*Worker) GetAddressUtxo added in v0.1.1

func (w *Worker) GetAddressUtxo(address string, onlyConfirmed bool) ([]AddressUtxo, error)

GetAddressUtxo returns unspent outputs for given address

func (*Worker) GetBlock added in v0.1.0

func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error)

GetBlock returns paged data about block

func (*Worker) GetBlocks added in v0.1.0

func (w *Worker) GetBlocks(page int, blocksOnPage int) (*Blocks, error)

GetBlocks returns BlockInfo for blocks on given page

func (*Worker) GetSpendingTxid added in v0.1.0

func (w *Worker) GetSpendingTxid(txid string, n int) (string, error)

GetSpendingTxid returns transaction id of transaction that spent given output

func (*Worker) GetSystemInfo added in v0.1.0

func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error)

GetSystemInfo returns information about system

func (*Worker) GetTransaction

func (w *Worker) GetTransaction(txid string, spendingTxs bool) (*Tx, error)

GetTransaction reads transaction data from txid

Jump to

Keyboard shortcuts

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