Documentation
¶
Overview ¶
Package digitalbitscore is a client library for communicating with an instance of digitalbits-core using through the server's HTTP port.
Index ¶
Examples ¶
Constants ¶
const SetCursorDone = "Done"
SetCursorDone is the success message returned by digitalbits-core when a cursor update succeeds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // HTTP is the client to use when communicating with digitalbits-core. If nil, // http.DefaultClient will be used. HTTP HTTP // URL of DigitalBits Core server to connect. URL string }
Client represents a client that is capable of communicating with a digitalbits-core server using HTTP
func (*Client) Info ¶
func (c *Client) Info(ctx context.Context) (resp *InfoResponse, err error)
Info calls the `info` command on the connected digitalbits core and returns the provided response
Example ¶
client := &Client{URL: "http://localhost:11626"} info, err := client.Info(context.Background()) if err != nil { panic(err) } fmt.Printf("synced: %v", info.IsSynced())
Output:
type HTTP ¶
HTTP represents the http client that a digitalbitscore client uses to make http requests.
type InfoResponse ¶
type InfoResponse struct { Info struct { Build string `json:"build"` Network string `json:"network"` ProtocolVersion int `json:"protocol_version"` State string `json:"state"` } }
InfoResponse is the json response returned from digitalbits-core's /info endpoint.
func (*InfoResponse) IsSynced ¶
func (resp *InfoResponse) IsSynced() bool
IsSynced returns a boolean indicating whether digitalbitscore is synced with the network.