@proof-labs/trading-sdk 9.2.0 → 10.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/README.md +11 -15
- package/dist/account-history.d.ts +94 -0
- package/dist/account-history.d.ts.map +1 -0
- package/dist/account-history.js +226 -0
- package/dist/account-history.js.map +1 -0
- package/dist/block-results-window.d.ts +25 -12
- package/dist/block-results-window.d.ts.map +1 -1
- package/dist/block-results-window.js +51 -21
- package/dist/block-results-window.js.map +1 -1
- package/dist/bounded-read.d.ts +3 -0
- package/dist/bounded-read.d.ts.map +1 -1
- package/dist/bounded-read.js +5 -4
- package/dist/bounded-read.js.map +1 -1
- package/dist/client.d.ts +54 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +91 -13
- package/dist/client.js.map +1 -1
- package/dist/codec-adapter.d.ts +0 -2
- package/dist/codec-adapter.d.ts.map +1 -1
- package/dist/codec-adapter.js +4 -23
- package/dist/codec-adapter.js.map +1 -1
- package/dist/errors.d.ts +8 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +33 -32
- package/dist/errors.js.map +1 -1
- package/dist/finalized-oracle-read.d.ts +1 -1
- package/dist/finalized-oracle-read.d.ts.map +1 -1
- package/dist/finalized-oracle-read.js +1 -1
- package/dist/finalized-oracle-read.js.map +1 -1
- package/dist/governance-query.d.ts.map +1 -1
- package/dist/governance-query.js +0 -1
- package/dist/governance-query.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/oracle-permissions.d.ts +14 -30
- package/dist/oracle-permissions.d.ts.map +1 -1
- package/dist/oracle-permissions.js +29 -65
- package/dist/oracle-permissions.js.map +1 -1
- package/dist/recent-trades.d.ts +33 -0
- package/dist/recent-trades.d.ts.map +1 -0
- package/dist/recent-trades.js +82 -0
- package/dist/recent-trades.js.map +1 -0
- package/dist/typed-gateway-reads.d.ts +5 -1
- package/dist/typed-gateway-reads.d.ts.map +1 -1
- package/dist/typed-gateway-reads.js +7 -1
- package/dist/typed-gateway-reads.js.map +1 -1
- package/dist/types.d.ts +29 -83
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -12
- package/dist/types.js.map +1 -1
- package/dist/wasm/proof_trading_sdk_wasm_bg.wasm +0 -0
- package/package.json +1 -6
- package/dist/testing.d.ts +0 -16
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -21
- package/dist/testing.js.map +0 -1
package/README.md
CHANGED
|
@@ -230,18 +230,16 @@ durable journal, nonce allocation, retries or cutover authority.
|
|
|
230
230
|
|
|
231
231
|
`queryOraclePermissions(market)` reads one underlying perp's committed oracle
|
|
232
232
|
policy, calendar epoch and verdict at an exact finalized height. It preserves
|
|
233
|
-
u64 values as `bigint
|
|
234
|
-
|
|
233
|
+
u64 values as `bigint`; with no committed verdict the read is `Unavailable`
|
|
234
|
+
with an `Unavailable` permission. `Satisfied` covers only this oracle dependency, not all
|
|
235
235
|
portfolio dependencies or other trading checks. It never reads provider/observer
|
|
236
236
|
health; feeder freshness is a separate operational read, described below.
|
|
237
237
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
`"Fallback"`) and a `diagnostics` bitset (`diagnosticFlags`: `OnFallback`,
|
|
238
|
+
The verdict carries the `selected` slot (`"Primary"` or `"Fallback"`) and a
|
|
239
|
+
`diagnostics` bitset (`diagnosticFlags`: `OnFallback`,
|
|
241
240
|
`PrimaryRefusedDivergence`, `DivergenceUnchecked`, `FallbackUnusable`), which
|
|
242
|
-
are monitoring signals rather than faults.
|
|
243
|
-
`
|
|
244
|
-
layout (`ORACLE_FAULT_BITS`, named in `faultReasons`); `Disagreement` and
|
|
241
|
+
are monitoring signals rather than faults. `faults` follows
|
|
242
|
+
`ORACLE_FAULT_BITS`, named in `faultReasons`; `Disagreement` and
|
|
245
243
|
`PairTimeMismatch` keep their bits but are no longer produced.
|
|
246
244
|
|
|
247
245
|
### Trading No on an event's binary book
|
|
@@ -481,13 +479,11 @@ keep operator actions out of autocomplete. `submitTx` still accepts the full
|
|
|
481
479
|
|
|
482
480
|
#### Operator actions (privileged)
|
|
483
481
|
|
|
484
|
-
`OperatorAction` covers oracle-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
operator-provisioned key. See [AGENTS.md](AGENTS.md) → "Operator actions"
|
|
489
|
-
usage (e.g. driving the BE-31 multi-source mark via `OracleUpdateComposite` +
|
|
490
|
-
`UpdateMarketFees` `markSourceMode`).
|
|
482
|
+
`OperatorAction` covers oracle-feeder / relayer-admin actions — e.g.
|
|
483
|
+
`SubmitOracleObservation`, `UpdateMarketFees`, `CreateMarket`. **A trading
|
|
484
|
+
integration never needs these.** Each is gated by a dedicated engine allowlist
|
|
485
|
+
or the market's oracle policy, so codec availability grants nothing without an
|
|
486
|
+
operator-provisioned key. See [AGENTS.md](AGENTS.md) → "Operator actions".
|
|
491
487
|
|
|
492
488
|
#### Governance actions (admin multisig)
|
|
493
489
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type HexAddress, type MarketId } from "./read-values.js";
|
|
2
|
+
import type { BoundedReadOptions } from "./bounded-read.js";
|
|
3
|
+
/** Body cap for one account-events page. The indexer's maximum page is 5000
|
|
4
|
+
* rows of verbatim engine payloads, which can pass the 1 MiB default; 16 MiB
|
|
5
|
+
* leaves over 3 KiB a row. */
|
|
6
|
+
export declare const ACCOUNT_EVENTS_MAX_BYTES: number;
|
|
7
|
+
/** Half-open block-time window, epoch ms: `fromMs` inclusive, `toMs`
|
|
8
|
+
* exclusive. Keep every filter fixed when passing a cursor back. */
|
|
9
|
+
interface HistoryPageOptions {
|
|
10
|
+
fromMs?: number;
|
|
11
|
+
toMs?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
/** Opaque indexer cursor from the previous page's `nextCursor`; `""` or
|
|
14
|
+
* absent starts from the first page. */
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FundingPaymentsOptions extends HistoryPageOptions, BoundedReadOptions {
|
|
18
|
+
market?: number;
|
|
19
|
+
/** 1–1000; defaults to 200. */
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
/** One `funding_settled` account event: funding paid or received on one
|
|
23
|
+
* market at one funding settlement. */
|
|
24
|
+
export interface FundingPayment {
|
|
25
|
+
owner: HexAddress;
|
|
26
|
+
market: MarketId;
|
|
27
|
+
/** Signed micro-USDC (6 dp), exactly as the engine emitted it. */
|
|
28
|
+
payment: bigint;
|
|
29
|
+
blockHeight: bigint;
|
|
30
|
+
/** RFC3339 with up to nanosecond precision, as indexed. */
|
|
31
|
+
blockTime: string;
|
|
32
|
+
}
|
|
33
|
+
export interface FundingPaymentsPage {
|
|
34
|
+
/** Newest first. */
|
|
35
|
+
payments: FundingPayment[];
|
|
36
|
+
/** Pass back as `cursor` for the next page; `""` on the last page, like
|
|
37
|
+
* `queryHistoryFills` and `queryHistoryPositionsPage`. */
|
|
38
|
+
nextCursor: string;
|
|
39
|
+
}
|
|
40
|
+
export interface AccountEventsOptions extends HistoryPageOptions, BoundedReadOptions {
|
|
41
|
+
/** Required by the indexer, which has no default direction. */
|
|
42
|
+
order: "asc" | "desc";
|
|
43
|
+
/** One indexed event type, e.g. `binary_issued_from_mtm`. */
|
|
44
|
+
eventType?: string;
|
|
45
|
+
/** 1–5000; defaults to 500. */
|
|
46
|
+
limit?: number;
|
|
47
|
+
}
|
|
48
|
+
/** One indexed account event. The payload is the engine event's attributes,
|
|
49
|
+
* verbatim; its fields depend on `eventType`. */
|
|
50
|
+
export interface AccountEvent {
|
|
51
|
+
eventId: bigint;
|
|
52
|
+
owner: HexAddress;
|
|
53
|
+
blockHeight: bigint;
|
|
54
|
+
blockTime: string;
|
|
55
|
+
/** The indexer's row key: the uppercase hex transaction hash, or for an
|
|
56
|
+
* event without one a synthetic position kept verbatim:
|
|
57
|
+
* `height-{h}-kind-block-event-{i}` for an event the block emits outside
|
|
58
|
+
* any transaction (funding, liquidation, auto-deleveraging), and
|
|
59
|
+
* `height-{h}-kind-tx-idx-{idx}-event-{i}` for a row rebuilt from a
|
|
60
|
+
* version-1 archive. It matches a live `AccountEventFrame.txHash`. */
|
|
61
|
+
txHash: string;
|
|
62
|
+
eventIndex: number;
|
|
63
|
+
/** The transaction's position in its block, present only when the block
|
|
64
|
+
* carries the same transaction hash more than once. */
|
|
65
|
+
txPosition?: number;
|
|
66
|
+
eventType: string;
|
|
67
|
+
payload: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export interface AccountEventsPage {
|
|
70
|
+
/** In the requested order of (blockTime, eventId). */
|
|
71
|
+
events: AccountEvent[];
|
|
72
|
+
/** Pass back as `cursor` for the next page; `""` on the last page, like
|
|
73
|
+
* `queryHistoryFills` and `queryHistoryPositionsPage`. */
|
|
74
|
+
nextCursor: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function fundingPaymentsSearchParams(owner: string, options: FundingPaymentsOptions): URLSearchParams;
|
|
77
|
+
/** One newest-first indexed page; not proof the indexer has caught up. */
|
|
78
|
+
export declare function decodeFundingPaymentsPage(value: unknown, owner: string, options: FundingPaymentsOptions): FundingPaymentsPage;
|
|
79
|
+
/** Query parameters for `GET /v1/history/account-events`, in the shape the
|
|
80
|
+
* raw `reads().accountEvents` takes. */
|
|
81
|
+
export declare function accountEventsParams(owner: string, options: AccountEventsOptions): {
|
|
82
|
+
owner: string;
|
|
83
|
+
order: "asc" | "desc";
|
|
84
|
+
event_type?: string;
|
|
85
|
+
limit: number;
|
|
86
|
+
cursor?: string;
|
|
87
|
+
from?: string;
|
|
88
|
+
to?: string;
|
|
89
|
+
};
|
|
90
|
+
/** One indexed page in the requested order; not proof the indexer has caught
|
|
91
|
+
* up. Payloads are returned verbatim and not validated per event type. */
|
|
92
|
+
export declare function decodeAccountEventsPage(value: unknown, owner: string, options: AccountEventsOptions): AccountEventsPage;
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=account-history.d.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|
|
|
1
|
+
import { I64_MAX, MAX_DATE_MS, invalidRead, marketId, rfc3339, } from "./read-values.js";
|
|
2
|
+
/** Defaults and caps of the indexer history server (funding: `history.rs`,
|
|
3
|
+
* account events: `account_events.rs`). It clamps a limit outside its range;
|
|
4
|
+
* the SDK refuses one, so a page is never silently shorter.
|
|
5
|
+
*
|
|
6
|
+
* Coupled to the indexer: `pageCursor` accepts a next cursor only after a
|
|
7
|
+
* page of exactly `limit` rows. That holds only while these maximums equal
|
|
8
|
+
* the indexer's. If the indexer ever lowers one, a request at the old
|
|
9
|
+
* maximum gets a full clamped page with a cursor, and every non-final page
|
|
10
|
+
* fails closed as "non-progressing or truncated page". Lower these with it. */
|
|
11
|
+
const DEFAULT_FUNDING_PAYMENTS_LIMIT = 200;
|
|
12
|
+
const MAX_FUNDING_PAYMENTS_LIMIT = 1000;
|
|
13
|
+
const DEFAULT_ACCOUNT_EVENTS_LIMIT = 500;
|
|
14
|
+
const MAX_ACCOUNT_EVENTS_LIMIT = 5000;
|
|
15
|
+
const MAX_CURSOR_LENGTH = 4096;
|
|
16
|
+
/** Body cap for one account-events page. The indexer's maximum page is 5000
|
|
17
|
+
* rows of verbatim engine payloads, which can pass the 1 MiB default; 16 MiB
|
|
18
|
+
* leaves over 3 KiB a row. */
|
|
19
|
+
export const ACCOUNT_EVENTS_MAX_BYTES = 16 * 1024 * 1024;
|
|
20
|
+
/** The indexer stores markets as signed i32. */
|
|
21
|
+
const INDEXER_MAX_MARKET = 0x7fff_ffff;
|
|
22
|
+
function invalid(read, field, kind = "malformed") {
|
|
23
|
+
return invalidRead(`${read}.${field}`, kind);
|
|
24
|
+
}
|
|
25
|
+
function object(value, read, field) {
|
|
26
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
27
|
+
invalid(read, field);
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
function count(value, read, field) {
|
|
31
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
32
|
+
invalid(read, field);
|
|
33
|
+
return BigInt(value);
|
|
34
|
+
}
|
|
35
|
+
function cursor(value, read, kind = "malformed") {
|
|
36
|
+
if (typeof value !== "string" ||
|
|
37
|
+
value.length > MAX_CURSOR_LENGTH ||
|
|
38
|
+
Array.from(value).some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127))
|
|
39
|
+
invalid(read, "cursor", kind);
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function pageParams(read, options, defaultLimit, maxLimit) {
|
|
43
|
+
const params = new URLSearchParams();
|
|
44
|
+
for (const [key, name] of [
|
|
45
|
+
["fromMs", "from"],
|
|
46
|
+
["toMs", "to"],
|
|
47
|
+
]) {
|
|
48
|
+
const ms = options[key];
|
|
49
|
+
if (ms === undefined)
|
|
50
|
+
continue;
|
|
51
|
+
if (!Number.isSafeInteger(ms) || ms < 0 || ms > MAX_DATE_MS)
|
|
52
|
+
misconfigured(read, "window");
|
|
53
|
+
params.set(name, String(ms));
|
|
54
|
+
}
|
|
55
|
+
if (options.fromMs !== undefined &&
|
|
56
|
+
options.toMs !== undefined &&
|
|
57
|
+
options.toMs <= options.fromMs)
|
|
58
|
+
misconfigured(read, "window");
|
|
59
|
+
const limit = options.limit ?? defaultLimit;
|
|
60
|
+
if (!Number.isSafeInteger(limit) || limit < 1 || limit > maxLimit)
|
|
61
|
+
misconfigured(read, "limit");
|
|
62
|
+
params.set("limit", String(limit));
|
|
63
|
+
if (options.cursor !== undefined && options.cursor !== "")
|
|
64
|
+
params.set("cursor", cursor(options.cursor, read, "configuration"));
|
|
65
|
+
return { params, limit };
|
|
66
|
+
}
|
|
67
|
+
/** Caller mistakes in the options are configuration, not gateway faults. */
|
|
68
|
+
function misconfigured(read, field) {
|
|
69
|
+
return invalid(read, field, "configuration");
|
|
70
|
+
}
|
|
71
|
+
/** The caller's owner, checked as configuration. */
|
|
72
|
+
function ownerOption(owner, read) {
|
|
73
|
+
if (!/^[a-f0-9]{40}$/.test(owner))
|
|
74
|
+
misconfigured(read, "owner");
|
|
75
|
+
}
|
|
76
|
+
/** Rows ≤ limit, and a next cursor only after a full page that moved on. */
|
|
77
|
+
function pageCursor(read, rows, next, limit, options) {
|
|
78
|
+
if (!Array.isArray(rows) || rows.length > limit)
|
|
79
|
+
invalid(read, "page size");
|
|
80
|
+
const nextCursor = cursor(next, read);
|
|
81
|
+
if (nextCursor && (rows.length !== limit || nextCursor === options.cursor))
|
|
82
|
+
invalid(read, "non-progressing or truncated page");
|
|
83
|
+
return { rows, nextCursor };
|
|
84
|
+
}
|
|
85
|
+
function blockTime(value, read, options) {
|
|
86
|
+
const time = rfc3339(value, `${read}.block time`);
|
|
87
|
+
if ((options.fromMs !== undefined &&
|
|
88
|
+
time.nanos < BigInt(options.fromMs) * 1000000n) ||
|
|
89
|
+
(options.toMs !== undefined &&
|
|
90
|
+
time.nanos >= BigInt(options.toMs) * 1000000n))
|
|
91
|
+
invalid(read, "row outside window");
|
|
92
|
+
return time;
|
|
93
|
+
}
|
|
94
|
+
const FUNDING = "funding payments";
|
|
95
|
+
export function fundingPaymentsSearchParams(owner, options) {
|
|
96
|
+
ownerOption(owner, FUNDING);
|
|
97
|
+
const { params } = pageParams(FUNDING, options, DEFAULT_FUNDING_PAYMENTS_LIMIT, MAX_FUNDING_PAYMENTS_LIMIT);
|
|
98
|
+
if (options.market !== undefined) {
|
|
99
|
+
if (!Number.isInteger(options.market) ||
|
|
100
|
+
options.market < 1 ||
|
|
101
|
+
options.market > INDEXER_MAX_MARKET)
|
|
102
|
+
misconfigured(FUNDING, "market");
|
|
103
|
+
params.set("market", String(options.market));
|
|
104
|
+
}
|
|
105
|
+
return params;
|
|
106
|
+
}
|
|
107
|
+
/** One newest-first indexed page; not proof the indexer has caught up. */
|
|
108
|
+
export function decodeFundingPaymentsPage(value, owner, options) {
|
|
109
|
+
const limit = Number(fundingPaymentsSearchParams(owner, options).get("limit"));
|
|
110
|
+
const page = object(value, FUNDING, "page");
|
|
111
|
+
const { rows, nextCursor } = pageCursor(FUNDING, page.funding_payments, page.next_cursor, limit, options);
|
|
112
|
+
let previous;
|
|
113
|
+
const payments = rows.map((raw) => {
|
|
114
|
+
const row = object(raw, FUNDING, "payment");
|
|
115
|
+
if (row.owner !== owner)
|
|
116
|
+
invalid(FUNDING, "owner mismatch", "binding");
|
|
117
|
+
if (options.market !== undefined && row.market !== options.market)
|
|
118
|
+
invalid(FUNDING, "market mismatch", "binding");
|
|
119
|
+
const time = blockTime(row.block_time, FUNDING, options);
|
|
120
|
+
if (previous !== undefined && time.nanos > previous)
|
|
121
|
+
invalid(FUNDING, "unordered payment");
|
|
122
|
+
previous = time.nanos;
|
|
123
|
+
if (typeof row.payment !== "string" ||
|
|
124
|
+
row.payment.length > 20 ||
|
|
125
|
+
!/^(0|-?[1-9][0-9]*)$/.test(row.payment))
|
|
126
|
+
invalid(FUNDING, "payment");
|
|
127
|
+
const payment = BigInt(row.payment);
|
|
128
|
+
if (payment < -I64_MAX - 1n || payment > I64_MAX)
|
|
129
|
+
invalid(FUNDING, "payment");
|
|
130
|
+
return {
|
|
131
|
+
owner: owner,
|
|
132
|
+
market: marketId(row.market),
|
|
133
|
+
payment,
|
|
134
|
+
blockHeight: count(row.block_height, FUNDING, "block height"),
|
|
135
|
+
blockTime: time.raw,
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
return { payments, nextCursor };
|
|
139
|
+
}
|
|
140
|
+
const EVENTS = "account events";
|
|
141
|
+
const DIGITS = "(0|[1-9][0-9]{0,18})";
|
|
142
|
+
/** The indexer's synthetic keys for an event with no transaction hash
|
|
143
|
+
* (indexer `TxRef` in `crates/domain/src/keys.rs`). */
|
|
144
|
+
const SYNTHETIC_TX_REF = new RegExp(`^height-${DIGITS}-kind-(block|tx-idx-${DIGITS})-event-${DIGITS}$`);
|
|
145
|
+
/** A real hash is uppercased like every SDK transaction hash; a synthetic key
|
|
146
|
+
* stays verbatim, so it still equals the live feed's key. */
|
|
147
|
+
function txRef(value) {
|
|
148
|
+
if (typeof value !== "string")
|
|
149
|
+
invalid(EVENTS, "tx hash");
|
|
150
|
+
if (/^[0-9A-Fa-f]{64}$/.test(value))
|
|
151
|
+
return value.toUpperCase();
|
|
152
|
+
if (!SYNTHETIC_TX_REF.test(value))
|
|
153
|
+
invalid(EVENTS, "tx hash");
|
|
154
|
+
return value;
|
|
155
|
+
}
|
|
156
|
+
/** Query parameters for `GET /v1/history/account-events`, in the shape the
|
|
157
|
+
* raw `reads().accountEvents` takes. */
|
|
158
|
+
export function accountEventsParams(owner, options) {
|
|
159
|
+
ownerOption(owner, EVENTS);
|
|
160
|
+
if (options.order !== "asc" && options.order !== "desc")
|
|
161
|
+
misconfigured(EVENTS, "order");
|
|
162
|
+
if (options.eventType !== undefined &&
|
|
163
|
+
!/^[a-z0-9_]{1,64}$/.test(options.eventType))
|
|
164
|
+
misconfigured(EVENTS, "event type");
|
|
165
|
+
const { params, limit } = pageParams(EVENTS, options, DEFAULT_ACCOUNT_EVENTS_LIMIT, MAX_ACCOUNT_EVENTS_LIMIT);
|
|
166
|
+
const from = params.get("from");
|
|
167
|
+
const to = params.get("to");
|
|
168
|
+
const next = params.get("cursor");
|
|
169
|
+
return {
|
|
170
|
+
owner,
|
|
171
|
+
order: options.order,
|
|
172
|
+
...(options.eventType !== undefined
|
|
173
|
+
? { event_type: options.eventType }
|
|
174
|
+
: {}),
|
|
175
|
+
limit,
|
|
176
|
+
...(next !== null ? { cursor: next } : {}),
|
|
177
|
+
...(from !== null ? { from } : {}),
|
|
178
|
+
...(to !== null ? { to } : {}),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/** One indexed page in the requested order; not proof the indexer has caught
|
|
182
|
+
* up. Payloads are returned verbatim and not validated per event type. */
|
|
183
|
+
export function decodeAccountEventsPage(value, owner, options) {
|
|
184
|
+
const { limit } = accountEventsParams(owner, options);
|
|
185
|
+
const page = object(value, EVENTS, "page");
|
|
186
|
+
const { rows, nextCursor } = pageCursor(EVENTS, page.account_events, page.next_cursor, limit, options);
|
|
187
|
+
let previous;
|
|
188
|
+
const events = rows.map((raw) => {
|
|
189
|
+
const row = object(raw, EVENTS, "event");
|
|
190
|
+
if (row.owner !== owner)
|
|
191
|
+
invalid(EVENTS, "owner mismatch", "binding");
|
|
192
|
+
if (typeof row.event_type !== "string" || row.event_type === "")
|
|
193
|
+
invalid(EVENTS, "event type");
|
|
194
|
+
if (options.eventType !== undefined && row.event_type !== options.eventType)
|
|
195
|
+
invalid(EVENTS, "event type mismatch", "binding");
|
|
196
|
+
const eventId = count(row.event_id, EVENTS, "event id");
|
|
197
|
+
const time = blockTime(row.block_time, EVENTS, options);
|
|
198
|
+
if (previous) {
|
|
199
|
+
const ascending = time.nanos > previous.nanos ||
|
|
200
|
+
(time.nanos === previous.nanos && eventId > previous.id);
|
|
201
|
+
const descending = time.nanos < previous.nanos ||
|
|
202
|
+
(time.nanos === previous.nanos && eventId < previous.id);
|
|
203
|
+
if (options.order === "asc" ? !ascending : !descending)
|
|
204
|
+
invalid(EVENTS, "duplicate or unordered event");
|
|
205
|
+
}
|
|
206
|
+
previous = { nanos: time.nanos, id: eventId };
|
|
207
|
+
const txHash = txRef(row.tx_hash);
|
|
208
|
+
const eventIndex = count(row.event_index, EVENTS, "event index");
|
|
209
|
+
const txPosition = row.tx_position === undefined
|
|
210
|
+
? undefined
|
|
211
|
+
: Number(count(row.tx_position, EVENTS, "tx position"));
|
|
212
|
+
return {
|
|
213
|
+
eventId,
|
|
214
|
+
owner: owner,
|
|
215
|
+
blockHeight: count(row.block_height, EVENTS, "block height"),
|
|
216
|
+
blockTime: time.raw,
|
|
217
|
+
txHash,
|
|
218
|
+
eventIndex: Number(eventIndex),
|
|
219
|
+
...(txPosition !== undefined ? { txPosition } : {}),
|
|
220
|
+
eventType: row.event_type,
|
|
221
|
+
payload: object(row.payload, EVENTS, "payload"),
|
|
222
|
+
};
|
|
223
|
+
});
|
|
224
|
+
return { events, nextCursor };
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=account-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-history.js","sourceRoot":"","sources":["../src/account-history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,EACR,OAAO,GAGR,MAAM,kBAAkB,CAAC;AAI1B;;;;;;;;+EAQ+E;AAC/E,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAC3C,MAAM,0BAA0B,GAAG,IAAI,CAAC;AACxC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B;;8BAE8B;AAC9B,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzD,gDAAgD;AAChD,MAAM,kBAAkB,GAAG,WAAW,CAAC;AA4EvC,SAAS,OAAO,CACd,IAAY,EACZ,KAAa,EACb,OAAiC,WAAW;IAE5C,OAAO,WAAW,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AACD,SAAS,MAAM,CAAC,KAAc,EAAE,IAAY,EAAE,KAAa;IACzD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7D,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvB,OAAO,KAAgC,CAAC;AAC1C,CAAC;AACD,SAAS,KAAK,CAAC,KAAc,EAAE,IAAY,EAAE,KAAa;IACxD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAK,KAAgB,GAAG,CAAC;QACvD,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC,KAAe,CAAC,CAAC;AACjC,CAAC;AACD,SAAS,MAAM,CACb,KAAc,EACd,I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AC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -3,20 +3,27 @@ import { type Hash32Hex } from "./read-values.js";
|
|
|
3
3
|
import { type BoundedReadOptions } from "./bounded-read.js";
|
|
4
4
|
import { type TransactionEvidenceEvent } from "./chain-evidence.js";
|
|
5
5
|
import type { ExchangeHttpTransport } from "./http-transport.js";
|
|
6
|
-
|
|
7
|
-
/** Fixed half-open wall-clock window, in exact epoch milliseconds. */
|
|
8
|
-
fromMs: number;
|
|
9
|
-
toMs: number;
|
|
10
|
-
/** Explicit last height to inspect; its block time must reach toMs. */
|
|
11
|
-
throughHeight: bigint;
|
|
6
|
+
interface BlockResultsBudgets {
|
|
12
7
|
/** Maximum backward-scanned heights, 1..128. Default 32. No partial success. */
|
|
13
8
|
maxHeights?: number;
|
|
14
|
-
/** Caller may reduce these
|
|
9
|
+
/** Caller may reduce these aggregate ceilings, never exceed them. */
|
|
15
10
|
maxDecodedBytes?: number;
|
|
16
11
|
maxTransactions?: number;
|
|
17
12
|
maxEvents?: number;
|
|
18
13
|
maxAttributes?: number;
|
|
19
14
|
}
|
|
15
|
+
export interface BlockResultsWindowSelection extends BlockResultsBudgets {
|
|
16
|
+
/** Fixed half-open wall-clock window, in exact epoch milliseconds. */
|
|
17
|
+
fromMs: number;
|
|
18
|
+
toMs: number;
|
|
19
|
+
/** Explicit last height to inspect; its block time must reach toMs. */
|
|
20
|
+
throughHeight: bigint;
|
|
21
|
+
}
|
|
22
|
+
export interface BlockResultsRangeSelection extends BlockResultsBudgets {
|
|
23
|
+
/** Exact inclusive bounds. No timestamp-based selection or extra boundary block. */
|
|
24
|
+
fromHeight: bigint;
|
|
25
|
+
throughHeight: bigint;
|
|
26
|
+
}
|
|
20
27
|
/** One block transaction and its same-index execution result. */
|
|
21
28
|
export interface BlockTransactionEvidence {
|
|
22
29
|
index: number;
|
|
@@ -39,12 +46,9 @@ export interface BlockResultsEvidence {
|
|
|
39
46
|
* chain, result counts, times, each block's transaction list against its
|
|
40
47
|
* header `data_hash`, and post-state/header bindings are checked. Block hashes
|
|
41
48
|
* are not recomputed from headers, so a coherently lying gateway is not caught.
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
export interface BlockResultsWindow {
|
|
49
|
+
* Range bounds are inclusive; equal and sub-millisecond block times are retained. */
|
|
50
|
+
export interface BlockResultsRange {
|
|
45
51
|
source: "trusted-gateway";
|
|
46
|
-
fromMs: number;
|
|
47
|
-
toMs: number;
|
|
48
52
|
fromHeight: bigint;
|
|
49
53
|
throughHeight: bigint;
|
|
50
54
|
/** H+1 header binding the final scanned block's post-state hash. */
|
|
@@ -52,7 +56,16 @@ export interface BlockResultsWindow {
|
|
|
52
56
|
/** Ascending heights; no missing or skipped blocks within this range. */
|
|
53
57
|
blocks: BlockResultsEvidence[];
|
|
54
58
|
}
|
|
59
|
+
/** Blocks include the lower-boundary block (before fromMs, or genesis) and may
|
|
60
|
+
* include end-boundary blocks. Consumers must apply [fromMs,toMs) themselves. */
|
|
61
|
+
export interface BlockResultsWindow extends BlockResultsRange {
|
|
62
|
+
fromMs: number;
|
|
63
|
+
toMs: number;
|
|
64
|
+
}
|
|
55
65
|
/** Internal bounded scan. At most 2*maxHeights+1 GETs; each response <=1 MiB,
|
|
56
66
|
* retained decoded JSON <=8 MiB, and all reads share one deadline. */
|
|
57
67
|
export declare function readBlockResultsWindow(gatewayUrl: string, expectedChainId: Uint8Array, selection: BlockResultsWindowSelection, options: BoundedReadOptions, transport: ExchangeHttpTransport): Promise<BlockResultsWindow>;
|
|
68
|
+
/** The same bounded decoder as the window read, selected by inclusive heights. */
|
|
69
|
+
export declare function readBlockResultsRange(gatewayUrl: string, expectedChainId: Uint8Array, selection: BlockResultsRangeSelection, options: BoundedReadOptions, transport: ExchangeHttpTransport): Promise<BlockResultsRange>;
|
|
70
|
+
export {};
|
|
58
71
|
//# sourceMappingURL=block-results-window.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-results-window.d.ts","sourceRoot":"","sources":["../src/block-results-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EASL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,
|
|
1
|
+
{"version":3,"file":"block-results-window.d.ts","sourceRoot":"","sources":["../src/block-results-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EASL,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE,UAAU,mBAAmB;IAC3B,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA2B,SAAQ,mBAAmB;IACrE,oFAAoF;IACpF,UA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CAAC,CAS5B"}
|
|
@@ -14,7 +14,24 @@ const WINDOW_MAX_ATTRIBUTES = 65_536;
|
|
|
14
14
|
/** Internal bounded scan. At most 2*maxHeights+1 GETs; each response <=1 MiB,
|
|
15
15
|
* retained decoded JSON <=8 MiB, and all reads share one deadline. */
|
|
16
16
|
export async function readBlockResultsWindow(gatewayUrl, expectedChainId, selection, options, transport) {
|
|
17
|
-
const { fromMs, toMs
|
|
17
|
+
const { fromMs, toMs } = selection;
|
|
18
|
+
const range = await readBlockResults(gatewayUrl, expectedChainId, selection, { kind: "window", fromMs, toMs }, options, transport);
|
|
19
|
+
return {
|
|
20
|
+
source: range.source,
|
|
21
|
+
fromMs,
|
|
22
|
+
toMs,
|
|
23
|
+
fromHeight: range.fromHeight,
|
|
24
|
+
throughHeight: range.throughHeight,
|
|
25
|
+
anchor: range.anchor,
|
|
26
|
+
blocks: range.blocks,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** The same bounded decoder as the window read, selected by inclusive heights. */
|
|
30
|
+
export async function readBlockResultsRange(gatewayUrl, expectedChainId, selection, options, transport) {
|
|
31
|
+
return readBlockResults(gatewayUrl, expectedChainId, selection, { kind: "range", fromHeight: selection.fromHeight }, options, transport);
|
|
32
|
+
}
|
|
33
|
+
async function readBlockResults(gatewayUrl, expectedChainId, selection, boundary, options, transport) {
|
|
34
|
+
const { throughHeight } = selection;
|
|
18
35
|
const deadline = readDeadline(options);
|
|
19
36
|
const budget = (value, ceiling, field) => {
|
|
20
37
|
const n = value ?? ceiling;
|
|
@@ -22,21 +39,30 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
22
39
|
throw new GatewayReadError("configuration", field);
|
|
23
40
|
return n;
|
|
24
41
|
};
|
|
25
|
-
const maxHeights = budget(selection.maxHeights ?? WINDOW_DEFAULT_HEIGHTS, WINDOW_MAX_HEIGHTS,
|
|
26
|
-
const maxBytes = budget(selection.maxDecodedBytes, WINDOW_MAX_DECODED_BYTES,
|
|
27
|
-
const maxTransactions = budget(selection.maxTransactions, WINDOW_MAX_TRANSACTIONS,
|
|
28
|
-
const maxEvents = budget(selection.maxEvents, WINDOW_MAX_EVENTS,
|
|
29
|
-
const maxAttributes = budget(selection.maxAttributes, WINDOW_MAX_ATTRIBUTES,
|
|
30
|
-
if (
|
|
31
|
-
fromMs
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
const maxHeights = budget(selection.maxHeights ?? WINDOW_DEFAULT_HEIGHTS, WINDOW_MAX_HEIGHTS, `${boundary.kind} heights`);
|
|
43
|
+
const maxBytes = budget(selection.maxDecodedBytes, WINDOW_MAX_DECODED_BYTES, `${boundary.kind} bytes`);
|
|
44
|
+
const maxTransactions = budget(selection.maxTransactions, WINDOW_MAX_TRANSACTIONS, `${boundary.kind} transactions`);
|
|
45
|
+
const maxEvents = budget(selection.maxEvents, WINDOW_MAX_EVENTS, `${boundary.kind} events`);
|
|
46
|
+
const maxAttributes = budget(selection.maxAttributes, WINDOW_MAX_ATTRIBUTES, `${boundary.kind} attributes`);
|
|
47
|
+
if (boundary.kind === "window" &&
|
|
48
|
+
(!Number.isSafeInteger(boundary.fromMs) ||
|
|
49
|
+
boundary.fromMs < 0 ||
|
|
50
|
+
!Number.isSafeInteger(boundary.toMs) ||
|
|
51
|
+
boundary.toMs <= boundary.fromMs ||
|
|
52
|
+
boundary.toMs > MAX_DATE_MS))
|
|
35
53
|
invalid("fixed window");
|
|
36
54
|
if (typeof throughHeight !== "bigint" ||
|
|
37
55
|
throughHeight < 1n ||
|
|
38
56
|
throughHeight >= I64_MAX)
|
|
39
57
|
invalid("through height");
|
|
58
|
+
if (boundary.kind === "range") {
|
|
59
|
+
if (typeof boundary.fromHeight !== "bigint" ||
|
|
60
|
+
boundary.fromHeight < 1n ||
|
|
61
|
+
boundary.fromHeight > throughHeight)
|
|
62
|
+
invalid("from height");
|
|
63
|
+
if (throughHeight - boundary.fromHeight + 1n > BigInt(maxHeights))
|
|
64
|
+
invalid("height budget", "limit");
|
|
65
|
+
}
|
|
40
66
|
if (!(expectedChainId instanceof Uint8Array) || expectedChainId.length !== 32)
|
|
41
67
|
invalid("pinned chain");
|
|
42
68
|
const chain = Uint8Array.from(expectedChainId);
|
|
@@ -49,12 +75,12 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
49
75
|
const raw = await boundedGatewayJson(`${base}${path}`, transport, deadline.remaining());
|
|
50
76
|
decodedBytes += new TextEncoder().encode(JSON.stringify(raw)).length;
|
|
51
77
|
if (decodedBytes > maxBytes)
|
|
52
|
-
invalid(
|
|
78
|
+
invalid(`${boundary.kind} byte budget`, "limit");
|
|
53
79
|
deadline.remaining();
|
|
54
80
|
return rpcResult(raw);
|
|
55
81
|
};
|
|
56
82
|
const decodeEvents = (value) => {
|
|
57
|
-
// Enforce the remaining
|
|
83
|
+
// Enforce the remaining aggregate budget before allocating decoded lists.
|
|
58
84
|
// A busy block must not inherit the single-transaction evidence limits.
|
|
59
85
|
const decoded = events(value, {
|
|
60
86
|
maxEvents: maxEvents - eventCount,
|
|
@@ -65,8 +91,8 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
65
91
|
return decoded;
|
|
66
92
|
};
|
|
67
93
|
const anchor = decodeBlockEvidenceHeader(await read(`/v1/block?height=${throughHeight + 1n}`), throughHeight + 1n, chain);
|
|
68
|
-
const fromNs = BigInt(fromMs) * 1000000n;
|
|
69
|
-
const toNs = BigInt(toMs) * 1000000n;
|
|
94
|
+
const fromNs = boundary.kind === "window" ? BigInt(boundary.fromMs) * 1000000n : null;
|
|
95
|
+
const toNs = boundary.kind === "window" ? BigInt(boundary.toMs) * 1000000n : null;
|
|
70
96
|
const blocks = [];
|
|
71
97
|
let next = anchor;
|
|
72
98
|
for (let height = throughHeight; blocks.length < maxHeights && height >= 1n; height--) {
|
|
@@ -76,7 +102,9 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
76
102
|
invalid("parent hash continuity");
|
|
77
103
|
if (rfc3339(header.time).nanos > rfc3339(next.time).nanos)
|
|
78
104
|
invalid("block time continuity");
|
|
79
|
-
if (height === throughHeight &&
|
|
105
|
+
if (height === throughHeight &&
|
|
106
|
+
toNs !== null &&
|
|
107
|
+
rfc3339(header.time).nanos < toNs)
|
|
80
108
|
invalid("source has not reached window end");
|
|
81
109
|
const rawTransactions = object(object(response.block, "block").data, "block data").txs;
|
|
82
110
|
// Go's non-omitempty slices encode a genuine empty list as null or [].
|
|
@@ -85,7 +113,7 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
85
113
|
const txs = (rawTransactions ?? []);
|
|
86
114
|
transactionCount += txs.length;
|
|
87
115
|
if (transactionCount > maxTransactions)
|
|
88
|
-
invalid(
|
|
116
|
+
invalid(`${boundary.kind} transaction budget`, "limit");
|
|
89
117
|
const blockTransactions = txs.map((value) => bytes(value, "block transaction bytes"));
|
|
90
118
|
bindBlockTransactions(response, blockTransactions);
|
|
91
119
|
const result = await read(`/v1/block_results?height=${height}`);
|
|
@@ -122,11 +150,13 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
122
150
|
finalizeBlockEvents: decodeEvents(result.finalize_block_events ?? []),
|
|
123
151
|
});
|
|
124
152
|
deadline.remaining();
|
|
125
|
-
|
|
153
|
+
const complete = boundary.kind === "range"
|
|
154
|
+
? height === boundary.fromHeight
|
|
155
|
+
: (fromNs !== null && rfc3339(header.time).nanos < fromNs) ||
|
|
156
|
+
height === 1n;
|
|
157
|
+
if (complete) {
|
|
126
158
|
return {
|
|
127
159
|
source: "trusted-gateway",
|
|
128
|
-
fromMs,
|
|
129
|
-
toMs,
|
|
130
160
|
fromHeight: height,
|
|
131
161
|
throughHeight,
|
|
132
162
|
anchor,
|
|
@@ -135,6 +165,6 @@ export async function readBlockResultsWindow(gatewayUrl, expectedChainId, select
|
|
|
135
165
|
}
|
|
136
166
|
next = header;
|
|
137
167
|
}
|
|
138
|
-
throw new GatewayReadError("limit", "height budget",
|
|
168
|
+
throw new GatewayReadError("limit", "height budget", `Block-results ${boundary.kind} exceeds height budget; no complete ${boundary.kind} available`);
|
|
139
169
|
}
|
|
140
170
|
//# sourceMappingURL=block-results-window.js.map
|