@0xmonaco/core 1.0.76 → 1.0.77
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/api/websocket/websocket.js +15 -15
- package/package.json +3 -3
|
@@ -454,6 +454,10 @@ function parseMarketStatsSummary(raw) {
|
|
|
454
454
|
// marketStatus stays lenient (read as string, not a strict enum) so an
|
|
455
455
|
// unrecognized status value never drops an otherwise-valid summary row.
|
|
456
456
|
marketStatus: readString(data, "marketStatus"),
|
|
457
|
+
indexPrice: readOptionalString(data, "indexPrice"),
|
|
458
|
+
fundingRate: readOptionalString(data, "fundingRate"),
|
|
459
|
+
premium: readOptionalString(data, "premium"),
|
|
460
|
+
openInterestNotional: readOptionalString(data, "openInterestNotional"),
|
|
457
461
|
};
|
|
458
462
|
}
|
|
459
463
|
function parseMarketStatsAllEvent(rawData) {
|
|
@@ -1717,8 +1721,9 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
|
|
|
1717
1721
|
* markets, or pass one to filter. Every frame carries the market's FULL
|
|
1718
1722
|
* current config as a terminal-state snapshot (never an additive delta);
|
|
1719
1723
|
* `changedFields` names what the mutation touched. A subscribe-time snapshot
|
|
1720
|
-
* of
|
|
1721
|
-
*
|
|
1724
|
+
* of every listed market arrives before the live diffs, inactive markets
|
|
1725
|
+
* included and flagged `isActive: false` (filter on `isActive` for the
|
|
1726
|
+
* tradable set); a subscriber joining a channel this client already holds is replayed the
|
|
1722
1727
|
* current baseline from a local cache instead (the server snapshots only
|
|
1723
1728
|
* genuinely new wire subscriptions). Detected broadcast lag closes the connection
|
|
1724
1729
|
* with 1013; a new wire subscription provides a fresh baseline.
|
|
@@ -1761,8 +1766,8 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
|
|
|
1761
1766
|
}
|
|
1762
1767
|
},
|
|
1763
1768
|
// The subscribe-time baseline arrives as one Snapshot frame whose data is
|
|
1764
|
-
// a flat InstrumentEventData[] (a `listing` per
|
|
1765
|
-
// per-item envelope).
|
|
1769
|
+
// a flat InstrumentEventData[] (a `listing` per market, inactive ones
|
|
1770
|
+
// flagged `isActive: false`, no per-item envelope).
|
|
1766
1771
|
//
|
|
1767
1772
|
// Where it goes depends on whether the caller opted in. With
|
|
1768
1773
|
// `onSnapshot`, the rows are handed over as one array and the event
|
|
@@ -1774,7 +1779,7 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
|
|
|
1774
1779
|
// asked would be a silent behaviour break.
|
|
1775
1780
|
//
|
|
1776
1781
|
// Either way the local cache is replaced wholesale rather than upserted,
|
|
1777
|
-
// so markets absent from the snapshot (
|
|
1782
|
+
// so markets absent from the snapshot (no longer listed) do
|
|
1778
1783
|
// not linger.
|
|
1779
1784
|
snapshotFrameHandler("instrument", parseInstrumentEventData, (items) => {
|
|
1780
1785
|
const events = items.map((item) => ({ tradingPairId: item.tradingPairId, data: item }));
|
|
@@ -1818,18 +1823,13 @@ export function createMonacoWebSocket(baseUrl, options = {}, serverClock = new S
|
|
|
1818
1823
|
// follows the same delivery contract: one array to `onSnapshot`
|
|
1819
1824
|
// when opted in, per-market events otherwise.
|
|
1820
1825
|
//
|
|
1821
|
-
//
|
|
1822
|
-
//
|
|
1823
|
-
//
|
|
1824
|
-
//
|
|
1825
|
-
// its market set from the array, so a delisted row there would
|
|
1826
|
-
// resurrect a market that is gone. The per-market EVENTS are not
|
|
1827
|
-
// filtered: a delisting is a legitimate event, it is what tells a
|
|
1828
|
-
// legacy subscriber the market went inactive, and dropping it would
|
|
1829
|
-
// change a caller that never opted into any of this.
|
|
1826
|
+
// Both forms carry the cache's full set, delistings it has seen live
|
|
1827
|
+
// included, because that is what a real snapshot is: the server
|
|
1828
|
+
// enumerates inactive markets too, each flagged `isActive: false`.
|
|
1829
|
+
// A consumer wanting the tradable set filters on `isActive`.
|
|
1830
1830
|
if (onSnapshot) {
|
|
1831
1831
|
try {
|
|
1832
|
-
onSnapshot(replay.
|
|
1832
|
+
onSnapshot(replay.map((event) => event.data));
|
|
1833
1833
|
}
|
|
1834
1834
|
catch (err) {
|
|
1835
1835
|
console.error("WebSocket: Error processing instrument baseline replay", err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.77",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://docs.0xmonaco.com/sdk/typescript",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"viem": "^2.45.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@0xmonaco/contracts": "1.0.
|
|
23
|
-
"@0xmonaco/types": "1.0.
|
|
22
|
+
"@0xmonaco/contracts": "1.0.77",
|
|
23
|
+
"@0xmonaco/types": "1.0.77",
|
|
24
24
|
"@noble/curves": "^1.9.1",
|
|
25
25
|
"@noble/hashes": "^2.4.0",
|
|
26
26
|
"http-status-codes": "^2.3.0"
|