client

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: Apache-2.0, BSD-2-Clause Imports: 13 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 {
	Events Events
	// contains filtered or unexported fields
}

Client represents the client-side connection to a txstream server

func New

func New(clientID string, log *logger.Logger, dial DialFunc) *Client

New creates a new client

func (*Client) Close

func (n *Client) Close()

Close shuts down the client

func (*Client) PostTransaction

func (n *Client) PostTransaction(tx *ledgerstate.Transaction)

PostTransaction posts a transaction to the ledger

func (*Client) RequestBacklog

func (n *Client) RequestBacklog(addr ledgerstate.Address)

RequestBacklog requests the backlog for a given address

func (*Client) RequestConfirmedOutput

func (n *Client) RequestConfirmedOutput(addr ledgerstate.Address, outputID ledgerstate.OutputID)

RequestConfirmedOutput requests a specific confirmed output

func (*Client) RequestConfirmedTransaction

func (n *Client) RequestConfirmedTransaction(addr ledgerstate.Address, txid ledgerstate.TransactionID)

RequestConfirmedTransaction requests a specific confirmed transaction

func (*Client) RequestTxInclusionState

func (n *Client) RequestTxInclusionState(addr ledgerstate.Address, txid ledgerstate.TransactionID)

RequestTxInclusionState requests the inclusion state of a transaction

func (*Client) RequestUnspentAliasOutput

func (n *Client) RequestUnspentAliasOutput(addr *ledgerstate.AliasAddress)

RequestUnspentAliasOutput requests the unique unspent alias output for the given AliasAddress

func (*Client) Subscribe

func (n *Client) Subscribe(addr ledgerstate.Address)

Subscribe subscribes to real-time updates for the given address

func (*Client) Unsubscribe

func (n *Client) Unsubscribe(addr ledgerstate.Address)

Unsubscribe unsubscribes the address

type DialFunc

type DialFunc func() (addr string, conn net.Conn, err error)

DialFunc is a function that performs the TCP connection to the server

type Events

type Events struct {
	// TransactionReceived is triggered when a transaction message is received from the server
	TransactionReceived *events.Event
	// InclusionStateReceived is triggered when an inclusion state message is received from the server
	InclusionStateReceived *events.Event
	// OutputReceived is triggered whenever individual output is received
	OutputReceived *events.Event
	// UnspentAliasOutputReceived is triggered whenever an unspent AliasOutput is received
	UnspentAliasOutputReceived *events.Event
	// Connected is triggered when the client connects successfully to the server
	Connected *events.Event
}

Events contains all events emitted by the Client

Jump to

Keyboard shortcuts

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