Cleanup accounts jsonrpc code

This commit is contained in:
Andrey Beletsky 2019-05-24 21:52:04 +07:00
parent 630260d0b1
commit 818b00190d
2 changed files with 11 additions and 15 deletions

View file

@ -182,15 +182,10 @@ func (d *Client) AccountFund(fromAccount string, toAccount string, amount string
func (d *Client) AccountCreate(accountName string, singleKey bool) (*AccountCreateResponse, error) { func (d *Client) AccountCreate(accountName string, singleKey bool) (*AccountCreateResponse, error) {
response := new(AccountCreateResponse) response := new(AccountCreateResponse)
args := struct { return response, d.call(response, "account_create", map[string]interface{}{
AccountName string `json:"account_name"` "account_name": accountName,
SingleKey bool `json:"single_key"` "single_key": singleKey,
}{ })
AccountName: accountName,
SingleKey: singleKey,
}
structs.DefaultTagName = "json"
return response, d.call(response, "account_create", structs.Map(args))
} }
func (d *Client) AccountRemove(accountID string) (*AccountRemoveResponse, error) { func (d *Client) AccountRemove(accountID string) (*AccountRemoveResponse, error) {

View file

@ -213,12 +213,13 @@ type AccountListResponse struct {
type AccountBalanceResponse string type AccountBalanceResponse string
type AccountCreateResponse struct { type AccountCreateResponse struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
PublicKey string `json:"public_key"` PublicKey string `json:"public_key"`
PrivateKey string `json:"private_key"` PrivateKey string `json:"private_key"`
Seed string `json:"seed"` Seed string `json:"seed"`
Ledger string `json:"ledger"` Ledger string `json:"ledger"`
ModifiedOn float64 `json:"modified_on"`
} }
type AccountRemoveResponse AccountCreateResponse type AccountRemoveResponse AccountCreateResponse