horizon

package
v0.0.0-...-9190965 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package horizon contains types that implement a variety of interfaces defined by the sdk/agent and its sub-packages, providing the functionality of those interfaces by querying Horizon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceCollector

type BalanceCollector struct {
	HorizonClient horizonclient.ClientInterface
}

BalanceCollector implements an agent's interface for collecting balances by querying Horizon's accounts endpoint for the balance.

func (*BalanceCollector) GetBalance

func (h *BalanceCollector) GetBalance(accountID *keypair.FromAddress, asset state.Asset) (int64, error)

GetBalance queries Horizon for the balance of the given asset on the given account.

type SequenceNumberCollector

type SequenceNumberCollector struct {
	HorizonClient horizonclient.ClientInterface
}

SequenceNumberCollector implements an agent's interface for collecting the current sequence number by querying Horizon's accounts endpoint.

func (*SequenceNumberCollector) GetSequenceNumber

func (h *SequenceNumberCollector) GetSequenceNumber(accountID *keypair.FromAddress) (int64, error)

GetSequenceNumber queries Horizon for the balance of the given account.

type Streamer

type Streamer struct {
	HorizonClient horizonclient.ClientInterface
	ErrorHandler  func(error)
}

Streamer implements the agent's interface for streaming transactions that affect a set of accounts, by using the streaming endpoints of Horizon's API to collect new transactions as they occur.

func (*Streamer) StreamTx

func (h *Streamer) StreamTx(cursor string, accounts ...*keypair.FromAddress) (txs <-chan agent.StreamedTransaction, cancel func())

StreamTx streams transactions that affect the given accounts, sending each transaction to the txs channel returned. StreamTx can be stopped by calling the cancel function returned. If multiple accounts are given the same transaction it may be broadcasted in duplicate if the transaction affects more than one account being monitored. The given cursor suppors resuming a previous stream.

TODO: Improve StreamTx so that it only streams transactions that affect the given accounts. At the moment, to reduce complexity and due to limitations in Horizon, it streams all network transactions. See https://github.com/stellar/go/issues/3874.

type Submitter

type Submitter struct {
	HorizonClient horizonclient.ClientInterface
}

Submitter implements an submit's interface for submitting transaction XDRs to the network, via Horizon's API.

func (*Submitter) SubmitTx

func (h *Submitter) SubmitTx(xdr string) error

SubmitTx submits the given xdr as a transaction to Horizon.

Jump to

Keyboard shortcuts

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