Documentation ¶
Overview ¶
Package rpcclient contains the API to the physical device.
Package rpcclient manages the connection with the bitboxbase, establishing a websocket listener and sending events when receiving packets. It also acts as a rpc client for any external package wanting to communicate with the base
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetEnvResponse ¶
GetEnvResponse holds the information from the rpc call reply to get some environment data from the base
type RPCClient ¶
type RPCClient struct { observable.Implementation // contains filtered or unexported fields }
RPCClient implements observable blockchainInfo.
func NewRPCClient ¶
func NewRPCClient(address string, bitboxBaseConfigDir string, onUnregister func(string), bitboxBaseID string) *RPCClient
NewRPCClient returns a new bitboxbase rpcClient.
func (*RPCClient) Connect ¶
Connect starts the websocket go routine, first checking if the middleware is reachable, then establishing a websocket connection, then authenticating and encrypting all further traffic with noise.
func (*RPCClient) GetEnv ¶
func (rpcClient *RPCClient) GetEnv() (GetEnvResponse, error)
GetEnv makes a synchronous rpc call to the base and returns the network type and electrs rpc port
func (*RPCClient) Ping ¶
Ping sends a get request to the bitbox base's middleware root handler and returns true if successful
func (*RPCClient) SampleInfo ¶
func (rpcClient *RPCClient) SampleInfo() (SampleInfoResponse, error)
SampleInfo make a synchronous rpc call to the base, emits an event containing the SampleInfo struct to the frontend and returns the SampleInfo struct
type SampleInfoResponse ¶
type SampleInfoResponse struct { Blocks int64 `json:"blocks"` Difficulty float64 `json:"difficulty"` LightningAlias string `json:"lightningAlias"` }
SampleInfoResponse holds some sample information from the BitBox Base