Documentation
¶
Index ¶
- Constants
- Variables
- func DisableLog()
- func NewAPIRouter(app *appContext, useRealIP, compressLarge bool) apiMux
- func NewContext(cfg *AppContextConfig) *appContext
- func NewFileRouter(app *appContext, useRealIP bool) fileMux
- func UseLogger(logger slog.Logger)
- type AppContextConfig
- type DataSourceAux
- type DataSourceLite
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 DataSourceLite
DBSource DataSourceAux
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 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.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)
}
DataSourceAux specifies an interface for advanced data collection using the auxiliary DB (e.g. PostgreSQL).
type DataSourceLite ¶
type DataSourceLite interface {
CoinSupply() *apitypes.CoinSupply
GetHeight() (int64, error)
GetBestBlockHash() (string, error)
GetBlockHash(idx int64) (string, error)
GetBlockHeight(hash string) (int64, error)
GetBlockByHash(string) (*wire.MsgBlock, error)
GetHeader(idx int) *bitumjson.GetBlockHeaderVerboseResult
GetBlockHeaderByHash(hash string) (*wire.BlockHeader, error)
GetBlockVerbose(idx int, verboseTx bool) *bitumjson.GetBlockVerboseResult
GetBlockVerboseByHash(hash string, verboseTx bool) *bitumjson.GetBlockVerboseResult
GetRawTransaction(txid *chainhash.Hash) *apitypes.Tx
GetTransactionHex(txid *chainhash.Hash) string
GetTrimmedTransaction(txid *chainhash.Hash) *apitypes.TrimmedTx
GetRawTransactionWithPrevOutAddresses(txid *chainhash.Hash) (*apitypes.Tx, [][]string, []int64)
GetVoteInfo(txid *chainhash.Hash) (*apitypes.VoteInfo, error)
GetVoteVersionInfo(ver uint32) (*bitumjson.GetVoteInfoResult, error)
GetStakeVersions(txHash string, count int32) (*bitumjson.GetStakeVersionsResult, error)
GetStakeVersionsLatest() (*bitumjson.StakeVersions, error)
GetAllTxIn(txid *chainhash.Hash) []*apitypes.TxIn
GetAllTxOut(txid *chainhash.Hash) []*apitypes.TxOut
GetTransactionsForBlock(idx int64) *apitypes.BlockTransactions
GetTransactionsForBlockByHash(hash string) *apitypes.BlockTransactions
GetFeeInfo(idx int) *bitumjson.FeeInfoBlock
//GetStakeDiffEstimate(idx int) *bitumjson.EstimateStakeDiffResult
GetStakeInfoExtendedByHeight(idx int) *apitypes.StakeInfoExtended
GetStakeInfoExtendedByHash(hash string) *apitypes.StakeInfoExtended
GetStakeDiffEstimates() *apitypes.StakeDiff
//GetBestBlock() *blockdata.BlockData
GetSummary(idx int) *apitypes.BlockDataBasic
GetSummaryByHash(hash string, withTxTotals bool) *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) (*dbtypes.AddressInfo, txhelpers.AddressType, txhelpers.AddressError)
GetMempoolPriceCountTime() *apitypes.PriceCountTime
UpdateChan() chan uint32
}
DataSourceLite specifies an interface for collecting data from the built-in databases (i.e. SQLite, badger, ffldb)