rpc: update rpc cmd requests to support multi-account
Most of the updates add optional arguments with default values.
This commit is contained in:
parent
6bc9a2b4dd
commit
987a533423
6 changed files with 226 additions and 128 deletions
|
@ -176,12 +176,13 @@ func NewGetAccountCmd(address string) *GetAccountCmd {
|
||||||
|
|
||||||
// GetAccountAddressCmd defines the getaccountaddress JSON-RPC command.
|
// GetAccountAddressCmd defines the getaccountaddress JSON-RPC command.
|
||||||
type GetAccountAddressCmd struct {
|
type GetAccountAddressCmd struct {
|
||||||
Account string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"legacy\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetAccountAddressCmd returns a new instance which can be used to issue a
|
// NewGetAccountAddressCmd returns a new instance which can be used to issue a
|
||||||
// getaccountaddress JSON-RPC command.
|
// getaccountaddress JSON-RPC command.
|
||||||
func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd {
|
func NewGetAccountAddressCmd(account *string) *GetAccountAddressCmd {
|
||||||
return &GetAccountAddressCmd{
|
return &GetAccountAddressCmd{
|
||||||
Account: account,
|
Account: account,
|
||||||
}
|
}
|
||||||
|
@ -189,12 +190,13 @@ func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd {
|
||||||
|
|
||||||
// GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command.
|
// GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command.
|
||||||
type GetAddressesByAccountCmd struct {
|
type GetAddressesByAccountCmd struct {
|
||||||
Account string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetAddressesByAccountCmd returns a new instance which can be used to issue
|
// NewGetAddressesByAccountCmd returns a new instance which can be used to issue
|
||||||
// a getaddressesbyaccount JSON-RPC command.
|
// a getaddressesbyaccount JSON-RPC command.
|
||||||
func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd {
|
func NewGetAddressesByAccountCmd(account *string) *GetAddressesByAccountCmd {
|
||||||
return &GetAddressesByAccountCmd{
|
return &GetAddressesByAccountCmd{
|
||||||
Account: account,
|
Account: account,
|
||||||
}
|
}
|
||||||
|
@ -215,8 +217,9 @@ func NewGetAddressInfoCmd(address string) *GetAddressInfoCmd {
|
||||||
|
|
||||||
// GetBalanceCmd defines the getbalance JSON-RPC command.
|
// GetBalanceCmd defines the getbalance JSON-RPC command.
|
||||||
type GetBalanceCmd struct {
|
type GetBalanceCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
MinConf *int `jsonrpcdefault:"1"`
|
MinConf *int `jsonrpcdefault:"1"`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetBalanceCmd returns a new instance which can be used to issue a
|
// NewGetBalanceCmd returns a new instance which can be used to issue a
|
||||||
|
@ -242,8 +245,8 @@ func NewGetBalancesCmd() *GetBalancesCmd {
|
||||||
|
|
||||||
// GetNewAddressCmd defines the getnewaddress JSON-RPC command.
|
// GetNewAddressCmd defines the getnewaddress JSON-RPC command.
|
||||||
type GetNewAddressCmd struct {
|
type GetNewAddressCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
AddressType *string // must be one of legacy / p2pkh or p2sh-p2wkh / p2sh-segwit, or p2wkh / bech32
|
AddressType *string `jsonrpcdefault:"\"legacy\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetNewAddressCmd returns a new instance which can be used to issue a
|
// NewGetNewAddressCmd returns a new instance which can be used to issue a
|
||||||
|
@ -259,7 +262,8 @@ func NewGetNewAddressCmd(account *string) *GetNewAddressCmd {
|
||||||
|
|
||||||
// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.
|
// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.
|
||||||
type GetRawChangeAddressCmd struct {
|
type GetRawChangeAddressCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"legacy\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetRawChangeAddressCmd returns a new instance which can be used to issue a
|
// NewGetRawChangeAddressCmd returns a new instance which can be used to issue a
|
||||||
|
@ -275,8 +279,8 @@ func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd {
|
||||||
|
|
||||||
// GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command.
|
// GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command.
|
||||||
type GetReceivedByAccountCmd struct {
|
type GetReceivedByAccountCmd struct {
|
||||||
Account string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
MinConf *int `jsonrpcdefault:"1"`
|
MinConf *int `jsonrpcdefault:"1"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetReceivedByAccountCmd returns a new instance which can be used to issue
|
// NewGetReceivedByAccountCmd returns a new instance which can be used to issue
|
||||||
|
@ -284,7 +288,7 @@ type GetReceivedByAccountCmd struct {
|
||||||
//
|
//
|
||||||
// The parameters which are pointers indicate they are optional. Passing nil
|
// The parameters which are pointers indicate they are optional. Passing nil
|
||||||
// for optional parameters will use the default value.
|
// for optional parameters will use the default value.
|
||||||
func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAccountCmd {
|
func NewGetReceivedByAccountCmd(account *string, minConf *int) *GetReceivedByAccountCmd {
|
||||||
return &GetReceivedByAccountCmd{
|
return &GetReceivedByAccountCmd{
|
||||||
Account: account,
|
Account: account,
|
||||||
MinConf: minConf,
|
MinConf: minConf,
|
||||||
|
@ -407,7 +411,8 @@ func NewKeyPoolRefillCmd(newSize *uint) *KeyPoolRefillCmd {
|
||||||
|
|
||||||
// ListAccountsCmd defines the listaccounts JSON-RPC command.
|
// ListAccountsCmd defines the listaccounts JSON-RPC command.
|
||||||
type ListAccountsCmd struct {
|
type ListAccountsCmd struct {
|
||||||
MinConf *int `jsonrpcdefault:"1"`
|
MinConf *int `jsonrpcdefault:"1"`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewListAccountsCmd returns a new instance which can be used to issue a
|
// NewListAccountsCmd returns a new instance which can be used to issue a
|
||||||
|
@ -501,10 +506,10 @@ func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOn
|
||||||
|
|
||||||
// ListTransactionsCmd defines the listtransactions JSON-RPC command.
|
// ListTransactionsCmd defines the listtransactions JSON-RPC command.
|
||||||
type ListTransactionsCmd struct {
|
type ListTransactionsCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
Count *int `jsonrpcdefault:"10"`
|
Count *int `jsonrpcdefault:"10"`
|
||||||
From *int `jsonrpcdefault:"0"`
|
From *int `jsonrpcdefault:"0"`
|
||||||
IncludeWatchOnly *bool `jsonrpcdefault:"false"`
|
IncludeWatchOnly *bool `jsonrpcdefault:"false"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewListTransactionsCmd returns a new instance which can be used to issue a
|
// NewListTransactionsCmd returns a new instance which can be used to issue a
|
||||||
|
@ -562,6 +567,7 @@ type SendFromCmd struct {
|
||||||
ToAddress string
|
ToAddress string
|
||||||
Amount float64 // In BTC
|
Amount float64 // In BTC
|
||||||
MinConf *int `jsonrpcdefault:"1"`
|
MinConf *int `jsonrpcdefault:"1"`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
Comment *string
|
Comment *string
|
||||||
CommentTo *string
|
CommentTo *string
|
||||||
}
|
}
|
||||||
|
@ -571,12 +577,15 @@ type SendFromCmd struct {
|
||||||
//
|
//
|
||||||
// The parameters which are pointers indicate they are optional. Passing nil
|
// The parameters which are pointers indicate they are optional. Passing nil
|
||||||
// for optional parameters will use the default value.
|
// for optional parameters will use the default value.
|
||||||
func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int, comment, commentTo *string) *SendFromCmd {
|
func NewSendFromCmd(fromAccount, toAddress string, amount float64,
|
||||||
|
minConf *int, addrType *string, comment, commentTo *string) *SendFromCmd {
|
||||||
|
|
||||||
return &SendFromCmd{
|
return &SendFromCmd{
|
||||||
FromAccount: fromAccount,
|
FromAccount: fromAccount,
|
||||||
ToAddress: toAddress,
|
ToAddress: toAddress,
|
||||||
Amount: amount,
|
Amount: amount,
|
||||||
MinConf: minConf,
|
MinConf: minConf,
|
||||||
|
AddressType: addrType,
|
||||||
Comment: comment,
|
Comment: comment,
|
||||||
CommentTo: commentTo,
|
CommentTo: commentTo,
|
||||||
}
|
}
|
||||||
|
@ -587,6 +596,7 @@ type SendManyCmd struct {
|
||||||
FromAccount string
|
FromAccount string
|
||||||
Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
|
Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC
|
||||||
MinConf *int `jsonrpcdefault:"1"`
|
MinConf *int `jsonrpcdefault:"1"`
|
||||||
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
Comment *string
|
Comment *string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,21 +605,24 @@ type SendManyCmd struct {
|
||||||
//
|
//
|
||||||
// The parameters which are pointers indicate they are optional. Passing nil
|
// The parameters which are pointers indicate they are optional. Passing nil
|
||||||
// for optional parameters will use the default value.
|
// for optional parameters will use the default value.
|
||||||
func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int, comment *string) *SendManyCmd {
|
func NewSendManyCmd(fromAccount string, amounts map[string]float64,
|
||||||
|
minConf *int, addrType *string, comment *string) *SendManyCmd {
|
||||||
return &SendManyCmd{
|
return &SendManyCmd{
|
||||||
FromAccount: fromAccount,
|
FromAccount: fromAccount,
|
||||||
Amounts: amounts,
|
Amounts: amounts,
|
||||||
MinConf: minConf,
|
MinConf: minConf,
|
||||||
|
AddressType: addrType,
|
||||||
Comment: comment,
|
Comment: comment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendToAddressCmd defines the sendtoaddress JSON-RPC command.
|
// SendToAddressCmd defines the sendtoaddress JSON-RPC command.
|
||||||
type SendToAddressCmd struct {
|
type SendToAddressCmd struct {
|
||||||
Address string
|
Address string
|
||||||
Amount float64
|
Amount float64
|
||||||
Comment *string
|
AddressType *string `jsonrpcdefault:"\"*\""`
|
||||||
CommentTo *string
|
Comment *string
|
||||||
|
CommentTo *string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSendToAddressCmd returns a new instance which can be used to issue a
|
// NewSendToAddressCmd returns a new instance which can be used to issue a
|
||||||
|
@ -617,12 +630,14 @@ type SendToAddressCmd struct {
|
||||||
//
|
//
|
||||||
// The parameters which are pointers indicate they are optional. Passing nil
|
// The parameters which are pointers indicate they are optional. Passing nil
|
||||||
// for optional parameters will use the default value.
|
// for optional parameters will use the default value.
|
||||||
func NewSendToAddressCmd(address string, amount float64, comment, commentTo *string) *SendToAddressCmd {
|
func NewSendToAddressCmd(address string, amount float64, addrType *string,
|
||||||
|
comment, commentTo *string) *SendToAddressCmd {
|
||||||
return &SendToAddressCmd{
|
return &SendToAddressCmd{
|
||||||
Address: address,
|
Address: address,
|
||||||
Amount: amount,
|
Amount: amount,
|
||||||
Comment: comment,
|
AddressType: addrType,
|
||||||
CommentTo: commentTo,
|
Comment: comment,
|
||||||
|
CommentTo: commentTo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,11 +287,12 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("getaccountaddress", "acct")
|
return btcjson.NewCmd("getaccountaddress", "acct")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetAccountAddressCmd("acct")
|
return btcjson.NewGetAccountAddressCmd(btcjson.String("acct"))
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getaccountaddress","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getaccountaddress","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetAccountAddressCmd{
|
unmarshalled: &btcjson.GetAccountAddressCmd{
|
||||||
Account: "acct",
|
Account: btcjson.String("acct"),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -300,11 +301,12 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("getaddressesbyaccount", "acct")
|
return btcjson.NewCmd("getaddressesbyaccount", "acct")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetAddressesByAccountCmd("acct")
|
return btcjson.NewGetAddressesByAccountCmd(btcjson.String("acct"))
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getaddressesbyaccount","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getaddressesbyaccount","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetAddressesByAccountCmd{
|
unmarshalled: &btcjson.GetAddressesByAccountCmd{
|
||||||
Account: "acct",
|
Account: btcjson.String("acct"),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -330,8 +332,9 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetBalanceCmd{
|
unmarshalled: &btcjson.GetBalanceCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -344,8 +347,9 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetBalanceCmd{
|
unmarshalled: &btcjson.GetBalanceCmd{
|
||||||
Account: btcjson.String("acct"),
|
Account: btcjson.String("acct"),
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -358,8 +362,9 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct",6],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct",6],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetBalanceCmd{
|
unmarshalled: &btcjson.GetBalanceCmd{
|
||||||
Account: btcjson.String("acct"),
|
Account: btcjson.String("acct"),
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -383,7 +388,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetNewAddressCmd{
|
unmarshalled: &btcjson.GetNewAddressCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -396,7 +402,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetNewAddressCmd{
|
unmarshalled: &btcjson.GetNewAddressCmd{
|
||||||
Account: btcjson.String("acct"),
|
Account: btcjson.String("acct"),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -409,7 +416,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetRawChangeAddressCmd{
|
unmarshalled: &btcjson.GetRawChangeAddressCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -422,7 +430,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetRawChangeAddressCmd{
|
unmarshalled: &btcjson.GetRawChangeAddressCmd{
|
||||||
Account: btcjson.String("acct"),
|
Account: btcjson.String("acct"),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -431,11 +440,11 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("getreceivedbyaccount", "acct")
|
return btcjson.NewCmd("getreceivedbyaccount", "acct")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetReceivedByAccountCmd("acct", nil)
|
return btcjson.NewGetReceivedByAccountCmd(btcjson.String("acct"), nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct"],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetReceivedByAccountCmd{
|
unmarshalled: &btcjson.GetReceivedByAccountCmd{
|
||||||
Account: "acct",
|
Account: btcjson.String("acct"),
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -445,11 +454,11 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("getreceivedbyaccount", "acct", 6)
|
return btcjson.NewCmd("getreceivedbyaccount", "acct", 6)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewGetReceivedByAccountCmd("acct", btcjson.Int(6))
|
return btcjson.NewGetReceivedByAccountCmd(btcjson.String("acct"), btcjson.Int(6))
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct",6],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct",6],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetReceivedByAccountCmd{
|
unmarshalled: &btcjson.GetReceivedByAccountCmd{
|
||||||
Account: "acct",
|
Account: btcjson.String("acct"),
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -601,7 +610,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.ListAccountsCmd{
|
unmarshalled: &btcjson.ListAccountsCmd{
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -614,7 +624,8 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[6],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[6],"id":1}`,
|
||||||
unmarshalled: &btcjson.ListAccountsCmd{
|
unmarshalled: &btcjson.ListAccountsCmd{
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -844,7 +855,7 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.ListTransactionsCmd{
|
unmarshalled: &btcjson.ListTransactionsCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
Count: btcjson.Int(10),
|
Count: btcjson.Int(10),
|
||||||
From: btcjson.Int(0),
|
From: btcjson.Int(0),
|
||||||
IncludeWatchOnly: btcjson.Bool(false),
|
IncludeWatchOnly: btcjson.Bool(false),
|
||||||
|
@ -1002,7 +1013,7 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5)
|
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendFromCmd("from", "1Address", 0.5, nil, nil, nil)
|
return btcjson.NewSendFromCmd("from", "1Address", 0.5, nil, nil, nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendFromCmd{
|
unmarshalled: &btcjson.SendFromCmd{
|
||||||
|
@ -1010,6 +1021,7 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
ToAddress: "1Address",
|
ToAddress: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
Comment: nil,
|
Comment: nil,
|
||||||
CommentTo: nil,
|
CommentTo: nil,
|
||||||
},
|
},
|
||||||
|
@ -1020,7 +1032,7 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6)
|
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), nil, nil)
|
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), nil, nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendFromCmd{
|
unmarshalled: &btcjson.SendFromCmd{
|
||||||
|
@ -1028,6 +1040,7 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
ToAddress: "1Address",
|
ToAddress: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
Comment: nil,
|
Comment: nil,
|
||||||
CommentTo: nil,
|
CommentTo: nil,
|
||||||
},
|
},
|
||||||
|
@ -1035,37 +1048,59 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "sendfrom optional2",
|
name: "sendfrom optional2",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "comment")
|
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "legacy")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6),
|
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), btcjson.String("legacy"),
|
||||||
btcjson.String("comment"), nil)
|
nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"comment"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"legacy"],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendFromCmd{
|
unmarshalled: &btcjson.SendFromCmd{
|
||||||
FromAccount: "from",
|
FromAccount: "from",
|
||||||
ToAddress: "1Address",
|
ToAddress: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
Comment: btcjson.String("comment"),
|
AddressType: btcjson.String("legacy"),
|
||||||
|
Comment: nil,
|
||||||
CommentTo: nil,
|
CommentTo: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "sendfrom optional3",
|
name: "sendfrom optional3",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "comment", "commentto")
|
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "legacy", "comment")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6),
|
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), btcjson.String("legacy"),
|
||||||
btcjson.String("comment"), btcjson.String("commentto"))
|
btcjson.String("comment"), nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"comment","commentto"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"legacy","comment"],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendFromCmd{
|
unmarshalled: &btcjson.SendFromCmd{
|
||||||
FromAccount: "from",
|
FromAccount: "from",
|
||||||
ToAddress: "1Address",
|
ToAddress: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
|
Comment: btcjson.String("comment"),
|
||||||
|
CommentTo: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sendfrom optional4",
|
||||||
|
newCmd: func() (interface{}, error) {
|
||||||
|
return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "legacy", "comment", "commentto")
|
||||||
|
},
|
||||||
|
staticCmd: func() interface{} {
|
||||||
|
return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), btcjson.String("legacy"),
|
||||||
|
btcjson.String("comment"), btcjson.String("commentto"))
|
||||||
|
},
|
||||||
|
marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"legacy","comment","commentto"],"id":1}`,
|
||||||
|
unmarshalled: &btcjson.SendFromCmd{
|
||||||
|
FromAccount: "from",
|
||||||
|
ToAddress: "1Address",
|
||||||
|
Amount: 0.5,
|
||||||
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
Comment: btcjson.String("comment"),
|
Comment: btcjson.String("comment"),
|
||||||
CommentTo: btcjson.String("commentto"),
|
CommentTo: btcjson.String("commentto"),
|
||||||
},
|
},
|
||||||
|
@ -1077,13 +1112,14 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
amounts := map[string]float64{"1Address": 0.5}
|
amounts := map[string]float64{"1Address": 0.5}
|
||||||
return btcjson.NewSendManyCmd("from", amounts, nil, nil)
|
return btcjson.NewSendManyCmd("from", amounts, nil, nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5}],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5}],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendManyCmd{
|
unmarshalled: &btcjson.SendManyCmd{
|
||||||
FromAccount: "from",
|
FromAccount: "from",
|
||||||
Amounts: map[string]float64{"1Address": 0.5},
|
Amounts: map[string]float64{"1Address": 0.5},
|
||||||
MinConf: btcjson.Int(1),
|
MinConf: btcjson.Int(1),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
Comment: nil,
|
Comment: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1094,30 +1130,50 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
amounts := map[string]float64{"1Address": 0.5}
|
amounts := map[string]float64{"1Address": 0.5}
|
||||||
return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), nil)
|
return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendManyCmd{
|
unmarshalled: &btcjson.SendManyCmd{
|
||||||
FromAccount: "from",
|
FromAccount: "from",
|
||||||
Amounts: map[string]float64{"1Address": 0.5},
|
Amounts: map[string]float64{"1Address": 0.5},
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("*"),
|
||||||
Comment: nil,
|
Comment: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "sendmany optional2",
|
name: "sendmany optional2",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`, 6, "comment")
|
return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`, 6, "legacy")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
amounts := map[string]float64{"1Address": 0.5}
|
amounts := map[string]float64{"1Address": 0.5}
|
||||||
return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), btcjson.String("comment"))
|
return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), btcjson.String("legacy"), nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6,"comment"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6,"legacy"],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendManyCmd{
|
unmarshalled: &btcjson.SendManyCmd{
|
||||||
FromAccount: "from",
|
FromAccount: "from",
|
||||||
Amounts: map[string]float64{"1Address": 0.5},
|
Amounts: map[string]float64{"1Address": 0.5},
|
||||||
MinConf: btcjson.Int(6),
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
|
Comment: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sendmany optional3",
|
||||||
|
newCmd: func() (interface{}, error) {
|
||||||
|
return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`, 6, "legacy", "comment")
|
||||||
|
},
|
||||||
|
staticCmd: func() interface{} {
|
||||||
|
amounts := map[string]float64{"1Address": 0.5}
|
||||||
|
return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), btcjson.String("legacy"), btcjson.String("comment"))
|
||||||
|
},
|
||||||
|
marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6,"legacy","comment"],"id":1}`,
|
||||||
|
unmarshalled: &btcjson.SendManyCmd{
|
||||||
|
FromAccount: "from",
|
||||||
|
Amounts: map[string]float64{"1Address": 0.5},
|
||||||
|
MinConf: btcjson.Int(6),
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
Comment: btcjson.String("comment"),
|
Comment: btcjson.String("comment"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1127,31 +1183,50 @@ func TestWalletSvrCmds(t *testing.T) {
|
||||||
return btcjson.NewCmd("sendtoaddress", "1Address", 0.5)
|
return btcjson.NewCmd("sendtoaddress", "1Address", 0.5)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendToAddressCmd("1Address", 0.5, nil, nil)
|
return btcjson.NewSendToAddressCmd("1Address", 0.5, nil, nil, nil)
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendToAddressCmd{
|
unmarshalled: &btcjson.SendToAddressCmd{
|
||||||
Address: "1Address",
|
Address: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
Comment: nil,
|
AddressType: btcjson.String("*"),
|
||||||
CommentTo: nil,
|
Comment: nil,
|
||||||
|
CommentTo: nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "sendtoaddress optional1",
|
name: "sendtoaddress optional1",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("sendtoaddress", "1Address", 0.5, "comment", "commentto")
|
return btcjson.NewCmd("sendtoaddress", "1Address", 0.5, "legacy")
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewSendToAddressCmd("1Address", 0.5, btcjson.String("comment"),
|
return btcjson.NewSendToAddressCmd("1Address", 0.5, btcjson.String("legacy"), nil, nil)
|
||||||
|
},
|
||||||
|
marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5,"legacy"],"id":1}`,
|
||||||
|
unmarshalled: &btcjson.SendToAddressCmd{
|
||||||
|
Address: "1Address",
|
||||||
|
Amount: 0.5,
|
||||||
|
AddressType: btcjson.String("legacy"),
|
||||||
|
Comment: nil,
|
||||||
|
CommentTo: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sendtoaddress optional2",
|
||||||
|
newCmd: func() (interface{}, error) {
|
||||||
|
return btcjson.NewCmd("sendtoaddress", "1Address", 0.5, "legacy", "comment", "commentto")
|
||||||
|
},
|
||||||
|
staticCmd: func() interface{} {
|
||||||
|
return btcjson.NewSendToAddressCmd("1Address", 0.5, btcjson.String("legacy"), btcjson.String("comment"),
|
||||||
btcjson.String("commentto"))
|
btcjson.String("commentto"))
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5,"comment","commentto"],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5,"legacy","comment","commentto"],"id":1}`,
|
||||||
unmarshalled: &btcjson.SendToAddressCmd{
|
unmarshalled: &btcjson.SendToAddressCmd{
|
||||||
Address: "1Address",
|
Address: "1Address",
|
||||||
Amount: 0.5,
|
Amount: 0.5,
|
||||||
Comment: btcjson.String("comment"),
|
AddressType: btcjson.String("legacy"),
|
||||||
CommentTo: btcjson.String("commentto"),
|
Comment: btcjson.String("comment"),
|
||||||
|
CommentTo: btcjson.String("commentto"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,6 +174,7 @@ type GetTransactionResult struct {
|
||||||
TimeReceived int64 `json:"timereceived"`
|
TimeReceived int64 `json:"timereceived"`
|
||||||
Details []GetTransactionDetailsResult `json:"details"`
|
Details []GetTransactionDetailsResult `json:"details"`
|
||||||
Hex string `json:"hex"`
|
Hex string `json:"hex"`
|
||||||
|
Generated bool `json:"generated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScanningOrFalse struct {
|
type ScanningOrFalse struct {
|
||||||
|
@ -288,7 +289,6 @@ type ListReceivedByAccountResult struct {
|
||||||
// ListReceivedByAddressResult models the data from the listreceivedbyaddress
|
// ListReceivedByAddressResult models the data from the listreceivedbyaddress
|
||||||
// command.
|
// command.
|
||||||
type ListReceivedByAddressResult struct {
|
type ListReceivedByAddressResult struct {
|
||||||
Account string `json:"account"`
|
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Amount float64 `json:"amount"`
|
Amount float64 `json:"amount"`
|
||||||
Confirmations uint64 `json:"confirmations"`
|
Confirmations uint64 `json:"confirmations"`
|
||||||
|
|
|
@ -40,7 +40,7 @@ func NewExportWatchingWalletCmd(account *string, download *bool) *ExportWatching
|
||||||
|
|
||||||
// GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command.
|
// GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command.
|
||||||
type GetUnconfirmedBalanceCmd struct {
|
type GetUnconfirmedBalanceCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue
|
// NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue
|
||||||
|
@ -58,7 +58,7 @@ func NewGetUnconfirmedBalanceCmd(account *string) *GetUnconfirmedBalanceCmd {
|
||||||
// command.
|
// command.
|
||||||
type ListAddressTransactionsCmd struct {
|
type ListAddressTransactionsCmd struct {
|
||||||
Addresses []string
|
Addresses []string
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewListAddressTransactionsCmd returns a new instance which can be used to
|
// NewListAddressTransactionsCmd returns a new instance which can be used to
|
||||||
|
@ -75,7 +75,7 @@ func NewListAddressTransactionsCmd(addresses []string, account *string) *ListAdd
|
||||||
|
|
||||||
// ListAllTransactionsCmd defines the listalltransactions JSON-RPC command.
|
// ListAllTransactionsCmd defines the listalltransactions JSON-RPC command.
|
||||||
type ListAllTransactionsCmd struct {
|
type ListAllTransactionsCmd struct {
|
||||||
Account *string
|
Account *string `jsonrpcdefault:"\"default\""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewListAllTransactionsCmd returns a new instance which can be used to issue a
|
// NewListAllTransactionsCmd returns a new instance which can be used to issue a
|
||||||
|
|
|
@ -71,7 +71,7 @@ func TestWalletSvrWsCmds(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "exportwatchingwallet optional2",
|
name: "exportwatchingwallet optional2",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
return btcjson.NewCmd("exportwatchingwallet", "acct", true)
|
return btcjson.NewCmd("exportwatchingwallet", btcjson.String("acct"), true)
|
||||||
},
|
},
|
||||||
staticCmd: func() interface{} {
|
staticCmd: func() interface{} {
|
||||||
return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"),
|
return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"),
|
||||||
|
@ -93,7 +93,7 @@ func TestWalletSvrWsCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{
|
unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ func TestWalletSvrWsCmds(t *testing.T) {
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"]],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"]],"id":1}`,
|
||||||
unmarshalled: &btcjson.ListAddressTransactionsCmd{
|
unmarshalled: &btcjson.ListAddressTransactionsCmd{
|
||||||
Addresses: []string{"1Address"},
|
Addresses: []string{"1Address"},
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ func TestWalletSvrWsCmds(t *testing.T) {
|
||||||
},
|
},
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.ListAllTransactionsCmd{
|
unmarshalled: &btcjson.ListAllTransactionsCmd{
|
||||||
Account: nil,
|
Account: btcjson.String("default"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -536,9 +536,10 @@ func (r FutureSendToAddressResult) Receive() (*chainhash.Hash, error) {
|
||||||
// returned instance.
|
// returned instance.
|
||||||
//
|
//
|
||||||
// See SendToAddress for the blocking version and more details.
|
// See SendToAddress for the blocking version and more details.
|
||||||
func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amount) FutureSendToAddressResult {
|
func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amount,
|
||||||
|
addrType *string) FutureSendToAddressResult {
|
||||||
addr := address.EncodeAddress()
|
addr := address.EncodeAddress()
|
||||||
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), nil, nil)
|
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), addrType, nil, nil)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,8 +551,9 @@ func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amou
|
||||||
//
|
//
|
||||||
// NOTE: This function requires to the wallet to be unlocked. See the
|
// NOTE: This function requires to the wallet to be unlocked. See the
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount) (*chainhash.Hash, error) {
|
func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount,
|
||||||
return c.SendToAddressAsync(address, amount).Receive()
|
addrType *string) (*chainhash.Hash, error) {
|
||||||
|
return c.SendToAddressAsync(address, amount, addrType).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendToAddressCommentAsync returns an instance of a type that can be used to
|
// SendToAddressCommentAsync returns an instance of a type that can be used to
|
||||||
|
@ -560,12 +562,12 @@ func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount) (
|
||||||
//
|
//
|
||||||
// See SendToAddressComment for the blocking version and more details.
|
// See SendToAddressComment for the blocking version and more details.
|
||||||
func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
|
func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
|
||||||
amount btcutil.Amount, comment,
|
amount btcutil.Amount, addrType *string, comment string,
|
||||||
commentTo string) FutureSendToAddressResult {
|
commentTo string) FutureSendToAddressResult {
|
||||||
|
|
||||||
addr := address.EncodeAddress()
|
addr := address.EncodeAddress()
|
||||||
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), &comment,
|
cmd := btcjson.NewSendToAddressCmd(addr, amount.ToBTC(), addrType,
|
||||||
&commentTo)
|
&comment, &commentTo)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,9 +583,10 @@ func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
|
||||||
//
|
//
|
||||||
// NOTE: This function requires to the wallet to be unlocked. See the
|
// NOTE: This function requires to the wallet to be unlocked. See the
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendToAddressComment(address btcutil.Address, amount btcutil.Amount, comment, commentTo string) (*chainhash.Hash, error) {
|
func (c *Client) SendToAddressComment(address btcutil.Address, amount btcutil.Amount,
|
||||||
return c.SendToAddressCommentAsync(address, amount, comment,
|
addrType *string, comment, commentTo string) (*chainhash.Hash, error) {
|
||||||
commentTo).Receive()
|
return c.SendToAddressCommentAsync(address, amount, addrType,
|
||||||
|
comment, commentTo).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FutureSendFromResult is a future promise to deliver the result of a
|
// FutureSendFromResult is a future promise to deliver the result of a
|
||||||
|
@ -615,10 +618,11 @@ func (r FutureSendFromResult) Receive() (*chainhash.Hash, error) {
|
||||||
// returned instance.
|
// returned instance.
|
||||||
//
|
//
|
||||||
// See SendFrom for the blocking version and more details.
|
// See SendFrom for the blocking version and more details.
|
||||||
func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) FutureSendFromResult {
|
func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address,
|
||||||
|
amount btcutil.Amount, addrType *string) FutureSendFromResult {
|
||||||
addr := toAddress.EncodeAddress()
|
addr := toAddress.EncodeAddress()
|
||||||
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(), nil,
|
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(), nil,
|
||||||
nil, nil)
|
addrType, nil, nil)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,8 +634,8 @@ func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, am
|
||||||
//
|
//
|
||||||
// NOTE: This function requires to the wallet to be unlocked. See the
|
// NOTE: This function requires to the wallet to be unlocked. See the
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) (*chainhash.Hash, error) {
|
func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, addrType *string) (*chainhash.Hash, error) {
|
||||||
return c.SendFromAsync(fromAccount, toAddress, amount).Receive()
|
return c.SendFromAsync(fromAccount, toAddress, amount, addrType).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendFromMinConfAsync returns an instance of a type that can be used to get
|
// SendFromMinConfAsync returns an instance of a type that can be used to get
|
||||||
|
@ -639,10 +643,12 @@ func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount
|
||||||
// the returned instance.
|
// the returned instance.
|
||||||
//
|
//
|
||||||
// See SendFromMinConf for the blocking version and more details.
|
// See SendFromMinConf for the blocking version and more details.
|
||||||
func (c *Client) SendFromMinConfAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) FutureSendFromResult {
|
func (c *Client) SendFromMinConfAsync(fromAccount string,
|
||||||
|
toAddress btcutil.Address, amount btcutil.Amount,
|
||||||
|
minConfirms int, addrType *string) FutureSendFromResult {
|
||||||
addr := toAddress.EncodeAddress()
|
addr := toAddress.EncodeAddress()
|
||||||
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
|
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
|
||||||
&minConfirms, nil, nil)
|
&minConfirms, addrType, nil, nil)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,9 +661,10 @@ func (c *Client) SendFromMinConfAsync(fromAccount string, toAddress btcutil.Addr
|
||||||
//
|
//
|
||||||
// NOTE: This function requires to the wallet to be unlocked. See the
|
// NOTE: This function requires to the wallet to be unlocked. See the
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) (*chainhash.Hash, error) {
|
func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address,
|
||||||
|
amount btcutil.Amount, minConfirms int, addrType *string) (*chainhash.Hash, error) {
|
||||||
return c.SendFromMinConfAsync(fromAccount, toAddress, amount,
|
return c.SendFromMinConfAsync(fromAccount, toAddress, amount,
|
||||||
minConfirms).Receive()
|
minConfirms, addrType).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendFromCommentAsync returns an instance of a type that can be used to get
|
// SendFromCommentAsync returns an instance of a type that can be used to get
|
||||||
|
@ -667,11 +674,11 @@ func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address,
|
||||||
// See SendFromComment for the blocking version and more details.
|
// See SendFromComment for the blocking version and more details.
|
||||||
func (c *Client) SendFromCommentAsync(fromAccount string,
|
func (c *Client) SendFromCommentAsync(fromAccount string,
|
||||||
toAddress btcutil.Address, amount btcutil.Amount, minConfirms int,
|
toAddress btcutil.Address, amount btcutil.Amount, minConfirms int,
|
||||||
comment, commentTo string) FutureSendFromResult {
|
addrType *string, comment, commentTo string) FutureSendFromResult {
|
||||||
|
|
||||||
addr := toAddress.EncodeAddress()
|
addr := toAddress.EncodeAddress()
|
||||||
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
|
cmd := btcjson.NewSendFromCmd(fromAccount, addr, amount.ToBTC(),
|
||||||
&minConfirms, &comment, &commentTo)
|
&minConfirms, addrType, &comment, &commentTo)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,11 +694,11 @@ func (c *Client) SendFromCommentAsync(fromAccount string,
|
||||||
// NOTE: This function requires to the wallet to be unlocked. See the
|
// NOTE: This function requires to the wallet to be unlocked. See the
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendFromComment(fromAccount string, toAddress btcutil.Address,
|
func (c *Client) SendFromComment(fromAccount string, toAddress btcutil.Address,
|
||||||
amount btcutil.Amount, minConfirms int,
|
amount btcutil.Amount, minConfirms int, addrType *string,
|
||||||
comment, commentTo string) (*chainhash.Hash, error) {
|
comment, commentTo string) (*chainhash.Hash, error) {
|
||||||
|
|
||||||
return c.SendFromCommentAsync(fromAccount, toAddress, amount,
|
return c.SendFromCommentAsync(fromAccount, toAddress, amount,
|
||||||
minConfirms, comment, commentTo).Receive()
|
minConfirms, addrType, comment, commentTo).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FutureSendManyResult is a future promise to deliver the result of a
|
// FutureSendManyResult is a future promise to deliver the result of a
|
||||||
|
@ -728,7 +735,7 @@ func (c *Client) SendManyAsync(fromAccount string, amounts map[btcutil.Address]b
|
||||||
for addr, amount := range amounts {
|
for addr, amount := range amounts {
|
||||||
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
||||||
}
|
}
|
||||||
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts, nil, nil)
|
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts, nil, nil, nil)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,14 +758,14 @@ func (c *Client) SendMany(fromAccount string, amounts map[btcutil.Address]btcuti
|
||||||
// See SendManyMinConf for the blocking version and more details.
|
// See SendManyMinConf for the blocking version and more details.
|
||||||
func (c *Client) SendManyMinConfAsync(fromAccount string,
|
func (c *Client) SendManyMinConfAsync(fromAccount string,
|
||||||
amounts map[btcutil.Address]btcutil.Amount,
|
amounts map[btcutil.Address]btcutil.Amount,
|
||||||
minConfirms int) FutureSendManyResult {
|
minConfirms int, addrType *string) FutureSendManyResult {
|
||||||
|
|
||||||
convertedAmounts := make(map[string]float64, len(amounts))
|
convertedAmounts := make(map[string]float64, len(amounts))
|
||||||
for addr, amount := range amounts {
|
for addr, amount := range amounts {
|
||||||
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
||||||
}
|
}
|
||||||
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
|
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
|
||||||
&minConfirms, nil)
|
&minConfirms, nil, addrType)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,9 +780,10 @@ func (c *Client) SendManyMinConfAsync(fromAccount string,
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendManyMinConf(fromAccount string,
|
func (c *Client) SendManyMinConf(fromAccount string,
|
||||||
amounts map[btcutil.Address]btcutil.Amount,
|
amounts map[btcutil.Address]btcutil.Amount,
|
||||||
minConfirms int) (*chainhash.Hash, error) {
|
minConfirms int, addrType *string) (*chainhash.Hash, error) {
|
||||||
|
|
||||||
return c.SendManyMinConfAsync(fromAccount, amounts, minConfirms).Receive()
|
return c.SendManyMinConfAsync(fromAccount, amounts, minConfirms,
|
||||||
|
addrType).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendManyCommentAsync returns an instance of a type that can be used to get
|
// SendManyCommentAsync returns an instance of a type that can be used to get
|
||||||
|
@ -785,14 +793,14 @@ func (c *Client) SendManyMinConf(fromAccount string,
|
||||||
// See SendManyComment for the blocking version and more details.
|
// See SendManyComment for the blocking version and more details.
|
||||||
func (c *Client) SendManyCommentAsync(fromAccount string,
|
func (c *Client) SendManyCommentAsync(fromAccount string,
|
||||||
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
|
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
|
||||||
comment string) FutureSendManyResult {
|
addrType *string, comment string) FutureSendManyResult {
|
||||||
|
|
||||||
convertedAmounts := make(map[string]float64, len(amounts))
|
convertedAmounts := make(map[string]float64, len(amounts))
|
||||||
for addr, amount := range amounts {
|
for addr, amount := range amounts {
|
||||||
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
convertedAmounts[addr.EncodeAddress()] = amount.ToBTC()
|
||||||
}
|
}
|
||||||
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
|
cmd := btcjson.NewSendManyCmd(fromAccount, convertedAmounts,
|
||||||
&minConfirms, &comment)
|
&minConfirms, &comment, addrType)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,10 +816,10 @@ func (c *Client) SendManyCommentAsync(fromAccount string,
|
||||||
// WalletPassphrase function for more details.
|
// WalletPassphrase function for more details.
|
||||||
func (c *Client) SendManyComment(fromAccount string,
|
func (c *Client) SendManyComment(fromAccount string,
|
||||||
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
|
amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
|
||||||
comment string) (*chainhash.Hash, error) {
|
addrType *string, comment string) (*chainhash.Hash, error) {
|
||||||
|
|
||||||
return c.SendManyCommentAsync(fromAccount, amounts, minConfirms,
|
return c.SendManyCommentAsync(fromAccount, amounts, minConfirms,
|
||||||
comment).Receive()
|
addrType, comment).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************
|
// *************************
|
||||||
|
@ -1135,8 +1143,8 @@ func (r FutureGetRawChangeAddressResult) Receive() (btcutil.Address, error) {
|
||||||
// function on the returned instance.
|
// function on the returned instance.
|
||||||
//
|
//
|
||||||
// See GetRawChangeAddress for the blocking version and more details.
|
// See GetRawChangeAddress for the blocking version and more details.
|
||||||
func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddressResult {
|
func (c *Client) GetRawChangeAddressAsync(account *string) FutureGetRawChangeAddressResult {
|
||||||
cmd := btcjson.NewGetRawChangeAddressCmd(&account)
|
cmd := btcjson.NewGetRawChangeAddressCmd(account)
|
||||||
result := FutureGetRawChangeAddressResult{
|
result := FutureGetRawChangeAddressResult{
|
||||||
network: c.chainParams,
|
network: c.chainParams,
|
||||||
responseChannel: c.SendCmd(cmd),
|
responseChannel: c.SendCmd(cmd),
|
||||||
|
@ -1147,7 +1155,7 @@ func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddr
|
||||||
// GetRawChangeAddress returns a new address for receiving change that will be
|
// GetRawChangeAddress returns a new address for receiving change that will be
|
||||||
// associated with the provided account. Note that this is only for raw
|
// associated with the provided account. Note that this is only for raw
|
||||||
// transactions and NOT for normal use.
|
// transactions and NOT for normal use.
|
||||||
func (c *Client) GetRawChangeAddress(account string) (btcutil.Address, error) {
|
func (c *Client) GetRawChangeAddress(account *string) (btcutil.Address, error) {
|
||||||
return c.GetRawChangeAddressAsync(account).Receive()
|
return c.GetRawChangeAddressAsync(account).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1226,7 +1234,7 @@ func (r FutureGetAccountAddressResult) Receive() (btcutil.Address, error) {
|
||||||
// the returned instance.
|
// the returned instance.
|
||||||
//
|
//
|
||||||
// See GetAccountAddress for the blocking version and more details.
|
// See GetAccountAddress for the blocking version and more details.
|
||||||
func (c *Client) GetAccountAddressAsync(account string) FutureGetAccountAddressResult {
|
func (c *Client) GetAccountAddressAsync(account *string) FutureGetAccountAddressResult {
|
||||||
cmd := btcjson.NewGetAccountAddressCmd(account)
|
cmd := btcjson.NewGetAccountAddressCmd(account)
|
||||||
result := FutureGetAccountAddressResult{
|
result := FutureGetAccountAddressResult{
|
||||||
network: c.chainParams,
|
network: c.chainParams,
|
||||||
|
@ -1237,7 +1245,7 @@ func (c *Client) GetAccountAddressAsync(account string) FutureGetAccountAddressR
|
||||||
|
|
||||||
// GetAccountAddress returns the current Bitcoin address for receiving payments
|
// GetAccountAddress returns the current Bitcoin address for receiving payments
|
||||||
// to the specified account.
|
// to the specified account.
|
||||||
func (c *Client) GetAccountAddress(account string) (btcutil.Address, error) {
|
func (c *Client) GetAccountAddress(account *string) (btcutil.Address, error) {
|
||||||
return c.GetAccountAddressAsync(account).Receive()
|
return c.GetAccountAddressAsync(account).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1317,7 +1325,7 @@ func (r FutureGetAddressesByAccountResult) Receive() ([]btcutil.Address, error)
|
||||||
// function on the returned instance.
|
// function on the returned instance.
|
||||||
//
|
//
|
||||||
// See GetAddressesByAccount for the blocking version and more details.
|
// See GetAddressesByAccount for the blocking version and more details.
|
||||||
func (c *Client) GetAddressesByAccountAsync(account string) FutureGetAddressesByAccountResult {
|
func (c *Client) GetAddressesByAccountAsync(account *string) FutureGetAddressesByAccountResult {
|
||||||
cmd := btcjson.NewGetAddressesByAccountCmd(account)
|
cmd := btcjson.NewGetAddressesByAccountCmd(account)
|
||||||
result := FutureGetAddressesByAccountResult{
|
result := FutureGetAddressesByAccountResult{
|
||||||
network: c.chainParams,
|
network: c.chainParams,
|
||||||
|
@ -1328,7 +1336,7 @@ func (c *Client) GetAddressesByAccountAsync(account string) FutureGetAddressesBy
|
||||||
|
|
||||||
// GetAddressesByAccount returns the list of addresses associated with the
|
// GetAddressesByAccount returns the list of addresses associated with the
|
||||||
// passed account.
|
// passed account.
|
||||||
func (c *Client) GetAddressesByAccount(account string) ([]btcutil.Address, error) {
|
func (c *Client) GetAddressesByAccount(account *string) ([]btcutil.Address, error) {
|
||||||
return c.GetAddressesByAccountAsync(account).Receive()
|
return c.GetAddressesByAccountAsync(account).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1709,7 +1717,7 @@ func (r FutureGetReceivedByAccountResult) Receive() (btcutil.Amount, error) {
|
||||||
// function on the returned instance.
|
// function on the returned instance.
|
||||||
//
|
//
|
||||||
// See GetReceivedByAccount for the blocking version and more details.
|
// See GetReceivedByAccount for the blocking version and more details.
|
||||||
func (c *Client) GetReceivedByAccountAsync(account string) FutureGetReceivedByAccountResult {
|
func (c *Client) GetReceivedByAccountAsync(account *string) FutureGetReceivedByAccountResult {
|
||||||
cmd := btcjson.NewGetReceivedByAccountCmd(account, nil)
|
cmd := btcjson.NewGetReceivedByAccountCmd(account, nil)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
@ -1719,7 +1727,7 @@ func (c *Client) GetReceivedByAccountAsync(account string) FutureGetReceivedByAc
|
||||||
//
|
//
|
||||||
// See GetReceivedByAccountMinConf to override the minimum number of
|
// See GetReceivedByAccountMinConf to override the minimum number of
|
||||||
// confirmations.
|
// confirmations.
|
||||||
func (c *Client) GetReceivedByAccount(account string) (btcutil.Amount, error) {
|
func (c *Client) GetReceivedByAccount(account *string) (btcutil.Amount, error) {
|
||||||
return c.GetReceivedByAccountAsync(account).Receive()
|
return c.GetReceivedByAccountAsync(account).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1728,8 +1736,8 @@ func (c *Client) GetReceivedByAccount(account string) (btcutil.Amount, error) {
|
||||||
// function on the returned instance.
|
// function on the returned instance.
|
||||||
//
|
//
|
||||||
// See GetReceivedByAccountMinConf for the blocking version and more details.
|
// See GetReceivedByAccountMinConf for the blocking version and more details.
|
||||||
func (c *Client) GetReceivedByAccountMinConfAsync(account string, minConfirms int) FutureGetReceivedByAccountResult {
|
func (c *Client) GetReceivedByAccountMinConfAsync(account *string, minConfirms *int) FutureGetReceivedByAccountResult {
|
||||||
cmd := btcjson.NewGetReceivedByAccountCmd(account, &minConfirms)
|
cmd := btcjson.NewGetReceivedByAccountCmd(account, minConfirms)
|
||||||
return c.SendCmd(cmd)
|
return c.SendCmd(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1738,7 +1746,7 @@ func (c *Client) GetReceivedByAccountMinConfAsync(account string, minConfirms in
|
||||||
// confirmations.
|
// confirmations.
|
||||||
//
|
//
|
||||||
// See GetReceivedByAccount to use the default minimum number of confirmations.
|
// See GetReceivedByAccount to use the default minimum number of confirmations.
|
||||||
func (c *Client) GetReceivedByAccountMinConf(account string, minConfirms int) (btcutil.Amount, error) {
|
func (c *Client) GetReceivedByAccountMinConf(account *string, minConfirms *int) (btcutil.Amount, error) {
|
||||||
return c.GetReceivedByAccountMinConfAsync(account, minConfirms).Receive()
|
return c.GetReceivedByAccountMinConfAsync(account, minConfirms).Receive()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue