Skip to content

Commit 04dd07c

Browse files
authored
fix(api): resolve app state retrieval issue (#901)
* fix(api): retrieve blob storage state if it exists * chore: add changesets
1 parent 4a98059 commit 04dd07c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.changeset/curvy-vans-share.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@blobscan/api": patch
3+
---
4+
5+
Resolved an issue where the app state wasn't being returned if the blob storage state is absent

packages/api/src/routers/state/getAppState.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ type StateQuery = {
88
lastFinalizedBlock: number;
99
lastLowerSyncedSlot: number;
1010
lastUpperSyncedSlot: number;
11-
swarmDataId: number;
12-
swarmDataTTL: number;
11+
swarmDataId?: number;
12+
swarmDataTTL?: number;
1313
}[];
1414

1515
type BlocksQuery = {
@@ -32,7 +32,7 @@ export const getAppState = publicProcedure.query(
3232
st.last_upper_synced_slot AS "lastUpperSyncedSlot",
3333
bs.swarm_data_id AS "swarmDataId",
3434
bs.swarm_data_ttl AS "swarmDataTTL"
35-
FROM blockchain_sync_state st JOIN blob_storages_state bs ON st.id = bs.id
35+
FROM blockchain_sync_state st LEFT JOIN blob_storages_state bs ON st.id = bs.id
3636
WHERE st.id = 1;
3737
`,
3838
prisma.$queryRaw<BlocksQuery>`

0 commit comments

Comments
 (0)