tidying ws client
This commit is contained in:
@@ -8,6 +8,7 @@ export enum WsConnectionStateEnum {
|
||||
CONNECTED = 2,
|
||||
CLOSING = 3,
|
||||
RECONNECTING = 4,
|
||||
// ERROR = 5,
|
||||
}
|
||||
/** A "topic" is always a string */
|
||||
type WsTopic = string;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createHmac } from 'crypto';
|
||||
|
||||
/** This is async because the browser version uses a promise (browser-support) */
|
||||
export async function signMessage(
|
||||
message: string,
|
||||
secret: string
|
||||
|
||||
@@ -6,6 +6,16 @@ export const wsKeyLinearPublic = 'linearPublic';
|
||||
export const wsKeySpotPrivate = 'spotPrivate';
|
||||
export const wsKeySpotPublic = 'spotPublic';
|
||||
|
||||
export const WS_KEY_MAP = {
|
||||
inverse: wsKeyInverse,
|
||||
linearPrivate: wsKeyLinearPrivate,
|
||||
linearPublic: wsKeyLinearPublic,
|
||||
spotPrivate: wsKeySpotPrivate,
|
||||
spotPublic: wsKeySpotPublic,
|
||||
};
|
||||
|
||||
export const PUBLIC_WS_KEYS = [WS_KEY_MAP.linearPublic, WS_KEY_MAP.spotPublic];
|
||||
|
||||
export function getLinearWsKeyForTopic(topic: string): WsKey {
|
||||
const privateLinearTopics = [
|
||||
'position',
|
||||
|
||||
Reference in New Issue
Block a user