@0xmonaco/core 1.1.6 → 1.1.7
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.
|
@@ -445,6 +445,18 @@ function parseRfqSideViewEventData(raw) {
|
|
|
445
445
|
...(estimatedMonacoFee !== undefined && { estimatedMonacoFee }),
|
|
446
446
|
...(estimatedBuilderFee !== undefined && { estimatedBuilderFee }),
|
|
447
447
|
...(estimatedTotalFee !== undefined && { estimatedTotalFee }),
|
|
448
|
+
...(raw.book != null && { book: parseRfqBookComparisonEventData(raw.book) }),
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function parseRfqBookComparisonEventData(raw) {
|
|
452
|
+
if (!isRecord(raw)) {
|
|
453
|
+
throw new Error("Invalid RFQ view: a book comparison must be an object");
|
|
454
|
+
}
|
|
455
|
+
return {
|
|
456
|
+
vwap: readString(raw, "vwap"),
|
|
457
|
+
grossVwap: readString(raw, "grossVwap"),
|
|
458
|
+
asOfMs: readSequence(raw, "asOfMs"),
|
|
459
|
+
levels: readSequence(raw, "levels"),
|
|
448
460
|
};
|
|
449
461
|
}
|
|
450
462
|
/** An optional wire integer that may be negative; absent or `null` is `undefined`. */
|
|
@@ -508,7 +520,7 @@ function parseRfqFillEventData(raw) {
|
|
|
508
520
|
...(builderFee !== undefined && { builderFee }),
|
|
509
521
|
};
|
|
510
522
|
}
|
|
511
|
-
/** Parse the taker's outcome. Nothing filled leaves `vwap` absent and `fills` empty. */
|
|
523
|
+
/** Parse the taker's outcome. Nothing filled leaves `vwap` and `allInVwap` absent and `fills` empty. */
|
|
512
524
|
function parseRfqOutcomeEventData(raw) {
|
|
513
525
|
if (!isRecord(raw)) {
|
|
514
526
|
throw new Error("Invalid RFQ outcome: outcome must be an object");
|
|
@@ -517,11 +529,13 @@ function parseRfqOutcomeEventData(raw) {
|
|
|
517
529
|
throw new Error("Invalid RFQ outcome: fills must be an array");
|
|
518
530
|
}
|
|
519
531
|
const vwap = readOptionalDecimalString(raw, "vwap");
|
|
532
|
+
const allInVwap = readOptionalDecimalString(raw, "allInVwap");
|
|
520
533
|
return {
|
|
521
534
|
executedQuantity: readString(raw, "executedQuantity"),
|
|
522
535
|
unfilledQuantity: readString(raw, "unfilledQuantity"),
|
|
523
536
|
...(vwap !== undefined && { vwap }),
|
|
524
537
|
fills: raw.fills.map(parseRfqFillEventData),
|
|
538
|
+
...(allInVwap !== undefined && { allInVwap }),
|
|
525
539
|
};
|
|
526
540
|
}
|
|
527
541
|
/** Parse an RFQ's end. Only the taker's push carries `outcome`. */
|
|
@@ -624,6 +638,21 @@ function parseAccountEvent(rawData) {
|
|
|
624
638
|
data: parseAccountEventData(rawData.data),
|
|
625
639
|
};
|
|
626
640
|
}
|
|
641
|
+
/** The frame's 24h volume split by source, or undefined when the frame omits it. */
|
|
642
|
+
function parseDailyVolumeBySource(raw) {
|
|
643
|
+
if (raw === undefined || raw === null) {
|
|
644
|
+
return undefined;
|
|
645
|
+
}
|
|
646
|
+
if (!isRecord(raw)) {
|
|
647
|
+
throw new Error("Invalid market stats event: daily_volume_by_source must be an object");
|
|
648
|
+
}
|
|
649
|
+
return {
|
|
650
|
+
orderBookBaseTokenVolume: readString(raw, "orderBookBaseTokenVolume"),
|
|
651
|
+
rfqBaseTokenVolume: readString(raw, "rfqBaseTokenVolume"),
|
|
652
|
+
orderBookQuoteTokenVolume: readOptionalString(raw, "orderBookQuoteTokenVolume"),
|
|
653
|
+
rfqQuoteTokenVolume: readOptionalString(raw, "rfqQuoteTokenVolume"),
|
|
654
|
+
};
|
|
655
|
+
}
|
|
627
656
|
function parseMarketStatsData(raw) {
|
|
628
657
|
if (!isRecord(raw)) {
|
|
629
658
|
throw new Error("Invalid market stats event: data must be an object");
|
|
@@ -647,6 +676,7 @@ function parseMarketStatsData(raw) {
|
|
|
647
676
|
dailyPriceHigh: readOptionalString(data, "dailyPriceHigh"),
|
|
648
677
|
dailyPriceChange: readOptionalString(data, "dailyPriceChange"),
|
|
649
678
|
dailyPriceChangePercent: readOptionalString(data, "dailyPriceChangePercent"),
|
|
679
|
+
dailyVolumeBySource: parseDailyVolumeBySource(data.dailyVolumeBySource),
|
|
650
680
|
currentFundingRate: readOptionalString(data, "currentFundingRate"),
|
|
651
681
|
fundingRate: readOptionalString(data, "fundingRate"),
|
|
652
682
|
fundingTimestamp: readOptionalNumber(data, "fundingTimestamp"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
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.1.
|
|
23
|
-
"@0xmonaco/types": "1.1.
|
|
22
|
+
"@0xmonaco/contracts": "1.1.7",
|
|
23
|
+
"@0xmonaco/types": "1.1.7",
|
|
24
24
|
"@noble/curves": "^2.4.0",
|
|
25
25
|
"@noble/hashes": "^2.4.0",
|
|
26
26
|
"http-status-codes": "^2.3.0"
|