types

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: 2 Imported by: 26

README

jsonrpc/types

Build Status ISC License Doc

Package types implements concrete types for marshalling to and from the dcrd JSON-RPC commands, return values, and notifications. A comprehensive suite of tests is provided to ensure proper functionality.

The provided types are automatically registered with dcrjson when the package is imported. Although this package was primarily written for dcrd, it has intentionally been designed so it can be used as a standalone package for any projects needing to marshal to and from dcrd JSON-RPC requests and responses.

Installation and Updating

$ go get -u github.com/Decred-Next/dcrnd/rpc/jsonrpc/types

License

Package types is licensed under the copyfree ISC License.

Documentation

Overview

Package types implements concrete types for marshalling to and from the dcrd JSON-RPC commands, return values, and notifications.

When communicating via the JSON-RPC protocol, all requests and responses must be marshalled to and from the wire in the appropriate format. This package provides data structures and primitives that are registered with dcrjson to ease this process. An overview specific to this package is provided here, however it is also instructive to read the documentation for the dcrjson package (https://pkg.go.dev/github.com/Decred-Next/dcrnd/dcrjson/v3).

Marshalling and Unmarshalling

The types in this package map to the required parts of the protocol as discussed in the dcrjson documentation

  • Request Objects (type Request)
  • Commands (type <Foo>Cmd)
  • Notifications (type <Foo>Ntfn)
  • Response Objects (type Response)
  • Result (type <Foo>Result)

To simplify the marshalling of the requests and responses, the dcrjson.MarshalCmd and dcrjson.MarshalResponse functions may be used. They return the raw bytes ready to be sent across the wire.

Unmarshalling a received Request object is a two step process:

  1. Unmarshal the raw bytes into a dcrjson.Request struct instance via json.Unmarshal
  2. Use dcrjson.ParseParams on the Method and Params fields of the unmarshalled Request to create a concrete command or notification instance with all struct fields set accordingly.

This approach is used since it provides the caller with access to the additional fields in the request that are not part of the command such as the ID.

Unmarshalling a received Response object is also a two step process:

  1. Unmarshal the raw bytes into a dcrjson.Response struct instance via json.Unmarshal
  2. Depending on the ID, unmarshal the Result field of the unmarshalled Response to create a concrete type instance

As above, this approach is used since it provides the caller with access to the fields in the response such as the ID and Error.

Command Creation

This package provides two approaches for creating a new command. This first, and preferred, method is to use one of the New<Foo>Cmd functions. This allows static compile-time checking to help ensure the parameters stay in sync with the struct definitions.

The second approach is the dcrjson.NewCmd function which takes a method (command) name and variable arguments. Since this package registers all of its types with dcrjson, the function will recognize them and includes full checking to ensure the parameters are accurate according to provided method, however these checks are, obviously, run-time which means any mistakes won't be found until the code is actually executed. However, it is quite useful for user-supplied commands that are intentionally dynamic.

Help Generation

To facilitate providing consistent help to users of the RPC server, the dcrjson package exposes the GenerateHelp and function which uses reflection on commands and notifications registered by this package, as well as the provided expected result types, to generate the final help text.

In addition, the dcrjson.MethodUsageText function may be used to generate consistent one-line usage for registered commands and notifications using reflection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddNodeCmd

type AddNodeCmd struct {
	Addr   string
	SubCmd AddNodeSubCmd `jsonrpcusage:"\"add|remove|onetry\""`
}

AddNodeCmd defines the addnode JSON-RPC command.

func NewAddNodeCmd

func NewAddNodeCmd(addr string, subCmd AddNodeSubCmd) *AddNodeCmd

NewAddNodeCmd returns a new instance which can be used to issue an addnode JSON-RPC command.

type AddNodeSubCmd

type AddNodeSubCmd string

AddNodeSubCmd defines the type used in the addnode JSON-RPC command for the sub command field.

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

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

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

type Agenda

type Agenda struct {
	ID             string   `json:"id"`
	Description    string   `json:"description"`
	Mask           uint16   `json:"mask"`
	StartTime      uint64   `json:"starttime"`
	ExpireTime     uint64   `json:"expiretime"`
	Status         string   `json:"status"`
	QuorumProgress float64  `json:"quorumprogress"`
	Choices        []Choice `json:"choices"`
}

Agenda models an individual agenda including its choices.

type AgendaInfo

type AgendaInfo struct {
	Status     string `json:"status"`
	Since      int64  `json:"since,omitempty"`
	StartTime  uint64 `json:"starttime"`
	ExpireTime uint64 `json:"expiretime"`
}

AgendaInfo provides an overview of an agenda in a consensus deployment.

type AuthenticateCmd

type AuthenticateCmd struct {
	Username   string
	Passphrase string
}

AuthenticateCmd defines the authenticate JSON-RPC command.

func NewAuthenticateCmd

func NewAuthenticateCmd(username, passphrase string) *AuthenticateCmd

NewAuthenticateCmd returns a new instance which can be used to issue an authenticate JSON-RPC command.

type BlockConnectedNtfn

type BlockConnectedNtfn struct {
	Header        string   `json:"header"`
	SubscribedTxs []string `json:"subscribedtxs"`
}

BlockConnectedNtfn defines the blockconnected JSON-RPC notification.

func NewBlockConnectedNtfn

func NewBlockConnectedNtfn(header string, subscribedTxs []string) *BlockConnectedNtfn

NewBlockConnectedNtfn returns a new instance which can be used to issue a blockconnected JSON-RPC notification.

type BlockDisconnectedNtfn

type BlockDisconnectedNtfn struct {
	Header string `json:"header"`
}

BlockDisconnectedNtfn defines the blockdisconnected JSON-RPC notification.

func NewBlockDisconnectedNtfn

func NewBlockDisconnectedNtfn(header string) *BlockDisconnectedNtfn

NewBlockDisconnectedNtfn returns a new instance which can be used to issue a blockdisconnected JSON-RPC notification.

type Choice

type Choice struct {
	ID          string  `json:"id"`
	Description string  `json:"description"`
	Bits        uint16  `json:"bits"`
	IsAbstain   bool    `json:"isabstain"`
	IsNo        bool    `json:"isno"`
	Count       uint32  `json:"count"`
	Progress    float64 `json:"progress"`
}

Choice models an individual choice inside an Agenda.

type CreateRawSSRtxCmd

type CreateRawSSRtxCmd struct {
	Inputs []TransactionInput `jsonrpcusage:"[{\"amount\":n.nnn,\"txid\":\"value\",\"vout\":n,\"tree\":n}]"` // only one input is accepted
	Fee    *float64
}

CreateRawSSRtxCmd is a type handling custom marshaling and unmarshaling of createrawssrtx JSON RPC commands.

func NewCreateRawSSRtxCmd

func NewCreateRawSSRtxCmd(inputs []TransactionInput, fee *float64) *CreateRawSSRtxCmd

NewCreateRawSSRtxCmd creates a new CreateRawSSRtxCmd.

type CreateRawSStxCmd

type CreateRawSStxCmd struct {
	Inputs []SStxInput
	Amount map[string]int64 `jsonrpcusage:"{\"address\":amount}"` // in atoms
	COuts  []SStxCommitOut
}

CreateRawSStxCmd is a type handling custom marshaling and unmarshaling of createrawsstx JSON RPC commands.

func NewCreateRawSStxCmd

func NewCreateRawSStxCmd(inputs []SStxInput, amount map[string]int64,
	couts []SStxCommitOut) *CreateRawSStxCmd

NewCreateRawSStxCmd creates a new CreateRawSStxCmd.

type CreateRawTransactionCmd

type CreateRawTransactionCmd struct {
	Inputs   []TransactionInput
	Amounts  map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In DCR
	LockTime *int64
	Expiry   *int64
}

CreateRawTransactionCmd defines the createrawtransaction JSON-RPC command.

func NewCreateRawTransactionCmd

func NewCreateRawTransactionCmd(inputs []TransactionInput, amounts map[string]float64,
	lockTime *int64, expiry *int64) *CreateRawTransactionCmd

NewCreateRawTransactionCmd returns a new instance which can be used to issue a createrawtransaction JSON-RPC command.

Amounts are in DCR.

type DebugLevelCmd

type DebugLevelCmd struct {
	LevelSpec string
}

DebugLevelCmd defines the debuglevel JSON-RPC command. This command is not a standard Bitcoin command. It is an extension for btcd.

func NewDebugLevelCmd

func NewDebugLevelCmd(levelSpec string) *DebugLevelCmd

NewDebugLevelCmd returns a new DebugLevelCmd which can be used to issue a debuglevel JSON-RPC command. This command is not a standard Bitcoin command. It is an extension for btcd.

type DecodeRawTransactionCmd

type DecodeRawTransactionCmd struct {
	HexTx string
}

DecodeRawTransactionCmd defines the decoderawtransaction JSON-RPC command.

func NewDecodeRawTransactionCmd

func NewDecodeRawTransactionCmd(hexTx string) *DecodeRawTransactionCmd

NewDecodeRawTransactionCmd returns a new instance which can be used to issue a decoderawtransaction JSON-RPC command.

type DecodeScriptCmd

type DecodeScriptCmd struct {
	HexScript string
	Version   *uint16
}

DecodeScriptCmd defines the decodescript JSON-RPC command.

func NewDecodeScriptCmd

func NewDecodeScriptCmd(hexScript string) *DecodeScriptCmd

NewDecodeScriptCmd returns a new instance which can be used to issue a decodescript JSON-RPC command.

type DecodeScriptResult

type DecodeScriptResult struct {
	Asm       string   `json:"asm"`
	ReqSigs   int32    `json:"reqSigs,omitempty"`
	Type      string   `json:"type"`
	Addresses []string `json:"addresses,omitempty"`
	P2sh      string   `json:"p2sh,omitempty"`
}

DecodeScriptResult models the data returned from the decodescript command.

type EstimateFeeCmd

type EstimateFeeCmd struct {
	NumBlocks int64
}

EstimateFeeCmd defines the estimatefee JSON-RPC command.

func NewEstimateFeeCmd

func NewEstimateFeeCmd(numBlocks int64) *EstimateFeeCmd

NewEstimateFeeCmd returns a new instance which can be used to issue an estimatefee JSON-RPC command.

type EstimateSmartFeeCmd

type EstimateSmartFeeCmd struct {
	Confirmations int64
	Mode          *EstimateSmartFeeMode `jsonrpcdefault:"\"conservative\""`
}

EstimateSmartFeeCmd defines the estimatesmartfee JSON-RPC command.

func NewEstimateSmartFeeCmd

func NewEstimateSmartFeeCmd(confirmations int64, mode *EstimateSmartFeeMode) *EstimateSmartFeeCmd

NewEstimateSmartFeeCmd returns a new instance which can be used to issue an estimatesmartfee JSON-RPC command.

type EstimateSmartFeeMode

type EstimateSmartFeeMode string

EstimateSmartFeeMode defines estimation mode to be used with the estimatesmartfee command.

const (
	// EstimateSmartFeeEconomical returns an
	// economical result.
	EstimateSmartFeeEconomical EstimateSmartFeeMode = "economical"

	// EstimateSmartFeeConservative potentially returns
	// a conservative result.
	EstimateSmartFeeConservative EstimateSmartFeeMode = "conservative"
)

func EstimateSmartFeeModeAddr

func EstimateSmartFeeModeAddr(v EstimateSmartFeeMode) *EstimateSmartFeeMode

EstimateSmartFeeModeAddr is a helper routine that allocates a new EstimateSmartFeeMode value to store v and returns a pointer to it. This is useful when assigning optional parameters.

type EstimateSmartFeeResult

type EstimateSmartFeeResult struct {
	FeeRate float64  `json:"feerate"`
	Errors  []string `json:"errors"`
	Blocks  int64    `json:"blocks"`
}

EstimateSmartFeeResult models the data returned from the estimatesmartfee command.

NOTE: EstimateSmartFee currently returns a float. This result type is unused.

TODO: Rework EstimateSmartFee to return this result type.

type EstimateStakeDiffCmd

type EstimateStakeDiffCmd struct {
	Tickets *uint32
}

EstimateStakeDiffCmd defines the eststakedifficulty JSON-RPC command.

func NewEstimateStakeDiffCmd

func NewEstimateStakeDiffCmd(tickets *uint32) *EstimateStakeDiffCmd

NewEstimateStakeDiffCmd defines the eststakedifficulty JSON-RPC command.

type EstimateStakeDiffResult

type EstimateStakeDiffResult struct {
	Min      float64  `json:"min"`
	Max      float64  `json:"max"`
	Expected float64  `json:"expected"`
	User     *float64 `json:"user,omitempty"`
}

EstimateStakeDiffResult models the data returned from the estimatestakediff command.

type ExistsAddressCmd

type ExistsAddressCmd struct {
	Address string
}

ExistsAddressCmd defines the existsaddress JSON-RPC command.

func NewExistsAddressCmd

func NewExistsAddressCmd(address string) *ExistsAddressCmd

NewExistsAddressCmd returns a new instance which can be used to issue a existsaddress JSON-RPC command.

type ExistsAddressesCmd

type ExistsAddressesCmd struct {
	Addresses []string
}

ExistsAddressesCmd defines the existsaddresses JSON-RPC command.

func NewExistsAddressesCmd

func NewExistsAddressesCmd(addresses []string) *ExistsAddressesCmd

NewExistsAddressesCmd returns a new instance which can be used to issue an existsaddresses JSON-RPC command.

type ExistsExpiredTicketsCmd

type ExistsExpiredTicketsCmd struct {
	TxHashes []string
}

ExistsExpiredTicketsCmd defines the existsexpiredtickets JSON-RPC command.

func NewExistsExpiredTicketsCmd

func NewExistsExpiredTicketsCmd(txHashes []string) *ExistsExpiredTicketsCmd

NewExistsExpiredTicketsCmd returns a new instance which can be used to issue an existsexpiredtickets JSON-RPC command.

type ExistsLiveTicketCmd

type ExistsLiveTicketCmd struct {
	TxHash string
}

ExistsLiveTicketCmd defines the existsliveticket JSON-RPC command.

func NewExistsLiveTicketCmd

func NewExistsLiveTicketCmd(txHash string) *ExistsLiveTicketCmd

NewExistsLiveTicketCmd returns a new instance which can be used to issue an existsliveticket JSON-RPC command.

type ExistsLiveTicketsCmd

type ExistsLiveTicketsCmd struct {
	TxHashes []string
}

ExistsLiveTicketsCmd defines the existslivetickets JSON-RPC command.

func NewExistsLiveTicketsCmd

func NewExistsLiveTicketsCmd(txHashes []string) *ExistsLiveTicketsCmd

NewExistsLiveTicketsCmd returns a new instance which can be used to issue an existslivetickets JSON-RPC command.

type ExistsMempoolTxsCmd

type ExistsMempoolTxsCmd struct {
	TxHashes []string
}

ExistsMempoolTxsCmd defines the existsmempooltxs JSON-RPC command.

func NewExistsMempoolTxsCmd

func NewExistsMempoolTxsCmd(txHashes []string) *ExistsMempoolTxsCmd

NewExistsMempoolTxsCmd returns a new instance which can be used to issue an existsmempooltxs JSON-RPC command.

type ExistsMissedTicketsCmd

type ExistsMissedTicketsCmd struct {
	TxHashes []string
}

ExistsMissedTicketsCmd defines the existsmissedtickets JSON-RPC command.

func NewExistsMissedTicketsCmd

func NewExistsMissedTicketsCmd(txHashes []string) *ExistsMissedTicketsCmd

NewExistsMissedTicketsCmd returns a new instance which can be used to issue an existsmissedtickets JSON-RPC command.

type FeeInfoBlock

type FeeInfoBlock struct {
	Height uint32  `json:"height"`
	Number uint32  `json:"number"`
	Min    float64 `json:"min"`
	Max    float64 `json:"max"`
	Mean   float64 `json:"mean"`
	Median float64 `json:"median"`
	StdDev float64 `json:"stddev"`
}

FeeInfoBlock is ticket fee information about a block.

type FeeInfoMempool

type FeeInfoMempool struct {
	Number uint32  `json:"number"`
	Min    float64 `json:"min"`
	Max    float64 `json:"max"`
	Mean   float64 `json:"mean"`
	Median float64 `json:"median"`
	StdDev float64 `json:"stddev"`
}

FeeInfoMempool is ticket fee information about the mempool.

type FeeInfoRange

type FeeInfoRange struct {
	Number uint32  `json:"number"`
	Min    float64 `json:"min"`
	Max    float64 `json:"max"`
	Mean   float64 `json:"mean"`
	Median float64 `json:"median"`
	StdDev float64 `json:"stddev"`
}

FeeInfoRange is ticket fee information about a range.

type FeeInfoWindow

type FeeInfoWindow struct {
	StartHeight uint32  `json:"startheight"`
	EndHeight   uint32  `json:"endheight"`
	Number      uint32  `json:"number"`
	Min         float64 `json:"min"`
	Max         float64 `json:"max"`
	Mean        float64 `json:"mean"`
	Median      float64 `json:"median"`
	StdDev      float64 `json:"stddev"`
}

FeeInfoWindow is ticket fee information about an adjustment window.

type GenerateCmd

type GenerateCmd struct {
	NumBlocks uint32
}

GenerateCmd defines the generate JSON-RPC command.

func NewGenerateCmd

func NewGenerateCmd(numBlocks uint32) *GenerateCmd

NewGenerateCmd returns a new instance which can be used to issue a generate JSON-RPC command.

type GetAddedNodeInfoCmd

type GetAddedNodeInfoCmd struct {
	DNS  bool
	Node *string
}

GetAddedNodeInfoCmd defines the getaddednodeinfo JSON-RPC command.

func NewGetAddedNodeInfoCmd

func NewGetAddedNodeInfoCmd(dns bool, node *string) *GetAddedNodeInfoCmd

NewGetAddedNodeInfoCmd returns a new instance which can be used to issue a getaddednodeinfo JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetAddedNodeInfoResult

type GetAddedNodeInfoResult struct {
	AddedNode string                        `json:"addednode"`
	Connected *bool                         `json:"connected,omitempty"`
	Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"`
}

GetAddedNodeInfoResult models the data from the getaddednodeinfo command.

type GetAddedNodeInfoResultAddr

type GetAddedNodeInfoResultAddr struct {
	Address   string `json:"address"`
	Connected string `json:"connected"`
}

GetAddedNodeInfoResultAddr models the data of the addresses portion of the getaddednodeinfo command.

type GetBestBlockCmd

type GetBestBlockCmd struct{}

GetBestBlockCmd defines the getbestblock JSON-RPC command.

func NewGetBestBlockCmd

func NewGetBestBlockCmd() *GetBestBlockCmd

NewGetBestBlockCmd returns a new instance which can be used to issue a getbestblock JSON-RPC command.

type GetBestBlockHashCmd

type GetBestBlockHashCmd struct{}

GetBestBlockHashCmd defines the getbestblockhash JSON-RPC command.

func NewGetBestBlockHashCmd

func NewGetBestBlockHashCmd() *GetBestBlockHashCmd

NewGetBestBlockHashCmd returns a new instance which can be used to issue a getbestblockhash JSON-RPC command.

type GetBestBlockResult

type GetBestBlockResult struct {
	Hash   string `json:"hash"`
	Height int64  `json:"height"`
}

GetBestBlockResult models the data from the getbestblock command.

type GetBlockChainInfoCmd

type GetBlockChainInfoCmd struct{}

GetBlockChainInfoCmd defines the getblockchaininfo JSON-RPC command.

func NewGetBlockChainInfoCmd

func NewGetBlockChainInfoCmd() *GetBlockChainInfoCmd

NewGetBlockChainInfoCmd returns a new instance which can be used to issue a getblockchaininfo JSON-RPC command.

type GetBlockChainInfoResult

type GetBlockChainInfoResult struct {
	Chain                string                `json:"chain"`
	Blocks               int64                 `json:"blocks"`
	Headers              int64                 `json:"headers"`
	SyncHeight           int64                 `json:"syncheight"`
	BestBlockHash        string                `json:"bestblockhash"`
	Difficulty           uint32                `json:"difficulty"`
	DifficultyRatio      float64               `json:"difficultyratio"`
	VerificationProgress float64               `json:"verificationprogress"`
	ChainWork            string                `json:"chainwork"`
	InitialBlockDownload bool                  `json:"initialblockdownload"`
	MaxBlockSize         int64                 `json:"maxblocksize"`
	Deployments          map[string]AgendaInfo `json:"deployments"`
}

GetBlockChainInfoResult models the data returned from the getblockchaininfo command.

type GetBlockCmd

type GetBlockCmd struct {
	Hash      string
	Verbose   *bool `jsonrpcdefault:"true"`
	VerboseTx *bool `jsonrpcdefault:"false"`
}

GetBlockCmd defines the getblock JSON-RPC command.

func NewGetBlockCmd

func NewGetBlockCmd(hash string, verbose, verboseTx *bool) *GetBlockCmd

NewGetBlockCmd returns a new instance which can be used to issue a getblock JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetBlockCountCmd

type GetBlockCountCmd struct{}

GetBlockCountCmd defines the getblockcount JSON-RPC command.

func NewGetBlockCountCmd

func NewGetBlockCountCmd() *GetBlockCountCmd

NewGetBlockCountCmd returns a new instance which can be used to issue a getblockcount JSON-RPC command.

type GetBlockHashCmd

type GetBlockHashCmd struct {
	Index int64
}

GetBlockHashCmd defines the getblockhash JSON-RPC command.

func NewGetBlockHashCmd

func NewGetBlockHashCmd(index int64) *GetBlockHashCmd

NewGetBlockHashCmd returns a new instance which can be used to issue a getblockhash JSON-RPC command.

type GetBlockHeaderCmd

type GetBlockHeaderCmd struct {
	Hash    string
	Verbose *bool `jsonrpcdefault:"true"`
}

GetBlockHeaderCmd defines the getblockheader JSON-RPC command.

func NewGetBlockHeaderCmd

func NewGetBlockHeaderCmd(hash string, verbose *bool) *GetBlockHeaderCmd

NewGetBlockHeaderCmd returns a new instance which can be used to issue a getblockheader JSON-RPC command.

type GetBlockHeaderVerboseResult

type GetBlockHeaderVerboseResult struct {
	Hash          string  `json:"hash"`
	Confirmations int64   `json:"confirmations"`
	Version       int32   `json:"version"`
	MerkleRoot    string  `json:"merkleroot"`
	StakeRoot     string  `json:"stakeroot"`
	VoteBits      uint16  `json:"votebits"`
	FinalState    string  `json:"finalstate"`
	Voters        uint16  `json:"voters"`
	FreshStake    uint8   `json:"freshstake"`
	Revocations   uint8   `json:"revocations"`
	PoolSize      uint32  `json:"poolsize"`
	Bits          string  `json:"bits"`
	SBits         float64 `json:"sbits"`
	Height        uint32  `json:"height"`
	Size          uint32  `json:"size"`
	Time          int64   `json:"time"`
	Nonce         uint32  `json:"nonce"`
	ExtraData     string  `json:"extradata"`
	StakeVersion  uint32  `json:"stakeversion"`
	Difficulty    float64 `json:"difficulty"`
	ChainWork     string  `json:"chainwork"`
	PreviousHash  string  `json:"previousblockhash,omitempty"`
	NextHash      string  `json:"nextblockhash,omitempty"`
}

GetBlockHeaderVerboseResult models the data from the getblockheader command when the verbose flag is set. When the verbose flag is not set, getblockheader returns a hex-encoded string.

type GetBlockSubsidyCmd

type GetBlockSubsidyCmd struct {
	Height int64
	Voters uint16
}

GetBlockSubsidyCmd defines the getblocksubsidy JSON-RPC command.

func NewGetBlockSubsidyCmd

func NewGetBlockSubsidyCmd(height int64, voters uint16) *GetBlockSubsidyCmd

NewGetBlockSubsidyCmd returns a new instance which can be used to issue a getblocksubsidy JSON-RPC command.

type GetBlockSubsidyResult

type GetBlockSubsidyResult struct {
	Developer int64 `json:"developer"`
	PoS       int64 `json:"pos"`
	PoW       int64 `json:"pow"`
	Total     int64 `json:"total"`
}

GetBlockSubsidyResult models the data returned from the getblocksubsidy command.

type GetBlockVerboseResult

type GetBlockVerboseResult struct {
	Hash          string        `json:"hash"`
	Confirmations int64         `json:"confirmations"`
	Size          int32         `json:"size"`
	Height        int64         `json:"height"`
	Version       int32         `json:"version"`
	MerkleRoot    string        `json:"merkleroot"`
	StakeRoot     string        `json:"stakeroot"`
	Tx            []string      `json:"tx,omitempty"`
	RawTx         []TxRawResult `json:"rawtx,omitempty"`
	STx           []string      `json:"stx,omitempty"`
	RawSTx        []TxRawResult `json:"rawstx,omitempty"`
	Time          int64         `json:"time"`
	Nonce         uint32        `json:"nonce"`
	VoteBits      uint16        `json:"votebits"`
	FinalState    string        `json:"finalstate"`
	Voters        uint16        `json:"voters"`
	FreshStake    uint8         `json:"freshstake"`
	Revocations   uint8         `json:"revocations"`
	PoolSize      uint32        `json:"poolsize"`
	Bits          string        `json:"bits"`
	SBits         float64       `json:"sbits"`
	ExtraData     string        `json:"extradata"`
	StakeVersion  uint32        `json:"stakeversion"`
	Difficulty    float64       `json:"difficulty"`
	ChainWork     string        `json:"chainwork"`
	PreviousHash  string        `json:"previousblockhash"`
	NextHash      string        `json:"nextblockhash,omitempty"`
}

GetBlockVerboseResult models the data from the getblock command when the verbose flag is set. When the verbose flag is not set, getblock returns a hex-encoded string. Contains Decred additions.

type GetCFilterCmd

type GetCFilterCmd struct {
	Hash       string
	FilterType string
}

GetCFilterCmd defines the getcfilter JSON-RPC command.

func NewGetCFilterCmd

func NewGetCFilterCmd(hash string, filterType string) *GetCFilterCmd

NewGetCFilterCmd returns a new instance which can be used to issue a getcfilter JSON-RPC command.

type GetCFilterHeaderCmd

type GetCFilterHeaderCmd struct {
	Hash       string
	FilterType string
}

GetCFilterHeaderCmd defines the getcfilterheader JSON-RPC command.

func NewGetCFilterHeaderCmd

func NewGetCFilterHeaderCmd(hash string, filterType string) *GetCFilterHeaderCmd

NewGetCFilterHeaderCmd returns a new instance which can be used to issue a getcfilterheader JSON-RPC command.

type GetCFilterV2Cmd

type GetCFilterV2Cmd struct {
	BlockHash string
}

GetCFilterV2Cmd defines the getcfilterv2 JSON-RPC command.

func NewGetCFilterV2Cmd

func NewGetCFilterV2Cmd(hash string) *GetCFilterV2Cmd

NewGetCFilterV2Cmd returns a new instance which can be used to issue a getcfilterv2 JSON-RPC command.

type GetCFilterV2Result

type GetCFilterV2Result struct {
	BlockHash   string   `json:"blockhash"`
	Data        string   `json:"data"`
	ProofIndex  uint32   `json:"proofindex"`
	ProofHashes []string `json:"proofhashes"`
}

GetCFilterV2Result models the data returned from the getcfilterv2 command.

type GetChainTipsCmd

type GetChainTipsCmd struct{}

GetChainTipsCmd defines the getchaintips JSON-RPC command.

func NewGetChainTipsCmd

func NewGetChainTipsCmd() *GetChainTipsCmd

NewGetChainTipsCmd returns a new instance which can be used to issue a getchaintips JSON-RPC command.

type GetChainTipsResult

type GetChainTipsResult struct {
	Height    int64  `json:"height"`
	Hash      string `json:"hash"`
	BranchLen int64  `json:"branchlen"`
	Status    string `json:"status"`
}

GetChainTipsResult models the data returns from the getchaintips command.

type GetCoinSupplyCmd

type GetCoinSupplyCmd struct{}

GetCoinSupplyCmd defines the getcoinsupply JSON-RPC command.

func NewGetCoinSupplyCmd

func NewGetCoinSupplyCmd() *GetCoinSupplyCmd

NewGetCoinSupplyCmd returns a new instance which can be used to issue a getcoinsupply JSON-RPC command.

type GetConnectionCountCmd

type GetConnectionCountCmd struct{}

GetConnectionCountCmd defines the getconnectioncount JSON-RPC command.

func NewGetConnectionCountCmd

func NewGetConnectionCountCmd() *GetConnectionCountCmd

NewGetConnectionCountCmd returns a new instance which can be used to issue a getconnectioncount JSON-RPC command.

type GetCurrentNetCmd

type GetCurrentNetCmd struct{}

GetCurrentNetCmd defines the getcurrentnet JSON-RPC command.

func NewGetCurrentNetCmd

func NewGetCurrentNetCmd() *GetCurrentNetCmd

NewGetCurrentNetCmd returns a new instance which can be used to issue a getcurrentnet JSON-RPC command.

type GetDifficultyCmd

type GetDifficultyCmd struct{}

GetDifficultyCmd defines the getdifficulty JSON-RPC command.

func NewGetDifficultyCmd

func NewGetDifficultyCmd() *GetDifficultyCmd

NewGetDifficultyCmd returns a new instance which can be used to issue a getdifficulty JSON-RPC command.

type GetGenerateCmd

type GetGenerateCmd struct{}

GetGenerateCmd defines the getgenerate JSON-RPC command.

func NewGetGenerateCmd

func NewGetGenerateCmd() *GetGenerateCmd

NewGetGenerateCmd returns a new instance which can be used to issue a getgenerate JSON-RPC command.

type GetHashesPerSecCmd

type GetHashesPerSecCmd struct{}

GetHashesPerSecCmd defines the gethashespersec JSON-RPC command.

func NewGetHashesPerSecCmd

func NewGetHashesPerSecCmd() *GetHashesPerSecCmd

NewGetHashesPerSecCmd returns a new instance which can be used to issue a gethashespersec JSON-RPC command.

type GetHeadersCmd

type GetHeadersCmd struct {
	BlockLocators []string `json:"blocklocators"`
	HashStop      string   `json:"hashstop"`
}

GetHeadersCmd defines the getheaders JSON-RPC command.

func NewGetHeadersCmd

func NewGetHeadersCmd(blockLocators []string, hashStop string) *GetHeadersCmd

NewGetHeadersCmd returns a new instance which can be used to issue a getheaders JSON-RPC command.

type GetHeadersResult

type GetHeadersResult struct {
	Headers []string `json:"headers"`
}

GetHeadersResult models the data returned by the chain server getheaders command.

type GetInfoCmd

type GetInfoCmd struct{}

GetInfoCmd defines the getinfo JSON-RPC command.

func NewGetInfoCmd

func NewGetInfoCmd() *GetInfoCmd

NewGetInfoCmd returns a new instance which can be used to issue a getinfo JSON-RPC command.

type GetMempoolInfoCmd

type GetMempoolInfoCmd struct{}

GetMempoolInfoCmd defines the getmempoolinfo JSON-RPC command.

func NewGetMempoolInfoCmd

func NewGetMempoolInfoCmd() *GetMempoolInfoCmd

NewGetMempoolInfoCmd returns a new instance which can be used to issue a getmempool JSON-RPC command.

type GetMempoolInfoResult

type GetMempoolInfoResult struct {
	Size  int64 `json:"size"`
	Bytes int64 `json:"bytes"`
}

GetMempoolInfoResult models the data returned from the getmempoolinfo command.

type GetMiningInfoCmd

type GetMiningInfoCmd struct{}

GetMiningInfoCmd defines the getmininginfo JSON-RPC command.

func NewGetMiningInfoCmd

func NewGetMiningInfoCmd() *GetMiningInfoCmd

NewGetMiningInfoCmd returns a new instance which can be used to issue a getmininginfo JSON-RPC command.

type GetMiningInfoResult

type GetMiningInfoResult struct {
	Blocks           int64   `json:"blocks"`
	CurrentBlockSize uint64  `json:"currentblocksize"`
	CurrentBlockTx   uint64  `json:"currentblocktx"`
	Difficulty       float64 `json:"difficulty"`
	StakeDifficulty  int64   `json:"stakedifficulty"`
	Errors           string  `json:"errors"`
	Generate         bool    `json:"generate"`
	GenProcLimit     int32   `json:"genproclimit"`
	HashesPerSec     int64   `json:"hashespersec"`
	NetworkHashPS    int64   `json:"networkhashps"`
	PooledTx         uint64  `json:"pooledtx"`
	TestNet          bool    `json:"testnet"`
}

GetMiningInfoResult models the data from the getmininginfo command. Contains Decred additions.

type GetNetTotalsCmd

type GetNetTotalsCmd struct{}

GetNetTotalsCmd defines the getnettotals JSON-RPC command.

func NewGetNetTotalsCmd

func NewGetNetTotalsCmd() *GetNetTotalsCmd

NewGetNetTotalsCmd returns a new instance which can be used to issue a getnettotals JSON-RPC command.

type GetNetTotalsResult

type GetNetTotalsResult struct {
	TotalBytesRecv uint64 `json:"totalbytesrecv"`
	TotalBytesSent uint64 `json:"totalbytessent"`
	TimeMillis     int64  `json:"timemillis"`
}

GetNetTotalsResult models the data returned from the getnettotals command.

type GetNetworkHashPSCmd

type GetNetworkHashPSCmd struct {
	Blocks *int `jsonrpcdefault:"120"`
	Height *int `jsonrpcdefault:"-1"`
}

GetNetworkHashPSCmd defines the getnetworkhashps JSON-RPC command.

func NewGetNetworkHashPSCmd

func NewGetNetworkHashPSCmd(numBlocks, height *int) *GetNetworkHashPSCmd

NewGetNetworkHashPSCmd returns a new instance which can be used to issue a getnetworkhashps JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetNetworkInfoCmd

type GetNetworkInfoCmd struct{}

GetNetworkInfoCmd defines the getnetworkinfo JSON-RPC command.

func NewGetNetworkInfoCmd

func NewGetNetworkInfoCmd() *GetNetworkInfoCmd

NewGetNetworkInfoCmd returns a new instance which can be used to issue a getnetworkinfo JSON-RPC command.

type GetNetworkInfoResult

type GetNetworkInfoResult struct {
	Version         int32                  `json:"version"`
	SubVersion      string                 `json:"subversion"`
	ProtocolVersion int32                  `json:"protocolversion"`
	TimeOffset      int64                  `json:"timeoffset"`
	Connections     int32                  `json:"connections"`
	Networks        []NetworksResult       `json:"networks"`
	RelayFee        float64                `json:"relayfee"`
	LocalAddresses  []LocalAddressesResult `json:"localaddresses"`
	LocalServices   string                 `json:"localservices"`
}

GetNetworkInfoResult models the data returned from the getnetworkinfo command.

type GetPeerInfoCmd

type GetPeerInfoCmd struct{}

GetPeerInfoCmd defines the getpeerinfo JSON-RPC command.

func NewGetPeerInfoCmd

func NewGetPeerInfoCmd() *GetPeerInfoCmd

NewGetPeerInfoCmd returns a new instance which can be used to issue a getpeer JSON-RPC command.

type GetPeerInfoResult

type GetPeerInfoResult struct {
	ID             int32   `json:"id"`
	Addr           string  `json:"addr"`
	AddrLocal      string  `json:"addrlocal,omitempty"`
	Services       string  `json:"services"`
	RelayTxes      bool    `json:"relaytxes"`
	LastSend       int64   `json:"lastsend"`
	LastRecv       int64   `json:"lastrecv"`
	BytesSent      uint64  `json:"bytessent"`
	BytesRecv      uint64  `json:"bytesrecv"`
	ConnTime       int64   `json:"conntime"`
	TimeOffset     int64   `json:"timeoffset"`
	PingTime       float64 `json:"pingtime"`
	PingWait       float64 `json:"pingwait,omitempty"`
	Version        uint32  `json:"version"`
	SubVer         string  `json:"subver"`
	Inbound        bool    `json:"inbound"`
	StartingHeight int64   `json:"startingheight"`
	CurrentHeight  int64   `json:"currentheight,omitempty"`
	BanScore       int32   `json:"banscore"`
	SyncNode       bool    `json:"syncnode"`
}

GetPeerInfoResult models the data returned from the getpeerinfo command.

type GetRawMempoolCmd

type GetRawMempoolCmd struct {
	Verbose *bool `jsonrpcdefault:"false"`
	TxType  *string
}

GetRawMempoolCmd defines the getmempool JSON-RPC command.

func NewGetRawMempoolCmd

func NewGetRawMempoolCmd(verbose *bool, txType *string) *GetRawMempoolCmd

NewGetRawMempoolCmd returns a new instance which can be used to issue a getrawmempool JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetRawMempoolTxTypeCmd

type GetRawMempoolTxTypeCmd string

GetRawMempoolTxTypeCmd defines the type used in the getrawmempool JSON-RPC command for the TxType command field.

const (
	// GRMAll indicates any type of transaction should be returned.
	GRMAll GetRawMempoolTxTypeCmd = "all"

	// GRMRegular indicates only regular transactions should be returned.
	GRMRegular GetRawMempoolTxTypeCmd = "regular"

	// GRMTickets indicates that only tickets should be returned.
	GRMTickets GetRawMempoolTxTypeCmd = "tickets"

	// GRMVotes indicates that only votes should be returned.
	GRMVotes GetRawMempoolTxTypeCmd = "votes"

	// GRMRevocations indicates that only revocations should be returned.
	GRMRevocations GetRawMempoolTxTypeCmd = "revocations"

	// GRMTSpend indicates that only tspends should be returned.
	GRMTSpend GetRawMempoolTxTypeCmd = "tspend"

	// GRMTAdd indicates that only tadds should be returned.
	GRMTAdd GetRawMempoolTxTypeCmd = "tadd"
)

type GetRawMempoolVerboseResult

type GetRawMempoolVerboseResult struct {
	Size             int32    `json:"size"`
	Fee              float64  `json:"fee"`
	Time             int64    `json:"time"`
	Height           int64    `json:"height"`
	StartingPriority float64  `json:"startingpriority"`
	CurrentPriority  float64  `json:"currentpriority"`
	Depends          []string `json:"depends"`
}

GetRawMempoolVerboseResult models the data returned from the getrawmempool command when the verbose flag is set. When the verbose flag is not set, getrawmempool returns an array of transaction hashes.

type GetRawTransactionCmd

type GetRawTransactionCmd struct {
	Txid    string
	Verbose *int `jsonrpcdefault:"0"`
}

GetRawTransactionCmd defines the getrawtransaction JSON-RPC command.

NOTE: This field is an int versus a bool to remain compatible with Bitcoin Core even though it really should be a bool.

func NewGetRawTransactionCmd

func NewGetRawTransactionCmd(txHash string, verbose *int) *GetRawTransactionCmd

NewGetRawTransactionCmd returns a new instance which can be used to issue a getrawtransaction JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetStakeDifficultyCmd

type GetStakeDifficultyCmd struct{}

GetStakeDifficultyCmd is a type handling custom marshaling and unmarshaling of getstakedifficulty JSON RPC commands.

func NewGetStakeDifficultyCmd

func NewGetStakeDifficultyCmd() *GetStakeDifficultyCmd

NewGetStakeDifficultyCmd returns a new instance which can be used to issue a JSON-RPC getstakedifficulty command.

type GetStakeDifficultyResult

type GetStakeDifficultyResult struct {
	CurrentStakeDifficulty float64 `json:"current"`
	NextStakeDifficulty    float64 `json:"next"`
}

GetStakeDifficultyResult models the data returned from the getstakedifficulty command.

type GetStakeVersionInfoCmd

type GetStakeVersionInfoCmd struct {
	Count *int32
}

GetStakeVersionInfoCmd returns stake version info for the current interval. Optionally, Count indicates how many additional intervals to return.

func NewGetStakeVersionInfoCmd

func NewGetStakeVersionInfoCmd(count int32) *GetStakeVersionInfoCmd

NewGetStakeVersionInfoCmd returns a new instance which can be used to issue a JSON-RPC getstakeversioninfo command.

type GetStakeVersionInfoResult

type GetStakeVersionInfoResult struct {
	CurrentHeight int64             `json:"currentheight"`
	Hash          string            `json:"hash"`
	Intervals     []VersionInterval `json:"intervals"`
}

GetStakeVersionInfoResult models the resulting data for getstakeversioninfo command.

type GetStakeVersionsCmd

type GetStakeVersionsCmd struct {
	Hash  string
	Count int32
}

GetStakeVersionsCmd returns stake version for a range of blocks. Count indicates how many blocks are walked backwards.

func NewGetStakeVersionsCmd

func NewGetStakeVersionsCmd(hash string, count int32) *GetStakeVersionsCmd

NewGetStakeVersionsCmd returns a new instance which can be used to issue a JSON-RPC getstakeversions command.

type GetStakeVersionsResult

type GetStakeVersionsResult struct {
	StakeVersions []StakeVersions `json:"stakeversions"`
}

GetStakeVersionsResult models the data returned from the getstakeversions command.

type GetTicketPoolValueCmd

type GetTicketPoolValueCmd struct{}

GetTicketPoolValueCmd defines the getticketpoolvalue JSON-RPC command.

func NewGetTicketPoolValueCmd

func NewGetTicketPoolValueCmd() *GetTicketPoolValueCmd

NewGetTicketPoolValueCmd returns a new instance which can be used to issue a getticketpoolvalue JSON-RPC command.

type GetTreasuryBalanceCmd

type GetTreasuryBalanceCmd struct {
	Hash    *string
	Verbose *bool `jsonrpcdefault:"false"`
}

GetTreasuryBalanceCmd returns the treasury balance for the provided block hash. If no hash is provided it returns the best block treasury balance.

func NewGetTreasuryBalanceCmd

func NewGetTreasuryBalanceCmd(hash *string) *GetTreasuryBalanceCmd

NewGetTreasuryBalanceCmd returns a new instance which can be used to issue a JSON-RPC gettreasurybalance command.

type GetTreasuryBalanceResult

type GetTreasuryBalanceResult struct {
	Hash    string  `json:"hash"`
	Height  int64   `json:"height"`
	Balance uint64  `json:"balance"`
	Updates []int64 `json:"updates,omitempty"`
}

GetTreasuryBalanceResult models the data returned from the gettreasurybalance command.

type GetTreasurySpendVotesCmd

type GetTreasurySpendVotesCmd struct {
	Block   *string
	TSpends *[]string
}

GetTreasurySpendVotesCmd returns the vote count for the specified treasury spend transactions up to the specified block.

If block is not specified, then the current best block is used. If no tspends are specified, then the counts for all tspends currently in the mempool are returned.

func NewGetTreasurySpendVotesCmd

func NewGetTreasurySpendVotesCmd(block *string, tspends *[]string) *GetTreasurySpendVotesCmd

NewGetTreasurySpendVotesCmd returns a new instance which can be used to issue a JSON-RPC gettreasuryspendvotes command.

type GetTreasurySpendVotesResult

type GetTreasurySpendVotesResult struct {
	Hash   string               `json:"hash"`
	Height int64                `json:"height"`
	Votes  []TreasurySpendVotes `json:"votes"`
}

GetTreasurySpendVotesResult models the data returned from the gettreasuryspendvotes command.

type GetTxOutCmd

type GetTxOutCmd struct {
	Txid           string
	Vout           uint32
	IncludeMempool *bool `jsonrpcdefault:"true"`
}

GetTxOutCmd defines the gettxout JSON-RPC command.

func NewGetTxOutCmd

func NewGetTxOutCmd(txHash string, vout uint32, includeMempool *bool) *GetTxOutCmd

NewGetTxOutCmd returns a new instance which can be used to issue a gettxout JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetTxOutResult

type GetTxOutResult struct {
	BestBlock     string             `json:"bestblock"`
	Confirmations int64              `json:"confirmations"`
	Value         float64            `json:"value"`
	ScriptPubKey  ScriptPubKeyResult `json:"scriptPubKey"`
	Version       int32              `json:"version"`
	Coinbase      bool               `json:"coinbase"`
}

GetTxOutResult models the data from the gettxout command.

type GetTxOutSetInfoCmd

type GetTxOutSetInfoCmd struct{}

GetTxOutSetInfoCmd defines the gettxoutsetinfo JSON-RPC command.

func NewGetTxOutSetInfoCmd

func NewGetTxOutSetInfoCmd() *GetTxOutSetInfoCmd

NewGetTxOutSetInfoCmd returns a new instance which can be used to issue a gettxoutsetinfo JSON-RPC command.

type GetTxOutSetInfoResult

type GetTxOutSetInfoResult struct {
	Height         int64  `json:"height"`
	BestBlock      string `json:"bestblock"`
	Transactions   int64  `json:"transactions"`
	TxOuts         int64  `json:"txouts"`
	SerializedHash string `json:"serializedhash"`
	DiskSize       int64  `json:"disksize"`
	TotalAmount    int64  `json:"totalamount"`
}

GetTxOutSetInfoResult models the data from the gettxoutsetinfo command.

type GetVoteInfoCmd

type GetVoteInfoCmd struct {
	Version uint32
}

GetVoteInfoCmd returns voting results over a range of blocks. Count indicates how many blocks are walked backwards.

func NewGetVoteInfoCmd

func NewGetVoteInfoCmd(version uint32) *GetVoteInfoCmd

NewGetVoteInfoCmd returns a new instance which can be used to issue a JSON-RPC getvoteinfo command.

type GetVoteInfoResult

type GetVoteInfoResult struct {
	CurrentHeight int64    `json:"currentheight"`
	StartHeight   int64    `json:"startheight"`
	EndHeight     int64    `json:"endheight"`
	Hash          string   `json:"hash"`
	VoteVersion   uint32   `json:"voteversion"`
	Quorum        uint32   `json:"quorum"`
	TotalVotes    uint32   `json:"totalvotes"`
	Agendas       []Agenda `json:"agendas,omitempty"`
}

GetVoteInfoResult models the data returned from the getvoteinfo command.

type GetWorkCmd

type GetWorkCmd struct {
	Data *string
}

GetWorkCmd defines the getwork JSON-RPC command.

func NewGetWorkCmd

func NewGetWorkCmd(data *string) *GetWorkCmd

NewGetWorkCmd returns a new instance which can be used to issue a getwork JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type GetWorkResult

type GetWorkResult struct {
	Data   string `json:"data"`
	Target string `json:"target"`
}

GetWorkResult models the data from the getwork command.

type HelpCmd

type HelpCmd struct {
	Command *string
}

HelpCmd defines the help JSON-RPC command.

func NewHelpCmd

func NewHelpCmd(command *string) *HelpCmd

NewHelpCmd returns a new instance which can be used to issue a help JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type InfoChainResult

type InfoChainResult struct {
	Version         int32   `json:"version"`
	ProtocolVersion int32   `json:"protocolversion"`
	Blocks          int64   `json:"blocks"`
	TimeOffset      int64   `json:"timeoffset"`
	Connections     int32   `json:"connections"`
	Proxy           string  `json:"proxy"`
	Difficulty      float64 `json:"difficulty"`
	TestNet         bool    `json:"testnet"`
	RelayFee        float64 `json:"relayfee"`
	Errors          string  `json:"errors"`
	AddrIndex       bool    `json:"addrindex"`
	TxIndex         bool    `json:"txindex"`
}

InfoChainResult models the data returned by the chain server getinfo command.

type LiveTicketsCmd

type LiveTicketsCmd struct{}

LiveTicketsCmd is a type handling custom marshaling and unmarshaling of livetickets JSON RPC commands.

func NewLiveTicketsCmd

func NewLiveTicketsCmd() *LiveTicketsCmd

NewLiveTicketsCmd returns a new instance which can be used to issue a JSON-RPC livetickets command.

type LiveTicketsResult

type LiveTicketsResult struct {
	Tickets []string `json:"tickets"`
}

LiveTicketsResult models the data returned from the livetickets command.

type LoadTxFilterCmd

type LoadTxFilterCmd struct {
	Reload    bool
	Addresses []string
	OutPoints []OutPoint
}

LoadTxFilterCmd defines the loadtxfilter request parameters to load or reload a transaction filter.

func NewLoadTxFilterCmd

func NewLoadTxFilterCmd(reload bool, addresses []string, outPoints []OutPoint) *LoadTxFilterCmd

NewLoadTxFilterCmd returns a new instance which can be used to issue a loadtxfilter JSON-RPC command.

type LocalAddressesResult

type LocalAddressesResult struct {
	Address string `json:"address"`
	Port    uint16 `json:"port"`
	Score   int32  `json:"score"`
}

LocalAddressesResult models the localaddresses data from the getnetworkinfo command.

type Method

type Method string

Method is the type used to register method and parameter pairs with dcrjson.

const (
	// BlockConnectedNtfnMethod is the method used for notifications from
	// the chain server that a block has been connected.
	BlockConnectedNtfnMethod Method = "blockconnected"

	// BlockDisconnectedNtfnMethod is the method used for notifications from
	// the chain server that a block has been disconnected.
	BlockDisconnectedNtfnMethod Method = "blockdisconnected"

	// NewTicketsNtfnMethod is the method of the daemon newtickets notification.
	NewTicketsNtfnMethod Method = "newtickets"

	// WorkNtfnMethod is the method used for notifications from
	// the chain server that a new block template has been generated.
	WorkNtfnMethod = "work"

	// TSpendNtfnMethod is the method used for notifications from the chain
	// server that a new tspend has arrived in the mempool.
	TSpendNtfnMethod = "tspend"

	// ReorganizationNtfnMethod is the method used for notifications that the
	// block chain is in the process of a reorganization.
	ReorganizationNtfnMethod Method = "reorganization"

	// TxAcceptedNtfnMethod is the method used for notifications from the
	// chain server that a transaction has been accepted into the mempool.
	TxAcceptedNtfnMethod Method = "txaccepted"

	// TxAcceptedVerboseNtfnMethod is the method used for notifications from
	// the chain server that a transaction has been accepted into the
	// mempool.  This differs from TxAcceptedNtfnMethod in that it provides
	// more details in the notification.
	TxAcceptedVerboseNtfnMethod Method = "txacceptedverbose"

	// RelevantTxAcceptedNtfnMethod is the method used for notifications
	// from the chain server that inform a client that a relevant
	// transaction was accepted by the mempool.
	RelevantTxAcceptedNtfnMethod Method = "relevanttxaccepted"

	// SpentAndMissedTicketsNtfnMethod is the method of the daemon
	// spentandmissedtickets notification.
	SpentAndMissedTicketsNtfnMethod Method = "spentandmissedtickets"

	// StakeDifficultyNtfnMethod is the method of the daemon stakedifficulty
	// notification.
	StakeDifficultyNtfnMethod Method = "stakedifficulty"

	// WinningTicketsNtfnMethod is the method of the daemon winningtickets
	// notification.
	WinningTicketsNtfnMethod Method = "winningtickets"
)

type MissedTicketsCmd

type MissedTicketsCmd struct{}

MissedTicketsCmd is a type handling custom marshaling and unmarshaling of missedtickets JSON RPC commands.

func NewMissedTicketsCmd

func NewMissedTicketsCmd() *MissedTicketsCmd

NewMissedTicketsCmd returns a new instance which can be used to issue a JSON-RPC missedtickets command.

type MissedTicketsResult

type MissedTicketsResult struct {
	Tickets []string `json:"tickets"`
}

MissedTicketsResult models the data returned from the missedtickets command.

type NetworksResult

type NetworksResult struct {
	Name                      string `json:"name"`
	Limited                   bool   `json:"limited"`
	Reachable                 bool   `json:"reachable"`
	Proxy                     string `json:"proxy"`
	ProxyRandomizeCredentials bool   `json:"proxyrandomizecredentials"`
}

NetworksResult models the networks data from the getnetworkinfo command.

type NewTicketsNtfn

type NewTicketsNtfn struct {
	Hash      string
	Height    int32
	StakeDiff int64
	Tickets   []string
}

NewTicketsNtfn is a type handling custom marshaling and unmarshaling of newtickets JSON websocket notifications.

func NewNewTicketsNtfn

func NewNewTicketsNtfn(hash string, height int32, stakeDiff int64, tickets []string) *NewTicketsNtfn

NewNewTicketsNtfn creates a new NewTicketsNtfn.

type NodeCmd

type NodeCmd struct {
	SubCmd        NodeSubCmd `jsonrpcusage:"\"connect|remove|disconnect\""`
	Target        string
	ConnectSubCmd *string `jsonrpcusage:"\"perm|temp\""`
}

NodeCmd defines the dropnode JSON-RPC command.

func NewNodeCmd

func NewNodeCmd(subCmd NodeSubCmd, target string, connectSubCmd *string) *NodeCmd

NewNodeCmd returns a new instance which can be used to issue a node JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type NodeSubCmd

type NodeSubCmd string

NodeSubCmd defines the type used in the node JSON-RPC command for the sub command field.

const (
	// NConnect indicates the specified host that should be connected to.
	NConnect NodeSubCmd = "connect"

	// NRemove indicates the specified peer that should be removed as a
	// persistent peer.
	NRemove NodeSubCmd = "remove"

	// NDisconnect indicates the specified peer should be disconnected.
	NDisconnect NodeSubCmd = "disconnect"
)

type NotifyBlocksCmd

type NotifyBlocksCmd struct{}

NotifyBlocksCmd defines the notifyblocks JSON-RPC command.

func NewNotifyBlocksCmd

func NewNotifyBlocksCmd() *NotifyBlocksCmd

NewNotifyBlocksCmd returns a new instance which can be used to issue a notifyblocks JSON-RPC command.

type NotifyNewTicketsCmd

type NotifyNewTicketsCmd struct {
}

NotifyNewTicketsCmd is a type handling custom marshaling and unmarshaling of notifynewtickets JSON websocket extension commands.

func NewNotifyNewTicketsCmd

func NewNotifyNewTicketsCmd() *NotifyNewTicketsCmd

NewNotifyNewTicketsCmd creates a new NotifyNewTicketsCmd.

type NotifyNewTransactionsCmd

type NotifyNewTransactionsCmd struct {
	Verbose *bool `jsonrpcdefault:"false"`
}

NotifyNewTransactionsCmd defines the notifynewtransactions JSON-RPC command.

func NewNotifyNewTransactionsCmd

func NewNotifyNewTransactionsCmd(verbose *bool) *NotifyNewTransactionsCmd

NewNotifyNewTransactionsCmd returns a new instance which can be used to issue a notifynewtransactions JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type NotifySpentAndMissedTicketsCmd

type NotifySpentAndMissedTicketsCmd struct {
}

NotifySpentAndMissedTicketsCmd is a type handling custom marshaling and unmarshaling of notifyspentandmissedtickets JSON websocket extension commands.

func NewNotifySpentAndMissedTicketsCmd

func NewNotifySpentAndMissedTicketsCmd() *NotifySpentAndMissedTicketsCmd

NewNotifySpentAndMissedTicketsCmd creates a new NotifySpentAndMissedTicketsCmd.

type NotifyStakeDifficultyCmd

type NotifyStakeDifficultyCmd struct {
}

NotifyStakeDifficultyCmd is a type handling custom marshaling and unmarshaling of notifystakedifficulty JSON websocket extension commands.

func NewNotifyStakeDifficultyCmd

func NewNotifyStakeDifficultyCmd() *NotifyStakeDifficultyCmd

NewNotifyStakeDifficultyCmd creates a new NotifyStakeDifficultyCmd.

type NotifyTSpendCmd

type NotifyTSpendCmd struct{}

NotifyTSpendCmd defines the notifytspend JSON-RPC command.

func NewNotifyTSpendCmd

func NewNotifyTSpendCmd() *NotifyTSpendCmd

NewNotifyTSpendCmd returns a new instance which can be used to issue a notifytspend JSON-RPC command.

type NotifyWinningTicketsCmd

type NotifyWinningTicketsCmd struct {
}

NotifyWinningTicketsCmd is a type handling custom marshaling and unmarshaling of notifywinningtickets JSON websocket extension commands.

func NewNotifyWinningTicketsCmd

func NewNotifyWinningTicketsCmd() *NotifyWinningTicketsCmd

NewNotifyWinningTicketsCmd creates a new NotifyWinningTicketsCmd.

type NotifyWorkCmd

type NotifyWorkCmd struct{}

NotifyWorkCmd defines the notifywork JSON-RPC command.

func NewNotifyWorkCmd

func NewNotifyWorkCmd() *NotifyWorkCmd

NewNotifyWorkCmd returns a new instance which can be used to issue a notifywork JSON-RPC command.

type OutPoint

type OutPoint struct {
	Hash  string `json:"hash"`
	Tree  int8   `json:"tree"`
	Index uint32 `json:"index"`
}

OutPoint describes a transaction outpoint that will be marshalled to and from JSON. Contains Decred addition.

type PingCmd

type PingCmd struct{}

PingCmd defines the ping JSON-RPC command.

func NewPingCmd

func NewPingCmd() *PingCmd

NewPingCmd returns a new instance which can be used to issue a ping JSON-RPC command.

type PrevOut

type PrevOut struct {
	Addresses []string `json:"addresses,omitempty"`
	Value     float64  `json:"value"`
}

PrevOut represents previous output for an input Vin.

type RebroadcastMissedCmd

type RebroadcastMissedCmd struct{}

RebroadcastMissedCmd is a type handling custom marshaling and unmarshaling of rebroadcastmissed JSON RPC commands.

func NewRebroadcastMissedCmd

func NewRebroadcastMissedCmd() *RebroadcastMissedCmd

NewRebroadcastMissedCmd returns a new instance which can be used to issue a JSON-RPC rebroadcastmissed command.

type RebroadcastWinnersCmd

type RebroadcastWinnersCmd struct{}

RebroadcastWinnersCmd is a type handling custom marshaling and unmarshaling of rebroadcastwinners JSON RPC commands.

func NewRebroadcastWinnersCmd

func NewRebroadcastWinnersCmd() *RebroadcastWinnersCmd

NewRebroadcastWinnersCmd returns a new instance which can be used to issue a JSON-RPC rebroadcastwinners command.

type RegenTemplateCmd

type RegenTemplateCmd struct{}

RegenTemplateCmd defines the regentemplate JSON-RPC command.

func NewRegenTemplateCmd

func NewRegenTemplateCmd() *RegenTemplateCmd

NewRegenTemplateCmd returns a new instance which can be used to issue a regentemplate JSON-RPC command.

type RelevantTxAcceptedNtfn

type RelevantTxAcceptedNtfn struct {
	Transaction string `json:"transaction"`
}

RelevantTxAcceptedNtfn defines the parameters to the relevanttxaccepted JSON-RPC notification.

func NewRelevantTxAcceptedNtfn

func NewRelevantTxAcceptedNtfn(txHex string) *RelevantTxAcceptedNtfn

NewRelevantTxAcceptedNtfn returns a new instance which can be used to issue a relevantxaccepted JSON-RPC notification.

type ReorganizationNtfn

type ReorganizationNtfn struct {
	OldHash   string `json:"oldhash"`
	OldHeight int32  `json:"oldheight"`
	NewHash   string `json:"newhash"`
	NewHeight int32  `json:"newheight"`
}

ReorganizationNtfn defines the reorganization JSON-RPC notification.

func NewReorganizationNtfn

func NewReorganizationNtfn(oldHash string, oldHeight int32, newHash string,
	newHeight int32) *ReorganizationNtfn

NewReorganizationNtfn returns a new instance which can be used to issue a blockdisconnected JSON-RPC notification.

type RescanCmd

type RescanCmd struct {
	BlockHashes []string
}

RescanCmd defines the rescan JSON-RPC command.

func NewRescanCmd

func NewRescanCmd(blockHashes []string) *RescanCmd

NewRescanCmd returns a new instance which can be used to issue a rescan JSON-RPC command.

type RescanResult

type RescanResult struct {
	DiscoveredData []RescannedBlock `json:"discovereddata"`
}

RescanResult models the result object returned by the rescan RPC.

type RescannedBlock

type RescannedBlock struct {
	Hash         string   `json:"hash"`
	Transactions []string `json:"transactions"`
}

RescannedBlock contains the hash and all discovered transactions of a single rescanned block.

type SStxCommitOut

type SStxCommitOut struct {
	Addr       string `json:"addr"`
	CommitAmt  int64  `json:"commitamt"`
	ChangeAddr string `json:"changeaddr"`
	ChangeAmt  int64  `json:"changeamt"`
}

SStxCommitOut represents the output to an SStx transaction. Specifically a a commitment address and amount, and a change address and amount.

type SStxInput

type SStxInput struct {
	Txid string `json:"txid"`
	Vout uint32 `json:"vout"`
	Tree int8   `json:"tree"`
	Amt  int64  `json:"amt"`
}

SStxInput represents the inputs to an SStx transaction. Specifically a transactionsha and output number pair, along with the output amounts.

type ScriptPubKeyResult

type ScriptPubKeyResult struct {
	Asm       string   `json:"asm"`
	Hex       string   `json:"hex,omitempty"`
	ReqSigs   int32    `json:"reqSigs,omitempty"`
	Type      string   `json:"type"`
	Addresses []string `json:"addresses,omitempty"`
	CommitAmt *float64 `json:"commitamt,omitempty"`
}

ScriptPubKeyResult models the scriptPubKey data of a tx script. It is defined separately since it is used by multiple commands.

type ScriptSig

type ScriptSig struct {
	Asm string `json:"asm"`
	Hex string `json:"hex"`
}

ScriptSig models a signature script. It is defined separately since it only applies to non-coinbase. Therefore the field in the Vin structure needs to be a pointer.

type SearchRawTransactionsCmd

type SearchRawTransactionsCmd struct {
	Address     string
	Verbose     *int  `jsonrpcdefault:"1"`
	Skip        *int  `jsonrpcdefault:"0"`
	Count       *int  `jsonrpcdefault:"100"`
	VinExtra    *int  `jsonrpcdefault:"0"`
	Reverse     *bool `jsonrpcdefault:"false"`
	FilterAddrs *[]string
}

SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command.

func NewSearchRawTransactionsCmd

func NewSearchRawTransactionsCmd(address string, verbose, skip, count *int, vinExtra *int, reverse *bool, filterAddrs *[]string) *SearchRawTransactionsCmd

NewSearchRawTransactionsCmd returns a new instance which can be used to issue a searchrawtransactions JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type SearchRawTransactionsResult

type SearchRawTransactionsResult struct {
	Hex           string       `json:"hex,omitempty"`
	Txid          string       `json:"txid"`
	Version       int32        `json:"version"`
	LockTime      uint32       `json:"locktime"`
	Expiry        uint32       `json:"expiry"`
	Vin           []VinPrevOut `json:"vin"`
	Vout          []Vout       `json:"vout"`
	BlockHash     string       `json:"blockhash,omitempty"`
	BlockHeight   int64        `json:"blockheight,omitempty"`
	BlockIndex    uint32       `json:"blockindex,omitempty"`
	Confirmations uint64       `json:"confirmations,omitempty"`
	Time          int64        `json:"time,omitempty"`
	Blocktime     int64        `json:"blocktime,omitempty"`
}

SearchRawTransactionsResult models the data from the searchrawtransaction command.

type SendRawTransactionCmd

type SendRawTransactionCmd struct {
	HexTx         string
	AllowHighFees *bool `jsonrpcdefault:"false"`
}

SendRawTransactionCmd defines the sendrawtransaction JSON-RPC command.

func NewSendRawTransactionCmd

func NewSendRawTransactionCmd(hexTx string, allowHighFees *bool) *SendRawTransactionCmd

NewSendRawTransactionCmd returns a new instance which can be used to issue a sendrawtransaction JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type SessionCmd

type SessionCmd struct{}

SessionCmd defines the session JSON-RPC command.

func NewSessionCmd

func NewSessionCmd() *SessionCmd

NewSessionCmd returns a new instance which can be used to issue a session JSON-RPC command.

type SessionResult

type SessionResult struct {
	SessionID uint64 `json:"sessionid"`
}

SessionResult models the data from the session command.

type SetGenerateCmd

type SetGenerateCmd struct {
	Generate     bool
	GenProcLimit *int `jsonrpcdefault:"-1"`
}

SetGenerateCmd defines the setgenerate JSON-RPC command.

func NewSetGenerateCmd

func NewSetGenerateCmd(generate bool, genProcLimit *int) *SetGenerateCmd

NewSetGenerateCmd returns a new instance which can be used to issue a setgenerate JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type SpentAndMissedTicketsNtfn

type SpentAndMissedTicketsNtfn struct {
	Hash      string
	Height    int32
	StakeDiff int64
	Tickets   map[string]string
}

SpentAndMissedTicketsNtfn is a type handling custom marshaling and unmarshaling of spentandmissedtickets JSON websocket notifications.

func NewSpentAndMissedTicketsNtfn

func NewSpentAndMissedTicketsNtfn(hash string, height int32, stakeDiff int64, tickets map[string]string) *SpentAndMissedTicketsNtfn

NewSpentAndMissedTicketsNtfn creates a new SpentAndMissedTicketsNtfn.

type StakeDifficultyNtfn

type StakeDifficultyNtfn struct {
	BlockHash   string
	BlockHeight int32
	StakeDiff   int64
}

StakeDifficultyNtfn is a type handling custom marshaling and unmarshaling of stakedifficulty JSON websocket notifications.

func NewStakeDifficultyNtfn

func NewStakeDifficultyNtfn(hash string, height int32, stakeDiff int64) *StakeDifficultyNtfn

NewStakeDifficultyNtfn creates a new StakeDifficultyNtfn.

type StakeVersions

type StakeVersions struct {
	Hash         string        `json:"hash"`
	Height       int64         `json:"height"`
	BlockVersion int32         `json:"blockversion"`
	StakeVersion uint32        `json:"stakeversion"`
	Votes        []VersionBits `json:"votes"`
}

StakeVersions models the data for GetStakeVersionsResult.

type StopCmd

type StopCmd struct{}

StopCmd defines the stop JSON-RPC command.

func NewStopCmd

func NewStopCmd() *StopCmd

NewStopCmd returns a new instance which can be used to issue a stop JSON-RPC command.

type StopNotifyBlocksCmd

type StopNotifyBlocksCmd struct{}

StopNotifyBlocksCmd defines the stopnotifyblocks JSON-RPC command.

func NewStopNotifyBlocksCmd

func NewStopNotifyBlocksCmd() *StopNotifyBlocksCmd

NewStopNotifyBlocksCmd returns a new instance which can be used to issue a stopnotifyblocks JSON-RPC command.

type StopNotifyNewTransactionsCmd

type StopNotifyNewTransactionsCmd struct{}

StopNotifyNewTransactionsCmd defines the stopnotifynewtransactions JSON-RPC command.

func NewStopNotifyNewTransactionsCmd

func NewStopNotifyNewTransactionsCmd() *StopNotifyNewTransactionsCmd

NewStopNotifyNewTransactionsCmd returns a new instance which can be used to issue a stopnotifynewtransactions JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type StopNotifyTSpendCmd

type StopNotifyTSpendCmd struct{}

StopNotifyTSpendCmd defines the stopnotifytspend JSON-RPC command.

func NewStopNotifyTSpendCmd

func NewStopNotifyTSpendCmd() *StopNotifyTSpendCmd

NewStopNotifyTSpendCmd returns a new instance which can be used to issue a stopnotifytspend JSON-RPC command.

type StopNotifyWorkCmd

type StopNotifyWorkCmd struct{}

StopNotifyWorkCmd defines the stopnotifywork JSON-RPC command.

func NewStopNotifyWorkCmd

func NewStopNotifyWorkCmd() *StopNotifyWorkCmd

NewStopNotifyWorkCmd returns a new instance which can be used to issue a stopnotifywork JSON-RPC command.

type SubmitBlockCmd

type SubmitBlockCmd struct {
	HexBlock string
	Options  *SubmitBlockOptions
}

SubmitBlockCmd defines the submitblock JSON-RPC command.

func NewSubmitBlockCmd

func NewSubmitBlockCmd(hexBlock string, options *SubmitBlockOptions) *SubmitBlockCmd

NewSubmitBlockCmd returns a new instance which can be used to issue a submitblock JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type SubmitBlockOptions

type SubmitBlockOptions struct {
	// must be provided if server provided a workid with template.
	WorkID string `json:"workid,omitempty"`
}

SubmitBlockOptions represents the optional options struct provided with a SubmitBlockCmd command.

type TSpendNtfn

type TSpendNtfn struct {
	TSpend string `json:"tspend"` // Hex string encoded tspend.
}

TSpendNtfn defines the tspend JSON-RPC notification.

func NewTSpendNtfn

func NewTSpendNtfn(tspend string) *TSpendNtfn

NewTSpendNtfn returns a new instance which can be used to issue a tspend JSON-RPC notification.

type Ticket

type Ticket struct {
	Hash  string `json:"hash"`
	Owner string `json:"owner"`
}

Ticket is the structure representing a ticket.

type TicketFeeInfoCmd

type TicketFeeInfoCmd struct {
	Blocks  *uint32
	Windows *uint32
}

TicketFeeInfoCmd defines the ticketfeeinfo JSON-RPC command.

func NewTicketFeeInfoCmd

func NewTicketFeeInfoCmd(blocks *uint32, windows *uint32) *TicketFeeInfoCmd

NewTicketFeeInfoCmd returns a new instance which can be used to issue a JSON-RPC ticket fee info command.

type TicketFeeInfoResult

type TicketFeeInfoResult struct {
	FeeInfoMempool FeeInfoMempool  `json:"feeinfomempool"`
	FeeInfoBlocks  []FeeInfoBlock  `json:"feeinfoblocks"`
	FeeInfoWindows []FeeInfoWindow `json:"feeinfowindows"`
}

TicketFeeInfoResult models the data returned from the ticketfeeinfo command. command.

type TicketVWAPCmd

type TicketVWAPCmd struct {
	Start *uint32
	End   *uint32
}

TicketVWAPCmd defines the ticketvwap JSON-RPC command.

func NewTicketVWAPCmd

func NewTicketVWAPCmd(start *uint32, end *uint32) *TicketVWAPCmd

NewTicketVWAPCmd returns a new instance which can be used to issue a JSON-RPC ticket volume weight average price command.

type TicketsForAddressCmd

type TicketsForAddressCmd struct {
	Address string
}

TicketsForAddressCmd defines the ticketsforaddress JSON-RPC command.

func NewTicketsForAddressCmd

func NewTicketsForAddressCmd(addr string) *TicketsForAddressCmd

NewTicketsForAddressCmd returns a new instance which can be used to issue a JSON-RPC tickets for address command.

type TicketsForAddressResult

type TicketsForAddressResult struct {
	Tickets []string `json:"tickets"`
}

TicketsForAddressResult models the data returned from the ticketforaddress command.

type TransactionInput

type TransactionInput struct {
	Amount float64 `json:"amount,omitempty"`
	Txid   string  `json:"txid"`
	Vout   uint32  `json:"vout"`
	Tree   int8    `json:"tree"`
}

TransactionInput represents the inputs to a transaction. Specifically a transaction hash and output number pair. Contains Decred additions.

type TreasurySpendVotes

type TreasurySpendVotes struct {
	Hash      string `json:"hash"`
	Expiry    int64  `json:"expiry"`
	VoteStart int64  `json:"votestart"`
	VoteEnd   int64  `json:"voteend"`
	YesVotes  int64  `json:"yesvotes"`
	NoVotes   int64  `json:"novotes"`
}

TreasurySpendVotes models the data returned for a single tspend returned by gettreasuryspendvotes command.

type TxAcceptedNtfn

type TxAcceptedNtfn struct {
	TxID   string  `json:"txid"`
	Amount float64 `json:"amount"`
}

TxAcceptedNtfn defines the txaccepted JSON-RPC notification.

func NewTxAcceptedNtfn

func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn

NewTxAcceptedNtfn returns a new instance which can be used to issue a txaccepted JSON-RPC notification.

type TxAcceptedVerboseNtfn

type TxAcceptedVerboseNtfn struct {
	RawTx TxRawResult `json:"rawtx"`
}

TxAcceptedVerboseNtfn defines the txacceptedverbose JSON-RPC notification.

func NewTxAcceptedVerboseNtfn

func NewTxAcceptedVerboseNtfn(rawTx TxRawResult) *TxAcceptedVerboseNtfn

NewTxAcceptedVerboseNtfn returns a new instance which can be used to issue a txacceptedverbose JSON-RPC notification.

type TxFeeInfoCmd

type TxFeeInfoCmd struct {
	Blocks     *uint32
	RangeStart *uint32
	RangeEnd   *uint32
}

TxFeeInfoCmd defines the txfeeinfo JSON-RPC command.

func NewTxFeeInfoCmd

func NewTxFeeInfoCmd(blocks *uint32, start *uint32, end *uint32) *TxFeeInfoCmd

NewTxFeeInfoCmd returns a new instance which can be used to issue a JSON-RPC tx fee info command.

type TxFeeInfoResult

type TxFeeInfoResult struct {
	FeeInfoMempool FeeInfoMempool `json:"feeinfomempool"`
	FeeInfoBlocks  []FeeInfoBlock `json:"feeinfoblocks"`
	FeeInfoRange   FeeInfoRange   `json:"feeinforange"`
}

TxFeeInfoResult models the data returned from the ticketfeeinfo command. command.

type TxRawDecodeResult

type TxRawDecodeResult struct {
	Txid     string `json:"txid"`
	Version  int32  `json:"version"`
	Locktime uint32 `json:"locktime"`
	Expiry   uint32 `json:"expiry"`
	Vin      []Vin  `json:"vin"`
	Vout     []Vout `json:"vout"`
}

TxRawDecodeResult models the data from the decoderawtransaction command.

type TxRawResult

type TxRawResult struct {
	Hex           string `json:"hex"`
	Txid          string `json:"txid"`
	Version       int32  `json:"version"`
	LockTime      uint32 `json:"locktime"`
	Expiry        uint32 `json:"expiry"`
	Vin           []Vin  `json:"vin"`
	Vout          []Vout `json:"vout"`
	BlockHash     string `json:"blockhash,omitempty"`
	BlockHeight   int64  `json:"blockheight,omitempty"`
	BlockIndex    uint32 `json:"blockindex,omitempty"`
	Confirmations int64  `json:"confirmations,omitempty"`
	Time          int64  `json:"time,omitempty"`
	Blocktime     int64  `json:"blocktime,omitempty"`
}

TxRawResult models the data from the getrawtransaction command.

type ValidateAddressChainResult

type ValidateAddressChainResult struct {
	IsValid bool   `json:"isvalid"`
	Address string `json:"address,omitempty"`
}

ValidateAddressChainResult models the data returned by the chain server validateaddress command.

type ValidateAddressCmd

type ValidateAddressCmd struct {
	Address string
}

ValidateAddressCmd defines the validateaddress JSON-RPC command.

func NewValidateAddressCmd

func NewValidateAddressCmd(address string) *ValidateAddressCmd

NewValidateAddressCmd returns a new instance which can be used to issue a validateaddress JSON-RPC command.

type VerifyChainCmd

type VerifyChainCmd struct {
	CheckLevel *int64 `jsonrpcdefault:"3"`
	CheckDepth *int64 `jsonrpcdefault:"288"` // 0 = all
}

VerifyChainCmd defines the verifychain JSON-RPC command.

func NewVerifyChainCmd

func NewVerifyChainCmd(checkLevel, checkDepth *int64) *VerifyChainCmd

NewVerifyChainCmd returns a new instance which can be used to issue a verifychain JSON-RPC command.

The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.

type VerifyMessageCmd

type VerifyMessageCmd struct {
	Address   string
	Signature string
	Message   string
}

VerifyMessageCmd defines the verifymessage JSON-RPC command.

func NewVerifyMessageCmd

func NewVerifyMessageCmd(address, signature, message string) *VerifyMessageCmd

NewVerifyMessageCmd returns a new instance which can be used to issue a verifymessage JSON-RPC command.

type VersionBits

type VersionBits struct {
	Version uint32 `json:"version"`
	Bits    uint16 `json:"bits"`
}

VersionBits models a generic version:bits tuple.

type VersionCmd

type VersionCmd struct{}

VersionCmd defines the version JSON-RPC command.

func NewVersionCmd

func NewVersionCmd() *VersionCmd

NewVersionCmd returns a new instance which can be used to issue a JSON-RPC version command.

type VersionCount

type VersionCount struct {
	Version uint32 `json:"version"`
	Count   uint32 `json:"count"`
}

VersionCount models a generic version:count tuple.

type VersionInterval

type VersionInterval struct {
	StartHeight  int64          `json:"startheight"`
	EndHeight    int64          `json:"endheight"`
	PoSVersions  []VersionCount `json:"posversions"`
	VoteVersions []VersionCount `json:"voteversions"`
}

VersionInterval models a cooked version count for an interval.

type VersionResult

type VersionResult struct {
	VersionString string `json:"versionstring"`
	Major         uint32 `json:"major"`
	Minor         uint32 `json:"minor"`
	Patch         uint32 `json:"patch"`
	Prerelease    string `json:"prerelease"`
	BuildMetadata string `json:"buildmetadata"`
}

VersionResult models objects included in the version response. In the actual result, these objects are keyed by the program or API name.

type Vin

type Vin struct {
	Coinbase      string     `json:"coinbase"`
	Stakebase     string     `json:"stakebase"`
	Treasurybase  bool       `json:"treasurybase"`
	TreasurySpend string     `json:"treasuryspend"`
	Txid          string     `json:"txid"`
	Vout          uint32     `json:"vout"`
	Tree          int8       `json:"tree"`
	Sequence      uint32     `json:"sequence"`
	AmountIn      float64    `json:"amountin"`
	BlockHeight   uint32     `json:"blockheight"`
	BlockIndex    uint32     `json:"blockindex"`
	ScriptSig     *ScriptSig `json:"scriptSig"`
}

Vin models parts of the tx data. It is defined separately since getrawtransaction and decoderawtransaction use the same structure.

func (*Vin) IsCoinBase

func (v *Vin) IsCoinBase() bool

IsCoinBase returns whether or not an input is a coinbase input.

func (*Vin) IsStakeBase

func (v *Vin) IsStakeBase() bool

IsStakeBase returns whether or not an input is a stakebase input.

func (*Vin) IsTreasurySpend

func (v *Vin) IsTreasurySpend() bool

IsTreasurySpend returns whether or not an input is a treasury spend input.

func (*Vin) MarshalJSON

func (v *Vin) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom Marshal method for Vin.

type VinPrevOut

type VinPrevOut struct {
	Coinbase      string     `json:"coinbase"`
	Stakebase     string     `json:"stakebase"`
	Treasurybase  bool       `json:"treasurybase"`
	TreasurySpend string     `json:"treasuryspend"`
	Txid          string     `json:"txid"`
	Vout          uint32     `json:"vout"`
	Tree          int8       `json:"tree"`
	AmountIn      *float64   `json:"amountin,omitempty"`
	BlockHeight   *uint32    `json:"blockheight,omitempty"`
	BlockIndex    *uint32    `json:"blockindex,omitempty"`
	ScriptSig     *ScriptSig `json:"scriptSig"`
	PrevOut       *PrevOut   `json:"prevOut"`
	Sequence      uint32     `json:"sequence"`
}

VinPrevOut is like Vin except it includes PrevOut. It is used by searchrawtransaction.

func (*VinPrevOut) IsCoinBase

func (v *VinPrevOut) IsCoinBase() bool

IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.

func (*VinPrevOut) IsStakeBase

func (v *VinPrevOut) IsStakeBase() bool

IsStakeBase returns a bool to show if a Vin is a StakeBase one or not.

func (*VinPrevOut) IsTreasurySpend

func (v *VinPrevOut) IsTreasurySpend() bool

IsTreasurySpend returns whether or not an input is a treasury spend input.

func (*VinPrevOut) MarshalJSON

func (v *VinPrevOut) MarshalJSON() ([]byte, error)

MarshalJSON provides a custom Marshal method for VinPrevOut.

type Vout

type Vout struct {
	Value        float64            `json:"value"`
	N            uint32             `json:"n"`
	Version      uint16             `json:"version"`
	ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"`
}

Vout models parts of the tx data. It is defined separately since both getrawtransaction and decoderawtransaction use the same structure.

type WinningTicketsNtfn

type WinningTicketsNtfn struct {
	BlockHash   string
	BlockHeight int32
	Tickets     map[string]string
}

WinningTicketsNtfn is a type handling custom marshaling and unmarshaling of blockconnected JSON websocket notifications.

func NewWinningTicketsNtfn

func NewWinningTicketsNtfn(hash string, height int32, tickets map[string]string) *WinningTicketsNtfn

NewWinningTicketsNtfn creates a new WinningTicketsNtfn.

type WorkNtfn

type WorkNtfn struct {
	Data   string `json:"data"`
	Target string `json:"target"`
	Reason string `json:"reason"`
}

WorkNtfn defines the work JSON-RPC notification.

func NewWorkNtfn

func NewWorkNtfn(data string, target string) *WorkNtfn

NewWorkNtfn returns a new instance which can be used to issue a work JSON-RPC notification.

Jump to

Keyboard shortcuts

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