rpc

package
v0.0.0-...-7abacdd Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: Unlicense Imports: 5 Imported by: 0

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 is the requester of the node's RPC server methods.

func NewClient

func NewClient() (Client, error)

NewClient creates a client that is connected to the node's RPC server.

Call Close to release the Client's associated resources when done.

func (*Client) AddNode

func (c *Client) AddNode(address string) (int, error)

AddNode adds a node to the peer list.

func (*Client) Close

func (c *Client) Close() error

Close releases resources related to the rcp client.

func (*Client) DisconnectNode

func (c *Client) DisconnectNode(address string) (int, error)

DisconnectNode removes a node from the peer list.

func (*Client) GetAddressUTXOs

func (c *Client) GetAddressUTXOs(address string) ([]tx.Output, error)

GetAddressUTXOs returns the unspent outputs of an address.

func (*Client) GetAddressesUTXOs

func (c *Client) GetAddressesUTXOs(addresses []string) (map[string][]tx.Output, error)

GetAddressesUTXOs returns the UTXOs corresponding to a set of addresses.

func (*Client) GetBestHeight

func (c *Client) GetBestHeight() (int32, error)

GetBestHeight returns the node's blockchain best height.

func (*Client) GetBlock

func (c *Client) GetBlock(hash []byte) (block.Block, error)

GetBlock returns a block given a hash.

func (*Client) GetLastBlock

func (c *Client) GetLastBlock() (block.Block, error)

GetLastBlock returns the last block (tip) of a chain.

func (*Client) GetPeerInfo

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

GetPeerInfo returns data about each connected node.

func (*Client) GetRawMempool

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

GetRawMempool returns the node's mempool transaction ids.

func (*Client) GetTransaction

func (c *Client) GetTransaction(id []byte) (block.Block, tx.Tx, error)

GetTransaction returns a transaction with the id provided.

func (*Client) ListBlocks

func (c *Client) ListBlocks() ([]block.Block, error)

ListBlocks returns all blocks from the chain.

func (*Client) SendPing

func (c *Client) SendPing() error

SendPing sends a signal request to another node.

func (*Client) SendTx

func (c *Client) SendTx(params node.SendTxParams) ([]byte, error)

SendTx sends sends a transaction to another node and returns the transaction id.

func (*Client) Stop

func (c *Client) Stop() error

Stop stops the running node.

Jump to

Keyboard shortcuts

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