go: github.com/stellar/go/clients/stellarcore Index | Examples | Files

package stellarcore

import "github.com/stellar/go/clients/stellarcore"

Package stellarcore is a client library for communicating with an instance of stellar-core using through the server's HTTP port.



Package Files

client.go main.go


const SetCursorDone = "Done"

SetCursorDone is the success message returned by stellar-core when a cursor update succeeds.

type Client Uses

type Client struct {
    // HTTP is the client to use when communicating with stellar-core.  If nil,
    // http.DefaultClient will be used.

    // URL of Stellar Core server to connect.
    URL string

Client represents a client that is capable of communicating with a stellar-core server using HTTP

func (*Client) Info Uses

func (c *Client) Info(ctx context.Context) (resp *proto.InfoResponse, err error)

Info calls the `info` command on the connected stellar core and returns the provided response


client := &Client{URL: "http://localhost:11626"}

info, err := client.Info(context.Background())

if err != nil {

fmt.Printf("synced: %v", info.IsSynced())

func (*Client) SetCursor Uses

func (c *Client) SetCursor(ctx context.Context, id string, cursor int32) error

SetCursor calls the `setcursor` command on the connected stellar core

func (*Client) SubmitTransaction Uses

func (c *Client) SubmitTransaction(ctx context.Context, envelope string) (resp *proto.TXResponse, err error)

SubmitTransaction calls the `tx` command on the connected stellar core with the provided envelope

func (*Client) WaitForNetworkSync Uses

func (c *Client) WaitForNetworkSync(ctx context.Context) error

WaitForNetworkSync continually polls the connected stellar-core until it receives a response that indicated the node has synced with the network

type HTTP Uses

type HTTP interface {
    Do(req *http.Request) (*http.Response, error)

HTTP represents the http client that a stellarcore client uses to make http requests.

Package stellarcore imports 11 packages (graph) and is imported by 37 packages. Updated 2018-04-18. Refresh now. Tools for package owners.