Skip to content

Commit

Permalink
Feature: add namespaces count to head (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Feb 13, 2025
1 parent 50ddf64 commit 7a5a88a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
29 changes: 22 additions & 7 deletions cmd/api/docs/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cmd/api/handler/responses/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type State struct {
TotalSupply string `example:"312" format:"string" json:"total_supply" swaggertype:"string"`
TotalStake string `example:"312" format:"string" json:"total_stake" swaggertype:"string"`
TotalVotingPower string `example:"312" format:"string" json:"total_voting_power" swaggertype:"string"`
TotalNamespaces int64 `example:"312" format:"string" json:"total_namespaces" swaggertype:"integer"`
Synced bool `example:"true" format:"boolean" json:"synced" swaggertype:"boolean"`
}

Expand All @@ -43,6 +44,7 @@ func NewState(state storage.State) State {
TotalFee: state.TotalFee.String(),
TotalBlobsSize: state.TotalBlobsSize,
TotalValidators: state.TotalValidators,
TotalNamespaces: state.TotalNamespaces,
TotalSupply: state.TotalSupply.String(),
TotalStake: state.TotalStake.String(),
TotalVotingPower: state.TotalVotingPower.String(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/api/handler/rollup.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ type rollupAllSeriesRequest struct {
// @ID get-rollup-all-series
// @Param timeframe path string true "Timeframe" Enums(hour, day, month)
// @Produce json
// @Success 200 {array} RollupAllSeriesResponse
// @Success 200 {array} responses.RollupAllSeriesResponse
// @Failure 400 {object} Error
// @Failure 500 {object} Error
// @Router /rollup/stats/series/{timeframe} [get]
Expand Down
2 changes: 2 additions & 0 deletions cmd/api/handler/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (s *StateTestSuite) TestHead() {
TotalBlobsSize: 30,
TotalValidators: 10,
TotalStake: decimal.NewFromInt(100),
TotalNamespaces: 100,
}, nil).
Times(1)

Expand All @@ -91,6 +92,7 @@ func (s *StateTestSuite) TestHead() {
s.Require().Equal("2", state.TotalFee)
s.Require().EqualValues(30, state.TotalBlobsSize)
s.Require().EqualValues(10, state.TotalValidators)
s.Require().EqualValues(100, state.TotalNamespaces)
s.Require().Equal(testTime, state.LastTime)
s.Require().Equal("100", state.TotalVotingPower)
s.Require().Equal("100", state.TotalStake)
Expand Down

0 comments on commit 7a5a88a

Please sign in to comment.