From 403179f6c0f90899736120a0a9c76fec1f7276dd Mon Sep 17 00:00:00 2001 From: alvrs Date: Thu, 5 Sep 2024 13:20:40 +0000 Subject: [PATCH] review fixes --- packages/protocol-parser/src/getKeySchema.ts | 2 +- packages/store-sync/src/dozer/decodeRecords.ts | 6 +++--- packages/store-sync/src/dozer/fetchRecords.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/protocol-parser/src/getKeySchema.ts b/packages/protocol-parser/src/getKeySchema.ts index 9023a14aa6..857ba2e04f 100644 --- a/packages/protocol-parser/src/getKeySchema.ts +++ b/packages/protocol-parser/src/getKeySchema.ts @@ -2,7 +2,7 @@ import { StaticAbiType, Table } from "@latticexyz/config"; type PartialTable = Pick; -type KeySchema = { +export type KeySchema = { readonly [fieldName: string]: { /** the Solidity primitive ABI type */ readonly type: StaticAbiType; diff --git a/packages/store-sync/src/dozer/decodeRecords.ts b/packages/store-sync/src/dozer/decodeRecords.ts index ef1120035b..17c829ddb0 100644 --- a/packages/store-sync/src/dozer/decodeRecords.ts +++ b/packages/store-sync/src/dozer/decodeRecords.ts @@ -8,7 +8,7 @@ type DozerQueryRecord = (string | boolean | string[])[]; // First item in the result is the header export type DozerQueryResult = [DozerQueryHeader, ...DozerQueryRecord[]]; -export type DecodeDozerRecordsArgs = { +export type DecodeRecordsArgs = { schema: Schema; records: DozerQueryResult; }; @@ -20,12 +20,12 @@ function trimHeader(result: DozerQueryResult): DozerQueryRecord[] { return result.slice(1); } -export type DecodeDozerRecordsResult = getSchemaPrimitives[]; +export type DecodeRecordsResult = getSchemaPrimitives[]; export function decodeRecords({ schema, records, -}: DecodeDozerRecordsArgs): DecodeDozerRecordsResult { +}: DecodeRecordsArgs): DecodeRecordsResult { const fieldNames = Object.keys(schema); if (records.length > 0 && fieldNames.length !== records[0].length) { throw new Error( diff --git a/packages/store-sync/src/dozer/fetchRecords.ts b/packages/store-sync/src/dozer/fetchRecords.ts index a7239697c3..caa049c8e5 100644 --- a/packages/store-sync/src/dozer/fetchRecords.ts +++ b/packages/store-sync/src/dozer/fetchRecords.ts @@ -1,4 +1,4 @@ -import { DecodeDozerRecordsResult, DozerQueryResult, decodeRecords } from "./decodeRecords"; +import { DecodeRecordsResult, DozerQueryResult, decodeRecords } from "./decodeRecords"; import { Hex } from "viem"; import { TableQuery } from "./common"; import { Table } from "@latticexyz/config"; @@ -26,7 +26,7 @@ type FetchRecordsResult = { blockHeight: bigint; result: { table: Table; - records: DecodeDozerRecordsResult; + records: DecodeRecordsResult; }[]; };