diff --git a/cmd/api/docs/docs.go b/cmd/api/docs/docs.go index 771f8ab..7b217a4 100644 --- a/cmd/api/docs/docs.go +++ b/cmd/api/docs/docs.go @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: 2024 PK Lab AG -// SPDX-License-Identifier: MIT - // Package docs Code generated by swaggo/swag. DO NOT EDIT package docs @@ -2486,6 +2483,11 @@ const docTemplate = `{ "responses.State": { "type": "object", "properties": { + "chain_id": { + "type": "string", + "format": "string", + "example": "astria-dusk-7" + }, "hash": { "type": "string", "format": "string", diff --git a/cmd/api/docs/swagger.json b/cmd/api/docs/swagger.json index f6d12c8..9ff807a 100644 --- a/cmd/api/docs/swagger.json +++ b/cmd/api/docs/swagger.json @@ -2476,6 +2476,11 @@ "responses.State": { "type": "object", "properties": { + "chain_id": { + "type": "string", + "format": "string", + "example": "astria-dusk-7" + }, "hash": { "type": "string", "format": "string", diff --git a/cmd/api/docs/swagger.yaml b/cmd/api/docs/swagger.yaml index f84db05..7397d2d 100644 --- a/cmd/api/docs/swagger.yaml +++ b/cmd/api/docs/swagger.yaml @@ -324,6 +324,10 @@ definitions: type: object responses.State: properties: + chain_id: + example: astria-dusk-7 + format: string + type: string hash: example: 652452A670018D629CC116E510BA88C1CABE061336661B1F3D206D248BD558AF format: string diff --git a/cmd/api/handler/responses/state.go b/cmd/api/handler/responses/state.go index 2ef74d5..e5e51cf 100644 --- a/cmd/api/handler/responses/state.go +++ b/cmd/api/handler/responses/state.go @@ -15,6 +15,7 @@ import ( type State struct { Id uint64 `example:"321" format:"int64" json:"id" swaggertype:"integer"` Name string `example:"indexer" format:"string" json:"name" swaggertype:"string"` + ChainID string `example:"astria-dusk-7" format:"string" json:"chain_id" swaggertype:"string"` LastHeight pkgTypes.Level `example:"100" format:"int64" json:"last_height" swaggertype:"integer"` LastHash string `example:"652452A670018D629CC116E510BA88C1CABE061336661B1F3D206D248BD558AF" format:"string" json:"hash" swaggertype:"string"` LastTime time.Time `example:"2023-07-04T03:10:57+00:00" format:"date-time" json:"last_time" swaggertype:"string"` @@ -30,6 +31,7 @@ func NewState(state storage.State) State { return State{ Id: state.Id, Name: state.Name, + ChainID: state.ChainId, LastHeight: state.LastHeight, LastHash: hex.EncodeToString(state.LastHash), LastTime: state.LastTime, diff --git a/cmd/api/handler/state_test.go b/cmd/api/handler/state_test.go index 7b468cc..4e372c7 100644 --- a/cmd/api/handler/state_test.go +++ b/cmd/api/handler/state_test.go @@ -26,6 +26,7 @@ var ( testState = storage.State{ Id: 1, Name: "test", + ChainId: "chain-id", LastHeight: 100, LastTime: testTime, TotalTx: 1234, @@ -83,6 +84,7 @@ func (s *StateTestSuite) TestHead() { s.Require().NoError(err) s.Require().EqualValues(1, state.Id) s.Require().EqualValues("test", state.Name) + s.Require().EqualValues("chain-id", state.ChainID) s.Require().EqualValues(100, state.LastHeight) s.Require().EqualValues(1234, state.TotalTx) s.Require().EqualValues(123, state.TotalAccounts)