worizon

package
v0.1.0-alpha.0...-0b1224c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package worizon is a wrapper for horizon. It exposes very little of the functionality of the underlying library — just enough for Interstellar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account = horizon.Account

Alias some types that don't need to be wrapped.

type Client

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

Client is a wrapper for some of a horizon client's functionality. To initialize a Client, call SetURL on the zero value. It is okay to call methods on Client concurrently. A Client must not be copied after first use.

func NewClient

func NewClient(rt http.RoundTripper, horizon horizonClient) *Client

func (*Client) AfterFunc

func (c *Client) AfterFunc(t time.Time, f func())

AfterFunc waits for a Stellar ledger at or after time t to commit, and then calls f in its own goroutine.

func (*Client) LoadAccount

func (c *Client) LoadAccount(id string) (Account, error)

func (*Client) Now

func (c *Client) Now() time.Time

Now returns the time of the last seen ledger.

func (*Client) SequenceForAccount

func (c *Client) SequenceForAccount(accountID string) (xdr.SequenceNumber, error)

SequenceForAccount implements SequenceProvider from package github.com/stellar/go/build.

func (*Client) SetURL

func (c *Client) SetURL(url string)

SetURL sets the URL for c to url. It also starts the clock routine.

If a non-nil horizon client is provided in NewClient, SetURL has no effect. Otherwise, SetURL must be called before any other method on c. After that, it is safe to call SetURL concurrently with other methods on Client.

func (*Client) StreamTxs

func (c *Client) StreamTxs(ctx context.Context, accountID string, cur Cursor, h func(Transaction) error) error

StreamTxs reads from the ledger all transactions that affect account accountID, beginning at cur, and calls h for each one. If h returns a non-nil error, StreamTxs returns it. If the underlying call to StreamTransactions returns an error, StreamTxs will retry.

func (*Client) SubmitTx

func (c *Client) SubmitTx(envXdr string) (response TxSuccess, err error)

SubmitTx submits a transaction to the network. The returned error can be (but is not necessarily) an instance of horizon.Error.

func (*Client) ValidateTestnetURL

func (c *Client) ValidateTestnetURL(url string) error

ValidateTestnetURL tests that the URL is a valid horizon URL on the Stellar testnet by opening a test connection.

func (*Client) ValidateURL

func (c *Client) ValidateURL(url string) error

ValidateURL tests that the URL is a valid horizon URL by opening a test connection.

type Cursor

type Cursor = horizon.Cursor

Alias some types that don't need to be wrapped.

type Ledger

type Ledger = horizon.Ledger

Alias some types that don't need to be wrapped.

type LedgerHandler

type LedgerHandler = horizon.LedgerHandler

Alias some types that don't need to be wrapped.

type Transaction

type Transaction = horizon.Transaction

Alias some types that don't need to be wrapped.

type TransactionHandler

type TransactionHandler = horizon.TransactionHandler

Alias some types that don't need to be wrapped.

type Tx

type Tx struct {
	Env    *xdr.TransactionEnvelope
	Result *xdr.TransactionResult

	PT         string // paging token a.k.a. cursor
	LedgerNum  int32
	LedgerTime time.Time
	SeqNum     string
}

Tx represents a Stellar transaction.

func NewTx

func NewTx(htx *horizon.Transaction) (*Tx, error)

NewTx produces a Tx from a Horizon Transaction object.

type TxSuccess

type TxSuccess = horizon.TransactionSuccess

Alias some types that don't need to be wrapped.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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