From b0b9e1e46b641bec3e4f5b54293fbba1a2c2f492 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Wed, 28 Sep 2022 13:53:47 +1000 Subject: [PATCH] refactor: use standard JS lib --- src/epoch.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/epoch.ts b/src/epoch.ts index b87c975..8a7934f 100644 --- a/src/epoch.ts +++ b/src/epoch.ts @@ -1,5 +1,3 @@ -import { writeUIntLE } from "./byte_utils.js"; - const DefaultEpochUnitSeconds = 10; // the rln-relay epoch length in seconds export function dateToEpoch( @@ -11,7 +9,10 @@ export function dateToEpoch( } export function epochIntToBytes(epoch: number): Uint8Array { - return writeUIntLE(new Uint8Array(32), epoch, 0, 8); + const bytes = new Uint8Array(32); + const db = new DataView(bytes.buffer); + db.setUint32(0, epoch, true); + return bytes; } export function epochBytesToInt(bytes: Uint8Array): number {