package heliumapi import ( "encoding/json" "fmt" ) type Account struct { Data struct { Address string `json:"address"` Balance int `json:"balance"` Block int `json:"block"` DCBalance int `json:"dc_balance"` DCNonce int `json:"dc_nonce"` SECBalance int `json:"sec_balance"` SECNonce int `json:"sec_nonce"` SpeculativeNonce int `json:"speculative_nonce"` } `json:"data"` } func GetAccountForAddress(account string) (*Account, error) { path := "/v1/accounts/" + account // query the api respBody, err := getHeliumApi(path, nil) if err != nil { return nil, err } // unmarshal the response respobject := Account{} err = json.Unmarshal(respBody, &respobject) if err != nil { return nil, fmt.Errorf("failed to unmarshal response from path %v: %v", path, err) } return &respobject, nil }