mirror of
https://github.com/Discreetly/interfaces.git
synced 2026-01-09 12:57:58 -05:00
refactored serverI and made genId more friendly
This commit is contained in:
@@ -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",
|
||||
|
||||
10
src/index.ts
10
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[];
|
||||
}
|
||||
|
||||
@@ -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)]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user