diff --git a/indexer/src/providers/providerStatusProvider.ts b/indexer/src/providers/providerStatusProvider.ts index eeeee1186..55aee95b2 100644 --- a/indexer/src/providers/providerStatusProvider.ts +++ b/indexer/src/providers/providerStatusProvider.ts @@ -34,12 +34,15 @@ export async function syncProvidersInfo() { timeout: StatusCallTimeout }); - const versionStr = semver.valid(versionResponse.data.akash.version); + const akashVersion = semver.valid(versionResponse.data.akash.version); + const cosmosVersion = semver.valid( + "cosmosSdkVersion" in versionResponse.data.akash ? versionResponse.data.akash.cosmosSdkVersion : versionResponse.data.akash.cosmos_sdk_version + ); - if (versionStr && semver.gte(versionStr, "0.5.0-0")) { - await grpcFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout); + if (akashVersion && semver.gte(akashVersion, "0.5.0-0")) { + await grpcFetchAndSaveProviderStats(provider, cosmosVersion, akashVersion, StatusCallTimeout); } else { - await restFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout); + await restFetchAndSaveProviderStats(provider, cosmosVersion, akashVersion, StatusCallTimeout); } } catch (err) { const checkDate = new Date(); @@ -88,17 +91,40 @@ export async function syncProvidersInfo() { console.log("Finished refreshing provider infos"); } -type ProviderVersionEndpointResponseType = { - akash: { version: string; commit: string; buildTags: string; go: string; cosmosSdkVersion: string }; - kube: { - major: string; - minor: string; - gitVersion: string; - gitCommit: string; - gitTreeState: string; - buildDate: string; - goVersion: string; - compiler: string; - platform: string; - }; -}; +type ProviderVersionEndpointResponseType = + | { + akash: { version: string; commit: string; buildTags: string; go: string; cosmosSdkVersion: string }; + kube: { + major: string; + minor: string; + gitVersion: string; + gitCommit: string; + gitTreeState: string; + buildDate: string; + goVersion: string; + compiler: string; + platform: string; + }; + } + | { + akash: { + name: string; + server_name: string; + version: string; + commit: string; + build_tags: string; + go: string; + cosmos_sdk_version: string; + }; + kube: { + major: string; + minor: string; + gitVersion: string; + gitCommit: string; + gitTreeState: string; + buildDate: string; + goVersion: string; + compiler: string; + platform: string; + }; + };