-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from informalsystems/mc-vesting-balances
vesting accounts and bug fixes
- Loading branch information
Showing
17 changed files
with
498 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package api | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
"net/http" | ||
|
||
"github.com/informalsystems/stakooler/client/cosmos/model" | ||
) | ||
|
||
func GetAuth(account *model.Account) (model.AuthResponse, error) { | ||
var authResponse model.AuthResponse | ||
|
||
url := account.Chain.LCD + "/cosmos/auth/v1beta1/accounts/" + account.Address | ||
method := "GET" | ||
|
||
client := &http.Client{} | ||
req, err := http.NewRequest(method, url, nil) | ||
|
||
if err != nil { | ||
fmt.Println(err) | ||
return authResponse, err | ||
} | ||
res, err := client.Do(req) | ||
if err != nil { | ||
fmt.Println(err) | ||
return authResponse, err | ||
} | ||
defer res.Body.Close() | ||
|
||
body, err := io.ReadAll(res.Body) | ||
if err != nil { | ||
fmt.Println(err) | ||
return authResponse, err | ||
} | ||
err = json.Unmarshal(body, &authResponse) | ||
if err != nil { | ||
fmt.Println(err) | ||
return authResponse, err | ||
} | ||
return authResponse, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package model | ||
|
||
type BalancesResponse struct { | ||
Balances []struct { | ||
Denom string `json:"denom"` | ||
Amount string `json:"amount"` | ||
} `json:"balances"` | ||
Pagination struct { | ||
NextKey interface{} `json:"next_key"` | ||
Total string `json:"total"` | ||
} `json:"pagination"` | ||
} | ||
|
||
type DenomMetadataResponse struct { | ||
Metadata struct { | ||
Description string `json:"description"` | ||
DenomUnits []struct { | ||
Denom string `json:"denom"` | ||
Exponent int `json:"exponent"` | ||
Aliases []string `json:"aliases"` | ||
} `json:"denom_units"` | ||
Base string `json:"base"` | ||
Display string `json:"display"` | ||
} `json:"metadata"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.