iotagox

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package iotagox provides experimental APIs which are not stable.

Index

Constants

View Source
const (
	// NodeEventMilestonesLatest is the name of the latest milestone event channel.
	NodeEventMilestonesLatest = "milestones/latest"
	// NodeEventMilestonesConfirmed is the name of the confirmed milestone event channel.
	NodeEventMilestonesConfirmed = "milestones/confirmed"

	// NodeEventMessages is the name of the received messages event channel.
	NodeEventMessages = "messages"
	// NodeEventMessagesReferenced is the name of the referenced messages metadata event channel.
	NodeEventMessagesReferenced = "messages/referenced"
	// NodeEventMessagesIndexation is the name of the indexed messages  event channel.
	NodeEventMessagesIndexation = "messages/indexation/{index}"
	// NodeEventMessagesMetadata is the name of the message metadata event channel.
	NodeEventMessagesMetadata = "messages/{messageId}/metadata"

	// NodeEventTransactionsIncludedMessage is the name of the included transaction message event channel.
	NodeEventTransactionsIncludedMessage = "transactions/{transactionId}/included-message"

	// NodeEventOutputs is the name of the outputs event channel.
	NodeEventOutputs = "outputs/{outputId}"

	// NodeEventReceipts is the name of the receipts event channel.
	NodeEventReceipts = "receipts"

	// NodeEventAddressesOutput is the name of the address outputs event channel.
	NodeEventAddressesOutput = "addresses/{address}/outputs"
	// NodeEventAddressesEd25519Output is the name of the ed25519 address outputs event channel.
	NodeEventAddressesEd25519Output = "addresses/ed25519/{address}/outputs"
)

Variables

View Source
var (
	// ErrNodeEventAPIClientInactive gets returned when a NodeEventAPIClient is inactive.
	ErrNodeEventAPIClientInactive = errors.New("node event api client is inactive")
)

Functions

This section is empty.

Types

type MilestonePointer

type MilestonePointer struct {
	Index     uint32 `json:"index"`
	Timestamp uint64 `json:"timestamp"`
}

MilestonePointer is an informative struct holding a milestone index and timestamp.

type NodeEventAPIClient

type NodeEventAPIClient struct {
	MQTTClient mqtt.Client
	// The context over the EventChannelsHandle.
	Ctx context.Context
	// A channel up on which errors are returned from within subscriptions or when the connection is lost.
	// It is the instantiater's job to ensure that the respective connection handlers are linked to this error channel
	// if the client was created without NewNodeEventAPIClient.
	// Errors are dropped silently if no receiver is listening for them or can consume them fast enough.
	Errors chan error
}

NodeEventAPIClient represents a handle to retrieve channels for node events. Any registration will panic if the NodeEventAPIClient.Ctx is done or the client isn't connected. Multiple calls to the same channel registration will override the previously created channel.

func NewNodeEventAPIClient

func NewNodeEventAPIClient(brokerURI string) *NodeEventAPIClient

NewNodeEventAPIClient creates a new NodeEventAPIClient using the given broker URI and default MQTT client options.

func (*NodeEventAPIClient) AddressOutputs

func (neac *NodeEventAPIClient) AddressOutputs(addr iotago.Address, netPrefix iotago.NetworkPrefix) <-chan *iotago.NodeOutputResponse

AddressOutputs returns a channel of newly created or spent outputs on the given address.

func (*NodeEventAPIClient) Close

func (neac *NodeEventAPIClient) Close()

Close disconnects the underlying MQTT client. Call this function to clean up any registered channels.

func (*NodeEventAPIClient) ConfirmedMilestoneMessages

func (neac *NodeEventAPIClient) ConfirmedMilestoneMessages(nodeHTTPAPIClient *iotago.NodeHTTPAPIClient) <-chan *iotago.Message

ConfirmedMilestoneMessages returns a channel of newly confirmed milestones messages.

func (*NodeEventAPIClient) ConfirmedMilestones

func (neac *NodeEventAPIClient) ConfirmedMilestones() <-chan *MilestonePointer

ConfirmedMilestones returns a channel of newly confirmed milestones.

func (*NodeEventAPIClient) Connect

func (neac *NodeEventAPIClient) Connect(ctx context.Context) error

Connect connects the NodeEventAPIClient to the specified brokers. The NodeEventAPIClient remains active as long as the given context isn't done/cancelled.

func (*NodeEventAPIClient) Ed25519AddressOutputs

func (neac *NodeEventAPIClient) Ed25519AddressOutputs(addr *iotago.Ed25519Address) <-chan *iotago.NodeOutputResponse

Ed25519AddressOutputs returns a channel of newly created or spent outputs on the given ed25519 address.

func (*NodeEventAPIClient) LatestMilestoneMessages

func (neac *NodeEventAPIClient) LatestMilestoneMessages(nodeHTTPAPIClient *iotago.NodeHTTPAPIClient) <-chan *iotago.Message

LatestMilestoneMessages returns a channel of newly seen latest milestones messages.

func (*NodeEventAPIClient) LatestMilestones

func (neac *NodeEventAPIClient) LatestMilestones() <-chan *MilestonePointer

LatestMilestones returns a channel of newly seen latest milestones.

func (*NodeEventAPIClient) MessageMetadataChange

func (neac *NodeEventAPIClient) MessageMetadataChange(msgID iotago.MessageID) <-chan *iotago.MessageMetadataResponse

MessageMetadataChange returns a channel of MessageMetadataResponse each time the given message's state changes.

func (*NodeEventAPIClient) Messages

func (neac *NodeEventAPIClient) Messages() <-chan *iotago.Message

Messages returns a channel of newly received messages.

func (*NodeEventAPIClient) MessagesWithIndex

func (neac *NodeEventAPIClient) MessagesWithIndex(index string) <-chan *iotago.Message

MessagesWithIndex returns a channel of newly received messages with the given index.

func (*NodeEventAPIClient) Output

func (neac *NodeEventAPIClient) Output(outputID iotago.UTXOInputID) <-chan *iotago.NodeOutputResponse

Output returns a channel which immediately returns the output with the given ID and afterwards when its state changes.

func (*NodeEventAPIClient) Receipts

func (neac *NodeEventAPIClient) Receipts() <-chan *iotago.Receipt

Receipts returns a channel which returns newly applied receipts.

func (*NodeEventAPIClient) ReferencedMessages

func (neac *NodeEventAPIClient) ReferencedMessages(nodeHTTPAPIClient *iotago.NodeHTTPAPIClient) <-chan *iotago.Message

ReferencedMessages returns a channel of newly referenced messages.

func (*NodeEventAPIClient) ReferencedMessagesMetadata

func (neac *NodeEventAPIClient) ReferencedMessagesMetadata() <-chan *iotago.MessageMetadataResponse

ReferencedMessagesMetadata returns a channel of message metadata of newly referenced messages.

func (*NodeEventAPIClient) TransactionIncludedMessage

func (neac *NodeEventAPIClient) TransactionIncludedMessage(txID iotago.TransactionID) <-chan *iotago.Message

TransactionIncludedMessage returns a channel of the included message which carries the transaction with the given ID.

Jump to

Keyboard shortcuts

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