electrumx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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 Balance

type Balance struct {
	Confirmed   uint64 `json:"confirmed"`
	Unconfirmed int64  `json:"unconfirmed"`
}

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 electrumx JSON RPC client.

func NewClient

func NewClient(address string) (*Client, error)

NewClient returns an initialised electrumx client.

func (*Client) Balance

func (c *Client) Balance(ctx context.Context, scriptHash []byte) (*Balance, error)

func (*Client) Broadcast

func (c *Client) Broadcast(ctx context.Context, rtx []byte) ([]byte, error)

func (*Client) Height

func (c *Client) Height(ctx context.Context) (uint64, error)

func (*Client) RawBlockHeader

func (c *Client) RawBlockHeader(ctx context.Context, height uint64) (*bitcoin.BlockHeader, error)

func (*Client) RawTransaction

func (c *Client) RawTransaction(ctx context.Context, txHash []byte) ([]byte, error)

func (*Client) Transaction

func (c *Client) Transaction(ctx context.Context, txHash []byte) ([]byte, error)

func (*Client) TransactionAtPosition

func (c *Client) TransactionAtPosition(ctx context.Context, height, index uint64) ([]byte, []string, error)

func (*Client) UTXOs

func (c *Client) UTXOs(ctx context.Context, scriptHash []byte) ([]*UTXO, error)

type HeaderNotification

type HeaderNotification struct {
	Height       uint64 `json:"height"`
	BinaryHeader string `json:"hex"`
}

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

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"`
}

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string          `json:"jsonrpc"`
	Error   *JSONRPCError   `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

type RPCError

type RPCError string

func (RPCError) Error

func (e RPCError) Error() string

type UTXO

type UTXO struct {
	Hash   []byte
	Height uint64
	Index  uint32
	Value  int64
}

Jump to

Keyboard shortcuts

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