Improve args passing to SDK for WalletCreate command
This commit is contained in:
parent
d5102a9cf6
commit
534831e6e5
1 changed files with 10 additions and 10 deletions
|
@ -603,9 +603,14 @@ func (d *Client) AccountAdd(accountName string, seed *string, privateKey *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type WalletCreateOpts struct {
|
type WalletCreateOpts struct {
|
||||||
SkipOnStartup bool
|
SkipOnStartup bool `json:"skip_on_startup,omitempty"`
|
||||||
CreateAccount bool
|
CreateAccount bool `json:"create_account,omitempty"`
|
||||||
SingleKey bool
|
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) {
|
||||||
|
@ -613,13 +618,8 @@ func (d *Client) WalletCreate(id string, opts *WalletCreateOpts) (*Wallet, error
|
||||||
if opts == nil {
|
if opts == nil {
|
||||||
opts = &WalletCreateOpts{}
|
opts = &WalletCreateOpts{}
|
||||||
}
|
}
|
||||||
params := map[string]interface{}{
|
args := WalletCreateArgs{ID: id, WalletCreateOpts: *opts}
|
||||||
"wallet_id": id,
|
return response, d.call(response, "wallet_create", structs.Map(args))
|
||||||
"skip_on_startup": opts.SkipOnStartup,
|
|
||||||
"create_account": opts.CreateAccount,
|
|
||||||
"single_key": opts.SingleKey,
|
|
||||||
}
|
|
||||||
return response, d.call(response, "wallet_create", params)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Client) WalletAdd(id string) (*Wallet, error) {
|
func (d *Client) WalletAdd(id string) (*Wallet, error) {
|
||||||
|
|
Loading…
Reference in a new issue