func (c *Client) AddWitnessAddress(address string) (soterutil.Address, error) {
	return c.AddWitnessAddressAsync(address).Receive()
}
AddWitnessAddress adds a witness address for a script and returns the new
address (P2SH of the witness script).
package rpcclient
import (
	"encoding/json"
	"strconv"
	"github.com/soteria-dag/soterd/soterjson"
	"github.com/soteria-dag/soterd/chaincfg"
	"github.com/soteria-dag/soterd/chaincfg/chainhash"
	"github.com/soteria-dag/soterd/wire"
	"github.com/soteria-dag/soterd/soterutil"
)
type FutureGetTransactionResult chan *response
func (r FutureGetTransactionResult) Receive() (*soterjson.GetTransactionResult, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var getTx soterjson.GetTransactionResult
	err = json.Unmarshal(res, &getTx)
	if err != nil {
		return nil, err
	}
	return &getTx, nil
}
func (c *Client) GetTransactionAsync(txHash *chainhash.Hash) FutureGetTransactionResult {
	hash := ""
	if txHash != nil {
		hash = txHash.String()
	}
	cmd := soterjson.NewGetTransactionCmd(hash, nil)
	return c.sendCmd(cmd)
}
func (c *Client) GetTransaction(txHash *chainhash.Hash) (*soterjson.GetTransactionResult, error) {
	return c.GetTransactionAsync(txHash).Receive()
}
type FutureListTransactionsResult chan *response
func (r FutureListTransactionsResult) Receive() ([]soterjson.ListTransactionsResult, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var transactions []soterjson.ListTransactionsResult
	err = json.Unmarshal(res, &transactions)
	if err != nil {
		return nil, err
	}
	return transactions, nil
}
func (c *Client) ListTransactionsAsync(account string) FutureListTransactionsResult {
	cmd := soterjson.NewListTransactionsCmd(&account, nil, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListTransactions(account string) ([]soterjson.ListTransactionsResult, error) {
	return c.ListTransactionsAsync(account).Receive()
}
func (c *Client) ListTransactionsCountAsync(account string, count int) FutureListTransactionsResult {
	cmd := soterjson.NewListTransactionsCmd(&account, &count, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListTransactionsCount(account string, count int) ([]soterjson.ListTransactionsResult, error) {
	return c.ListTransactionsCountAsync(account, count).Receive()
}
func (c *Client) ListTransactionsCountFromAsync(account string, count, from int) FutureListTransactionsResult {
	cmd := soterjson.NewListTransactionsCmd(&account, &count, &from, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListTransactionsCountFrom(account string, count, from int) ([]soterjson.ListTransactionsResult, error) {
	return c.ListTransactionsCountFromAsync(account, count, from).Receive()
}
type FutureListUnspentResult chan *response
func (r FutureListUnspentResult) Receive() ([]soterjson.ListUnspentResult, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var unspent []soterjson.ListUnspentResult
	err = json.Unmarshal(res, &unspent)
	if err != nil {
		return nil, err
	}
	return unspent, nil
}
func (c *Client) ListUnspentAsync() FutureListUnspentResult {
	cmd := soterjson.NewListUnspentCmd(nil, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListUnspentMinAsync(minConf int) FutureListUnspentResult {
	cmd := soterjson.NewListUnspentCmd(&minConf, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListUnspentMinMaxAsync(minConf, maxConf int) FutureListUnspentResult {
	cmd := soterjson.NewListUnspentCmd(&minConf, &maxConf, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListUnspentMinMaxAddressesAsync(minConf, maxConf int, addrs []soterutil.Address) FutureListUnspentResult {
	addrStrs := make([]string, 0, len(addrs))
	for _, a := range addrs {
		addrStrs = append(addrStrs, a.EncodeAddress())
	}
	cmd := soterjson.NewListUnspentCmd(&minConf, &maxConf, &addrStrs)
	return c.sendCmd(cmd)
}
func (c *Client) ListUnspent() ([]soterjson.ListUnspentResult, error) {
	return c.ListUnspentAsync().Receive()
}
func (c *Client) ListUnspentMin(minConf int) ([]soterjson.ListUnspentResult, error) {
	return c.ListUnspentMinAsync(minConf).Receive()
}
func (c *Client) ListUnspentMinMax(minConf, maxConf int) ([]soterjson.ListUnspentResult, error) {
	return c.ListUnspentMinMaxAsync(minConf, maxConf).Receive()
}
func (c *Client) ListUnspentMinMaxAddresses(minConf, maxConf int, addrs []soterutil.Address) ([]soterjson.ListUnspentResult, error) {
	return c.ListUnspentMinMaxAddressesAsync(minConf, maxConf, addrs).Receive()
}
type FutureListSinceBlockResult chan *response
func (r FutureListSinceBlockResult) Receive() (*soterjson.ListSinceBlockResult, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var listResult soterjson.ListSinceBlockResult
	err = json.Unmarshal(res, &listResult)
	if err != nil {
		return nil, err
	}
	return &listResult, nil
}
func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceBlockResult {
	var hash *string
	if blockHash != nil {
		hash = soterjson.String(blockHash.String())
	}
	cmd := soterjson.NewListSinceBlockCmd(hash, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*soterjson.ListSinceBlockResult, error) {
	return c.ListSinceBlockAsync(blockHash).Receive()
}
func (c *Client) ListSinceBlockMinConfAsync(blockHash *chainhash.Hash, minConfirms int) FutureListSinceBlockResult {
	var hash *string
	if blockHash != nil {
		hash = soterjson.String(blockHash.String())
	}
	cmd := soterjson.NewListSinceBlockCmd(hash, &minConfirms, nil)
	return c.sendCmd(cmd)
}
func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms int) (*soterjson.ListSinceBlockResult, error) {
	return c.ListSinceBlockMinConfAsync(blockHash, minConfirms).Receive()
}
type FutureLockUnspentResult chan *response
func (r FutureLockUnspentResult) Receive() error {
	_, err := receiveFuture(r)
	return err
}
func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockUnspentResult {
	outputs := make([]soterjson.TransactionInput, len(ops))
	for i, op := range ops {
		outputs[i] = soterjson.TransactionInput{
			Txid: op.Hash.String(),
			Vout: op.Index,
		}
	}
	cmd := soterjson.NewLockUnspentCmd(unlock, outputs)
	return c.sendCmd(cmd)
}
func (c *Client) LockUnspent(unlock bool, ops []*wire.OutPoint) error {
	return c.LockUnspentAsync(unlock, ops).Receive()
}
type FutureListLockUnspentResult chan *response
func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var inputs []soterjson.TransactionInput
	err = json.Unmarshal(res, &inputs)
	if err != nil {
		return nil, err
	}
	ops := make([]*wire.OutPoint, len(inputs))
	for i, input := range inputs {
		sha, err := chainhash.NewHashFromStr(input.Txid)
		if err != nil {
			return nil, err
		}
		ops[i] = wire.NewOutPoint(sha, input.Vout)
	}
	return ops, nil
}
func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult {
	cmd := soterjson.NewListLockUnspentCmd()
	return c.sendCmd(cmd)
}
func (c *Client) ListLockUnspent() ([]*wire.OutPoint, error) {
	return c.ListLockUnspentAsync().Receive()
}
type FutureSetTxFeeResult chan *response
func (r FutureSetTxFeeResult) Receive() error {
	_, err := receiveFuture(r)
	return err
}
func (c *Client) SetTxFeeAsync(fee soterutil.Amount) FutureSetTxFeeResult {
	cmd := soterjson.NewSetTxFeeCmd(fee.ToSOTER())
	return c.sendCmd(cmd)
}
func (c *Client) SetTxFee(fee soterutil.Amount) error {
	return c.SetTxFeeAsync(fee).Receive()
}
type FutureSendToAddressResult chan *response
func (r FutureSendToAddressResult) Receive() (*chainhash.Hash, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var txHash string
	err = json.Unmarshal(res, &txHash)
	if err != nil {
		return nil, err
	}
	return chainhash.NewHashFromStr(txHash)
}
func (c *Client) SendToAddressAsync(address soterutil.Address, amount soterutil.Amount) FutureSendToAddressResult {
	addr := address.EncodeAddress()
	cmd := soterjson.NewSendToAddressCmd(addr, amount.ToSOTER(), nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) SendToAddress(address soterutil.Address, amount soterutil.Amount) (*chainhash.Hash, error) {
	return c.SendToAddressAsync(address, amount).Receive()
}
func (c *Client) SendToAddressCommentAsync(address soterutil.Address,
	amount soterutil.Amount, comment,
	commentTo string) FutureSendToAddressResult {
	addr := address.EncodeAddress()
	cmd := soterjson.NewSendToAddressCmd(addr, amount.ToSOTER(), &comment,
		&commentTo)
	return c.sendCmd(cmd)
}
func (c *Client) SendToAddressComment(address soterutil.Address, amount soterutil.Amount, comment, commentTo string) (*chainhash.Hash, error) {
	return c.SendToAddressCommentAsync(address, amount, comment,
		commentTo).Receive()
}
type FutureSendFromResult chan *response
func (r FutureSendFromResult) Receive() (*chainhash.Hash, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var txHash string
	err = json.Unmarshal(res, &txHash)
	if err != nil {
		return nil, err
	}
	return chainhash.NewHashFromStr(txHash)
}
func (c *Client) SendFromAsync(fromAccount string, toAddress soterutil.Address, amount soterutil.Amount) FutureSendFromResult {
	addr := toAddress.EncodeAddress()
	cmd := soterjson.NewSendFromCmd(fromAccount, addr, amount.ToSOTER(), nil,
		nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) SendFrom(fromAccount string, toAddress soterutil.Address, amount soterutil.Amount) (*chainhash.Hash, error) {
	return c.SendFromAsync(fromAccount, toAddress, amount).Receive()
}
func (c *Client) SendFromMinConfAsync(fromAccount string, toAddress soterutil.Address, amount soterutil.Amount, minConfirms int) FutureSendFromResult {
	addr := toAddress.EncodeAddress()
	cmd := soterjson.NewSendFromCmd(fromAccount, addr, amount.ToSOTER(),
		&minConfirms, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) SendFromMinConf(fromAccount string, toAddress soterutil.Address, amount soterutil.Amount, minConfirms int) (*chainhash.Hash, error) {
	return c.SendFromMinConfAsync(fromAccount, toAddress, amount,
		minConfirms).Receive()
}
func (c *Client) SendFromCommentAsync(fromAccount string,
	toAddress soterutil.Address, amount soterutil.Amount, minConfirms int,
	comment, commentTo string) FutureSendFromResult {
	addr := toAddress.EncodeAddress()
	cmd := soterjson.NewSendFromCmd(fromAccount, addr, amount.ToSOTER(),
		&minConfirms, &comment, &commentTo)
	return c.sendCmd(cmd)
}
func (c *Client) SendFromComment(fromAccount string, toAddress soterutil.Address,
	amount soterutil.Amount, minConfirms int,
	comment, commentTo string) (*chainhash.Hash, error) {
	return c.SendFromCommentAsync(fromAccount, toAddress, amount,
		minConfirms, comment, commentTo).Receive()
}
type FutureSendManyResult chan *response
func (r FutureSendManyResult) Receive() (*chainhash.Hash, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var txHash string
	err = json.Unmarshal(res, &txHash)
	if err != nil {
		return nil, err
	}
	return chainhash.NewHashFromStr(txHash)
}
func (c *Client) SendManyAsync(fromAccount string, amounts map[soterutil.Address]soterutil.Amount) FutureSendManyResult {
	convertedAmounts := make(map[string]float64, len(amounts))
	for addr, amount := range amounts {
		convertedAmounts[addr.EncodeAddress()] = amount.ToSOTER()
	}
	cmd := soterjson.NewSendManyCmd(fromAccount, convertedAmounts, nil, nil)
	return c.sendCmd(cmd)
}
func (c *Client) SendMany(fromAccount string, amounts map[soterutil.Address]soterutil.Amount) (*chainhash.Hash, error) {
	return c.SendManyAsync(fromAccount, amounts).Receive()
}
func (c *Client) SendManyMinConfAsync(fromAccount string,
	amounts map[soterutil.Address]soterutil.Amount,
	minConfirms int) FutureSendManyResult {
	convertedAmounts := make(map[string]float64, len(amounts))
	for addr, amount := range amounts {
		convertedAmounts[addr.EncodeAddress()] = amount.ToSOTER()
	}
	cmd := soterjson.NewSendManyCmd(fromAccount, convertedAmounts,
		&minConfirms, nil)
	return c.sendCmd(cmd)
}
func (c *Client) SendManyMinConf(fromAccount string,
	amounts map[soterutil.Address]soterutil.Amount,
	minConfirms int) (*chainhash.Hash, error) {
	return c.SendManyMinConfAsync(fromAccount, amounts, minConfirms).Receive()
}
func (c *Client) SendManyCommentAsync(fromAccount string,
	amounts map[soterutil.Address]soterutil.Amount, minConfirms int,
	comment string) FutureSendManyResult {
	convertedAmounts := make(map[string]float64, len(amounts))
	for addr, amount := range amounts {
		convertedAmounts[addr.EncodeAddress()] = amount.ToSOTER()
	}
	cmd := soterjson.NewSendManyCmd(fromAccount, convertedAmounts,
		&minConfirms, &comment)
	return c.sendCmd(cmd)
}
func (c *Client) SendManyComment(fromAccount string,
	amounts map[soterutil.Address]soterutil.Amount, minConfirms int,
	comment string) (*chainhash.Hash, error) {
	return c.SendManyCommentAsync(fromAccount, amounts, minConfirms,
		comment).Receive()
}
type FutureAddMultisigAddressResult chan *response
func (r FutureAddMultisigAddressResult) Receive() (soterutil.Address, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var addr string
	err = json.Unmarshal(res, &addr)
	if err != nil {
		return nil, err
	}
	return soterutil.DecodeAddress(addr, &chaincfg.MainNetParams)
}
func (c *Client) AddMultisigAddressAsync(requiredSigs int, addresses []soterutil.Address, account string) FutureAddMultisigAddressResult {
	addrs := make([]string, 0, len(addresses))
	for _, addr := range addresses {
		addrs = append(addrs, addr.String())
	}
	cmd := soterjson.NewAddMultisigAddressCmd(requiredSigs, addrs, &account)
	return c.sendCmd(cmd)
}
func (c *Client) AddMultisigAddress(requiredSigs int, addresses []soterutil.Address, account string) (soterutil.Address, error) {
	return c.AddMultisigAddressAsync(requiredSigs, addresses,
		account).Receive()
}
type FutureCreateMultisigResult chan *response
func (r FutureCreateMultisigResult) Receive() (*soterjson.CreateMultiSigResult, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var multisigRes soterjson.CreateMultiSigResult
	err = json.Unmarshal(res, &multisigRes)
	if err != nil {
		return nil, err
	}
	return &multisigRes, nil
}
func (c *Client) CreateMultisigAsync(requiredSigs int, addresses []soterutil.Address) FutureCreateMultisigResult {
	addrs := make([]string, 0, len(addresses))
	for _, addr := range addresses {
		addrs = append(addrs, addr.String())
	}
	cmd := soterjson.NewCreateMultisigCmd(requiredSigs, addrs)
	return c.sendCmd(cmd)
}
func (c *Client) CreateMultisig(requiredSigs int, addresses []soterutil.Address) (*soterjson.CreateMultiSigResult, error) {
	return c.CreateMultisigAsync(requiredSigs, addresses).Receive()
}
type FutureCreateNewAccountResult chan *response
func (r FutureCreateNewAccountResult) Receive() error {
	_, err := receiveFuture(r)
	return err
}
func (c *Client) CreateNewAccountAsync(account string) FutureCreateNewAccountResult {
	cmd := soterjson.NewCreateNewAccountCmd(account)
	return c.sendCmd(cmd)
}
func (c *Client) CreateNewAccount(account string) error {
	return c.CreateNewAccountAsync(account).Receive()
}
type FutureGetNewAddressResult chan *response
func (r FutureGetNewAddressResult) Receive() (soterutil.Address, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var addr string
	err = json.Unmarshal(res, &addr)
	if err != nil {
		return nil, err
	}
	return soterutil.DecodeAddress(addr, &chaincfg.MainNetParams)
}
func (c *Client) GetNewAddressAsync(account string) FutureGetNewAddressResult {
	cmd := soterjson.NewGetNewAddressCmd(&account)
	return c.sendCmd(cmd)
}
func (c *Client) GetNewAddress(account string) (soterutil.Address, error) {
	return c.GetNewAddressAsync(account).Receive()
}
type FutureGetRawChangeAddressResult chan *response
func (r FutureGetRawChangeAddressResult) Receive() (soterutil.Address, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var addr string
	err = json.Unmarshal(res, &addr)
	if err != nil {
		return nil, err
	}
	return soterutil.DecodeAddress(addr, &chaincfg.MainNetParams)
}
func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddressResult {
	cmd := soterjson.NewGetRawChangeAddressCmd(&account)
	return c.sendCmd(cmd)
}
func (c *Client) GetRawChangeAddress(account string) (soterutil.Address, error) {
	return c.GetRawChangeAddressAsync(account).Receive()
}
type FutureAddWitnessAddressResult chan *response
func (r FutureAddWitnessAddressResult) Receive() (soterutil.Address, error) {
	res, err := receiveFuture(r)
	if err != nil {
		return nil, err
	}
	var addr string
	err = json.Unmarshal(res, &addr)
	if err != nil {
		return nil, err
	}
	return soterutil.DecodeAddress(addr, &chaincfg.MainNetParams)
}
func (c *Client) AddWitnessAddressAsync(address string) FutureAddWitnessAddressResult {
	cmd := soterjson.NewAddWitnessAddressCmd(address)
	return c.sendCmd(cmd)
}