Documentation ¶
Index ¶
- Variables
- type Balance
- type BlockNotOnDiskError
- type Client
- func (c *Client) Balance(ctx context.Context, scriptHash []byte) (*Balance, error)
- func (c *Client) Broadcast(ctx context.Context, rtx []byte) ([]byte, error)
- func (c *Client) Close() error
- func (c *Client) Height(ctx context.Context) (uint64, error)
- func (c *Client) Metrics() []prometheus.Collector
- func (c *Client) RawBlockHeader(ctx context.Context, height uint64) (*bitcoin.BlockHeader, error)
- func (c *Client) RawTransaction(ctx context.Context, txHash []byte) ([]byte, error)
- func (c *Client) Transaction(ctx context.Context, txHash []byte) ([]byte, error)
- func (c *Client) TransactionAtPosition(ctx context.Context, height, index uint64) ([]byte, []string, error)
- func (c *Client) UTXOs(ctx context.Context, scriptHash []byte) ([]*UTXO, error)
- type ClientOptions
- type HeaderNotification
- type JSONRPCError
- type JSONRPCRequest
- type JSONRPCResponse
- type NoTxAtPositionError
- type RPCError
- type UTXO
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBlockNotOnDisk = NewBlockNotOnDiskError(errors.New("block not on disk")) ErrNoTxAtPosition = NewNoTxAtPositionError(errors.New("no tx at position")) )
Functions ¶
This section is empty.
Types ¶
type BlockNotOnDiskError ¶
type BlockNotOnDiskError struct {
// contains filtered or unexported fields
}
func NewBlockNotOnDiskError ¶
func NewBlockNotOnDiskError(err error) BlockNotOnDiskError
func (BlockNotOnDiskError) Error ¶
func (e BlockNotOnDiskError) Error() string
func (BlockNotOnDiskError) Is ¶
func (e BlockNotOnDiskError) Is(target error) bool
func (BlockNotOnDiskError) Unwrap ¶
func (e BlockNotOnDiskError) Unwrap() error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements an electrs JSON RPC client.
func NewClient ¶
func NewClient(address string, opts *ClientOptions) (*Client, error)
NewClient returns an initialised electrs client.
func (*Client) Metrics ¶
func (c *Client) Metrics() []prometheus.Collector
Metrics returns Prometheus metric collectors for the client.
func (*Client) RawBlockHeader ¶
func (*Client) RawTransaction ¶
func (*Client) Transaction ¶
func (*Client) TransactionAtPosition ¶
type ClientOptions ¶
type ClientOptions struct { // InitialConnections is the number of initial Electrs connections to open // and keep in the pool. InitialConnections int // MaxConnections is the maximum number of Electrs connections to keep in // the pool. // // If adding a connection back to the pool would result in the pool having // more connections than this value, the connection will be closed instead // of being added to the pool. MaxConnections int // PromNamespace is the application Prometheus namespace. PromNamespace string }
type HeaderNotification ¶
type JSONRPCError ¶
func NewJSONRPCError ¶
func NewJSONRPCError(code int, msg string) *JSONRPCError
type JSONRPCRequest ¶
type JSONRPCRequest struct { JSONRPC string `json:"jsonrpc"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` ID uint64 `json:"id"` }
func NewJSONRPCRequest ¶
func NewJSONRPCRequest(id uint64, method string, params any) (*JSONRPCRequest, error)
NewJSONRPCRequest creates a new JSONRPCRequest.
type JSONRPCResponse ¶
type JSONRPCResponse struct { JSONRPC string `json:"jsonrpc"` Error string `json:"error,omitempty"` Result json.RawMessage `json:"result"` ID uint64 `json:"id"` }
type NoTxAtPositionError ¶
type NoTxAtPositionError struct {
// contains filtered or unexported fields
}
func NewNoTxAtPositionError ¶
func NewNoTxAtPositionError(err error) NoTxAtPositionError
func (NoTxAtPositionError) Error ¶
func (e NoTxAtPositionError) Error() string
func (NoTxAtPositionError) Is ¶
func (e NoTxAtPositionError) Is(target error) bool
func (NoTxAtPositionError) Unwrap ¶
func (e NoTxAtPositionError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.