rpcclient

package
v4.12.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2019 License: Apache-2.0 Imports: 14 Imported by: 3

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 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

func (rpcClient *RPCClient) ChannelHash() (string, bool)

ChannelHash returns the noise channel and a boolean to indicate if it is verified

func (*RPCClient) Connect

func (rpcClient *RPCClient) Connect() error

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

func (rpcClient *RPCClient) Ping() (bool, error)

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.

func (*RPCClient) Stop

func (rpcClient *RPCClient) Stop()

Stop shuts down the websocket connection with the base

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL