Add AccountCreate method
This commit is contained in:
parent
6f0d34f863
commit
5f847fb035
3 changed files with 25 additions and 0 deletions
|
@ -162,6 +162,14 @@ func (d *Client) AccountFund(fromAccount string, toAccount string, amount string
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Client) AccountCreate(accountName string, singleKey bool) (*AccountCreateResponse, error) {
|
||||||
|
response := new(AccountCreateResponse)
|
||||||
|
return response, d.call(response, "account_create", map[string]interface{}{
|
||||||
|
"account_name": accountName,
|
||||||
|
"single_key": singleKey,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Client) AddressUnused(account *string) (*AddressUnusedResponse, error) {
|
func (d *Client) AddressUnused(account *string) (*AddressUnusedResponse, error) {
|
||||||
response := new(AddressUnusedResponse)
|
response := new(AddressUnusedResponse)
|
||||||
return response, d.call(response, "address_unused", map[string]interface{}{
|
return response, d.call(response, "address_unused", map[string]interface{}{
|
||||||
|
|
|
@ -216,3 +216,14 @@ func TestClient_AccountFund(t *testing.T) {
|
||||||
}
|
}
|
||||||
log.Infof("%+v", *got)
|
log.Infof("%+v", *got)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestClient_AccountCreate(t *testing.T) {
|
||||||
|
d := NewClient("")
|
||||||
|
account, err := d.AccountCreate("test@lbry.com", false)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
if account.Status != "created" {
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -200,6 +200,12 @@ type AccountListResponse struct {
|
||||||
}
|
}
|
||||||
type AccountBalanceResponse string
|
type AccountBalanceResponse string
|
||||||
|
|
||||||
|
type AccountCreateResponse struct {
|
||||||
|
Account
|
||||||
|
Seed string `json:"seed"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
type Transaction struct {
|
type Transaction struct {
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Amount string `json:"amount"`
|
Amount string `json:"amount"`
|
||||||
|
|
Loading…
Reference in a new issue