Add wallet commands to JSON-RPC client #73

Merged
anbsky merged 8 commits from feature/wallet into master 2019-10-08 08:08:57 +02:00
Showing only changes of commit 49c9531404 - Show all commits

View file

@ -603,23 +603,20 @@ func (d *Client) AccountAdd(accountName string, seed *string, privateKey *string
} }
type WalletCreateOpts struct { type WalletCreateOpts struct {
ID string `json:"wallet_id"`
SkipOnStartup bool `json:"skip_on_startup,omitempty"` SkipOnStartup bool `json:"skip_on_startup,omitempty"`
CreateAccount bool `json:"create_account,omitempty"` CreateAccount bool `json:"create_account,omitempty"`
SingleKey bool `json:"single_key,omitempty"` SingleKey bool `json:"single_key,omitempty"`
} }
type WalletCreateArgs struct {
WalletCreateOpts
ID string `json:"wallet_id"`
}
func (d *Client) WalletCreate(id string, opts *WalletCreateOpts) (*Wallet, error) { func (d *Client) WalletCreate(id string, opts *WalletCreateOpts) (*Wallet, error) {
response := new(Wallet) response := new(Wallet)
if opts == nil { if opts == nil {
opts = &WalletCreateOpts{} opts = &WalletCreateOpts{}
} }
args := WalletCreateArgs{ID: id, WalletCreateOpts: *opts} opts.ID = id
return response, d.call(response, "wallet_create", structs.Map(args)) structs.DefaultTagName = "json"
return response, d.call(response, "wallet_create", structs.Map(opts))
} }
func (d *Client) WalletAdd(id string) (*Wallet, error) { func (d *Client) WalletAdd(id string) (*Wallet, error) {