btcws

package module
v0.0.0-...-3067732 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2015 License: ISC Imports: 4 Imported by: 2

README

btcws

[Build Status] (https://travis-ci.org/btcsuite/btcws)

Package btcws implements extensions to the standard bitcoind JSON-RPC API for the btcd suite of programs (btcd, btcwallet, and btcgui). Importing this package registers all implemented custom requests with btcjson (using btcjson.RegisterCustomCmd).

Sample Use

// Client Side
import (
	"golang.org/x/net/websocket"
	"github.com/btcsuite/btcws"
)

// Create rescan command.
id := 0
addrs := map[string]struct{}{
	"17XhEvq9Nahdj7Xe1nv6oRe1tEmaHUuynH": struct{},
}
cmd, err := btcws.NewRescanCmd(id, 270000, addrs)

// Set up a handler for a reply with id 0.
AddReplyHandler(id, func(reply map[string]interface{}) {
	// Deal with reply.
})

// JSON marshal and send rescan request to websocket connection.
websocket.JSON.Send(btcdWSConn, cmd)


// Server Side
import (
	"golang.org/x/net/websocket"
	"github.com/btcsuite/btcd/btcjson"
	"github.com/btcsuite/btcws"
)

// Get marshaled request.
var b []byte
err := websocket.Message.Receive(clientWSConn, &b)

// Parse marshaled command.
cmd, err := btcjson.ParseMarshaledCmd(b)

// If this is a rescan command, handle and reply.
rcmd, ok := cmd.(*btcws.RescanCmd)
if ok {
	// Do stuff
	var reply []byte
	err := websocket.Message.Send(clientWSConn, reply)
}

Installation

$ go get github.com/btcsuite/btcws

GPG Verification Key

All official release tags are signed by Conformal so users can ensure the code has not been tampered with and is coming from Conformal. To verify the signature perform the following:

  • Download the public key from the Conformal website at https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt

  • Import the public key into your GPG keyring:

    gpg --import GIT-GPG-KEY-conformal.txt
    
  • Verify the release tag with the following command where TAG_NAME is a placeholder for the specific tag:

    git tag -v TAG_NAME
    

License

Package btcws is licensed under the liberal ISC License.

Documentation

Index

Constants

View Source
const (
	// AccountBalanceNtfnMethod is the method of the btcwallet
	// accountbalance notification.
	AccountBalanceNtfnMethod = "accountbalance"

	// TxAcceptedNtfnMethod is the method of the btcd txaccepted
	// notification
	TxAcceptedNtfnMethod = "txaccepted"

	// TxAcceptedVerboseNtfnMethod is the method of the btcd
	// txacceptedverbose notifications.
	TxAcceptedVerboseNtfnMethod = "txacceptedverbose"

	// BlockConnectedNtfnMethod is the method of the btcd
	// blockconnected notification.
	BlockConnectedNtfnMethod = "blockconnected"

	// BlockDisconnectedNtfnMethod is the method of the btcd
	// blockdisconnected notification.
	BlockDisconnectedNtfnMethod = "blockdisconnected"

	// BtcdConnectedNtfnMethod is the method of the btcwallet
	// btcdconnected notification.
	BtcdConnectedNtfnMethod = "btcdconnected"

	// RecvTxNtfnMethod is the method of the btcd recvtx notification.
	RecvTxNtfnMethod = "recvtx"

	// TxNtfnMethod is the method of the btcwallet newtx
	// notification.
	TxNtfnMethod = "newtx"

	// RedeemingTxNtfnMethod is the method of the btcd redeemingtx
	// notification.
	RedeemingTxNtfnMethod = "redeemingtx"

	// RescanFinishedNtfnMethod is the method of the btcd rescanfinished
	// notification.
	RescanFinishedNtfnMethod = "rescanfinished"

	// RescanProgressNtfnMethod is the method of the btcd rescanprogress
	// notification.
	RescanProgressNtfnMethod = "rescanprogress"

	// WalletLockStateNtfnMethod is the method of the btcwallet
	// walletlockstate notification.
	WalletLockStateNtfnMethod = "walletlockstate"
)

Variables

View Source
var (
	// ErrNotANtfn describes an error where a JSON-RPC Request
	// object cannot be successfully parsed as a notification
	// due to having an ID.
	ErrNotANtfn = errors.New("notifications may not have IDs")
)

Functions

This section is empty.

Types

type AccountBalanceNtfn

type AccountBalanceNtfn struct {
	Account   string
	Balance   float64
	Confirmed bool // Whether Balance is confirmed or unconfirmed.
}

AccountBalanceNtfn is a type handling custom marshaling and unmarshaling of accountbalance JSON websocket notifications.

func NewAccountBalanceNtfn

func NewAccountBalanceNtfn(account string, balance float64,
	confirmed bool) *AccountBalanceNtfn

NewAccountBalanceNtfn creates a new AccountBalanceNtfn.

func (*AccountBalanceNtfn) Id

func (n *AccountBalanceNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*AccountBalanceNtfn) MarshalJSON

func (n *AccountBalanceNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*AccountBalanceNtfn) Method

func (n *AccountBalanceNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*AccountBalanceNtfn) UnmarshalJSON

func (n *AccountBalanceNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type AuthenticateCmd

type AuthenticateCmd struct {
	Username   string
	Passphrase string
	// contains filtered or unexported fields
}

AuthenticateCmd is a type handling custom marshaling and unmarshaling of authenticate JSON websocket extension commands.

func NewAuthenticateCmd

func NewAuthenticateCmd(id interface{}, username, passphrase string) *AuthenticateCmd

NewAuthenticateCmd creates a new GetCurrentNetCmd.

func (*AuthenticateCmd) Id

func (cmd *AuthenticateCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*AuthenticateCmd) MarshalJSON

func (cmd *AuthenticateCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*AuthenticateCmd) Method

func (cmd *AuthenticateCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*AuthenticateCmd) UnmarshalJSON

func (cmd *AuthenticateCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type BlockConnectedNtfn

type BlockConnectedNtfn struct {
	Hash   string
	Height int32
}

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

func NewBlockConnectedNtfn

func NewBlockConnectedNtfn(hash string, height int32) *BlockConnectedNtfn

NewBlockConnectedNtfn creates a new BlockConnectedNtfn.

func (*BlockConnectedNtfn) Id

func (n *BlockConnectedNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*BlockConnectedNtfn) MarshalJSON

func (n *BlockConnectedNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*BlockConnectedNtfn) Method

func (n *BlockConnectedNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*BlockConnectedNtfn) UnmarshalJSON

func (n *BlockConnectedNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type BlockDetails

type BlockDetails struct {
	Height int32  `json:"height"`
	Hash   string `json:"hash"`
	Index  int    `json:"index"`
	Time   int64  `json:"time"`
}

BlockDetails describes details of a tx in a block.

type BlockDisconnectedNtfn

type BlockDisconnectedNtfn struct {
	Hash   string
	Height int32
}

BlockDisconnectedNtfn is a type handling custom marshaling and unmarshaling of blockdisconnected JSON websocket notifications.

func NewBlockDisconnectedNtfn

func NewBlockDisconnectedNtfn(hash string, height int32) *BlockDisconnectedNtfn

NewBlockDisconnectedNtfn creates a new BlockDisconnectedNtfn.

func (*BlockDisconnectedNtfn) Id

func (n *BlockDisconnectedNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*BlockDisconnectedNtfn) MarshalJSON

func (n *BlockDisconnectedNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*BlockDisconnectedNtfn) Method

func (n *BlockDisconnectedNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*BlockDisconnectedNtfn) UnmarshalJSON

func (n *BlockDisconnectedNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type BtcdConnectedNtfn

type BtcdConnectedNtfn struct {
	Connected bool
}

BtcdConnectedNtfn is a type handling custom marshaling and unmarshaling of btcdconnected JSON websocket notifications.

func NewBtcdConnectedNtfn

func NewBtcdConnectedNtfn(connected bool) *BtcdConnectedNtfn

NewBtcdConnectedNtfn creates a new BtcdConnectedNtfn.

func (*BtcdConnectedNtfn) Id

func (n *BtcdConnectedNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*BtcdConnectedNtfn) MarshalJSON

func (n *BtcdConnectedNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*BtcdConnectedNtfn) Method

func (n *BtcdConnectedNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*BtcdConnectedNtfn) UnmarshalJSON

func (n *BtcdConnectedNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type CreateEncryptedWalletCmd

type CreateEncryptedWalletCmd struct {
	Passphrase string
	// contains filtered or unexported fields
}

CreateEncryptedWalletCmd is a type handling custom marshaling and unmarshaling of createencryptedwallet JSON websocket extension commands.

func NewCreateEncryptedWalletCmd

func NewCreateEncryptedWalletCmd(id interface{}, passphrase string) *CreateEncryptedWalletCmd

NewCreateEncryptedWalletCmd creates a new CreateEncryptedWalletCmd.

func (*CreateEncryptedWalletCmd) Id

func (cmd *CreateEncryptedWalletCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*CreateEncryptedWalletCmd) MarshalJSON

func (cmd *CreateEncryptedWalletCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*CreateEncryptedWalletCmd) Method

func (cmd *CreateEncryptedWalletCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*CreateEncryptedWalletCmd) UnmarshalJSON

func (cmd *CreateEncryptedWalletCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type CreateNewAccountCmd

type CreateNewAccountCmd struct {
	Account string
	// contains filtered or unexported fields
}

CreateNewAccountCmd is a type handling custom marshaling and unmarshaling of createnewaccount JSON websocket extension commands.

func NewCreateNewAccountCmd

func NewCreateNewAccountCmd(id interface{}, account string) *CreateNewAccountCmd

NewCreateNewAccountCmd creates a new CreateNewAccountCmd.

func (*CreateNewAccountCmd) Id

func (cmd *CreateNewAccountCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*CreateNewAccountCmd) MarshalJSON

func (cmd *CreateNewAccountCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*CreateNewAccountCmd) Method

func (cmd *CreateNewAccountCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*CreateNewAccountCmd) UnmarshalJSON

func (cmd *CreateNewAccountCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type ExportWatchingWalletCmd

type ExportWatchingWalletCmd struct {
	Account  string
	Download bool
	// contains filtered or unexported fields
}

ExportWatchingWalletCmd is a type handling custom marshaling and unmarshaling of exportwatchingwallet JSON websocket extension commands.

func NewExportWatchingWalletCmd

func NewExportWatchingWalletCmd(id interface{}, optArgs ...interface{}) (*ExportWatchingWalletCmd, error)

NewExportWatchingWalletCmd creates a new ExportWatchingWalletCmd.

func (*ExportWatchingWalletCmd) Id

func (cmd *ExportWatchingWalletCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*ExportWatchingWalletCmd) MarshalJSON

func (cmd *ExportWatchingWalletCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*ExportWatchingWalletCmd) Method

func (cmd *ExportWatchingWalletCmd) Method() string

Method satisifies the Cmd interface by returning the RPC method.

func (*ExportWatchingWalletCmd) UnmarshalJSON

func (cmd *ExportWatchingWalletCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type GetBestBlockCmd

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

GetBestBlockCmd is a type handling custom marshaling and unmarshaling of getbestblock JSON websocket extension commands.

func NewGetBestBlockCmd

func NewGetBestBlockCmd(id interface{}) *GetBestBlockCmd

NewGetBestBlockCmd creates a new GetBestBlock.

func (*GetBestBlockCmd) Id

func (cmd *GetBestBlockCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*GetBestBlockCmd) MarshalJSON

func (cmd *GetBestBlockCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*GetBestBlockCmd) Method

func (cmd *GetBestBlockCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*GetBestBlockCmd) UnmarshalJSON

func (cmd *GetBestBlockCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type GetBestBlockResult

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

GetBestBlockResult holds the result of a getbestblock response.

type GetCurrentNetCmd

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

GetCurrentNetCmd is a type handling custom marshaling and unmarshaling of getcurrentnet JSON websocket extension commands.

func NewGetCurrentNetCmd

func NewGetCurrentNetCmd(id interface{}) *GetCurrentNetCmd

NewGetCurrentNetCmd creates a new GetCurrentNetCmd.

func (*GetCurrentNetCmd) Id

func (cmd *GetCurrentNetCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*GetCurrentNetCmd) MarshalJSON

func (cmd *GetCurrentNetCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*GetCurrentNetCmd) Method

func (cmd *GetCurrentNetCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*GetCurrentNetCmd) UnmarshalJSON

func (cmd *GetCurrentNetCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type GetUnconfirmedBalanceCmd

type GetUnconfirmedBalanceCmd struct {
	Account string
	// contains filtered or unexported fields
}

GetUnconfirmedBalanceCmd is a type handling custom marshaling and unmarshaling of getunconfirmedbalance JSON websocket extension commands.

func NewGetUnconfirmedBalanceCmd

func NewGetUnconfirmedBalanceCmd(id interface{},
	optArgs ...string) (*GetUnconfirmedBalanceCmd, error)

NewGetUnconfirmedBalanceCmd creates a new GetUnconfirmedBalanceCmd.

func (*GetUnconfirmedBalanceCmd) Id

func (cmd *GetUnconfirmedBalanceCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*GetUnconfirmedBalanceCmd) MarshalJSON

func (cmd *GetUnconfirmedBalanceCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*GetUnconfirmedBalanceCmd) Method

func (cmd *GetUnconfirmedBalanceCmd) Method() string

Method satisifies the Cmd interface by returning the RPC method.

func (*GetUnconfirmedBalanceCmd) UnmarshalJSON

func (cmd *GetUnconfirmedBalanceCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type ListAddressTransactionsCmd

type ListAddressTransactionsCmd struct {
	Account   string
	Addresses []string
	// contains filtered or unexported fields
}

ListAddressTransactionsCmd is a type handling custom marshaling and unmarshaling of listaddresstransactions JSON websocket extension commands.

func NewListAddressTransactionsCmd

func NewListAddressTransactionsCmd(id interface{}, addresses []string,
	optArgs ...string) (*ListAddressTransactionsCmd, error)

NewListAddressTransactionsCmd creates a new ListAddressTransactionsCmd.

func (*ListAddressTransactionsCmd) Id

func (cmd *ListAddressTransactionsCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*ListAddressTransactionsCmd) MarshalJSON

func (cmd *ListAddressTransactionsCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*ListAddressTransactionsCmd) Method

func (cmd *ListAddressTransactionsCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*ListAddressTransactionsCmd) UnmarshalJSON

func (cmd *ListAddressTransactionsCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type ListAllTransactionsCmd

type ListAllTransactionsCmd struct {
	Account *string
	// contains filtered or unexported fields
}

ListAllTransactionsCmd is a type handling custom marshaling and unmarshaling of listalltransactions JSON websocket extension commands.

func NewListAllTransactionsCmd

func NewListAllTransactionsCmd(id interface{},
	optArgs ...string) (*ListAllTransactionsCmd, error)

NewListAllTransactionsCmd creates a new ListAllTransactionsCmd.

func (*ListAllTransactionsCmd) Id

func (cmd *ListAllTransactionsCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*ListAllTransactionsCmd) MarshalJSON

func (cmd *ListAllTransactionsCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*ListAllTransactionsCmd) Method

func (cmd *ListAllTransactionsCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*ListAllTransactionsCmd) UnmarshalJSON

func (cmd *ListAllTransactionsCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type NotifyBlocksCmd

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

NotifyBlocksCmd is a type handling custom marshaling and unmarshaling of notifyblocks JSON websocket extension commands.

func NewNotifyBlocksCmd

func NewNotifyBlocksCmd(id interface{}) *NotifyBlocksCmd

NewNotifyBlocksCmd creates a new NotifyBlocksCmd.

func (*NotifyBlocksCmd) Id

func (cmd *NotifyBlocksCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*NotifyBlocksCmd) MarshalJSON

func (cmd *NotifyBlocksCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*NotifyBlocksCmd) Method

func (cmd *NotifyBlocksCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*NotifyBlocksCmd) UnmarshalJSON

func (cmd *NotifyBlocksCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type NotifyNewTransactionsCmd

type NotifyNewTransactionsCmd struct {
	Verbose bool
	// contains filtered or unexported fields
}

NotifyNewTransactionsCmd is a type handling custom marshaling and unmarshaling of notifynewtransactions JSON websocket extension commands.

func NewNotifyNewTransactionsCmd

func NewNotifyNewTransactionsCmd(id interface{}, optArgs ...bool) (*NotifyNewTransactionsCmd, error)

NewNotifyNewTransactionsCmd creates a new NotifyNewTransactionsCmd that optionally takes a single verbose parameter that defaults to false.

func (*NotifyNewTransactionsCmd) Id

func (cmd *NotifyNewTransactionsCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*NotifyNewTransactionsCmd) MarshalJSON

func (cmd *NotifyNewTransactionsCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*NotifyNewTransactionsCmd) Method

func (cmd *NotifyNewTransactionsCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*NotifyNewTransactionsCmd) UnmarshalJSON

func (cmd *NotifyNewTransactionsCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type NotifyReceivedCmd

type NotifyReceivedCmd struct {
	Addresses []string
	// contains filtered or unexported fields
}

NotifyReceivedCmd is a type handling custom marshaling and unmarshaling of notifyreceived JSON websocket extension commands.

func NewNotifyReceivedCmd

func NewNotifyReceivedCmd(id interface{}, addresses []string) *NotifyReceivedCmd

NewNotifyReceivedCmd creates a new NotifyReceivedCmd.

func (*NotifyReceivedCmd) Id

func (cmd *NotifyReceivedCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*NotifyReceivedCmd) MarshalJSON

func (cmd *NotifyReceivedCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*NotifyReceivedCmd) Method

func (cmd *NotifyReceivedCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*NotifyReceivedCmd) UnmarshalJSON

func (cmd *NotifyReceivedCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type NotifySpentCmd

type NotifySpentCmd struct {
	OutPoints []OutPoint
	// contains filtered or unexported fields
}

NotifySpentCmd is a type handling custom marshaling and unmarshaling of notifyspent JSON websocket extension commands.

func NewNotifySpentCmd

func NewNotifySpentCmd(id interface{}, outpoints []OutPoint) *NotifySpentCmd

NewNotifySpentCmd creates a new NotifySpentCmd.

func (*NotifySpentCmd) Id

func (cmd *NotifySpentCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*NotifySpentCmd) MarshalJSON

func (cmd *NotifySpentCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*NotifySpentCmd) Method

func (cmd *NotifySpentCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*NotifySpentCmd) UnmarshalJSON

func (cmd *NotifySpentCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type OutPoint

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

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

func NewOutPointFromWire

func NewOutPointFromWire(op *wire.OutPoint) *OutPoint

NewOutPointFromWire creates a new OutPoint from the OutPoint structure of the wire package.

type RecoverAddressesCmd

type RecoverAddressesCmd struct {
	Account string
	N       int
	// contains filtered or unexported fields
}

RecoverAddressesCmd is a type handling custom marshaling and unmarshaling of recoveraddresses JSON websocket extension commands.

func NewRecoverAddressesCmd

func NewRecoverAddressesCmd(id interface{}, account string, n int) *RecoverAddressesCmd

NewRecoverAddressesCmd creates a new RecoverAddressesCmd.

func (*RecoverAddressesCmd) Id

func (cmd *RecoverAddressesCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*RecoverAddressesCmd) MarshalJSON

func (cmd *RecoverAddressesCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*RecoverAddressesCmd) Method

func (cmd *RecoverAddressesCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*RecoverAddressesCmd) UnmarshalJSON

func (cmd *RecoverAddressesCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type RecvTxNtfn

type RecvTxNtfn struct {
	HexTx string
	Block *BlockDetails
}

RecvTxNtfn is a type handling custom marshaling and unmarshaling of recvtx JSON websocket notifications.

func NewRecvTxNtfn

func NewRecvTxNtfn(hextx string, block *BlockDetails) *RecvTxNtfn

NewRecvTxNtfn creates a new RecvTxNtfn.

func (*RecvTxNtfn) Id

func (n *RecvTxNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*RecvTxNtfn) MarshalJSON

func (n *RecvTxNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*RecvTxNtfn) Method

func (n *RecvTxNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*RecvTxNtfn) UnmarshalJSON

func (n *RecvTxNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type RedeemingTxNtfn

type RedeemingTxNtfn struct {
	HexTx string
	Block *BlockDetails
}

RedeemingTxNtfn is a type handling custom marshaling and unmarshaling of redeemingtx JSON websocket notifications.

func NewRedeemingTxNtfn

func NewRedeemingTxNtfn(hextx string, block *BlockDetails) *RedeemingTxNtfn

NewRedeemingTxNtfn creates a new RedeemingTxNtfn.

func (*RedeemingTxNtfn) Id

func (n *RedeemingTxNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*RedeemingTxNtfn) MarshalJSON

func (n *RedeemingTxNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*RedeemingTxNtfn) Method

func (n *RedeemingTxNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*RedeemingTxNtfn) UnmarshalJSON

func (n *RedeemingTxNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type RenameAccountCmd

type RenameAccountCmd struct {
	OldAccount string
	NewAccount string
	// contains filtered or unexported fields
}

RenameAccountCmd is a type handling custom marshaling and unmarshaling of renameaccount JSON websocket extension commands.

func NewRenameAccountCmd

func NewRenameAccountCmd(id interface{}, oldaccount, newaccount string) *RenameAccountCmd

NewRenameAccountCmd creates a new GetCurrentNetCmd.

func (*RenameAccountCmd) Id

func (cmd *RenameAccountCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*RenameAccountCmd) MarshalJSON

func (cmd *RenameAccountCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*RenameAccountCmd) Method

func (cmd *RenameAccountCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*RenameAccountCmd) UnmarshalJSON

func (cmd *RenameAccountCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type RescanCmd

type RescanCmd struct {
	BeginBlock string
	Addresses  []string
	OutPoints  []OutPoint
	EndBlock   string
	// contains filtered or unexported fields
}

RescanCmd is a type handling custom marshaling and unmarshaling of rescan JSON websocket extension commands.

func NewRescanCmd

func NewRescanCmd(id interface{}, begin string, addresses []string,
	outpoints []OutPoint, optArgs ...string) (*RescanCmd, error)

NewRescanCmd creates a new RescanCmd, parsing the optional arguments optArgs which may either be empty or a single upper block hash.

func (*RescanCmd) Id

func (cmd *RescanCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*RescanCmd) MarshalJSON

func (cmd *RescanCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*RescanCmd) Method

func (cmd *RescanCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*RescanCmd) UnmarshalJSON

func (cmd *RescanCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type RescanFinishedNtfn

type RescanFinishedNtfn struct {
	Hash   string
	Height int32
	Time   int64
}

RescanFinishedNtfn is type handling custom marshaling and unmarshaling of rescanfinished JSON websocket notifications.

func NewRescanFinishedNtfn

func NewRescanFinishedNtfn(hash string, height int32, time int64) *RescanFinishedNtfn

NewRescanFinishedNtfn creates a new RescanFinshedNtfn.

func (*RescanFinishedNtfn) Id

func (n *RescanFinishedNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*RescanFinishedNtfn) MarshalJSON

func (n *RescanFinishedNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*RescanFinishedNtfn) Method

func (n *RescanFinishedNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*RescanFinishedNtfn) UnmarshalJSON

func (n *RescanFinishedNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type RescanProgressNtfn

type RescanProgressNtfn struct {
	Hash   string
	Height int32
	Time   int64
}

RescanProgressNtfn is type handling custom marshaling and unmarshaling of rescanprogress JSON websocket notifications.

func NewRescanProgressNtfn

func NewRescanProgressNtfn(hash string, height int32, time int64) *RescanProgressNtfn

NewRescanProgressNtfn creates a new RescanProgressNtfn.

func (*RescanProgressNtfn) Id

func (n *RescanProgressNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*RescanProgressNtfn) MarshalJSON

func (n *RescanProgressNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*RescanProgressNtfn) Method

func (n *RescanProgressNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*RescanProgressNtfn) UnmarshalJSON

func (n *RescanProgressNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type TxAcceptedNtfn

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

TxAcceptedNtfn is a type handling custom marshaling and unmarshaling of txmined JSON websocket notifications.

func NewTxAcceptedNtfn

func NewTxAcceptedNtfn(txid string, amount int64) *TxAcceptedNtfn

NewTxAcceptedNtfn creates a new TxAcceptedNtfn.

func (*TxAcceptedNtfn) Id

func (n *TxAcceptedNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*TxAcceptedNtfn) MarshalJSON

func (n *TxAcceptedNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*TxAcceptedNtfn) Method

func (n *TxAcceptedNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*TxAcceptedNtfn) UnmarshalJSON

func (n *TxAcceptedNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type TxAcceptedVerboseNtfn

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

TxAcceptedVerboseNtfn is a type handling custom marshaling and unmarshaling of txmined JSON websocket notifications.

func NewTxAcceptedVerboseNtfn

func NewTxAcceptedVerboseNtfn(rawTx *btcjson.TxRawResult) *TxAcceptedVerboseNtfn

NewTxAcceptedVerboseNtfn creates a new TxAcceptedVerboseNtfn.

func (*TxAcceptedVerboseNtfn) Id

func (n *TxAcceptedVerboseNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*TxAcceptedVerboseNtfn) MarshalJSON

func (n *TxAcceptedVerboseNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*TxAcceptedVerboseNtfn) Method

func (n *TxAcceptedVerboseNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*TxAcceptedVerboseNtfn) UnmarshalJSON

func (n *TxAcceptedVerboseNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type TxNtfn

type TxNtfn struct {
	Account string
	Details *btcjson.ListTransactionsResult
}

TxNtfn is a type handling custom marshaling and unmarshaling of newtx JSON websocket notifications.

func NewTxNtfn

func NewTxNtfn(account string, details *btcjson.ListTransactionsResult) *TxNtfn

NewTxNtfn creates a new TxNtfn.

func (*TxNtfn) Id

func (n *TxNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*TxNtfn) MarshalJSON

func (n *TxNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*TxNtfn) Method

func (n *TxNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*TxNtfn) UnmarshalJSON

func (n *TxNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

type WalletIsLockedCmd

type WalletIsLockedCmd struct {
	Account string
	// contains filtered or unexported fields
}

WalletIsLockedCmd is a type handling custom marshaling and unmarshaling of walletislocked JSON websocket extension commands.

func NewWalletIsLockedCmd

func NewWalletIsLockedCmd(id interface{},
	optArgs ...string) (*WalletIsLockedCmd, error)

NewWalletIsLockedCmd creates a new WalletIsLockedCmd.

func (*WalletIsLockedCmd) Id

func (cmd *WalletIsLockedCmd) Id() interface{}

Id satisifies the Cmd interface by returning the ID of the command.

func (*WalletIsLockedCmd) MarshalJSON

func (cmd *WalletIsLockedCmd) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface.

func (*WalletIsLockedCmd) Method

func (cmd *WalletIsLockedCmd) Method() string

Method satisfies the Cmd interface by returning the RPC method.

func (*WalletIsLockedCmd) UnmarshalJSON

func (cmd *WalletIsLockedCmd) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of the Cmd interface.

type WalletLockStateNtfn

type WalletLockStateNtfn struct {
	Account string
	Locked  bool
}

WalletLockStateNtfn is a type handling custom marshaling and unmarshaling of walletlockstate JSON websocket notifications.

func NewWalletLockStateNtfn

func NewWalletLockStateNtfn(account string,
	locked bool) *WalletLockStateNtfn

NewWalletLockStateNtfn creates a new WalletLockStateNtfn.

func (*WalletLockStateNtfn) Id

func (n *WalletLockStateNtfn) Id() interface{}

Id satisifies the btcjson.Cmd interface by returning nil for a notification ID.

func (*WalletLockStateNtfn) MarshalJSON

func (n *WalletLockStateNtfn) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of n. Part of the btcjson.Cmd interface.

func (*WalletLockStateNtfn) Method

func (n *WalletLockStateNtfn) Method() string

Method satisifies the btcjson.Cmd interface by returning the method of the notification.

func (*WalletLockStateNtfn) UnmarshalJSON

func (n *WalletLockStateNtfn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JSON encoding of n into n. Part of the btcjson.Cmd interface.

Jump to

Keyboard shortcuts

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