@symmio/trading-core 4.0.0 → 4.1.0
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/balance-history/get-balance-history/types.d.ts +3 -1
- package/dist/balance-history/get-balance-history/types.d.ts.map +1 -1
- package/dist/balance-history/get-balance-history/types.js +1 -1
- package/dist/balance-history/get-balance-history/types.js.map +1 -1
- package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.d.ts +50 -0
- package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.d.ts.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.js +30 -0
- package/dist/funding/get-funding-index-checkpoints/get-funding-index-checkpoints.js.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/index.d.ts +5 -0
- package/dist/funding/get-funding-index-checkpoints/index.d.ts.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/query-document.d.ts +16 -0
- package/dist/funding/get-funding-index-checkpoints/query-document.d.ts.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/query-document.js +7 -0
- package/dist/funding/get-funding-index-checkpoints/query-document.js.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/query.d.ts +37 -0
- package/dist/funding/get-funding-index-checkpoints/query.d.ts.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/query.js +23 -0
- package/dist/funding/get-funding-index-checkpoints/query.js.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.d.ts +12 -0
- package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.d.ts.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.js +31 -0
- package/dist/funding/get-funding-index-checkpoints/to-funding-index-checkpoint-row.js.map +1 -0
- package/dist/funding/get-funding-index-checkpoints/types.d.ts +51 -0
- package/dist/funding/get-funding-index-checkpoints/types.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.d.ts +47 -0
- package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.js +30 -0
- package/dist/funding/get-quote-funding-settlements/get-quote-funding-settlements.js.map +1 -0
- package/dist/funding/get-quote-funding-settlements/index.d.ts +5 -0
- package/dist/funding/get-quote-funding-settlements/index.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/query-document.d.ts +16 -0
- package/dist/funding/get-quote-funding-settlements/query-document.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/query-document.js +7 -0
- package/dist/funding/get-quote-funding-settlements/query-document.js.map +1 -0
- package/dist/funding/get-quote-funding-settlements/query.d.ts +37 -0
- package/dist/funding/get-quote-funding-settlements/query.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/query.js +23 -0
- package/dist/funding/get-quote-funding-settlements/query.js.map +1 -0
- package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.d.ts +12 -0
- package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.d.ts.map +1 -0
- package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.js +33 -0
- package/dist/funding/get-quote-funding-settlements/to-quote-funding-settlement-row.js.map +1 -0
- package/dist/funding/get-quote-funding-settlements/types.d.ts +56 -0
- package/dist/funding/get-quote-funding-settlements/types.d.ts.map +1 -0
- package/dist/funding/index.d.ts +3 -0
- package/dist/funding/index.d.ts.map +1 -0
- package/dist/index.d.ts +46 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +408 -388
- package/dist/liquidation/get-liquidation-details/get-liquidation-details.d.ts +44 -0
- package/dist/liquidation/get-liquidation-details/get-liquidation-details.d.ts.map +1 -0
- package/dist/liquidation/get-liquidation-details/get-liquidation-details.js +30 -0
- package/dist/liquidation/get-liquidation-details/get-liquidation-details.js.map +1 -0
- package/dist/liquidation/get-liquidation-details/index.d.ts +5 -0
- package/dist/liquidation/get-liquidation-details/index.d.ts.map +1 -0
- package/dist/liquidation/get-liquidation-details/query-document.d.ts +16 -0
- package/dist/liquidation/get-liquidation-details/query-document.d.ts.map +1 -0
- package/dist/liquidation/get-liquidation-details/query-document.js +7 -0
- package/dist/liquidation/get-liquidation-details/query-document.js.map +1 -0
- package/dist/liquidation/get-liquidation-details/query.d.ts +37 -0
- package/dist/liquidation/get-liquidation-details/query.d.ts.map +1 -0
- package/dist/liquidation/get-liquidation-details/query.js +23 -0
- package/dist/liquidation/get-liquidation-details/query.js.map +1 -0
- package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.d.ts +12 -0
- package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.d.ts.map +1 -0
- package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.js +32 -0
- package/dist/liquidation/get-liquidation-details/to-liquidation-detail-row.js.map +1 -0
- package/dist/liquidation/get-liquidation-details/types.d.ts +47 -0
- package/dist/liquidation/get-liquidation-details/types.d.ts.map +1 -0
- package/dist/liquidation/index.d.ts +2 -0
- package/dist/liquidation/index.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/get-margin-transfers.d.ts +51 -0
- package/dist/margin/get-margin-transfers/get-margin-transfers.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/get-margin-transfers.js +32 -0
- package/dist/margin/get-margin-transfers/get-margin-transfers.js.map +1 -0
- package/dist/margin/get-margin-transfers/index.d.ts +5 -0
- package/dist/margin/get-margin-transfers/index.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/query-document.d.ts +17 -0
- package/dist/margin/get-margin-transfers/query-document.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/query-document.js +7 -0
- package/dist/margin/get-margin-transfers/query-document.js.map +1 -0
- package/dist/margin/get-margin-transfers/query.d.ts +37 -0
- package/dist/margin/get-margin-transfers/query.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/query.js +23 -0
- package/dist/margin/get-margin-transfers/query.js.map +1 -0
- package/dist/margin/get-margin-transfers/to-margin-transfer-row.d.ts +12 -0
- package/dist/margin/get-margin-transfers/to-margin-transfer-row.d.ts.map +1 -0
- package/dist/margin/get-margin-transfers/to-margin-transfer-row.js +19 -0
- package/dist/margin/get-margin-transfers/to-margin-transfer-row.js.map +1 -0
- package/dist/margin/get-margin-transfers/types.d.ts +27 -0
- package/dist/margin/get-margin-transfers/types.d.ts.map +1 -0
- package/dist/margin/index.d.ts +1 -0
- package/dist/margin/index.d.ts.map +1 -1
- package/dist/pools/trade-history/query-document.d.ts +3 -0
- package/dist/pools/trade-history/query-document.d.ts.map +1 -1
- package/dist/pools/trade-history/query-document.js +1 -1
- package/dist/pools/trade-history/query-document.js.map +1 -1
- package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.d.ts +22 -12
- package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.d.ts.map +1 -1
- package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.js +20 -21
- package/dist/quotes/get-quote-events-by-type/get-quote-events-by-type.js.map +1 -1
- package/dist/quotes/get-quote-events-by-type/query-document.d.ts +5 -5
- package/dist/quotes/get-quote-events-by-type/query-document.d.ts.map +1 -1
- package/dist/quotes/get-quote-events-by-type/query-document.js +1 -1
- package/dist/quotes/get-quote-events-by-type/query-document.js.map +1 -1
- package/dist/quotes/get-quote-events-by-type/query.d.ts +7 -6
- package/dist/quotes/get-quote-events-by-type/query.d.ts.map +1 -1
- package/dist/quotes/get-quote-events-by-type/query.js +19 -17
- package/dist/quotes/get-quote-events-by-type/query.js.map +1 -1
- package/dist/quotes/get-quote-events-by-type/to-quote-event-row.d.ts +2 -2
- package/dist/quotes/get-quote-events-by-type/to-quote-event-row.d.ts.map +1 -1
- package/dist/quotes/get-quote-events-by-type/to-quote-event-row.js +1 -3
- package/dist/quotes/get-quote-events-by-type/to-quote-event-row.js.map +1 -1
- package/dist/quotes/get-quote-events-by-type/types.d.ts +14 -3
- package/dist/quotes/get-quote-events-by-type/types.d.ts.map +1 -1
- package/dist/quotes/get-quote-events-by-type/types.js.map +1 -1
- package/dist/quotes/get-quote-funding/get-quote-funding.d.ts +12 -2
- package/dist/quotes/get-quote-funding/get-quote-funding.d.ts.map +1 -1
- package/dist/quotes/get-quote-funding/get-quote-funding.js +21 -17
- package/dist/quotes/get-quote-funding/get-quote-funding.js.map +1 -1
- package/dist/quotes/get-quote-funding/query-document.d.ts +3 -2
- package/dist/quotes/get-quote-funding/query-document.d.ts.map +1 -1
- package/dist/quotes/get-quote-funding/query-document.js +1 -1
- package/dist/quotes/get-quote-funding/query-document.js.map +1 -1
- package/dist/quotes/get-quote-funding/query.d.ts.map +1 -1
- package/dist/quotes/get-quote-funding/query.js +2 -1
- package/dist/quotes/get-quote-funding/query.js.map +1 -1
- package/dist/quotes/get-quote-funding/to-funding-row.d.ts.map +1 -1
- package/dist/quotes/get-quote-funding/to-funding-row.js +1 -3
- package/dist/quotes/get-quote-funding/to-funding-row.js.map +1 -1
- package/dist/quotes/get-quote-history/get-quote-history.d.ts +18 -7
- package/dist/quotes/get-quote-history/get-quote-history.d.ts.map +1 -1
- package/dist/quotes/get-quote-history/get-quote-history.js +32 -22
- package/dist/quotes/get-quote-history/get-quote-history.js.map +1 -1
- package/dist/quotes/get-quote-history/query-document.d.ts +12 -7
- package/dist/quotes/get-quote-history/query-document.d.ts.map +1 -1
- package/dist/quotes/get-quote-history/query-document.js +1 -1
- package/dist/quotes/get-quote-history/query-document.js.map +1 -1
- package/dist/quotes/get-quote-history/query.d.ts +3 -2
- package/dist/quotes/get-quote-history/query.d.ts.map +1 -1
- package/dist/quotes/get-quote-history/query.js +22 -19
- package/dist/quotes/get-quote-history/query.js.map +1 -1
- package/dist/quotes/get-quote-history/to-history-row.d.ts.map +1 -1
- package/dist/quotes/get-quote-history/to-history-row.js +52 -37
- package/dist/quotes/get-quote-history/to-history-row.js.map +1 -1
- package/dist/quotes/get-quote-history/types.d.ts +41 -0
- package/dist/quotes/get-quote-history/types.d.ts.map +1 -1
- package/dist/quotes/get-quote-history/types.js.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.d.ts +21 -11
- package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.d.ts.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.js +19 -21
- package/dist/quotes/get-quotes-events-by-type/get-quotes-events-by-type.js.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/query-document.d.ts +7 -7
- package/dist/quotes/get-quotes-events-by-type/query-document.d.ts.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/query-document.js +1 -1
- package/dist/quotes/get-quotes-events-by-type/query-document.js.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/query.d.ts +8 -6
- package/dist/quotes/get-quotes-events-by-type/query.d.ts.map +1 -1
- package/dist/quotes/get-quotes-events-by-type/query.js +22 -20
- package/dist/quotes/get-quotes-events-by-type/query.js.map +1 -1
- package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.d.ts +38 -0
- package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.d.ts.map +1 -0
- package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.js +28 -0
- package/dist/quotes/get-subgraph-quotes/get-subgraph-quotes.js.map +1 -0
- package/dist/quotes/get-subgraph-quotes/index.d.ts +5 -0
- package/dist/quotes/get-subgraph-quotes/index.d.ts.map +1 -0
- package/dist/quotes/get-subgraph-quotes/query-document.d.ts +15 -0
- package/dist/quotes/get-subgraph-quotes/query-document.d.ts.map +1 -0
- package/dist/quotes/get-subgraph-quotes/query-document.js +7 -0
- package/dist/quotes/get-subgraph-quotes/query-document.js.map +1 -0
- package/dist/quotes/get-subgraph-quotes/query.d.ts +37 -0
- package/dist/quotes/get-subgraph-quotes/query.d.ts.map +1 -0
- package/dist/quotes/get-subgraph-quotes/query.js +23 -0
- package/dist/quotes/get-subgraph-quotes/query.js.map +1 -0
- package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.d.ts +12 -0
- package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.d.ts.map +1 -0
- package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.js +32 -0
- package/dist/quotes/get-subgraph-quotes/to-subgraph-quote-row.js.map +1 -0
- package/dist/quotes/get-subgraph-quotes/types.d.ts +54 -0
- package/dist/quotes/get-subgraph-quotes/types.d.ts.map +1 -0
- package/dist/quotes/index.d.ts +1 -0
- package/dist/quotes/index.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.d.ts +122 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.js +80 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/get-party-a-open-positions-batch.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.d.ts +37 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.js +27 -0
- package/dist/symmio-contracts/symmio/get-party-a-open-positions-batch/query.js.map +1 -0
- package/dist/symmio-contracts/symmio/index.d.ts +2 -0
- package/dist/symmio-contracts/symmio/index.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.d.ts +37 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.js +15 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/is-party-a-liquidated.js.map +1 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.d.ts +38 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.js +29 -0
- package/dist/symmio-contracts/symmio/is-party-a-liquidated/query.js.map +1 -0
- package/dist/symmio-subgraph/index.d.ts +1 -0
- package/dist/symmio-subgraph/index.d.ts.map +1 -1
- package/dist/symmio-subgraph/subgraph-decode.d.ts +51 -0
- package/dist/symmio-subgraph/subgraph-decode.d.ts.map +1 -0
- package/dist/symmio-subgraph/subgraph-decode.js +24 -0
- package/dist/symmio-subgraph/subgraph-decode.js.map +1 -0
- package/dist/symmio-subgraph/subgraph-filters.d.ts +97 -0
- package/dist/symmio-subgraph/subgraph-filters.d.ts.map +1 -0
- package/dist/symmio-subgraph/subgraph-filters.js +39 -0
- package/dist/symmio-subgraph/subgraph-filters.js.map +1 -0
- package/dist/symmio-subgraph/types/generated/analytics/gql.d.ts +25 -5
- package/dist/symmio-subgraph/types/generated/analytics/gql.d.ts.map +1 -1
- package/dist/symmio-subgraph/types/generated/analytics/gql.js +16 -11
- package/dist/symmio-subgraph/types/generated/analytics/gql.js.map +1 -1
- package/dist/symmio-subgraph/types/generated/analytics/graphql.d.ts +3640 -9
- package/dist/symmio-subgraph/types/generated/analytics/graphql.d.ts.map +1 -1
- package/dist/symmio-subgraph/types/generated/analytics/graphql.js +2 -2
- package/dist/symmio-subgraph/types/generated/analytics/graphql.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { toAddressOrNull as e, toBigIntOrNull as t, toBigIntOrZero as n, toNumberOrNull as r } from "../../symmio-subgraph/subgraph-decode.js";
|
|
2
|
+
import { LIQUIDATION_EVENT_TYPES as i, eventTypeToQuoteStatus as a } from "./close-type.js";
|
|
3
|
+
import { parseSolverFees as o } from "./solver-fees.js";
|
|
4
|
+
import { getAddress as s } from "viem";
|
|
4
5
|
//#region src/quotes/get-quote-history/to-history-row.ts
|
|
5
|
-
function
|
|
6
|
-
return e ? BigInt(e) : 0n;
|
|
7
|
-
}
|
|
8
|
-
function a(e) {
|
|
6
|
+
function c(e) {
|
|
9
7
|
if (!e) return null;
|
|
10
8
|
try {
|
|
11
9
|
return JSON.parse(e);
|
|
@@ -13,7 +11,7 @@ function a(e) {
|
|
|
13
11
|
return null;
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
|
-
function
|
|
14
|
+
function l(e) {
|
|
17
15
|
if (e == null) return null;
|
|
18
16
|
let t = String(e).trim();
|
|
19
17
|
if (t === "") return null;
|
|
@@ -25,38 +23,55 @@ function o(e) {
|
|
|
25
23
|
}
|
|
26
24
|
return n > 0n ? n : null;
|
|
27
25
|
}
|
|
28
|
-
function
|
|
29
|
-
let
|
|
26
|
+
function u(u) {
|
|
27
|
+
let d = u.type, f = u.quote, p = i.has(d), m = c(u.metadata), h = m ? l(m.amount) : null, g = m ? l(m.closePrice) : null, _ = m ? l(m.openedPrice) : null, v = o(m?.solverFees), y = h ?? n(f.closedAmount), b = h ?? n(f.quantityToClose), x = g ?? n(f.averageClosedPrice), S = _ ?? n(f.openedPrice), C = p ? h ?? n(f.liquidateAmount) : n(f.liquidateAmount), w = p ? g ?? n(f.liquidatePrice) : n(f.liquidatePrice);
|
|
30
28
|
return {
|
|
31
|
-
eventId:
|
|
32
|
-
closeEventType:
|
|
33
|
-
closedAt: Number(
|
|
34
|
-
quoteId:
|
|
35
|
-
marketId:
|
|
36
|
-
symbol:
|
|
37
|
-
positionType:
|
|
38
|
-
orderType:
|
|
39
|
-
quoteStatus:
|
|
40
|
-
quantity:
|
|
41
|
-
openedPrice:
|
|
42
|
-
requestedOpenPrice:
|
|
43
|
-
avgClosedPrice:
|
|
44
|
-
closedAmount:
|
|
45
|
-
quantityToClose:
|
|
46
|
-
liquidateAmount:
|
|
47
|
-
liquidatePrice:
|
|
48
|
-
solverFee:
|
|
49
|
-
staticSolverFee:
|
|
50
|
-
totalSolverFee:
|
|
51
|
-
partyA:
|
|
52
|
-
partyB:
|
|
53
|
-
subAccount:
|
|
54
|
-
blockNumber:
|
|
55
|
-
transaction:
|
|
56
|
-
rawMetadata:
|
|
29
|
+
eventId: u.id,
|
|
30
|
+
closeEventType: d,
|
|
31
|
+
closedAt: Number(u.timestamp),
|
|
32
|
+
quoteId: n(u.quoteId),
|
|
33
|
+
marketId: f.symbolId ? Number(f.symbolId) : 0,
|
|
34
|
+
symbol: f.symbol ?? null,
|
|
35
|
+
positionType: f.positionType ?? 0,
|
|
36
|
+
orderType: f.orderTypeOpen ?? 0,
|
|
37
|
+
quoteStatus: a[d] ?? f.quoteStatus ?? 0,
|
|
38
|
+
quantity: n(f.quantity),
|
|
39
|
+
openedPrice: S,
|
|
40
|
+
requestedOpenPrice: n(f.requestedOpenPrice),
|
|
41
|
+
avgClosedPrice: x,
|
|
42
|
+
closedAmount: y,
|
|
43
|
+
quantityToClose: b,
|
|
44
|
+
liquidateAmount: C,
|
|
45
|
+
liquidatePrice: w,
|
|
46
|
+
solverFee: v.solverFee,
|
|
47
|
+
staticSolverFee: v.staticSolverFee,
|
|
48
|
+
totalSolverFee: v.totalSolverFee,
|
|
49
|
+
partyA: s(f.partyA),
|
|
50
|
+
partyB: f.partyB ? s(f.partyB) : null,
|
|
51
|
+
subAccount: f.subAccount ? s(f.subAccount.id) : null,
|
|
52
|
+
blockNumber: u.blockNumber ? BigInt(u.blockNumber) : void 0,
|
|
53
|
+
transaction: u.transaction ? u.transaction : void 0,
|
|
54
|
+
rawMetadata: u.metadata,
|
|
55
|
+
source: s(u.source),
|
|
56
|
+
closedPrice: t(f.closedPrice),
|
|
57
|
+
initialOpenedPrice: t(f.initialOpenedPrice),
|
|
58
|
+
marketPrice: t(f.marketPrice),
|
|
59
|
+
tradingFee: n(f.tradingFee),
|
|
60
|
+
closeFee: n(f.closeFee),
|
|
61
|
+
leverage: t(f.leverage),
|
|
62
|
+
cva: t(f.cva),
|
|
63
|
+
lf: t(f.lf),
|
|
64
|
+
initialCva: n(f.initialCva),
|
|
65
|
+
initialLf: n(f.initialLf),
|
|
66
|
+
initialPartyAmm: t(f.initialPartyAmm),
|
|
67
|
+
timestampSendQuote: r(f.timestampSendQuote),
|
|
68
|
+
timestampOpenPosition: r(f.timestampOpenPosition),
|
|
69
|
+
subAccountOwner: e(f.subAccount?.owner),
|
|
70
|
+
sendQuoteTransaction: f.sendQuoteEvents[0]?.transaction ? f.sendQuoteEvents[0].transaction : null,
|
|
71
|
+
openPositionMetadata: f.openPositionEvents.map((e) => e.metadata)
|
|
57
72
|
};
|
|
58
73
|
}
|
|
59
74
|
//#endregion
|
|
60
|
-
export {
|
|
75
|
+
export { u as toQuoteHistoryRow };
|
|
61
76
|
|
|
62
77
|
//# sourceMappingURL=to-history-row.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-history-row.js","names":[],"sources":["../../../src/quotes/get-quote-history/to-history-row.ts"],"sourcesContent":["import { getAddress, type Hex } from \"viem\";\nimport type { OrderType, PositionType, QuoteStatus } from \"../../symmio-contracts/symmio/types\";\nimport type { QuoteEventsForHistoryQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport { eventTypeToQuoteStatus, LIQUIDATION_EVENT_TYPES } from \"./close-type\";\nimport { parseSolverFees } from \"./solver-fees\";\nimport { QuoteCloseEventType, type QuoteHistoryRow } from \"./types\";\n\n/** A single `quoteEvents` row as returned by the history query. */\nexport type RawQuoteEventRow = QuoteEventsForHistoryQuery[\"quoteEvents\"][number];\n\n/** Parse
|
|
1
|
+
{"version":3,"file":"to-history-row.js","names":[],"sources":["../../../src/quotes/get-quote-history/to-history-row.ts"],"sourcesContent":["import { getAddress, type Hex } from \"viem\";\nimport type { OrderType, PositionType, QuoteStatus } from \"../../symmio-contracts/symmio/types\";\nimport { toAddressOrNull, toBigIntOrNull, toBigIntOrZero, toNumberOrNull } from \"../../symmio-subgraph/subgraph-decode\";\nimport type { QuoteEventsForHistoryQuery } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport { eventTypeToQuoteStatus, LIQUIDATION_EVENT_TYPES } from \"./close-type\";\nimport { parseSolverFees } from \"./solver-fees\";\nimport { QuoteCloseEventType, type QuoteHistoryRow } from \"./types\";\n\n/** A single `quoteEvents` row as returned by the history query. */\nexport type RawQuoteEventRow = QuoteEventsForHistoryQuery[\"quoteEvents\"][number];\n\n/** Parse the event `metadata` JSON, returning `null` on absence or malformed input. */\nfunction parseMetadata(raw: string | null): Record<string, unknown> | null {\n if (!raw) return null;\n try {\n return JSON.parse(raw) as Record<string, unknown>;\n } catch {\n return null;\n }\n}\n\n/**\n * Read a wei field from the metadata snapshot as a positive `bigint`, or `null`\n * when it is absent, malformed, or non-positive (so a missing snapshot field\n * falls back to the quote's mutable value rather than overwriting it with zero).\n */\nfunction positiveWei(value: unknown): bigint | null {\n if (value === undefined || value === null) return null;\n\n const text = String(value).trim();\n if (text === \"\") return null;\n\n let parsed: bigint;\n try {\n parsed = BigInt(text);\n } catch {\n return null;\n }\n return parsed > 0n ? parsed : null;\n}\n\n/**\n * Build a {@link QuoteHistoryRow} from one immutable `quoteEvents` row, overlaying\n * the event's frozen `metadata` snapshot (amount, close price, open price) onto\n * the otherwise-mutable quote. Without this overlay, every partial-close row of a\n * quote would show its final mutable state instead of the amount/price of that\n * individual close.\n *\n * @param row - One `quoteEvents` row from {@link \"QuoteEventsForHistoryDocument\"}.\n * @returns The decoded, snapshot-applied history row.\n */\nexport function toQuoteHistoryRow(row: RawQuoteEventRow): QuoteHistoryRow {\n const eventType = row.type as QuoteCloseEventType;\n const quote = row.quote;\n const isLiquidation = LIQUIDATION_EVENT_TYPES.has(eventType);\n\n const metadata = parseMetadata(row.metadata);\n const snapshotAmount = metadata ? positiveWei(metadata.amount) : null;\n const snapshotClosePrice = metadata ? positiveWei(metadata.closePrice) : null;\n const snapshotOpenedPrice = metadata ? positiveWei(metadata.openedPrice) : null;\n const solverFees = parseSolverFees(metadata?.solverFees);\n\n // Overlay the immutable per-event snapshot over the mutable quote values. The\n // snapshot `amount` is this event's settled size — it drives both the closed\n // amount and the close-request quantity (mirrors the reference frontend's applyHistoryCloseEventMetadata).\n const closedAmount = snapshotAmount ?? toBigIntOrZero(quote.closedAmount);\n const quantityToClose = snapshotAmount ?? toBigIntOrZero(quote.quantityToClose);\n const avgClosedPrice = snapshotClosePrice ?? toBigIntOrZero(quote.averageClosedPrice);\n const openedPrice = snapshotOpenedPrice ?? toBigIntOrZero(quote.openedPrice);\n const liquidateAmount = isLiquidation\n ? (snapshotAmount ?? toBigIntOrZero(quote.liquidateAmount))\n : toBigIntOrZero(quote.liquidateAmount);\n const liquidatePrice = isLiquidation\n ? (snapshotClosePrice ?? toBigIntOrZero(quote.liquidatePrice))\n : toBigIntOrZero(quote.liquidatePrice);\n\n return {\n eventId: row.id,\n closeEventType: eventType,\n closedAt: Number(row.timestamp),\n quoteId: toBigIntOrZero(row.quoteId),\n marketId: quote.symbolId ? Number(quote.symbolId) : 0,\n symbol: quote.symbol ?? null,\n positionType: (quote.positionType ?? 0) as PositionType,\n orderType: (quote.orderTypeOpen ?? 0) as OrderType,\n quoteStatus: eventTypeToQuoteStatus[eventType] ?? ((quote.quoteStatus ?? 0) as QuoteStatus),\n quantity: toBigIntOrZero(quote.quantity),\n openedPrice,\n requestedOpenPrice: toBigIntOrZero(quote.requestedOpenPrice),\n avgClosedPrice,\n closedAmount,\n quantityToClose,\n liquidateAmount,\n liquidatePrice,\n solverFee: solverFees.solverFee,\n staticSolverFee: solverFees.staticSolverFee,\n totalSolverFee: solverFees.totalSolverFee,\n partyA: getAddress(quote.partyA),\n partyB: quote.partyB ? getAddress(quote.partyB) : null,\n subAccount: quote.subAccount ? getAddress(quote.subAccount.id) : null,\n blockNumber: row.blockNumber ? BigInt(row.blockNumber) : undefined,\n transaction: row.transaction ? (row.transaction as Hex) : undefined,\n rawMetadata: row.metadata,\n source: getAddress(row.source),\n closedPrice: toBigIntOrNull(quote.closedPrice),\n initialOpenedPrice: toBigIntOrNull(quote.initialOpenedPrice),\n marketPrice: toBigIntOrNull(quote.marketPrice),\n tradingFee: toBigIntOrZero(quote.tradingFee),\n closeFee: toBigIntOrZero(quote.closeFee),\n leverage: toBigIntOrNull(quote.leverage),\n cva: toBigIntOrNull(quote.cva),\n lf: toBigIntOrNull(quote.lf),\n initialCva: toBigIntOrZero(quote.initialCva),\n initialLf: toBigIntOrZero(quote.initialLf),\n initialPartyAmm: toBigIntOrNull(quote.initialPartyAmm),\n timestampSendQuote: toNumberOrNull(quote.timestampSendQuote),\n timestampOpenPosition: toNumberOrNull(quote.timestampOpenPosition),\n subAccountOwner: toAddressOrNull(quote.subAccount?.owner),\n sendQuoteTransaction: quote.sendQuoteEvents[0]?.transaction ? (quote.sendQuoteEvents[0].transaction as Hex) : null,\n openPositionMetadata: quote.openPositionEvents.map((event) => event.metadata),\n };\n}\n"],"mappings":";;;;;AAYA,SAAS,EAAc,GAAoD;CACzE,IAAI,CAAC,GAAK,OAAO;CACjB,IAAI;EACF,OAAO,KAAK,MAAM,CAAG;CACvB,QAAQ;EACN,OAAO;CACT;AACF;AAOA,SAAS,EAAY,GAA+B;CAClD,IAAI,KAAiC,MAAM,OAAO;CAElD,IAAM,IAAO,OAAO,CAAK,EAAE,KAAK;CAChC,IAAI,MAAS,IAAI,OAAO;CAExB,IAAI;CACJ,IAAI;EACF,IAAS,OAAO,CAAI;CACtB,QAAQ;EACN,OAAO;CACT;CACA,OAAO,IAAS,KAAK,IAAS;AAChC;AAYA,SAAgB,EAAkB,GAAwC;CACxE,IAAM,IAAY,EAAI,MAChB,IAAQ,EAAI,OACZ,IAAgB,EAAwB,IAAI,CAAS,GAErD,IAAW,EAAc,EAAI,QAAQ,GACrC,IAAiB,IAAW,EAAY,EAAS,MAAM,IAAI,MAC3D,IAAqB,IAAW,EAAY,EAAS,UA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U,EAAe,EAAM,QAAQ;EACvC,UAAU,EAAe,EAAM,QAAQ;EACvC,KAAK,EAAe,EAAM,GAAG;EAC7B,IAAI,EAAe,EAAM,EAAE;EAC3B,YAAY,EAAe,EAAM,UAAU;EAC3C,WAAW,EAAe,EAAM,SAAS;EACzC,iBAAiB,EAAe,EAAM,eAAe;EACrD,oBAAoB,EAAe,EAAM,kBAAkB;EAC3D,uBAAuB,EAAe,EAAM,qBAAqB;EACjE,iBAAiB,EAAgB,EAAM,YAAY,KAAK;EACxD,sBAAsB,EAAM,gBAAgB,IAAI,cAAe,EAAM,gBAAgB,GAAG,cAAsB;EAC9G,sBAAsB,EAAM,mBAAmB,KAAK,MAAU,EAAM,QAAQ;CAC9E;AACF"}
|
|
@@ -124,5 +124,46 @@ export interface QuoteHistoryRow {
|
|
|
124
124
|
transaction?: Hex;
|
|
125
125
|
/** Raw event `metadata` JSON string, preserved for power users. */
|
|
126
126
|
rawMetadata: string | null;
|
|
127
|
+
/** Diamond address the event was indexed from (the subgraph's `source`). */
|
|
128
|
+
source: Address;
|
|
129
|
+
/**
|
|
130
|
+
* The quote's own `closedPrice`, as indexed — not snapshot-overlaid. Prefer
|
|
131
|
+
* {@link QuoteHistoryRow.avgClosedPrice} for this event's close price.
|
|
132
|
+
*/
|
|
133
|
+
closedPrice: bigint | null;
|
|
134
|
+
/** The fill price before any `SETTLE_UPNL` moved the open price; `null` when not indexed. */
|
|
135
|
+
initialOpenedPrice: bigint | null;
|
|
136
|
+
/** Market price when the quote was sent; `null` when not indexed. */
|
|
137
|
+
marketPrice: bigint | null;
|
|
138
|
+
/** Platform (trading) fee rate the quote was sent with (18-decimal fraction). */
|
|
139
|
+
tradingFee: bigint;
|
|
140
|
+
/** Platform close fee rate the quote was sent with (18-decimal fraction). */
|
|
141
|
+
closeFee: bigint;
|
|
142
|
+
/** Quote leverage as indexed (18-decimal); `null` when not indexed. */
|
|
143
|
+
leverage: bigint | null;
|
|
144
|
+
/** Live locked CVA (shrinks on partial close); `null` when not indexed. */
|
|
145
|
+
cva: bigint | null;
|
|
146
|
+
/** Live locked LF (shrinks on partial close); `null` when not indexed. */
|
|
147
|
+
lf: bigint | null;
|
|
148
|
+
/** CVA the quote was sent with. */
|
|
149
|
+
initialCva: bigint;
|
|
150
|
+
/** LF the quote was sent with. */
|
|
151
|
+
initialLf: bigint;
|
|
152
|
+
/** PartyA maintenance margin the quote was sent with; `null` when not indexed. */
|
|
153
|
+
initialPartyAmm: bigint | null;
|
|
154
|
+
/** When the quote was sent (unix seconds); `null` when not indexed. */
|
|
155
|
+
timestampSendQuote: number | null;
|
|
156
|
+
/** When the position opened (unix seconds); `null` when not indexed. */
|
|
157
|
+
timestampOpenPosition: number | null;
|
|
158
|
+
/** Owner of the quote's SubAccount, or `null` when the quote has none (cross-margin). */
|
|
159
|
+
subAccountOwner: Address | null;
|
|
160
|
+
/** Transaction of the quote's `SEND_QUOTE` event (its open transaction), or `null`. */
|
|
161
|
+
sendQuoteTransaction: Hex | null;
|
|
162
|
+
/**
|
|
163
|
+
* Raw `metadata` of the quote's `OPEN_POSITION` events — at most 1000, the
|
|
164
|
+
* subgraph's page ceiling — undecoded. Decoding (e.g. the solver fees paid at
|
|
165
|
+
* open) and judging whether the list is complete are the consumer's choice.
|
|
166
|
+
*/
|
|
167
|
+
openPositionMetadata: readonly (string | null)[];
|
|
127
168
|
}
|
|
128
169
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEhG;;;;;GAKG;AACH,oBAAY,cAAc;IACxB,yCAAyC;IACzC,GAAG,QAAQ;IACX,mCAAmC;IACnC,MA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M,CAAC;IACxB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;;;;;OAQG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,yDAAyD;IACzD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,mEAAmE;IACnE,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quote-history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEhG;;;;;GAKG;AACH,oBAAY,cAAc;IACxB,yCAAyC;IACzC,GAAG,QAAQ;IACX,mCAAmC;IACnC,MAAM,WAAW;IACjB,mCAAmC;IACnC,WAAW,gBAAgB;IAC3B,2CAA2C;IAC3C,eAAe,oBAAoB;IACnC,6CAA6C;IAC7C,SAAS,cAAc;IACvB,0EAA0E;IAC1E,UAAU,eAAe;CAC1B;AAED;;;;;;;GAOG;AACH,oBAAY,mBAAmB;IAC7B,wCAAwC;IACxC,SAAS,eAAe;IACxB,qBAAqB;IACrB,UAAU,gBAAgB;IAC1B,0BAA0B;IAC1B,cAAc,oBAAoB;IAClC,kCAAkC;IAClC,QAAQ,cAAc;IACtB,4CAA4C;IAC5C,eAAe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cesContent":["import type { Address, Hex } from \"viem\";\nimport type { OrderType, PositionType, QuoteStatus } from \"../../symmio-contracts/symmio/types\";\n\n/**\n * Close-type filter for quote history.\n *\n * Selects which terminal events a history read returns. Maps to the subgraph's\n * `QuoteEvent.type` values via {@link \"closeTypeToEventTypes\"}.\n */\nexport enum QuoteCloseType {\n /** Every close and liquidation event. */\n All = \"All\",\n /** Normal close (`FILL_CLOSE`). */\n Closed = \"Closed\",\n /** Force close (`FORCE_CLOSE`). */\n ForceClosed = \"ForceClosed\",\n /** Emergency close (`EMERGENCY_CLOSE`). */\n EmergencyClosed = \"EmergencyClosed\",\n /** Auto-deleveraging close (`ADL_CLOSE`). */\n AdlClosed = \"AdlClosed\",\n /** Liquidation (`LIQUIDATE_PARTY_A` / `_PARTY_B` / `_CLEARING_HOUSE`). */\n Liquidated = \"Liquidated\",\n}\n\n/**\n * Subgraph `QuoteEvent.type` values that terminate a (partial) position and\n * therefore appear in history. Each carries an immutable `metadata` snapshot.\n *\n * @remarks\n * Mirrors the event-type strings emitted by the SYMMIO subgraphs (v0.8.6+);\n * see the subgraphs `0.8.6_migration` doc — QuoteEvent metadata.\n */\nexport enum QuoteCloseEventType {\n /** A normal (partial or full) close. */\n FillClose = \"FILL_CLOSE\",\n /** A force close. */\n ForceClose = \"FORCE_CLOSE\",\n /** An emergency close. */\n EmergencyClose = \"EMERGENCY_CLOSE\",\n /** An auto-deleveraging close. */\n AdlClose = \"ADL_CLOSE\",\n /** Liquidation initiated against partyA. */\n LiquidatePartyA = \"LIQUIDATE_PARTY_A\",\n /** Liquidation initiated against partyB. */\n LiquidatePartyB = \"LIQUIDATE_PARTY_B\",\n /** Liquidation initiated by the clearing house. */\n LiquidateClearingHouse = \"LIQUIDATE_CLEARING_HOUSE\",\n}\n\n/**\n * One row of quote history — a single immutable `QuoteEvent` with its per-event\n * `metadata` snapshot overlaid onto the (otherwise mutable) quote it belongs to.\n *\n * Because the underlying `Quote` entity is mutable, a quote closed across several\n * partial closes produces several history rows that would otherwise show the same\n * final state. The snapshot overlay restores each event's own amount/price, so\n * every partial-close row is distinct.\n *\n * @remarks\n * Amounts and prices are raw `bigint` (18-decimal fixed point, no scaling),\n * matching the SDK's on-chain {@link \"Quote\"} reads. Enum fields are decoded.\n */\nexport interface QuoteHistoryRow {\n /** Stable id of the underlying immutable `QuoteEvent` (use as a row key). */\n eventId: string;\n /** The close / liquidation event that produced this row. */\n closeEventType: QuoteCloseEventType;\n /** Event block timestamp in seconds (the row's \"close time\"). */\n closedAt: number;\n /** Protocol quote id. */\n quoteId: bigint;\n /** Market identifier (`symbolId`). */\n marketId: number;\n /** Market ticker resolved by the subgraph, when known. */\n symbol: string | null;\n /** Long or short. */\n positionType: PositionType;\n /** Limit or market order (open side). */\n orderType: OrderType;\n /** Lifecycle status, forced to `CLOSED` / `LIQUIDATED` from the event type. */\n quoteStatus: QuoteStatus;\n /** Total quote quantity. */\n quantity: bigint;\n /** Open price (snapshot-overlaid when the event carried one). */\n openedPrice: bigint;\n /** Price partyA originally requested to open at. */\n requestedOpenPrice: bigint;\n /** Average close price (snapshot-overlaid with this event's close price). */\n avgClosedPrice: bigint;\n /** Amount closed by this event (snapshot `amount`). */\n closedAmount: bigint;\n /** Quantity of the close request this event settled. */\n quantityToClose: bigint;\n /** Liquidated amount (set only for liquidation rows). */\n liquidateAmount: bigint;\n /** Liquidation price (set only for liquidation rows). */\n liquidatePrice: bigint;\n /**\n * Rate-based solver fee charged by this event (`SOLVER_FEE`), or `null` when\n * the event carried none.\n */\n solverFee: bigint | null;\n /**\n * Flat solver fee charged by this event (`STATIC_SOLVER_FEE`), or `null` when\n * the event carried none.\n */\n staticSolverFee: bigint | null;\n /**\n * Sum of every solver fee on the event — including tags this version does not\n * name individually — or `null` when the event recorded none at all.\n *\n * @remarks\n * Only fill-close events carry solver fees: liquidation and ADL rows, and\n * deployments indexed before the fee was recorded, read `null` on all three\n * fee fields. The untruncated list stays on {@link QuoteHistoryRow.rawMetadata}.\n */\n totalSolverFee: bigint | null;\n /** PartyA (the SubAccount or Virtual Account that owns the quote). */\n partyA: Address;\n /** PartyB (the hedger/solver), or `null` when absent. */\n partyB: Address | null;\n /** The account-layer SubAccount address, or `null` when absent. */\n subAccount: Address | null;\n /** Block number of the event, when available. */\n blockNumber?: bigint;\n /** Transaction hash of the event, when available. */\n transaction?: Hex;\n /** Raw event `metadata` JSON string, preserved for power users. */\n rawMetadata: string | null;\n}\n"],"mappings":";AASA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,MAAA,OAEA,EAAA,SAAA,UAEA,EAAA,cAAA,eAEA,EAAA,kBAAA,mBAEA,EAAA,YAAA,aAEA,EAAA,aAAA;AACF,EAAA,CAAA,CAAA,GAUY,IAAL,yBAAA,GAAA;QAEL,EAAA,YAAA,cAEA,EAAA,aAAA,eAEA,EAAA,iBAAA,mBAEA,EAAA,WAAA,aAEA,EAAA,kBAAA,qBAEA,EAAA,kBAAA,qBAEA,EAAA,yBAAA;AACF,EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/quotes/get-quote-history/types.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { OrderType, PositionType, QuoteStatus } from \"../../symmio-contracts/symmio/types\";\n\n/**\n * Close-type filter for quote history.\n *\n * Selects which terminal events a history read returns. Maps to the subgraph's\n * `QuoteEvent.type` values via {@link \"closeTypeToEventTypes\"}.\n */\nexport enum QuoteCloseType {\n /** Every close and liquidation event. */\n All = \"All\",\n /** Normal close (`FILL_CLOSE`). */\n Closed = \"Closed\",\n /** Force close (`FORCE_CLOSE`). */\n ForceClosed = \"ForceClosed\",\n /** Emergency close (`EMERGENCY_CLOSE`). */\n EmergencyClosed = \"EmergencyClosed\",\n /** Auto-deleveraging close (`ADL_CLOSE`). */\n AdlClosed = \"AdlClosed\",\n /** Liquidation (`LIQUIDATE_PARTY_A` / `_PARTY_B` / `_CLEARING_HOUSE`). */\n Liquidated = \"Liquidated\",\n}\n\n/**\n * Subgraph `QuoteEvent.type` values that terminate a (partial) position and\n * therefore appear in history. Each carries an immutable `metadata` snapshot.\n *\n * @remarks\n * Mirrors the event-type strings emitted by the SYMMIO subgraphs (v0.8.6+);\n * see the subgraphs `0.8.6_migration` doc — QuoteEvent metadata.\n */\nexport enum QuoteCloseEventType {\n /** A normal (partial or full) close. */\n FillClose = \"FILL_CLOSE\",\n /** A force close. */\n ForceClose = \"FORCE_CLOSE\",\n /** An emergency close. */\n EmergencyClose = \"EMERGENCY_CLOSE\",\n /** An auto-deleveraging close. */\n AdlClose = \"ADL_CLOSE\",\n /** Liquidation initiated against partyA. */\n LiquidatePartyA = \"LIQUIDATE_PARTY_A\",\n /** Liquidation initiated against partyB. */\n LiquidatePartyB = \"LIQUIDATE_PARTY_B\",\n /** Liquidation initiated by the clearing house. */\n LiquidateClearingHouse = \"LIQUIDATE_CLEARING_HOUSE\",\n}\n\n/**\n * One row of quote history — a single immutable `QuoteEvent` with its per-event\n * `metadata` snapshot overlaid onto the (otherwise mutable) quote it belongs to.\n *\n * Because the underlying `Quote` entity is mutable, a quote closed across several\n * partial closes produces several history rows that would otherwise show the same\n * final state. The snapshot overlay restores each event's own amount/price, so\n * every partial-close row is distinct.\n *\n * @remarks\n * Amounts and prices are raw `bigint` (18-decimal fixed point, no scaling),\n * matching the SDK's on-chain {@link \"Quote\"} reads. Enum fields are decoded.\n */\nexport interface QuoteHistoryRow {\n /** Stable id of the underlying immutable `QuoteEvent` (use as a row key). */\n eventId: string;\n /** The close / liquidation event that produced this row. */\n closeEventType: QuoteCloseEventType;\n /** Event block timestamp in seconds (the row's \"close time\"). */\n closedAt: number;\n /** Protocol quote id. */\n quoteId: bigint;\n /** Market identifier (`symbolId`). */\n marketId: number;\n /** Market ticker resolved by the subgraph, when known. */\n symbol: string | null;\n /** Long or short. */\n positionType: PositionType;\n /** Limit or market order (open side). */\n orderType: OrderType;\n /** Lifecycle status, forced to `CLOSED` / `LIQUIDATED` from the event type. */\n quoteStatus: QuoteStatus;\n /** Total quote quantity. */\n quantity: bigint;\n /** Open price (snapshot-overlaid when the event carried one). */\n openedPrice: bigint;\n /** Price partyA originally requested to open at. */\n requestedOpenPrice: bigint;\n /** Average close price (snapshot-overlaid with this event's close price). */\n avgClosedPrice: bigint;\n /** Amount closed by this event (snapshot `amount`). */\n closedAmount: bigint;\n /** Quantity of the close request this event settled. */\n quantityToClose: bigint;\n /** Liquidated amount (set only for liquidation rows). */\n liquidateAmount: bigint;\n /** Liquidation price (set only for liquidation rows). */\n liquidatePrice: bigint;\n /**\n * Rate-based solver fee charged by this event (`SOLVER_FEE`), or `null` when\n * the event carried none.\n */\n solverFee: bigint | null;\n /**\n * Flat solver fee charged by this event (`STATIC_SOLVER_FEE`), or `null` when\n * the event carried none.\n */\n staticSolverFee: bigint | null;\n /**\n * Sum of every solver fee on the event — including tags this version does not\n * name individually — or `null` when the event recorded none at all.\n *\n * @remarks\n * Only fill-close events carry solver fees: liquidation and ADL rows, and\n * deployments indexed before the fee was recorded, read `null` on all three\n * fee fields. The untruncated list stays on {@link QuoteHistoryRow.rawMetadata}.\n */\n totalSolverFee: bigint | null;\n /** PartyA (the SubAccount or Virtual Account that owns the quote). */\n partyA: Address;\n /** PartyB (the hedger/solver), or `null` when absent. */\n partyB: Address | null;\n /** The account-layer SubAccount address, or `null` when absent. */\n subAccount: Address | null;\n /** Block number of the event, when available. */\n blockNumber?: bigint;\n /** Transaction hash of the event, when available. */\n transaction?: Hex;\n /** Raw event `metadata` JSON string, preserved for power users. */\n rawMetadata: string | null;\n /** Diamond address the event was indexed from (the subgraph's `source`). */\n source: Address;\n /**\n * The quote's own `closedPrice`, as indexed — not snapshot-overlaid. Prefer\n * {@link QuoteHistoryRow.avgClosedPrice} for this event's close price.\n */\n closedPrice: bigint | null;\n /** The fill price before any `SETTLE_UPNL` moved the open price; `null` when not indexed. */\n initialOpenedPrice: bigint | null;\n /** Market price when the quote was sent; `null` when not indexed. */\n marketPrice: bigint | null;\n /** Platform (trading) fee rate the quote was sent with (18-decimal fraction). */\n tradingFee: bigint;\n /** Platform close fee rate the quote was sent with (18-decimal fraction). */\n closeFee: bigint;\n /** Quote leverage as indexed (18-decimal); `null` when not indexed. */\n leverage: bigint | null;\n /** Live locked CVA (shrinks on partial close); `null` when not indexed. */\n cva: bigint | null;\n /** Live locked LF (shrinks on partial close); `null` when not indexed. */\n lf: bigint | null;\n /** CVA the quote was sent with. */\n initialCva: bigint;\n /** LF the quote was sent with. */\n initialLf: bigint;\n /** PartyA maintenance margin the quote was sent with; `null` when not indexed. */\n initialPartyAmm: bigint | null;\n /** When the quote was sent (unix seconds); `null` when not indexed. */\n timestampSendQuote: number | null;\n /** When the position opened (unix seconds); `null` when not indexed. */\n timestampOpenPosition: number | null;\n /** Owner of the quote's SubAccount, or `null` when the quote has none (cross-margin). */\n subAccountOwner: Address | null;\n /** Transaction of the quote's `SEND_QUOTE` event (its open transaction), or `null`. */\n sendQuoteTransaction: Hex | null;\n /**\n * Raw `metadata` of the quote's `OPEN_POSITION` events — at most 1000, the\n * subgraph's page ceiling — undecoded. Decoding (e.g. the solver fees paid at\n * open) and judging whether the list is complete are the consumer's choice.\n */\n openPositionMetadata: readonly (string | null)[];\n}\n"],"mappings":";AASA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,MAAA,OAEA,EAAA,SAAA,UAEA,EAAA,cAAA,eAEA,EAAA,kBAAA,mBAEA,EAAA,YAAA,aAEA,EAAA,aAAA;AACF,EAAA,CAAA,CAAA,GAUY,IAAL,yBAAA,GAAA;QAEL,EAAA,YAAA,cAEA,EAAA,aAAA,eAEA,EAAA,iBAAA,mBAEA,EAAA,WAAA,aAEA,EAAA,kBAAA,qBAEA,EAAA,kBAAA,qBAEA,EAAA,yBAAA;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
1
2
|
import { Config } from '../../core/config/index.js';
|
|
2
3
|
import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
|
|
3
|
-
import { QuoteEventRow, QuoteEventType } from '../get-quote-events-by-type/types.js';
|
|
4
|
+
import { QuoteEventRow, QuoteEventType, QuoteSubgraphEventType } from '../get-quote-events-by-type/types.js';
|
|
4
5
|
/**
|
|
5
6
|
* Parameters for {@link getQuotesEventsByType}.
|
|
6
7
|
*/
|
|
7
|
-
export type GetQuotesEventsByTypeParameters = Compute<ChainIdParameter & {
|
|
8
|
+
export type GetQuotesEventsByTypeParameters<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType> = Compute<ChainIdParameter & {
|
|
8
9
|
/** On-chain quote ids to read events for. Order is irrelevant — rows come back merged. */
|
|
9
10
|
quoteIds: readonly bigint[];
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Event types to include — e.g. {@link FUNDING_HISTORY_EVENT_TYPES}, or any
|
|
13
|
+
* subgraph type such as `"OPEN_POSITION"`. Omit to read every type; an empty
|
|
14
|
+
* array reads nothing. The rows' `type` narrows to what is passed.
|
|
15
|
+
*/
|
|
16
|
+
types?: readonly TType[];
|
|
17
|
+
/**
|
|
18
|
+
* The deployment's diamond address (the subgraph's `source`). Omit to match
|
|
19
|
+
* the quote ids on any deployment the subgraph indexes.
|
|
20
|
+
*/
|
|
21
|
+
source?: Address;
|
|
12
22
|
/**
|
|
13
23
|
* Page size across the whole batch, not per quote id. The subgraph caps it at
|
|
14
24
|
* 1000, and omitting it asks for that ceiling — one round-trip returns as much
|
|
@@ -22,21 +32,21 @@ export type GetQuotesEventsByTypeParameters = Compute<ChainIdParameter & {
|
|
|
22
32
|
orderDirection?: "asc" | "desc";
|
|
23
33
|
}>;
|
|
24
34
|
/** Return type of {@link getQuotesEventsByType}. */
|
|
25
|
-
export interface GetQuotesEventsByTypeReturnType {
|
|
35
|
+
export interface GetQuotesEventsByTypeReturnType<TType extends QuoteSubgraphEventType = QuoteEventType> {
|
|
26
36
|
/**
|
|
27
37
|
* The decoded event rows for every requested quote id, already merged and
|
|
28
38
|
* sorted by `timestamp` server-side (newest first unless `orderDirection` says
|
|
29
39
|
* otherwise). Each row carries its own `quoteId`, so a caller that needs a
|
|
30
40
|
* per-quote view groups by that field.
|
|
31
41
|
*/
|
|
32
|
-
rows: QuoteEventRow[];
|
|
42
|
+
rows: QuoteEventRow<TType>[];
|
|
33
43
|
/** `true` when the page came back full — caller should fetch the next page. */
|
|
34
44
|
hasMore: boolean;
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
|
-
* Batched sibling of `getQuoteEventsByType`: read the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
47
|
+
* Batched sibling of `getQuoteEventsByType`: read the events of **many** quotes
|
|
48
|
+
* from the analytics subgraph in one round-trip, optionally filtered to the
|
|
49
|
+
* requested event types and deployment.
|
|
40
50
|
*
|
|
41
51
|
* The subgraph does the merge: rows for all `quoteIds` come back interleaved and
|
|
42
52
|
* sorted by `timestamp`, newest first by default, and `first` / `skip` page over
|
|
@@ -60,7 +70,7 @@ export interface GetQuotesEventsByTypeReturnType {
|
|
|
60
70
|
* The action does no event-type interpretation beyond decoding the metadata JSON.
|
|
61
71
|
*
|
|
62
72
|
* @param config - The SDK config.
|
|
63
|
-
* @param parameters - Quote ids, types, pagination, sort, optional chain id.
|
|
73
|
+
* @param parameters - Quote ids, optional types and diamond, pagination, sort, optional chain id.
|
|
64
74
|
* @returns The decoded rows plus a `hasMore` flag.
|
|
65
75
|
* @throws {SymmError} when the chain is unsupported or has no analytics subgraph.
|
|
66
76
|
* @throws {SymmApiError} when the subgraph request fails.
|
|
@@ -73,5 +83,5 @@ export interface GetQuotesEventsByTypeReturnType {
|
|
|
73
83
|
* });
|
|
74
84
|
* ```
|
|
75
85
|
*/
|
|
76
|
-
export declare function getQuotesEventsByType(config: Config, parameters: GetQuotesEventsByTypeParameters): Promise<GetQuotesEventsByTypeReturnType
|
|
86
|
+
export declare function getQuotesEventsByType<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType>(config: Config, parameters: GetQuotesEventsByTypeParameters<TType>): Promise<GetQuotesEventsByTypeReturnType<TType>>;
|
|
77
87
|
//# sourceMappingURL=get-quotes-events-by-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-quotes-events-by-type.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quotes-events-by-type/get-quotes-events-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-quotes-events-by-type.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quotes-events-by-type/get-quotes-events-by-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAW/E,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAG/G;;GAEG;AACH,MAAM,MAAM,+BAA+B,CAAC,KAAK,SAAS,sBAAsB,GAAG,sBAAsB,IAAI,OAAO,CAClH,gBAAgB,GAAG;IACjB,0FAA0F;IAC1F,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACjC,CACF,CAAC;AAEF,oDAAoD;AACpD,MAAM,WAAW,+BAA+B,CAAC,KAAK,SAAS,sBAAsB,GAAG,cAAc;IACpG;;;;;OAKG;IACH,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;IAC7B,+EAA+E;IAC/E,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAsB,qBAAqB,CAAC,KAAK,SAAS,sBAAsB,GAAG,sBAAsB,EACvG,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,+BAA+B,CAAC,KAAK,CAAC,GACjD,OAAO,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC,CAkCjD"}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import { querySubgraph as e } from "../../symmio-subgraph/query-subgraph/query-subgraph.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { SUBGRAPH_MAX_PAGE_SIZE as t, compactWhere as n, hasEmptyListFilter as r, stringList as i, toSubgraphPage as a } from "../../symmio-subgraph/subgraph-filters.js";
|
|
3
|
+
import { toQuoteEventRow as o } from "../get-quote-events-by-type/to-quote-event-row.js";
|
|
4
|
+
import { QuoteEventsForQuotesByTypeDocument as s } from "./query-document.js";
|
|
4
5
|
//#region src/quotes/get-quotes-events-by-type/get-quotes-events-by-type.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (s.length === 0 || c.length === 0) return {
|
|
6
|
+
async function c(c, l) {
|
|
7
|
+
let { chainId: u, quoteIds: d, types: f, source: p, first: m = t, skip: h = 0, orderDirection: g = "desc" } = l;
|
|
8
|
+
return r(d, f) ? {
|
|
9
9
|
rows: [],
|
|
10
10
|
hasMore: !1
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
document: n,
|
|
11
|
+
} : a((await e(c, {
|
|
12
|
+
chainId: u,
|
|
13
|
+
document: s,
|
|
15
14
|
variables: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
where: n({
|
|
16
|
+
quoteId_in: i(d),
|
|
17
|
+
type_in: f,
|
|
18
|
+
source: p?.toLowerCase()
|
|
19
|
+
}),
|
|
20
|
+
first: m,
|
|
21
|
+
skip: h,
|
|
22
|
+
orderDirection: g
|
|
21
23
|
}
|
|
22
|
-
})).quoteEvents.map(
|
|
23
|
-
return {
|
|
24
|
-
rows: f,
|
|
25
|
-
hasMore: f.length === l
|
|
26
|
-
};
|
|
24
|
+
})).quoteEvents.map((e) => o(e)), m);
|
|
27
25
|
}
|
|
28
26
|
//#endregion
|
|
29
|
-
export {
|
|
27
|
+
export { c as getQuotesEventsByType };
|
|
30
28
|
|
|
31
29
|
//# sourceMappingURL=get-quotes-events-by-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-quotes-events-by-type.js","names":[],"sources":["../../../src/quotes/get-quotes-events-by-type/get-quotes-events-by-type.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { querySubgraph } from \"../../symmio-subgraph/query-subgraph\";\nimport { toQuoteEventRow } from \"../get-quote-events-by-type/to-quote-event-row\";\nimport type { QuoteEventRow, QuoteEventType } from \"../get-quote-events-by-type/types\";\nimport { QuoteEventsForQuotesByTypeDocument } from \"./query-document\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"get-quotes-events-by-type.js","names":[],"sources":["../../../src/quotes/get-quotes-events-by-type/get-quotes-events-by-type.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { querySubgraph } from \"../../symmio-subgraph/query-subgraph\";\nimport {\n compactWhere,\n hasEmptyListFilter,\n stringList,\n SUBGRAPH_MAX_PAGE_SIZE,\n toSubgraphPage,\n} from \"../../symmio-subgraph/subgraph-filters\";\nimport type { QuoteEvent_Filter } from \"../../symmio-subgraph/types/generated/analytics/graphql\";\nimport { toQuoteEventRow } from \"../get-quote-events-by-type/to-quote-event-row\";\nimport type { QuoteEventRow, QuoteEventType, QuoteSubgraphEventType } from \"../get-quote-events-by-type/types\";\nimport { QuoteEventsForQuotesByTypeDocument } from \"./query-document\";\n\n/**\n * Parameters for {@link getQuotesEventsByType}.\n */\nexport type GetQuotesEventsByTypeParameters<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType> = Compute<\n ChainIdParameter & {\n /** On-chain quote ids to read events for. Order is irrelevant — rows come back merged. */\n quoteIds: readonly bigint[];\n /**\n * Event types to include — e.g. {@link FUNDING_HISTORY_EVENT_TYPES}, or any\n * subgraph type such as `\"OPEN_POSITION\"`. Omit to read every type; an empty\n * array reads nothing. The rows' `type` narrows to what is passed.\n */\n types?: readonly TType[];\n /**\n * The deployment's diamond address (the subgraph's `source`). Omit to match\n * the quote ids on any deployment the subgraph indexes.\n */\n source?: Address;\n /**\n * Page size across the whole batch, not per quote id. The subgraph caps it at\n * 1000, and omitting it asks for that ceiling — one round-trip returns as much\n * as the subgraph will serve.\n * @default 1000\n */\n first?: number;\n /** Page offset. @default 0 */\n skip?: number;\n /** Sort direction on the event timestamp. @default \"desc\" (newest first). */\n orderDirection?: \"asc\" | \"desc\";\n }\n>;\n\n/** Return type of {@link getQuotesEventsByType}. */\nexport interface GetQuotesEventsByTypeReturnType<TType extends QuoteSubgraphEventType = QuoteEventType> {\n /**\n * The decoded event rows for every requested quote id, already merged and\n * sorted by `timestamp` server-side (newest first unless `orderDirection` says\n * otherwise). Each row carries its own `quoteId`, so a caller that needs a\n * per-quote view groups by that field.\n */\n rows: QuoteEventRow<TType>[];\n /** `true` when the page came back full — caller should fetch the next page. */\n hasMore: boolean;\n}\n\n/**\n * Batched sibling of `getQuoteEventsByType`: read the events of **many** quotes\n * from the analytics subgraph in one round-trip, optionally filtered to the\n * requested event types and deployment.\n *\n * The subgraph does the merge: rows for all `quoteIds` come back interleaved and\n * sorted by `timestamp`, newest first by default, and `first` / `skip` page over\n * that merged stream rather than per quote id. Omit `first` and the action asks\n * for the 1000-row ceiling the subgraph enforces, so an un-paged call returns\n * everything one request can serve.\n *\n * Pass {@link FUNDING_HISTORY_EVENT_TYPES} to build a funding timeline for a\n * whole position group. Two caveats for that use case:\n *\n * - These are the funding charges **settled to date** — what the analytics\n * subgraph has indexed. Funding that has accrued since the last on-chain charge\n * is not indexed by the subgraph and therefore not included here — read it\n * with {@link getQuotePendingFunding}.\n * - The metadata carries the raw on-chain amounts. Net a row the way the rest of\n * the SDK does — `fundingReceived − fundingPaid`, so a **positive** net means\n * the position **earned** funding on that tick, matching\n * `QuoteFundingData.netReceived`. The raw fields themselves are verbatim from\n * the subgraph and are never re-signed.\n *\n * The action does no event-type interpretation beyond decoding the metadata JSON.\n *\n * @param config - The SDK config.\n * @param parameters - Quote ids, optional types and diamond, pagination, sort, optional chain id.\n * @returns The decoded rows plus a `hasMore` flag.\n * @throws {SymmError} when the chain is unsupported or has no analytics subgraph.\n * @throws {SymmApiError} when the subgraph request fails.\n *\n * @example\n * ```ts\n * const { rows, hasMore } = await getQuotesEventsByType(config, {\n * quoteIds: [7334n, 7335n],\n * types: FUNDING_HISTORY_EVENT_TYPES,\n * });\n * ```\n */\nexport async function getQuotesEventsByType<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType>(\n config: Config,\n parameters: GetQuotesEventsByTypeParameters<TType>,\n): Promise<GetQuotesEventsByTypeReturnType<TType>> {\n // `first` defaults to the ceiling: asking below it would truncate an un-paged\n // caller, and leaving it out of the query makes The Graph fall back to 100.\n const {\n chainId,\n quoteIds,\n types,\n source,\n first = SUBGRAPH_MAX_PAGE_SIZE,\n skip = 0,\n orderDirection = \"desc\",\n } = parameters;\n\n if (hasEmptyListFilter(quoteIds, types)) return { rows: [], hasMore: false };\n\n const data = await querySubgraph(config, {\n chainId,\n document: QuoteEventsForQuotesByTypeDocument,\n variables: {\n where: compactWhere<QuoteEvent_Filter>({\n quoteId_in: stringList(quoteIds),\n type_in: types as string[] | undefined,\n source: source?.toLowerCase(),\n }),\n first,\n skip,\n orderDirection,\n },\n });\n\n return toSubgraphPage(\n data.quoteEvents.map((row) => toQuoteEventRow<TType>(row)),\n first,\n );\n}\n"],"mappings":";;;;;AAqGA,eAAsB,EACpB,GACA,GACiD;CAGjD,IAAM,EACJ,YACA,aACA,UACA,WACA,WAAQ,GACR,UAAO,GACP,oBAAiB,WACf;CAmBJ,OAjBI,EAAmB,GAAU,CAAK,IAAU;EAAE,MAAM,CAAC;EAAG,SAAS;CAAM,IAiBpE,GACL,MAhBiB,EAAc,GAAQ;EACvC;EACA,UAAU;EACV,WAAW;GACT,OAAO,EAAgC;IACrC,YAAY,EAAW,CAAQ;IAC/B,SAAS;IACT,QAAQ,GAAQ,YAAY;GAC9B,CAAC;GACD;GACA;GACA;EACF;CACF,CAAC,GAGM,YAAY,KAAK,MAAQ,EAAuB,CAAG,CAAC,GACzD,CACF;AACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Batched sibling of `QuoteEventsForQuoteByTypeDocument`: read
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Batched sibling of `QuoteEventsForQuoteByTypeDocument`: read `QuoteEvent`s for
|
|
3
|
+
* **many** quote ids in one round-trip, merged and sorted server-side by
|
|
4
|
+
* `timestamp`. Filters on the protocol-level `quoteId` scalar via `quoteId_in` —
|
|
5
|
+
* the same batching `QuotesFundingDocument` uses — so callers never need the
|
|
6
|
+
* diamond address. The action builds `$where`: `quoteId_in` always, `type_in`
|
|
7
|
+
* and `source` only when passed.
|
|
7
8
|
*
|
|
8
9
|
* The field selection is deliberately identical to the single-quote document so
|
|
9
10
|
* `toQuoteEventRow` decodes both without change.
|
|
@@ -11,8 +12,7 @@
|
|
|
11
12
|
* The document compiles to a typed query string via graphql-codegen.
|
|
12
13
|
*/
|
|
13
14
|
export declare const QuoteEventsForQuotesByTypeDocument: import('../../symmio-subgraph/types/generated/analytics/graphql.js').TypedDocumentString<import('../../symmio-subgraph/types/generated/analytics/graphql.js').QuoteEventsForQuotesByTypeQuery, {
|
|
14
|
-
|
|
15
|
-
typeIn: Array<string> | string;
|
|
15
|
+
where: import('../../symmio-subgraph/types/generated/analytics/graphql.js').QuoteEvent_Filter;
|
|
16
16
|
first: number;
|
|
17
17
|
skip: number;
|
|
18
18
|
orderDirection: import('../../symmio-subgraph/types/generated/analytics/graphql.js').OrderDirection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-document.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quotes-events-by-type/query-document.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"query-document.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quotes-events-by-type/query-document.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kCAAkC;;;;;EAiB7C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { graphql as e } from "../../symmio-subgraph/types/generated/analytics/gql.js";
|
|
2
2
|
//#region src/quotes/get-quotes-events-by-type/query-document.ts
|
|
3
|
-
var t = e("\n query QuoteEventsForQuotesByType(\n $
|
|
3
|
+
var t = e("\n query QuoteEventsForQuotesByType(\n $where: QuoteEvent_filter!\n $first: Int!\n $skip: Int!\n $orderDirection: OrderDirection!\n ) {\n quoteEvents(first: $first, skip: $skip, orderBy: timestamp, orderDirection: $orderDirection, where: $where) {\n id\n type\n metadata\n timestamp\n blockNumber\n transaction\n quoteId\n }\n }\n");
|
|
4
4
|
//#endregion
|
|
5
5
|
export { t as QuoteEventsForQuotesByTypeDocument };
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quotes-events-by-type/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Batched sibling of `QuoteEventsForQuoteByTypeDocument`: read
|
|
1
|
+
{"version":3,"file":"query-document.js","names":[],"sources":["../../../src/quotes/get-quotes-events-by-type/query-document.ts"],"sourcesContent":["import { graphql } from \"../../symmio-subgraph/types/generated/analytics\";\n\n/**\n * Batched sibling of `QuoteEventsForQuoteByTypeDocument`: read `QuoteEvent`s for\n * **many** quote ids in one round-trip, merged and sorted server-side by\n * `timestamp`. Filters on the protocol-level `quoteId` scalar via `quoteId_in` —\n * the same batching `QuotesFundingDocument` uses — so callers never need the\n * diamond address. The action builds `$where`: `quoteId_in` always, `type_in`\n * and `source` only when passed.\n *\n * The field selection is deliberately identical to the single-quote document so\n * `toQuoteEventRow` decodes both without change.\n *\n * The document compiles to a typed query string via graphql-codegen.\n */\nexport const QuoteEventsForQuotesByTypeDocument = graphql(`\n query QuoteEventsForQuotesByType(\n $where: QuoteEvent_filter!\n $first: Int!\n $skip: Int!\n $orderDirection: OrderDirection!\n ) {\n quoteEvents(first: $first, skip: $skip, orderBy: timestamp, orderDirection: $orderDirection, where: $where) {\n id\n type\n metadata\n timestamp\n blockNumber\n transaction\n quoteId\n }\n }\n`);\n"],"mappings":";;AAeA,IAAa,IAAqC,EAAQ,oYAiBzD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Config } from '../../core/config/index.js';
|
|
2
2
|
import { Compute, ConfigKeyParameter } from '../../shared/types/properties.js';
|
|
3
3
|
import { QueryParameter, SymmioQueryOptions } from '../../shared/types/query.js';
|
|
4
|
+
import { QuoteEventType, QuoteSubgraphEventType } from '../get-quote-events-by-type/types.js';
|
|
4
5
|
import { GetQuotesEventsByTypeParameters, GetQuotesEventsByTypeReturnType } from './get-quotes-events-by-type.js';
|
|
5
6
|
/** Data resolved by the {@link getQuotesEventsByTypeQueryOptions} query. */
|
|
6
|
-
export type GetQuotesEventsByTypeData = GetQuotesEventsByTypeReturnType
|
|
7
|
+
export type GetQuotesEventsByTypeData<TType extends QuoteSubgraphEventType = QuoteEventType> = GetQuotesEventsByTypeReturnType<TType>;
|
|
7
8
|
/**
|
|
8
9
|
* Build the TanStack Query key for {@link getQuotesEventsByTypeQueryOptions}.
|
|
9
10
|
*
|
|
@@ -12,8 +13,8 @@ export type GetQuotesEventsByTypeData = GetQuotesEventsByTypeReturnType;
|
|
|
12
13
|
* the key is JSON-safe, and sorted so id order does not fragment the cache.
|
|
13
14
|
*/
|
|
14
15
|
export declare function getQuotesEventsByTypeQueryKey(options: Compute<GetQuotesEventsByTypeParameters & ConfigKeyParameter>): readonly ["getQuotesEventsByType", {
|
|
16
|
+
readonly types?: QuoteSubgraphEventType[] | undefined;
|
|
15
17
|
readonly quoteIds: string[];
|
|
16
|
-
readonly types: readonly import('../index.js').QuoteEventType[];
|
|
17
18
|
}];
|
|
18
19
|
/** Query-key type produced by {@link getQuotesEventsByTypeQueryKey}. */
|
|
19
20
|
export type GetQuotesEventsByTypeQueryKey = ReturnType<typeof getQuotesEventsByTypeQueryKey>;
|
|
@@ -21,12 +22,13 @@ export type GetQuotesEventsByTypeQueryKey = ReturnType<typeof getQuotesEventsByT
|
|
|
21
22
|
* Options accepted by {@link getQuotesEventsByTypeQueryOptions}: the action's
|
|
22
23
|
* parameters plus TanStack overrides.
|
|
23
24
|
*/
|
|
24
|
-
export type GetQuotesEventsByTypeOptions = Compute<GetQuotesEventsByTypeParameters & QueryParameter<GetQuotesEventsByTypeData
|
|
25
|
+
export type GetQuotesEventsByTypeOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType> = Compute<GetQuotesEventsByTypeParameters<TType> & QueryParameter<GetQuotesEventsByTypeData<TType>, Error, GetQuotesEventsByTypeData<TType>, GetQuotesEventsByTypeQueryKey>>;
|
|
25
26
|
/** TanStack Query options returned by {@link getQuotesEventsByTypeQueryOptions}. */
|
|
26
|
-
export type GetQuotesEventsByTypeQueryOptions = SymmioQueryOptions<GetQuotesEventsByTypeData
|
|
27
|
+
export type GetQuotesEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteEventType> = SymmioQueryOptions<GetQuotesEventsByTypeData<TType>, Error, GetQuotesEventsByTypeData<TType>, GetQuotesEventsByTypeQueryKey>;
|
|
27
28
|
/**
|
|
28
29
|
* Build TanStack Query options for {@link getQuotesEventsByType}. The query is
|
|
29
|
-
* disabled until at least one quote id
|
|
30
|
+
* disabled until at least one quote id is supplied, and while `types` is an
|
|
31
|
+
* empty array; omitting `types` reads every type.
|
|
30
32
|
*
|
|
31
33
|
* @param config - The SDK config.
|
|
32
34
|
* @param options - Query parameters and TanStack overrides.
|
|
@@ -42,5 +44,5 @@ export type GetQuotesEventsByTypeQueryOptions = SymmioQueryOptions<GetQuotesEven
|
|
|
42
44
|
* );
|
|
43
45
|
* ```
|
|
44
46
|
*/
|
|
45
|
-
export declare function getQuotesEventsByTypeQueryOptions(config: Config, options: GetQuotesEventsByTypeOptions): GetQuotesEventsByTypeQueryOptions
|
|
47
|
+
export declare function getQuotesEventsByTypeQueryOptions<TType extends QuoteSubgraphEventType = QuoteSubgraphEventType>(config: Config, options: GetQuotesEventsByTypeOptions<TType>): GetQuotesEventsByTypeQueryOptions<TType>;
|
|
46
48
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/quotes/get-quotes-events-by-type/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnF,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,6BAA6B,CAAC;AAErC,4EAA4E;AAC5E,MAAM,MAAM,yBAAyB,GA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;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,SAAS,sBAAsB,GAAG,sBAAsB,EAC7G,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,CAAC,KAAK,CAAC,GAC3C,iCAAiC,CAAC,KAAK,CAAC,CAmB1C"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import { filterQueryOptions as e } from "../../shared/utils/query.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { hasEmptyListFilter as t } from "../../symmio-subgraph/subgraph-filters.js";
|
|
3
|
+
import { toQuoteIdKeyPart as n } from "../quote-id-key-part.js";
|
|
4
|
+
import { getQuotesEventsByType as r } from "./get-quotes-events-by-type.js";
|
|
4
5
|
//#region src/quotes/get-quotes-events-by-type/query.ts
|
|
5
|
-
function
|
|
6
|
+
function i(t) {
|
|
6
7
|
return ["getQuotesEventsByType", {
|
|
7
|
-
...e(
|
|
8
|
-
quoteIds: t
|
|
9
|
-
types: [...
|
|
8
|
+
...e(t),
|
|
9
|
+
quoteIds: n(t.quoteIds),
|
|
10
|
+
...t.types === void 0 ? {} : { types: [...t.types] }
|
|
10
11
|
}];
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function a(e, n) {
|
|
13
14
|
return {
|
|
14
|
-
...
|
|
15
|
-
queryKey:
|
|
16
|
-
...
|
|
17
|
-
configKey: e.getChainConfigKey(
|
|
15
|
+
...n.query,
|
|
16
|
+
queryKey: i({
|
|
17
|
+
...n,
|
|
18
|
+
configKey: e.getChainConfigKey(n.chainId)
|
|
18
19
|
}),
|
|
19
|
-
enabled: (
|
|
20
|
-
queryFn: () =>
|
|
21
|
-
chainId:
|
|
22
|
-
quoteIds:
|
|
23
|
-
types:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
enabled: (n.query?.enabled ?? !0) && !t(n.quoteIds, n.types),
|
|
21
|
+
queryFn: () => r(e, {
|
|
22
|
+
chainId: n.chainId,
|
|
23
|
+
quoteIds: n.quoteIds,
|
|
24
|
+
types: n.types,
|
|
25
|
+
source: n.source,
|
|
26
|
+
first: n.first,
|
|
27
|
+
skip: n.skip,
|
|
28
|
+
orderDirection: n.orderDirection
|
|
27
29
|
})
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
//#endregion
|
|
31
|
-
export {
|
|
33
|
+
export { i as getQuotesEventsByTypeQueryKey, a as getQuotesEventsByTypeQueryOptions };
|
|
32
34
|
|
|
33
35
|
//# sourceMappingURL=query.js.map
|