@proof-labs/trading-sdk 9.1.0 → 9.2.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/block-header.d.ts +13 -0
- package/dist/block-header.d.ts.map +1 -0
- package/dist/block-header.js +29 -0
- package/dist/block-header.js.map +1 -0
- package/dist/block-results-window.d.ts +58 -0
- package/dist/block-results-window.d.ts.map +1 -0
- package/dist/block-results-window.js +140 -0
- package/dist/block-results-window.js.map +1 -0
- package/dist/bounded-read.d.ts +47 -0
- package/dist/bounded-read.d.ts.map +1 -0
- package/dist/bounded-read.js +288 -0
- package/dist/bounded-read.js.map +1 -0
- package/dist/chain-evidence.d.ts +37 -0
- package/dist/chain-evidence.d.ts.map +1 -0
- package/dist/chain-evidence.js +123 -0
- package/dist/chain-evidence.js.map +1 -0
- package/dist/client.d.ts +3 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -4
- package/dist/client.js.map +1 -1
- package/dist/committed-transaction.d.ts +34 -0
- package/dist/committed-transaction.d.ts.map +1 -0
- package/dist/committed-transaction.js +58 -0
- package/dist/committed-transaction.js.map +1 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -1
- package/dist/finalized-account-reads.d.ts +75 -0
- package/dist/finalized-account-reads.d.ts.map +1 -0
- package/dist/finalized-account-reads.js +199 -0
- package/dist/finalized-account-reads.js.map +1 -0
- package/dist/finalized-oracle-read.d.ts +10 -0
- package/dist/finalized-oracle-read.d.ts.map +1 -0
- package/dist/finalized-oracle-read.js +25 -0
- package/dist/finalized-oracle-read.js.map +1 -0
- package/dist/finalized-orderbook.d.ts +23 -0
- package/dist/finalized-orderbook.d.ts.map +1 -0
- package/dist/finalized-orderbook.js +92 -0
- package/dist/finalized-orderbook.js.map +1 -0
- package/dist/finalized-state-reads.d.ts +21 -0
- package/dist/finalized-state-reads.d.ts.map +1 -0
- package/dist/finalized-state-reads.js +66 -0
- package/dist/finalized-state-reads.js.map +1 -0
- package/dist/financial-state.d.ts.map +1 -1
- package/dist/financial-state.js +12 -56
- package/dist/financial-state.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/market-snapshot.d.ts +3 -0
- package/dist/market-snapshot.d.ts.map +1 -1
- package/dist/market-snapshot.js +16 -38
- package/dist/market-snapshot.js.map +1 -1
- package/dist/read-values.d.ts +49 -0
- package/dist/read-values.d.ts.map +1 -0
- package/dist/read-values.js +88 -0
- package/dist/read-values.js.map +1 -0
- package/dist/trade-history.d.ts +50 -0
- package/dist/trade-history.d.ts.map +1 -0
- package/dist/trade-history.js +135 -0
- package/dist/trade-history.js.map +1 -0
- package/dist/typed-gateway-reads.d.ts +54 -0
- package/dist/typed-gateway-reads.d.ts.map +1 -0
- package/dist/typed-gateway-reads.js +92 -0
- package/dist/typed-gateway-reads.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { GatewayReadError } from "./errors.js";
|
|
2
|
+
declare const hexAddressBrand: unique symbol;
|
|
3
|
+
declare const hashBrand: unique symbol;
|
|
4
|
+
declare const marketBrand: unique symbol;
|
|
5
|
+
export type HexAddress = string & {
|
|
6
|
+
readonly [hexAddressBrand]: true;
|
|
7
|
+
};
|
|
8
|
+
export type Hash32Hex = string & {
|
|
9
|
+
readonly [hashBrand]: true;
|
|
10
|
+
};
|
|
11
|
+
export type MarketId = number & {
|
|
12
|
+
readonly [marketBrand]: true;
|
|
13
|
+
};
|
|
14
|
+
export declare const U64_MAX: bigint;
|
|
15
|
+
export declare const I64_MAX: bigint;
|
|
16
|
+
export declare const MAX_DATE_MS = 8640000000000000;
|
|
17
|
+
export declare const DEFAULT_READ_TIMEOUT_MS = 5000;
|
|
18
|
+
export declare const MAX_READ_TIMEOUT_MS = 60000;
|
|
19
|
+
/** Whole HTTP envelope, not decoded MessagePack. Same cap as gateway #267. */
|
|
20
|
+
export declare const MAX_READ_BYTES: number;
|
|
21
|
+
export declare const MAX_READ_CHUNKS = 4096;
|
|
22
|
+
/** Longest an HTTP failure waits for its body. The status is the diagnosis,
|
|
23
|
+
* so a stalled error body must not cost the caller the whole read deadline. */
|
|
24
|
+
export declare const MAX_ERROR_BODY_WAIT_MS = 250;
|
|
25
|
+
export declare function invalidRead(field: string, kind?: GatewayReadError["kind"]): never;
|
|
26
|
+
export declare function hexAddress(value: unknown, field?: string): HexAddress;
|
|
27
|
+
/** Hashes use uppercase, matching CometBFT and the existing SDK tx hash. */
|
|
28
|
+
export declare function hash32(value: unknown, field?: string): Hash32Hex;
|
|
29
|
+
export declare function marketId(value: unknown): MarketId;
|
|
30
|
+
export declare function readObject(value: unknown, field: string): Record<string, unknown>;
|
|
31
|
+
export declare function canonicalBase64(value: unknown, field: string, maxBytes: number): Uint8Array;
|
|
32
|
+
/** Preserve nanoseconds for ordering; epoch milliseconds elsewhere are explicit units. */
|
|
33
|
+
export declare function rfc3339(value: unknown, field?: string): {
|
|
34
|
+
raw: string;
|
|
35
|
+
nanos: bigint;
|
|
36
|
+
};
|
|
37
|
+
/** One monotonic deadline shared by every request in a logical read. */
|
|
38
|
+
export declare function readDeadline(options: {
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}): {
|
|
42
|
+
timeoutMs: number;
|
|
43
|
+
remaining: () => {
|
|
44
|
+
signal: AbortSignal | undefined;
|
|
45
|
+
timeoutMs: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=read-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-values.d.ts","sourceRoot":"","sources":["../src/read-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,CAAC,M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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzB;AACD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,UAAU,CAaZ;AACD,0FAA0F;AAC1F,wBAAgB,OAAO,CACrB,KAAK,EAAE,OAAO,EACd,KAAK,SAAe,GACnB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAqBhC;AACD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;;;EAuBA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { GatewayReadError } from "./errors.js";
|
|
2
|
+
export const U64_MAX = (1n << 64n) - 1n;
|
|
3
|
+
export const I64_MAX = (1n << 63n) - 1n;
|
|
4
|
+
export const MAX_DATE_MS = 8_640_000_000_000_000;
|
|
5
|
+
export const DEFAULT_READ_TIMEOUT_MS = 5_000;
|
|
6
|
+
export const MAX_READ_TIMEOUT_MS = 60_000;
|
|
7
|
+
/** Whole HTTP envelope, not decoded MessagePack. Same cap as gateway #267. */
|
|
8
|
+
export const MAX_READ_BYTES = 1024 * 1024;
|
|
9
|
+
export const MAX_READ_CHUNKS = 4096;
|
|
10
|
+
/** Longest an HTTP failure waits for its body. The status is the diagnosis,
|
|
11
|
+
* so a stalled error body must not cost the caller the whole read deadline. */
|
|
12
|
+
export const MAX_ERROR_BODY_WAIT_MS = 250;
|
|
13
|
+
export function invalidRead(field, kind = "malformed") {
|
|
14
|
+
throw new GatewayReadError(kind, field);
|
|
15
|
+
}
|
|
16
|
+
export function hexAddress(value, field = "address") {
|
|
17
|
+
if (typeof value !== "string" || !/^[a-f0-9]{40}$/.test(value))
|
|
18
|
+
invalidRead(field);
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
/** Hashes use uppercase, matching CometBFT and the existing SDK tx hash. */
|
|
22
|
+
export function hash32(value, field = "hash") {
|
|
23
|
+
if (typeof value !== "string" || !/^[a-fA-F0-9]{64}$/.test(value))
|
|
24
|
+
invalidRead(field);
|
|
25
|
+
return value.toUpperCase();
|
|
26
|
+
}
|
|
27
|
+
export function marketId(value) {
|
|
28
|
+
if (typeof value !== "number" ||
|
|
29
|
+
!Number.isInteger(value) ||
|
|
30
|
+
value < 1 ||
|
|
31
|
+
value > 0xffffffff)
|
|
32
|
+
invalidRead("market");
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
export function readObject(value, field) {
|
|
36
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
37
|
+
invalidRead(field);
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function canonicalBase64(value, field, maxBytes) {
|
|
41
|
+
if (typeof value !== "string" ||
|
|
42
|
+
!value.length ||
|
|
43
|
+
value.length > Math.ceil(maxBytes / 3) * 4 ||
|
|
44
|
+
!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value))
|
|
45
|
+
invalidRead(field);
|
|
46
|
+
const text = atob(value);
|
|
47
|
+
if (text.length > maxBytes || btoa(text) !== value)
|
|
48
|
+
invalidRead(field);
|
|
49
|
+
return Uint8Array.from(text, (c) => c.charCodeAt(0));
|
|
50
|
+
}
|
|
51
|
+
/** Preserve nanoseconds for ordering; epoch milliseconds elsewhere are explicit units. */
|
|
52
|
+
export function rfc3339(value, field = "block time") {
|
|
53
|
+
if (typeof value !== "string" ||
|
|
54
|
+
!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/.test(value))
|
|
55
|
+
invalidRead(field);
|
|
56
|
+
const raw = value;
|
|
57
|
+
const ms = Date.parse(raw);
|
|
58
|
+
if (!Number.isFinite(ms) ||
|
|
59
|
+
ms < 0 ||
|
|
60
|
+
new Date(ms).toISOString().slice(0, 19) !== raw.slice(0, 19))
|
|
61
|
+
invalidRead(field);
|
|
62
|
+
const fraction = raw.slice(19, -1).replace(/^\./, "").padEnd(9, "0");
|
|
63
|
+
return {
|
|
64
|
+
raw,
|
|
65
|
+
nanos: BigInt(Date.parse(`${raw.slice(0, 19)}Z`)) * 1000000n +
|
|
66
|
+
BigInt(fraction),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** One monotonic deadline shared by every request in a logical read. */
|
|
70
|
+
export function readDeadline(options) {
|
|
71
|
+
const signal = options.signal;
|
|
72
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_READ_TIMEOUT_MS;
|
|
73
|
+
if (!Number.isSafeInteger(timeoutMs) ||
|
|
74
|
+
timeoutMs < 1 ||
|
|
75
|
+
timeoutMs > MAX_READ_TIMEOUT_MS)
|
|
76
|
+
invalidRead("timeout", "configuration");
|
|
77
|
+
signal?.throwIfAborted();
|
|
78
|
+
const deadline = performance.now() + timeoutMs;
|
|
79
|
+
const remaining = () => {
|
|
80
|
+
signal?.throwIfAborted();
|
|
81
|
+
const left = Math.floor(deadline - performance.now());
|
|
82
|
+
if (left < 1)
|
|
83
|
+
throw new GatewayReadError("deadline", "timeout", "Gateway read deadline exceeded");
|
|
84
|
+
return { signal, timeoutMs: left };
|
|
85
|
+
};
|
|
86
|
+
return { timeoutMs, remaining };
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=read-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-values.js","sourceRoot":"","sources":["../src/read-values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ/C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CA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EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrC,CAAC,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type MarketId, type HexAddress } from "./read-values.js";
|
|
2
|
+
import { Side } from "./types.js";
|
|
3
|
+
import type { ExchangeHttpTransport } from "./http-transport.js";
|
|
4
|
+
import { type BoundedReadOptions } from "./bounded-read.js";
|
|
5
|
+
export interface TradeHistoryOptions extends BoundedReadOptions {
|
|
6
|
+
/** Fixed inclusive lower and exclusive upper block-time bounds, epoch ms. */
|
|
7
|
+
fromMs: number;
|
|
8
|
+
toMs: number;
|
|
9
|
+
/** 1–1000; defaults to 200. Keep all filters fixed when following a cursor. */
|
|
10
|
+
limit?: number;
|
|
11
|
+
/** Opaque indexer cursor. Never decode or numerically coerce it. */
|
|
12
|
+
cursor?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ParticipantTrade {
|
|
15
|
+
fillId: bigint;
|
|
16
|
+
market: MarketId;
|
|
17
|
+
blockHeight: bigint;
|
|
18
|
+
/** Original RFC3339 string, retaining fractional-second precision. */
|
|
19
|
+
blockTime: string;
|
|
20
|
+
/** Exact NUMERIC text as indexed, without conversion or rounding. Rows
|
|
21
|
+
* from the current engine are integer micro-USDC (6 dp) with the column's
|
|
22
|
+
* six-digit zero tail, e.g. "66750000000.000000" = $66,750. Archived rows
|
|
23
|
+
* may hold decimal prices; the SDK does not normalize their scale. */
|
|
24
|
+
price: string;
|
|
25
|
+
/** Exact NUMERIC text of an integer contract count. */
|
|
26
|
+
quantity: string;
|
|
27
|
+
makerOwner: HexAddress;
|
|
28
|
+
takerOwner: HexAddress;
|
|
29
|
+
makerSide: Side;
|
|
30
|
+
takerFee: bigint;
|
|
31
|
+
makerFee: bigint;
|
|
32
|
+
}
|
|
33
|
+
export interface TradeHistoryPage {
|
|
34
|
+
market: MarketId;
|
|
35
|
+
/** The request's bounds, not an assertion of indexer freshness/completeness. */
|
|
36
|
+
fromMs: number;
|
|
37
|
+
toMs: number;
|
|
38
|
+
trades: ParticipantTrade[];
|
|
39
|
+
/** Absent ends this indexed range, not proof of ingestion completeness. */
|
|
40
|
+
nextCursor?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function tradeHistorySearchParams(market: number, options: TradeHistoryOptions): URLSearchParams;
|
|
43
|
+
/** One indexed page only, not proof of completeness. Callers MUST keep filters
|
|
44
|
+
* fixed, track all seen cursors and fill IDs, and compare (blockTime, fillId)
|
|
45
|
+
* across boundaries. Cursor cycles, duplicates and skipped rows across pages
|
|
46
|
+
* are not detectable by a stateless decoder. Use complete chain evidence when
|
|
47
|
+
* absence/completeness matters. No self-trade filtering or units conversion. */
|
|
48
|
+
export declare function decodeTradeHistoryPage(value: unknown, market: number, options: TradeHistoryOptions): TradeHistoryPage;
|
|
49
|
+
export declare function readTradeHistoryPage(gatewayUrl: string, market: number, options: TradeHistoryOptions, transport: ExchangeHttpTransport): Promise<TradeHistoryPage>;
|
|
50
|
+
//# sourceMappingURL=trade-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-history.d.ts","sourceRoot":"","sources":["../src/trade-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAUhF,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB;;;0EAGsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,QAAQ,CAAC;IACjB,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAwCD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC3B,eAAe,CA2BjB;AAED;;;;gFAIgF;AAChF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC3B,gBAAgB,CAiElB;AAED,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,EAC5B,SAAS,EAAE,qBAAqB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { I64_MAX, MAX_DATE_MS, hexAddress, invalidRead, marketId, rfc3339, } from "./read-values.js";
|
|
2
|
+
import { Side } from "./types.js";
|
|
3
|
+
import { boundedGatewayJson } from "./bounded-read.js";
|
|
4
|
+
const DEFAULT_TRADE_HISTORY_LIMIT = 200;
|
|
5
|
+
const MAX_TRADE_HISTORY_LIMIT = 1000;
|
|
6
|
+
const MAX_CURSOR_LENGTH = 4096;
|
|
7
|
+
const MAX_NUMERIC_TEXT_LENGTH = 100;
|
|
8
|
+
/** The indexer stores markets as signed i32. */
|
|
9
|
+
const INDEXER_MAX_MARKET = 0x7fff_ffff;
|
|
10
|
+
function invalid(field, kind = "malformed") {
|
|
11
|
+
return invalidRead(`trade history.${field}`, kind);
|
|
12
|
+
}
|
|
13
|
+
function integer(value, field, signed = false) {
|
|
14
|
+
const n = typeof value === "number" && Number.isSafeInteger(value)
|
|
15
|
+
? BigInt(value)
|
|
16
|
+
: typeof value === "string" &&
|
|
17
|
+
/^(0|[1-9][0-9]*|-[1-9][0-9]*)$/.test(value) &&
|
|
18
|
+
value.length <= 20
|
|
19
|
+
? BigInt(value)
|
|
20
|
+
: invalid(field);
|
|
21
|
+
if (n < (signed ? -(1n << 63n) : 0n) || n > I64_MAX)
|
|
22
|
+
invalid(field);
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
function numeric(value, field) {
|
|
26
|
+
if (typeof value !== "string" ||
|
|
27
|
+
value.length > MAX_NUMERIC_TEXT_LENGTH ||
|
|
28
|
+
!/^(0|[1-9][0-9]*)(\.[0-9]+)?$/.test(value))
|
|
29
|
+
invalid(field);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function cursor(value) {
|
|
33
|
+
if (typeof value !== "string" ||
|
|
34
|
+
value.length > MAX_CURSOR_LENGTH ||
|
|
35
|
+
Array.from(value).some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127))
|
|
36
|
+
invalid("cursor");
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
export function tradeHistorySearchParams(market, options) {
|
|
40
|
+
marketId(market);
|
|
41
|
+
// Indexer storage uses signed i32; do not broaden its route contract.
|
|
42
|
+
if (market > INDEXER_MAX_MARKET)
|
|
43
|
+
invalid("market outside indexer range");
|
|
44
|
+
if (!Number.isSafeInteger(options.fromMs) ||
|
|
45
|
+
!Number.isSafeInteger(options.toMs) ||
|
|
46
|
+
options.fromMs < 0 ||
|
|
47
|
+
options.toMs <= options.fromMs ||
|
|
48
|
+
options.toMs > MAX_DATE_MS)
|
|
49
|
+
invalid("window");
|
|
50
|
+
const limit = options.limit ?? DEFAULT_TRADE_HISTORY_LIMIT;
|
|
51
|
+
if (!Number.isSafeInteger(limit) ||
|
|
52
|
+
limit < 1 ||
|
|
53
|
+
limit > MAX_TRADE_HISTORY_LIMIT)
|
|
54
|
+
invalid("limit");
|
|
55
|
+
const params = new URLSearchParams({
|
|
56
|
+
from: String(options.fromMs),
|
|
57
|
+
to: String(options.toMs),
|
|
58
|
+
limit: String(limit),
|
|
59
|
+
});
|
|
60
|
+
if (options.cursor !== undefined)
|
|
61
|
+
params.set("cursor", cursor(options.cursor));
|
|
62
|
+
return params;
|
|
63
|
+
}
|
|
64
|
+
/** One indexed page only, not proof of completeness. Callers MUST keep filters
|
|
65
|
+
* fixed, track all seen cursors and fill IDs, and compare (blockTime, fillId)
|
|
66
|
+
* across boundaries. Cursor cycles, duplicates and skipped rows across pages
|
|
67
|
+
* are not detectable by a stateless decoder. Use complete chain evidence when
|
|
68
|
+
* absence/completeness matters. No self-trade filtering or units conversion. */
|
|
69
|
+
export function decodeTradeHistoryPage(value, market, options) {
|
|
70
|
+
tradeHistorySearchParams(market, options);
|
|
71
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
72
|
+
invalid("page");
|
|
73
|
+
const page = value;
|
|
74
|
+
const limit = options.limit ?? DEFAULT_TRADE_HISTORY_LIMIT;
|
|
75
|
+
if (!Array.isArray(page.fills) || page.fills.length > limit)
|
|
76
|
+
invalid("page size");
|
|
77
|
+
const nextCursor = cursor(page.next_cursor);
|
|
78
|
+
if (nextCursor &&
|
|
79
|
+
(page.fills.length !== limit || nextCursor === options.cursor))
|
|
80
|
+
invalid("non-progressing or truncated page");
|
|
81
|
+
let previous;
|
|
82
|
+
const ids = new Set();
|
|
83
|
+
const trades = page.fills.map((raw) => {
|
|
84
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
85
|
+
invalid("trade");
|
|
86
|
+
const row = raw;
|
|
87
|
+
if (row.market !== market)
|
|
88
|
+
invalid("market mismatch", "binding");
|
|
89
|
+
const fillId = integer(row.fill_id, "fill id");
|
|
90
|
+
const blockHeight = integer(row.block_height, "block height");
|
|
91
|
+
const block = rfc3339(row.block_time);
|
|
92
|
+
if (block.nanos < BigInt(options.fromMs) * 1000000n ||
|
|
93
|
+
block.nanos >= BigInt(options.toMs) * 1000000n)
|
|
94
|
+
invalid("trade outside window");
|
|
95
|
+
if (ids.has(fillId) ||
|
|
96
|
+
(previous &&
|
|
97
|
+
(block.nanos > previous.nanos ||
|
|
98
|
+
(block.nanos === previous.nanos && fillId >= previous.id))))
|
|
99
|
+
invalid("duplicate or unordered trade");
|
|
100
|
+
ids.add(fillId);
|
|
101
|
+
previous = { nanos: block.nanos, id: fillId };
|
|
102
|
+
if (row.maker_side !== "buy" &&
|
|
103
|
+
row.maker_side !== "sell" &&
|
|
104
|
+
row.maker_side !== "Buy" &&
|
|
105
|
+
row.maker_side !== "Sell")
|
|
106
|
+
invalid("maker side");
|
|
107
|
+
return {
|
|
108
|
+
fillId,
|
|
109
|
+
market: marketId(market),
|
|
110
|
+
blockHeight,
|
|
111
|
+
blockTime: block.raw,
|
|
112
|
+
price: numeric(row.price, "price"),
|
|
113
|
+
quantity: numeric(row.quantity, "quantity"),
|
|
114
|
+
makerOwner: hexAddress(row.maker_owner, "participant owner"),
|
|
115
|
+
takerOwner: hexAddress(row.taker_owner, "participant owner"),
|
|
116
|
+
makerSide: row.maker_side.toLowerCase() === "buy" ? Side.Buy : Side.Sell,
|
|
117
|
+
takerFee: integer(row.taker_fee, "taker fee", true),
|
|
118
|
+
makerFee: integer(row.maker_fee, "maker fee", true),
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
market: marketId(market),
|
|
123
|
+
fromMs: options.fromMs,
|
|
124
|
+
toMs: options.toMs,
|
|
125
|
+
trades,
|
|
126
|
+
...(nextCursor ? { nextCursor } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export async function readTradeHistoryPage(gatewayUrl, market, options, transport) {
|
|
130
|
+
const captured = { ...options };
|
|
131
|
+
const params = tradeHistorySearchParams(market, captured);
|
|
132
|
+
const body = await boundedGatewayJson(`${gatewayUrl.replace(/\/+$/, "")}/v1/history/trades/${market}?${params}`, transport, captured);
|
|
133
|
+
return decodeTradeHistoryPage(body, market, captured);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=trade-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-history.js","sourceRoot":"","sources":["../src/trade-history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,OAAO,GAGR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAA2B,MAAM,mBAAmB,CAAC;AAGhF,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAwCvC,SAAS,OAAO,CACd,KAAa,EACb,OAAiC,WAAW;IAE5C,OAAO,WAAW,CAAC,iBAAiB,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AACD,SAAS,OAAO,CAAC,KAAc,EAAE,KAAa,EAAE,MAAM,GAAG,KAAK;IAC5D,MAAM,CAAC,GACL,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EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC;YACnD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC;SACpD,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC;QACxB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM;QACN,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,UAAkB,EAClB,MAAc,EACd,OAA4B,EAC5B,SAAgC;IAEhC,MAAM,QAAQ,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,MAAM,kBAAkB,CACnC,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,sBAAsB,MAAM,IAAI,MAAM,EAAE,EACzE,SAAS,EACT,QAAQ,CACT,CAAC;IACF,OAAO,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type FinalizedOrderbook, type FinalizedOrderbookOptions } from "./finalized-orderbook.js";
|
|
2
|
+
import { type FinalizedOraclePermissions } from "./finalized-oracle-read.js";
|
|
3
|
+
import { type FinalizedAccountInfo, type FinalizedAccountState, type FinalizedAgentAuthorization, type FinalizedRecentNonces, type FinalizedOpenOrders, type FinalizedOpenOrdersOptions } from "./finalized-account-reads.js";
|
|
4
|
+
import type { BoundedReadOptions } from "./bounded-read.js";
|
|
5
|
+
import { type FinalizedMarketsSnapshot, type FinalizedFinancialState } from "./finalized-state-reads.js";
|
|
6
|
+
import type { BlockEvidenceHeader } from "./block-header.js";
|
|
7
|
+
import { type TransactionEvidence, type TransactionEvidenceSelection } from "./committed-transaction.js";
|
|
8
|
+
import { type BlockResultsWindow, type BlockResultsWindowSelection } from "./block-results-window.js";
|
|
9
|
+
import { type TradeHistoryOptions, type TradeHistoryPage } from "./trade-history.js";
|
|
10
|
+
import { GatewayReads } from "./gateway-reads.js";
|
|
11
|
+
import { type ExchangeHttpTransport } from "./http-transport.js";
|
|
12
|
+
import type { FinancialStateSelection } from "./financial-state.js";
|
|
13
|
+
declare class ReadClient {
|
|
14
|
+
protected readonly gatewayUrl: string;
|
|
15
|
+
protected readonly httpTransport: ExchangeHttpTransport;
|
|
16
|
+
protected readonly inventoryChainId?: Uint8Array | undefined;
|
|
17
|
+
constructor(gatewayUrl: string, httpTransport: ExchangeHttpTransport, inventoryChainId?: Uint8Array | undefined);
|
|
18
|
+
protected requirePinnedChain(purpose: string): Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
/** Same-view facts. See FinalizedReadWitness for the trust and binding boundary. */
|
|
21
|
+
export declare class FinalizedReads extends ReadClient {
|
|
22
|
+
account(owner: string, options?: BoundedReadOptions): Promise<FinalizedAccountInfo>;
|
|
23
|
+
accountState(owner: string, options?: BoundedReadOptions): Promise<FinalizedAccountState>;
|
|
24
|
+
agentAuthorization(owner: string, agent: string, options?: BoundedReadOptions): Promise<FinalizedAgentAuthorization>;
|
|
25
|
+
recentNonces(signer: string, options?: BoundedReadOptions): Promise<FinalizedRecentNonces>;
|
|
26
|
+
openOrders(owner: string, options?: FinalizedOpenOrdersOptions): Promise<FinalizedOpenOrders>;
|
|
27
|
+
financialState(selection: FinancialStateSelection, options?: BoundedReadOptions): Promise<FinalizedFinancialState>;
|
|
28
|
+
/** Defaults to `MARKETS_SNAPSHOT_TIMEOUT_MS` (10 seconds), the same deadline
|
|
29
|
+
* as `queryMarketsSnapshot`; an explicit `timeoutMs` still wins. */
|
|
30
|
+
marketsSnapshot(options?: BoundedReadOptions): Promise<FinalizedMarketsSnapshot>;
|
|
31
|
+
orderbook(market: number, options?: FinalizedOrderbookOptions): Promise<FinalizedOrderbook>;
|
|
32
|
+
oraclePermissions(market: number, options?: BoundedReadOptions): Promise<FinalizedOraclePermissions>;
|
|
33
|
+
}
|
|
34
|
+
/** Bounded chain evidence. A replay rejection never proves earlier non-admission. */
|
|
35
|
+
export declare class EvidenceReads extends ReadClient {
|
|
36
|
+
transaction(selection: TransactionEvidenceSelection, options?: BoundedReadOptions): Promise<TransactionEvidence>;
|
|
37
|
+
blockResultsWindow(selection: BlockResultsWindowSelection, options?: BoundedReadOptions): Promise<BlockResultsWindow>;
|
|
38
|
+
/** Fetches the whole block from `/v1/block` and keeps only its header, so a
|
|
39
|
+
* block whose response exceeds the 1 MiB read cap (`MAX_READ_BYTES`) fails
|
|
40
|
+
* with `GatewayReadError` kind `limit`. Lifting that needs a header-only
|
|
41
|
+
* gateway route. */
|
|
42
|
+
blockHeader(height: bigint, options?: BoundedReadOptions): Promise<BlockEvidenceHeader>;
|
|
43
|
+
}
|
|
44
|
+
/** Typed opt-in extension of reads(); always gateway-only, like existing reads(). */
|
|
45
|
+
export declare class TypedGatewayReads extends GatewayReads {
|
|
46
|
+
private readonly gatewayUrl;
|
|
47
|
+
private readonly httpTransport;
|
|
48
|
+
readonly finalized: FinalizedReads;
|
|
49
|
+
readonly evidence: EvidenceReads;
|
|
50
|
+
constructor(gatewayUrl: string, httpTransport: ExchangeHttpTransport, chain?: Uint8Array);
|
|
51
|
+
tradeHistoryPage(market: number, options: TradeHistoryOptions): Promise<TradeHistoryPage>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=typed-gateway-reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-gateway-reads.d.ts","sourceRoot":"","sources":["../src/typed-gateway-reads.ts"],"names":[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B;IACd,WAAW,CACf,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,mBAAmB,CAAC;CAShC;AACD,qFAAqF;AACrF,qBAAa,iBAAkB,SAAQ,YAAY;IAI/C,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAJhC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;gBAEd,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,qBAAqB,EACrD,KAAK,CAAC,EAAE,UAAU;IASd,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC;CAQ7B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { readFinalizedOrderbook, } from "./finalized-orderbook.js";
|
|
2
|
+
import { readFinalizedOraclePermissions, } from "./finalized-oracle-read.js";
|
|
3
|
+
import { readFinalizedAccount, readFinalizedAccountState, readFinalizedAgentAuthorization, readFinalizedRecentNonces, readFinalizedOpenOrders, } from "./finalized-account-reads.js";
|
|
4
|
+
import { readBlockHeader, readFinalizedMarketsSnapshot, readFinalizedFinancialState, } from "./finalized-state-reads.js";
|
|
5
|
+
import { readTransactionEvidence, } from "./committed-transaction.js";
|
|
6
|
+
import { readBlockResultsWindow, } from "./block-results-window.js";
|
|
7
|
+
import { readTradeHistoryPage, } from "./trade-history.js";
|
|
8
|
+
import { GatewayReads } from "./gateway-reads.js";
|
|
9
|
+
import { gatewayReadContext, } from "./http-transport.js";
|
|
10
|
+
import { GatewayReadError } from "./errors.js";
|
|
11
|
+
class ReadClient {
|
|
12
|
+
gatewayUrl;
|
|
13
|
+
httpTransport;
|
|
14
|
+
inventoryChainId;
|
|
15
|
+
constructor(gatewayUrl, httpTransport, inventoryChainId) {
|
|
16
|
+
this.gatewayUrl = gatewayUrl;
|
|
17
|
+
this.httpTransport = httpTransport;
|
|
18
|
+
this.inventoryChainId = inventoryChainId;
|
|
19
|
+
}
|
|
20
|
+
requirePinnedChain(purpose) {
|
|
21
|
+
if (!this.inventoryChainId)
|
|
22
|
+
throw new GatewayReadError("configuration", "chainId", `${purpose} requires an explicit pinned chainId`);
|
|
23
|
+
return Uint8Array.from(this.inventoryChainId);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Same-view facts. See FinalizedReadWitness for the trust and binding boundary. */
|
|
27
|
+
export class FinalizedReads extends ReadClient {
|
|
28
|
+
async account(owner, options = {}) {
|
|
29
|
+
return readFinalizedAccount(this.gatewayUrl, owner, options, this.httpTransport);
|
|
30
|
+
}
|
|
31
|
+
async accountState(owner, options = {}) {
|
|
32
|
+
return readFinalizedAccountState(this.gatewayUrl, owner, options, this.httpTransport);
|
|
33
|
+
}
|
|
34
|
+
async agentAuthorization(owner, agent, options = {}) {
|
|
35
|
+
return readFinalizedAgentAuthorization(this.gatewayUrl, owner, agent, options, this.httpTransport);
|
|
36
|
+
}
|
|
37
|
+
async recentNonces(signer, options = {}) {
|
|
38
|
+
return readFinalizedRecentNonces(this.gatewayUrl, signer, options, this.httpTransport);
|
|
39
|
+
}
|
|
40
|
+
async openOrders(owner, options = {}) {
|
|
41
|
+
return readFinalizedOpenOrders(this.gatewayUrl, owner, options, this.httpTransport);
|
|
42
|
+
}
|
|
43
|
+
async financialState(selection, options = {}) {
|
|
44
|
+
return readFinalizedFinancialState(this.gatewayUrl, selection, options, this.httpTransport);
|
|
45
|
+
}
|
|
46
|
+
/** Defaults to `MARKETS_SNAPSHOT_TIMEOUT_MS` (10 seconds), the same deadline
|
|
47
|
+
* as `queryMarketsSnapshot`; an explicit `timeoutMs` still wins. */
|
|
48
|
+
async marketsSnapshot(options = {}) {
|
|
49
|
+
return readFinalizedMarketsSnapshot(this.gatewayUrl, this.requirePinnedChain("marketsSnapshot"), options, this.httpTransport);
|
|
50
|
+
}
|
|
51
|
+
async orderbook(market, options = {}) {
|
|
52
|
+
return readFinalizedOrderbook(this.gatewayUrl, market, options, this.httpTransport);
|
|
53
|
+
}
|
|
54
|
+
async oraclePermissions(market, options = {}) {
|
|
55
|
+
return readFinalizedOraclePermissions(this.gatewayUrl, market, options, this.httpTransport);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Bounded chain evidence. A replay rejection never proves earlier non-admission. */
|
|
59
|
+
export class EvidenceReads extends ReadClient {
|
|
60
|
+
async transaction(selection, options = {}) {
|
|
61
|
+
return readTransactionEvidence(this.gatewayUrl, this.requirePinnedChain("transaction"), selection, options, this.httpTransport);
|
|
62
|
+
}
|
|
63
|
+
async blockResultsWindow(selection, options = {}) {
|
|
64
|
+
return readBlockResultsWindow(this.gatewayUrl, this.requirePinnedChain("blockResultsWindow"), selection, options, this.httpTransport);
|
|
65
|
+
}
|
|
66
|
+
/** Fetches the whole block from `/v1/block` and keeps only its header, so a
|
|
67
|
+
* block whose response exceeds the 1 MiB read cap (`MAX_READ_BYTES`) fails
|
|
68
|
+
* with `GatewayReadError` kind `limit`. Lifting that needs a header-only
|
|
69
|
+
* gateway route. */
|
|
70
|
+
async blockHeader(height, options = {}) {
|
|
71
|
+
return readBlockHeader(this.gatewayUrl, this.requirePinnedChain("blockHeader"), height, options, this.httpTransport);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Typed opt-in extension of reads(); always gateway-only, like existing reads(). */
|
|
75
|
+
export class TypedGatewayReads extends GatewayReads {
|
|
76
|
+
gatewayUrl;
|
|
77
|
+
httpTransport;
|
|
78
|
+
finalized;
|
|
79
|
+
evidence;
|
|
80
|
+
constructor(gatewayUrl, httpTransport, chain) {
|
|
81
|
+
super(gatewayUrl, (url, init) => httpTransport(url, init, gatewayReadContext(url, init)));
|
|
82
|
+
this.gatewayUrl = gatewayUrl;
|
|
83
|
+
this.httpTransport = httpTransport;
|
|
84
|
+
const pin = chain ? Uint8Array.from(chain) : undefined;
|
|
85
|
+
this.finalized = new FinalizedReads(gatewayUrl, httpTransport, pin);
|
|
86
|
+
this.evidence = new EvidenceReads(gatewayUrl, httpTransport, pin);
|
|
87
|
+
}
|
|
88
|
+
async tradeHistoryPage(market, options) {
|
|
89
|
+
return readTradeHistoryPage(this.gatewayUrl, market, options, this.httpTransport);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=typed-gateway-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-gateway-reads.js","sourceRoot":"","sources":["../src/typed-gateway-reads.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAGvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,8BAA8B,GAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EAEpB,yBAAyB,EACzB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,GAMxB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,GAG5B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,uBAAuB,GAGxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,GAGvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,oBAAoB,GAGrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,UAAU;IAEO;IACA;IACA;IAHrB,YACqB,UAAkB,EAClB,aAAoC,EACpC,gBAA6B;QAF7B,eAAU,GAAV,UAAU,CAAQ;QAClB,kBAAa,GAAb,aAAa,CAAuB;QACpC,qBAAgB,GAAhB,gBAAgB,CAAa;IAC/C,CAAC;IACM,kBAAkB,CAAC,OAAe;QAC1C,IAAI,CAA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