Skip to content

Commit

Permalink
use RedisStreamId type instead of string
Browse files Browse the repository at this point in the history
  • Loading branch information
Sladuca committed Sep 2, 2023
1 parent 70f7119 commit 5baf719
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions actors/insertion-writer/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { SubgraphUtils } from "@nocturne-xyz/core";
import { RedisStreamId } from "@nocturne-xyz/persistent-log";

const { makeSubgraphQuery } = SubgraphUtils;

export function merkleIndexToRedisStreamId(merkleIndex: number): string {
export function merkleIndexToRedisStreamId(merkleIndex: number): RedisStreamId {
return `${merkleIndex}-1`;
}

export function merkleIndexFromRedisStreamId(id: string): number {
export function merkleIndexFromRedisStreamId(id: RedisStreamId): number {
const components = id.split("-");
if (!components || components.length !== 2) {
throw new Error("invalid id");
Expand Down

0 comments on commit 5baf719

Please sign in to comment.