@gvnrdao/dh-sdk 0.0.332 → 0.0.334

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.
@@ -86,6 +86,43 @@ export interface UserRateLimitData {
86
86
  nextResetBlock: string;
87
87
  lastUpdated: string;
88
88
  }
89
+ /**
90
+ * Raw shape of the `GetLoanEvents` document response.
91
+ *
92
+ * Module-scoped so BOTH event paths can share one transform: the per-position
93
+ * `getLoanEvents` fetch, and the wallet-collapsed `GetWalletLoanEvents` fetch that
94
+ * reshapes each position into this same form. Sharing the transform is the point —
95
+ * two hand-written mappings for the same entity WILL drift, which is the exact class
96
+ * of bug that took the PSM reads down for 17 days.
97
+ */
98
+ /**
99
+ * True when the caller narrowed the event set in ANY way.
100
+ *
101
+ * Deliberately conservative: every field counts, including `limit`/`orderDirection` even
102
+ * at their default values. A false negative here would send a narrowed request down the
103
+ * collapsed path and silently return unfiltered data; a false positive only costs the old
104
+ * fan-out. Wrong-but-slow beats wrong-but-wrong.
105
+ */
106
+ /**
107
+ * Narrow an assembled `LoanEvents` in memory.
108
+ *
109
+ * The proxy allowlists GraphQL documents by hash, so a filtered request cannot be
110
+ * expressed as a narrower document — see the note in `getLoanEvents`. The request
111
+ * is therefore always the full shape and the narrowing happens here.
112
+ *
113
+ * `totalEvents` is RECOMPUTED from what survives, so it describes the returned
114
+ * set rather than what the subgraph held. A caller that filtered to
115
+ * `positionCreated` and still saw `totalEvents: 12` would reasonably assume the
116
+ * filter had not applied.
117
+ */
118
+ export declare function applyLoanEventsFilter(events: LoanEvents, opts: {
119
+ wantsEvent: (kind: NonNullable<LoanEventsFilter["eventTypes"]>[number]) => boolean;
120
+ fromTimestamp?: string;
121
+ toTimestamp?: string;
122
+ fromBlock?: string;
123
+ toBlock?: string;
124
+ limit: number;
125
+ }): LoanEvents;
89
126
  export interface LoanEventsQueryResponse {
90
127
  position: {
91
128
  id: string;