api

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: ISC Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = 1

APIVersion is an integer value, incremented for breaking changes

Variables

View Source
var CommitHash string

CommitHash may be set on the build command line: go build -ldflags "-X main.CommitHash=`git rev-parse --short HEAD`"

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func NewAPIRouter

func NewAPIRouter(app *appContext, userRealIP bool) apiMux

func NewContext

func NewContext(client *rpcclient.Client, params *chaincfg.Params, dataSource DataSourceLite, auxDataSource DataSourceAux, JSONIndent string) *appContext

NewContext constructs a new appContext from the RPC client, primary and auxiliary data sources, and JSON indentation string.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type DataSourceAux

type DataSourceAux interface {
	SpendingTransaction(fundingTx string, vout uint32) (string, uint32, int8, error)
	SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error)
	AddressHistory(address string, N, offset int64, txnType dbtypes.AddrTxnType) ([]*dbtypes.AddressRow, *explorer.AddressBalance, error)
	FillAddressTransactions(addrInfo *explorer.AddressInfo) error
	AddressTransactionDetails(addr string, count, skip int64,
		txnType dbtypes.AddrTxnType) (*apitypes.Address, error)
	AddressTotals(address string) (*apitypes.AddressTotals, error)
	VotesInBlock(hash string) (int16, error)
}

DataSourceAux specifies an interface for advanced data collection using the auxiliary DB (e.g. PostgreSQL).

type DataSourceLite

type DataSourceLite interface {
	CoinSupply() *apitypes.CoinSupply
	GetHeight() int
	GetBestBlockHash() (string, error)
	GetBlockHash(idx int64) (string, error)
	GetBlockHeight(hash string) (int64, error)
	//Get(idx int) *blockdata.BlockData
	GetHeader(idx int) *dcrjson.GetBlockHeaderVerboseResult
	GetBlockVerbose(idx int, verboseTx bool) *dcrjson.GetBlockVerboseResult
	GetBlockVerboseByHash(hash string, verboseTx bool) *dcrjson.GetBlockVerboseResult
	GetRawTransaction(txid string) *apitypes.Tx
	GetTransactionHex(txid string) string
	GetTrimmedTransaction(txid string) *apitypes.TrimmedTx
	GetRawTransactionWithPrevOutAddresses(txid string) (*apitypes.Tx, [][]string)
	GetVoteInfo(txid string) (*apitypes.VoteInfo, error)
	GetVoteVersionInfo(ver uint32) (*dcrjson.GetVoteInfoResult, error)
	GetStakeVersions(txHash string, count int32) (*dcrjson.GetStakeVersionsResult, error)
	GetStakeVersionsLatest() (*dcrjson.StakeVersions, error)
	GetAllTxIn(txid string) []*apitypes.TxIn
	GetAllTxOut(txid string) []*apitypes.TxOut
	GetTransactionsForBlock(idx int64) *apitypes.BlockTransactions
	GetTransactionsForBlockByHash(hash string) *apitypes.BlockTransactions
	GetFeeInfo(idx int) *dcrjson.FeeInfoBlock
	//GetStakeDiffEstimate(idx int) *dcrjson.EstimateStakeDiffResult
	GetStakeInfoExtended(idx int) *apitypes.StakeInfoExtended
	//needs db update: GetStakeInfoExtendedByHash(hash string) *apitypes.StakeInfoExtended
	GetStakeDiffEstimates() *apitypes.StakeDiff
	//GetBestBlock() *blockdata.BlockData
	GetSummary(idx int) *apitypes.BlockDataBasic
	GetSummaryByHash(hash string) *apitypes.BlockDataBasic
	GetBestBlockSummary() *apitypes.BlockDataBasic
	GetBlockSize(idx int) (int32, error)
	GetBlockSizeRange(idx0, idx1 int) ([]int32, error)
	GetPoolInfo(idx int) *apitypes.TicketPoolInfo
	GetPoolInfoByHash(hash string) *apitypes.TicketPoolInfo
	GetPoolInfoRange(idx0, idx1 int) []apitypes.TicketPoolInfo
	GetPool(idx int64) ([]string, error)
	GetPoolByHash(hash string) ([]string, error)
	GetPoolValAndSizeRange(idx0, idx1 int) ([]float64, []float64)
	GetSDiff(idx int) float64
	GetSDiffRange(idx0, idx1 int) []float64
	GetMempoolSSTxSummary() *apitypes.MempoolTicketFeeInfo
	GetMempoolSSTxFeeRates(N int) *apitypes.MempoolTicketFees
	GetMempoolSSTxDetails(N int) *apitypes.MempoolTicketDetails
	GetAddressTransactions(addr string, count int) *apitypes.Address
	GetAddressTransactionsRaw(addr string, count int) []*apitypes.AddressTxRaw
	GetAddressTransactionsWithSkip(addr string, count, skip int) *apitypes.Address
	GetAddressTransactionsRawWithSkip(addr string, count, skip int) []*apitypes.AddressTxRaw
	SendRawTransaction(txhex string) (string, error)
	GetExplorerAddress(address string, count, offset int64) *explorer.AddressInfo
}

DataSourceLite specifies an interface for collecting data from the built-in databases (i.e. SQLite, badger, ffldb)

Directories

Path Synopsis
Package insight handles the insight api
Package insight handles the insight api

Jump to

Keyboard shortcuts

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