Skip to content

Commit

Permalink
Merge pull request #104 from Jeiwan/get_currency_stats
Browse files Browse the repository at this point in the history
Add support for 'chain/get_currency_stats' API endpoint
  • Loading branch information
billettc authored Jan 8, 2019
2 parents 638ba4b + 1d94523 commit 5119b9e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,16 @@ func (api *API) GetCurrencyBalance(account AccountName, symbol string, code Acco
return
}

func (api *API) GetCurrencyStats(code AccountName, symbol string) (out *GetCurrencyStatsResp, err error) {
params := M{"code": code, "symbol": symbol}

outWrapper := make(map[string]*GetCurrencyStatsResp)
err = api.call("chain", "get_currency_stats", params, &outWrapper)
out = outWrapper[symbol]

return
}

// See more here: libraries/chain/contracts/abi_serializer.cpp:58...

func (api *API) call(baseAPI string, endpoint string, body interface{}, out interface{}) error {
Expand Down
6 changes: 6 additions & 0 deletions responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,9 @@ type ActionsResp struct {
Actions []ActionResp `json:"actions"`
LastIrreversibleBlock uint32 `json:"last_irreversible_block"`
}

type GetCurrencyStatsResp struct {
Supply Asset `json:"supply"`
MaxSupply Asset `json:"max_supply"`
Issuer AccountName `json:"issuer"`
}

0 comments on commit 5119b9e

Please sign in to comment.