@pythnetwork/pyth-lazer-sdk 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/cjs/protocol.d.ts +3 -1
- package/dist/cjs/socket/websocket-pool.d.ts +1 -0
- package/dist/cjs/socket/websocket-pool.js +3 -1
- package/dist/esm/protocol.d.ts +3 -1
- package/dist/esm/socket/websocket-pool.d.ts +1 -0
- package/dist/esm/socket/websocket-pool.js +3 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
package/dist/cjs/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type Chain = "evm" | "solana";
|
|
2
2
|
export type DeliveryFormat = "json" | "binary";
|
|
3
3
|
export type JsonBinaryEncoding = "base64" | "hex";
|
|
4
|
-
export type PriceFeedProperty = "price" | "bestBidPrice" | "bestAskPrice";
|
|
4
|
+
export type PriceFeedProperty = "price" | "bestBidPrice" | "bestAskPrice" | "exponent" | "publisherCount";
|
|
5
5
|
export type Channel = "real_time" | "fixed_rate@50ms" | "fixed_rate@200ms";
|
|
6
6
|
export type Request = {
|
|
7
7
|
type: "subscribe";
|
|
@@ -22,6 +22,8 @@ export type ParsedFeedPayload = {
|
|
|
22
22
|
price?: string | undefined;
|
|
23
23
|
bestBidPrice?: string | undefined;
|
|
24
24
|
bestAskPrice?: string | undefined;
|
|
25
|
+
publisherCount?: number | undefined;
|
|
26
|
+
exponent?: number | undefined;
|
|
25
27
|
};
|
|
26
28
|
export type ParsedPayload = {
|
|
27
29
|
timestampUs: string;
|
|
@@ -10,6 +10,7 @@ export declare class WebSocketPool {
|
|
|
10
10
|
private messageListeners;
|
|
11
11
|
private allConnectionsDownListeners;
|
|
12
12
|
private wasAllDown;
|
|
13
|
+
private checkConnectionStatesInterval;
|
|
13
14
|
private constructor();
|
|
14
15
|
/**
|
|
15
16
|
* Creates a new WebSocketPool instance that uses multiple redundant WebSocket connections for reliability.
|
|
@@ -16,6 +16,7 @@ class WebSocketPool {
|
|
|
16
16
|
messageListeners;
|
|
17
17
|
allConnectionsDownListeners;
|
|
18
18
|
wasAllDown = true;
|
|
19
|
+
checkConnectionStatesInterval;
|
|
19
20
|
constructor(logger = ts_log_1.dummyLogger) {
|
|
20
21
|
this.logger = logger;
|
|
21
22
|
this.rwsPool = [];
|
|
@@ -24,7 +25,7 @@ class WebSocketPool {
|
|
|
24
25
|
this.messageListeners = [];
|
|
25
26
|
this.allConnectionsDownListeners = [];
|
|
26
27
|
// Start monitoring connection states
|
|
27
|
-
setInterval(() => {
|
|
28
|
+
this.checkConnectionStatesInterval = setInterval(() => {
|
|
28
29
|
this.checkConnectionStates();
|
|
29
30
|
}, 100);
|
|
30
31
|
}
|
|
@@ -183,6 +184,7 @@ class WebSocketPool {
|
|
|
183
184
|
this.subscriptions.clear();
|
|
184
185
|
this.messageListeners = [];
|
|
185
186
|
this.allConnectionsDownListeners = [];
|
|
187
|
+
clearInterval(this.checkConnectionStatesInterval);
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
exports.WebSocketPool = WebSocketPool;
|
package/dist/esm/protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type Chain = "evm" | "solana";
|
|
2
2
|
export type DeliveryFormat = "json" | "binary";
|
|
3
3
|
export type JsonBinaryEncoding = "base64" | "hex";
|
|
4
|
-
export type PriceFeedProperty = "price" | "bestBidPrice" | "bestAskPrice";
|
|
4
|
+
export type PriceFeedProperty = "price" | "bestBidPrice" | "bestAskPrice" | "exponent" | "publisherCount";
|
|
5
5
|
export type Channel = "real_time" | "fixed_rate@50ms" | "fixed_rate@200ms";
|
|
6
6
|
export type Request = {
|
|
7
7
|
type: "subscribe";
|
|
@@ -22,6 +22,8 @@ export type ParsedFeedPayload = {
|
|
|
22
22
|
price?: string | undefined;
|
|
23
23
|
bestBidPrice?: string | undefined;
|
|
24
24
|
bestAskPrice?: string | undefined;
|
|
25
|
+
publisherCount?: number | undefined;
|
|
26
|
+
exponent?: number | undefined;
|
|
25
27
|
};
|
|
26
28
|
export type ParsedPayload = {
|
|
27
29
|
timestampUs: string;
|
|
@@ -10,6 +10,7 @@ export declare class WebSocketPool {
|
|
|
10
10
|
private messageListeners;
|
|
11
11
|
private allConnectionsDownListeners;
|
|
12
12
|
private wasAllDown;
|
|
13
|
+
private checkConnectionStatesInterval;
|
|
13
14
|
private constructor();
|
|
14
15
|
/**
|
|
15
16
|
* Creates a new WebSocketPool instance that uses multiple redundant WebSocket connections for reliability.
|
|
@@ -11,6 +11,7 @@ export class WebSocketPool {
|
|
|
11
11
|
messageListeners;
|
|
12
12
|
allConnectionsDownListeners;
|
|
13
13
|
wasAllDown = true;
|
|
14
|
+
checkConnectionStatesInterval;
|
|
14
15
|
constructor(logger = dummyLogger) {
|
|
15
16
|
this.logger = logger;
|
|
16
17
|
this.rwsPool = [];
|
|
@@ -19,7 +20,7 @@ export class WebSocketPool {
|
|
|
19
20
|
this.messageListeners = [];
|
|
20
21
|
this.allConnectionsDownListeners = [];
|
|
21
22
|
// Start monitoring connection states
|
|
22
|
-
setInterval(() => {
|
|
23
|
+
this.checkConnectionStatesInterval = setInterval(() => {
|
|
23
24
|
this.checkConnectionStates();
|
|
24
25
|
}, 100);
|
|
25
26
|
}
|
|
@@ -178,5 +179,6 @@ export class WebSocketPool {
|
|
|
178
179
|
this.subscriptions.clear();
|
|
179
180
|
this.messageListeners = [];
|
|
180
181
|
this.allConnectionsDownListeners = [];
|
|
182
|
+
clearInterval(this.checkConnectionStatesInterval);
|
|
181
183
|
}
|
|
182
184
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pythnetwork/pyth-lazer-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Pyth Lazer SDK",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"ts-log": "^2.2.7",
|
|
68
68
|
"ws": "^8.18.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "5dd180c3215308b9982b818fb0e6c57bd65870e8"
|
|
71
71
|
}
|