legacy

package
v0.0.2-0...-1c7e8a7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Unlicense Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const MaxRequestSize = 1024 * 1024 * 4

MaxRequestSize specifies the maximum number of bytes in the request body that may be read from a client. This is currently limited to 4MB.

Variables

View Source
var (
	ErrNeedPositiveAmount = InvalidParameterError{
		errors.New("amount must be positive"),
	}
	ErrNeedPositiveMinconf = InvalidParameterError{
		errors.New("minconf must be positive"),
	}
	ErrAddressNotInWallet = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "address not found in wallet",
	}
	ErrAccountNameNotFound = btcjson.RPCError{
		Code:    btcjson.ErrRPCWalletInvalidAccountName,
		Message: "account name not found",
	}
	ErrUnloadedWallet = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "Request requires a wallet but wallet has not loaded yet",
	}
	ErrWalletUnlockNeeded = btcjson.RPCError{
		Code:    btcjson.ErrRPCWalletUnlockNeeded,
		Message: "Enter the wallet passphrase with walletpassphrase first",
	}
	ErrNotImportedAccount = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "imported addresses must belong to the imported account",
	}
	ErrNoTransactionInfo = btcjson.RPCError{
		Code:    btcjson.ErrRPCNoTxInfo,
		Message: "No information for transaction",
	}
	ErrReservedAccountName = btcjson.RPCError{
		Code:    btcjson.ErrRPCInvalidParameter,
		Message: "Account name is reserved by RPC server",
	}
)

Errors variables that are defined once here to avoid duplication below.

View Source
var ErrNoAuth = errors.New("no auth")

ErrNoAuth represents an error where authentication could not succeed due to a missing Authorization HTTP header.

View Source
var HelpDescs map[string]string
View Source
var HelpDescsMutex sync.Mutex // Help may execute concurrently, so synchronize access.
View Source
var LocaleHelpDescs = map[string]func() map[string]string{
	"en_US": HelpDescsEnUS,
}
View Source
var RPCHandlers = map[string]struct {
	Handler RequestHandler
	// Function variables cannot be compared against anything but nil, so use a boolean to record whether help
	// generation is necessary.  This is used by the tests to ensure that help can be generated for every implemented
	// method.
	//
	// A single map and this bool is here is used rather than several maps for the unimplemented handlers so every
	// method has exactly one handler function.
	//
	// The Return field returns a new channel of the type returned by this function. This makes it possible to use this
	// for callers to receive a response in the cpc library which implements the functions as channel pipes
	NoHelp bool
	Call   chan API
	Params interface{}
	Result func() API
}{
	"addmultisigaddress": {
		Handler: AddMultiSigAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan AddMultiSigAddressRes)} }},
	"createmultisig": {
		Handler: CreateMultiSig, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan CreateMultiSigRes)} }},
	"createnewaccount": {
		Handler: CreateNewAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan CreateNewAccountRes)} }},
	"dropwallethistory": {
		Handler: HandleDropWalletHistory, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan HandleDropWalletHistoryRes)} }},
	"dumpprivkey": {
		Handler: DumpPrivKey, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan DumpPrivKeyRes)} }},
	"getaccount": {
		Handler: GetAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAccountRes)} }},
	"getaccountaddress": {
		Handler: GetAccountAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAccountAddressRes)} }},
	"getaddressesbyaccount": {
		Handler: GetAddressesByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAddressesByAccountRes)} }},
	"getbalance": {
		Handler: GetBalance, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBalanceRes)} }},
	"getbestblock": {
		Handler: GetBestBlock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBestBlockRes)} }},
	"getbestblockhash": {
		Handler: GetBestBlockHash, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBestBlockHashRes)} }},
	"getblockcount": {
		Handler: GetBlockCount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBlockCountRes)} }},
	"getinfo": {
		Handler: GetInfo, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetInfoRes)} }},
	"getnewaddress": {
		Handler: GetNewAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetNewAddressRes)} }},
	"getrawchangeaddress": {
		Handler: GetRawChangeAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetRawChangeAddressRes)} }},
	"getreceivedbyaccount": {
		Handler: GetReceivedByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetReceivedByAccountRes)} }},
	"getreceivedbyaddress": {
		Handler: GetReceivedByAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetReceivedByAddressRes)} }},
	"gettransaction": {
		Handler: GetTransaction, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetTransactionRes)} }},
	"getunconfirmedbalance": {
		Handler: GetUnconfirmedBalance, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetUnconfirmedBalanceRes)} }},
	"help": {
		Handler: HelpNoChainRPC, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan HelpNoChainRPCRes)} }},
	"importprivkey": {
		Handler: ImportPrivKey, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ImportPrivKeyRes)} }},
	"keypoolrefill": {
		Handler: KeypoolRefill, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan KeypoolRefillRes)} }},
	"listaccounts": {
		Handler: ListAccounts, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAccountsRes)} }},
	"listaddresstransactions": {
		Handler: ListAddressTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAddressTransactionsRes)} }},
	"listalltransactions": {
		Handler: ListAllTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAllTransactionsRes)} }},
	"listlockunspent": {
		Handler: ListLockUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListLockUnspentRes)} }},
	"listreceivedbyaccount": {
		Handler: ListReceivedByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListReceivedByAccountRes)} }},
	"listreceivedbyaddress": {
		Handler: ListReceivedByAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListReceivedByAddressRes)} }},
	"listsinceblock": {
		Handler: ListSinceBlock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListSinceBlockRes)} }},
	"listtransactions": {
		Handler: ListTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListTransactionsRes)} }},
	"listunspent": {
		Handler: ListUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListUnspentRes)} }},
	"renameaccount": {
		Handler: RenameAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan RenameAccountRes)} }},
	"sendfrom": {
		Handler: LockUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan LockUnspentRes)} }},
	"sendmany": {
		Handler: SendMany, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SendManyRes)} }},
	"sendtoaddress": {
		Handler: SendToAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SendToAddressRes)} }},
	"settxfee": {
		Handler: SetTxFee, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SetTxFeeRes)} }},
	"signmessage": {
		Handler: SignMessage, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SignMessageRes)} }},
	"signrawtransaction": {
		Handler: SignRawTransaction, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SignRawTransactionRes)} }},
	"validateaddress": {
		Handler: ValidateAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ValidateAddressRes)} }},
	"verifymessage": {
		Handler: VerifyMessage, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan VerifyMessageRes)} }},
	"walletislocked": {
		Handler: WalletIsLocked, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletIsLockedRes)} }},
	"walletlock": {
		Handler: WalletLock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletLockRes)} }},
	"walletpassphrase": {
		Handler: WalletPassphrase, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletPassphraseRes)} }},
	"walletpassphrasechange": {
		Handler: WalletPassphraseChange, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletPassphraseChangeRes)} }},
}

RPCHandlers is all of the RPC calls available

- Handler is the handler function

  • Call is a channel carrying a struct containing parameters and error that is listened to in RunAPI to dispatch the calls

- Result is a bundle of command parameters and a channel that the result will be sent back on

Get and save the Result function's return, and you can then call the call functions check, result and wait functions for asynchronous and synchronous calls to RPC functions

View Source
var RequestUsages = "" /* 1969-byte string literal not displayed */

Functions

func AddMultiSigAddress

func AddMultiSigAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

AddMultiSigAddress handles an addmultisigaddress request by adding a multisig address to the given wallet.

func Check

func Check(err error) bool

func Confirms

func Confirms(txHeight, curHeight int32) int32

Confirms returns the number of confirmations for a transaction in a block at height txHeight (or -1 for an unconfirmed tx) given the chain height curHeight.

func CreateMultiSig

func CreateMultiSig(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

CreateMultiSig handles an createmultisig request by returning a multisig address for the given inputs.

func CreateNewAccount

func CreateNewAccount(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

CreateNewAccount handles a createnewaccount request by creating and returning a new account. If the last account has no transaction history as per BIP 0044 a new account cannot be created so an error will be returned.

func Debug

func Debug(a ...interface{})

func Debugc

func Debugc(fn func() string)

func Debugf

func Debugf(format string, a ...interface{})

func Debugs

func Debugs(a interface{})

func DecodeAddress

func DecodeAddress(s string, params *netparams.Params) (util.Address, error)

func DecodeHexStr

func DecodeHexStr(hexStr string) ([]byte, error)

DecodeHexStr decodes the hex encoding of a string, possibly prepending a leading '0' character if there is an odd number of bytes in the hex string. This is to prevent an error for an invalid hex string when using an odd number of bytes when calling hex.Decode.

func DropWalletHistory

func DropWalletHistory(w *wallet.Wallet) func(c *cli.Context) error

func DumpPrivKey

func DumpPrivKey(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

DumpPrivKey handles a dumpprivkey request with the private key for a single address, or an appropriate error if the wallet is locked.

func Error

func Error(a ...interface{})

func Errorc

func Errorc(fn func() string)

func Errorf

func Errorf(format string, a ...interface{})

func Errors

func Errors(a interface{})

func Fatal

func Fatal(a ...interface{})

func Fatalc

func Fatalc(fn func() string)

func Fatalf

func Fatalf(format string, a ...interface{})

func Fatals

func Fatals(a interface{})

func GetAccount

func GetAccount(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

GetAccount handles a getaccount request by returning the account name associated with a single address.

func GetAccountAddress

func GetAccountAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetAccountAddress handles a getaccountaddress by returning the most recently-created chained address that has not yet been used (does not yet appear in the blockchain, or any tx that has arrived in the pod mempool).

If the most recently-requested address has been used, a new address (the next chained address in the keypool) is used. This can fail if the keypool runs out (and will return json.ErrRPCWalletKeypoolRanOut if that happens).

func GetAddressesByAccount

func GetAddressesByAccount(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetAddressesByAccount handles a getaddressesbyaccount request by returning all addresses for an account, or an error if the requested account does not exist.

func GetBalance

func GetBalance(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetBalance handles a getbalance request by returning the balance for an account (wallet), or an error if the requested account does not exist.

func GetBestBlock

func GetBestBlock(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetBestBlock handles a getbestblock request by returning a JSON object with the height and hash of the most recently processed block.

func GetBestBlockHash

func GetBestBlockHash(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetBestBlockHash handles a getbestblockhash request by returning the hash of the most recently processed block.

func GetBlockCount

func GetBlockCount(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetBlockCount handles a getblockcount request by returning the chain height of the most recently processed block.

func GetInfo

func GetInfo(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetInfo handles a getinfo request by returning the a structure containing information about the current state of btcwallet. exist.

func GetNewAddress

func GetNewAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetNewAddress handles a getnewaddress request by returning a new address for an account. If the account does not exist an appropiate error is returned.

TODO: Follow BIP 0044 and warn if number of unused addresses exceeds the gap limit.

func GetRawChangeAddress

func GetRawChangeAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetRawChangeAddress handles a getrawchangeaddress request by creating and returning a new change address for an account.

Note: bitcoind allows specifying the account as an optional parameter, but ignores the parameter.

func GetReceivedByAccount

func GetReceivedByAccount(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetReceivedByAccount handles a getreceivedbyaccount request by returning the total amount received by addresses of an account.

func GetReceivedByAddress

func GetReceivedByAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetReceivedByAddress handles a getreceivedbyaddress request by returning the total amount received by a single address.

func GetTransaction

func GetTransaction(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetTransaction handles a gettransaction request by returning details about a single transaction saved by wallet.

func GetUnconfirmedBalance

func GetUnconfirmedBalance(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

GetUnconfirmedBalance handles a getunconfirmedbalance extension request by returning the current unconfirmed balance of an account.

func HTTPBasicAuth

func HTTPBasicAuth(username, password string) []byte

HTTPBasicAuth returns the UTF-8 bytes of the HTTP Basic authentication string:

"Basic " + base64(username + ":" + password)

func HandleDropWalletHistory

func HandleDropWalletHistory(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (
	out interface{}, err error)

func Help

func Help(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error)

Help handles the Help request by returning one line usage of all available methods, or full Help for a specific method. The chainClient is optional, and this is simply a helper function for the HelpNoChainRPC and HelpWithChainRPC handlers.

func HelpDescsEnUS

func HelpDescsEnUS() map[string]string

func HelpNoChainRPC

func HelpNoChainRPC(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

HelpNoChainRPC handles the help request when the RPC server has not been associated with a consensus RPC client. No help messages are included for passthrough requests.

func HelpWithChainRPC

func HelpWithChainRPC(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

HelpWithChainRPC handles the help request when the RPC server has been associated with a consensus RPC client. The additional RPC client is used to include help messages for methods implemented by the consensus server via RPC passthrough.

func IDPointer

func IDPointer(id interface{}) (p *interface{})

IDPointer returns a pointer to the passed ID, or nil if the interface is nil. Interface pointers are usually a red flag of doing something incorrectly, but this is only implemented here to work around an oddity with json, which uses empty interface pointers for response IDs.

func ImportPrivKey

func ImportPrivKey(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

ImportPrivKey handles an importprivkey request by parsing a WIF-encoded private key and adding it to an account.

func Info

func Info(a ...interface{})

func Infoc

func Infoc(fn func() string)

func Infof

func Infof(format string, a ...interface{})

func Infos

func Infos(a interface{})

func IsNilOrEmpty

func IsNilOrEmpty(s *string) bool

func JSONAuthFail

func JSONAuthFail(w http.ResponseWriter)

JSONAuthFail sends a message back to the client if the http auth is rejected.

func JSONError

func JSONError(err error) *btcjson.RPCError

JSONError creates a JSON-RPC error from the Go error.

func KeypoolRefill

func KeypoolRefill(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

KeypoolRefill handles the keypoolrefill command. Since we handle the keypool automatically this does nothing since refilling is never manually required.

func ListAccounts

func ListAccounts(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListAccounts handles a listaccounts request by returning a map of account names to their balances.

func ListAddressTransactions

func ListAddressTransactions(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListAddressTransactions handles a listaddresstransactions request by returning an array of maps with details of spent and received wallet transactions.

The form of the reply is identical to listtransactions, but the array elements are limited to transaction details which are about the addresess included in the request.

func ListAllTransactions

func ListAllTransactions(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListAllTransactions handles a listalltransactions request by returning a map with details of sent and received wallet transactions. This is similar to ListTransactions, except it takes only a single optional argument for the account name and replies with all transactions.

func ListLockUnspent

func ListLockUnspent(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListLockUnspent handles a listlockunspent request by returning an slice of all locked outpoints.

func ListReceivedByAccount

func ListReceivedByAccount(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListReceivedByAccount handles a listreceivedbyaccount request by returning a slice of objects, each one containing:

"account": the receiving account;

"amount": total amount received by the account;

"confirmations": number of confirmations of the most recent transaction.

It takes two parameters:

"minconf": minimum number of confirmations to consider a transaction - default: one;

"includeempty": whether or not to include addresses that have no transactions - default: false.

func ListReceivedByAddress

func ListReceivedByAddress(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListReceivedByAddress handles a listreceivedbyaddress request by returning a slice of objects, each one containing:

"account": the account of the receiving address;

"address": the receiving address;

"amount": total amount received by the address;

"confirmations": number of confirmations of the most recent transaction.

It takes two parameters:

"minconf": minimum number of confirmations to consider a transaction - default: one;

"includeempty": whether or not to include addresses that have no transactions - default: false.

func ListSinceBlock

func ListSinceBlock(icmd interface{}, w *wallet.Wallet,
	cc ...*chain.RPCClient) (interface{}, error)

ListSinceBlock handles a listsinceblock request by returning an array of maps with details of sent and received wallet transactions since the given block.

func ListTransactions

func ListTransactions(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (txs interface{}, err error)

ListTransactions handles a listtransactions request by returning an array of maps with details of sent and recevied wallet transactions.

func ListUnspent

func ListUnspent(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

ListUnspent handles the listunspent command.

func LockUnspent

func LockUnspent(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

LockUnspent handles the lockunspent command.

func MakeMultiSigScript

func MakeMultiSigScript(w *wallet.Wallet, keys []string, nRequired int) ([]byte, error)

MakeMultiSigScript is a helper function to combine common logic for AddMultiSig and CreateMultiSig.

func MakeOutputs

func MakeOutputs(pairs map[string]util.Amount, chainParams *netparams.Params) ([]*wire.TxOut, error)

MakeOutputs creates a slice of transaction outputs from a pair of address strings to amounts. This is used to create the outputs to include in newly created transactions from a JSON object describing the output destinations and amounts.

func MakeResponse

func MakeResponse(id, result interface{}, err error) btcjson.Response

MakeResponse makes the JSON-RPC response struct for the result and error returned by a requestHandler. The returned response is not ready for marshaling and sending off to a client, but must be

func RenameAccount

func RenameAccount(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

RenameAccount handles a renameaccount request by renaming an account. If the account does not exist an appropiate error will be returned.

func RunAPI

func RunAPI(chainRPC *chain.RPCClient, wallet *wallet.Wallet,
	quit chan struct{})

RunAPI starts up the api handler server that receives rpc.API messages and runs the handler and returns the result Note that the parameters are type asserted to prevent the consumer of the API from sending wrong message types not because it's necessary since they are interfaces end to end

func SendFrom

func SendFrom(icmd interface{}, w *wallet.Wallet, chainClient *chain.RPCClient) (interface{}, error)

SendFrom handles a sendfrom RPC request by creating a new transaction spending unspent transaction outputs for a wallet to another payment address. Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SendMany

func SendMany(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

SendMany handles a sendmany RPC request by creating a new transaction spending unspent transaction outputs for a wallet to any number of payment addresses.

Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SendPairs

func SendPairs(w *wallet.Wallet, amounts map[string]util.Amount,
	account uint32, minconf int32, feeSatPerKb util.Amount) (string, error)

SendPairs creates and sends payment transactions. It returns the transaction hash in string format upon success All errors are returned in json.RPCError format

func SendToAddress

func SendToAddress(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

SendToAddress handles a sendtoaddress RPC request by creating a new transaction spending unspent transaction outputs for a wallet to another payment address.

Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SetTxFee

func SetTxFee(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

SetTxFee sets the transaction fee per kilobyte added to transactions.

func SignMessage

func SignMessage(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

SignMessage signs the given message with the private key for the given address

func SignRawTransaction

func SignRawTransaction(icmd interface{}, w *wallet.Wallet,
	cc ...*chain.RPCClient) (interface{}, error)

SignRawTransaction handles the signrawtransaction command.

func Throttled

func Throttled(threshold int64, h http.Handler) http.Handler

Throttled wraps an http.Handler with throttling of concurrent active clients by responding with an HTTP 429 when the threshold is crossed.

func ThrottledFn

func ThrottledFn(threshold int64, f http.HandlerFunc) http.Handler

ThrottledFn wraps an http.HandlerFunc with throttling of concurrent active clients by responding with an HTTP 429 when the threshold is crossed.

func Trace

func Trace(a ...interface{})

func Tracec

func Tracec(fn func() string)

func Tracef

func Tracef(format string, a ...interface{})

func Traces

func Traces(a interface{})

func Unimplemented

func Unimplemented(interface{}, *wallet.Wallet) (interface{}, error)

Unimplemented handles an Unimplemented RPC request with the appropiate error.

func Unsupported

func Unsupported(interface{}, *wallet.Wallet) (interface{}, error)

Unsupported handles a standard bitcoind RPC request which is Unsupported by btcwallet due to design differences.

func ValidateAddress

func ValidateAddress(icmd interface{}, w *wallet.Wallet, chainClient ...*chain.RPCClient) (interface{}, error)

ValidateAddress handles the validateaddress command.

func VerifyMessage

func VerifyMessage(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

VerifyMessage handles the verifymessage command by verifying the provided compact signature for the given address and message.

func WalletIsLocked

func WalletIsLocked(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

WalletIsLocked handles the walletislocked extension request by returning the current lock state (false for unlocked, true for locked) of an account.

func WalletLock

func WalletLock(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

WalletLock handles a walletlock request by locking the all account wallets, returning an error if any wallet is not encrypted (for example, a watching-only wallet).

func WalletPassphrase

func WalletPassphrase(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

WalletPassphrase responds to the walletpassphrase request by unlocking the wallet. The decryption key is saved in the wallet until timeout seconds expires, after which the wallet is locked.

func WalletPassphraseChange

func WalletPassphraseChange(icmd interface{}, w *wallet.Wallet,
	chainClient ...*chain.RPCClient) (interface{}, error)

WalletPassphraseChange responds to the walletpassphrasechange request by unlocking all accounts with the provided old passphrase, and re-encrypting each private key with an AES key derived from the new passphrase.

If the old passphrase is correct and the passphrase is changed, all wallets will be immediately locked.

func Warn

func Warn(a ...interface{})

func Warnc

func Warnc(fn func() string)

func Warnf

func Warnf(format string, a ...interface{})

func Warns

func Warns(a interface{})

Types

type API

type API struct {
	Ch     interface{}
	Params interface{}
	Result interface{}
}

API stores the channel, parameters and result values from calls via the channel

func (API) AddMultiSigAddress

func (a API) AddMultiSigAddress(cmd *btcjson.AddMultisigAddressCmd) (err error)

AddMultiSigAddress calls the method with the given parameters

func (API) AddMultiSigAddressCheck

func (a API) AddMultiSigAddressCheck() (isNew bool)

AddMultiSigAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) AddMultiSigAddressGetRes

func (a API) AddMultiSigAddressGetRes() (out *string, err error)

AddMultiSigAddressGetRes returns a pointer to the value in the Result field

func (API) AddMultiSigAddressWait

func (a API) AddMultiSigAddressWait(cmd *btcjson.AddMultisigAddressCmd) (out *string, err error)

AddMultiSigAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) CreateMultiSig

func (a API) CreateMultiSig(cmd *btcjson.CreateMultisigCmd) (err error)

CreateMultiSig calls the method with the given parameters

func (API) CreateMultiSigCheck

func (a API) CreateMultiSigCheck() (isNew bool)

CreateMultiSigCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) CreateMultiSigGetRes

func (a API) CreateMultiSigGetRes() (out *btcjson.CreateMultiSigResult, err error)

CreateMultiSigGetRes returns a pointer to the value in the Result field

func (API) CreateMultiSigWait

func (a API) CreateMultiSigWait(cmd *btcjson.CreateMultisigCmd) (out *btcjson.CreateMultiSigResult, err error)

CreateMultiSigWait calls the method and blocks until it returns or 5 seconds passes

func (API) CreateNewAccount

func (a API) CreateNewAccount(cmd *btcjson.CreateNewAccountCmd) (err error)

CreateNewAccount calls the method with the given parameters

func (API) CreateNewAccountCheck

func (a API) CreateNewAccountCheck() (isNew bool)

CreateNewAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) CreateNewAccountGetRes

func (a API) CreateNewAccountGetRes() (out *None, err error)

CreateNewAccountGetRes returns a pointer to the value in the Result field

func (API) CreateNewAccountWait

func (a API) CreateNewAccountWait(cmd *btcjson.CreateNewAccountCmd) (out *None, err error)

CreateNewAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) DumpPrivKey

func (a API) DumpPrivKey(cmd *btcjson.DumpPrivKeyCmd) (err error)

DumpPrivKey calls the method with the given parameters

func (API) DumpPrivKeyCheck

func (a API) DumpPrivKeyCheck() (isNew bool)

DumpPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) DumpPrivKeyGetRes

func (a API) DumpPrivKeyGetRes() (out *string, err error)

DumpPrivKeyGetRes returns a pointer to the value in the Result field

func (API) DumpPrivKeyWait

func (a API) DumpPrivKeyWait(cmd *btcjson.DumpPrivKeyCmd) (out *string, err error)

DumpPrivKeyWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAccount

func (a API) GetAccount(cmd *btcjson.GetAccountCmd) (err error)

GetAccount calls the method with the given parameters

func (API) GetAccountAddress

func (a API) GetAccountAddress(cmd *btcjson.GetAccountAddressCmd) (err error)

GetAccountAddress calls the method with the given parameters

func (API) GetAccountAddressCheck

func (a API) GetAccountAddressCheck() (isNew bool)

GetAccountAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAccountAddressGetRes

func (a API) GetAccountAddressGetRes() (out *string, err error)

GetAccountAddressGetRes returns a pointer to the value in the Result field

func (API) GetAccountAddressWait

func (a API) GetAccountAddressWait(cmd *btcjson.GetAccountAddressCmd) (out *string, err error)

GetAccountAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAccountCheck

func (a API) GetAccountCheck() (isNew bool)

GetAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAccountGetRes

func (a API) GetAccountGetRes() (out *string, err error)

GetAccountGetRes returns a pointer to the value in the Result field

func (API) GetAccountWait

func (a API) GetAccountWait(cmd *btcjson.GetAccountCmd) (out *string, err error)

GetAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAddressesByAccount

func (a API) GetAddressesByAccount(cmd *btcjson.GetAddressesByAccountCmd) (err error)

GetAddressesByAccount calls the method with the given parameters

func (API) GetAddressesByAccountCheck

func (a API) GetAddressesByAccountCheck() (isNew bool)

GetAddressesByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAddressesByAccountGetRes

func (a API) GetAddressesByAccountGetRes() (out *[]string, err error)

GetAddressesByAccountGetRes returns a pointer to the value in the Result field

func (API) GetAddressesByAccountWait

func (a API) GetAddressesByAccountWait(cmd *btcjson.GetAddressesByAccountCmd) (out *[]string, err error)

GetAddressesByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBalance

func (a API) GetBalance(cmd *btcjson.GetBalanceCmd) (err error)

GetBalance calls the method with the given parameters

func (API) GetBalanceCheck

func (a API) GetBalanceCheck() (isNew bool)

GetBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBalanceGetRes

func (a API) GetBalanceGetRes() (out *float64, err error)

GetBalanceGetRes returns a pointer to the value in the Result field

func (API) GetBalanceWait

func (a API) GetBalanceWait(cmd *btcjson.GetBalanceCmd) (out *float64, err error)

GetBalanceWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBestBlock

func (a API) GetBestBlock(cmd *None) (err error)

GetBestBlock calls the method with the given parameters

func (API) GetBestBlockCheck

func (a API) GetBestBlockCheck() (isNew bool)

GetBestBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBestBlockGetRes

func (a API) GetBestBlockGetRes() (out *btcjson.GetBestBlockResult, err error)

GetBestBlockGetRes returns a pointer to the value in the Result field

func (API) GetBestBlockHash

func (a API) GetBestBlockHash(cmd *None) (err error)

GetBestBlockHash calls the method with the given parameters

func (API) GetBestBlockHashCheck

func (a API) GetBestBlockHashCheck() (isNew bool)

GetBestBlockHashCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBestBlockHashGetRes

func (a API) GetBestBlockHashGetRes() (out *string, err error)

GetBestBlockHashGetRes returns a pointer to the value in the Result field

func (API) GetBestBlockHashWait

func (a API) GetBestBlockHashWait(cmd *None) (out *string, err error)

GetBestBlockHashWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBestBlockWait

func (a API) GetBestBlockWait(cmd *None) (out *btcjson.GetBestBlockResult, err error)

GetBestBlockWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBlockCount

func (a API) GetBlockCount(cmd *None) (err error)

GetBlockCount calls the method with the given parameters

func (API) GetBlockCountCheck

func (a API) GetBlockCountCheck() (isNew bool)

GetBlockCountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBlockCountGetRes

func (a API) GetBlockCountGetRes() (out *int32, err error)

GetBlockCountGetRes returns a pointer to the value in the Result field

func (API) GetBlockCountWait

func (a API) GetBlockCountWait(cmd *None) (out *int32, err error)

GetBlockCountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetInfo

func (a API) GetInfo(cmd *None) (err error)

GetInfo calls the method with the given parameters

func (API) GetInfoCheck

func (a API) GetInfoCheck() (isNew bool)

GetInfoCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetInfoGetRes

func (a API) GetInfoGetRes() (out *btcjson.InfoWalletResult, err error)

GetInfoGetRes returns a pointer to the value in the Result field

func (API) GetInfoWait

func (a API) GetInfoWait(cmd *None) (out *btcjson.InfoWalletResult, err error)

GetInfoWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetNewAddress

func (a API) GetNewAddress(cmd *btcjson.GetNewAddressCmd) (err error)

GetNewAddress calls the method with the given parameters

func (API) GetNewAddressCheck

func (a API) GetNewAddressCheck() (isNew bool)

GetNewAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetNewAddressGetRes

func (a API) GetNewAddressGetRes() (out *string, err error)

GetNewAddressGetRes returns a pointer to the value in the Result field

func (API) GetNewAddressWait

func (a API) GetNewAddressWait(cmd *btcjson.GetNewAddressCmd) (out *string, err error)

GetNewAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetRawChangeAddress

func (a API) GetRawChangeAddress(cmd *btcjson.GetRawChangeAddressCmd) (err error)

GetRawChangeAddress calls the method with the given parameters

func (API) GetRawChangeAddressCheck

func (a API) GetRawChangeAddressCheck() (isNew bool)

GetRawChangeAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetRawChangeAddressGetRes

func (a API) GetRawChangeAddressGetRes() (out *string, err error)

GetRawChangeAddressGetRes returns a pointer to the value in the Result field

func (API) GetRawChangeAddressWait

func (a API) GetRawChangeAddressWait(cmd *btcjson.GetRawChangeAddressCmd) (out *string, err error)

GetRawChangeAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetReceivedByAccount

func (a API) GetReceivedByAccount(cmd *btcjson.GetReceivedByAccountCmd) (err error)

GetReceivedByAccount calls the method with the given parameters

func (API) GetReceivedByAccountCheck

func (a API) GetReceivedByAccountCheck() (isNew bool)

GetReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetReceivedByAccountGetRes

func (a API) GetReceivedByAccountGetRes() (out *float64, err error)

GetReceivedByAccountGetRes returns a pointer to the value in the Result field

func (API) GetReceivedByAccountWait

func (a API) GetReceivedByAccountWait(cmd *btcjson.GetReceivedByAccountCmd) (out *float64, err error)

GetReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetReceivedByAddress

func (a API) GetReceivedByAddress(cmd *btcjson.GetReceivedByAddressCmd) (err error)

GetReceivedByAddress calls the method with the given parameters

func (API) GetReceivedByAddressCheck

func (a API) GetReceivedByAddressCheck() (isNew bool)

GetReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetReceivedByAddressGetRes

func (a API) GetReceivedByAddressGetRes() (out *float64, err error)

GetReceivedByAddressGetRes returns a pointer to the value in the Result field

func (API) GetReceivedByAddressWait

func (a API) GetReceivedByAddressWait(cmd *btcjson.GetReceivedByAddressCmd) (out *float64, err error)

GetReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetTransaction

func (a API) GetTransaction(cmd *btcjson.GetTransactionCmd) (err error)

GetTransaction calls the method with the given parameters

func (API) GetTransactionCheck

func (a API) GetTransactionCheck() (isNew bool)

GetTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetTransactionGetRes

func (a API) GetTransactionGetRes() (out *btcjson.GetTransactionResult, err error)

GetTransactionGetRes returns a pointer to the value in the Result field

func (API) GetTransactionWait

func (a API) GetTransactionWait(cmd *btcjson.GetTransactionCmd) (out *btcjson.GetTransactionResult, err error)

GetTransactionWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetUnconfirmedBalance

func (a API) GetUnconfirmedBalance(cmd *btcjson.GetUnconfirmedBalanceCmd) (err error)

GetUnconfirmedBalance calls the method with the given parameters

func (API) GetUnconfirmedBalanceCheck

func (a API) GetUnconfirmedBalanceCheck() (isNew bool)

GetUnconfirmedBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetUnconfirmedBalanceGetRes

func (a API) GetUnconfirmedBalanceGetRes() (out *float64, err error)

GetUnconfirmedBalanceGetRes returns a pointer to the value in the Result field

func (API) GetUnconfirmedBalanceWait

func (a API) GetUnconfirmedBalanceWait(cmd *btcjson.GetUnconfirmedBalanceCmd) (out *float64, err error)

GetUnconfirmedBalanceWait calls the method and blocks until it returns or 5 seconds passes

func (API) HandleDropWalletHistory

func (a API) HandleDropWalletHistory(cmd *None) (err error)

HandleDropWalletHistory calls the method with the given parameters

func (API) HandleDropWalletHistoryCheck

func (a API) HandleDropWalletHistoryCheck() (isNew bool)

HandleDropWalletHistoryCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) HandleDropWalletHistoryGetRes

func (a API) HandleDropWalletHistoryGetRes() (out *string, err error)

HandleDropWalletHistoryGetRes returns a pointer to the value in the Result field

func (API) HandleDropWalletHistoryWait

func (a API) HandleDropWalletHistoryWait(cmd *None) (out *string, err error)

HandleDropWalletHistoryWait calls the method and blocks until it returns or 5 seconds passes

func (API) HelpNoChainRPC

func (a API) HelpNoChainRPC(cmd btcjson.HelpCmd) (err error)

HelpNoChainRPC calls the method with the given parameters

func (API) HelpNoChainRPCCheck

func (a API) HelpNoChainRPCCheck() (isNew bool)

HelpNoChainRPCCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) HelpNoChainRPCGetRes

func (a API) HelpNoChainRPCGetRes() (out *string, err error)

HelpNoChainRPCGetRes returns a pointer to the value in the Result field

func (API) HelpNoChainRPCWait

func (a API) HelpNoChainRPCWait(cmd btcjson.HelpCmd) (out *string, err error)

HelpNoChainRPCWait calls the method and blocks until it returns or 5 seconds passes

func (API) ImportPrivKey

func (a API) ImportPrivKey(cmd *btcjson.ImportPrivKeyCmd) (err error)

ImportPrivKey calls the method with the given parameters

func (API) ImportPrivKeyCheck

func (a API) ImportPrivKeyCheck() (isNew bool)

ImportPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ImportPrivKeyGetRes

func (a API) ImportPrivKeyGetRes() (out *None, err error)

ImportPrivKeyGetRes returns a pointer to the value in the Result field

func (API) ImportPrivKeyWait

func (a API) ImportPrivKeyWait(cmd *btcjson.ImportPrivKeyCmd) (out *None, err error)

ImportPrivKeyWait calls the method and blocks until it returns or 5 seconds passes

func (API) KeypoolRefill

func (a API) KeypoolRefill(cmd *None) (err error)

KeypoolRefill calls the method with the given parameters

func (API) KeypoolRefillCheck

func (a API) KeypoolRefillCheck() (isNew bool)

KeypoolRefillCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) KeypoolRefillGetRes

func (a API) KeypoolRefillGetRes() (out *None, err error)

KeypoolRefillGetRes returns a pointer to the value in the Result field

func (API) KeypoolRefillWait

func (a API) KeypoolRefillWait(cmd *None) (out *None, err error)

KeypoolRefillWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAccounts

func (a API) ListAccounts(cmd *btcjson.ListAccountsCmd) (err error)

ListAccounts calls the method with the given parameters

func (API) ListAccountsCheck

func (a API) ListAccountsCheck() (isNew bool)

ListAccountsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAccountsGetRes

func (a API) ListAccountsGetRes() (out *map[string]float64, err error)

ListAccountsGetRes returns a pointer to the value in the Result field

func (API) ListAccountsWait

func (a API) ListAccountsWait(cmd *btcjson.ListAccountsCmd) (out *map[string]float64, err error)

ListAccountsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAddressTransactions

func (a API) ListAddressTransactions(cmd *btcjson.ListAddressTransactionsCmd) (err error)

ListAddressTransactions calls the method with the given parameters

func (API) ListAddressTransactionsCheck

func (a API) ListAddressTransactionsCheck() (isNew bool)

ListAddressTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAddressTransactionsGetRes

func (a API) ListAddressTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, err error)

ListAddressTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListAddressTransactionsWait

func (a API) ListAddressTransactionsWait(cmd *btcjson.ListAddressTransactionsCmd) (out *[]btcjson.ListTransactionsResult, err error)

ListAddressTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAllTransactions

func (a API) ListAllTransactions(cmd *btcjson.ListAllTransactionsCmd) (err error)

ListAllTransactions calls the method with the given parameters

func (API) ListAllTransactionsCheck

func (a API) ListAllTransactionsCheck() (isNew bool)

ListAllTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAllTransactionsGetRes

func (a API) ListAllTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, err error)

ListAllTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListAllTransactionsWait

func (a API) ListAllTransactionsWait(cmd *btcjson.ListAllTransactionsCmd) (out *[]btcjson.ListTransactionsResult, err error)

ListAllTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListLockUnspent

func (a API) ListLockUnspent(cmd *None) (err error)

ListLockUnspent calls the method with the given parameters

func (API) ListLockUnspentCheck

func (a API) ListLockUnspentCheck() (isNew bool)

ListLockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListLockUnspentGetRes

func (a API) ListLockUnspentGetRes() (out *[]btcjson.TransactionInput, err error)

ListLockUnspentGetRes returns a pointer to the value in the Result field

func (API) ListLockUnspentWait

func (a API) ListLockUnspentWait(cmd *None) (out *[]btcjson.TransactionInput, err error)

ListLockUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListReceivedByAccount

func (a API) ListReceivedByAccount(cmd *btcjson.ListReceivedByAccountCmd) (err error)

ListReceivedByAccount calls the method with the given parameters

func (API) ListReceivedByAccountCheck

func (a API) ListReceivedByAccountCheck() (isNew bool)

ListReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListReceivedByAccountGetRes

func (a API) ListReceivedByAccountGetRes() (out *[]btcjson.ListReceivedByAccountResult, err error)

ListReceivedByAccountGetRes returns a pointer to the value in the Result field

func (API) ListReceivedByAccountWait

func (a API) ListReceivedByAccountWait(cmd *btcjson.ListReceivedByAccountCmd) (out *[]btcjson.ListReceivedByAccountResult, err error)

ListReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListReceivedByAddress

func (a API) ListReceivedByAddress(cmd *btcjson.ListReceivedByAddressCmd) (err error)

ListReceivedByAddress calls the method with the given parameters

func (API) ListReceivedByAddressCheck

func (a API) ListReceivedByAddressCheck() (isNew bool)

ListReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListReceivedByAddressGetRes

func (a API) ListReceivedByAddressGetRes() (out *btcjson.ListReceivedByAddressResult, err error)

ListReceivedByAddressGetRes returns a pointer to the value in the Result field

func (API) ListReceivedByAddressWait

func (a API) ListReceivedByAddressWait(cmd *btcjson.ListReceivedByAddressCmd) (out *btcjson.ListReceivedByAddressResult, err error)

ListReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListSinceBlock

func (a API) ListSinceBlock(cmd btcjson.ListSinceBlockCmd) (err error)

ListSinceBlock calls the method with the given parameters

func (API) ListSinceBlockCheck

func (a API) ListSinceBlockCheck() (isNew bool)

ListSinceBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListSinceBlockGetRes

func (a API) ListSinceBlockGetRes() (out *btcjson.ListSinceBlockResult, err error)

ListSinceBlockGetRes returns a pointer to the value in the Result field

func (API) ListSinceBlockWait

func (a API) ListSinceBlockWait(cmd btcjson.ListSinceBlockCmd) (out *btcjson.ListSinceBlockResult, err error)

ListSinceBlockWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListTransactions

func (a API) ListTransactions(cmd *btcjson.ListTransactionsCmd) (err error)

ListTransactions calls the method with the given parameters

func (API) ListTransactionsCheck

func (a API) ListTransactionsCheck() (isNew bool)

ListTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListTransactionsGetRes

func (a API) ListTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, err error)

ListTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListTransactionsWait

func (a API) ListTransactionsWait(cmd *btcjson.ListTransactionsCmd) (out *[]btcjson.ListTransactionsResult, err error)

ListTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListUnspent

func (a API) ListUnspent(cmd *btcjson.ListUnspentCmd) (err error)

ListUnspent calls the method with the given parameters

func (API) ListUnspentCheck

func (a API) ListUnspentCheck() (isNew bool)

ListUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListUnspentGetRes

func (a API) ListUnspentGetRes() (out *[]btcjson.ListUnspentResult, err error)

ListUnspentGetRes returns a pointer to the value in the Result field

func (API) ListUnspentWait

func (a API) ListUnspentWait(cmd *btcjson.ListUnspentCmd) (out *[]btcjson.ListUnspentResult, err error)

ListUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) LockUnspent

func (a API) LockUnspent(cmd btcjson.LockUnspentCmd) (err error)

LockUnspent calls the method with the given parameters

func (API) LockUnspentCheck

func (a API) LockUnspentCheck() (isNew bool)

LockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) LockUnspentGetRes

func (a API) LockUnspentGetRes() (out *bool, err error)

LockUnspentGetRes returns a pointer to the value in the Result field

func (API) LockUnspentWait

func (a API) LockUnspentWait(cmd btcjson.LockUnspentCmd) (out *bool, err error)

LockUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) RenameAccount

func (a API) RenameAccount(cmd *btcjson.RenameAccountCmd) (err error)

RenameAccount calls the method with the given parameters

func (API) RenameAccountCheck

func (a API) RenameAccountCheck() (isNew bool)

RenameAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) RenameAccountGetRes

func (a API) RenameAccountGetRes() (out *None, err error)

RenameAccountGetRes returns a pointer to the value in the Result field

func (API) RenameAccountWait

func (a API) RenameAccountWait(cmd *btcjson.RenameAccountCmd) (out *None, err error)

RenameAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) SendMany

func (a API) SendMany(cmd *btcjson.SendManyCmd) (err error)

SendMany calls the method with the given parameters

func (API) SendManyCheck

func (a API) SendManyCheck() (isNew bool)

SendManyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SendManyGetRes

func (a API) SendManyGetRes() (out *string, err error)

SendManyGetRes returns a pointer to the value in the Result field

func (API) SendManyWait

func (a API) SendManyWait(cmd *btcjson.SendManyCmd) (out *string, err error)

SendManyWait calls the method and blocks until it returns or 5 seconds passes

func (API) SendToAddress

func (a API) SendToAddress(cmd *btcjson.SendToAddressCmd) (err error)

SendToAddress calls the method with the given parameters

func (API) SendToAddressCheck

func (a API) SendToAddressCheck() (isNew bool)

SendToAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SendToAddressGetRes

func (a API) SendToAddressGetRes() (out *string, err error)

SendToAddressGetRes returns a pointer to the value in the Result field

func (API) SendToAddressWait

func (a API) SendToAddressWait(cmd *btcjson.SendToAddressCmd) (out *string, err error)

SendToAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) SetTxFee

func (a API) SetTxFee(cmd *btcjson.SetTxFeeCmd) (err error)

SetTxFee calls the method with the given parameters

func (API) SetTxFeeCheck

func (a API) SetTxFeeCheck() (isNew bool)

SetTxFeeCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SetTxFeeGetRes

func (a API) SetTxFeeGetRes() (out *bool, err error)

SetTxFeeGetRes returns a pointer to the value in the Result field

func (API) SetTxFeeWait

func (a API) SetTxFeeWait(cmd *btcjson.SetTxFeeCmd) (out *bool, err error)

SetTxFeeWait calls the method and blocks until it returns or 5 seconds passes

func (API) SignMessage

func (a API) SignMessage(cmd *btcjson.SignMessageCmd) (err error)

SignMessage calls the method with the given parameters

func (API) SignMessageCheck

func (a API) SignMessageCheck() (isNew bool)

SignMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SignMessageGetRes

func (a API) SignMessageGetRes() (out *string, err error)

SignMessageGetRes returns a pointer to the value in the Result field

func (API) SignMessageWait

func (a API) SignMessageWait(cmd *btcjson.SignMessageCmd) (out *string, err error)

SignMessageWait calls the method and blocks until it returns or 5 seconds passes

func (API) SignRawTransaction

func (a API) SignRawTransaction(cmd btcjson.SignRawTransactionCmd) (err error)

SignRawTransaction calls the method with the given parameters

func (API) SignRawTransactionCheck

func (a API) SignRawTransactionCheck() (isNew bool)

SignRawTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SignRawTransactionGetRes

func (a API) SignRawTransactionGetRes() (out *btcjson.SignRawTransactionResult, err error)

SignRawTransactionGetRes returns a pointer to the value in the Result field

func (API) SignRawTransactionWait

func (a API) SignRawTransactionWait(cmd btcjson.SignRawTransactionCmd) (out *btcjson.SignRawTransactionResult, err error)

SignRawTransactionWait calls the method and blocks until it returns or 5 seconds passes

func (API) ValidateAddress

func (a API) ValidateAddress(cmd *btcjson.ValidateAddressCmd) (err error)

ValidateAddress calls the method with the given parameters

func (API) ValidateAddressCheck

func (a API) ValidateAddressCheck() (isNew bool)

ValidateAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ValidateAddressGetRes

func (a API) ValidateAddressGetRes() (out *btcjson.ValidateAddressWalletResult, err error)

ValidateAddressGetRes returns a pointer to the value in the Result field

func (API) ValidateAddressWait

func (a API) ValidateAddressWait(cmd *btcjson.ValidateAddressCmd) (out *btcjson.ValidateAddressWalletResult, err error)

ValidateAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) VerifyMessage

func (a API) VerifyMessage(cmd *btcjson.VerifyMessageCmd) (err error)

VerifyMessage calls the method with the given parameters

func (API) VerifyMessageCheck

func (a API) VerifyMessageCheck() (isNew bool)

VerifyMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) VerifyMessageGetRes

func (a API) VerifyMessageGetRes() (out *bool, err error)

VerifyMessageGetRes returns a pointer to the value in the Result field

func (API) VerifyMessageWait

func (a API) VerifyMessageWait(cmd *btcjson.VerifyMessageCmd) (out *bool, err error)

VerifyMessageWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletIsLocked

func (a API) WalletIsLocked(cmd *None) (err error)

WalletIsLocked calls the method with the given parameters

func (API) WalletIsLockedCheck

func (a API) WalletIsLockedCheck() (isNew bool)

WalletIsLockedCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletIsLockedGetRes

func (a API) WalletIsLockedGetRes() (out *bool, err error)

WalletIsLockedGetRes returns a pointer to the value in the Result field

func (API) WalletIsLockedWait

func (a API) WalletIsLockedWait(cmd *None) (out *bool, err error)

WalletIsLockedWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletLock

func (a API) WalletLock(cmd *None) (err error)

WalletLock calls the method with the given parameters

func (API) WalletLockCheck

func (a API) WalletLockCheck() (isNew bool)

WalletLockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletLockGetRes

func (a API) WalletLockGetRes() (out *None, err error)

WalletLockGetRes returns a pointer to the value in the Result field

func (API) WalletLockWait

func (a API) WalletLockWait(cmd *None) (out *None, err error)

WalletLockWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletPassphrase

func (a API) WalletPassphrase(cmd *btcjson.WalletPassphraseCmd) (err error)

WalletPassphrase calls the method with the given parameters

func (API) WalletPassphraseChange

func (a API) WalletPassphraseChange(cmd *btcjson.WalletPassphraseChangeCmd) (err error)

WalletPassphraseChange calls the method with the given parameters

func (API) WalletPassphraseChangeCheck

func (a API) WalletPassphraseChangeCheck() (isNew bool)

WalletPassphraseChangeCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletPassphraseChangeGetRes

func (a API) WalletPassphraseChangeGetRes() (out *None, err error)

WalletPassphraseChangeGetRes returns a pointer to the value in the Result field

func (API) WalletPassphraseChangeWait

func (a API) WalletPassphraseChangeWait(cmd *btcjson.WalletPassphraseChangeCmd) (out *None, err error)

WalletPassphraseChangeWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletPassphraseCheck

func (a API) WalletPassphraseCheck() (isNew bool)

WalletPassphraseCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletPassphraseGetRes

func (a API) WalletPassphraseGetRes() (out *None, err error)

WalletPassphraseGetRes returns a pointer to the value in the Result field

func (API) WalletPassphraseWait

func (a API) WalletPassphraseWait(cmd *btcjson.WalletPassphraseCmd) (out *None, err error)

WalletPassphraseWait calls the method and blocks until it returns or 5 seconds passes

type AddMultiSigAddressRes

type AddMultiSigAddressRes struct {
	Res *string
	Err error
}

AddMultiSigAddressRes is the result from a call to AddMultiSigAddress

type CAPI

type CAPI struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

CAPI is the central structure for configuration and access to a net/rpc API access endpoint for this RPC API

func NewCAPI

func NewCAPI(quit chan struct{}, timeout ...time.Duration) (c *CAPI)

NewCAPI returns a new CAPI

func (*CAPI) AddMultiSigAddress

func (c *CAPI) AddMultiSigAddress(req *btcjson.AddMultisigAddressCmd, resp string) (err error)

func (*CAPI) CreateMultiSig

func (c *CAPI) CreateMultiSig(req *btcjson.CreateMultisigCmd, resp btcjson.CreateMultiSigResult) (err error)

func (*CAPI) CreateNewAccount

func (c *CAPI) CreateNewAccount(req *btcjson.CreateNewAccountCmd, resp None) (err error)

func (*CAPI) DumpPrivKey

func (c *CAPI) DumpPrivKey(req *btcjson.DumpPrivKeyCmd, resp string) (err error)

func (*CAPI) GetAccount

func (c *CAPI) GetAccount(req *btcjson.GetAccountCmd, resp string) (err error)

func (*CAPI) GetAccountAddress

func (c *CAPI) GetAccountAddress(req *btcjson.GetAccountAddressCmd, resp string) (err error)

func (*CAPI) GetAddressesByAccount

func (c *CAPI) GetAddressesByAccount(req *btcjson.GetAddressesByAccountCmd, resp []string) (err error)

func (*CAPI) GetBalance

func (c *CAPI) GetBalance(req *btcjson.GetBalanceCmd, resp float64) (err error)

func (*CAPI) GetBestBlock

func (c *CAPI) GetBestBlock(req *None, resp btcjson.GetBestBlockResult) (err error)

func (*CAPI) GetBestBlockHash

func (c *CAPI) GetBestBlockHash(req *None, resp string) (err error)

func (*CAPI) GetBlockCount

func (c *CAPI) GetBlockCount(req *None, resp int32) (err error)

func (*CAPI) GetInfo

func (c *CAPI) GetInfo(req *None, resp btcjson.InfoWalletResult) (err error)

func (*CAPI) GetNewAddress

func (c *CAPI) GetNewAddress(req *btcjson.GetNewAddressCmd, resp string) (err error)

func (*CAPI) GetRawChangeAddress

func (c *CAPI) GetRawChangeAddress(req *btcjson.GetRawChangeAddressCmd, resp string) (err error)

func (*CAPI) GetReceivedByAccount

func (c *CAPI) GetReceivedByAccount(req *btcjson.GetReceivedByAccountCmd, resp float64) (err error)

func (*CAPI) GetReceivedByAddress

func (c *CAPI) GetReceivedByAddress(req *btcjson.GetReceivedByAddressCmd, resp float64) (err error)

func (*CAPI) GetTransaction

func (c *CAPI) GetTransaction(req *btcjson.GetTransactionCmd, resp btcjson.GetTransactionResult) (err error)

func (*CAPI) GetUnconfirmedBalance

func (c *CAPI) GetUnconfirmedBalance(req *btcjson.GetUnconfirmedBalanceCmd, resp float64) (err error)

func (*CAPI) HandleDropWalletHistory

func (c *CAPI) HandleDropWalletHistory(req *None, resp string) (err error)

func (*CAPI) HelpNoChainRPC

func (c *CAPI) HelpNoChainRPC(req btcjson.HelpCmd, resp string) (err error)

func (*CAPI) ImportPrivKey

func (c *CAPI) ImportPrivKey(req *btcjson.ImportPrivKeyCmd, resp None) (err error)

func (*CAPI) KeypoolRefill

func (c *CAPI) KeypoolRefill(req *None, resp None) (err error)

func (*CAPI) ListAccounts

func (c *CAPI) ListAccounts(req *btcjson.ListAccountsCmd, resp map[string]float64) (err error)

func (*CAPI) ListAddressTransactions

func (c *CAPI) ListAddressTransactions(req *btcjson.ListAddressTransactionsCmd, resp []btcjson.ListTransactionsResult) (err error)

func (*CAPI) ListAllTransactions

func (c *CAPI) ListAllTransactions(req *btcjson.ListAllTransactionsCmd, resp []btcjson.ListTransactionsResult) (err error)

func (*CAPI) ListLockUnspent

func (c *CAPI) ListLockUnspent(req *None, resp []btcjson.TransactionInput) (err error)

func (*CAPI) ListReceivedByAccount

func (c *CAPI) ListReceivedByAccount(req *btcjson.ListReceivedByAccountCmd, resp []btcjson.ListReceivedByAccountResult) (err error)

func (*CAPI) ListReceivedByAddress

func (c *CAPI) ListReceivedByAddress(req *btcjson.ListReceivedByAddressCmd, resp btcjson.ListReceivedByAddressResult) (err error)

func (*CAPI) ListSinceBlock

func (c *CAPI) ListSinceBlock(req btcjson.ListSinceBlockCmd, resp btcjson.ListSinceBlockResult) (err error)

func (*CAPI) ListTransactions

func (c *CAPI) ListTransactions(req *btcjson.ListTransactionsCmd, resp []btcjson.ListTransactionsResult) (err error)

func (*CAPI) ListUnspent

func (c *CAPI) ListUnspent(req *btcjson.ListUnspentCmd, resp []btcjson.ListUnspentResult) (err error)

func (*CAPI) LockUnspent

func (c *CAPI) LockUnspent(req btcjson.LockUnspentCmd, resp bool) (err error)

func (*CAPI) RenameAccount

func (c *CAPI) RenameAccount(req *btcjson.RenameAccountCmd, resp None) (err error)

func (*CAPI) SendMany

func (c *CAPI) SendMany(req *btcjson.SendManyCmd, resp string) (err error)

func (*CAPI) SendToAddress

func (c *CAPI) SendToAddress(req *btcjson.SendToAddressCmd, resp string) (err error)

func (*CAPI) SetTxFee

func (c *CAPI) SetTxFee(req *btcjson.SetTxFeeCmd, resp bool) (err error)

func (*CAPI) SignMessage

func (c *CAPI) SignMessage(req *btcjson.SignMessageCmd, resp string) (err error)

func (*CAPI) SignRawTransaction

func (c *CAPI) SignRawTransaction(req btcjson.SignRawTransactionCmd, resp btcjson.SignRawTransactionResult) (err error)

func (*CAPI) ValidateAddress

func (c *CAPI) ValidateAddress(req *btcjson.ValidateAddressCmd, resp btcjson.ValidateAddressWalletResult) (err error)

func (*CAPI) VerifyMessage

func (c *CAPI) VerifyMessage(req *btcjson.VerifyMessageCmd, resp bool) (err error)

func (*CAPI) WalletIsLocked

func (c *CAPI) WalletIsLocked(req *None, resp bool) (err error)

func (*CAPI) WalletLock

func (c *CAPI) WalletLock(req *None, resp None) (err error)

func (*CAPI) WalletPassphrase

func (c *CAPI) WalletPassphrase(req *btcjson.WalletPassphraseCmd, resp None) (err error)

func (*CAPI) WalletPassphraseChange

func (c *CAPI) WalletPassphraseChange(req *btcjson.WalletPassphraseChangeCmd, resp None) (err error)

type CAPIClient

type CAPIClient struct {
	*rpc.Client
}

func NewCAPIClient

func NewCAPIClient(conn io.ReadWriteCloser) *CAPIClient

NewCAPIClient creates a new client for a kopach_worker. Note that any kind of connection can be used here, other than the StdConn

func (*CAPIClient) AddMultiSigAddress

func (r *CAPIClient) AddMultiSigAddress(cmd ...*btcjson.AddMultisigAddressCmd) (res string, err error)

func (*CAPIClient) CreateMultiSig

func (r *CAPIClient) CreateMultiSig(cmd ...*btcjson.CreateMultisigCmd) (res btcjson.CreateMultiSigResult, err error)

func (*CAPIClient) CreateNewAccount

func (r *CAPIClient) CreateNewAccount(cmd ...*btcjson.CreateNewAccountCmd) (res None, err error)

func (*CAPIClient) DumpPrivKey

func (r *CAPIClient) DumpPrivKey(cmd ...*btcjson.DumpPrivKeyCmd) (res string, err error)

func (*CAPIClient) GetAccount

func (r *CAPIClient) GetAccount(cmd ...*btcjson.GetAccountCmd) (res string, err error)

func (*CAPIClient) GetAccountAddress

func (r *CAPIClient) GetAccountAddress(cmd ...*btcjson.GetAccountAddressCmd) (res string, err error)

func (*CAPIClient) GetAddressesByAccount

func (r *CAPIClient) GetAddressesByAccount(cmd ...*btcjson.GetAddressesByAccountCmd) (res []string, err error)

func (*CAPIClient) GetBalance

func (r *CAPIClient) GetBalance(cmd ...*btcjson.GetBalanceCmd) (res float64, err error)

func (*CAPIClient) GetBestBlock

func (r *CAPIClient) GetBestBlock(cmd ...*None) (res btcjson.GetBestBlockResult, err error)

func (*CAPIClient) GetBestBlockHash

func (r *CAPIClient) GetBestBlockHash(cmd ...*None) (res string, err error)

func (*CAPIClient) GetBlockCount

func (r *CAPIClient) GetBlockCount(cmd ...*None) (res int32, err error)

func (*CAPIClient) GetInfo

func (r *CAPIClient) GetInfo(cmd ...*None) (res btcjson.InfoWalletResult, err error)

func (*CAPIClient) GetNewAddress

func (r *CAPIClient) GetNewAddress(cmd ...*btcjson.GetNewAddressCmd) (res string, err error)

func (*CAPIClient) GetRawChangeAddress

func (r *CAPIClient) GetRawChangeAddress(cmd ...*btcjson.GetRawChangeAddressCmd) (res string, err error)

func (*CAPIClient) GetReceivedByAccount

func (r *CAPIClient) GetReceivedByAccount(cmd ...*btcjson.GetReceivedByAccountCmd) (res float64, err error)

func (*CAPIClient) GetReceivedByAddress

func (r *CAPIClient) GetReceivedByAddress(cmd ...*btcjson.GetReceivedByAddressCmd) (res float64, err error)

func (*CAPIClient) GetTransaction

func (r *CAPIClient) GetTransaction(cmd ...*btcjson.GetTransactionCmd) (res btcjson.GetTransactionResult, err error)

func (*CAPIClient) GetUnconfirmedBalance

func (r *CAPIClient) GetUnconfirmedBalance(cmd ...*btcjson.GetUnconfirmedBalanceCmd) (res float64, err error)

func (*CAPIClient) HandleDropWalletHistory

func (r *CAPIClient) HandleDropWalletHistory(cmd ...*None) (res string, err error)

func (*CAPIClient) HelpNoChainRPC

func (r *CAPIClient) HelpNoChainRPC(cmd ...btcjson.HelpCmd) (res string, err error)

func (*CAPIClient) ImportPrivKey

func (r *CAPIClient) ImportPrivKey(cmd ...*btcjson.ImportPrivKeyCmd) (res None, err error)

func (*CAPIClient) KeypoolRefill

func (r *CAPIClient) KeypoolRefill(cmd ...*None) (res None, err error)

func (*CAPIClient) ListAccounts

func (r *CAPIClient) ListAccounts(cmd ...*btcjson.ListAccountsCmd) (res map[string]float64, err error)

func (*CAPIClient) ListAddressTransactions

func (r *CAPIClient) ListAddressTransactions(cmd ...*btcjson.ListAddressTransactionsCmd) (res []btcjson.ListTransactionsResult, err error)

func (*CAPIClient) ListAllTransactions

func (r *CAPIClient) ListAllTransactions(cmd ...*btcjson.ListAllTransactionsCmd) (res []btcjson.ListTransactionsResult, err error)

func (*CAPIClient) ListLockUnspent

func (r *CAPIClient) ListLockUnspent(cmd ...*None) (res []btcjson.TransactionInput, err error)

func (*CAPIClient) ListReceivedByAccount

func (r *CAPIClient) ListReceivedByAccount(cmd ...*btcjson.ListReceivedByAccountCmd) (res []btcjson.ListReceivedByAccountResult, err error)

func (*CAPIClient) ListReceivedByAddress

func (r *CAPIClient) ListReceivedByAddress(cmd ...*btcjson.ListReceivedByAddressCmd) (res btcjson.ListReceivedByAddressResult, err error)

func (*CAPIClient) ListSinceBlock

func (r *CAPIClient) ListSinceBlock(cmd ...btcjson.ListSinceBlockCmd) (res btcjson.ListSinceBlockResult, err error)

func (*CAPIClient) ListTransactions

func (r *CAPIClient) ListTransactions(cmd ...*btcjson.ListTransactionsCmd) (res []btcjson.ListTransactionsResult, err error)

func (*CAPIClient) ListUnspent

func (r *CAPIClient) ListUnspent(cmd ...*btcjson.ListUnspentCmd) (res []btcjson.ListUnspentResult, err error)

func (*CAPIClient) LockUnspent

func (r *CAPIClient) LockUnspent(cmd ...btcjson.LockUnspentCmd) (res bool, err error)

func (*CAPIClient) RenameAccount

func (r *CAPIClient) RenameAccount(cmd ...*btcjson.RenameAccountCmd) (res None, err error)

func (*CAPIClient) SendMany

func (r *CAPIClient) SendMany(cmd ...*btcjson.SendManyCmd) (res string, err error)

func (*CAPIClient) SendToAddress

func (r *CAPIClient) SendToAddress(cmd ...*btcjson.SendToAddressCmd) (res string, err error)

func (*CAPIClient) SetTxFee

func (r *CAPIClient) SetTxFee(cmd ...*btcjson.SetTxFeeCmd) (res bool, err error)

func (*CAPIClient) SignMessage

func (r *CAPIClient) SignMessage(cmd ...*btcjson.SignMessageCmd) (res string, err error)

func (*CAPIClient) SignRawTransaction

func (r *CAPIClient) SignRawTransaction(cmd ...btcjson.SignRawTransactionCmd) (res btcjson.SignRawTransactionResult, err error)

func (*CAPIClient) ValidateAddress

func (r *CAPIClient) ValidateAddress(cmd ...*btcjson.ValidateAddressCmd) (res btcjson.ValidateAddressWalletResult, err error)

func (*CAPIClient) VerifyMessage

func (r *CAPIClient) VerifyMessage(cmd ...*btcjson.VerifyMessageCmd) (res bool, err error)

func (*CAPIClient) WalletIsLocked

func (r *CAPIClient) WalletIsLocked(cmd ...*None) (res bool, err error)

func (*CAPIClient) WalletLock

func (r *CAPIClient) WalletLock(cmd ...*None) (res None, err error)

func (*CAPIClient) WalletPassphrase

func (r *CAPIClient) WalletPassphrase(cmd ...*btcjson.WalletPassphraseCmd) (res None, err error)

func (*CAPIClient) WalletPassphraseChange

func (r *CAPIClient) WalletPassphraseChange(cmd ...*btcjson.WalletPassphraseChangeCmd) (res None, err error)

type CreateMultiSigRes

type CreateMultiSigRes struct {
	Res *btcjson.CreateMultiSigResult
	Err error
}

CreateMultiSigRes is the result from a call to CreateMultiSig

type CreateNewAccountRes

type CreateNewAccountRes struct {
	Res *None
	Err error
}

CreateNewAccountRes is the result from a call to CreateNewAccount

type DeserializationError

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

DeserializationError describes a failed deserializaion due to bad user input. It corresponds to json.ErrRPCDeserialization.

type DumpPrivKeyRes

type DumpPrivKeyRes struct {
	Res *string
	Err error
}

DumpPrivKeyRes is the result from a call to DumpPrivKey

type GetAccountAddressRes

type GetAccountAddressRes struct {
	Res *string
	Err error
}

GetAccountAddressRes is the result from a call to GetAccountAddress

type GetAccountRes

type GetAccountRes struct {
	Res *string
	Err error
}

GetAccountRes is the result from a call to GetAccount

type GetAddressesByAccountRes

type GetAddressesByAccountRes struct {
	Res *[]string
	Err error
}

GetAddressesByAccountRes is the result from a call to GetAddressesByAccount

type GetBalanceRes

type GetBalanceRes struct {
	Res *float64
	Err error
}

GetBalanceRes is the result from a call to GetBalance

type GetBestBlockHashRes

type GetBestBlockHashRes struct {
	Res *string
	Err error
}

GetBestBlockHashRes is the result from a call to GetBestBlockHash

type GetBestBlockRes

type GetBestBlockRes struct {
	Res *btcjson.GetBestBlockResult
	Err error
}

GetBestBlockRes is the result from a call to GetBestBlock

type GetBlockCountRes

type GetBlockCountRes struct {
	Res *int32
	Err error
}

GetBlockCountRes is the result from a call to GetBlockCount

type GetInfoRes

type GetInfoRes struct {
	Res *btcjson.InfoWalletResult
	Err error
}

GetInfoRes is the result from a call to GetInfo

type GetNewAddressRes

type GetNewAddressRes struct {
	Res *string
	Err error
}

GetNewAddressRes is the result from a call to GetNewAddress

type GetRawChangeAddressRes

type GetRawChangeAddressRes struct {
	Res *string
	Err error
}

GetRawChangeAddressRes is the result from a call to GetRawChangeAddress

type GetReceivedByAccountRes

type GetReceivedByAccountRes struct {
	Res *float64
	Err error
}

GetReceivedByAccountRes is the result from a call to GetReceivedByAccount

type GetReceivedByAddressRes

type GetReceivedByAddressRes struct {
	Res *float64
	Err error
}

GetReceivedByAddressRes is the result from a call to GetReceivedByAddress

type GetTransactionRes

type GetTransactionRes struct {
	Res *btcjson.GetTransactionResult
	Err error
}

GetTransactionRes is the result from a call to GetTransaction

type GetUnconfirmedBalanceRes

type GetUnconfirmedBalanceRes struct {
	Res *float64
	Err error
}

GetUnconfirmedBalanceRes is the result from a call to GetUnconfirmedBalance

type HandleDropWalletHistoryRes

type HandleDropWalletHistoryRes struct {
	Res *string
	Err error
}

HandleDropWalletHistoryRes is the result from a call to HandleDropWalletHistory

type HelpNoChainRPCRes

type HelpNoChainRPCRes struct {
	Res *string
	Err error
}

HelpNoChainRPCRes is the result from a call to HelpNoChainRPC

type ImportPrivKeyRes

type ImportPrivKeyRes struct {
	Res *None
	Err error
}

ImportPrivKeyRes is the result from a call to ImportPrivKey

type InvalidParameterError

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

InvalidParameterError describes an invalid parameter passed by the user. It corresponds to json.ErrRPCInvalidParameter.

type KeypoolRefillRes

type KeypoolRefillRes struct {
	Res *None
	Err error
}

KeypoolRefillRes is the result from a call to KeypoolRefill

type LazyHandler

type LazyHandler func() (interface{}, *btcjson.RPCError)

LazyHandler is a closure over a requestHandler or passthrough request with the RPC server's wallet and chain server variables as part of the closure context.

func LazyApplyHandler

func LazyApplyHandler(request *btcjson.Request, w *wallet.Wallet, chainClient chain.Interface) LazyHandler

LazyApplyHandler looks up the best request handler func for the method, returning a closure that will execute it with the (required) wallet and (optional) consensus RPC server. If no handlers are found and the chainClient is not nil, the returned handler performs RPC passthrough.

type ListAccountsRes

type ListAccountsRes struct {
	Res *map[string]float64
	Err error
}

ListAccountsRes is the result from a call to ListAccounts

type ListAddressTransactionsRes

type ListAddressTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	Err error
}

ListAddressTransactionsRes is the result from a call to ListAddressTransactions

type ListAllTransactionsRes

type ListAllTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	Err error
}

ListAllTransactionsRes is the result from a call to ListAllTransactions

type ListLockUnspentRes

type ListLockUnspentRes struct {
	Res *[]btcjson.TransactionInput
	Err error
}

ListLockUnspentRes is the result from a call to ListLockUnspent

type ListReceivedByAccountRes

type ListReceivedByAccountRes struct {
	Res *[]btcjson.ListReceivedByAccountResult
	Err error
}

ListReceivedByAccountRes is the result from a call to ListReceivedByAccount

type ListReceivedByAddressRes

type ListReceivedByAddressRes struct {
	Res *btcjson.ListReceivedByAddressResult
	Err error
}

ListReceivedByAddressRes is the result from a call to ListReceivedByAddress

type ListSinceBlockRes

type ListSinceBlockRes struct {
	Res *btcjson.ListSinceBlockResult
	Err error
}

ListSinceBlockRes is the result from a call to ListSinceBlock

type ListTransactionsRes

type ListTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	Err error
}

ListTransactionsRes is the result from a call to ListTransactions

type ListUnspentRes

type ListUnspentRes struct {
	Res *[]btcjson.ListUnspentResult
	Err error
}

ListUnspentRes is the result from a call to ListUnspent

type LockUnspentRes

type LockUnspentRes struct {
	Res *bool
	Err error
}

LockUnspentRes is the result from a call to LockUnspent

type None

type None struct{}

None means no parameters it is not checked so it can be nil

type Options

type Options struct {
	Username            string
	Password            string
	MaxPOSTClients      int64
	MaxWebsocketClients int64
}

Options contains the required options for running the legacy RPC server.

type ParseError

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

ParseError describes a failed parse due to bad user input. It corresponds to json.ErrRPCParse.

type RenameAccountRes

type RenameAccountRes struct {
	Res *None
	Err error
}

RenameAccountRes is the result from a call to RenameAccount

type RequestHandler

type RequestHandler func(interface{}, *wallet.Wallet,
	...*chain.RPCClient) (interface{}, error)

RequestHandler is a handler function to handle an unmarshaled and parsed request into a marshalable response. If the error is a *json.RPCError or any of the above special error classes, the server will respond with the JSON-RPC appropriate error code. All other errors use the wallet catch-all error code, json.ErrRPCWallet.

type SendManyRes

type SendManyRes struct {
	Res *string
	Err error
}

SendManyRes is the result from a call to SendMany

type SendToAddressRes

type SendToAddressRes struct {
	Res *string
	Err error
}

SendToAddressRes is the result from a call to SendToAddress

type Server

type Server struct {
	HTTPServer   http.Server
	Wallet       *wallet.Wallet
	WalletLoader *wallet.Loader
	ChainClient  chain.Interface
	// handlerLookup       func(string) (requestHandler, bool)
	HandlerMutex        sync.Mutex
	Listeners           []net.Listener
	AuthSHA             [sha256.Size]byte
	Upgrader            websocket.Upgrader
	MaxPostClients      int64 // Max concurrent HTTP POST clients.
	MaxWebsocketClients int64 // Max concurrent websocket clients.
	WG                  sync.WaitGroup
	Quit                qu.C
	QuitMutex           sync.Mutex
	RequestShutdownChan qu.C
}

Server holds the items the RPC server may need to access (auth, config, shutdown, etc.)

func NewServer

func NewServer(opts *Options, walletLoader *wallet.Loader, listeners []net.Listener, quit qu.C) *Server

NewServer creates a new server for serving legacy RPC client connections, both HTTP POST and websocket.

func (*Server) CheckAuthHeader

func (s *Server) CheckAuthHeader(r *http.Request) error

CheckAuthHeader checks the HTTP Basic authentication supplied by a client in the HTTP request r. It errors with ErrNoAuth if the request does not contain the Authorization header, or another non-nil error if the authentication was provided but incorrect.

This check is time-constant.

func (*Server) HandlerClosure

func (s *Server) HandlerClosure(request *btcjson.Request) LazyHandler

HandlerClosure creates a closure function for handling requests of the given method. This may be a request that is handled directly by btcwallet, or a chain server request that is handled by passing the request down to pod.

NOTE: These handlers do not handle special cases, such as the authenticate method. Each of these must be checked beforehand (the method is already known) and handled accordingly.

func (*Server) InvalidAuth

func (s *Server) InvalidAuth(req *btcjson.Request) bool

InvalidAuth checks whether a websocket request is a valid (parsable) authenticate request and checks the supplied username and passphrase against the server auth.

func (*Server) POSTClientRPC

func (s *Server) POSTClientRPC(w http.ResponseWriter, r *http.Request)

POSTClientRPC processes and replies to a JSON-RPC client request.

func (*Server) RegisterWallet

func (s *Server) RegisterWallet(w *wallet.Wallet)

RegisterWallet associates the legacy RPC server with the wallet. This function must be called before any wallet RPCs can be called by clients.

func (*Server) RequestProcessShutdown

func (s *Server) RequestProcessShutdown()

func (*Server) RequestProcessShutdownChan

func (s *Server) RequestProcessShutdownChan() qu.C

RequestProcessShutdownChan returns a channel that is sent to when an authorized client requests remote shutdown.

func (*Server) Serve

func (s *Server) Serve(lis net.Listener)

Serve serves HTTP POST and websocket RPC for the legacy JSON-RPC RPC server. This function does not block on lis.Accept.

func (*Server) SetChainServer

func (s *Server) SetChainServer(chainClient chain.Interface)

SetChainServer sets the chain server client component needed to run a fully functional bitcoin wallet RPC server. This can be called to enable RPC passthrough even before a loaded wallet is set, but the wallet's RPC client is preferred.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the rpc server by stopping and disconnecting all clients, disconnecting the chain server connection, and closing the wallet's account files. This blocks until shutdown completes.

func (*Server) WebsocketClientRPC

func (s *Server) WebsocketClientRPC(wsc *WebsocketClient)

WebsocketClientRPC starts the goroutines to serve JSON-RPC requests over a websocket connection for a single client.

func (*Server) WebsocketClientRead

func (s *Server) WebsocketClientRead(wsc *WebsocketClient)

func (*Server) WebsocketClientRespond

func (s *Server) WebsocketClientRespond(wsc *WebsocketClient)

func (*Server) WebsocketClientSend

func (s *Server) WebsocketClientSend(wsc *WebsocketClient)

type SetTxFeeRes

type SetTxFeeRes struct {
	Res *bool
	Err error
}

SetTxFeeRes is the result from a call to SetTxFee

type SignMessageRes

type SignMessageRes struct {
	Res *string
	Err error
}

SignMessageRes is the result from a call to SignMessage

type SignRawTransactionRes

type SignRawTransactionRes struct {
	Res *btcjson.SignRawTransactionResult
	Err error
}

SignRawTransactionRes is the result from a call to SignRawTransaction

type ValidateAddressRes

type ValidateAddressRes struct {
	Res *btcjson.ValidateAddressWalletResult
	Err error
}

ValidateAddressRes is the result from a call to ValidateAddress

type VerifyMessageRes

type VerifyMessageRes struct {
	Res *bool
	Err error
}

VerifyMessageRes is the result from a call to VerifyMessage

type WalletIsLockedRes

type WalletIsLockedRes struct {
	Res *bool
	Err error
}

WalletIsLockedRes is the result from a call to WalletIsLocked

type WalletLockRes

type WalletLockRes struct {
	Res *None
	Err error
}

WalletLockRes is the result from a call to WalletLock

type WalletPassphraseChangeRes

type WalletPassphraseChangeRes struct {
	Res *None
	Err error
}

WalletPassphraseChangeRes is the result from a call to WalletPassphraseChange

type WalletPassphraseRes

type WalletPassphraseRes struct {
	Res *None
	Err error
}

WalletPassphraseRes is the result from a call to WalletPassphrase

type WebsocketClient

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

func NewWebsocketClient

func NewWebsocketClient(c *websocket.Conn, authenticated bool, remoteAddr string) *WebsocketClient

func (*WebsocketClient) Send

func (c *WebsocketClient) Send(b []byte) error

Jump to

Keyboard shortcuts

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