rpc

package
v1.124.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client connection to a UTXO daemon. Internally this uses the Ethereum JSON-RPC 2.0 implementation, which allows batching and connection reuse.

func NewClient

func NewClient(host, user, password string, version int) (*Client, error)

NewClient returns a client connection to a UTXO daemon.

func (*Client) BatchGetMempoolEntry

func (c *Client) BatchGetMempoolEntry(txids []string) ([]*btcjson.GetMempoolEntryResult, []error, error)

BatchGetMempoolEntry returns mempool data for the given transactions.

func (*Client) BatchGetRawTransactionVerbose added in v1.119.0

func (c *Client) BatchGetRawTransactionVerbose(txids []string) ([]*btcjson.TxRawResult, []error, error)

BatchGetRawTransactionVerbose returns a raw transaction for given transaction ids.

func (*Client) Call added in v1.121.0

func (c *Client) Call(result interface{}, method string, args ...interface{}) error

func (*Client) CreateWallet

func (c *Client) CreateWallet(name string) error

CreateWallet creates a new wallet.

func (*Client) GetBlockCount

func (c *Client) GetBlockCount() (int64, error)

GetBlockCount returns the number of blocks in the longest block chain.

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(height int64) (string, error)

GetBlockHash returns the hash of the block in best-block-chain at the given height.

func (*Client) GetBlockStats

func (c *Client) GetBlockStats(hash string) (*btcjson.GetBlockStatsResult, error)

GetBlockStats returns statistics about the block at the given hash.

func (*Client) GetBlockVerbose

func (c *Client) GetBlockVerbose(hash string) (*btcjson.GetBlockVerboseResult, error)

GetBlockVerbose returns information about the block with verbosity 1.

func (*Client) GetBlockVerboseTxs

func (c *Client) GetBlockVerboseTxs(hash string) (*btcjson.GetBlockVerboseTxResult, error)

GetBlockVerbose returns information about the block with verbosity 2.

func (*Client) GetMempoolEntry

func (c *Client) GetMempoolEntry(txid string) (*btcjson.GetMempoolEntryResult, error)

GetMempoolEntry returns mempool data for the given transaction.

func (*Client) GetNetworkInfo

func (c *Client) GetNetworkInfo() (*btcjson.GetNetworkInfoResult, error)

func (*Client) GetRawMempool

func (c *Client) GetRawMempool() ([]string, error)

GetRawMempool returns all transaction ids in the mempool.

func (*Client) GetRawTransaction

func (c *Client) GetRawTransaction(txid string) (string, error)

GetRawTransaction returns a raw transaction string for the transaction id.

func (*Client) GetRawTransactionVerbose added in v1.119.0

func (c *Client) GetRawTransactionVerbose(txid string) (*btcjson.TxRawResult, error)

GetRawTransactionVerbose returns a raw transaction for the transaction id.

func (*Client) ImportAddress

func (c *Client) ImportAddress(address string) error

ImportAddress imports the address with no rescan.

func (*Client) ListUnspent

func (c *Client) ListUnspent(address string) ([]btcjson.ListUnspentResult, error)

ListUnspent returns all unspent outputs with between min and max confirmations.

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(tx SerializableTx, maxFeeParam any) (string, error)

SendRawTransaction serializes and sends the transaction. The maxFeeParam differs in type between chains - ensure the correct variant is used.

type SerializableTx

type SerializableTx interface {
	SerializeSize() int
	Serialize(io.Writer) error
}

Jump to

Keyboard shortcuts

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