From d55b923e3a49c02f13895b4732d0cce347175bde Mon Sep 17 00:00:00 2001 From: katspaugh Date: Thu, 26 Sep 2024 15:42:37 +0200 Subject: [PATCH] Feat: chain indexing status --- package.json | 2 +- src/index.ts | 6 ++++++ src/types/api.ts | 23 ++++++++++++++++++++++- src/types/chains.ts | 5 +++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5083fa45..c2541241 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@safe-global/safe-gateway-typescript-sdk", - "version": "3.22.2", + "version": "3.22.3-beta.13", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ diff --git a/src/index.ts b/src/index.ts index 014cac74..1ea2a574 100644 --- a/src/index.ts +++ b/src/index.ts @@ -696,4 +696,10 @@ export function putAccountDataSettings( }) } +export function getIndexingStatus(chainId: string) { + return getEndpoint(baseUrl, '/v1/chains/{chainId}/about/indexing', { + path: { chainId }, + }) +} + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ diff --git a/src/types/api.ts b/src/types/api.ts index efef7d95..a7b9f3c8 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -18,7 +18,7 @@ import type { NoncesResponse, } from './transactions' import type { SafeInfo, SafeOverview } from './safe-info' -import type { ChainListResponse, ChainInfo } from './chains' +import type { ChainListResponse, ChainInfo, ChainIndexingStatus } from './chains' import type { SafeAppsResponse } from './safe-apps' import type { AnyConfirmationView, DecodedDataRequest, DecodedDataResponse } from './decoded-data' import type { MasterCopyReponse } from './master-copies' @@ -429,6 +429,14 @@ export interface paths extends PathRegistry { } } } + '/v1/chains/{chainId}/about/indexing': { + get: operations['get_indexing'] + parameters: { + path: { + chainId: string + } + } + } '/v1/subscriptions': { delete: operations['unsubscribe_single'] parameters: { @@ -1180,6 +1188,19 @@ export interface operations { } } } + get_indexing: { + parameters: { + path: { + chainId: string + } + } + + responses: { + 200: { + schema: ChainIndexingStatus + } + } + } unsubscribe_single: { parameters: { query: { diff --git a/src/types/chains.ts b/src/types/chains.ts index 2d451878..bd962dc6 100644 --- a/src/types/chains.ts +++ b/src/types/chains.ts @@ -109,3 +109,8 @@ export type ChainInfo = { } export type ChainListResponse = Page + +export type ChainIndexingStatus = { + lastSync: number + synced: boolean +}