Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Sep 5, 2024
1 parent 9adc159 commit 403179f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/protocol-parser/src/getKeySchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { StaticAbiType, Table } from "@latticexyz/config";

type PartialTable = Pick<Table, "schema" | "key">;

type KeySchema = {
export type KeySchema = {
readonly [fieldName: string]: {
/** the Solidity primitive ABI type */
readonly type: StaticAbiType;
Expand Down
6 changes: 3 additions & 3 deletions packages/store-sync/src/dozer/decodeRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -20,12 +20,12 @@ function trimHeader(result: DozerQueryResult): DozerQueryRecord[] {
return result.slice(1);
}

export type DecodeDozerRecordsResult<schema extends Schema = Schema> = getSchemaPrimitives<schema>[];
export type DecodeRecordsResult<schema extends Schema = Schema> = getSchemaPrimitives<schema>[];

export function decodeRecords<schema extends Schema>({
schema,
records,
}: DecodeDozerRecordsArgs): DecodeDozerRecordsResult<schema> {
}: DecodeRecordsArgs): DecodeRecordsResult<schema> {
const fieldNames = Object.keys(schema);
if (records.length > 0 && fieldNames.length !== records[0].length) {
throw new Error(
Expand Down
4 changes: 2 additions & 2 deletions packages/store-sync/src/dozer/fetchRecords.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -26,7 +26,7 @@ type FetchRecordsResult = {
blockHeight: bigint;
result: {
table: Table;
records: DecodeDozerRecordsResult;
records: DecodeRecordsResult;
}[];
};

Expand Down

0 comments on commit 403179f

Please sign in to comment.