@pod-network/trade-sdk 0.10.0 → 0.11.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.
Files changed (72) hide show
  1. package/README.md +6 -4
  2. package/dist/client.d.ts +20 -10
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +26 -11
  5. package/dist/client.js.map +1 -1
  6. package/dist/codec/activity.d.ts +11 -0
  7. package/dist/codec/activity.d.ts.map +1 -0
  8. package/dist/codec/activity.js +33 -0
  9. package/dist/codec/activity.js.map +1 -0
  10. package/dist/codec/decode.d.ts +14 -6
  11. package/dist/codec/decode.d.ts.map +1 -1
  12. package/dist/codec/decode.js +58 -24
  13. package/dist/codec/decode.js.map +1 -1
  14. package/dist/codec/orders-v2.d.ts +9 -3
  15. package/dist/codec/orders-v2.d.ts.map +1 -1
  16. package/dist/codec/orders-v2.js +12 -9
  17. package/dist/codec/orders-v2.js.map +1 -1
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +1 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/sync/activity.d.ts +58 -0
  23. package/dist/sync/activity.d.ts.map +1 -0
  24. package/dist/sync/activity.js +259 -0
  25. package/dist/sync/activity.js.map +1 -0
  26. package/dist/sync/orders.d.ts +4 -64
  27. package/dist/sync/orders.d.ts.map +1 -1
  28. package/dist/sync/orders.js +40 -190
  29. package/dist/sync/orders.js.map +1 -1
  30. package/dist/sync/pnl-history.d.ts +33 -14
  31. package/dist/sync/pnl-history.d.ts.map +1 -1
  32. package/dist/sync/pnl-history.js +255 -65
  33. package/dist/sync/pnl-history.js.map +1 -1
  34. package/dist/sync/stream.d.ts +101 -0
  35. package/dist/sync/stream.d.ts.map +1 -0
  36. package/dist/sync/stream.js +243 -0
  37. package/dist/sync/stream.js.map +1 -0
  38. package/dist/transport/jsonrpc.d.ts +0 -5
  39. package/dist/transport/jsonrpc.d.ts.map +1 -1
  40. package/dist/transport/jsonrpc.js +0 -20
  41. package/dist/transport/jsonrpc.js.map +1 -1
  42. package/dist/transport/rest.d.ts +36 -4
  43. package/dist/transport/rest.d.ts.map +1 -1
  44. package/dist/transport/rest.js +43 -10
  45. package/dist/transport/rest.js.map +1 -1
  46. package/dist/transport/ws.d.ts +5 -1
  47. package/dist/transport/ws.d.ts.map +1 -1
  48. package/dist/transport/ws.js.map +1 -1
  49. package/dist/types/public.d.ts +62 -23
  50. package/dist/types/public.d.ts.map +1 -1
  51. package/dist/types/wire.d.ts +98 -16
  52. package/dist/types/wire.d.ts.map +1 -1
  53. package/dist/write/index.d.ts +3 -3
  54. package/dist/write/index.d.ts.map +1 -1
  55. package/dist/write/index.js +0 -3
  56. package/dist/write/index.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/client.ts +28 -13
  59. package/src/codec/activity.ts +46 -0
  60. package/src/codec/decode.ts +65 -30
  61. package/src/codec/orders-v2.ts +24 -11
  62. package/src/index.ts +3 -1
  63. package/src/sync/activity.ts +266 -0
  64. package/src/sync/orders.ts +41 -187
  65. package/src/sync/pnl-history.ts +244 -75
  66. package/src/sync/stream.ts +270 -0
  67. package/src/transport/jsonrpc.ts +0 -23
  68. package/src/transport/rest.ts +62 -14
  69. package/src/transport/ws.ts +5 -1
  70. package/src/types/public.ts +62 -26
  71. package/src/types/wire.ts +105 -18
  72. package/src/write/index.ts +3 -6
@@ -1,52 +1,10 @@
1
1
  // OrderHistory: a SeriesResource<Order> seeded from the warm first page, kept
2
2
  // live by the pod_orders_v2 stream (bidder-filtered, resumed from a (batch, book)
3
- // cursor), and paged backwards by cursor for deep history.
4
- //
5
- // Reconnect: on every (re)connect we re-seed the first page (authoritative open
6
- // orders) and refresh the cursor from its watermark; the WS auto-resubscribes,
7
- // and if the cursor is too old (down too long) `onError` re-seeds and
8
- // resubscribes. A server-initiated close is not the same as a rejection: it
9
- // reports where delivery stopped, so resuming from one is a bare `resubscribe()`
10
- // with no re-seed.
3
+ // cursor by `ResumableStream`), and paged backwards by cursor for deep history.
11
4
  import { applyOrdersFrame } from "../codec/orders-v2.js";
12
5
  import { BaseResource } from "../stores/resource.js";
13
- import { PodSubscriptionClosedError } from "../transport/ws.js";
14
- /**
15
- * Consecutive server closes we resume from before falling back to the re-seed
16
- * path. A lagged close is recoverable by resubscribing, so the fast path is the
17
- * right default — but a stream that keeps closing is one we are not keeping up
18
- * with, and re-seeding beats replaying a growing backlog on every attempt.
19
- */
20
- const FAST_RESUMES_BEFORE_RESEED = 3;
21
- /**
22
- * Re-seed attempts that keep the cursor before we conclude the cursor is what the
23
- * server is rejecting, drop it, and settle for streaming live.
24
- */
25
- const RETRIES_BEFORE_DROPPING_CURSOR = 2;
26
- /** The largest book id, which is what an absent `sinceBook` means. */
27
- const WHOLE_BATCH = `0x${"ff".repeat(32)}`;
28
- /**
29
- * Order two positions in the stream, the way the server does.
30
- *
31
- * A batch is delivered as one frame per book, so a position is the pair
32
- * `(batch, book)` — and an absent book means the whole batch, which sorts *above*
33
- * every book in it. This mirrors `already_delivered` in
34
- * `node/src/rpc/orders_v2.rs`: `(frame_batch, frame_book) <= (since,
35
- * since_book.unwrap_or(0xff…))`. Getting the absent case wrong turns "all of batch
36
- * N" into "up to book B of batch N", which asks the server to re-send the rest.
37
- *
38
- * Book ids are fixed-width lowercase hex, so comparing them as strings is
39
- * comparing their bytes.
40
- */
41
- export function compareCursor(a, b) {
42
- const aBatch = a.since ?? 0;
43
- const bBatch = b.since ?? 0;
44
- if (aBatch !== bBatch)
45
- return aBatch < bBatch ? -1 : 1;
46
- const aBook = a.sinceBook ?? WHOLE_BATCH;
47
- const bBook = b.sinceBook ?? WHOLE_BATCH;
48
- return aBook === bBook ? 0 : aBook < bBook ? -1 : 1;
49
- }
6
+ import { compareCursor, ResumableStream } from "./stream.js";
7
+ export { compareCursor } from "./stream.js";
50
8
  export class OrderHistory {
51
9
  ctx;
52
10
  account;
@@ -55,48 +13,28 @@ export class OrderHistory {
55
13
  handle;
56
14
  byId = new Map();
57
15
  nextCursor = null;
58
- sub;
59
- alive = false;
16
+ painted = false;
17
+ seedGen = 0;
60
18
  _hasMore = true;
61
19
  _loading = false;
62
- subRetries = 0;
63
- fastResumes = 0;
64
- retryTimer;
65
20
  eventListeners = new Set();
66
- /**
67
- * Where the stream is: the last frame accepted, as the `(batch, book)` pair the
68
- * channel resumes from. Replaced whole rather than patched half at a time —
69
- * `sinceBook` names a book *within* `since`, so the two are one fact and a
70
- * mismatched pair asks the server to skip books we never saw.
71
- */
72
- cursor = { since: 0, sinceBook: undefined };
73
- /**
74
- * Push the cursor to the transport, both halves.
75
- *
76
- * `update` merges, so sending `{ since }` alone would leave whatever `sinceBook` was
77
- * there before — a book from an older batch beside a newer `since`, which asks the
78
- * server to skip less than it should and re-send the difference.
79
- */
80
- pushCursor() {
81
- this.sub?.update({ since: this.cursor.since, sinceBook: this.cursor.sinceBook });
82
- }
21
+ stream;
83
22
  constructor(ctx, account, query = {}) {
84
23
  this.ctx = ctx;
85
24
  this.account = account;
86
25
  this.query = query;
26
+ this.stream = new ResumableStream({
27
+ ws: ctx.ws,
28
+ channel: "pod_orders_v2",
29
+ params: { account },
30
+ reseed: () => this.fetchFirstPage(),
31
+ onFrame: (r) => this.onFrame(r),
32
+ });
87
33
  this.base = new BaseResource((h) => {
88
34
  this.handle = h;
89
- this.alive = true;
90
- const offOpen = this.ctx.ws.on("open", () => { if (this.alive)
91
- this.seed(); });
92
- this.seed(); // initial paint (REST is independent of the socket being open)
35
+ this.stream.start();
93
36
  return () => {
94
- this.alive = false;
95
- offOpen();
96
- if (this.retryTimer)
97
- clearTimeout(this.retryTimer);
98
- this.sub?.unsubscribe();
99
- this.sub = undefined;
37
+ this.stream.stop();
100
38
  this.handle = undefined;
101
39
  };
102
40
  });
@@ -151,150 +89,62 @@ export class OrderHistory {
151
89
  }
152
90
  // --- internals ---
153
91
  async fetchFirstPage() {
154
- const before = this.cursor;
92
+ const gen = ++this.seedGen;
93
+ const before = this.stream.cursor;
155
94
  try {
156
95
  const page = await this.ctx.rest.orders(this.account, { limit: this.query.limit ?? 100 });
157
- if (!this.alive)
96
+ // A seed overtaken by a fresher one is dropped whole: it would absorb rows the
97
+ // newer page has already corrected, and raise the cursor to an older watermark.
98
+ if (!this.stream.running || gen !== this.seedGen)
158
99
  return false;
159
100
  // The transport resubscribes synchronously right after the `open` event that
160
101
  // starts this fetch, so replayed frames can land while it is still in flight —
161
102
  // and the indexer trails the stream by design. Overwriting a row the stream has
162
- // already advanced would revert it, permanently: the cursor below refuses to
163
- // rewind and `onFrame` drops a re-delivery, so nothing would repair it.
164
- const streamMovedOn = compareCursor(this.cursor, before) > 0;
103
+ // already advanced would revert it, permanently: the cursor refuses to rewind
104
+ // and `onFrame` drops a re-delivery, so nothing would repair it.
105
+ const streamMovedOn = compareCursor(this.stream.cursor, before) > 0;
165
106
  for (const o of page.orders) {
166
107
  if (streamMovedOn && this.byId.has(o.id))
167
108
  continue;
168
109
  this.byId.set(o.id, o);
169
110
  }
170
- this.nextCursor = page.nextCursor;
171
- this._hasMore = page.nextCursor !== null;
111
+ // Paging is the consumer's position in history, not the seed's: a reconnect
112
+ // re-paints the first page, and taking its cursor again would hand back pages
113
+ // `loadOlder` has already walked past.
114
+ if (!this.painted) {
115
+ this.painted = true;
116
+ this.nextCursor = page.nextCursor;
117
+ this._hasMore = page.nextCursor !== null;
118
+ }
172
119
  // Only ever forward, and a page settles whole batches, so its watermark
173
120
  // carries no book — which makes it *ahead* of a stream position in the same
174
121
  // batch, not equal to it.
175
- const settled = { since: page.solutionNow * 1000, sinceBook: undefined };
176
- if (compareCursor(settled, this.cursor) > 0)
177
- this.cursor = settled;
122
+ this.stream.raise({ since: page.solutionNow * 1000, sinceBook: undefined });
178
123
  this.rebuild();
179
124
  return true;
180
125
  }
181
126
  catch (e) {
182
- if (this.byId.size === 0)
183
- this.handle?.fail(e);
184
- return false;
127
+ // Only before the first paint: an account whose history is genuinely empty has
128
+ // a resource, and reporting a later transient failure on it would blank the view.
129
+ if (this.handle && this.handle.current() === undefined)
130
+ this.handle.fail(e);
131
+ throw e;
185
132
  }
186
133
  }
187
- seed() {
188
- void this.fetchFirstPage().then((ok) => {
189
- if (!ok || !this.alive)
190
- return;
191
- if (!this.sub) {
192
- this.sub = this.ctx.ws.subscribe("pod_orders_v2", { account: this.account, ...this.cursor }, (r) => this.onFrame(r), (e) => this.onSubError(e));
193
- }
194
- else {
195
- this.pushCursor(); // refresh for the next reconnect
196
- }
197
- });
198
- }
199
- /**
200
- * The subscription is not running: `eth_subscribe` was rejected, or the server
201
- * closed it.
202
- *
203
- * A resumable close needs neither a re-seed nor a delay: the server reports where
204
- * it stopped, so resubscribing from that delivers exactly the frames we never got.
205
- * That fast path is only taken while the socket is actually open — `resubscribe()`
206
- * is a no-op otherwise, which would spend the budget without an attempt and leave
207
- * nothing scheduled, and `-32021` (node shutting down) arrives exactly as the
208
- * socket goes away.
209
- *
210
- * Everything else (a rejection, a server bug, a close with the socket already
211
- * gone, or closes that keep coming) takes the slow path: backed off and capped, so
212
- * a server that keeps refusing cannot spin this into a tight re-seed loop, and
213
- * eventually the cursor is dropped (the likely culprit) to just stream live. Both
214
- * counters reset once live data flows (`onFrame`).
215
- */
216
- onSubError(err) {
217
- if (!this.alive)
218
- return;
219
- const canFastResume = err instanceof PodSubscriptionClosedError && err.resumable
220
- && this.fastResumes < FAST_RESUMES_BEFORE_RESEED && this.ctx.ws.state === "open";
221
- if (canFastResume) {
222
- this.fastResumes++;
223
- // Adopt the server's watermark only when it is ahead of ours: it knows which
224
- // frames it handed over, but a re-seed may already have carried us past it,
225
- // and rewinding would re-deliver frames we have applied.
226
- const reported = { since: err.resumeSince, sinceBook: err.resumeSinceBook };
227
- if (err.resumeSince !== undefined && compareCursor(reported, this.cursor) > 0)
228
- this.cursor = reported;
229
- // The transport rewrote `sub.params` from the close before this ran, so without
230
- // pushing our own decision back the wire resumes from the server's point
231
- // regardless and the guard above protects nothing.
232
- this.pushCursor();
233
- this.sub?.resubscribe();
234
- return;
235
- }
236
- // The slow path, and the one that answers "what if we fell behind the server's
237
- // replay buffer": `eth_subscribe` rejects a `since` older than what the buffer
238
- // retains, and the prescribed recovery is to backfill over REST and resubscribe.
239
- // That is what this is. `fetchFirstPage` also *replaces the cursor* with the
240
- // page's watermark, so the position that was too old is gone by the first retry
241
- // and the resubscribe is accepted with no gap — the server replays from the page
242
- // forward. Dropping the cursor below is the backstop for when even that fresh
243
- // watermark is refused (the indexer further behind than the buffer retains):
244
- // live-only resubscribe, trading the unreplayable window for a working stream.
245
- this.scheduleReseed();
246
- }
247
- /**
248
- * Back off, re-seed over REST, then resubscribe — and keep trying.
249
- *
250
- * The re-seed can fail too (the same node is usually behind both the stream and the
251
- * indexer), and a failure has to re-arm here: not resubscribing means no further
252
- * close or rejection arrives, so nothing else would ever schedule another attempt and
253
- * the stream would stay down with no error surfaced. Capped, so a node that keeps
254
- * refusing cannot spin this.
255
- */
256
- scheduleReseed() {
257
- this.subRetries++;
258
- const delay = Math.min(30_000, 500 * 2 ** (this.subRetries - 1));
259
- if (this.retryTimer)
260
- clearTimeout(this.retryTimer);
261
- this.retryTimer = setTimeout(() => {
262
- void this.fetchFirstPage().then((ok) => {
263
- if (!this.alive)
264
- return;
265
- if (!ok) {
266
- this.scheduleReseed();
267
- return;
268
- }
269
- const tooOld = this.subRetries > RETRIES_BEFORE_DROPPING_CURSOR;
270
- if (tooOld)
271
- this.sub?.update({ since: undefined, sinceBook: undefined });
272
- else
273
- this.pushCursor();
274
- this.sub?.resubscribe();
275
- });
276
- }, delay);
277
- }
278
134
  /** One frame: everything that happened to one book in one auction batch. */
279
135
  onFrame(result) {
280
- // Live data flowing → the subscription is healthy on both paths.
281
- this.subRetries = 0;
282
- this.fastResumes = 0;
283
136
  const frame = result;
284
137
  if (!frame || !Array.isArray(frame.orders) || !Array.isArray(frame.events))
285
138
  return;
286
139
  // Drop what we already hold. Applying a frame is not idempotent — a fill event
287
140
  // appends to `order.fills`, and re-creating an entity resets its totals — and
288
141
  // re-delivery is designed in: a resumed subscription replays from a cursor, and
289
- // the replay boundary is a whole batch. Same predicate as the server's
290
- // `already_delivered`, so client and server agree on what "already sent" means.
142
+ // the replay boundary is a whole batch.
291
143
  const at = { since: frame.batch, sinceBook: frame.book };
292
- if (compareCursor(at, this.cursor) <= 0)
144
+ if (this.stream.delivered(at))
293
145
  return;
294
146
  const events = applyOrdersFrame(frame, this.byId, { account: this.account });
295
- // A socket-level reconnect resubscribes from whatever is stored here.
296
- this.cursor = at;
297
- this.sub?.update(at);
147
+ this.stream.advance(at);
298
148
  this.rebuild();
299
149
  // Strictly after `rebuild()`: a listener that reads the resource in response to an
300
150
  // event must see the state that event produced, not the state before it.
@@ -1 +1 @@
1
- {"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/sync/orders.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kFAAkF;AAClF,2DAA2D;AAC3D,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,4EAA4E;AAC5E,iFAAiF;AACjF,mBAAmB;AAInB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAqC,MAAM,oBAAoB,CAAC;AAInG;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAEzC,sEAAsE;AACtE,MAAM,WAAW,GAAG,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAc,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,CAAY,EAAE,CAAY;IACtD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC5B,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC5B,IAAI,MA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;QACb,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QACzB,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/E,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW;YAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC9F,6EAA6E;QAC7E,8EAA8E;QAC9E,+EAA+E;QAC/E,+EAA+E;QAC/E,8EAA8E;QAC9E,mDAAmD;QACnD,MAAM,EAAE,GAAG,CAAC,CAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,gBAAgB,CAAC;QACjE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;CACF"}
@@ -1,9 +1,13 @@
1
1
  import type { Address, MarketId } from "../types/public.js";
2
+ import type { WireFillRow } from "../types/wire.js";
2
3
  import { type RpcOptions } from "../transport/jsonrpc.js";
3
- import type { PodRestClient } from "../transport/rest.js";
4
+ import { type PodRestClient } from "../transport/rest.js";
4
5
  export interface PnlPoint {
5
6
  time: number;
6
7
  pnl: bigint;
8
+ /** Absolute account value at the point; absent when the node does not
9
+ * serve the activity feed the deposits and transfers come from. */
10
+ accountValue?: bigint;
7
11
  }
8
12
  export interface PnlHistory {
9
13
  points: PnlPoint[];
@@ -36,12 +40,17 @@ export interface PnlLeg {
36
40
  basis?: bigint;
37
41
  }
38
42
  export interface PnlEvent {
39
- market: MarketId;
43
+ /** Absent on a cash movement. */
44
+ market?: MarketId;
40
45
  timeUs: number;
46
+ /** Signed size for a market event; the signed native amount for `cash`. */
41
47
  deltaSize: bigint;
42
- /** Fill price; unused for withdrawals. */
48
+ /** Fill price; unused for withdrawals, deposits and cash. */
43
49
  price: bigint;
44
- kind: "fill" | "withdraw" | "sweep";
50
+ /** `withdraw` and `deposit` are spot token movements: a withdrawal leaves at
51
+ * the average cost, a deposit arrives marked at the tick's clearing price.
52
+ * `cash` is native money in or out, which moves account value only. */
53
+ kind: "fill" | "withdraw" | "deposit" | "sweep" | "cash";
45
54
  }
46
55
  export interface PnlTick {
47
56
  mark: bigint;
@@ -56,34 +65,32 @@ export interface PnlFoldInput {
56
65
  gridUs: number[];
57
66
  /** Newest tick at or before `timeUs`. */
58
67
  tickAt: (market: MarketId, timeUs: number) => PnlTick | undefined;
68
+ /** Account value at the reference tick; points carry `accountValue` when given. */
69
+ accountValueRef?: bigint;
59
70
  }
60
71
  /** The backward walk. Feed events newest-first, ask for points newest-first;
61
72
  * every event after a point must have been fed before the point is asked. */
62
73
  export declare class PnlWalker {
63
74
  private readonly tickAt;
64
75
  private readonly refTimeUs;
76
+ private readonly accountValueRef?;
65
77
  readonly warnings: string[];
66
78
  private readonly state;
67
79
  private pending;
68
80
  private acc;
81
+ private flows;
69
82
  private refValue?;
70
- constructor(legs: PnlLeg[], tickAt: (market: MarketId, timeUs: number) => PnlTick | undefined, refTimeUs: number);
83
+ constructor(legs: PnlLeg[], tickAt: (market: MarketId, timeUs: number) => PnlTick | undefined, refTimeUs: number, accountValueRef?: bigint | undefined);
71
84
  /** A market first seen in an old fill: flat at the reference. */
72
85
  touch(market: MarketId, kind: "perp" | "spot"): void;
73
86
  feed(events: PnlEvent[]): void;
74
87
  point(t: number): PnlPoint;
75
88
  private value;
89
+ /** The PnL adjustment and the non-PnL money value carried by the event. */
76
90
  private unapply;
77
91
  }
78
92
  export declare function foldPnlHistory(input: PnlFoldInput): PnlHistory;
79
- interface WireFill {
80
- orderbook_id: string;
81
- order_id: string;
82
- initial_size: string;
83
- base_amount: string;
84
- timestamp: number;
85
- price: string;
86
- }
93
+ type WireFill = WireFillRow;
87
94
  /** Immutable inputs shared by every window size and every refresh: fills as
88
95
  * events keyed by the time ranges they cover, and ticks keyed by market and
89
96
  * time. The fold is recomputed per request; only uncovered ranges and unseen
@@ -93,12 +100,22 @@ export declare class PnlHistoryCache {
93
100
  readonly ticks: Map<string, PnlTick>;
94
101
  /** Times at which every market's row was fetched at once. */
95
102
  readonly tickTimes: Set<number>;
103
+ /** Per market, the latest time known to have no row at or before it. A
104
+ * market has no rows before its first tick, so one empty answer rules out
105
+ * every earlier point without a call. */
106
+ readonly noRowBefore: Map<`0x${string}`, number>;
107
+ /** Set when a range was cached from a node without the activity feed; the
108
+ * next run that does get flows drops the cache so those ranges are refetched. */
109
+ flowsMissing: boolean;
96
110
  private events;
97
111
  private coverage;
98
112
  /** About 150 bytes per event and per tick, so the default cap is on the
99
113
  * order of 50 MB with its ticks. */
100
114
  constructor(maxEvents?: number);
101
115
  clear(): void;
116
+ /** Whether a tick for the market at the time can exist at all. */
117
+ mayHaveTick(market: MarketId, timeUs: number): boolean;
118
+ noteEmpty(market: MarketId, timeUs: number): void;
102
119
  /** Sub-ranges of [from, to) not yet covered. */
103
120
  missing(from: number, to: number): {
104
121
  from: number;
@@ -107,6 +124,8 @@ export declare class PnlHistoryCache {
107
124
  add(from: number, to: number, events: PnlEvent[]): void;
108
125
  /** Events with from ≤ time < to, newest first. */
109
126
  slice(from: number, to: number): PnlEvent[];
127
+ /** Drop a range so it is fetched again. */
128
+ forget(from: number, to: number): void;
110
129
  }
111
130
  export interface PnlHistoryDeps {
112
131
  rest: PodRestClient;
@@ -114,7 +133,7 @@ export interface PnlHistoryDeps {
114
133
  fetch?: typeof fetch;
115
134
  cache?: PnlHistoryCache;
116
135
  }
117
- export declare function fetchFills(rpcUrl: string, account: Address, fromUs: number, toUs: number, opts: RpcOptions): Promise<WireFill[]>;
136
+ export declare function fetchFills(rest: PodRestClient, account: Address, fromUs: number, toUs: number, rpcUrl?: string, opts?: RpcOptions): Promise<WireFill[]>;
118
137
  export declare function streamPnlHistory(deps: PnlHistoryDeps, account: Address, q: PnlHistoryQuery): AsyncGenerator<PnlHistoryChunk>;
119
138
  export declare function fetchPnlHistory(deps: PnlHistoryDeps, account: Address, q: PnlHistoryQuery): Promise<PnlHistory>;
120
139
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"pnl-history.d.ts","sourceRoot":"","sources":["../../src/sync/pnl-history.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG5D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,WAAW,QAAQ;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE;AACvD,MAAM,WAAW,UAAU;IAAG,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE;AACtE,MAAM,WAAW,eAAe;IAC9B,SAAS;IACT,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;sDACkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD;;;8BAG8B;AAC9B,MAAM,WAAW,eAAe;IAAG,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CA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