@inodra/sui 0.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/LICENSE +202 -0
- package/README.md +237 -0
- package/bin/inodra-sui.mjs +2 -0
- package/dist/chunk-3CBLVI6J.js +426 -0
- package/dist/chunk-3CBLVI6J.js.map +1 -0
- package/dist/chunk-4HKKW5QN.js +80 -0
- package/dist/chunk-4HKKW5QN.js.map +1 -0
- package/dist/chunk-74XGJJJI.js +33 -0
- package/dist/chunk-74XGJJJI.js.map +1 -0
- package/dist/chunk-D6FZYWG7.js +99 -0
- package/dist/chunk-D6FZYWG7.js.map +1 -0
- package/dist/chunk-LZZMTSLH.js +31 -0
- package/dist/chunk-LZZMTSLH.js.map +1 -0
- package/dist/chunk-M3M2L6BW.js +29 -0
- package/dist/chunk-M3M2L6BW.js.map +1 -0
- package/dist/chunk-NSXRC5XW.js +298 -0
- package/dist/chunk-NSXRC5XW.js.map +1 -0
- package/dist/chunk-OGMBYWTG.js +537 -0
- package/dist/chunk-OGMBYWTG.js.map +1 -0
- package/dist/chunk-U6D5LGNF.js +111 -0
- package/dist/chunk-U6D5LGNF.js.map +1 -0
- package/dist/chunk-ZSW3EWGF.js +539 -0
- package/dist/chunk-ZSW3EWGF.js.map +1 -0
- package/dist/cli.js +665 -0
- package/dist/cli.js.map +1 -0
- package/dist/events.cjs +3273 -0
- package/dist/events.cjs.map +1 -0
- package/dist/events.d.cts +47 -0
- package/dist/events.d.ts +47 -0
- package/dist/events.js +2578 -0
- package/dist/events.js.map +1 -0
- package/dist/graphql.cjs +129 -0
- package/dist/graphql.cjs.map +1 -0
- package/dist/graphql.d.cts +36 -0
- package/dist/graphql.d.ts +36 -0
- package/dist/graphql.js +10 -0
- package/dist/graphql.js.map +1 -0
- package/dist/grpc-web.cjs +129 -0
- package/dist/grpc-web.cjs.map +1 -0
- package/dist/grpc-web.d.cts +31 -0
- package/dist/grpc-web.d.ts +31 -0
- package/dist/grpc-web.js +10 -0
- package/dist/grpc-web.js.map +1 -0
- package/dist/grpc.cjs +131 -0
- package/dist/grpc.cjs.map +1 -0
- package/dist/grpc.d.cts +34 -0
- package/dist/grpc.d.ts +34 -0
- package/dist/grpc.js +10 -0
- package/dist/grpc.js.map +1 -0
- package/dist/index-CGBN_EI5.d.ts +4800 -0
- package/dist/index-CVO2Kj8a.d.cts +4800 -0
- package/dist/index.cjs +4723 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.ts +504 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/manage.cjs +376 -0
- package/dist/manage.cjs.map +1 -0
- package/dist/manage.d.cts +2 -0
- package/dist/manage.d.ts +2 -0
- package/dist/manage.js +8 -0
- package/dist/manage.js.map +1 -0
- package/dist/network-CEg2MJY3.d.cts +60 -0
- package/dist/network-CEg2MJY3.d.ts +60 -0
- package/dist/node.cjs +4759 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +28 -0
- package/dist/node.d.ts +28 -0
- package/dist/node.js +73 -0
- package/dist/node.js.map +1 -0
- package/dist/reflection-Bx44-Fs1.d.ts +4639 -0
- package/dist/reflection-Cf7WFH6H.d.cts +4639 -0
- package/dist/reflection-FEGYA7DU.js +9 -0
- package/dist/reflection-FEGYA7DU.js.map +1 -0
- package/dist/runtime-OWKF3LZ7.js +37 -0
- package/dist/runtime-OWKF3LZ7.js.map +1 -0
- package/dist/warp.cjs +633 -0
- package/dist/warp.cjs.map +1 -0
- package/dist/warp.d.cts +195 -0
- package/dist/warp.d.ts +195 -0
- package/dist/warp.js +12 -0
- package/dist/warp.js.map +1 -0
- package/dist/webhooks.cjs +104 -0
- package/dist/webhooks.cjs.map +1 -0
- package/dist/webhooks.d.cts +35 -0
- package/dist/webhooks.d.ts +35 -0
- package/dist/webhooks.js +7 -0
- package/dist/webhooks.js.map +1 -0
- package/llms.txt +189 -0
- package/package.json +119 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import {
|
|
2
|
+
verifyWebhookSignature
|
|
3
|
+
} from "./chunk-4HKKW5QN.js";
|
|
4
|
+
import {
|
|
5
|
+
createInodraGrpcWebClient
|
|
6
|
+
} from "./chunk-M3M2L6BW.js";
|
|
7
|
+
import {
|
|
8
|
+
createInodraGraphQLClient
|
|
9
|
+
} from "./chunk-74XGJJJI.js";
|
|
10
|
+
import {
|
|
11
|
+
WarpSseStream,
|
|
12
|
+
WarpWebSocketStream,
|
|
13
|
+
iterateStream
|
|
14
|
+
} from "./chunk-ZSW3EWGF.js";
|
|
15
|
+
import {
|
|
16
|
+
InodraHttpClient,
|
|
17
|
+
InodraWebhookSignatureError
|
|
18
|
+
} from "./chunk-NSXRC5XW.js";
|
|
19
|
+
import {
|
|
20
|
+
INODRA_ENDPOINTS,
|
|
21
|
+
authFromOptions
|
|
22
|
+
} from "./chunk-U6D5LGNF.js";
|
|
23
|
+
|
|
24
|
+
// src/namespaces/account.ts
|
|
25
|
+
var AccountNamespace = class {
|
|
26
|
+
http;
|
|
27
|
+
constructor(http) {
|
|
28
|
+
this.http = http;
|
|
29
|
+
}
|
|
30
|
+
/** Who am I — key, organization, project, network, tier, subscription. */
|
|
31
|
+
me() {
|
|
32
|
+
return this.http.request("GET", "/auth/me");
|
|
33
|
+
}
|
|
34
|
+
/** Usage stats for the current billing period (CU, requests, latency). */
|
|
35
|
+
usage() {
|
|
36
|
+
return this.http.request("GET", "/usage/stats");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/namespaces/catalog.ts
|
|
41
|
+
var CatalogNamespace = class {
|
|
42
|
+
http;
|
|
43
|
+
constructor(http) {
|
|
44
|
+
this.http = http;
|
|
45
|
+
}
|
|
46
|
+
protocols(query) {
|
|
47
|
+
return this.http.request("GET", "/catalog/protocols", { query });
|
|
48
|
+
}
|
|
49
|
+
events(query) {
|
|
50
|
+
return this.http.request("GET", "/catalog/events", { query });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/core/openapi.ts
|
|
55
|
+
async function* paginate(fetchPage) {
|
|
56
|
+
let cursor;
|
|
57
|
+
for (; ; ) {
|
|
58
|
+
const page = await fetchPage(cursor);
|
|
59
|
+
yield* page.data;
|
|
60
|
+
if (!page.pagination.hasNext || !page.pagination.cursor) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
cursor = page.pagination.cursor;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/namespaces/data.ts
|
|
68
|
+
var DataNamespace = class {
|
|
69
|
+
http;
|
|
70
|
+
constructor(http) {
|
|
71
|
+
this.http = http;
|
|
72
|
+
}
|
|
73
|
+
accounts = {
|
|
74
|
+
get: (address) => this.http.request("GET", `/accounts/${encodeURIComponent(address)}`),
|
|
75
|
+
balance: (address) => this.http.request(
|
|
76
|
+
"GET",
|
|
77
|
+
`/accounts/${encodeURIComponent(address)}/balance`
|
|
78
|
+
),
|
|
79
|
+
objects: (address, query) => this.http.request(
|
|
80
|
+
"GET",
|
|
81
|
+
`/accounts/${encodeURIComponent(address)}/objects`,
|
|
82
|
+
{ query }
|
|
83
|
+
),
|
|
84
|
+
/** Every owned object, walking all pages lazily. */
|
|
85
|
+
iterateObjects: (address, query) => paginate(
|
|
86
|
+
(cursor) => this.accounts.objects(address, { ...query, cursor })
|
|
87
|
+
),
|
|
88
|
+
transactions: (address, query) => this.http.request(
|
|
89
|
+
"GET",
|
|
90
|
+
`/accounts/${encodeURIComponent(address)}/transactions`,
|
|
91
|
+
{ query }
|
|
92
|
+
),
|
|
93
|
+
/** Every transaction, walking all pages lazily. */
|
|
94
|
+
iterateTransactions: (address, query) => paginate(
|
|
95
|
+
(cursor) => this.accounts.transactions(address, { ...query, cursor })
|
|
96
|
+
),
|
|
97
|
+
delegations: (address) => this.http.request(
|
|
98
|
+
"GET",
|
|
99
|
+
`/accounts/${encodeURIComponent(address)}/delegations`
|
|
100
|
+
)
|
|
101
|
+
};
|
|
102
|
+
coins = {
|
|
103
|
+
/** Coin denomination (supply, holders, decimals, …). */
|
|
104
|
+
get: (coinType) => this.http.request("GET", `/coins/${encodeURIComponent(coinType)}`),
|
|
105
|
+
/** Display metadata: name, symbol, icon, description, links. */
|
|
106
|
+
metadata: (coinType) => this.http.request("GET", `/coins/type/${encodeURIComponent(coinType)}`)
|
|
107
|
+
};
|
|
108
|
+
objects = {
|
|
109
|
+
/** Metadata (type, name, image, project) for one object id. */
|
|
110
|
+
metadata: (input) => this.http.request("POST", "/objects/metadata", {
|
|
111
|
+
body: input,
|
|
112
|
+
idempotent: true
|
|
113
|
+
}),
|
|
114
|
+
transactions: (objectId, query) => this.http.request(
|
|
115
|
+
"GET",
|
|
116
|
+
`/objects/${encodeURIComponent(objectId)}/transactions`,
|
|
117
|
+
{ query }
|
|
118
|
+
),
|
|
119
|
+
/** Every transaction touching the object, walking all pages lazily. */
|
|
120
|
+
iterateTransactions: (objectId, query) => paginate(
|
|
121
|
+
(cursor) => this.objects.transactions(objectId, { ...query, cursor })
|
|
122
|
+
)
|
|
123
|
+
};
|
|
124
|
+
packages = {
|
|
125
|
+
get: (packageId) => this.http.request("GET", `/packages/${encodeURIComponent(packageId)}`)
|
|
126
|
+
};
|
|
127
|
+
chain = {
|
|
128
|
+
info: () => this.http.request("GET", "/chain/info"),
|
|
129
|
+
staking: () => this.http.request("GET", "/chain/staking"),
|
|
130
|
+
stats: () => this.http.request("GET", "/chain/stats")
|
|
131
|
+
};
|
|
132
|
+
validators = {
|
|
133
|
+
list: (query) => this.http.request("GET", "/validators", { query }),
|
|
134
|
+
apy: () => this.http.request("GET", "/validators/apy"),
|
|
135
|
+
commission: () => this.http.request("GET", "/validators/commission"),
|
|
136
|
+
get: (validatorAddress) => this.http.request(
|
|
137
|
+
"GET",
|
|
138
|
+
`/validators/${encodeURIComponent(validatorAddress)}`
|
|
139
|
+
)
|
|
140
|
+
};
|
|
141
|
+
suins = {
|
|
142
|
+
/** SuiNS name → address. */
|
|
143
|
+
resolve: (name) => this.http.request("GET", `/suins/resolve/${encodeURIComponent(name)}`),
|
|
144
|
+
/** Address → primary SuiNS name. */
|
|
145
|
+
reverse: (address) => this.http.request(
|
|
146
|
+
"GET",
|
|
147
|
+
`/suins/reverse/${encodeURIComponent(address)}`
|
|
148
|
+
),
|
|
149
|
+
resolveBatch: (input) => this.http.request("POST", "/suins/resolve/batch", {
|
|
150
|
+
body: input,
|
|
151
|
+
idempotent: true
|
|
152
|
+
}),
|
|
153
|
+
availability: (name) => this.http.request(
|
|
154
|
+
"GET",
|
|
155
|
+
`/suins/availability/${encodeURIComponent(name)}`
|
|
156
|
+
)
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// src/namespaces/events.ts
|
|
161
|
+
var EventsNamespace = class {
|
|
162
|
+
ctx;
|
|
163
|
+
reflectorPromise;
|
|
164
|
+
constructor(ctx) {
|
|
165
|
+
this.ctx = ctx;
|
|
166
|
+
}
|
|
167
|
+
/** The underlying reflector (shared cache across calls). */
|
|
168
|
+
reflector() {
|
|
169
|
+
this.reflectorPromise ??= import("./reflection-FEGYA7DU.js").then(
|
|
170
|
+
(module) => new module.EventSchemaReflector({
|
|
171
|
+
auth: this.ctx.auth,
|
|
172
|
+
network: this.ctx.network,
|
|
173
|
+
url: this.ctx.graphqlUrl,
|
|
174
|
+
fetch: this.ctx.fetch
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
return this.reflectorPromise;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Build (and cache) a loose, normalizing zod schema for any concrete
|
|
181
|
+
* Move event type, by reflecting its struct layout on-chain. Generic
|
|
182
|
+
* types are typed concretely from their instantiation.
|
|
183
|
+
*/
|
|
184
|
+
async schemaFor(type) {
|
|
185
|
+
return (await this.reflector()).schemaFor(type);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Validate + normalize an event payload against the reflected schema.
|
|
189
|
+
* Accepts a Warp stream message, a bare event payload, or a webhook
|
|
190
|
+
* body. Returns undefined for other event types; throws on schema
|
|
191
|
+
* mismatch. Pass a base type (no `<…>`) to match every instantiation —
|
|
192
|
+
* each is reflected and typed concretely.
|
|
193
|
+
*/
|
|
194
|
+
async parseEvent(message, type) {
|
|
195
|
+
return (await this.reflector()).parseEvent(message, type);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// src/namespaces/warp.ts
|
|
200
|
+
var WarpNamespace = class {
|
|
201
|
+
ctx;
|
|
202
|
+
constructor(ctx) {
|
|
203
|
+
this.ctx = ctx;
|
|
204
|
+
}
|
|
205
|
+
createEventStream(input) {
|
|
206
|
+
return this.ctx.http.request("POST", "/warp/events", { body: input });
|
|
207
|
+
}
|
|
208
|
+
createAddressStream(input) {
|
|
209
|
+
return this.ctx.http.request("POST", "/warp/addresses", { body: input });
|
|
210
|
+
}
|
|
211
|
+
createCoinStream(input) {
|
|
212
|
+
return this.ctx.http.request("POST", "/warp/coins", { body: input });
|
|
213
|
+
}
|
|
214
|
+
createObjectStream(input) {
|
|
215
|
+
return this.ctx.http.request("POST", "/warp/objects", { body: input });
|
|
216
|
+
}
|
|
217
|
+
list() {
|
|
218
|
+
return this.ctx.http.request("GET", "/warp");
|
|
219
|
+
}
|
|
220
|
+
get(id) {
|
|
221
|
+
return this.ctx.http.request("GET", `/warp/${encodeURIComponent(id)}`);
|
|
222
|
+
}
|
|
223
|
+
update(id, input) {
|
|
224
|
+
return this.ctx.http.request("PUT", `/warp/${encodeURIComponent(id)}`, {
|
|
225
|
+
body: input
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
delete(id) {
|
|
229
|
+
return this.ctx.http.request("DELETE", `/warp/${encodeURIComponent(id)}`);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Open an SSE connection to a Warp subscription and start it.
|
|
233
|
+
* At-least-once delivery; reconnects resume from the last event ID.
|
|
234
|
+
*/
|
|
235
|
+
connect(subscriptionId, options = {}) {
|
|
236
|
+
const stream = new WarpSseStream({
|
|
237
|
+
...options,
|
|
238
|
+
auth: this.ctx.auth,
|
|
239
|
+
subscriptionId,
|
|
240
|
+
network: this.ctx.network,
|
|
241
|
+
url: options.url ?? this.sseUrl(subscriptionId),
|
|
242
|
+
fetch: options.fetch ?? this.ctx.fetch
|
|
243
|
+
});
|
|
244
|
+
stream.connect();
|
|
245
|
+
return stream;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Open a WebSocket connection to a Warp subscription and start it.
|
|
249
|
+
* Exactly-once delivery via acks (automatic by default).
|
|
250
|
+
*/
|
|
251
|
+
connectWebSocket(subscriptionId, options = {}) {
|
|
252
|
+
const stream = new WarpWebSocketStream({
|
|
253
|
+
...options,
|
|
254
|
+
auth: this.ctx.auth,
|
|
255
|
+
subscriptionId,
|
|
256
|
+
network: this.ctx.network,
|
|
257
|
+
url: options.url ?? this.wsUrl(subscriptionId)
|
|
258
|
+
});
|
|
259
|
+
stream.connect();
|
|
260
|
+
return stream;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* One call from catalog id to typed live events: resolves the event's
|
|
264
|
+
* canonical type for this network, creates the subscription, connects,
|
|
265
|
+
* and yields validated payloads.
|
|
266
|
+
*
|
|
267
|
+
* ```ts
|
|
268
|
+
* const swaps = await inodra.warp.streamCatalogEvent("cetus.swap", {
|
|
269
|
+
* ephemeral: true,
|
|
270
|
+
* });
|
|
271
|
+
* for await (const { payload, envelope } of swaps) {
|
|
272
|
+
* console.log(envelope.txDigest, payload.amount_in);
|
|
273
|
+
* }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
async streamCatalogEvent(id, options = {}) {
|
|
277
|
+
const events = await import("./events.js");
|
|
278
|
+
const event = events.catalogEvents[id];
|
|
279
|
+
if (!event) {
|
|
280
|
+
throw new Error(`Unknown catalog event id: ${String(id)}`);
|
|
281
|
+
}
|
|
282
|
+
const deployments = event.deployments;
|
|
283
|
+
const deployment = deployments.find(
|
|
284
|
+
(d) => d.network === this.ctx.network && d.primary
|
|
285
|
+
) ?? deployments.find((d) => d.network === this.ctx.network);
|
|
286
|
+
if (!deployment) {
|
|
287
|
+
throw new Error(
|
|
288
|
+
`Catalog event ${String(id)} has no verified deployment on ${this.ctx.network}`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
const { sender, eventFieldFilters, transport, ephemeral, ...connectOptions } = options;
|
|
292
|
+
const created = await this.createEventStream({
|
|
293
|
+
eventType: deployment.eventType,
|
|
294
|
+
sender,
|
|
295
|
+
eventFieldFilters
|
|
296
|
+
});
|
|
297
|
+
const subscription = created.data;
|
|
298
|
+
let stream;
|
|
299
|
+
try {
|
|
300
|
+
stream = transport === "ws" ? this.connectWebSocket(subscription.id, connectOptions) : this.connect(subscription.id, connectOptions);
|
|
301
|
+
} catch (error) {
|
|
302
|
+
if (ephemeral) {
|
|
303
|
+
await this.delete(subscription.id).catch(() => {
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
throw error;
|
|
307
|
+
}
|
|
308
|
+
let cleaned = false;
|
|
309
|
+
const close = async () => {
|
|
310
|
+
stream.close();
|
|
311
|
+
if (ephemeral && !cleaned) {
|
|
312
|
+
cleaned = true;
|
|
313
|
+
await this.delete(subscription.id);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const network = this.ctx.network;
|
|
317
|
+
return {
|
|
318
|
+
subscription,
|
|
319
|
+
stream,
|
|
320
|
+
close,
|
|
321
|
+
async *[Symbol.asyncIterator]() {
|
|
322
|
+
try {
|
|
323
|
+
for await (const raw of iterateStream(stream, {
|
|
324
|
+
closeOnReturn: false
|
|
325
|
+
})) {
|
|
326
|
+
const payload = events.parseCatalogEvent(raw, id, { network });
|
|
327
|
+
if (payload === void 0) {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
const envelope = events.warpEventPayloadSchema.parse(raw.data);
|
|
331
|
+
yield { payload, envelope };
|
|
332
|
+
}
|
|
333
|
+
} finally {
|
|
334
|
+
await close();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
sseUrl(subscriptionId) {
|
|
340
|
+
if (!this.ctx.restBaseUrl) {
|
|
341
|
+
return void 0;
|
|
342
|
+
}
|
|
343
|
+
return `${this.ctx.restBaseUrl}/warp/${encodeURIComponent(subscriptionId)}/stream`;
|
|
344
|
+
}
|
|
345
|
+
wsUrl(subscriptionId) {
|
|
346
|
+
if (!this.ctx.warpWsBaseUrl) {
|
|
347
|
+
return void 0;
|
|
348
|
+
}
|
|
349
|
+
return `${this.ctx.warpWsBaseUrl}/warp/${encodeURIComponent(subscriptionId)}/ws`;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/namespaces/webhooks.ts
|
|
354
|
+
var WebhooksNamespace = class {
|
|
355
|
+
http;
|
|
356
|
+
constructor(http) {
|
|
357
|
+
this.http = http;
|
|
358
|
+
}
|
|
359
|
+
createEvent(input) {
|
|
360
|
+
return this.http.request("POST", "/webhooks/events", { body: input });
|
|
361
|
+
}
|
|
362
|
+
createAddress(input) {
|
|
363
|
+
return this.http.request("POST", "/webhooks/addresses", { body: input });
|
|
364
|
+
}
|
|
365
|
+
createCoin(input) {
|
|
366
|
+
return this.http.request("POST", "/webhooks/coins", { body: input });
|
|
367
|
+
}
|
|
368
|
+
createObject(input) {
|
|
369
|
+
return this.http.request("POST", "/webhooks/objects", { body: input });
|
|
370
|
+
}
|
|
371
|
+
list() {
|
|
372
|
+
return this.http.request("GET", "/webhooks");
|
|
373
|
+
}
|
|
374
|
+
get(id) {
|
|
375
|
+
return this.http.request("GET", `/webhooks/${encodeURIComponent(id)}`);
|
|
376
|
+
}
|
|
377
|
+
update(id, input) {
|
|
378
|
+
return this.http.request("PUT", `/webhooks/${encodeURIComponent(id)}`, {
|
|
379
|
+
body: input
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
delete(id) {
|
|
383
|
+
return this.http.request("DELETE", `/webhooks/${encodeURIComponent(id)}`);
|
|
384
|
+
}
|
|
385
|
+
/** Verify an incoming webhook delivery's X-Inodra-Signature header. */
|
|
386
|
+
verifySignature(options) {
|
|
387
|
+
return verifyWebhookSignature(options);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Verify and parse an incoming event-webhook delivery in one step
|
|
391
|
+
* (Stripe's constructEvent pattern). Throws InodraWebhookSignatureError
|
|
392
|
+
* on a bad or expired signature, and a zod error if the body doesn't
|
|
393
|
+
* look like an Inodra delivery.
|
|
394
|
+
*
|
|
395
|
+
* Pair with `matchCatalogEvent`/`parseCatalogEvent` from
|
|
396
|
+
* `@inodra/sui/events` to narrow the payload to a catalog event type.
|
|
397
|
+
*
|
|
398
|
+
* ```ts
|
|
399
|
+
* const body = await inodra.webhooks.constructEvent({
|
|
400
|
+
* payload: rawBody, // exact raw string — do not JSON.parse first
|
|
401
|
+
* signature: req.headers["x-inodra-signature"],
|
|
402
|
+
* secret: process.env.INODRA_WEBHOOK_SECRET,
|
|
403
|
+
* });
|
|
404
|
+
* const swap = parseCatalogEvent(body, "cetus.swap");
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
async constructEvent(options) {
|
|
408
|
+
const valid = await verifyWebhookSignature(options);
|
|
409
|
+
if (!valid) {
|
|
410
|
+
throw new InodraWebhookSignatureError();
|
|
411
|
+
}
|
|
412
|
+
const { webhookEventBodySchema } = await import("./runtime-OWKF3LZ7.js");
|
|
413
|
+
return webhookEventBodySchema.parse(JSON.parse(options.payload));
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/client.ts
|
|
418
|
+
var Inodra = class {
|
|
419
|
+
network;
|
|
420
|
+
/** The underlying REST transport (shared by all REST namespaces). */
|
|
421
|
+
http;
|
|
422
|
+
options;
|
|
423
|
+
auth;
|
|
424
|
+
memo = /* @__PURE__ */ new Map();
|
|
425
|
+
constructor(options) {
|
|
426
|
+
authFromOptions(options, "Inodra");
|
|
427
|
+
this.options = options;
|
|
428
|
+
this.auth = options.auth ?? { apiKey: options.apiKey };
|
|
429
|
+
this.network = options.network ?? "mainnet";
|
|
430
|
+
this.http = new InodraHttpClient({
|
|
431
|
+
auth: this.auth,
|
|
432
|
+
network: this.network,
|
|
433
|
+
baseUrl: options.endpoints?.rest,
|
|
434
|
+
maxRetries: options.maxRetries,
|
|
435
|
+
timeoutMs: options.timeoutMs,
|
|
436
|
+
fetch: options.fetch,
|
|
437
|
+
onResponseMeta: options.onResponseMeta
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
/** Rate-limit/credit info from the most recent REST response. */
|
|
441
|
+
get lastResponseMeta() {
|
|
442
|
+
return this.http.lastResponseMeta;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Sui gRPC client (@mysten/sui) over Inodra's authenticated gateway.
|
|
446
|
+
* Uses a fetch-based gRPC-Web transport — works in browsers, edge
|
|
447
|
+
* runtimes, and Node. For native HTTP/2 gRPC on Node, use
|
|
448
|
+
* `@inodra/sui/node`.
|
|
449
|
+
*/
|
|
450
|
+
get grpc() {
|
|
451
|
+
return this.lazy("grpc", () => this.createGrpcClient());
|
|
452
|
+
}
|
|
453
|
+
/** Sui GraphQL client (@mysten/sui) over Inodra's authenticated gateway. */
|
|
454
|
+
get graphql() {
|
|
455
|
+
return this.lazy(
|
|
456
|
+
"graphql",
|
|
457
|
+
() => createInodraGraphQLClient({
|
|
458
|
+
auth: this.auth,
|
|
459
|
+
network: this.network,
|
|
460
|
+
url: this.options.endpoints?.graphql
|
|
461
|
+
})
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
/** Warp streams: subscription CRUD + live SSE/WebSocket delivery. */
|
|
465
|
+
get warp() {
|
|
466
|
+
return this.lazy(
|
|
467
|
+
"warp",
|
|
468
|
+
() => new WarpNamespace({
|
|
469
|
+
http: this.http,
|
|
470
|
+
auth: this.auth,
|
|
471
|
+
network: this.network,
|
|
472
|
+
restBaseUrl: this.options.endpoints?.rest,
|
|
473
|
+
warpWsBaseUrl: this.options.endpoints?.warpWs,
|
|
474
|
+
fetch: this.options.fetch
|
|
475
|
+
})
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
/** Webhooks: subscription CRUD + delivery signature verification. */
|
|
479
|
+
get webhooks() {
|
|
480
|
+
return this.lazy("webhooks", () => new WebhooksNamespace(this.http));
|
|
481
|
+
}
|
|
482
|
+
/** Indexer-backed data: accounts, coins, packages, validators, SuiNS, …. */
|
|
483
|
+
get data() {
|
|
484
|
+
return this.lazy("data", () => new DataNamespace(this.http));
|
|
485
|
+
}
|
|
486
|
+
/** Curated protocol event catalog (live view). */
|
|
487
|
+
get catalog() {
|
|
488
|
+
return this.lazy("catalog", () => new CatalogNamespace(this.http));
|
|
489
|
+
}
|
|
490
|
+
/** The authenticated principal: key introspection + usage stats. */
|
|
491
|
+
get account() {
|
|
492
|
+
return this.lazy("account", () => new AccountNamespace(this.http));
|
|
493
|
+
}
|
|
494
|
+
/** Reflection-based typed payloads for arbitrary (uncataloged) events. */
|
|
495
|
+
get events() {
|
|
496
|
+
return this.lazy(
|
|
497
|
+
"events",
|
|
498
|
+
() => new EventsNamespace({
|
|
499
|
+
auth: this.auth,
|
|
500
|
+
network: this.network,
|
|
501
|
+
graphqlUrl: this.options.endpoints?.graphql,
|
|
502
|
+
fetch: this.options.fetch
|
|
503
|
+
})
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
/** Default endpoints for this client's network. */
|
|
507
|
+
get endpoints() {
|
|
508
|
+
return INODRA_ENDPOINTS[this.network];
|
|
509
|
+
}
|
|
510
|
+
createGrpcClient() {
|
|
511
|
+
return createInodraGrpcWebClient({
|
|
512
|
+
auth: this.auth,
|
|
513
|
+
network: this.network,
|
|
514
|
+
baseUrl: this.options.endpoints?.grpcWeb
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
lazy(key, create) {
|
|
518
|
+
let value = this.memo.get(key);
|
|
519
|
+
if (value === void 0) {
|
|
520
|
+
value = create();
|
|
521
|
+
this.memo.set(key, value);
|
|
522
|
+
}
|
|
523
|
+
return value;
|
|
524
|
+
}
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export {
|
|
528
|
+
AccountNamespace,
|
|
529
|
+
CatalogNamespace,
|
|
530
|
+
paginate,
|
|
531
|
+
DataNamespace,
|
|
532
|
+
EventsNamespace,
|
|
533
|
+
WarpNamespace,
|
|
534
|
+
WebhooksNamespace,
|
|
535
|
+
Inodra
|
|
536
|
+
};
|
|
537
|
+
//# sourceMappingURL=chunk-OGMBYWTG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/namespaces/account.ts","../src/namespaces/catalog.ts","../src/core/openapi.ts","../src/namespaces/data.ts","../src/namespaces/events.ts","../src/namespaces/warp.ts","../src/namespaces/webhooks.ts","../src/client.ts"],"sourcesContent":["import type { InodraHttpClient } from \"../core/http.js\";\nimport type { Operation, Success } from \"../core/openapi.js\";\n\ntype MeOp = Operation<\"/auth/me\", \"get\">;\ntype UsageOp = Operation<\"/usage/stats\", \"get\">;\n\n/**\n * The authenticated principal: API key introspection and usage/billing stats.\n *\n * ```ts\n * const me = await inodra.account.me(); // org, project, network, tier\n * const usage = await inodra.account.usage(); // CU consumed/remaining, p95s\n * ```\n */\nexport class AccountNamespace {\n\tprivate readonly http: InodraHttpClient;\n\n\tconstructor(http: InodraHttpClient) {\n\t\tthis.http = http;\n\t}\n\n\t/** Who am I — key, organization, project, network, tier, subscription. */\n\tme(): Promise<Success<MeOp>> {\n\t\treturn this.http.request(\"GET\", \"/auth/me\");\n\t}\n\n\t/** Usage stats for the current billing period (CU, requests, latency). */\n\tusage(): Promise<Success<UsageOp>> {\n\t\treturn this.http.request(\"GET\", \"/usage/stats\");\n\t}\n}\n","import type { InodraHttpClient } from \"../core/http.js\";\nimport type { Operation, Query, Success } from \"../core/openapi.js\";\n\ntype ProtocolsOp = Operation<\"/catalog/protocols\", \"get\">;\ntype EventsOp = Operation<\"/catalog/events\", \"get\">;\n\n/**\n * Curated protocol event catalog — the live counterpart of the generated\n * schemas in `@inodra/sui/events`. Use it to browse protocols/events and\n * pre-fill webhook or Warp subscriptions with canonical event types.\n */\nexport class CatalogNamespace {\n\tprivate readonly http: InodraHttpClient;\n\n\tconstructor(http: InodraHttpClient) {\n\t\tthis.http = http;\n\t}\n\n\tprotocols(query?: Query<ProtocolsOp>): Promise<Success<ProtocolsOp>> {\n\t\treturn this.http.request(\"GET\", \"/catalog/protocols\", { query });\n\t}\n\n\tevents(query?: Query<EventsOp>): Promise<Success<EventsOp>> {\n\t\treturn this.http.request(\"GET\", \"/catalog/events\", { query });\n\t}\n}\n","/**\n * Conditional-type helpers that derive request/response types from the\n * OpenAPI-generated `paths` (src/generated/api.ts) — namespaces never\n * hand-write API shapes.\n */\nimport type { paths } from \"../generated/api.js\";\n\nexport type Operation<\n\tP extends keyof paths,\n\tM extends keyof paths[P],\n> = NonNullable<paths[P][M]>;\n\ntype JsonContent<T> = T extends { content: { \"application/json\": infer C } }\n\t? C\n\t: never;\n\nexport type Success<O> = O extends { responses: infer R }\n\t? JsonContent<R[Extract<keyof R, 200 | 201>]>\n\t: never;\n\nexport type Body<O> = O extends { requestBody?: infer B }\n\t? JsonContent<NonNullable<B>>\n\t: never;\n\nexport type Query<O> = O extends { parameters: { query?: infer Q } }\n\t? NonNullable<Q>\n\t: never;\n\n/** The `{data, pagination}` envelope used by paginated list endpoints. */\nexport interface Page<T = unknown> {\n\tdata: readonly T[];\n\tpagination: { limit: number; cursor?: string; hasNext: boolean };\n}\n\n/**\n * Lazily walk every page of a cursor-paginated endpoint, yielding items.\n * Endpoints whose `data` is a union of array shapes (e.g. raw vs activity\n * transaction format) yield the union of their element types.\n *\n * ```ts\n * for await (const tx of inodra.data.accounts.iterateTransactions(addr)) { … }\n * ```\n */\nexport async function* paginate<\n\tP extends {\n\t\tdata: readonly unknown[];\n\t\tpagination: { cursor?: string; hasNext: boolean };\n\t},\n>(\n\tfetchPage: (cursor: string | undefined) => Promise<P>,\n): AsyncGenerator<P[\"data\"][number], void, undefined> {\n\tlet cursor: string | undefined;\n\tfor (;;) {\n\t\tconst page = await fetchPage(cursor);\n\t\tyield* page.data as readonly P[\"data\"][number][];\n\t\tif (!page.pagination.hasNext || !page.pagination.cursor) {\n\t\t\treturn;\n\t\t}\n\t\tcursor = page.pagination.cursor;\n\t}\n}\n","import type { InodraHttpClient } from \"../core/http.js\";\nimport {\n\ttype Body,\n\ttype Operation,\n\tpaginate,\n\ttype Query,\n\ttype Success,\n} from \"../core/openapi.js\";\n\ntype AccountOp = Operation<\"/accounts/{address}\", \"get\">;\ntype BalanceOp = Operation<\"/accounts/{address}/balance\", \"get\">;\ntype AccountObjectsOp = Operation<\"/accounts/{address}/objects\", \"get\">;\ntype AccountTxsOp = Operation<\"/accounts/{address}/transactions\", \"get\">;\ntype DelegationsOp = Operation<\"/accounts/{address}/delegations\", \"get\">;\ntype CoinOp = Operation<\"/coins/{coinType}\", \"get\">;\ntype CoinMetadataOp = Operation<\"/coins/type/{coinType}\", \"get\">;\ntype ObjectMetadataOp = Operation<\"/objects/metadata\", \"post\">;\ntype ObjectTxsOp = Operation<\"/objects/{objectId}/transactions\", \"get\">;\ntype PackageOp = Operation<\"/packages/{packageId}\", \"get\">;\ntype ChainInfoOp = Operation<\"/chain/info\", \"get\">;\ntype ChainStakingOp = Operation<\"/chain/staking\", \"get\">;\ntype ChainStatsOp = Operation<\"/chain/stats\", \"get\">;\ntype ValidatorsOp = Operation<\"/validators\", \"get\">;\ntype ValidatorsApyOp = Operation<\"/validators/apy\", \"get\">;\ntype ValidatorsCommissionOp = Operation<\"/validators/commission\", \"get\">;\ntype ValidatorOp = Operation<\"/validators/{validatorAddress}\", \"get\">;\ntype SuinsResolveOp = Operation<\"/suins/resolve/{name}\", \"get\">;\ntype SuinsReverseOp = Operation<\"/suins/reverse/{address}\", \"get\">;\ntype SuinsBatchOp = Operation<\"/suins/resolve/batch\", \"post\">;\ntype SuinsAvailabilityOp = Operation<\"/suins/availability/{name}\", \"get\">;\n\n/**\n * Indexer-backed data API: accounts, coins, objects, packages, chain,\n * validators, and SuiNS. Mainnet only (testnet projects get 403 on these).\n *\n * ```ts\n * const balance = await inodra.data.accounts.balance(\"0x...\");\n * for await (const tx of inodra.data.accounts.iterateTransactions(\"0x...\")) { … }\n * ```\n */\nexport class DataNamespace {\n\tprivate readonly http: InodraHttpClient;\n\n\tconstructor(http: InodraHttpClient) {\n\t\tthis.http = http;\n\t}\n\n\treadonly accounts = {\n\t\tget: (address: string): Promise<Success<AccountOp>> =>\n\t\t\tthis.http.request(\"GET\", `/accounts/${encodeURIComponent(address)}`),\n\t\tbalance: (address: string): Promise<Success<BalanceOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/accounts/${encodeURIComponent(address)}/balance`,\n\t\t\t),\n\t\tobjects: (\n\t\t\taddress: string,\n\t\t\tquery?: Query<AccountObjectsOp>,\n\t\t): Promise<Success<AccountObjectsOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/accounts/${encodeURIComponent(address)}/objects`,\n\t\t\t\t{ query },\n\t\t\t),\n\t\t/** Every owned object, walking all pages lazily. */\n\t\titerateObjects: (address: string, query?: Query<AccountObjectsOp>) =>\n\t\t\tpaginate((cursor) =>\n\t\t\t\tthis.accounts.objects(address, { ...query, cursor }),\n\t\t\t),\n\t\ttransactions: (\n\t\t\taddress: string,\n\t\t\tquery?: Query<AccountTxsOp>,\n\t\t): Promise<Success<AccountTxsOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/accounts/${encodeURIComponent(address)}/transactions`,\n\t\t\t\t{ query },\n\t\t\t),\n\t\t/** Every transaction, walking all pages lazily. */\n\t\titerateTransactions: (address: string, query?: Query<AccountTxsOp>) =>\n\t\t\tpaginate((cursor) =>\n\t\t\t\tthis.accounts.transactions(address, { ...query, cursor }),\n\t\t\t),\n\t\tdelegations: (address: string): Promise<Success<DelegationsOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/accounts/${encodeURIComponent(address)}/delegations`,\n\t\t\t),\n\t};\n\n\treadonly coins = {\n\t\t/** Coin denomination (supply, holders, decimals, …). */\n\t\tget: (coinType: string): Promise<Success<CoinOp>> =>\n\t\t\tthis.http.request(\"GET\", `/coins/${encodeURIComponent(coinType)}`),\n\t\t/** Display metadata: name, symbol, icon, description, links. */\n\t\tmetadata: (coinType: string): Promise<Success<CoinMetadataOp>> =>\n\t\t\tthis.http.request(\"GET\", `/coins/type/${encodeURIComponent(coinType)}`),\n\t};\n\n\treadonly objects = {\n\t\t/** Metadata (type, name, image, project) for one object id. */\n\t\tmetadata: (input: Body<ObjectMetadataOp>): Promise<Success<ObjectMetadataOp>> =>\n\t\t\tthis.http.request(\"POST\", \"/objects/metadata\", {\n\t\t\t\tbody: input,\n\t\t\t\tidempotent: true,\n\t\t\t}),\n\t\ttransactions: (\n\t\t\tobjectId: string,\n\t\t\tquery?: Query<ObjectTxsOp>,\n\t\t): Promise<Success<ObjectTxsOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/objects/${encodeURIComponent(objectId)}/transactions`,\n\t\t\t\t{ query },\n\t\t\t),\n\t\t/** Every transaction touching the object, walking all pages lazily. */\n\t\titerateTransactions: (objectId: string, query?: Query<ObjectTxsOp>) =>\n\t\t\tpaginate((cursor) =>\n\t\t\t\tthis.objects.transactions(objectId, { ...query, cursor }),\n\t\t\t),\n\t};\n\n\treadonly packages = {\n\t\tget: (packageId: string): Promise<Success<PackageOp>> =>\n\t\t\tthis.http.request(\"GET\", `/packages/${encodeURIComponent(packageId)}`),\n\t};\n\n\treadonly chain = {\n\t\tinfo: (): Promise<Success<ChainInfoOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/chain/info\"),\n\t\tstaking: (): Promise<Success<ChainStakingOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/chain/staking\"),\n\t\tstats: (): Promise<Success<ChainStatsOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/chain/stats\"),\n\t};\n\n\treadonly validators = {\n\t\tlist: (query?: Query<ValidatorsOp>): Promise<Success<ValidatorsOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/validators\", { query }),\n\t\tapy: (): Promise<Success<ValidatorsApyOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/validators/apy\"),\n\t\tcommission: (): Promise<Success<ValidatorsCommissionOp>> =>\n\t\t\tthis.http.request(\"GET\", \"/validators/commission\"),\n\t\tget: (validatorAddress: string): Promise<Success<ValidatorOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/validators/${encodeURIComponent(validatorAddress)}`,\n\t\t\t),\n\t};\n\n\treadonly suins = {\n\t\t/** SuiNS name → address. */\n\t\tresolve: (name: string): Promise<Success<SuinsResolveOp>> =>\n\t\t\tthis.http.request(\"GET\", `/suins/resolve/${encodeURIComponent(name)}`),\n\t\t/** Address → primary SuiNS name. */\n\t\treverse: (address: string): Promise<Success<SuinsReverseOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/suins/reverse/${encodeURIComponent(address)}`,\n\t\t\t),\n\t\tresolveBatch: (input: Body<SuinsBatchOp>): Promise<Success<SuinsBatchOp>> =>\n\t\t\tthis.http.request(\"POST\", \"/suins/resolve/batch\", {\n\t\t\t\tbody: input,\n\t\t\t\tidempotent: true,\n\t\t\t}),\n\t\tavailability: (name: string): Promise<Success<SuinsAvailabilityOp>> =>\n\t\t\tthis.http.request(\n\t\t\t\t\"GET\",\n\t\t\t\t`/suins/availability/${encodeURIComponent(name)}`,\n\t\t\t),\n\t};\n}\n","import type { InodraAuth } from \"../core/auth.js\";\nimport type { InodraNetwork } from \"../core/network.js\";\nimport type { EventSchemaReflector } from \"../events/reflection.js\";\n\nexport interface EventsNamespaceContext {\n\tauth: InodraAuth;\n\tnetwork: InodraNetwork;\n\t/** GraphQL endpoint override (custom endpoints). */\n\tgraphqlUrl?: string;\n\tfetch?: typeof globalThis.fetch;\n}\n\n/**\n * Typed payloads for ARBITRARY Move events (beyond the curated catalog) via\n * on-chain struct reflection. Schemas are built once and cached per type.\n *\n * ```ts\n * const schema = await inodra.events.schemaFor(\"0xpkg::vault::Deposit<0x2::sui::SUI>\");\n * stream.on(\"message\", async (msg) => {\n * const payload = await inodra.events.parseEvent(msg, \"0xpkg::vault::Deposit\");\n * if (payload) console.log(payload.amount); // validated + normalized\n * });\n * ```\n *\n * For catalog events prefer the statically-typed helpers in\n * `@inodra/sui/events` (`parseCatalogEvent`) — reflection is for your own\n * or uncataloged protocols. The zod machinery loads on first use.\n */\nexport class EventsNamespace {\n\tprivate readonly ctx: EventsNamespaceContext;\n\tprivate reflectorPromise: Promise<EventSchemaReflector> | undefined;\n\n\tconstructor(ctx: EventsNamespaceContext) {\n\t\tthis.ctx = ctx;\n\t}\n\n\t/** The underlying reflector (shared cache across calls). */\n\treflector(): Promise<EventSchemaReflector> {\n\t\tthis.reflectorPromise ??= import(\"../events/reflection.js\").then(\n\t\t\t(module) =>\n\t\t\t\tnew module.EventSchemaReflector({\n\t\t\t\t\tauth: this.ctx.auth,\n\t\t\t\t\tnetwork: this.ctx.network,\n\t\t\t\t\turl: this.ctx.graphqlUrl,\n\t\t\t\t\tfetch: this.ctx.fetch,\n\t\t\t\t}),\n\t\t);\n\t\treturn this.reflectorPromise;\n\t}\n\n\t/**\n\t * Build (and cache) a loose, normalizing zod schema for any concrete\n\t * Move event type, by reflecting its struct layout on-chain. Generic\n\t * types are typed concretely from their instantiation.\n\t */\n\tasync schemaFor(type: string) {\n\t\treturn (await this.reflector()).schemaFor(type);\n\t}\n\n\t/**\n\t * Validate + normalize an event payload against the reflected schema.\n\t * Accepts a Warp stream message, a bare event payload, or a webhook\n\t * body. Returns undefined for other event types; throws on schema\n\t * mismatch. Pass a base type (no `<…>`) to match every instantiation —\n\t * each is reflected and typed concretely.\n\t */\n\tasync parseEvent(\n\t\tmessage: unknown,\n\t\ttype: string,\n\t): Promise<Record<string, unknown> | undefined> {\n\t\treturn (await this.reflector()).parseEvent(message, type);\n\t}\n}\n","import type { InodraAuth } from \"../core/auth.js\";\nimport type { InodraHttpClient } from \"../core/http.js\";\nimport type { InodraNetwork } from \"../core/network.js\";\nimport type {\n\tCatalogDeployment,\n\tWarpEventPayload,\n} from \"../events/runtime.js\";\nimport type {\n\tCatalogEventId,\n\tCatalogEventPayload,\n} from \"../generated/events.js\";\nimport { iterateStream } from \"../warp/iterate.js\";\nimport type {\n\tCreateAddressStreamInput,\n\tCreateCoinStreamInput,\n\tCreateEventStreamInput,\n\tCreateObjectStreamInput,\n\tCreateStreamResponse,\n\tDeleteStreamResponse,\n\tListStreamsResponse,\n\tUpdateStreamInput,\n\tUpdateStreamResponse,\n\tWarpStream,\n} from \"../manage/index.js\";\nimport { WarpSseStream, type WarpSseStreamOptions } from \"../warp/sse.js\";\nimport {\n\tWarpWebSocketStream,\n\ttype WarpWebSocketStreamOptions,\n} from \"../warp/ws.js\";\n\nexport interface WarpNamespaceContext {\n\thttp: InodraHttpClient;\n\tauth: InodraAuth;\n\tnetwork: InodraNetwork;\n\t/** REST base URL override (custom endpoints) — used for SSE stream URLs. */\n\trestBaseUrl?: string;\n\t/** WS base URL override (custom endpoints). */\n\twarpWsBaseUrl?: string;\n\t/** Custom fetch implementation, threaded into SSE streams. */\n\tfetch?: typeof globalThis.fetch;\n}\n\nexport type ConnectOptions = Omit<\n\tWarpSseStreamOptions,\n\t\"auth\" | \"apiKey\" | \"subscriptionId\" | \"network\"\n>;\nexport type ConnectWebSocketOptions = Omit<\n\tWarpWebSocketStreamOptions,\n\t\"auth\" | \"apiKey\" | \"subscriptionId\" | \"network\"\n>;\n\nexport interface StreamCatalogEventOptions\n\textends ConnectOptions,\n\t\tConnectWebSocketOptions {\n\t/** Optional sender address filter for the subscription. */\n\tsender?: CreateEventStreamInput[\"sender\"];\n\t/** Optional field-level filters for the subscription (max 10). */\n\teventFieldFilters?: CreateEventStreamInput[\"eventFieldFilters\"];\n\t/** Delivery transport. Defaults to \"sse\". */\n\ttransport?: \"sse\" | \"ws\";\n\t/**\n\t * Delete the subscription when the stream closes or iteration ends.\n\t * Defaults to false — pass true for one-off consumers so they don't\n\t * accumulate subscriptions against the plan limit. Note: if the process\n\t * dies before close(), the subscription survives; give long-lived\n\t * consumers a managed subscription instead.\n\t */\n\tephemeral?: boolean;\n}\n\n/** A typed catalog event with its delivery envelope. */\nexport interface CatalogEventMessage<Id extends CatalogEventId> {\n\t/** Validated, normalized Move event payload. */\n\tpayload: CatalogEventPayload<Id>;\n\t/** Delivery envelope: txDigest, checkpoint, timestamp, sender, raw type. */\n\tenvelope: WarpEventPayload;\n}\n\nexport interface CatalogEventStream<Id extends CatalogEventId>\n\textends AsyncIterable<CatalogEventMessage<Id>> {\n\t/** The created Warp subscription (delete it when done unless ephemeral). */\n\tsubscription: CreateStreamResponse[\"data\"];\n\t/** The underlying transport stream (for on(\"error\"), lastEventId, …). */\n\tstream: WarpSseStream | WarpWebSocketStream;\n\t/** Close the stream; deletes the subscription when ephemeral. */\n\tclose(): Promise<void>;\n}\n\n/**\n * Warp streams: subscription CRUD plus live SSE/WebSocket delivery.\n *\n * ```ts\n * const sub = await inodra.warp.createEventStream({ eventType });\n * const stream = inodra.warp.connect(sub.id);\n * stream.on(\"message\", (event) => console.log(event.data));\n * ```\n */\nexport class WarpNamespace {\n\tprivate readonly ctx: WarpNamespaceContext;\n\n\tconstructor(ctx: WarpNamespaceContext) {\n\t\tthis.ctx = ctx;\n\t}\n\n\tcreateEventStream(input: CreateEventStreamInput): Promise<CreateStreamResponse> {\n\t\treturn this.ctx.http.request(\"POST\", \"/warp/events\", { body: input });\n\t}\n\n\tcreateAddressStream(\n\t\tinput: CreateAddressStreamInput,\n\t): Promise<CreateStreamResponse> {\n\t\treturn this.ctx.http.request(\"POST\", \"/warp/addresses\", { body: input });\n\t}\n\n\tcreateCoinStream(input: CreateCoinStreamInput): Promise<CreateStreamResponse> {\n\t\treturn this.ctx.http.request(\"POST\", \"/warp/coins\", { body: input });\n\t}\n\n\tcreateObjectStream(\n\t\tinput: CreateObjectStreamInput,\n\t): Promise<CreateStreamResponse> {\n\t\treturn this.ctx.http.request(\"POST\", \"/warp/objects\", { body: input });\n\t}\n\n\tlist(): Promise<ListStreamsResponse> {\n\t\treturn this.ctx.http.request(\"GET\", \"/warp\");\n\t}\n\n\tget(id: string): Promise<WarpStream> {\n\t\treturn this.ctx.http.request(\"GET\", `/warp/${encodeURIComponent(id)}`);\n\t}\n\n\tupdate(id: string, input: UpdateStreamInput): Promise<UpdateStreamResponse> {\n\t\treturn this.ctx.http.request(\"PUT\", `/warp/${encodeURIComponent(id)}`, {\n\t\t\tbody: input,\n\t\t});\n\t}\n\n\tdelete(id: string): Promise<DeleteStreamResponse> {\n\t\treturn this.ctx.http.request(\"DELETE\", `/warp/${encodeURIComponent(id)}`);\n\t}\n\n\t/**\n\t * Open an SSE connection to a Warp subscription and start it.\n\t * At-least-once delivery; reconnects resume from the last event ID.\n\t */\n\tconnect(subscriptionId: string, options: ConnectOptions = {}): WarpSseStream {\n\t\tconst stream = new WarpSseStream({\n\t\t\t...options,\n\t\t\tauth: this.ctx.auth,\n\t\t\tsubscriptionId,\n\t\t\tnetwork: this.ctx.network,\n\t\t\turl: options.url ?? this.sseUrl(subscriptionId),\n\t\t\tfetch: options.fetch ?? this.ctx.fetch,\n\t\t});\n\t\tstream.connect();\n\t\treturn stream;\n\t}\n\n\t/**\n\t * Open a WebSocket connection to a Warp subscription and start it.\n\t * Exactly-once delivery via acks (automatic by default).\n\t */\n\tconnectWebSocket(\n\t\tsubscriptionId: string,\n\t\toptions: ConnectWebSocketOptions = {},\n\t): WarpWebSocketStream {\n\t\tconst stream = new WarpWebSocketStream({\n\t\t\t...options,\n\t\t\tauth: this.ctx.auth,\n\t\t\tsubscriptionId,\n\t\t\tnetwork: this.ctx.network,\n\t\t\turl: options.url ?? this.wsUrl(subscriptionId),\n\t\t});\n\t\tstream.connect();\n\t\treturn stream;\n\t}\n\n\t/**\n\t * One call from catalog id to typed live events: resolves the event's\n\t * canonical type for this network, creates the subscription, connects,\n\t * and yields validated payloads.\n\t *\n\t * ```ts\n\t * const swaps = await inodra.warp.streamCatalogEvent(\"cetus.swap\", {\n\t * ephemeral: true,\n\t * });\n\t * for await (const { payload, envelope } of swaps) {\n\t * console.log(envelope.txDigest, payload.amount_in);\n\t * }\n\t * ```\n\t */\n\tasync streamCatalogEvent<Id extends CatalogEventId>(\n\t\tid: Id,\n\t\toptions: StreamCatalogEventOptions = {},\n\t): Promise<CatalogEventStream<Id>> {\n\t\tconst events = await import(\"../events/index.js\");\n\t\tconst event = events.catalogEvents[id];\n\t\tif (!event) {\n\t\t\tthrow new Error(`Unknown catalog event id: ${String(id)}`);\n\t\t}\n\t\tconst deployments: readonly CatalogDeployment[] = event.deployments;\n\t\tconst deployment =\n\t\t\tdeployments.find(\n\t\t\t\t(d) => d.network === this.ctx.network && d.primary,\n\t\t\t) ?? deployments.find((d) => d.network === this.ctx.network);\n\t\tif (!deployment) {\n\t\t\tthrow new Error(\n\t\t\t\t`Catalog event ${String(id)} has no verified deployment on ${this.ctx.network}`,\n\t\t\t);\n\t\t}\n\n\t\tconst { sender, eventFieldFilters, transport, ephemeral, ...connectOptions } =\n\t\t\toptions;\n\t\tconst created = await this.createEventStream({\n\t\t\teventType: deployment.eventType,\n\t\t\tsender,\n\t\t\teventFieldFilters,\n\t\t});\n\t\tconst subscription = created.data;\n\n\t\tlet stream: WarpSseStream | WarpWebSocketStream;\n\t\ttry {\n\t\t\tstream =\n\t\t\t\ttransport === \"ws\"\n\t\t\t\t\t? this.connectWebSocket(subscription.id, connectOptions)\n\t\t\t\t\t: this.connect(subscription.id, connectOptions);\n\t\t} catch (error) {\n\t\t\tif (ephemeral) {\n\t\t\t\tawait this.delete(subscription.id).catch(() => {});\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tlet cleaned = false;\n\t\tconst close = async (): Promise<void> => {\n\t\t\tstream.close();\n\t\t\tif (ephemeral && !cleaned) {\n\t\t\t\tcleaned = true;\n\t\t\t\tawait this.delete(subscription.id);\n\t\t\t}\n\t\t};\n\n\t\tconst network = this.ctx.network;\n\t\treturn {\n\t\t\tsubscription,\n\t\t\tstream,\n\t\t\tclose,\n\t\t\tasync *[Symbol.asyncIterator]() {\n\t\t\t\ttry {\n\t\t\t\t\tfor await (const raw of iterateStream(stream, {\n\t\t\t\t\t\tcloseOnReturn: false,\n\t\t\t\t\t})) {\n\t\t\t\t\t\tconst payload = events.parseCatalogEvent(raw, id, { network });\n\t\t\t\t\t\tif (payload === undefined) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst envelope = events.warpEventPayloadSchema.parse(raw.data);\n\t\t\t\t\t\tyield { payload, envelope };\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tawait close();\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate sseUrl(subscriptionId: string): string | undefined {\n\t\tif (!this.ctx.restBaseUrl) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn `${this.ctx.restBaseUrl}/warp/${encodeURIComponent(subscriptionId)}/stream`;\n\t}\n\n\tprivate wsUrl(subscriptionId: string): string | undefined {\n\t\tif (!this.ctx.warpWsBaseUrl) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn `${this.ctx.warpWsBaseUrl}/warp/${encodeURIComponent(subscriptionId)}/ws`;\n\t}\n}\n","import { InodraWebhookSignatureError } from \"../core/errors.js\";\nimport type { InodraHttpClient } from \"../core/http.js\";\nimport type { WebhookEventBody } from \"../events/runtime.js\";\nimport type {\n\tCreateAddressWebhookInput,\n\tCreateCoinWebhookInput,\n\tCreateEventWebhookInput,\n\tCreateObjectWebhookInput,\n\tCreateWebhookResponse,\n\tDeleteWebhookResponse,\n\tListWebhooksResponse,\n\tUpdateWebhookInput,\n\tUpdateWebhookResponse,\n\tWebhook,\n} from \"../manage/index.js\";\nimport {\n\tverifyWebhookSignature,\n\ttype VerifyWebhookSignatureOptions,\n} from \"../webhooks/index.js\";\n\n/**\n * Webhooks: subscription CRUD plus delivery signature verification.\n *\n * ```ts\n * const hook = await inodra.webhooks.createEvent({ eventType, url });\n * // in your receiver:\n * const valid = await inodra.webhooks.verifySignature({ payload, signature, secret });\n * ```\n */\nexport class WebhooksNamespace {\n\tprivate readonly http: InodraHttpClient;\n\n\tconstructor(http: InodraHttpClient) {\n\t\tthis.http = http;\n\t}\n\n\tcreateEvent(input: CreateEventWebhookInput): Promise<CreateWebhookResponse> {\n\t\treturn this.http.request(\"POST\", \"/webhooks/events\", { body: input });\n\t}\n\n\tcreateAddress(\n\t\tinput: CreateAddressWebhookInput,\n\t): Promise<CreateWebhookResponse> {\n\t\treturn this.http.request(\"POST\", \"/webhooks/addresses\", { body: input });\n\t}\n\n\tcreateCoin(input: CreateCoinWebhookInput): Promise<CreateWebhookResponse> {\n\t\treturn this.http.request(\"POST\", \"/webhooks/coins\", { body: input });\n\t}\n\n\tcreateObject(input: CreateObjectWebhookInput): Promise<CreateWebhookResponse> {\n\t\treturn this.http.request(\"POST\", \"/webhooks/objects\", { body: input });\n\t}\n\n\tlist(): Promise<ListWebhooksResponse> {\n\t\treturn this.http.request(\"GET\", \"/webhooks\");\n\t}\n\n\tget(id: string): Promise<Webhook> {\n\t\treturn this.http.request(\"GET\", `/webhooks/${encodeURIComponent(id)}`);\n\t}\n\n\tupdate(id: string, input: UpdateWebhookInput): Promise<UpdateWebhookResponse> {\n\t\treturn this.http.request(\"PUT\", `/webhooks/${encodeURIComponent(id)}`, {\n\t\t\tbody: input,\n\t\t});\n\t}\n\n\tdelete(id: string): Promise<DeleteWebhookResponse> {\n\t\treturn this.http.request(\"DELETE\", `/webhooks/${encodeURIComponent(id)}`);\n\t}\n\n\t/** Verify an incoming webhook delivery's X-Inodra-Signature header. */\n\tverifySignature(options: VerifyWebhookSignatureOptions): Promise<boolean> {\n\t\treturn verifyWebhookSignature(options);\n\t}\n\n\t/**\n\t * Verify and parse an incoming event-webhook delivery in one step\n\t * (Stripe's constructEvent pattern). Throws InodraWebhookSignatureError\n\t * on a bad or expired signature, and a zod error if the body doesn't\n\t * look like an Inodra delivery.\n\t *\n\t * Pair with `matchCatalogEvent`/`parseCatalogEvent` from\n\t * `@inodra/sui/events` to narrow the payload to a catalog event type.\n\t *\n\t * ```ts\n\t * const body = await inodra.webhooks.constructEvent({\n\t * payload: rawBody, // exact raw string — do not JSON.parse first\n\t * signature: req.headers[\"x-inodra-signature\"],\n\t * secret: process.env.INODRA_WEBHOOK_SECRET,\n\t * });\n\t * const swap = parseCatalogEvent(body, \"cetus.swap\");\n\t * ```\n\t */\n\tasync constructEvent(\n\t\toptions: VerifyWebhookSignatureOptions,\n\t): Promise<WebhookEventBody> {\n\t\tconst valid = await verifyWebhookSignature(options);\n\t\tif (!valid) {\n\t\t\tthrow new InodraWebhookSignatureError();\n\t\t}\n\t\tconst { webhookEventBodySchema } = await import(\"../events/runtime.js\");\n\t\treturn webhookEventBodySchema.parse(JSON.parse(options.payload));\n\t}\n}\n","import { authFromOptions, type InodraAuth } from \"./core/auth.js\";\nimport {\n\tInodraHttpClient,\n\ttype InodraResponseMeta,\n} from \"./core/http.js\";\nimport {\n\tINODRA_ENDPOINTS,\n\ttype InodraNetwork,\n} from \"./core/network.js\";\nimport { createInodraGraphQLClient } from \"./graphql/index.js\";\nimport type { SuiGraphQLClient } from \"./graphql/index.js\";\nimport { createInodraGrpcWebClient } from \"./grpc-web/index.js\";\nimport type { SuiGrpcClient } from \"./grpc-web/index.js\";\nimport { AccountNamespace } from \"./namespaces/account.js\";\nimport { CatalogNamespace } from \"./namespaces/catalog.js\";\nimport { DataNamespace } from \"./namespaces/data.js\";\nimport { EventsNamespace } from \"./namespaces/events.js\";\nimport { WarpNamespace } from \"./namespaces/warp.js\";\nimport { WebhooksNamespace } from \"./namespaces/webhooks.js\";\n\n/** Per-protocol endpoint overrides (all optional; defaults come from network). */\nexport interface InodraEndpointOverrides {\n\t/** REST base URL, e.g. http://localhost:3000/v1 */\n\trest?: string;\n\t/** GraphQL endpoint URL. */\n\tgraphql?: string;\n\t/** host:port for native gRPC transports. */\n\tgrpc?: string;\n\t/** Base URL for gRPC-Web transports. */\n\tgrpcWeb?: string;\n\t/** WS base URL for Warp streams, e.g. ws://localhost:3000/v1 */\n\twarpWs?: string;\n}\n\nexport interface InodraOptions {\n\t/** Credentials: an API key string, {apiKey}, {sessionToken}, or a provider. */\n\tauth?: InodraAuth;\n\t/** Shorthand for `auth: { apiKey }`. */\n\tapiKey?: string;\n\t/** Defaults to \"mainnet\". */\n\tnetwork?: InodraNetwork;\n\t/** Endpoint overrides for self-hosted / local development. */\n\tendpoints?: InodraEndpointOverrides;\n\t/** REST retry budget for 429/5xx. Defaults to 2. */\n\tmaxRetries?: number;\n\t/** REST per-request timeout in milliseconds. Defaults to 30000. */\n\ttimeoutMs?: number;\n\t/** Custom fetch implementation. */\n\tfetch?: typeof globalThis.fetch;\n\t/** Called with rate-limit/credit info after every REST response. */\n\tonResponseMeta?: (meta: InodraResponseMeta) => void;\n}\n\n/**\n * The Inodra client — one entry point, one credential, every product surface.\n *\n * ```ts\n * const inodra = new Inodra({ network: \"mainnet\", auth: { apiKey } });\n *\n * const balance = await inodra.grpc.core.getBalance({ owner, coinType });\n * const sub = await inodra.warp.createEventStream({ eventType });\n * const stream = inodra.warp.connect(sub.id);\n * ```\n *\n * Namespaces are created lazily on first access. The `grpc` client uses a\n * fetch-based gRPC-Web transport that works in every runtime; on Node.js,\n * import `Inodra` from `@inodra/sui/node` for native HTTP/2 gRPC instead.\n *\n * Bundle note: this entry statically references `@mysten/sui`. Frontend apps\n * that only need Warp/webhooks and want a Mysten-free bundle should import\n * from the lean subpaths (`@inodra/sui/warp`, `@inodra/sui/manage`, …).\n */\nexport class Inodra {\n\treadonly network: InodraNetwork;\n\t/** The underlying REST transport (shared by all REST namespaces). */\n\treadonly http: InodraHttpClient;\n\n\tprotected readonly options: InodraOptions;\n\tprotected readonly auth: InodraAuth;\n\tprivate memo = new Map<string, unknown>();\n\n\tconstructor(options: InodraOptions) {\n\t\t// Validate credentials eagerly so misconfiguration fails at construction.\n\t\tauthFromOptions(options, \"Inodra\");\n\t\tthis.options = options;\n\t\tthis.auth = options.auth ?? { apiKey: options.apiKey as string };\n\t\tthis.network = options.network ?? \"mainnet\";\n\t\tthis.http = new InodraHttpClient({\n\t\t\tauth: this.auth,\n\t\t\tnetwork: this.network,\n\t\t\tbaseUrl: options.endpoints?.rest,\n\t\t\tmaxRetries: options.maxRetries,\n\t\t\ttimeoutMs: options.timeoutMs,\n\t\t\tfetch: options.fetch,\n\t\t\tonResponseMeta: options.onResponseMeta,\n\t\t});\n\t}\n\n\t/** Rate-limit/credit info from the most recent REST response. */\n\tget lastResponseMeta(): InodraResponseMeta | undefined {\n\t\treturn this.http.lastResponseMeta;\n\t}\n\n\t/**\n\t * Sui gRPC client (@mysten/sui) over Inodra's authenticated gateway.\n\t * Uses a fetch-based gRPC-Web transport — works in browsers, edge\n\t * runtimes, and Node. For native HTTP/2 gRPC on Node, use\n\t * `@inodra/sui/node`.\n\t */\n\tget grpc(): SuiGrpcClient {\n\t\treturn this.lazy(\"grpc\", () => this.createGrpcClient());\n\t}\n\n\t/** Sui GraphQL client (@mysten/sui) over Inodra's authenticated gateway. */\n\tget graphql(): SuiGraphQLClient {\n\t\treturn this.lazy(\"graphql\", () =>\n\t\t\tcreateInodraGraphQLClient({\n\t\t\t\tauth: this.auth,\n\t\t\t\tnetwork: this.network,\n\t\t\t\turl: this.options.endpoints?.graphql,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** Warp streams: subscription CRUD + live SSE/WebSocket delivery. */\n\tget warp(): WarpNamespace {\n\t\treturn this.lazy(\n\t\t\t\"warp\",\n\t\t\t() =>\n\t\t\t\tnew WarpNamespace({\n\t\t\t\t\thttp: this.http,\n\t\t\t\t\tauth: this.auth,\n\t\t\t\t\tnetwork: this.network,\n\t\t\t\t\trestBaseUrl: this.options.endpoints?.rest,\n\t\t\t\t\twarpWsBaseUrl: this.options.endpoints?.warpWs,\n\t\t\t\t\tfetch: this.options.fetch,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/** Webhooks: subscription CRUD + delivery signature verification. */\n\tget webhooks(): WebhooksNamespace {\n\t\treturn this.lazy(\"webhooks\", () => new WebhooksNamespace(this.http));\n\t}\n\n\t/** Indexer-backed data: accounts, coins, packages, validators, SuiNS, …. */\n\tget data(): DataNamespace {\n\t\treturn this.lazy(\"data\", () => new DataNamespace(this.http));\n\t}\n\n\t/** Curated protocol event catalog (live view). */\n\tget catalog(): CatalogNamespace {\n\t\treturn this.lazy(\"catalog\", () => new CatalogNamespace(this.http));\n\t}\n\n\t/** The authenticated principal: key introspection + usage stats. */\n\tget account(): AccountNamespace {\n\t\treturn this.lazy(\"account\", () => new AccountNamespace(this.http));\n\t}\n\n\t/** Reflection-based typed payloads for arbitrary (uncataloged) events. */\n\tget events(): EventsNamespace {\n\t\treturn this.lazy(\n\t\t\t\"events\",\n\t\t\t() =>\n\t\t\t\tnew EventsNamespace({\n\t\t\t\t\tauth: this.auth,\n\t\t\t\t\tnetwork: this.network,\n\t\t\t\t\tgraphqlUrl: this.options.endpoints?.graphql,\n\t\t\t\t\tfetch: this.options.fetch,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/** Default endpoints for this client's network. */\n\tget endpoints(): (typeof INODRA_ENDPOINTS)[InodraNetwork] {\n\t\treturn INODRA_ENDPOINTS[this.network];\n\t}\n\n\tprotected createGrpcClient(): SuiGrpcClient {\n\t\treturn createInodraGrpcWebClient({\n\t\t\tauth: this.auth,\n\t\t\tnetwork: this.network,\n\t\t\tbaseUrl: this.options.endpoints?.grpcWeb,\n\t\t});\n\t}\n\n\tprotected lazy<T>(key: string, create: () => T): T {\n\t\tlet value = this.memo.get(key) as T | undefined;\n\t\tif (value === undefined) {\n\t\t\tvalue = create();\n\t\t\tthis.memo.set(key, value);\n\t\t}\n\t\treturn value;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcO,IAAM,mBAAN,MAAuB;AAAA,EACZ;AAAA,EAEjB,YAAY,MAAwB;AACnC,SAAK,OAAO;AAAA,EACb;AAAA;AAAA,EAGA,KAA6B;AAC5B,WAAO,KAAK,KAAK,QAAQ,OAAO,UAAU;AAAA,EAC3C;AAAA;AAAA,EAGA,QAAmC;AAClC,WAAO,KAAK,KAAK,QAAQ,OAAO,cAAc;AAAA,EAC/C;AACD;;;ACnBO,IAAM,mBAAN,MAAuB;AAAA,EACZ;AAAA,EAEjB,YAAY,MAAwB;AACnC,SAAK,OAAO;AAAA,EACb;AAAA,EAEA,UAAU,OAA2D;AACpE,WAAO,KAAK,KAAK,QAAQ,OAAO,sBAAsB,EAAE,MAAM,CAAC;AAAA,EAChE;AAAA,EAEA,OAAO,OAAqD;AAC3D,WAAO,KAAK,KAAK,QAAQ,OAAO,mBAAmB,EAAE,MAAM,CAAC;AAAA,EAC7D;AACD;;;ACkBA,gBAAuB,SAMtB,WACqD;AACrD,MAAI;AACJ,aAAS;AACR,UAAM,OAAO,MAAM,UAAU,MAAM;AACnC,WAAO,KAAK;AACZ,QAAI,CAAC,KAAK,WAAW,WAAW,CAAC,KAAK,WAAW,QAAQ;AACxD;AAAA,IACD;AACA,aAAS,KAAK,WAAW;AAAA,EAC1B;AACD;;;ACpBO,IAAM,gBAAN,MAAoB;AAAA,EACT;AAAA,EAEjB,YAAY,MAAwB;AACnC,SAAK,OAAO;AAAA,EACb;AAAA,EAES,WAAW;AAAA,IACnB,KAAK,CAAC,YACL,KAAK,KAAK,QAAQ,OAAO,aAAa,mBAAmB,OAAO,CAAC,EAAE;AAAA,IACpE,SAAS,CA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