insight

package
v3.0.0-...-e4f035e Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: ISC Imports: 34 Imported by: 0

Documentation

Overview

Package insight handles the insight api

Index

Constants

View Source
const APIVersion = 0

APIVersion is an integer value, incremented for breaking changes

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

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

func NewInsightContext

func NewInsightContext(client *rpcclient.Client, blockData *dcrpg.ChainDBRPC, params *chaincfg.Params, memPoolData DataSourceLite, JSONIndent string) *insightApiContext

NewInsightContext Constructor for insightApiContext

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type ApiMux

type ApiMux struct {
	*chi.Mux
}

ApiMux contains the struct mux

func NewInsightApiRouter

func NewInsightApiRouter(app *insightApiContext, useRealIP bool) ApiMux

NewInsightApiRouter returns a new HTTP path router, ApiMux, for the Insight API, app.

type DataSourceLite

type DataSourceLite interface {
	UnconfirmedTxnsForAddress(address string) (*txhelpers.AddressOutpoints, int64, error)
}

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

type InsightSocketVout

type InsightSocketVout struct {
	Address string
	Value   int64
}

InsightSocketVout represents a single vout for the Insight "vout" JSON object that appears in a "tx" message from the "inv" room.

func (*InsightSocketVout) MarshalJSON

func (v *InsightSocketVout) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler so that an InsightSocketVout will marshal to JSON like:

{
  "DsZQaCQES5vh3JmcyyFokJYz3aSw8Sm1dsQ": 13741789
}

type NewTx

type NewTx struct {
	Hex   string
	Vouts []dcrjson.Vout
}

NewTx models data from the notification handler

type SocketServer

type SocketServer struct {
	socketio.Server
	// contains filtered or unexported fields
}

SocketServer wraps the socket.io server with the watched address list.

func NewSocketServer

func NewSocketServer(newTxChan chan *NewTx, params *chaincfg.Params) (*SocketServer, error)

NewSocketServer constructs a new SocketServer, registering handlers for the "connection", "disconnection", and "subscribe" events.

func (*SocketServer) Store

func (soc *SocketServer) Store(blockData *blockdata.BlockData, _ *wire.MsgBlock) error

Store broadcasts the lastest block hash to the the inv room

type WebSocketTx

type WebSocketTx struct {
	Hash     string              `json:"txid"`
	Size     int                 `json:"size"`
	TotalOut int64               `json:"valueOut"`
	Vouts    []InsightSocketVout `json:"vout,omitempty"`
}

WebSocketTx models the JSON data sent as the tx event in the inv room.

Jump to

Keyboard shortcuts

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