From bc7bf8a83c5376155d62cf08a5b20c2d95a38eee Mon Sep 17 00:00:00 2001 From: AtHeartEngineer Date: Tue, 15 Aug 2023 21:51:53 -0400 Subject: [PATCH] refactored serverI and made genId more friendly --- package.json | 2 +- src/index.ts | 10 ++++------ src/utils.ts | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 5429503..ce78b20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discreetly-interfaces", - "version": "0.1.32", + "version": "0.1.33", "description": "Common interfaces and utilities for discreetly", "author": "AtHeartEngineer", "homepage": "https://github.com/Discreetly", diff --git a/src/index.ts b/src/index.ts index eefe128..1da2a7e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -45,11 +45,9 @@ export interface RoomI { } export interface ServerI { - id: bigint | string; - name: string; + id?: bigint | string; + name?: string; version?: string; - serverInfoEndpoint?: string; - messageHandlerSocket?: string; // Default port for websocket connections - rooms?: RoomI[]; - selectedRoom?: RoomI['roomId']; + url?: string; + rooms?: string[]; } diff --git a/src/utils.ts b/src/utils.ts index f292fef..0d486ce 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -8,9 +8,9 @@ export function str2BigInt(str: string) { return BigInt(num); } -export function genId(serverID: bigint, roomName: string | bigint | number) { +export function genId(serverID: string | bigint | number, roomName: string | bigint | number) { if (typeof roomName === 'string') { - return poseidon2([serverID, str2BigInt(roomName)]); + return poseidon2([BigInt(serverID), str2BigInt(roomName)]); } return poseidon2([serverID, BigInt(roomName)]); }