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 ¶
- type RPCClient
- func (rpcClient *RPCClient) ChannelHash() (string, bool)
- func (rpcClient *RPCClient) Connect() error
- func (rpcClient *RPCClient) GetEnv() (rpcmessages.GetEnvResponse, error)
- func (rpcClient *RPCClient) GetSampleInfo() (rpcmessages.SampleInfoResponse, error)
- func (rpcClient *RPCClient) GetVerificationProgress() (rpcmessages.VerificationProgressResponse, error)
- func (rpcClient *RPCClient) Ping() (bool, error)
- func (rpcClient *RPCClient) ResyncBitcoin(options rpcmessages.ResyncBitcoinArgs) (rpcmessages.ResyncBitcoinResponse, error)
- func (rpcClient *RPCClient) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient handles communication with the BitBox Base's rpc server
func NewRPCClient ¶
func NewRPCClient(address string, bitboxBaseConfigDir string, onChangeStatus func(bitboxbasestatus.Status), onEvent func(bitboxbasestatus.Event), onUnregister func() (bool, error)) (*RPCClient, error)
NewRPCClient returns a new bitboxbase rpcClient.
func (*RPCClient) ChannelHash ¶
ChannelHash returns the noise channel and a boolean to indicate if it is verified
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() (rpcmessages.GetEnvResponse, error)
GetEnv makes a synchronous rpc call to the base and returns the network type and electrs rpc port
func (*RPCClient) GetSampleInfo ¶
func (rpcClient *RPCClient) GetSampleInfo() (rpcmessages.SampleInfoResponse, error)
GetSampleInfo makes a synchronous rpc call to the base and returns the SampleInfoResponse struct
func (*RPCClient) GetVerificationProgress ¶
func (rpcClient *RPCClient) GetVerificationProgress() (rpcmessages.VerificationProgressResponse, error)
GetVerificationProgress makes a synchronous rpc call to the base and returns the VerificationProgressResponse struct
func (*RPCClient) Ping ¶
Ping sends a get request to the bitbox base's middleware root handler and returns true if successful
func (*RPCClient) ResyncBitcoin ¶
func (rpcClient *RPCClient) ResyncBitcoin(options rpcmessages.ResyncBitcoinArgs) (rpcmessages.ResyncBitcoinResponse, error)
ResyncBitcoin makes a synchronous rpc call to the base and returns wether the resync bitcoin script on the BitBox Base was executed successfully.