diff --git a/src/Client.js b/src/Client.js index afd60ba..00f5e12 100644 --- a/src/Client.js +++ b/src/Client.js @@ -10,10 +10,20 @@ import { KeepAlive } from './Protocol.js' import { EventEmitter } from 'events' +import Long from 'long' const WebSocket = (typeof window === 'undefined' ? import('ws'): window.WebSocket) export class Client extends EventEmitter { + static formatAddress(address) { + const int = BigInt(address) + return int.toString(16).padStart(16, '0').match(/.{1,4}/g).join(':') + } + + static decodeAddress(address) { + return Long.fromString(BigInt('0x' + address.replace(/:/g, '')).toString(10)) + } + #gateway #ws #id diff --git a/src/index.js b/src/index.js index def7557..51e37f8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,2 @@ -import Long from 'long' import { Client } from './Client.js' - -export function formatAddress(address) { - const int = BigInt(address) - return int.toString(16).padStart(16, '0').match(/.{1,4}/g).join(':') -} - -export function decodeAddress(address) { - return Long.fromString(BigInt('0x' + address.replace(/:/g, '')).toString(10)) -} - export { Client }