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 ¶
- type Account
- type Client
- func (c *Client) AfterFunc(t time.Time, f func())
- func (c *Client) LoadAccount(id string) (Account, error)
- func (c *Client) Now() time.Time
- func (c *Client) SequenceForAccount(accountID string) (xdr.SequenceNumber, error)
- func (c *Client) SetURL(url string)
- func (c *Client) StreamTxs(ctx context.Context, accountID string, cur Cursor, h func(Transaction) error) error
- func (c *Client) SubmitTx(envXdr string) (response TxSuccess, err error)
- func (c *Client) ValidateTestnetURL(url string) error
- func (c *Client) ValidateURL(url string) error
- type Cursor
- type Ledger
- type LedgerHandler
- type Transaction
- type TransactionHandler
- type Tx
- type TxSuccess
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 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 ¶
AfterFunc waits for a Stellar ledger at or after time t to commit, and then calls f in its own goroutine.
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 ¶
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 ¶
SubmitTx submits a transaction to the network. The returned error can be (but is not necessarily) an instance of horizon.Error.
func (*Client) ValidateTestnetURL ¶
ValidateTestnetURL tests that the URL is a valid horizon URL on the Stellar testnet by opening a test connection.
func (*Client) ValidateURL ¶
ValidateURL tests that the URL is a valid horizon URL by opening a test connection.
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.
type TxSuccess ¶
type TxSuccess = horizon.TransactionSuccess
Alias some types that don't need to be wrapped.