rpcclient

package module
v8.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: ISC Imports: 30 Imported by: 0

README

rpcclient

Build Status ISC License Doc

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

Major Features

  • Supports Websockets (dcrd/dcrwallet) and HTTP POST mode (bitcoin core-like)
  • Provides callback and registration functions for dcrd notifications
  • 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 and Updating

This package is part of the github.com/Decred-Next/dcrnd/rpcclient/version7/v8 module. Use the standard go tooling for working with modules to incorporate it.

License

Package rpcclient is licensed under the copyfree ISC License.

Documentation

Overview

Package rpcclient implements a websocket-enabled Decred JSON-RPC client.

This client provides a robust and easy to use client for interfacing with a Decred RPC server that uses a mostly btcd/bitcoin core style Decred JSON-RPC API. This client has been tested with dcrd (https://github.com/decred/dcrd) and dcrwallet (https://github.com/decred/dcrwallet).

In addition to the compatible standard HTTP POST JSON-RPC API, dcrd and dcrwallet provide a websocket interface that is more efficient than the standard HTTP POST method of accessing RPC. The section below discusses the differences between HTTP POST and websockets.

By default, this client assumes the RPC server supports websockets and has TLS enabled. In practice, this currently means it assumes you are talking to dcrd or dcrwallet by default. However, configuration options are provided to fall back to HTTP POST and disable TLS to support talking with inferior bitcoin core style RPC servers.

Websockets vs HTTP POST

In HTTP POST-based JSON-RPC, every request creates a new HTTP connection, issues the call, waits for the response, and closes the connection. This adds quite a bit of overhead to every call and lacks flexibility for features such as notifications.

In contrast, the websocket-based JSON-RPC interface provided by dcrd and dcrwallet only uses a single connection that remains open and allows asynchronous bi-directional communication.

The websocket interface supports all of the same commands as HTTP POST, but they can be invoked without having to go through a connect/disconnect cycle for every call. In addition, the websocket interface provides other nice features such as the ability to register for asynchronous notifications of various events.

Synchronous vs Asynchronous API

The client provides both a synchronous (blocking) and asynchronous API.

The synchronous (blocking) API is typically sufficient for most use cases. It works by issuing the RPC and blocking until the response is received. This allows straightforward code where you have the response as soon as the function returns.

The asynchronous API works on the concept of futures. When you invoke the async version of a command, it will quickly return an instance of a type that promises to provide the result of the RPC at some future time. In the background, the RPC call is issued and the result is stored in the returned instance. Invoking the Receive method on the returned instance will either return the result immediately if it has already arrived, or block until it has. This is useful since it provides the caller with greater control over concurrency.

Notifications

The first important part of notifications is to realize that they will only work when connected via websockets. This should intuitively make sense because HTTP POST mode does not keep a connection open!

All notifications provided by dcrd require registration to opt-in. For example, if you want to be notified when funds are received by a set of addresses, you register the addresses via the NotifyReceived (or NotifyReceivedAsync) function.

Notification Handlers

Notifications are exposed by the client through the use of callback handlers which are setup via a NotificationHandlers instance that is specified by the caller when creating the client.

It is important that these notification handlers complete quickly since they are intentionally in the main read loop and will block further reads until they complete. This provides the caller with the flexibility to decide what to do when notifications are coming in faster than they are being handled.

In particular this means issuing a blocking RPC call from a callback handler will cause a deadlock as more server responses won't be read until the callback returns, but the callback would be waiting for a response. Thus, any additional RPCs must be issued an a completely decoupled manner.

Automatic Reconnection

By default, when running in websockets mode, this client will automatically keep trying to reconnect to the RPC server should the connection be lost. There is a back-off in between each connection attempt until it reaches one try per minute. Once a connection is re-established, all previously registered notifications are automatically re-registered and any in-flight commands are re-issued. This means from the caller's perspective, the request simply takes longer to complete.

The caller may invoke the Shutdown method on the client to force the client to cease reconnect attempts and return ErrClientShutdown for all outstanding commands.

The automatic reconnection can be disabled by setting the DisableAutoReconnect flag to true in the connection config when creating the client.

Interacting with Dcrwallet

This package only provides methods for dcrd RPCs. Using the websocket connection and request-response mapping provided by rpcclient with arbitrary methods or different servers is possible through the generic RawRequest and RawRequestAsync methods (each of which deal with json.RawMessage for parameters and return results).

Previous versions of this package provided methods for dcrwallet's JSON-RPC server in addition to dcrd. These were removed in major version 6 of this module. Projects depending on these calls are advised to use the decred.org/dcrwallet/rpc/client/dcrwallet package which is able to wrap rpcclient.Client using the aforementioned RawRequest method:

var _ *rpcclient.Client = client // Should be connected to dcrwallet
var _ *chaincfg.Params = params
var walletClient = dcrwallet.NewClient(dcrwallet.RawRequestCaller(client), params)

Using struct embedding, it is possible to create a single variable with the combined method sets of both rpcclient.Client and dcrwallet.Client:

type WalletClient = dcrwallet.Client // Avoids naming clash for selectors
type MyClient struct {
    *rpcclient.Client
    *WalletClient
}
var myClient = MyClient{Client: client, WalletClient: walletClient}

This technique is valuable as dcrwallet (syncing in RPC mode) will passthrough any unknown RPCs to the backing dcrd server, proxying requests and responses for the client.

Errors

There are 3 categories of errors that will be returned throughout this package:

  • Errors related to the client connection such as authentication, endpoint, disconnect, and shutdown
  • Errors that occur before communicating with the remote RPC server such as command creation and marshaling errors or issues talking to the remote server
  • Errors returned from the remote RPC server like unimplemented commands, nonexistent requested blocks and transactions, malformed data, and incorrect networks

The first category of errors are typically one of ErrInvalidAuth, ErrInvalidEndpoint, ErrClientDisconnect, or ErrClientShutdown.

NOTE: The ErrClientDisconnect will not be returned unless the DisableAutoReconnect flag is set since the client automatically handles reconnect by default as previously described.

The second category of errors typically indicates a programmer error and as such the type can vary, but usually will be best handled by simply showing/logging it.

The third category of errors, that is errors returned by the server, can be detected by type asserting the error in a *dcrjson.RPCError. For example, to detect if a command is unimplemented by the remote RPC server:

  block, err := client.GetBlock(ctx, blockHash)
  if err != nil {
  	if jerr, ok := err.(*dcrjson.RPCError); ok {
  		switch jerr.Code {
  		case dcrjson.ErrRPCUnimplemented:
  			// Handle not implemented error

  		// Handle other specific errors you care about
		}
  	}

  	// Log or otherwise handle the error knowing it was not one returned
  	// from the remote RPC server.
  }

Example Usage

The following full-blown client examples are in the examples directory:

  • dcrdwebsockets Connects to a dcrd RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAuth is an error to describe the condition where the client
	// is either unable to authenticate or the specified endpoint is
	// incorrect.
	ErrInvalidAuth = errors.New("authentication failure")

	// ErrInvalidEndpoint is an error to describe the condition where the
	// websocket handshake failed with the specified endpoint.
	ErrInvalidEndpoint = errors.New("the endpoint either does not support " +
		"websockets or does not exist")

	// ErrClientNotConnected is an error to describe the condition where a
	// websocket client has been created, but the connection was never
	// established.  This condition differs from ErrClientDisconnect, which
	// represents an established connection that was lost.
	ErrClientNotConnected = errors.New("the client was never connected")

	// ErrClientDisconnect is an error to describe the condition where the
	// client has been disconnected from the RPC server.  When the
	// DisableAutoReconnect option is not set, any outstanding futures
	// when a client disconnect occurs will return this error as will
	// any new requests.
	ErrClientDisconnect = errors.New("the client has been disconnected")

	// ErrClientShutdown is an error to describe the condition where the
	// client is either already shutdown, or in the process of shutting
	// down.  Any outstanding futures when a client shutdown occurs will
	// return this error as will any new requests.
	ErrClientShutdown = errors.New("the client has been shutdown")

	// 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.
	ErrNotWebsocketClient = errors.New("client is not configured for " +
		"websockets")

	// 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.
	ErrClientAlreadyConnected = errors.New("websocket client has already " +
		"connected")

	// ErrRequestCanceled is an error to describe the condition where
	// a request was canceled by the caller by terminating the passed
	// context.
	ErrRequestCanceled = errors.New("request was canceled by the caller")
)
View Source
var (
	// 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.
	ErrWebsocketsRequired = errors.New("a websocket connection is required " +
		"to use this feature")
)

Functions

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AddNodeCommand

type AddNodeCommand string

AddNodeCommand enumerates the available commands that the AddNode function accepts.

const (
	// ANAdd indicates the specified host should be added as a persistent
	// peer.
	ANAdd AddNodeCommand = "add"

	// ANRemove indicates the specified peer should be removed.
	ANRemove AddNodeCommand = "remove"

	// ANOneTry indicates the specified host should try to connect once,
	// but it should not be made persistent.
	ANOneTry AddNodeCommand = "onetry"
)

Constants used to indicate the command for the AddNode function.

func (AddNodeCommand) String

func (cmd AddNodeCommand) String() string

String returns the AddNodeCommand in human-readable form.

type CFilterV2Result

type CFilterV2Result struct {
	BlockHash   chainhash.Hash
	Filter      *gcs.FilterV2
	ProofIndex  uint32
	ProofHashes []chainhash.Hash
}

CFilterV2Result is the result of calling the GetCFilterV2 and GetCFilterV2Async methods.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Decred RPC client which allows easy access to the various RPC methods available on a Decred RPC server. Each of the wrapper functions handle the details of converting the passed and return types to and from the underlying JSON types which are required for the JSON-RPC invocations

The client provides each RPC in both synchronous (blocking) and asynchronous (non-blocking) forms. The asynchronous forms are based on the concept of futures where they return an instance of a type that promises to deliver the result of the invocation at some future time. Invoking the Receive method on the returned future will block until the result is available if it's not already.

func New

func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error)

New creates a new RPC client based on the provided connection configuration details. The notification handlers parameter may be nil if you are not interested in receiving notifications and will be ignored if the configuration is set to run in HTTP POST mode.

func (*Client) AddNode

func (c *Client) AddNode(ctx context.Context, host string, command AddNodeCommand) error

AddNode attempts to perform the passed command on the passed persistent peer. For example, it can be used to add or a remove a persistent peer, or to do a one time connection to a peer.

It may not be used to remove non-persistent peers.

func (*Client) AddNodeAsync

func (c *Client) AddNodeAsync(ctx context.Context, host string, command AddNodeCommand) *FutureAddNodeResult

AddNodeAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See AddNode for the blocking version and more details.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, retry bool) error

Connect establishes the initial websocket connection. This is necessary when a client was created after setting the DisableConnectOnNew field of the Config struct.

If the connection fails and retry is true, this method will continue to try reconnections with backoff until the context is done.

This method will error if the client is not configured for websockets, if the connection has already been established, or if none of the connection attempts were successful. The client will be shut down when the passed context is terminated.

func (*Client) CreateRawSSRtx

func (c *Client) CreateRawSSRtx(ctx context.Context, inputs []chainjson.TransactionInput, fee dcrutil.Amount) (*wire.MsgTx, error)

CreateRawSSRtx returns a new SSR transaction (revoking an sstx).

func (*Client) CreateRawSSRtxAsync

func (c *Client) CreateRawSSRtxAsync(ctx context.Context, inputs []chainjson.TransactionInput, fee dcrutil.Amount) *FutureCreateRawSSRtxResult

CreateRawSSRtxAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See CreateRawSSRtx for the blocking version and more details.

func (*Client) CreateRawSStx

func (c *Client) CreateRawSStx(ctx context.Context, inputs []chainjson.SStxInput,
	amount map[stdaddr.Address]dcrutil.Amount,
	couts []SStxCommitOut) (*wire.MsgTx, error)

CreateRawSStx returns a new transaction spending the provided inputs and sending to the provided addresses.

func (*Client) CreateRawSStxAsync

func (c *Client) CreateRawSStxAsync(ctx context.Context, inputs []chainjson.SStxInput,
	amount map[stdaddr.Address]dcrutil.Amount,
	couts []SStxCommitOut) *FutureCreateRawSStxResult

CreateRawSStxAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See CreateRawSStx for the blocking version and more details.

func (*Client) CreateRawTransaction

func (c *Client) CreateRawTransaction(ctx context.Context, inputs []chainjson.TransactionInput,
	amounts map[stdaddr.Address]dcrutil.Amount, lockTime *int64, expiry *int64) (*wire.MsgTx, error)

CreateRawTransaction returns a new transaction spending the provided inputs and sending to the provided addresses.

func (*Client) CreateRawTransactionAsync

func (c *Client) CreateRawTransactionAsync(ctx context.Context, inputs []chainjson.TransactionInput,
	amounts map[stdaddr.Address]dcrutil.Amount, lockTime *int64, expiry *int64) *FutureCreateRawTransactionResult

CreateRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See CreateRawTransaction for the blocking version and more details.

func (*Client) DebugLevel

func (c *Client) DebugLevel(ctx context.Context, levelSpec string) (string, error)

DebugLevel dynamically sets the debug logging level to the passed level specification.

The levelspec can be either a debug level or of the form:

<subsystem>=<level>,<subsystem2>=<level2>,...

Additionally, the special keyword 'show' can be used to get a list of the available subsystems.

NOTE: This is a dcrd extension.

func (*Client) DebugLevelAsync

func (c *Client) DebugLevelAsync(ctx context.Context, levelSpec string) *FutureDebugLevelResult

DebugLevelAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See DebugLevel for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) DecodeRawTransaction

func (c *Client) DecodeRawTransaction(ctx context.Context, serializedTx []byte) (*chainjson.TxRawResult, error)

DecodeRawTransaction returns information about a transaction given its serialized bytes.

func (*Client) DecodeRawTransactionAsync

func (c *Client) DecodeRawTransactionAsync(ctx context.Context, serializedTx []byte) *FutureDecodeRawTransactionResult

DecodeRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See DecodeRawTransaction for the blocking version and more details.

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect disconnects the current websocket associated with the client. The connection will automatically be re-established unless the client was created with the DisableAutoReconnect flag.

This function has no effect when the client is running in HTTP POST mode.

func (*Client) Disconnected

func (c *Client) Disconnected() bool

Disconnected returns whether or not the server is disconnected. If a websocket client was created but never connected, this also returns false.

func (*Client) EstimateSmartFee

func (c *Client) EstimateSmartFee(ctx context.Context, confirmations int64, mode chainjson.EstimateSmartFeeMode) (*chainjson.EstimateSmartFeeResult, error)

EstimateSmartFee returns an estimation of a transaction fee rate (in dcr/KB) that new transactions should pay if they desire to be mined in up to 'confirmations' blocks and the block number where the estimate was found.

The mode parameter (roughly) selects the different thresholds for accepting an estimation as reasonable, allowing users to select different trade-offs between probability of the transaction being mined in the given target confirmation range and minimization of fees paid.

As of 2019-01, only the default conservative mode is supported by dcrd.

func (*Client) EstimateSmartFeeAsync

func (c *Client) EstimateSmartFeeAsync(ctx context.Context, confirmations int64, mode chainjson.EstimateSmartFeeMode) *FutureEstimateSmartFeeResult

EstimateSmartFeeAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See EstimateSmartFee for the blocking version and more details.

func (*Client) EstimateStakeDiff

func (c *Client) EstimateStakeDiff(ctx context.Context, tickets *uint32) (*chainjson.EstimateStakeDiffResult, error)

EstimateStakeDiff returns the minimum, maximum, and expected next stake difficulty.

NOTE: This is a dcrd extension.

func (*Client) EstimateStakeDiffAsync

func (c *Client) EstimateStakeDiffAsync(ctx context.Context, tickets *uint32) *FutureEstimateStakeDiffResult

EstimateStakeDiffAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See EstimateStakeDiff for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) ExistsAddress

func (c *Client) ExistsAddress(ctx context.Context, address stdaddr.Address) (bool, error)

ExistsAddress returns information about whether or not an address has been used on the main chain or in mempool.

NOTE: This is a dcrd extension.

func (*Client) ExistsAddressAsync

func (c *Client) ExistsAddressAsync(ctx context.Context, address stdaddr.Address) *FutureExistsAddressResult

ExistsAddressAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsAddresses

func (c *Client) ExistsAddresses(ctx context.Context, addresses []stdaddr.Address) (string, error)

ExistsAddresses returns information about whether or not an address exists in the blockchain or memory pool.

NOTE: This is a dcrd extension.

func (*Client) ExistsAddressesAsync

func (c *Client) ExistsAddressesAsync(ctx context.Context, addresses []stdaddr.Address) *FutureExistsAddressesResult

ExistsAddressesAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsExpiredTickets

func (c *Client) ExistsExpiredTickets(ctx context.Context, hashes []*chainhash.Hash) (string, error)

ExistsExpiredTickets returns information about whether or not a ticket hash exists in the expired ticket database.

NOTE: This is a dcrd extension.

func (*Client) ExistsExpiredTicketsAsync

func (c *Client) ExistsExpiredTicketsAsync(ctx context.Context, hashes []*chainhash.Hash) *FutureExistsExpiredTicketsResult

ExistsExpiredTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsLiveTicket

func (c *Client) ExistsLiveTicket(ctx context.Context, hash *chainhash.Hash) (bool, error)

ExistsLiveTicket returns information about whether or not a ticket hash exists in the live ticket database.

NOTE: This is a dcrd extension.

func (*Client) ExistsLiveTicketAsync

func (c *Client) ExistsLiveTicketAsync(ctx context.Context, hash *chainhash.Hash) *FutureExistsLiveTicketResult

ExistsLiveTicketAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsLiveTickets

func (c *Client) ExistsLiveTickets(ctx context.Context, hashes []*chainhash.Hash) (string, error)

ExistsLiveTickets returns information about whether or not a list of ticket hashes exist in the live ticket database.

NOTE: This is a dcrd extension.

func (*Client) ExistsLiveTicketsAsync

func (c *Client) ExistsLiveTicketsAsync(ctx context.Context, hashes []*chainhash.Hash) *FutureExistsLiveTicketsResult

ExistsLiveTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsMempoolTxs

func (c *Client) ExistsMempoolTxs(ctx context.Context, hashes []*chainhash.Hash) (string, error)

ExistsMempoolTxs returns information about whether or not a list of transaction hashes exist in the mempool.

NOTE: This is a dcrd extension.

func (*Client) ExistsMempoolTxsAsync

func (c *Client) ExistsMempoolTxsAsync(ctx context.Context, hashes []*chainhash.Hash) *FutureExistsMempoolTxsResult

ExistsMempoolTxsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) ExistsMissedTickets

func (c *Client) ExistsMissedTickets(ctx context.Context, hashes []*chainhash.Hash) (string, error)

ExistsMissedTickets returns a hex-encoded bitset describing whether or not ticket hashes exists in the missed ticket database.

func (*Client) ExistsMissedTicketsAsync

func (c *Client) ExistsMissedTicketsAsync(ctx context.Context, hashes []*chainhash.Hash) *FutureExistsMissedTicketsResult

ExistsMissedTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) Generate

func (c *Client) Generate(ctx context.Context, numBlocks uint32) ([]*chainhash.Hash, error)

Generate generates numBlocks blocks and returns their hashes.

func (*Client) GenerateAsync

func (c *Client) GenerateAsync(ctx context.Context, numBlocks uint32) *FutureGenerateResult

GenerateAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Generate for the blocking version and more details.

func (*Client) GetAddedNodeInfo

func (c *Client) GetAddedNodeInfo(ctx context.Context, peer string) ([]chainjson.GetAddedNodeInfoResult, error)

GetAddedNodeInfo returns information about manually added (persistent) peers.

See GetAddedNodeInfoNoDNS to retrieve only a list of the added (persistent) peers.

func (*Client) GetAddedNodeInfoAsync

func (c *Client) GetAddedNodeInfoAsync(ctx context.Context, peer string) *FutureGetAddedNodeInfoResult

GetAddedNodeInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetAddedNodeInfo for the blocking version and more details.

func (*Client) GetAddedNodeInfoNoDNS

func (c *Client) GetAddedNodeInfoNoDNS(ctx context.Context, peer string) ([]string, error)

GetAddedNodeInfoNoDNS returns a list of manually added (persistent) peers. This works by setting the dns flag to false in the underlying RPC.

See GetAddedNodeInfo to obtain more information about each added (persistent) peer.

func (*Client) GetAddedNodeInfoNoDNSAsync

func (c *Client) GetAddedNodeInfoNoDNSAsync(ctx context.Context, peer string) *FutureGetAddedNodeInfoNoDNSResult

GetAddedNodeInfoNoDNSAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetAddedNodeInfoNoDNS for the blocking version and more details.

func (*Client) GetBestBlock

func (c *Client) GetBestBlock(ctx context.Context) (*chainhash.Hash, int64, error)

GetBestBlock returns the hash and height of the block in the longest (best) chain.

NOTE: This is a dcrd extension.

func (*Client) GetBestBlockAsync

func (c *Client) GetBestBlockAsync(ctx context.Context) *FutureGetBestBlockResult

GetBestBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBestBlock for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetBestBlockHash

func (c *Client) GetBestBlockHash(ctx context.Context) (*chainhash.Hash, error)

GetBestBlockHash returns the hash of the best block in the longest block chain.

func (*Client) GetBestBlockHashAsync

func (c *Client) GetBestBlockHashAsync(ctx context.Context) *FutureGetBestBlockHashResult

GetBestBlockHashAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBestBlockHash for the blocking version and more details.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blockHash *chainhash.Hash) (*wire.MsgBlock, error)

GetBlock returns a raw block from the server given its hash.

See GetBlockVerbose to retrieve a data structure with information about the block instead.

func (*Client) GetBlockAsync

func (c *Client) GetBlockAsync(ctx context.Context, blockHash *chainhash.Hash) *FutureGetBlockResult

GetBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlock for the blocking version and more details.

func (*Client) GetBlockChainInfo

func (c *Client) GetBlockChainInfo(ctx context.Context) (*chainjson.GetBlockChainInfoResult, error)

GetBlockChainInfo returns information about the current state of the block chain.

func (*Client) GetBlockChainInfoAsync

func (c *Client) GetBlockChainInfoAsync(ctx context.Context) *FutureGetBlockChainInfoResult

GetBlockChainInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockChainInfo for the blocking version and more details.

func (*Client) GetBlockCount

func (c *Client) GetBlockCount(ctx context.Context) (int64, error)

GetBlockCount returns the number of blocks in the longest block chain.

func (*Client) GetBlockCountAsync

func (c *Client) GetBlockCountAsync(ctx context.Context) *FutureGetBlockCountResult

GetBlockCountAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockCount for the blocking version and more details.

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(ctx context.Context, blockHeight int64) (*chainhash.Hash, error)

GetBlockHash returns the hash of the block in the best block chain at the given height.

func (*Client) GetBlockHashAsync

func (c *Client) GetBlockHashAsync(ctx context.Context, blockHeight int64) *FutureGetBlockHashResult

GetBlockHashAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHash for the blocking version and more details.

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, hash *chainhash.Hash) (*wire.BlockHeader, error)

GetBlockHeader returns the hash of the block in the best block chain at the given height.

func (*Client) GetBlockHeaderAsync

func (c *Client) GetBlockHeaderAsync(ctx context.Context, hash *chainhash.Hash) *FutureGetBlockHeaderResult

GetBlockHeaderAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHeader for the blocking version and more details.

func (*Client) GetBlockHeaderVerbose

func (c *Client) GetBlockHeaderVerbose(ctx context.Context, hash *chainhash.Hash) (*chainjson.GetBlockHeaderVerboseResult, error)

GetBlockHeaderVerbose returns a data structure of the block header from the server given its hash.

See GetBlockHeader to retrieve a raw block header instead.

func (*Client) GetBlockHeaderVerboseAsync

func (c *Client) GetBlockHeaderVerboseAsync(ctx context.Context, hash *chainhash.Hash) *FutureGetBlockHeaderVerboseResult

GetBlockHeaderVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHeaderVerbose for the blocking version and more details.

func (*Client) GetBlockSubsidy

func (c *Client) GetBlockSubsidy(ctx context.Context, height int64, voters uint16) (*chainjson.GetBlockSubsidyResult, error)

GetBlockSubsidy returns a data structure of the block subsidy from the server given its height and number of voters.

func (*Client) GetBlockSubsidyAsync

func (c *Client) GetBlockSubsidyAsync(ctx context.Context, height int64, voters uint16) *FutureGetBlockSubsidyResult

GetBlockSubsidyAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockSubsidy for the blocking version and more details.

func (*Client) GetBlockVerbose

func (c *Client) GetBlockVerbose(ctx context.Context, blockHash *chainhash.Hash, verboseTx bool) (*chainjson.GetBlockVerboseResult, error)

GetBlockVerbose returns a data structure from the server with information about a block given its hash.

See GetBlock to retrieve a raw block instead.

func (*Client) GetBlockVerboseAsync

func (c *Client) GetBlockVerboseAsync(ctx context.Context, blockHash *chainhash.Hash, verboseTx bool) *FutureGetBlockVerboseResult

GetBlockVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockVerbose for the blocking version and more details.

func (*Client) GetCFilterV2

func (c *Client) GetCFilterV2(ctx context.Context, blockHash *chainhash.Hash) (*CFilterV2Result, error)

GetCFilterV2 returns the version 2 block filter for the given block along with a proof that can be used to prove the filter is committed to by the block header.

func (*Client) GetCFilterV2Async

func (c *Client) GetCFilterV2Async(ctx context.Context, blockHash *chainhash.Hash) *FutureGetCFilterV2Result

GetCFilterV2Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCFilterV2 for the blocking version and more details.

func (*Client) GetChainTips

func (c *Client) GetChainTips(ctx context.Context) ([]chainjson.GetChainTipsResult, error)

GetChainTips returns all known tips in the block tree.

func (*Client) GetChainTipsAsync

func (c *Client) GetChainTipsAsync(ctx context.Context) *FutureGetChainTipsResult

GetChainTipsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetChainTips for the blocking version and more details.

func (*Client) GetCoinSupply

func (c *Client) GetCoinSupply(ctx context.Context) (dcrutil.Amount, error)

GetCoinSupply returns the current coin supply

func (*Client) GetCoinSupplyAsync

func (c *Client) GetCoinSupplyAsync(ctx context.Context) *FutureGetCoinSupplyResult

GetCoinSupplyAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCoinSupply for the blocking version and more details.

func (*Client) GetConnectionCount

func (c *Client) GetConnectionCount(ctx context.Context) (int64, error)

GetConnectionCount returns the number of active connections to other peers.

func (*Client) GetConnectionCountAsync

func (c *Client) GetConnectionCountAsync(ctx context.Context) *FutureGetConnectionCountResult

GetConnectionCountAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetConnectionCount for the blocking version and more details.

func (*Client) GetCurrentNet

func (c *Client) GetCurrentNet(ctx context.Context) (wire.CurrencyNet, error)

GetCurrentNet returns the network the server is running on.

NOTE: This is a dcrd extension.

func (*Client) GetCurrentNetAsync

func (c *Client) GetCurrentNetAsync(ctx context.Context) *FutureGetCurrentNetResult

GetCurrentNetAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCurrentNet for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetDifficulty

func (c *Client) GetDifficulty(ctx context.Context) (float64, error)

GetDifficulty returns the proof-of-work difficulty as a multiple of the minimum difficulty.

func (*Client) GetDifficultyAsync

func (c *Client) GetDifficultyAsync(ctx context.Context) *FutureGetDifficultyResult

GetDifficultyAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetDifficulty for the blocking version and more details.

func (*Client) GetGenerate

func (c *Client) GetGenerate(ctx context.Context) (bool, error)

GetGenerate returns true if the server is set to mine, otherwise false.

func (*Client) GetGenerateAsync

func (c *Client) GetGenerateAsync(ctx context.Context) *FutureGetGenerateResult

GetGenerateAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetGenerate for the blocking version and more details.

func (*Client) GetHashesPerSec

func (c *Client) GetHashesPerSec(ctx context.Context) (int64, error)

GetHashesPerSec returns a recent hashes per second performance measurement while generating coins (mining). Zero is returned if the server is not mining.

func (*Client) GetHashesPerSecAsync

func (c *Client) GetHashesPerSecAsync(ctx context.Context) *FutureGetHashesPerSecResult

GetHashesPerSecAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetHashesPerSec for the blocking version and more details.

func (*Client) GetHeaders

func (c *Client) GetHeaders(ctx context.Context, blockLocators []*chainhash.Hash, hashStop *chainhash.Hash) (*chainjson.GetHeadersResult, error)

GetHeaders mimics the wire protocol getheaders and headers messages by returning all headers on the main chain after the first known block in the locators, up until a block hash matches hashStop.

func (*Client) GetHeadersAsync

func (c *Client) GetHeadersAsync(ctx context.Context, blockLocators []*chainhash.Hash, hashStop *chainhash.Hash) *FutureGetHeadersResult

GetHeadersAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetHeaders for the blocking version and more details.

func (*Client) GetInfo

func (c *Client) GetInfo(ctx context.Context) (*chainjson.InfoChainResult, error)

GetInfo returns information about the current state of the full node process.

func (*Client) GetInfoAsync

func (c *Client) GetInfoAsync(ctx context.Context) *FutureGetInfoResult

GetInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetInfo for the blocking version and more details.

func (*Client) GetMiningInfo

func (c *Client) GetMiningInfo(ctx context.Context) (*chainjson.GetMiningInfoResult, error)

GetMiningInfo returns mining information.

func (*Client) GetMiningInfoAsync

func (c *Client) GetMiningInfoAsync(ctx context.Context) *FutureGetMiningInfoResult

GetMiningInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetMiningInfo for the blocking version and more details.

func (*Client) GetNetTotals

func (c *Client) GetNetTotals(ctx context.Context) (*chainjson.GetNetTotalsResult, error)

GetNetTotals returns network traffic statistics.

func (*Client) GetNetTotalsAsync

func (c *Client) GetNetTotalsAsync(ctx context.Context) *FutureGetNetTotalsResult

GetNetTotalsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetNetTotals for the blocking version and more details.

func (*Client) GetNetworkHashPS

func (c *Client) GetNetworkHashPS(ctx context.Context) (int64, error)

GetNetworkHashPS returns the estimated network hashes per second using the default number of blocks and the most recent block height.

See GetNetworkHashPS2 to override the number of blocks to use and GetNetworkHashPS3 to override the height at which to calculate the estimate.

func (*Client) GetNetworkHashPS2

func (c *Client) GetNetworkHashPS2(ctx context.Context, blocks int) (int64, error)

GetNetworkHashPS2 returns the estimated network hashes per second for the specified previous number of blocks working backwards from the most recent block height. The blocks parameter can also be -1 in which case the number of blocks since the last difficulty change will be used.

See GetNetworkHashPS to use defaults and GetNetworkHashPS3 to override the height at which to calculate the estimate.

func (*Client) GetNetworkHashPS2Async

func (c *Client) GetNetworkHashPS2Async(ctx context.Context, blocks int) *FutureGetNetworkHashPS

GetNetworkHashPS2Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetNetworkHashPS2 for the blocking version and more details.

func (*Client) GetNetworkHashPS3

func (c *Client) GetNetworkHashPS3(ctx context.Context, blocks, height int) (int64, error)

GetNetworkHashPS3 returns the estimated network hashes per second for the specified previous number of blocks working backwards from the specified block height. The blocks parameter can also be -1 in which case the number of blocks since the last difficulty change will be used.

See GetNetworkHashPS and GetNetworkHashPS2 to use defaults.

func (*Client) GetNetworkHashPS3Async

func (c *Client) GetNetworkHashPS3Async(ctx context.Context, blocks, height int) *FutureGetNetworkHashPS

GetNetworkHashPS3Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetNetworkHashPS3 for the blocking version and more details.

func (*Client) GetNetworkHashPSAsync

func (c *Client) GetNetworkHashPSAsync(ctx context.Context) *FutureGetNetworkHashPS

GetNetworkHashPSAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetNetworkHashPS for the blocking version and more details.

func (*Client) GetNetworkInfo

func (c *Client) GetNetworkInfo(ctx context.Context) (*chainjson.GetNetworkInfoResult, error)

GetNetworkInfo returns network-related data about the underlying node.

func (*Client) GetNetworkInfoAsync

func (c *Client) GetNetworkInfoAsync(ctx context.Context) *FutureGetNetworkInfoResult

GetNetworkInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetNetworkInfo for the blocking version and more details.

func (*Client) GetPeerInfo

func (c *Client) GetPeerInfo(ctx context.Context) ([]chainjson.GetPeerInfoResult, error)

GetPeerInfo returns data about each connected network peer.

func (*Client) GetPeerInfoAsync

func (c *Client) GetPeerInfoAsync(ctx context.Context) *FutureGetPeerInfoResult

GetPeerInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetPeerInfo for the blocking version and more details.

func (*Client) GetRawMempool

func (c *Client) GetRawMempool(ctx context.Context, txType chainjson.GetRawMempoolTxTypeCmd) ([]*chainhash.Hash, error)

GetRawMempool returns the hashes of all transactions in the memory pool for the given txType.

See GetRawMempoolVerbose to retrieve data structures with information about the transactions instead.

func (*Client) GetRawMempoolAsync

GetRawMempoolAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawMempool for the blocking version and more details.

func (*Client) GetRawMempoolVerbose

GetRawMempoolVerbose returns a map of transaction hashes to an associated data structure with information about the transaction for all transactions in the memory pool.

See GetRawMempool to retrieve only the transaction hashes instead.

func (*Client) GetRawMempoolVerboseAsync

func (c *Client) GetRawMempoolVerboseAsync(ctx context.Context, txType chainjson.GetRawMempoolTxTypeCmd) *FutureGetRawMempoolVerboseResult

GetRawMempoolVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawMempoolVerbose for the blocking version and more details.

func (*Client) GetRawTransaction

func (c *Client) GetRawTransaction(ctx context.Context, txHash *chainhash.Hash) (*dcrutil.Tx, error)

GetRawTransaction returns a transaction given its hash.

See GetRawTransactionVerbose to obtain additional information about the transaction.

func (*Client) GetRawTransactionAsync

func (c *Client) GetRawTransactionAsync(ctx context.Context, txHash *chainhash.Hash) *FutureGetRawTransactionResult

GetRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawTransaction for the blocking version and more details.

func (*Client) GetRawTransactionVerbose

func (c *Client) GetRawTransactionVerbose(ctx context.Context, txHash *chainhash.Hash) (*chainjson.TxRawResult, error)

GetRawTransactionVerbose returns information about a transaction given its hash.

See GetRawTransaction to obtain only the transaction already deserialized.

func (*Client) GetRawTransactionVerboseAsync

func (c *Client) GetRawTransactionVerboseAsync(ctx context.Context, txHash *chainhash.Hash) *FutureGetRawTransactionVerboseResult

GetRawTransactionVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawTransactionVerbose for the blocking version and more details.

func (*Client) GetStakeDifficulty

func (c *Client) GetStakeDifficulty(ctx context.Context) (*chainjson.GetStakeDifficultyResult, error)

GetStakeDifficulty returns the current and next stake difficulty.

NOTE: This is a dcrd extension.

func (*Client) GetStakeDifficultyAsync

func (c *Client) GetStakeDifficultyAsync(ctx context.Context) *FutureGetStakeDifficultyResult

GetStakeDifficultyAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetStakeDifficulty for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetStakeVersionInfo

func (c *Client) GetStakeVersionInfo(ctx context.Context, count int32) (*chainjson.GetStakeVersionInfoResult, error)

GetStakeVersionInfo returns the stake versions results for past requested intervals (count).

NOTE: This is a dcrd extension.

func (*Client) GetStakeVersionInfoAsync

func (c *Client) GetStakeVersionInfoAsync(ctx context.Context, count int32) *FutureGetStakeVersionInfoResult

GetStakeVersionInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetStakeVersionInfo for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetStakeVersions

func (c *Client) GetStakeVersions(ctx context.Context, hash string, count int32) (*chainjson.GetStakeVersionsResult, error)

GetStakeVersions returns the stake versions and vote versions of past requested blocks.

NOTE: This is a dcrd extension.

func (*Client) GetStakeVersionsAsync

func (c *Client) GetStakeVersionsAsync(ctx context.Context, hash string, count int32) *FutureGetStakeVersionsResult

GetStakeVersionsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetStakeVersions for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetTicketPoolValue

func (c *Client) GetTicketPoolValue(ctx context.Context) (dcrutil.Amount, error)

GetTicketPoolValue returns the value of the live ticket pool.

NOTE: This is a dcrd extension.

func (*Client) GetTicketPoolValueAsync

func (c *Client) GetTicketPoolValueAsync(ctx context.Context) *FutureGetTicketPoolValueResult

GetTicketPoolValueAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetTicketPoolValue for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetTreasuryBalance

func (c *Client) GetTreasuryBalance(ctx context.Context, block *chainhash.Hash, verbose bool) (*chainjson.GetTreasuryBalanceResult, error)

GetTreasuryBalance returns the treasury balance as of a given block hash or at the current tip if no hash is specified. If verbose is specified, then the treasury balance updates (TreasuryBase, TAdds and TSpends) in the given block are also returned.

func (*Client) GetTreasuryBalanceAsync

func (c *Client) GetTreasuryBalanceAsync(ctx context.Context, block *chainhash.Hash, verbose bool) *FutureGetTreasuryBalanceResult

GetTreasuryBalanceAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetTreasuryBalance for the blocking version and more details.

func (*Client) GetTreasurySpendVotes

func (c *Client) GetTreasurySpendVotes(ctx context.Context, block *chainhash.Hash, tspends []*chainhash.Hash) (*chainjson.GetTreasurySpendVotesResult, error)

GetTreasurySpendVotes returns the vote counts for some set of treasury spend transactions up to the specified block.

If the block is not specified, then votes are tallied up to the current main tip. If no tspend hashes are specified, then votes for all tspends currently in the mempool are returned.

func (*Client) GetTreasurySpendVotesAsync

func (c *Client) GetTreasurySpendVotesAsync(ctx context.Context, block *chainhash.Hash, tspends []*chainhash.Hash) *FutureGetTreasurySpendVotesResult

GetTreasurySpendVotesAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetTreasurySpendVotes for the blocking version and more details.

func (*Client) GetTxOut

func (c *Client) GetTxOut(ctx context.Context, txHash *chainhash.Hash, index uint32, tree int8, mempool bool) (*chainjson.GetTxOutResult, error)

GetTxOut returns the transaction output info if it's unspent and nil, otherwise.

func (*Client) GetTxOutAsync

func (c *Client) GetTxOutAsync(ctx context.Context, txHash *chainhash.Hash, index uint32, tree int8, mempool bool) *FutureGetTxOutResult

GetTxOutAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetTxOut for the blocking version and more details.

func (*Client) GetVoteInfo

func (c *Client) GetVoteInfo(ctx context.Context, version uint32) (*chainjson.GetVoteInfoResult, error)

GetVoteInfo returns voting information for the specified stake version. This includes current voting window, quorum, total votes and agendas.

NOTE: This is a dcrd extension.

func (*Client) GetVoteInfoAsync

func (c *Client) GetVoteInfoAsync(ctx context.Context, version uint32) *FutureGetVoteInfoResult

GetVoteInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetVoteInfo for the blocking version and more details.

NOTE: This is a dcrd extension.

func (*Client) GetWork

func (c *Client) GetWork(ctx context.Context) (*chainjson.GetWorkResult, error)

GetWork returns hash data to work on.

See GetWorkSubmit to submit the found solution.

func (*Client) GetWorkAsync

func (c *Client) GetWorkAsync(ctx context.Context) *FutureGetWork

GetWorkAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetWork for the blocking version and more details.

func (*Client) GetWorkSubmit

func (c *Client) GetWorkSubmit(ctx context.Context, data string) (bool, error)

GetWorkSubmit submits a block header which is a solution to previously requested data and returns whether or not the solution was accepted.

See GetWork to request data to work on.

func (*Client) GetWorkSubmitAsync

func (c *Client) GetWorkSubmitAsync(ctx context.Context, data string) *FutureGetWorkSubmit

GetWorkSubmitAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetWorkSubmit for the blocking version and more details.

func (*Client) LiveTickets

func (c *Client) LiveTickets(ctx context.Context) ([]*chainhash.Hash, error)

LiveTickets returns all currently live tickets from the live ticket database in the daemon.

NOTE: This is a dcrd extension.

func (*Client) LiveTicketsAsync

func (c *Client) LiveTicketsAsync(ctx context.Context) *FutureLiveTicketsResult

LiveTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) LoadTxFilter

func (c *Client) LoadTxFilter(ctx context.Context, reload bool, addresses []stdaddr.Address, outPoints []wire.OutPoint) error

LoadTxFilter loads, reloads, or adds data to a websocket client's transaction filter. The filter is consistently updated based on inspected transactions during mempool acceptance, block acceptance, and for all rescanned blocks.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) LoadTxFilterAsync

func (c *Client) LoadTxFilterAsync(ctx context.Context, reload bool, addresses []stdaddr.Address,
	outPoints []wire.OutPoint) *FutureLoadTxFilterResult

LoadTxFilterAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See LoadTxFilter for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) MissedTickets

func (c *Client) MissedTickets(ctx context.Context) ([]*chainhash.Hash, error)

MissedTickets returns all currently missed tickets from the missed ticket database in the daemon.

NOTE: This is a dcrd extension.

func (*Client) MissedTicketsAsync

func (c *Client) MissedTicketsAsync(ctx context.Context) *FutureMissedTicketsResult

MissedTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

func (*Client) NextID

func (c *Client) NextID() uint64

NextID returns the next id to be used when sending a JSON-RPC message. This ID allows responses to be associated with particular requests per the JSON-RPC specification. Typically the consumer of the client does not need to call this function, however, if a custom request is being created and used this function should be used to ensure the ID is unique amongst all requests being made.

func (*Client) NotifyBlocks

func (c *Client) NotifyBlocks(ctx context.Context) error

NotifyBlocks registers the client to receive notifications when blocks are connected and disconnected from the main chain. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnBlockConnected or OnBlockDisconnected.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyBlocksAsync

func (c *Client) NotifyBlocksAsync(ctx context.Context) *FutureNotifyBlocksResult

NotifyBlocksAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyBlocks for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyNewTickets

func (c *Client) NotifyNewTickets(ctx context.Context) error

NotifyNewTickets registers the client to receive notifications when blocks are connected to the main chain and new tickets have matured. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via OnNewTickets.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyNewTicketsAsync

func (c *Client) NotifyNewTicketsAsync(ctx context.Context) *FutureNotifyNewTicketsResult

NotifyNewTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyNewTickets for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyNewTransactions

func (c *Client) NotifyNewTransactions(ctx context.Context, verbose bool) error

NotifyNewTransactions registers the client to receive notifications every time a new transaction is accepted to the memory pool. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnTxAccepted (when verbose is false) or OnTxAcceptedVerbose (when verbose is true).

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyNewTransactionsAsync

func (c *Client) NotifyNewTransactionsAsync(ctx context.Context, verbose bool) *FutureNotifyNewTransactionsResult

NotifyNewTransactionsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyNewTransactions for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifySpentAndMissedTickets

func (c *Client) NotifySpentAndMissedTickets(ctx context.Context) error

NotifySpentAndMissedTickets registers the client to receive notifications when blocks are connected to the main chain and tickets are spent or missed. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be those from OnSpentAndMissedTickets.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifySpentAndMissedTicketsAsync

func (c *Client) NotifySpentAndMissedTicketsAsync(ctx context.Context) *FutureNotifySpentAndMissedTicketsResult

NotifySpentAndMissedTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifySpentAndMissedTickets for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyTSpend

func (c *Client) NotifyTSpend(ctx context.Context) error

NotifyTSpend registers the client to receive notifications when a new tspend arrives in the mempool.

The notifications delivered as a result of this call will be via one of OnTSpend.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyTSpendAsync

func (c *Client) NotifyTSpendAsync(ctx context.Context) *FutureNotifyTSpendResult

NotifyTSpendAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyTSpend for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyWinningTickets

func (c *Client) NotifyWinningTickets(ctx context.Context) error

NotifyWinningTickets registers the client to receive notifications when blocks are connected to the main chain and tickets are chosen to vote. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be those from OnWinningTickets.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyWinningTicketsAsync

func (c *Client) NotifyWinningTicketsAsync(ctx context.Context) *FutureNotifyWinningTicketsResult

NotifyWinningTicketsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyWinningTickets for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyWork

func (c *Client) NotifyWork(ctx context.Context) error

NotifyWork registers the client to receive notifications when a new block template has been generated.

The notifications delivered as a result of this call will be via OnWork.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) NotifyWorkAsync

func (c *Client) NotifyWorkAsync(ctx context.Context) *FutureNotifyWorkResult

NotifyWorkAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See NotifyWork for the blocking version and more details.

NOTE: This is a dcrd extension and requires a websocket connection.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping queues a ping to be sent to each connected peer.

Use the GetPeerInfo function and examine the PingTime and PingWait fields to access the ping times.

func (*Client) PingAsync

func (c *Client) PingAsync(ctx context.Context) *FuturePingResult

PingAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Ping for the blocking version and more details.

func (*Client) RawRequest

func (c *Client) RawRequest(ctx context.Context, method string, params []json.RawMessage) (json.RawMessage, error)

RawRequest allows the caller to send a raw or custom request to the server. This method may be used to send and receive requests and responses for requests that are not handled by this client package, or to proxy partially unmarshaled requests to another JSON-RPC server if a request cannot be handled directly.

func (*Client) RawRequestAsync

func (c *Client) RawRequestAsync(ctx context.Context, method string, params []json.RawMessage) *FutureRawResult

RawRequestAsync returns an instance of a type that can be used to get the result of a custom RPC request at some future time by invoking the Receive function on the returned instance.

See RawRequest for the blocking version and more details.

func (*Client) RegenTemplate

func (c *Client) RegenTemplate(ctx context.Context) error

RegenTemplate asks the node to regenerate its current block template. Note that template generation is currently asynchronous, therefore no guarantees are made for when or whether a new template will actually be available.

func (*Client) RegenTemplateAsync

func (c *Client) RegenTemplateAsync(ctx context.Context) *FutureRegenTemplateResult

RegenTemplateAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See RegenTemplate for the blocking version and more details.

func (*Client) Rescan

func (c *Client) Rescan(ctx context.Context, blockHashes []chainhash.Hash) (*chainjson.RescanResult, error)

Rescan rescans the blocks identified by blockHashes, in order, using the client's loaded transaction filter. The blocks do not need to be on the main chain, but they do need to be adjacent to each other.

func (*Client) RescanAsync

func (c *Client) RescanAsync(ctx context.Context, blockHashes []chainhash.Hash) *FutureRescanResult

RescanAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Rescan for the blocking version and more details.

func (*Client) SearchRawTransactions

func (c *Client) SearchRawTransactions(ctx context.Context,
	address stdaddr.Address, skip, count int,
	reverse bool, filterAddrs []string) ([]*wire.MsgTx, error)

SearchRawTransactions returns transactions that involve the passed address.

NOTE: Chain servers do not typically provide this capability unless it has specifically been enabled.

See SearchRawTransactionsVerbose to retrieve a list of data structures with information about the transactions instead of the transactions themselves.

func (*Client) SearchRawTransactionsAsync

func (c *Client) SearchRawTransactionsAsync(ctx context.Context,
	address stdaddr.Address, skip, count int, reverse bool,
	filterAddrs []string) *FutureSearchRawTransactionsResult

SearchRawTransactionsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SearchRawTransactions for the blocking version and more details.

func (*Client) SearchRawTransactionsVerbose

func (c *Client) SearchRawTransactionsVerbose(ctx context.Context,
	address stdaddr.Address, skip, count int, includePrevOut, reverse bool,
	filterAddrs []string) ([]*chainjson.SearchRawTransactionsResult, error)

SearchRawTransactionsVerbose returns a list of data structures that describe transactions which involve the passed address.

NOTE: Chain servers do not typically provide this capability unless it has specifically been enabled.

See SearchRawTransactions to retrieve a list of raw transactions instead.

func (*Client) SearchRawTransactionsVerboseAsync

func (c *Client) SearchRawTransactionsVerboseAsync(ctx context.Context,
	address stdaddr.Address, skip, count int, includePrevOut bool, reverse bool,
	filterAddrs *[]string) *FutureSearchRawTransactionsVerboseResult

SearchRawTransactionsVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SearchRawTransactionsVerbose for the blocking version and more details.

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(ctx context.Context, tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error)

SendRawTransaction submits the encoded transaction to the server which will then relay it to the network.

func (*Client) SendRawTransactionAsync

func (c *Client) SendRawTransactionAsync(ctx context.Context, tx *wire.MsgTx, allowHighFees bool) *FutureSendRawTransactionResult

SendRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SendRawTransaction for the blocking version and more details.

func (*Client) Session

func (c *Client) Session(ctx context.Context) (*chainjson.SessionResult, error)

Session returns details regarding a websocket client's current connection.

This RPC requires the client to be running in websocket mode.

NOTE: This is a Decred extension.

func (*Client) SessionAsync

func (c *Client) SessionAsync(ctx context.Context) *FutureSessionResult

SessionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Session for the blocking version and more details.

NOTE: This is a Decred extension.

func (*Client) SetGenerate

func (c *Client) SetGenerate(ctx context.Context, enable bool, numCPUs int) error

SetGenerate sets the server to generate coins (mine) or not.

func (*Client) SetGenerateAsync

func (c *Client) SetGenerateAsync(ctx context.Context, enable bool, numCPUs int) *FutureSetGenerateResult

SetGenerateAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SetGenerate for the blocking version and more details.

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown shuts down the client by disconnecting any connections associated with the client and, when automatic reconnect is enabled, preventing future attempts to reconnect. It also stops all goroutines.

func (*Client) String

func (c *Client) String() string

String implements fmt.Stringer by returning the URL of the RPC server the client makes requests to.

func (*Client) SubmitBlock

func (c *Client) SubmitBlock(ctx context.Context, block *dcrutil.Block, options *chainjson.SubmitBlockOptions) error

SubmitBlock attempts to submit a new block into the Decred network.

func (*Client) SubmitBlockAsync

func (c *Client) SubmitBlockAsync(ctx context.Context, block *dcrutil.Block, options *chainjson.SubmitBlockOptions) *FutureSubmitBlockResult

SubmitBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SubmitBlock for the blocking version and more details.

func (*Client) TicketFeeInfo

func (c *Client) TicketFeeInfo(ctx context.Context, blocks *uint32, windows *uint32) (*chainjson.TicketFeeInfoResult, error)

TicketFeeInfo returns information about ticket fees.

This RPC requires the client to be running in websocket mode.

NOTE: This is a Decred extension.

func (*Client) TicketFeeInfoAsync

func (c *Client) TicketFeeInfoAsync(ctx context.Context, blocks *uint32, windows *uint32) *FutureTicketFeeInfoResult

TicketFeeInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See TicketFeeInfo for the blocking version and more details.

NOTE: This is a Decred extension.

func (*Client) TicketVWAP

func (c *Client) TicketVWAP(ctx context.Context, start *uint32, end *uint32) (dcrutil.Amount, error)

TicketVWAP returns the vwap weighted average price of tickets.

This RPC requires the client to be running in websocket mode.

NOTE: This is a Decred extension.

func (*Client) TicketVWAPAsync

func (c *Client) TicketVWAPAsync(ctx context.Context, start *uint32, end *uint32) *FutureTicketVWAPResult

TicketVWAPAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See TicketVWAP for the blocking version and more details.

NOTE: This is a Decred extension.

func (*Client) TxFeeInfo

func (c *Client) TxFeeInfo(ctx context.Context, blocks *uint32, start *uint32, end *uint32) (*chainjson.TxFeeInfoResult, error)

TxFeeInfo returns information about tx fees.

This RPC requires the client to be running in websocket mode.

NOTE: This is a Decred extension.

func (*Client) TxFeeInfoAsync

func (c *Client) TxFeeInfoAsync(ctx context.Context, blocks *uint32, start *uint32, end *uint32) *FutureTxFeeInfoResult

TxFeeInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See TxFeeInfo for the blocking version and more details.

NOTE: This is a Decred extension.

func (*Client) ValidateAddress

func (c *Client) ValidateAddress(ctx context.Context, address stdaddr.Address) (*chainjson.ValidateAddressChainResult, error)

ValidateAddress returns information about the given Decred address.

func (*Client) ValidateAddressAsync

func (c *Client) ValidateAddressAsync(ctx context.Context, address stdaddr.Address) *FutureValidateAddressResult

ValidateAddressAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See ValidateAddress for the blocking version and more details.

func (*Client) VerifyChain

func (c *Client) VerifyChain(ctx context.Context) (bool, error)

VerifyChain requests the server to verify the block chain database using the default check level and number of blocks to verify.

See VerifyChainLevel and VerifyChainBlocks to override the defaults.

func (*Client) VerifyChainAsync

func (c *Client) VerifyChainAsync(ctx context.Context) *FutureVerifyChainResult

VerifyChainAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChain for the blocking version and more details.

func (*Client) VerifyChainBlocks

func (c *Client) VerifyChainBlocks(ctx context.Context, checkLevel, numBlocks int64) (bool, error)

VerifyChainBlocks requests the server to verify the block chain database using the passed check level and number of blocks to verify.

The check level controls how thorough the verification is with higher numbers increasing the amount of checks done as consequently how long the verification takes.

The number of blocks refers to the number of blocks from the end of the current longest chain.

See VerifyChain and VerifyChainLevel to use defaults.

func (*Client) VerifyChainBlocksAsync

func (c *Client) VerifyChainBlocksAsync(ctx context.Context, checkLevel, numBlocks int64) *FutureVerifyChainResult

VerifyChainBlocksAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChainBlocks for the blocking version and more details.

func (*Client) VerifyChainLevel

func (c *Client) VerifyChainLevel(ctx context.Context, checkLevel int64) (bool, error)

VerifyChainLevel requests the server to verify the block chain database using the passed check level and default number of blocks to verify.

The check level controls how thorough the verification is with higher numbers increasing the amount of checks done as consequently how long the verification takes.

See VerifyChain to use the default check level and VerifyChainBlocks to override the number of blocks to verify.

func (*Client) VerifyChainLevelAsync

func (c *Client) VerifyChainLevelAsync(ctx context.Context, checkLevel int64) *FutureVerifyChainResult

VerifyChainLevelAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChainLevel for the blocking version and more details.

func (*Client) VerifyMessage

func (c *Client) VerifyMessage(ctx context.Context, address stdaddr.Address, signature, message string) (bool, error)

VerifyMessage verifies a signed message.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) VerifyMessageAsync

func (c *Client) VerifyMessageAsync(ctx context.Context, address stdaddr.Address, signature, message string) *FutureVerifyMessageResult

VerifyMessageAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyMessage for the blocking version and more details.

func (*Client) Version

func (c *Client) Version(ctx context.Context) (map[string]chainjson.VersionResult, error)

Version returns information about the server's JSON-RPC API versions.

func (*Client) VersionAsync

func (c *Client) VersionAsync(ctx context.Context) *FutureVersionResult

VersionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Version for the blocking version and more details.

func (*Client) WaitForShutdown

func (c *Client) WaitForShutdown()

WaitForShutdown blocks until the client goroutines are stopped and the connection is closed.

type ConnConfig

type ConnConfig struct {
	// Host is the IP address and port of the RPC server you want to connect
	// to.
	Host string

	// Endpoint is the websocket endpoint on the RPC server.  This is
	// typically "ws".
	Endpoint string

	// User is the username to use to authenticate to the RPC server.
	User string

	// Pass is the passphrase to use to authenticate to the RPC server.
	Pass string

	// DisableTLS specifies whether transport layer security should be
	// disabled.  It is recommended to always use TLS if the RPC server
	// supports it as otherwise your username and password is sent across
	// the wire in cleartext.
	DisableTLS bool

	// Certificates are the bytes for a PEM-encoded certificate chain used
	// for the TLS connection.  It has no effect if the DisableTLS parameter
	// is true.
	Certificates []byte

	// Proxy specifies to connect through a SOCKS 5 proxy server.  It may
	// be an empty string if a proxy is not required.
	Proxy string

	// ProxyUser is an optional username to use for the proxy server if it
	// requires authentication.  It has no effect if the Proxy parameter
	// is not set.
	ProxyUser string

	// ProxyPass is an optional password to use for the proxy server if it
	// requires authentication.  It has no effect if the Proxy parameter
	// is not set.
	ProxyPass string

	// DisableAutoReconnect specifies the client should not automatically
	// try to reconnect to the server when it has been disconnected.
	DisableAutoReconnect bool

	// DisableConnectOnNew specifies that a websocket client connection
	// should not be tried when creating the client with New.  Instead, the
	// client is created and returned unconnected, and Connect must be
	// called manually.
	DisableConnectOnNew bool

	// HTTPPostMode instructs the client to run using multiple independent
	// connections issuing HTTP POST requests instead of using the default
	// of websockets.  Websockets are generally preferred as some of the
	// features of the client such notifications only work with websockets,
	// however, not all servers support the websocket extensions, so this
	// flag can be set to true to use basic HTTP POST requests instead.
	HTTPPostMode bool
}

ConnConfig describes the connection configuration parameters for the client. This

type FutureAddNodeResult

type FutureAddNodeResult cmdRes

FutureAddNodeResult is a future promise to deliver the result of an AddNodeAsync RPC invocation (or an applicable error).

func (*FutureAddNodeResult) Receive

func (r *FutureAddNodeResult) Receive() error

Receive waits for the response promised by the future and returns an error if any occurred when performing the specified command.

type FutureCreateRawSSRtxResult

type FutureCreateRawSSRtxResult cmdRes

FutureCreateRawSSRtxResult is a future promise to deliver the result of a CreateRawSSRtxAsync RPC invocation (or an applicable error).

func (*FutureCreateRawSSRtxResult) Receive

func (r *FutureCreateRawSSRtxResult) Receive() (*wire.MsgTx, error)

Receive waits for the response promised by the future and returns a new transaction spending the provided inputs and sending to the provided addresses.

type FutureCreateRawSStxResult

type FutureCreateRawSStxResult cmdRes

FutureCreateRawSStxResult is a future promise to deliver the result of a CreateRawSStxAsync RPC invocation (or an applicable error).

func (*FutureCreateRawSStxResult) Receive

func (r *FutureCreateRawSStxResult) Receive() (*wire.MsgTx, error)

Receive waits for the response promised by the future and returns a new transaction spending the provided inputs and sending to the provided addresses.

type FutureCreateRawTransactionResult

type FutureCreateRawTransactionResult cmdRes

FutureCreateRawTransactionResult is a future promise to deliver the result of a CreateRawTransactionAsync RPC invocation (or an applicable error).

func (*FutureCreateRawTransactionResult) Receive

func (r *FutureCreateRawTransactionResult) Receive() (*wire.MsgTx, error)

Receive waits for the response promised by the future and returns a new transaction spending the provided inputs and sending to the provided addresses.

type FutureDebugLevelResult

type FutureDebugLevelResult cmdRes

FutureDebugLevelResult is a future promise to deliver the result of a DebugLevelAsync RPC invocation (or an applicable error).

func (*FutureDebugLevelResult) Receive

func (r *FutureDebugLevelResult) Receive() (string, error)

Receive waits for the response promised by the future and returns the result of setting the debug logging level to the passed level specification or the list of the available subsystems for the special keyword 'show'.

type FutureDecodeRawTransactionResult

type FutureDecodeRawTransactionResult cmdRes

FutureDecodeRawTransactionResult is a future promise to deliver the result of a DecodeRawTransactionAsync RPC invocation (or an applicable error).

func (*FutureDecodeRawTransactionResult) Receive

Receive waits for the response promised by the future and returns information about a transaction given its serialized bytes.

type FutureEstimateSmartFeeResult

type FutureEstimateSmartFeeResult cmdRes

FutureEstimateSmartFeeResult is a future promise to deliver the result of a EstimateSmartFee RPC invocation (or an applicable error).

func (*FutureEstimateSmartFeeResult) Receive

Receive waits for the response promised by the future and returns a fee estimation for the given target confirmation window and mode along with the block number where the estimate was found.

type FutureEstimateStakeDiffResult

type FutureEstimateStakeDiffResult cmdRes

FutureEstimateStakeDiffResult is a future promise to deliver the result of a EstimateStakeDiffAsync RPC invocation (or an applicable error).

func (*FutureEstimateStakeDiffResult) Receive

Receive waits for the response promised by the future and returns the estimatestakediff result.

type FutureExistsAddressResult

type FutureExistsAddressResult cmdRes

FutureExistsAddressResult is a future promise to deliver the result of a FutureExistsAddressResultAsync RPC invocation (or an applicable error).

func (*FutureExistsAddressResult) Receive

func (r *FutureExistsAddressResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not an address exists in the blockchain or mempool.

type FutureExistsAddressesResult

type FutureExistsAddressesResult cmdRes

FutureExistsAddressesResult is a future promise to deliver the result of a FutureExistsAddressesResultAsync RPC invocation (or an applicable error).

func (*FutureExistsAddressesResult) Receive

func (r *FutureExistsAddressesResult) Receive() (string, error)

Receive waits for the response promised by the future and returns whether or not the addresses exist.

type FutureExistsExpiredTicketsResult

type FutureExistsExpiredTicketsResult cmdRes

FutureExistsExpiredTicketsResult is a future promise to deliver the result of a FutureExistsExpiredTicketsResultAsync RPC invocation (or an applicable error).

func (*FutureExistsExpiredTicketsResult) Receive

Receive waits for the response promised by the future and returns whether or not the tickets exist in the expired ticket database.

type FutureExistsLiveTicketResult

type FutureExistsLiveTicketResult cmdRes

FutureExistsLiveTicketResult is a future promise to deliver the result of a FutureExistsLiveTicketResultAsync RPC invocation (or an applicable error).

func (*FutureExistsLiveTicketResult) Receive

func (r *FutureExistsLiveTicketResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not the ticket exists in the live ticket database.

type FutureExistsLiveTicketsResult

type FutureExistsLiveTicketsResult cmdRes

FutureExistsLiveTicketsResult is a future promise to deliver the result of a FutureExistsLiveTicketsResultAsync RPC invocation (or an applicable error).

func (*FutureExistsLiveTicketsResult) Receive

func (r *FutureExistsLiveTicketsResult) Receive() (string, error)

Receive waits for the response promised by the future and returns whether or not the tickets exist in the live ticket database.

type FutureExistsMempoolTxsResult

type FutureExistsMempoolTxsResult cmdRes

FutureExistsMempoolTxsResult is a future promise to deliver the result of a FutureExistsMempoolTxsResultAsync RPC invocation (or an applicable error).

func (*FutureExistsMempoolTxsResult) Receive

func (r *FutureExistsMempoolTxsResult) Receive() (string, error)

Receive waits for the response promised by the future and returns whether or not the transactions exist in the mempool.

type FutureExistsMissedTicketsResult

type FutureExistsMissedTicketsResult cmdRes

FutureExistsMissedTicketsResult is a future promise to deliver the result of an ExistsMissedTicketsAsync RPC invocation (or an applicable error).

func (*FutureExistsMissedTicketsResult) Receive

Receive waits for the response promised by the future and returns whether or not the tickets exist in the missed ticket database.

type FutureGenerateResult

type FutureGenerateResult cmdRes

FutureGenerateResult is a future promise to deliver the result of a GenerateAsync RPC invocation (or an applicable error).

func (*FutureGenerateResult) Receive

func (r *FutureGenerateResult) Receive() ([]*chainhash.Hash, error)

Receive waits for the response promised by the future and returns a list of block hashes generated by the call.

type FutureGetAddedNodeInfoNoDNSResult

type FutureGetAddedNodeInfoNoDNSResult cmdRes

FutureGetAddedNodeInfoNoDNSResult is a future promise to deliver the result of a GetAddedNodeInfoNoDNSAsync RPC invocation (or an applicable error).

func (*FutureGetAddedNodeInfoNoDNSResult) Receive

Receive waits for the response promised by the future and returns a list of manually added (persistent) peers.

type FutureGetAddedNodeInfoResult

type FutureGetAddedNodeInfoResult cmdRes

FutureGetAddedNodeInfoResult is a future promise to deliver the result of a GetAddedNodeInfoAsync RPC invocation (or an applicable error).

func (*FutureGetAddedNodeInfoResult) Receive

Receive waits for the response promised by the future and returns information about manually added (persistent) peers.

type FutureGetBestBlockHashResult

type FutureGetBestBlockHashResult cmdRes

FutureGetBestBlockHashResult is a future promise to deliver the result of a GetBestBlockAsync RPC invocation (or an applicable error).

func (*FutureGetBestBlockHashResult) Receive

func (r *FutureGetBestBlockHashResult) Receive() (*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the hash of the best block in the longest block chain.

type FutureGetBestBlockResult

type FutureGetBestBlockResult cmdRes

FutureGetBestBlockResult is a future promise to deliver the result of a GetBestBlockAsync RPC invocation (or an applicable error).

func (*FutureGetBestBlockResult) Receive

func (r *FutureGetBestBlockResult) Receive() (*chainhash.Hash, int64, error)

Receive waits for the response promised by the future and returns the hash and height of the block in the longest (best) chain.

type FutureGetBlockChainInfoResult

type FutureGetBlockChainInfoResult cmdRes

FutureGetBlockChainInfoResult is a future promise to deliver the result of a GetBlockChainInfoAsync RPC invocation (or an applicable error).

func (*FutureGetBlockChainInfoResult) Receive

Receive waits for the response promised by the future and returns the info provided by the server.

type FutureGetBlockCountResult

type FutureGetBlockCountResult cmdRes

FutureGetBlockCountResult is a future promise to deliver the result of a GetBlockCountAsync RPC invocation (or an applicable error).

func (*FutureGetBlockCountResult) Receive

func (r *FutureGetBlockCountResult) Receive() (int64, error)

Receive waits for the response promised by the future and returns the number of blocks in the longest block chain.

type FutureGetBlockHashResult

type FutureGetBlockHashResult cmdRes

FutureGetBlockHashResult is a future promise to deliver the result of a GetBlockHashAsync RPC invocation (or an applicable error).

func (*FutureGetBlockHashResult) Receive

func (r *FutureGetBlockHashResult) Receive() (*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the hash of the block in the best block chain at the given height.

type FutureGetBlockHeaderResult

type FutureGetBlockHeaderResult cmdRes

FutureGetBlockHeaderResult is a future promise to deliver the result of a GetBlockHeaderAsync RPC invocation (or an applicable error).

func (*FutureGetBlockHeaderResult) Receive

func (r *FutureGetBlockHeaderResult) Receive() (*wire.BlockHeader, error)

Receive waits for the response promised by the future and returns the blockheader requested from the server given its hash.

type FutureGetBlockHeaderVerboseResult

type FutureGetBlockHeaderVerboseResult cmdRes

FutureGetBlockHeaderVerboseResult is a future promise to deliver the result of a GetBlockHeaderAsync RPC invocation (or an applicable error).

func (*FutureGetBlockHeaderVerboseResult) Receive

Receive waits for the response promised by the future and returns a data structure of the block header requested from the server given its hash.

type FutureGetBlockResult

type FutureGetBlockResult cmdRes

FutureGetBlockResult is a future promise to deliver the result of a GetBlockAsync RPC invocation (or an applicable error).

func (*FutureGetBlockResult) Receive

func (r *FutureGetBlockResult) Receive() (*wire.MsgBlock, error)

Receive waits for the response promised by the future and returns the raw block requested from the server given its hash.

type FutureGetBlockSubsidyResult

type FutureGetBlockSubsidyResult cmdRes

FutureGetBlockSubsidyResult is a future promise to deliver the result of a GetBlockSubsidyAsync RPC invocation (or an applicable error).

func (*FutureGetBlockSubsidyResult) Receive

Receive waits for the response promised by the future and returns a data structure of the block subsidy requested from the server given its height and number of voters.

type FutureGetBlockVerboseResult

type FutureGetBlockVerboseResult cmdRes

FutureGetBlockVerboseResult is a future promise to deliver the result of a GetBlockVerboseAsync RPC invocation (or an applicable error).

func (*FutureGetBlockVerboseResult) Receive

Receive waits for the response promised by the future and returns the data structure from the server with information about the requested block.

type FutureGetCFilterV2Result

type FutureGetCFilterV2Result cmdRes

FutureGetCFilterV2Result is a future promise to deliver the result of a GetCFilterV2Async RPC invocation (or an applicable error).

func (*FutureGetCFilterV2Result) Receive

Receive waits for the response promised by the future and returns the discovered rescan data.

type FutureGetChainTipsResult

type FutureGetChainTipsResult cmdRes

FutureGetChainTipsResult is a future promise to deliver the result of a GetChainTipsAsync RPC invocation (or an applicable error).

func (*FutureGetChainTipsResult) Receive

Receive waits for the response promised by the future and returns slice of all known tips in the block tree.

type FutureGetCoinSupplyResult

type FutureGetCoinSupplyResult cmdRes

FutureGetCoinSupplyResult is a future promise to deliver the result of a GetCoinSupplyAsync RPC invocation (or an applicable error).

func (*FutureGetCoinSupplyResult) Receive

func (r *FutureGetCoinSupplyResult) Receive() (dcrutil.Amount, error)

Receive waits for the response promised by the future and returns the current coin supply

type FutureGetConnectionCountResult

type FutureGetConnectionCountResult cmdRes

FutureGetConnectionCountResult is a future promise to deliver the result of a GetConnectionCountAsync RPC invocation (or an applicable error).

func (*FutureGetConnectionCountResult) Receive

func (r *FutureGetConnectionCountResult) Receive() (int64, error)

Receive waits for the response promised by the future and returns the number of active connections to other peers.

type FutureGetCurrentNetResult

type FutureGetCurrentNetResult cmdRes

FutureGetCurrentNetResult is a future promise to deliver the result of a GetCurrentNetAsync RPC invocation (or an applicable error).

func (*FutureGetCurrentNetResult) Receive

func (r *FutureGetCurrentNetResult) Receive() (wire.CurrencyNet, error)

Receive waits for the response promised by the future and returns the network the server is running on.

type FutureGetDifficultyResult

type FutureGetDifficultyResult cmdRes

FutureGetDifficultyResult is a future promise to deliver the result of a GetDifficultyAsync RPC invocation (or an applicable error).

func (*FutureGetDifficultyResult) Receive

func (r *FutureGetDifficultyResult) Receive() (float64, error)

Receive waits for the response promised by the future and returns the proof-of-work difficulty as a multiple of the minimum difficulty.

type FutureGetGenerateResult

type FutureGetGenerateResult cmdRes

FutureGetGenerateResult is a future promise to deliver the result of a GetGenerateAsync RPC invocation (or an applicable error).

func (*FutureGetGenerateResult) Receive

func (r *FutureGetGenerateResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns true if the server is set to mine, otherwise false.

type FutureGetHashesPerSecResult

type FutureGetHashesPerSecResult cmdRes

FutureGetHashesPerSecResult is a future promise to deliver the result of a GetHashesPerSecAsync RPC invocation (or an applicable error).

func (*FutureGetHashesPerSecResult) Receive

func (r *FutureGetHashesPerSecResult) Receive() (int64, error)

Receive waits for the response promised by the future and returns a recent hashes per second performance measurement while generating coins (mining). Zero is returned if the server is not mining.

type FutureGetHeadersResult

type FutureGetHeadersResult cmdRes

FutureGetHeadersResult is a future promise to deliver the result of a getheaders RPC invocation (or an applicable error).

func (*FutureGetHeadersResult) Receive

Receive waits for the response promised by the future and returns the getheaders result.

type FutureGetInfoResult

type FutureGetInfoResult cmdRes

FutureGetInfoResult is a future promise to deliver the result of a GetInfoAsync RPC invocation (or an applicable error).

func (*FutureGetInfoResult) Receive

Receive waits for the response promised by the future and returns the info provided by the server.

type FutureGetMiningInfoResult

type FutureGetMiningInfoResult cmdRes

FutureGetMiningInfoResult is a future promise to deliver the result of a GetMiningInfoAsync RPC invocation (or an applicable error).

func (*FutureGetMiningInfoResult) Receive

Receive waits for the response promised by the future and returns the mining information.

type FutureGetNetTotalsResult

type FutureGetNetTotalsResult cmdRes

FutureGetNetTotalsResult is a future promise to deliver the result of a GetNetTotalsAsync RPC invocation (or an applicable error).

func (*FutureGetNetTotalsResult) Receive

Receive waits for the response promised by the future and returns network traffic statistics.

type FutureGetNetworkHashPS

type FutureGetNetworkHashPS cmdRes

FutureGetNetworkHashPS is a future promise to deliver the result of a GetNetworkHashPSAsync RPC invocation (or an applicable error).

func (*FutureGetNetworkHashPS) Receive

func (r *FutureGetNetworkHashPS) Receive() (int64, error)

Receive waits for the response promised by the future and returns the estimated network hashes per second for the block heights provided by the parameters.

type FutureGetNetworkInfoResult

type FutureGetNetworkInfoResult cmdRes

FutureGetNetworkInfoResult is a future promise to deliver the result of a GetNetworkInfo RPC invocation (or an applicable error).

func (*FutureGetNetworkInfoResult) Receive

Receive waits for the response promised by the future and returns data related to network of the underlying node instance.

type FutureGetPeerInfoResult

type FutureGetPeerInfoResult cmdRes

FutureGetPeerInfoResult is a future promise to deliver the result of a GetPeerInfoAsync RPC invocation (or an applicable error).

func (*FutureGetPeerInfoResult) Receive

Receive waits for the response promised by the future and returns data about each connected network peer.

type FutureGetRawMempoolResult

type FutureGetRawMempoolResult cmdRes

FutureGetRawMempoolResult is a future promise to deliver the result of a GetRawMempoolAsync RPC invocation (or an applicable error).

func (*FutureGetRawMempoolResult) Receive

func (r *FutureGetRawMempoolResult) Receive() ([]*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the hashes of all transactions in the memory pool.

type FutureGetRawMempoolVerboseResult

type FutureGetRawMempoolVerboseResult cmdRes

FutureGetRawMempoolVerboseResult is a future promise to deliver the result of a GetRawMempoolVerboseAsync RPC invocation (or an applicable error).

func (*FutureGetRawMempoolVerboseResult) Receive

Receive waits for the response promised by the future and returns a map of transaction hashes to an associated data structure with information about the transaction for all transactions in the memory pool.

type FutureGetRawTransactionResult

type FutureGetRawTransactionResult cmdRes

FutureGetRawTransactionResult is a future promise to deliver the result of a GetRawTransactionAsync RPC invocation (or an applicable error).

func (*FutureGetRawTransactionResult) Receive

func (r *FutureGetRawTransactionResult) Receive() (*dcrutil.Tx, error)

Receive waits for the response promised by the future and returns a transaction given its hash.

type FutureGetRawTransactionVerboseResult

type FutureGetRawTransactionVerboseResult cmdRes

FutureGetRawTransactionVerboseResult is a future promise to deliver the result of a GetRawTransactionVerboseAsync RPC invocation (or an applicable error).

func (*FutureGetRawTransactionVerboseResult) Receive

Receive waits for the response promised by the future and returns information about a transaction given its hash.

type FutureGetStakeDifficultyResult

type FutureGetStakeDifficultyResult cmdRes

FutureGetStakeDifficultyResult is a future promise to deliver the result of a GetStakeDifficultyAsync RPC invocation (or an applicable error).

func (*FutureGetStakeDifficultyResult) Receive

Receive waits for the response promised by the future and returns the getstakedifficulty result.

type FutureGetStakeVersionInfoResult

type FutureGetStakeVersionInfoResult cmdRes

FutureGetStakeVersionInfoResult is a future promise to deliver the result of a GetStakeVersionInfoAsync RPC invocation (or an applicable error).

func (*FutureGetStakeVersionInfoResult) Receive

Receive waits for the response promised by the future and returns the getstakeversioninfo result.

type FutureGetStakeVersionsResult

type FutureGetStakeVersionsResult cmdRes

FutureGetStakeVersionsResult is a future promise to deliver the result of a GetStakeVersionsAsync RPC invocation (or an applicable error).

func (*FutureGetStakeVersionsResult) Receive

Receive waits for the response promised by the future and returns the getstakeversions result.

type FutureGetTicketPoolValueResult

type FutureGetTicketPoolValueResult cmdRes

FutureGetTicketPoolValueResult is a future promise to deliver the result of a GetTicketPoolValueAsync RPC invocation (or an applicable error).

func (*FutureGetTicketPoolValueResult) Receive

func (r *FutureGetTicketPoolValueResult) Receive() (dcrutil.Amount, error)

Receive waits for the response promised by the future and returns the total value of the live ticket pool.

type FutureGetTreasuryBalanceResult

type FutureGetTreasuryBalanceResult cmdRes

FutureGetTreasuryBalanceResult is a future promise to deliver the result of a GetTreasuryBalanceAsync RPC invocation (or an applicable error).

func (*FutureGetTreasuryBalanceResult) Receive

Receive waits for the response promised by the future and returns the gettreasurybalance result.

type FutureGetTreasurySpendVotesResult

type FutureGetTreasurySpendVotesResult cmdRes

FutureGetTreasurySpendVotesResult is a future promise to deliver the result of a GetTreasurySpendVotesAsync RPC invocation (or an applicable error).

func (*FutureGetTreasurySpendVotesResult) Receive

Receive waits for the response promised by the future and returns the gettreasuryspendvotes result.

type FutureGetTxOutResult

type FutureGetTxOutResult cmdRes

FutureGetTxOutResult is a future promise to deliver the result of a GetTxOutAsync RPC invocation (or an applicable error).

func (*FutureGetTxOutResult) Receive

Receive waits for the response promised by the future and returns a transaction given its hash.

type FutureGetVoteInfoResult

type FutureGetVoteInfoResult cmdRes

FutureGetVoteInfoResult is a future promise to deliver the result of a GetVoteInfoAsync RPC invocation (or an applicable error).

func (*FutureGetVoteInfoResult) Receive

Receive waits for the response promised by the future and returns the getvoteinfo result.

type FutureGetWork

type FutureGetWork cmdRes

FutureGetWork is a future promise to deliver the result of a GetWorkAsync RPC invocation (or an applicable error).

func (*FutureGetWork) Receive

func (r *FutureGetWork) Receive() (*chainjson.GetWorkResult, error)

Receive waits for the response promised by the future and returns the hash data to work on.

type FutureGetWorkSubmit

type FutureGetWorkSubmit cmdRes

FutureGetWorkSubmit is a future promise to deliver the result of a GetWorkSubmitAsync RPC invocation (or an applicable error).

func (*FutureGetWorkSubmit) Receive

func (r *FutureGetWorkSubmit) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not the submitted block header was accepted.

type FutureLiveTicketsResult

type FutureLiveTicketsResult cmdRes

FutureLiveTicketsResult is a future promise to deliver the result of a FutureLiveTicketsResultAsync RPC invocation (or an applicable error).

func (*FutureLiveTicketsResult) Receive

func (r *FutureLiveTicketsResult) Receive() ([]*chainhash.Hash, error)

Receive waits for the response promised by the future and returns all currently live tickets from the live ticket database.

type FutureLoadTxFilterResult

type FutureLoadTxFilterResult cmdRes

FutureLoadTxFilterResult is a future promise to deliver the result of a LoadTxFilterAsync RPC invocation (or an applicable error).

func (*FutureLoadTxFilterResult) Receive

func (r *FutureLoadTxFilterResult) Receive() error

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureMissedTicketsResult

type FutureMissedTicketsResult cmdRes

FutureMissedTicketsResult is a future promise to deliver the result of a FutureMissedTicketsResultAsync RPC invocation (or an applicable error).

func (*FutureMissedTicketsResult) Receive

func (r *FutureMissedTicketsResult) Receive() ([]*chainhash.Hash, error)

Receive waits for the response promised by the future and returns all currently missed tickets from the missed ticket database.

type FutureNotifyBlocksResult

type FutureNotifyBlocksResult cmdRes

FutureNotifyBlocksResult is a future promise to deliver the result of a NotifyBlocksAsync RPC invocation (or an applicable error).

func (*FutureNotifyBlocksResult) Receive

func (r *FutureNotifyBlocksResult) Receive() error

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyNewTicketsResult

type FutureNotifyNewTicketsResult cmdRes

FutureNotifyNewTicketsResult is a future promise to deliver the result of a NotifyNewTicketsAsync RPC invocation (or an applicable error).

func (*FutureNotifyNewTicketsResult) Receive

func (r *FutureNotifyNewTicketsResult) Receive() error

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyNewTransactionsResult

type FutureNotifyNewTransactionsResult cmdRes

FutureNotifyNewTransactionsResult is a future promise to deliver the result of a NotifyNewTransactionsAsync RPC invocation (or an applicable error).

func (*FutureNotifyNewTransactionsResult) Receive

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifySpentAndMissedTicketsResult

type FutureNotifySpentAndMissedTicketsResult cmdRes

FutureNotifySpentAndMissedTicketsResult is a future promise to deliver the result of a NotifySpentAndMissedTicketsAsync RPC invocation (or an applicable error).

func (*FutureNotifySpentAndMissedTicketsResult) Receive

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyTSpendResult

type FutureNotifyTSpendResult cmdRes

FutureNotifyTSpendResult is a future promise to deliver the result of a NotifyTSpendAsync RPC invocation (or an applicable error).

func (*FutureNotifyTSpendResult) Receive

func (r *FutureNotifyTSpendResult) Receive() error

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyWinningTicketsResult

type FutureNotifyWinningTicketsResult cmdRes

FutureNotifyWinningTicketsResult is a future promise to deliver the result of a NotifyWinningTicketsAsync RPC invocation (or an applicable error).

func (*FutureNotifyWinningTicketsResult) Receive

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyWorkResult

type FutureNotifyWorkResult cmdRes

FutureNotifyWorkResult is a future promise to deliver the result of a NotifyWorkAsync RPC invocation (or an applicable error).

func (*FutureNotifyWorkResult) Receive

func (r *FutureNotifyWorkResult) Receive() error

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FuturePingResult

type FuturePingResult cmdRes

FuturePingResult is a future promise to deliver the result of a PingAsync RPC invocation (or an applicable error).

func (*FuturePingResult) Receive

func (r *FuturePingResult) Receive() error

Receive waits for the response promised by the future and returns the result of queueing a ping to be sent to each connected peer.

type FutureRawResult

type FutureRawResult cmdRes

FutureRawResult is a future promise to deliver the result of a RawRequest RPC invocation (or an applicable error).

func (*FutureRawResult) Receive

func (r *FutureRawResult) Receive() (json.RawMessage, error)

Receive waits for the response promised by the future and returns the raw response, or an error if the request was unsuccessful.

type FutureRegenTemplateResult

type FutureRegenTemplateResult cmdRes

FutureRegenTemplateResult is a future promise to deliver the result of a RegenTemplate RPC invocation (or an applicable error).

func (*FutureRegenTemplateResult) Receive

func (r *FutureRegenTemplateResult) Receive() error

Receive waits for the response and returns an error if any has occurred.

type FutureRescanResult

type FutureRescanResult cmdRes

FutureRescanResult is a future promise to deliver the result of a RescanAsynnc RPC invocation (or an applicable error).

func (*FutureRescanResult) Receive

Receive waits for the response promised by the future and returns the discovered rescan data.

type FutureSearchRawTransactionsResult

type FutureSearchRawTransactionsResult cmdRes

FutureSearchRawTransactionsResult is a future promise to deliver the result of the SearchRawTransactionsAsync RPC invocation (or an applicable error).

func (*FutureSearchRawTransactionsResult) Receive

func (r *FutureSearchRawTransactionsResult) Receive() ([]*wire.MsgTx, error)

Receive waits for the response promised by the future and returns the found raw transactions.

type FutureSearchRawTransactionsVerboseResult

type FutureSearchRawTransactionsVerboseResult cmdRes

FutureSearchRawTransactionsVerboseResult is a future promise to deliver the result of the SearchRawTransactionsVerboseAsync RPC invocation (or an applicable error).

func (*FutureSearchRawTransactionsVerboseResult) Receive

Receive waits for the response promised by the future and returns the found raw transactions.

type FutureSendRawTransactionResult

type FutureSendRawTransactionResult cmdRes

FutureSendRawTransactionResult is a future promise to deliver the result of a SendRawTransactionAsync RPC invocation (or an applicable error).

func (*FutureSendRawTransactionResult) Receive

func (r *FutureSendRawTransactionResult) Receive() (*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the result of submitting the encoded transaction to the server which then relays it to the network.

type FutureSessionResult

type FutureSessionResult cmdRes

FutureSessionResult is a future promise to deliver the result of a SessionAsync RPC invocation (or an applicable error).

func (*FutureSessionResult) Receive

Receive waits for the response promised by the future and returns the session result.

type FutureSetGenerateResult

type FutureSetGenerateResult cmdRes

FutureSetGenerateResult is a future promise to deliver the result of a SetGenerateAsync RPC invocation (or an applicable error).

func (*FutureSetGenerateResult) Receive

func (r *FutureSetGenerateResult) Receive() error

Receive waits for the response promised by the future and returns an error if any occurred when setting the server to generate coins (mine) or not.

type FutureSubmitBlockResult

type FutureSubmitBlockResult cmdRes

FutureSubmitBlockResult is a future promise to deliver the result of a SubmitBlockAsync RPC invocation (or an applicable error).

func (*FutureSubmitBlockResult) Receive

func (r *FutureSubmitBlockResult) Receive() error

Receive waits for the response promised by the future and returns an error if any occurred when submitting the block.

type FutureTicketFeeInfoResult

type FutureTicketFeeInfoResult cmdRes

FutureTicketFeeInfoResult is a future promise to deliver the result of a TicketFeeInfoAsync RPC invocation (or an applicable error).

func (*FutureTicketFeeInfoResult) Receive

Receive waits for the response promised by the future and returns the ticketfeeinfo result.

type FutureTicketVWAPResult

type FutureTicketVWAPResult cmdRes

FutureTicketVWAPResult is a future promise to deliver the result of a TicketVWAPAsync RPC invocation (or an applicable error).

func (*FutureTicketVWAPResult) Receive

func (r *FutureTicketVWAPResult) Receive() (dcrutil.Amount, error)

Receive waits for the response promised by the future and returns the vwap average price of tickets.

type FutureTxFeeInfoResult

type FutureTxFeeInfoResult cmdRes

FutureTxFeeInfoResult is a future promise to deliver the result of a TxFeeInfoAsync RPC invocation (or an applicable error).

func (*FutureTxFeeInfoResult) Receive

Receive waits for the response promised by the future and returns the txfeeinfo result.

type FutureValidateAddressResult

type FutureValidateAddressResult cmdRes

FutureValidateAddressResult is a future promise to deliver the result of a ValidateAddressAsync RPC invocation (or an applicable error).

func (*FutureValidateAddressResult) Receive

Receive waits for the response promised by the future and returns information about the given Decred address.

type FutureVerifyChainResult

type FutureVerifyChainResult cmdRes

FutureVerifyChainResult is a future promise to deliver the result of a VerifyChainAsync, VerifyChainLevelAsyncRPC, or VerifyChainBlocksAsync invocation (or an applicable error).

func (*FutureVerifyChainResult) Receive

func (r *FutureVerifyChainResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not the chain verified based on the check level and number of blocks to verify specified in the original call.

type FutureVerifyMessageResult

type FutureVerifyMessageResult cmdRes

FutureVerifyMessageResult is a future promise to deliver the result of a VerifyMessageAsync RPC invocation (or an applicable error).

func (*FutureVerifyMessageResult) Receive

func (r *FutureVerifyMessageResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not the message was successfully verified.

type FutureVersionResult

type FutureVersionResult cmdRes

FutureVersionResult is a future promise to deliver the result of a version RPC invocation (or an applicable error).

func (*FutureVersionResult) Receive

Receive waits for the response promised by the future and returns the version result.

type NotificationHandlers

type NotificationHandlers struct {
	// OnClientConnected is invoked when the client connects or reconnects
	// to the RPC server.  This callback is run async with the rest of the
	// notification handlers, and is safe for blocking client requests.
	OnClientConnected func()

	// OnBlockConnected is invoked when a block is connected to the longest
	// (best) chain.  It will only be invoked if a preceding call to
	// NotifyBlocks has been made to register for the notification and the
	// function is non-nil.
	OnBlockConnected func(blockHeader []byte, transactions [][]byte)

	// OnBlockDisconnected is invoked when a block is disconnected from the
	// longest (best) chain.  It will only be invoked if a preceding call to
	// NotifyBlocks has been made to register for the notification and the
	// function is non-nil.
	OnBlockDisconnected func(blockHeader []byte)

	// OnWork is invoked when a new block template is generated.
	// It will only be invoked if a preceding call to NotifyWork has
	// been made to register for the notification and the function is non-nil.
	OnWork func(data []byte, target []byte, reason string)

	// OnTSpend is invoked when a new tspend arrives in the mempool.  It
	// will only be invoked if a preceding call to NotifyTSpend has been
	// made to register for the notification and the function is non-nil.
	OnTSpend func(tspend []byte)

	// OnRelevantTxAccepted is invoked when an unmined transaction passes
	// the client's transaction filter.
	OnRelevantTxAccepted func(transaction []byte)

	// OnReorganization is invoked when the blockchain begins reorganizing.
	// It will only be invoked if a preceding call to NotifyBlocks has been
	// made to register for the notification and the function is non-nil.
	OnReorganization func(oldHash *chainhash.Hash, oldHeight int32,
		newHash *chainhash.Hash, newHeight int32)

	// OnWinningTickets is invoked when a block is connected and eligible tickets
	// to be voted on for this chain are given.  It will only be invoked if a
	// preceding call to NotifyWinningTickets has been made to register for the
	// notification and the function is non-nil.
	OnWinningTickets func(blockHash *chainhash.Hash,
		blockHeight int64,
		tickets []*chainhash.Hash)

	// OnSpentAndMissedTickets is invoked when a block is connected to the
	// longest (best) chain and tickets are spent or missed.  It will only be
	// invoked if a preceding call to NotifySpentAndMissedTickets has been made to
	// register for the notification and the function is non-nil.
	OnSpentAndMissedTickets func(hash *chainhash.Hash,
		height int64,
		stakeDiff int64,
		tickets map[chainhash.Hash]bool)

	// OnNewTickets is invoked when a block is connected to the longest (best)
	// chain and tickets have matured to become active.  It will only be invoked
	// if a preceding call to NotifyNewTickets has been made to register for the
	// notification and the function is non-nil.
	OnNewTickets func(hash *chainhash.Hash,
		height int64,
		stakeDiff int64,
		tickets []*chainhash.Hash)

	// OnTxAccepted is invoked when a transaction is accepted into the
	// memory pool.  It will only be invoked if a preceding call to
	// NotifyNewTransactions with the verbose flag set to false has been
	// made to register for the notification and the function is non-nil.
	OnTxAccepted func(hash *chainhash.Hash, amount dcrutil.Amount)

	// OnTxAccepted is invoked when a transaction is accepted into the
	// memory pool.  It will only be invoked if a preceding call to
	// NotifyNewTransactions with the verbose flag set to true has been
	// made to register for the notification and the function is non-nil.
	OnTxAcceptedVerbose func(txDetails *chainjson.TxRawResult)

	// OnUnknownNotification is invoked when an unrecognized notification
	// is received.  This typically means the notification handling code
	// for this package needs to be updated for a new notification type or
	// the caller is using a custom notification this package does not know
	// about.
	OnUnknownNotification func(method string, params []json.RawMessage)
}

NotificationHandlers defines callback function pointers to invoke with notifications. Since all of the functions are nil by default, all notifications are effectively ignored until their handlers are set to a concrete callback.

NOTE: Unless otherwise documented, these handlers must NOT directly call any blocking calls on the client instance since the input reader goroutine blocks until the callback has completed. Doing so will result in a deadlock situation.

type SStxCommitOut

type SStxCommitOut struct {
	Addr       stdaddr.Address
	CommitAmt  dcrutil.Amount
	ChangeAddr stdaddr.Address
	ChangeAmt  dcrutil.Amount
}

SStxCommitOut represents the output to an SStx transaction. Specifically a a commitment address and amount, and a change address and amount. Same name as the JSON lib, but different internal structures.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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