diff --git a/cmd/api/docs/docs.go b/cmd/api/docs/docs.go index 072be929..5d68b483 100644 --- a/cmd/api/docs/docs.go +++ b/cmd/api/docs/docs.go @@ -1,6 +1,3 @@ -// SPDX-FileCopyrightText: 2023 PK Lab AG -// SPDX-License-Identifier: MIT - // Package docs Code generated by swaggo/swag. DO NOT EDIT package docs @@ -2423,6 +2420,11 @@ const docTemplate = `{ "format": "string", "example": "indexer" }, + "synced": { + "type": "boolean", + "format": "boolean", + "example": true + }, "total_accounts": { "type": "integer", "format": "int64", diff --git a/cmd/api/docs/swagger.json b/cmd/api/docs/swagger.json index 48361a65..89ada16d 100644 --- a/cmd/api/docs/swagger.json +++ b/cmd/api/docs/swagger.json @@ -2413,6 +2413,11 @@ "format": "string", "example": "indexer" }, + "synced": { + "type": "boolean", + "format": "boolean", + "example": true + }, "total_accounts": { "type": "integer", "format": "int64", diff --git a/cmd/api/docs/swagger.yaml b/cmd/api/docs/swagger.yaml index 46cab514..818759b0 100644 --- a/cmd/api/docs/swagger.yaml +++ b/cmd/api/docs/swagger.yaml @@ -400,6 +400,10 @@ definitions: example: indexer format: string type: string + synced: + example: true + format: boolean + type: boolean total_accounts: example: 43 format: int64 diff --git a/cmd/api/handler/responses/state.go b/cmd/api/handler/responses/state.go index 7b7afa1d..069cd31a 100644 --- a/cmd/api/handler/responses/state.go +++ b/cmd/api/handler/responses/state.go @@ -5,9 +5,10 @@ package responses import ( "encoding/hex" - pkgTypes "github.com/celenium-io/celestia-indexer/pkg/types" "time" + pkgTypes "github.com/celenium-io/celestia-indexer/pkg/types" + "github.com/celenium-io/celestia-indexer/internal/storage" ) @@ -22,6 +23,7 @@ type State struct { TotalFee string `example:"312" format:"string" json:"total_fee" swaggertype:"string"` TotalBlobsSize int64 `example:"56789" format:"int64" json:"total_blobs_size" swaggertype:"integer"` TotalSupply string `example:"312" format:"string" json:"total_supply" swaggertype:"string"` + Synced bool `example:"true" format:"boolean" json:"synced" swaggertype:"boolean"` } func NewState(state storage.State) State { @@ -36,5 +38,6 @@ func NewState(state storage.State) State { TotalFee: state.TotalFee.String(), TotalBlobsSize: state.TotalBlobsSize, TotalSupply: state.TotalSupply.String(), + Synced: !state.LastTime.UTC().Add(2 * time.Minute).Before(time.Now().UTC()), } }