@pear-protocol/market-sdk 0.0.13 → 0.0.14
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/dist/chart/cache/index.js +15 -3
- package/dist/chart/chart.js +14 -23
- package/dist/chart/collector/binance.js +4 -0
- package/dist/chart/collector/bybit.js +12 -1
- package/dist/chart/collector/helpers.js +3 -0
- package/dist/chart/collector/hyperliquid.js +12 -2
- package/dist/chart/collector/index.js +27 -12
- package/dist/chart/collector/lighter.js +4 -2
- package/dist/chart/collector/okx.js +12 -1
- package/dist/chart/compute/asset.js +4 -0
- package/dist/chart/compute/performance.js +20 -4
- package/dist/chart/compute/price-ratio.js +8 -1
- package/dist/chart/compute/weighted-ratio.js +9 -1
- package/dist/chart/utils.js +19 -11
- package/dist/chart/ws/base-candle.d.ts +11 -5
- package/dist/chart/ws/base-candle.js +6 -2
- package/dist/chart/ws/binance.d.ts +4 -6
- package/dist/chart/ws/binance.js +33 -19
- package/dist/chart/ws/bybit.d.ts +4 -6
- package/dist/chart/ws/bybit.js +40 -24
- package/dist/chart/ws/hyperliquid.d.ts +4 -6
- package/dist/chart/ws/hyperliquid.js +37 -19
- package/dist/chart/ws/index.js +3 -0
- package/dist/chart/ws/lighter.d.ts +20 -20
- package/dist/chart/ws/lighter.js +75 -196
- package/dist/chart/ws/okx.d.ts +4 -6
- package/dist/chart/ws/okx.js +47 -23
- package/dist/funding-rate/fetcher/binance.js +7 -1
- package/dist/funding-rate/fetcher/bybit.js +15 -13
- package/dist/funding-rate/fetcher/http-client.js +11 -8
- package/dist/funding-rate/fetcher/hyperliquid.js +7 -1
- package/dist/funding-rate/fetcher/index.js +3 -0
- package/dist/funding-rate/fetcher/lighter.js +7 -1
- package/dist/funding-rate/fetcher/okx.js +14 -12
- package/dist/funding-rate/funding-rate.js +29 -21
- package/dist/funding-rate/utils.js +26 -5
- package/dist/orderbook/book/aggregate.js +16 -3
- package/dist/orderbook/book/local-book.js +16 -5
- package/dist/orderbook/orderbook.js +29 -13
- package/dist/orderbook/types.js +7 -1
- package/dist/orderbook/utils.js +5 -0
- package/dist/orderbook/ws/base-depth.js +10 -1
- package/dist/orderbook/ws/binance.js +28 -7
- package/dist/orderbook/ws/bybit.js +20 -5
- package/dist/orderbook/ws/hyperliquid.js +31 -11
- package/dist/orderbook/ws/index.js +3 -0
- package/dist/orderbook/ws/lighter.js +22 -7
- package/dist/orderbook/ws/okx.js +23 -2
- package/dist/transport/base-transport.js +5 -0
- package/dist/transport/binance.js +5 -0
- package/dist/transport/bybit.js +8 -1
- package/dist/transport/hyperliquid.js +8 -1
- package/dist/transport/index.js +3 -0
- package/dist/transport/lighter.js +8 -1
- package/dist/transport/okx.js +5 -0
- package/package.json +2 -2
package/dist/orderbook/utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { DEFAULT_MULTIPLIERS } from './types';
|
|
3
3
|
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
6
|
function getCexAvailableAggregations(tickSize, midPrice, multipliers = DEFAULT_MULTIPLIERS) {
|
|
5
7
|
if (tickSize <= 0 || midPrice <= 0) return [];
|
|
6
8
|
const tick = new BigNumber(tickSize);
|
|
@@ -11,6 +13,7 @@ function getCexAvailableAggregations(tickSize, midPrice, multipliers = DEFAULT_M
|
|
|
11
13
|
return bucket < midPrice && bucketMag <= maxBucketMag;
|
|
12
14
|
});
|
|
13
15
|
}
|
|
16
|
+
__name(getCexAvailableAggregations, "getCexAvailableAggregations");
|
|
14
17
|
function getHyperliquidAvailableAggregations(maxDecimals, midPrice, multipliers = DEFAULT_MULTIPLIERS) {
|
|
15
18
|
if (midPrice <= 0) return [];
|
|
16
19
|
const decimals = Math.max(0, maxDecimals);
|
|
@@ -23,6 +26,7 @@ function getHyperliquidAvailableAggregations(maxDecimals, midPrice, multipliers
|
|
|
23
26
|
return bucket < midPrice && bucketMag >= minBucketMag && bucketMag <= maxBucketMag;
|
|
24
27
|
});
|
|
25
28
|
}
|
|
29
|
+
__name(getHyperliquidAvailableAggregations, "getHyperliquidAvailableAggregations");
|
|
26
30
|
function getAvailableAggregations(connector, config, multipliers = DEFAULT_MULTIPLIERS) {
|
|
27
31
|
if (connector === "hyperliquid") {
|
|
28
32
|
const { maxDecimals, midPrice: midPrice2 } = config;
|
|
@@ -31,5 +35,6 @@ function getAvailableAggregations(connector, config, multipliers = DEFAULT_MULTI
|
|
|
31
35
|
const { tickSize, midPrice } = config;
|
|
32
36
|
return getCexAvailableAggregations(tickSize, midPrice, multipliers);
|
|
33
37
|
}
|
|
38
|
+
__name(getAvailableAggregations, "getAvailableAggregations");
|
|
34
39
|
|
|
35
40
|
export { getAvailableAggregations, getCexAvailableAggregations, getHyperliquidAvailableAggregations };
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1
3
|
function parseStringLevels(levels) {
|
|
2
4
|
if (!levels) return [];
|
|
3
5
|
const out = new Array(levels.length);
|
|
4
6
|
for (let i = 0; i < levels.length; i++) {
|
|
5
7
|
const entry = levels[i];
|
|
6
8
|
if (!entry) continue;
|
|
7
|
-
out[i] = [
|
|
9
|
+
out[i] = [
|
|
10
|
+
entry[0],
|
|
11
|
+
Number(entry[1])
|
|
12
|
+
];
|
|
8
13
|
}
|
|
9
14
|
return out;
|
|
10
15
|
}
|
|
16
|
+
__name(parseStringLevels, "parseStringLevels");
|
|
11
17
|
class BaseDepthWs {
|
|
18
|
+
static {
|
|
19
|
+
__name(this, "BaseDepthWs");
|
|
20
|
+
}
|
|
12
21
|
transport;
|
|
13
22
|
onUpdate;
|
|
14
23
|
snapshottedPrice = 0;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { BaseDepthWs, parseStringLevels } from './base-depth';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
const BINANCE_DEPTH_REST = "https://fapi.binance.com/fapi/v1/depth";
|
|
4
|
-
const toStreamName = (symbol) => `${symbol.toLowerCase()}@depth@100ms
|
|
6
|
+
const toStreamName = /* @__PURE__ */ __name((symbol) => `${symbol.toLowerCase()}@depth@100ms`, "toStreamName");
|
|
5
7
|
class BinanceDepthWs extends BaseDepthWs {
|
|
8
|
+
static {
|
|
9
|
+
__name(this, "BinanceDepthWs");
|
|
10
|
+
}
|
|
6
11
|
idCounter = 1;
|
|
7
12
|
symbolStates = /* @__PURE__ */ new Map();
|
|
8
13
|
buildSubscribeMessage(symbol) {
|
|
9
14
|
return {
|
|
10
15
|
method: "SUBSCRIBE",
|
|
11
|
-
params: [
|
|
16
|
+
params: [
|
|
17
|
+
toStreamName(symbol)
|
|
18
|
+
],
|
|
12
19
|
id: this.idCounter++
|
|
13
20
|
};
|
|
14
21
|
}
|
|
@@ -16,13 +23,18 @@ class BinanceDepthWs extends BaseDepthWs {
|
|
|
16
23
|
this.symbolStates.delete(symbol);
|
|
17
24
|
return {
|
|
18
25
|
method: "UNSUBSCRIBE",
|
|
19
|
-
params: [
|
|
26
|
+
params: [
|
|
27
|
+
toStreamName(symbol)
|
|
28
|
+
],
|
|
20
29
|
id: this.idCounter++
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
subscribe(symbol) {
|
|
24
33
|
if (this.symbolStates.has(symbol)) return;
|
|
25
|
-
this.symbolStates.set(symbol, {
|
|
34
|
+
this.symbolStates.set(symbol, {
|
|
35
|
+
phase: "buffering",
|
|
36
|
+
buffer: []
|
|
37
|
+
});
|
|
26
38
|
super.subscribe(symbol);
|
|
27
39
|
this.bootstrap(symbol);
|
|
28
40
|
}
|
|
@@ -54,7 +66,10 @@ class BinanceDepthWs extends BaseDepthWs {
|
|
|
54
66
|
asks: parseStringLevels(snapshot.asks),
|
|
55
67
|
ts: snapshot.E ?? Date.now()
|
|
56
68
|
});
|
|
57
|
-
this.symbolStates.set(symbol, {
|
|
69
|
+
this.symbolStates.set(symbol, {
|
|
70
|
+
phase: "syncing",
|
|
71
|
+
lastUpdateId
|
|
72
|
+
});
|
|
58
73
|
for (const event of buffered) {
|
|
59
74
|
if (!this.processEvent(symbol, event)) {
|
|
60
75
|
this.rebootstrap(symbol);
|
|
@@ -70,7 +85,10 @@ class BinanceDepthWs extends BaseDepthWs {
|
|
|
70
85
|
if (!(payload.U <= state.lastUpdateId && payload.u >= state.lastUpdateId)) {
|
|
71
86
|
return false;
|
|
72
87
|
}
|
|
73
|
-
this.symbolStates.set(symbol, {
|
|
88
|
+
this.symbolStates.set(symbol, {
|
|
89
|
+
phase: "ready",
|
|
90
|
+
lastFinalUpdateId: payload.u
|
|
91
|
+
});
|
|
74
92
|
this.emitDelta(symbol, payload);
|
|
75
93
|
return true;
|
|
76
94
|
}
|
|
@@ -98,7 +116,10 @@ class BinanceDepthWs extends BaseDepthWs {
|
|
|
98
116
|
}
|
|
99
117
|
rebootstrap(symbol) {
|
|
100
118
|
if (!this.symbolStates.has(symbol)) return;
|
|
101
|
-
this.symbolStates.set(symbol, {
|
|
119
|
+
this.symbolStates.set(symbol, {
|
|
120
|
+
phase: "buffering",
|
|
121
|
+
buffer: []
|
|
122
|
+
});
|
|
102
123
|
setTimeout(() => this.bootstrap(symbol), 1e3);
|
|
103
124
|
}
|
|
104
125
|
parseMessage(data) {
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { BaseDepthWs, parseStringLevels } from './base-depth';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const toTopic = /* @__PURE__ */ __name((symbol) => `orderbook.1000.${symbol}`, "toTopic");
|
|
6
|
+
const fromTopic = /* @__PURE__ */ __name((topic) => {
|
|
5
7
|
const parts = topic.split(".");
|
|
6
8
|
return parts[2] ?? "";
|
|
7
|
-
};
|
|
9
|
+
}, "fromTopic");
|
|
8
10
|
class BybitDepthWs extends BaseDepthWs {
|
|
11
|
+
static {
|
|
12
|
+
__name(this, "BybitDepthWs");
|
|
13
|
+
}
|
|
9
14
|
buildSubscribeMessage(symbol) {
|
|
10
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
op: "subscribe",
|
|
17
|
+
args: [
|
|
18
|
+
toTopic(symbol)
|
|
19
|
+
]
|
|
20
|
+
};
|
|
11
21
|
}
|
|
12
22
|
buildUnsubscribeMessage(symbol) {
|
|
13
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
op: "unsubscribe",
|
|
25
|
+
args: [
|
|
26
|
+
toTopic(symbol)
|
|
27
|
+
]
|
|
28
|
+
};
|
|
14
29
|
}
|
|
15
30
|
parseMessage(data) {
|
|
16
31
|
let msg;
|
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
import { BaseDepthWs } from './base-depth';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const parseLevels = /* @__PURE__ */ __name((levels) => {
|
|
4
6
|
if (!levels) return [];
|
|
5
|
-
return levels.map((l) => [
|
|
6
|
-
|
|
7
|
+
return levels.map((l) => [
|
|
8
|
+
l.px,
|
|
9
|
+
Number(l.sz)
|
|
10
|
+
]);
|
|
11
|
+
}, "parseLevels");
|
|
7
12
|
function computeSigFigs(bucketSize, currentPrice) {
|
|
8
13
|
if (bucketSize <= 0 || currentPrice <= 0) return {};
|
|
9
14
|
const priceMag = Math.floor(Math.log10(currentPrice));
|
|
10
15
|
const bucketMag = Math.floor(Math.log10(bucketSize));
|
|
11
16
|
const rawSigFigs = priceMag - bucketMag + 1;
|
|
12
17
|
if (rawSigFigs < 2) return {};
|
|
13
|
-
if (rawSigFigs > 5) return {
|
|
18
|
+
if (rawSigFigs > 5) return {
|
|
19
|
+
nSigFigs: null
|
|
20
|
+
};
|
|
14
21
|
const nSigFigs = rawSigFigs;
|
|
15
|
-
if (nSigFigs < 5) return {
|
|
22
|
+
if (nSigFigs < 5) return {
|
|
23
|
+
nSigFigs
|
|
24
|
+
};
|
|
16
25
|
const ratio = bucketSize / 10 ** bucketMag;
|
|
17
|
-
const mantissaCandidates = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
const mantissaCandidates = [
|
|
27
|
+
1,
|
|
28
|
+
2,
|
|
29
|
+
5
|
|
30
|
+
];
|
|
31
|
+
const mantissa = mantissaCandidates.reduce((closest, candidate) => Math.abs(candidate - ratio) < Math.abs(closest - ratio) ? candidate : closest);
|
|
32
|
+
if (mantissa === 1) return {
|
|
33
|
+
nSigFigs: 5
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
nSigFigs: 5,
|
|
37
|
+
mantissa
|
|
38
|
+
};
|
|
23
39
|
}
|
|
40
|
+
__name(computeSigFigs, "computeSigFigs");
|
|
24
41
|
class HyperliquidDepthWs extends BaseDepthWs {
|
|
42
|
+
static {
|
|
43
|
+
__name(this, "HyperliquidDepthWs");
|
|
44
|
+
}
|
|
25
45
|
aggregation = 0;
|
|
26
46
|
lastNSigFigs;
|
|
27
47
|
lastMantissa;
|
|
@@ -5,6 +5,8 @@ import { HyperliquidDepthWs } from './hyperliquid';
|
|
|
5
5
|
import { LighterDepthWs } from './lighter';
|
|
6
6
|
import { OkxDepthWs } from './okx';
|
|
7
7
|
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
function createDepthWs(transport, connector, onUpdate) {
|
|
9
11
|
switch (connector) {
|
|
10
12
|
case "hyperliquid":
|
|
@@ -23,5 +25,6 @@ function createDepthWs(transport, connector, onUpdate) {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
28
|
+
__name(createDepthWs, "createDepthWs");
|
|
26
29
|
|
|
27
30
|
export { createDepthWs };
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { BaseDepthWs, parseStringLevels } from './base-depth';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class LighterDepthWs extends BaseDepthWs {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "LighterDepthWs");
|
|
8
|
+
}
|
|
4
9
|
snapshotReceived = /* @__PURE__ */ new Map();
|
|
5
10
|
lastNonce = /* @__PURE__ */ new Map();
|
|
6
11
|
resetListenerId = null;
|
|
7
12
|
buildSubscribeMessage(symbol) {
|
|
8
|
-
return {
|
|
13
|
+
return {
|
|
14
|
+
type: "subscribe",
|
|
15
|
+
channel: `order_book@tier2/${symbol}`
|
|
16
|
+
};
|
|
9
17
|
}
|
|
10
18
|
buildUnsubscribeMessage(symbol) {
|
|
11
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
type: "unsubscribe",
|
|
21
|
+
channel: `order_book@tier2/${symbol}`
|
|
22
|
+
};
|
|
12
23
|
}
|
|
13
24
|
start() {
|
|
14
25
|
super.start();
|
|
@@ -44,9 +55,7 @@ class LighterDepthWs extends BaseDepthWs {
|
|
|
44
55
|
if (!isSnapshot) {
|
|
45
56
|
const prevNonce = this.lastNonce.get(symbol);
|
|
46
57
|
if (prevNonce !== void 0 && book.begin_nonce !== prevNonce) {
|
|
47
|
-
console.warn(
|
|
48
|
-
`[LighterDepthWs] Sequence break on symbol ${symbol}: expected begin_nonce ${prevNonce}, got ${book.begin_nonce}. Resubscribing.`
|
|
49
|
-
);
|
|
58
|
+
console.warn(`[LighterDepthWs] Sequence break on symbol ${symbol}: expected begin_nonce ${prevNonce}, got ${book.begin_nonce}. Resubscribing.`);
|
|
50
59
|
this.resubscribe(symbol);
|
|
51
60
|
return null;
|
|
52
61
|
}
|
|
@@ -56,8 +65,14 @@ class LighterDepthWs extends BaseDepthWs {
|
|
|
56
65
|
return {
|
|
57
66
|
symbol,
|
|
58
67
|
type: isSnapshot ? "snapshot" : "delta",
|
|
59
|
-
bids: parseStringLevels(book.bids.map((l) => [
|
|
60
|
-
|
|
68
|
+
bids: parseStringLevels(book.bids.map((l) => [
|
|
69
|
+
l.price,
|
|
70
|
+
l.size
|
|
71
|
+
])),
|
|
72
|
+
asks: parseStringLevels(book.asks.map((l) => [
|
|
73
|
+
l.price,
|
|
74
|
+
l.size
|
|
75
|
+
])),
|
|
61
76
|
ts: msg.timestamp
|
|
62
77
|
};
|
|
63
78
|
}
|
package/dist/orderbook/ws/okx.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
import { BaseDepthWs, parseStringLevels } from './base-depth';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class OkxDepthWs extends BaseDepthWs {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "OkxDepthWs");
|
|
8
|
+
}
|
|
4
9
|
buildSubscribeMessage(symbol) {
|
|
5
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
op: "subscribe",
|
|
12
|
+
args: [
|
|
13
|
+
{
|
|
14
|
+
channel: "books",
|
|
15
|
+
instId: symbol
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
};
|
|
6
19
|
}
|
|
7
20
|
buildUnsubscribeMessage(symbol) {
|
|
8
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
op: "unsubscribe",
|
|
23
|
+
args: [
|
|
24
|
+
{
|
|
25
|
+
channel: "books",
|
|
26
|
+
instId: symbol
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
};
|
|
9
30
|
}
|
|
10
31
|
parseMessage(data) {
|
|
11
32
|
if (data === "pong") return null;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { WebSocket } from 'partysocket';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "BaseTransport");
|
|
8
|
+
}
|
|
4
9
|
ws = null;
|
|
5
10
|
pingTimer = null;
|
|
6
11
|
messageListeners = /* @__PURE__ */ new Map();
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BaseTransport } from './base-transport';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class BinanceTransport extends BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "BinanceTransport");
|
|
8
|
+
}
|
|
4
9
|
connector = "binance";
|
|
5
10
|
getWsUrl() {
|
|
6
11
|
return "wss://fstream.binance.com/ws";
|
package/dist/transport/bybit.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BaseTransport } from './base-transport';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class BybitTransport extends BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "BybitTransport");
|
|
8
|
+
}
|
|
4
9
|
connector = "bybit";
|
|
5
10
|
getWsUrl() {
|
|
6
11
|
return "wss://stream.bybit.com/v5/public/linear";
|
|
@@ -9,7 +14,9 @@ class BybitTransport extends BaseTransport {
|
|
|
9
14
|
return 2e4;
|
|
10
15
|
}
|
|
11
16
|
buildPingMessage() {
|
|
12
|
-
return {
|
|
17
|
+
return {
|
|
18
|
+
op: "ping"
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
21
|
}
|
|
15
22
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BaseTransport } from './base-transport';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class HyperliquidTransport extends BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "HyperliquidTransport");
|
|
8
|
+
}
|
|
4
9
|
connector = "hyperliquid";
|
|
5
10
|
getWsUrl() {
|
|
6
11
|
return "wss://api.hyperliquid.xyz/ws";
|
|
@@ -9,7 +14,9 @@ class HyperliquidTransport extends BaseTransport {
|
|
|
9
14
|
return 3e4;
|
|
10
15
|
}
|
|
11
16
|
buildPingMessage() {
|
|
12
|
-
return {
|
|
17
|
+
return {
|
|
18
|
+
method: "ping"
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
21
|
}
|
|
15
22
|
|
package/dist/transport/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import { HyperliquidTransport } from './hyperliquid';
|
|
|
5
5
|
import { LighterTransport } from './lighter';
|
|
6
6
|
import { OkxTransport } from './okx';
|
|
7
7
|
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
function CreateTransport(connector) {
|
|
9
11
|
switch (connector) {
|
|
10
12
|
case "binance":
|
|
@@ -23,5 +25,6 @@ function CreateTransport(connector) {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
|
28
|
+
__name(CreateTransport, "CreateTransport");
|
|
26
29
|
|
|
27
30
|
export { CreateTransport };
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BaseTransport } from './base-transport';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class LighterTransport extends BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "LighterTransport");
|
|
8
|
+
}
|
|
4
9
|
connector = "lighter";
|
|
5
10
|
getWsUrl() {
|
|
6
11
|
return "wss://mainnet.zklighter.elliot.ai/stream";
|
|
@@ -9,7 +14,9 @@ class LighterTransport extends BaseTransport {
|
|
|
9
14
|
return 6e4;
|
|
10
15
|
}
|
|
11
16
|
buildPingMessage() {
|
|
12
|
-
return {
|
|
17
|
+
return {
|
|
18
|
+
type: "ping"
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
21
|
}
|
|
15
22
|
|
package/dist/transport/okx.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { BaseTransport } from './base-transport';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
5
|
class OkxTransport extends BaseTransport {
|
|
6
|
+
static {
|
|
7
|
+
__name(this, "OkxTransport");
|
|
8
|
+
}
|
|
4
9
|
connector = "okx";
|
|
5
10
|
getWsUrl() {
|
|
6
11
|
return "wss://ws.okx.com:8443/ws/v5/public";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pear-protocol/market-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Pear Protocol Market SDK",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"typecheck": "tsc --noEmit"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@pear-protocol/types": "^1.
|
|
28
|
+
"@pear-protocol/types": "^1.26.0",
|
|
29
29
|
"bignumber.js": "^9.1.2",
|
|
30
30
|
"partysocket": "^1.0.3"
|
|
31
31
|
},
|