# README
rpcclient
rpcclient implements a Websocket-enabled Decred JSON-RPC client package written in Go. It provides a robust and easy to use client for interfacing with a Decred RPC server that uses a dcrd compatible Decred JSON-RPC API.
Status
This package is currently under active development. It is already stable and the infrastructure is complete. However, there are still several RPCs left to implement and the API is not stable yet.
Documentation
- API Reference
- dcrd Websockets Example Connects to a dcrd RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count
- dcrwallet Websockets Example
Connects to a dcrwallet RPC server using TLS-secured websockets, registers for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign
Major Features
- Supports Websockets (dcrd/dcrwallet) and HTTP POST mode (bitcoin core-like)
- Provides callback and registration functions for dcrd/dcrwallet notifications
- Supports dcrd extensions
- Translates to and from higher-level and easier to use Go types
- Offers a synchronous (blocking) and asynchronous API
- When running in Websockets mode (the default):
- Automatic reconnect handling (can be disabled)
- Outstanding commands are automatically reissued
- Registered notifications are automatically reregistered
- Back-off support on reconnect attempts
Installation
$ go get -u github.com/Decred-Next/dcrnd/rpcclient
License
Package rpcclient is licensed under the copyfree ISC License.
# Packages
No description provided by the author
# Functions
DisableLog disables all library log output.
New creates a new RPC client based on the provided connection configuration details.
UseLogger uses a specified Logger to output package logging info.
# Constants
ANAdd indicates the specified host should be added as a persistent peer.
ANOneTry indicates the specified host should try to connect once, but it should not be made persistent.
ANRemove indicates the specified peer should be removed.
Gap policies that are understood by a wallet JSON-RPC server.
Gap policies that are understood by a wallet JSON-RPC server.
Gap policies that are understood by a wallet JSON-RPC server.
SigHashAll indicates ALL of the outputs should be signed.
SigHashAllAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.
SigHashNone indicates NONE of the outputs should be signed.
SigHashNoneAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.
SigHashSingle indicates that a SINGLE output should be signed.
SigHashSingleAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.
# Variables
ErrClientAlreadyConnected is an error to describe the condition where a new client connection cannot be established due to a websocket client having already connected to the RPC server.
ErrClientDisconnect is an error to describe the condition where the client has been disconnected from the RPC server.
ErrClientNotConnected is an error to describe the condition where a websocket client has been created, but the connection was never established.
ErrClientShutdown is an error to describe the condition where the client is either already shutdown, or in the process of shutting down.
ErrInvalidAuth is an error to describe the condition where the client is either unable to authenticate or the specified endpoint is incorrect.
ErrInvalidEndpoint is an error to describe the condition where the websocket handshake failed with the specified endpoint.
ErrNotWebsocketClient is an error to describe the condition of calling a Client method intended for a websocket client when the client has been configured to run in HTTP POST mode instead.
ErrWebsocketsRequired is an error to describe the condition where the caller is trying to use a websocket-only feature, such as requesting notifications or other websocket requests when the client is configured to run in HTTP POST mode.
# Structs
Client represents a Decred RPC client which allows easy access to the various RPC methods available on a Decred RPC server.
ConnConfig describes the connection configuration parameters for the client.
NotificationHandlers defines callback function pointers to invoke with notifications.
SStxCommitOut represents the output to an SStx transaction.
# Type aliases
AddNodeCommand enumerates the available commands that the AddNode function accepts.
GapPolicy defines the policy to use when the BIP0044 unused address gap limit would be violated by creating a new address.
SigHashType enumerates the available signature hashing types that the SignRawTransaction function accepts.