Documentation
¶
Index ¶
Constants ¶
const APIVersion = 1
APIVersion is an integer value, incremented for breaking changes
Variables ¶
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, useRealIP, compressLarge bool) apiMux
NewAPIRouter creates a new HTTP request path router/mux for the given API, appContext.
func NewContext ¶
func NewContext(cfg *AppContextConfig) *appContext
NewContext constructs a new appContext from the RPC client, primary and auxiliary data sources, and JSON indentation string.
func NewFileRouter ¶
func NewFileRouter(app *appContext, useRealIP bool) fileMux
NewFileRouter creates a new HTTP request path router/mux for file downloads.
Types ¶
type AppContextConfig ¶
type AppContextConfig struct {
Client *rpcclient.Client
Params *chaincfg.Params
DataSource DataSource
JsonIndent string
XcBot *exchanges.ExchangeBot
AgendasDBInstance *agendas.AgendaDB
MaxAddrs int
Charts *cache.ChartData
IsPiparserDisabled bool
}
AppContextConfig is the configuration for the appContext and the only argument to its constructor.
type DataSource ¶
type DataSource interface {
GetHeight() (int64, error)
GetBestBlockHash() (string, error)
GetBlockHash(idx int64) (string, error)
GetBlockHeight(hash string) (int64, error)
GetBlockByHash(string) (*wire.MsgBlock, error)
SpendingTransaction(fundingTx string, vout uint32) (string, uint32, int8, error)
SpendingTransactions(fundingTxID string) ([]string, []uint32, []uint32, error)
AddressHistory(address string, N, offset int64, txnType dbtypes.AddrTxnViewType) ([]*dbtypes.AddressRow, *dbtypes.AddressBalance, error)
FillAddressTransactions(addrInfo *dbtypes.AddressInfo) error
AddressTransactionDetails(addr string, count, skip int64,
txnType dbtypes.AddrTxnViewType) (*apitypes.Address, error)
AddressTotals(address string) (*apitypes.AddressTotals, error)
VotesInBlock(hash string) (int16, error)
TxHistoryData(address string, addrChart dbtypes.HistoryChart,
chartGroupings dbtypes.TimeBasedGrouping) (*dbtypes.ChartsData, error)
TicketPoolVisualization(interval dbtypes.TimeBasedGrouping) (
*dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, *dbtypes.PoolTicketsData, int64, error)
AgendaVotes(agendaID string, chartType int) (*dbtypes.AgendaVoteChoices, error)
AddressTxIoCsv(address string) ([][]string, error)
Height() int64
AllAgendas() (map[string]dbtypes.MileStone, error)
GetTicketInfo(txid string) (*apitypes.TicketInfo, error)
ProposalVotes(proposalToken string) (*dbtypes.ProposalChartsData, error)
PowerlessTickets() (*apitypes.PowerlessTickets, error)
GetStakeInfoExtendedByHash(hash string) *apitypes.StakeInfoExtended
GetStakeInfoExtendedByHeight(idx int) *apitypes.StakeInfoExtended
GetPoolInfo(idx int) *apitypes.TicketPoolInfo
GetPoolInfoByHash(hash string) *apitypes.TicketPoolInfo
GetPoolInfoRange(idx0, idx1 int) []apitypes.TicketPoolInfo
GetPoolValAndSizeRange(idx0, idx1 int) ([]float64, []uint32)
GetPool(idx int64) ([]string, error)
CurrentCoinSupply() *apitypes.CoinSupply
GetHeader(idx int) *chainjson.GetBlockHeaderVerboseResult
GetBlockHeaderByHash(hash string) (*wire.BlockHeader, error)
GetBlockVerboseByHash(hash string, verboseTx bool) *chainjson.GetBlockVerboseResult
GetRawAPITransaction(txid *chainhash.Hash) *apitypes.Tx
GetTransactionHex(txid *chainhash.Hash) string
GetTrimmedTransaction(txid *chainhash.Hash) *apitypes.TrimmedTx
GetVoteInfo(txid *chainhash.Hash) (*apitypes.VoteInfo, error)
GetVoteVersionInfo(ver uint32) (*chainjson.GetVoteInfoResult, error)
GetStakeVersionsLatest() (*chainjson.StakeVersions, error)
GetAllTxIn(txid *chainhash.Hash) []*apitypes.TxIn
GetAllTxOut(txid *chainhash.Hash) []*apitypes.TxOut
GetTransactionsForBlockByHash(hash string) *apitypes.BlockTransactions
GetStakeDiffEstimates() *apitypes.StakeDiff
GetSummary(idx int) *apitypes.BlockDataBasic
GetSummaryRange(idx0, idx1 int) []*apitypes.BlockDataBasic
GetSummaryRangeStepped(idx0, idx1, step int) []*apitypes.BlockDataBasic
GetSummaryByHash(hash string, withTxTotals bool) *apitypes.BlockDataBasic
GetBestBlockSummary() *apitypes.BlockDataBasic
GetBlockSize(idx int) (int32, error)
GetBlockSizeRange(idx0, idx1 int) ([]int32, error)
GetSDiff(idx int) float64
GetSDiffRange(idx0, idx1 int) []float64
GetMempoolSSTxSummary() *apitypes.MempoolTicketFeeInfo
GetMempoolSSTxFeeRates(N int) *apitypes.MempoolTicketFees
GetMempoolSSTxDetails(N int) *apitypes.MempoolTicketDetails
GetAddressTransactionsRawWithSkip(addr string, count, skip int) []*apitypes.AddressTxRaw
GetMempoolPriceCountTime() *apitypes.PriceCountTime
}
DataSource specifies an interface for advanced data collection using the auxiliary DB (e.g. PostgreSQL).