From 49c9531404712fa58bce5c213393694550a0bfca Mon Sep 17 00:00:00 2001 From: Andrey Beletsky Date: Wed, 2 Oct 2019 14:56:37 +0700 Subject: [PATCH] Fix wallet opts passing --- extras/jsonrpc/daemon.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/extras/jsonrpc/daemon.go b/extras/jsonrpc/daemon.go index 1b3ebd7..d506156 100644 --- a/extras/jsonrpc/daemon.go +++ b/extras/jsonrpc/daemon.go @@ -603,14 +603,10 @@ func (d *Client) AccountAdd(accountName string, seed *string, privateKey *string } type WalletCreateOpts struct { - SkipOnStartup bool `json:"skip_on_startup,omitempty"` - CreateAccount bool `json:"create_account,omitempty"` - SingleKey bool `json:"single_key,omitempty"` -} - -type WalletCreateArgs struct { - WalletCreateOpts - ID string `json:"wallet_id"` + ID string `json:"wallet_id"` + SkipOnStartup bool `json:"skip_on_startup,omitempty"` + CreateAccount bool `json:"create_account,omitempty"` + SingleKey bool `json:"single_key,omitempty"` } func (d *Client) WalletCreate(id string, opts *WalletCreateOpts) (*Wallet, error) { @@ -618,8 +614,9 @@ func (d *Client) WalletCreate(id string, opts *WalletCreateOpts) (*Wallet, error if opts == nil { opts = &WalletCreateOpts{} } - args := WalletCreateArgs{ID: id, WalletCreateOpts: *opts} - return response, d.call(response, "wallet_create", structs.Map(args)) + opts.ID = id + structs.DefaultTagName = "json" + return response, d.call(response, "wallet_create", structs.Map(opts)) } func (d *Client) WalletAdd(id string) (*Wallet, error) {