@heightproof/shared 0.0.0-stage → 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.
@@ -0,0 +1,862 @@
1
+ import { type AttributeValue } from "@opentelemetry/api";
2
+ import { type CostWasteContext, type DisagreementContext, type ReorgContext, type SilentFailureContext, type StaleHeadContext, type ThrottlingContext } from "./detectors.js";
3
+ import { z } from "zod";
4
+ export { airnodePassthroughRequestHash, checkAirnodeAttestation, readAirnodeAttestation, recoverAirnodeSigner, reverifyAttestation, type AirnodeAttestation, type AirnodeAttestationCheck } from "./airnode.js";
5
+ export { buildDemoEvents } from "./demoEvents.js";
6
+ export { detectCostWaste, detectDisagreement, detectReorgLag, detectSilentFailure, detectStaleHead, detectThrottling, DEFAULT_DETECTOR_THRESHOLDS, type CostWasteContext, type DetectorThresholds, type DisagreementContext, type PeerResult, type ReorgContext, type SilentFailureContext, type StaleHeadContext, type ThrottlingContext } from "./detectors.js";
7
+ export { chainBlockTimeMs, classifyResultShape, extractBlockHash, extractBlockNumber, extractBlockTag, extractRpcError, hashEndpoint, hashRpcResult, methodCostUnits, normalizeRpcResult, pinBlockTag, blockTagParamIndex, isThrottleSignature, isVerifiableMethod, resultCount, VERIFIABLE_METHODS, CHAIN_BLOCK_TIME_MS, DEFAULT_METHOD_COST_UNITS, type BlockTag, type ResultShape } from "./rpc.js";
8
+ /** Largest signed response body kept as attestation evidence. */
9
+ export declare const AIRNODE_SIGNED_BODY_MAX_CHARS = 65536;
10
+ export declare const HttpMethodSchema: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]>;
11
+ export declare const TrafficKindSchema: z.ZodEnum<["rest", "graphql", "evm_rpc", "websocket", "webhook"]>;
12
+ export declare const HeightproofEventSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ traceId: z.ZodOptional<z.ZodString>;
15
+ parentSpanId: z.ZodOptional<z.ZodString>;
16
+ projectId: z.ZodString;
17
+ serviceName: z.ZodString;
18
+ environment: z.ZodDefault<z.ZodString>;
19
+ timestamp: z.ZodString;
20
+ kind: z.ZodEnum<["rest", "graphql", "evm_rpc", "websocket", "webhook"]>;
21
+ request: z.ZodObject<{
22
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]>;
23
+ path: z.ZodString;
24
+ route: z.ZodOptional<z.ZodString>;
25
+ ip: z.ZodOptional<z.ZodString>;
26
+ userAgent: z.ZodOptional<z.ZodString>;
27
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
28
+ query: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
29
+ body: z.ZodOptional<z.ZodUnknown>;
30
+ auth: z.ZodDefault<z.ZodObject<{
31
+ present: z.ZodBoolean;
32
+ scheme: z.ZodOptional<z.ZodString>;
33
+ failed: z.ZodDefault<z.ZodBoolean>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ present: boolean;
36
+ failed: boolean;
37
+ scheme?: string | undefined;
38
+ }, {
39
+ present: boolean;
40
+ scheme?: string | undefined;
41
+ failed?: boolean | undefined;
42
+ }>>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ path: string;
45
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
46
+ headers: Record<string, string>;
47
+ query: Record<string, unknown>;
48
+ auth: {
49
+ present: boolean;
50
+ failed: boolean;
51
+ scheme?: string | undefined;
52
+ };
53
+ route?: string | undefined;
54
+ ip?: string | undefined;
55
+ userAgent?: string | undefined;
56
+ body?: unknown;
57
+ }, {
58
+ path: string;
59
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
60
+ route?: string | undefined;
61
+ ip?: string | undefined;
62
+ userAgent?: string | undefined;
63
+ headers?: Record<string, string> | undefined;
64
+ query?: Record<string, unknown> | undefined;
65
+ body?: unknown;
66
+ auth?: {
67
+ present: boolean;
68
+ scheme?: string | undefined;
69
+ failed?: boolean | undefined;
70
+ } | undefined;
71
+ }>;
72
+ response: z.ZodObject<{
73
+ statusCode: z.ZodNumber;
74
+ latencyMs: z.ZodNumber;
75
+ bodyBytes: z.ZodOptional<z.ZodNumber>;
76
+ }, "strip", z.ZodTypeAny, {
77
+ statusCode: number;
78
+ latencyMs: number;
79
+ bodyBytes?: number | undefined;
80
+ }, {
81
+ statusCode: number;
82
+ latencyMs: number;
83
+ bodyBytes?: number | undefined;
84
+ }>;
85
+ graphQL: z.ZodOptional<z.ZodObject<{
86
+ operationName: z.ZodOptional<z.ZodString>;
87
+ operationType: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ operationName?: string | undefined;
90
+ operationType?: string | undefined;
91
+ }, {
92
+ operationName?: string | undefined;
93
+ operationType?: string | undefined;
94
+ }>>;
95
+ evmRpc: z.ZodOptional<z.ZodObject<{
96
+ method: z.ZodString;
97
+ chainId: z.ZodOptional<z.ZodString>;
98
+ provider: z.ZodOptional<z.ZodString>;
99
+ walletAddress: z.ZodOptional<z.ZodString>;
100
+ contractAddress: z.ZodOptional<z.ZodString>;
101
+ blockTag: z.ZodOptional<z.ZodString>;
102
+ blockNumber: z.ZodOptional<z.ZodString>;
103
+ blockHash: z.ZodOptional<z.ZodString>;
104
+ resultHash: z.ZodOptional<z.ZodString>;
105
+ resultShape: z.ZodOptional<z.ZodEnum<["null", "empty_array", "empty_data", "value", "error_in_body"]>>;
106
+ resultCount: z.ZodOptional<z.ZodNumber>;
107
+ /** Whether the response carried a rate-limiting signature (D5). */
108
+ throttled: z.ZodOptional<z.ZodBoolean>;
109
+ rpcErrorCode: z.ZodOptional<z.ZodNumber>;
110
+ rpcErrorMessage: z.ZodOptional<z.ZodString>;
111
+ endpointHash: z.ZodOptional<z.ZodString>;
112
+ costUnits: z.ZodOptional<z.ZodNumber>;
113
+ shadowOfTraceId: z.ZodOptional<z.ZodString>;
114
+ attestation: z.ZodOptional<z.ZodObject<{
115
+ scheme: z.ZodLiteral<"airnode">;
116
+ signer: z.ZodString;
117
+ requestHash: z.ZodString;
118
+ timestamp: z.ZodString;
119
+ signature: z.ZodString;
120
+ signatureValid: z.ZodBoolean;
121
+ requestBound: z.ZodBoolean;
122
+ signedBody: z.ZodOptional<z.ZodString>;
123
+ }, "strip", z.ZodTypeAny, {
124
+ signer: string;
125
+ requestHash: string;
126
+ timestamp: string;
127
+ signature: string;
128
+ signatureValid: boolean;
129
+ scheme: "airnode";
130
+ requestBound: boolean;
131
+ signedBody?: string | undefined;
132
+ }, {
133
+ signer: string;
134
+ requestHash: string;
135
+ timestamp: string;
136
+ signature: string;
137
+ signatureValid: boolean;
138
+ scheme: "airnode";
139
+ requestBound: boolean;
140
+ signedBody?: string | undefined;
141
+ }>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ method: string;
144
+ blockNumber?: string | undefined;
145
+ blockHash?: string | undefined;
146
+ chainId?: string | undefined;
147
+ provider?: string | undefined;
148
+ walletAddress?: string | undefined;
149
+ contractAddress?: string | undefined;
150
+ blockTag?: string | undefined;
151
+ resultHash?: string | undefined;
152
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
153
+ resultCount?: number | undefined;
154
+ throttled?: boolean | undefined;
155
+ rpcErrorCode?: number | undefined;
156
+ rpcErrorMessage?: string | undefined;
157
+ endpointHash?: string | undefined;
158
+ costUnits?: number | undefined;
159
+ shadowOfTraceId?: string | undefined;
160
+ attestation?: {
161
+ signer: string;
162
+ requestHash: string;
163
+ timestamp: string;
164
+ signature: string;
165
+ signatureValid: boolean;
166
+ scheme: "airnode";
167
+ requestBound: boolean;
168
+ signedBody?: string | undefined;
169
+ } | undefined;
170
+ }, {
171
+ method: string;
172
+ blockNumber?: string | undefined;
173
+ blockHash?: string | undefined;
174
+ chainId?: string | undefined;
175
+ provider?: string | undefined;
176
+ walletAddress?: string | undefined;
177
+ contractAddress?: string | undefined;
178
+ blockTag?: string | undefined;
179
+ resultHash?: string | undefined;
180
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
181
+ resultCount?: number | undefined;
182
+ throttled?: boolean | undefined;
183
+ rpcErrorCode?: number | undefined;
184
+ rpcErrorMessage?: string | undefined;
185
+ endpointHash?: string | undefined;
186
+ costUnits?: number | undefined;
187
+ shadowOfTraceId?: string | undefined;
188
+ attestation?: {
189
+ signer: string;
190
+ requestHash: string;
191
+ timestamp: string;
192
+ signature: string;
193
+ signatureValid: boolean;
194
+ scheme: "airnode";
195
+ requestBound: boolean;
196
+ signedBody?: string | undefined;
197
+ } | undefined;
198
+ }>>;
199
+ error: z.ZodOptional<z.ZodObject<{
200
+ type: z.ZodString;
201
+ message: z.ZodString;
202
+ stack: z.ZodOptional<z.ZodString>;
203
+ }, "strip", z.ZodTypeAny, {
204
+ type: string;
205
+ message: string;
206
+ stack?: string | undefined;
207
+ }, {
208
+ type: string;
209
+ message: string;
210
+ stack?: string | undefined;
211
+ }>>;
212
+ }, "strip", z.ZodTypeAny, {
213
+ timestamp: string;
214
+ id: string;
215
+ projectId: string;
216
+ serviceName: string;
217
+ environment: string;
218
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
219
+ request: {
220
+ path: string;
221
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
222
+ headers: Record<string, string>;
223
+ query: Record<string, unknown>;
224
+ auth: {
225
+ present: boolean;
226
+ failed: boolean;
227
+ scheme?: string | undefined;
228
+ };
229
+ route?: string | undefined;
230
+ ip?: string | undefined;
231
+ userAgent?: string | undefined;
232
+ body?: unknown;
233
+ };
234
+ response: {
235
+ statusCode: number;
236
+ latencyMs: number;
237
+ bodyBytes?: number | undefined;
238
+ };
239
+ error?: {
240
+ type: string;
241
+ message: string;
242
+ stack?: string | undefined;
243
+ } | undefined;
244
+ traceId?: string | undefined;
245
+ parentSpanId?: string | undefined;
246
+ graphQL?: {
247
+ operationName?: string | undefined;
248
+ operationType?: string | undefined;
249
+ } | undefined;
250
+ evmRpc?: {
251
+ method: string;
252
+ blockNumber?: string | undefined;
253
+ blockHash?: string | undefined;
254
+ chainId?: string | undefined;
255
+ provider?: string | undefined;
256
+ walletAddress?: string | undefined;
257
+ contractAddress?: string | undefined;
258
+ blockTag?: string | undefined;
259
+ resultHash?: string | undefined;
260
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
261
+ resultCount?: number | undefined;
262
+ throttled?: boolean | undefined;
263
+ rpcErrorCode?: number | undefined;
264
+ rpcErrorMessage?: string | undefined;
265
+ endpointHash?: string | undefined;
266
+ costUnits?: number | undefined;
267
+ shadowOfTraceId?: string | undefined;
268
+ attestation?: {
269
+ signer: string;
270
+ requestHash: string;
271
+ timestamp: string;
272
+ signature: string;
273
+ signatureValid: boolean;
274
+ scheme: "airnode";
275
+ requestBound: boolean;
276
+ signedBody?: string | undefined;
277
+ } | undefined;
278
+ } | undefined;
279
+ }, {
280
+ timestamp: string;
281
+ id: string;
282
+ projectId: string;
283
+ serviceName: string;
284
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
285
+ request: {
286
+ path: string;
287
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
288
+ route?: string | undefined;
289
+ ip?: string | undefined;
290
+ userAgent?: string | undefined;
291
+ headers?: Record<string, string> | undefined;
292
+ query?: Record<string, unknown> | undefined;
293
+ body?: unknown;
294
+ auth?: {
295
+ present: boolean;
296
+ scheme?: string | undefined;
297
+ failed?: boolean | undefined;
298
+ } | undefined;
299
+ };
300
+ response: {
301
+ statusCode: number;
302
+ latencyMs: number;
303
+ bodyBytes?: number | undefined;
304
+ };
305
+ error?: {
306
+ type: string;
307
+ message: string;
308
+ stack?: string | undefined;
309
+ } | undefined;
310
+ traceId?: string | undefined;
311
+ parentSpanId?: string | undefined;
312
+ environment?: string | undefined;
313
+ graphQL?: {
314
+ operationName?: string | undefined;
315
+ operationType?: string | undefined;
316
+ } | undefined;
317
+ evmRpc?: {
318
+ method: string;
319
+ blockNumber?: string | undefined;
320
+ blockHash?: string | undefined;
321
+ chainId?: string | undefined;
322
+ provider?: string | undefined;
323
+ walletAddress?: string | undefined;
324
+ contractAddress?: string | undefined;
325
+ blockTag?: string | undefined;
326
+ resultHash?: string | undefined;
327
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
328
+ resultCount?: number | undefined;
329
+ throttled?: boolean | undefined;
330
+ rpcErrorCode?: number | undefined;
331
+ rpcErrorMessage?: string | undefined;
332
+ endpointHash?: string | undefined;
333
+ costUnits?: number | undefined;
334
+ shadowOfTraceId?: string | undefined;
335
+ attestation?: {
336
+ signer: string;
337
+ requestHash: string;
338
+ timestamp: string;
339
+ signature: string;
340
+ signatureValid: boolean;
341
+ scheme: "airnode";
342
+ requestBound: boolean;
343
+ signedBody?: string | undefined;
344
+ } | undefined;
345
+ } | undefined;
346
+ }>;
347
+ export declare const EventBatchSchema: z.ZodObject<{
348
+ events: z.ZodArray<z.ZodObject<{
349
+ id: z.ZodString;
350
+ traceId: z.ZodOptional<z.ZodString>;
351
+ parentSpanId: z.ZodOptional<z.ZodString>;
352
+ projectId: z.ZodString;
353
+ serviceName: z.ZodString;
354
+ environment: z.ZodDefault<z.ZodString>;
355
+ timestamp: z.ZodString;
356
+ kind: z.ZodEnum<["rest", "graphql", "evm_rpc", "websocket", "webhook"]>;
357
+ request: z.ZodObject<{
358
+ method: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"]>;
359
+ path: z.ZodString;
360
+ route: z.ZodOptional<z.ZodString>;
361
+ ip: z.ZodOptional<z.ZodString>;
362
+ userAgent: z.ZodOptional<z.ZodString>;
363
+ headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
364
+ query: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
365
+ body: z.ZodOptional<z.ZodUnknown>;
366
+ auth: z.ZodDefault<z.ZodObject<{
367
+ present: z.ZodBoolean;
368
+ scheme: z.ZodOptional<z.ZodString>;
369
+ failed: z.ZodDefault<z.ZodBoolean>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ present: boolean;
372
+ failed: boolean;
373
+ scheme?: string | undefined;
374
+ }, {
375
+ present: boolean;
376
+ scheme?: string | undefined;
377
+ failed?: boolean | undefined;
378
+ }>>;
379
+ }, "strip", z.ZodTypeAny, {
380
+ path: string;
381
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
382
+ headers: Record<string, string>;
383
+ query: Record<string, unknown>;
384
+ auth: {
385
+ present: boolean;
386
+ failed: boolean;
387
+ scheme?: string | undefined;
388
+ };
389
+ route?: string | undefined;
390
+ ip?: string | undefined;
391
+ userAgent?: string | undefined;
392
+ body?: unknown;
393
+ }, {
394
+ path: string;
395
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
396
+ route?: string | undefined;
397
+ ip?: string | undefined;
398
+ userAgent?: string | undefined;
399
+ headers?: Record<string, string> | undefined;
400
+ query?: Record<string, unknown> | undefined;
401
+ body?: unknown;
402
+ auth?: {
403
+ present: boolean;
404
+ scheme?: string | undefined;
405
+ failed?: boolean | undefined;
406
+ } | undefined;
407
+ }>;
408
+ response: z.ZodObject<{
409
+ statusCode: z.ZodNumber;
410
+ latencyMs: z.ZodNumber;
411
+ bodyBytes: z.ZodOptional<z.ZodNumber>;
412
+ }, "strip", z.ZodTypeAny, {
413
+ statusCode: number;
414
+ latencyMs: number;
415
+ bodyBytes?: number | undefined;
416
+ }, {
417
+ statusCode: number;
418
+ latencyMs: number;
419
+ bodyBytes?: number | undefined;
420
+ }>;
421
+ graphQL: z.ZodOptional<z.ZodObject<{
422
+ operationName: z.ZodOptional<z.ZodString>;
423
+ operationType: z.ZodOptional<z.ZodString>;
424
+ }, "strip", z.ZodTypeAny, {
425
+ operationName?: string | undefined;
426
+ operationType?: string | undefined;
427
+ }, {
428
+ operationName?: string | undefined;
429
+ operationType?: string | undefined;
430
+ }>>;
431
+ evmRpc: z.ZodOptional<z.ZodObject<{
432
+ method: z.ZodString;
433
+ chainId: z.ZodOptional<z.ZodString>;
434
+ provider: z.ZodOptional<z.ZodString>;
435
+ walletAddress: z.ZodOptional<z.ZodString>;
436
+ contractAddress: z.ZodOptional<z.ZodString>;
437
+ blockTag: z.ZodOptional<z.ZodString>;
438
+ blockNumber: z.ZodOptional<z.ZodString>;
439
+ blockHash: z.ZodOptional<z.ZodString>;
440
+ resultHash: z.ZodOptional<z.ZodString>;
441
+ resultShape: z.ZodOptional<z.ZodEnum<["null", "empty_array", "empty_data", "value", "error_in_body"]>>;
442
+ resultCount: z.ZodOptional<z.ZodNumber>;
443
+ /** Whether the response carried a rate-limiting signature (D5). */
444
+ throttled: z.ZodOptional<z.ZodBoolean>;
445
+ rpcErrorCode: z.ZodOptional<z.ZodNumber>;
446
+ rpcErrorMessage: z.ZodOptional<z.ZodString>;
447
+ endpointHash: z.ZodOptional<z.ZodString>;
448
+ costUnits: z.ZodOptional<z.ZodNumber>;
449
+ shadowOfTraceId: z.ZodOptional<z.ZodString>;
450
+ attestation: z.ZodOptional<z.ZodObject<{
451
+ scheme: z.ZodLiteral<"airnode">;
452
+ signer: z.ZodString;
453
+ requestHash: z.ZodString;
454
+ timestamp: z.ZodString;
455
+ signature: z.ZodString;
456
+ signatureValid: z.ZodBoolean;
457
+ requestBound: z.ZodBoolean;
458
+ signedBody: z.ZodOptional<z.ZodString>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ signer: string;
461
+ requestHash: string;
462
+ timestamp: string;
463
+ signature: string;
464
+ signatureValid: boolean;
465
+ scheme: "airnode";
466
+ requestBound: boolean;
467
+ signedBody?: string | undefined;
468
+ }, {
469
+ signer: string;
470
+ requestHash: string;
471
+ timestamp: string;
472
+ signature: string;
473
+ signatureValid: boolean;
474
+ scheme: "airnode";
475
+ requestBound: boolean;
476
+ signedBody?: string | undefined;
477
+ }>>;
478
+ }, "strip", z.ZodTypeAny, {
479
+ method: string;
480
+ blockNumber?: string | undefined;
481
+ blockHash?: string | undefined;
482
+ chainId?: string | undefined;
483
+ provider?: string | undefined;
484
+ walletAddress?: string | undefined;
485
+ contractAddress?: string | undefined;
486
+ blockTag?: string | undefined;
487
+ resultHash?: string | undefined;
488
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
489
+ resultCount?: number | undefined;
490
+ throttled?: boolean | undefined;
491
+ rpcErrorCode?: number | undefined;
492
+ rpcErrorMessage?: string | undefined;
493
+ endpointHash?: string | undefined;
494
+ costUnits?: number | undefined;
495
+ shadowOfTraceId?: string | undefined;
496
+ attestation?: {
497
+ signer: string;
498
+ requestHash: string;
499
+ timestamp: string;
500
+ signature: string;
501
+ signatureValid: boolean;
502
+ scheme: "airnode";
503
+ requestBound: boolean;
504
+ signedBody?: string | undefined;
505
+ } | undefined;
506
+ }, {
507
+ method: string;
508
+ blockNumber?: string | undefined;
509
+ blockHash?: string | undefined;
510
+ chainId?: string | undefined;
511
+ provider?: string | undefined;
512
+ walletAddress?: string | undefined;
513
+ contractAddress?: string | undefined;
514
+ blockTag?: string | undefined;
515
+ resultHash?: string | undefined;
516
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
517
+ resultCount?: number | undefined;
518
+ throttled?: boolean | undefined;
519
+ rpcErrorCode?: number | undefined;
520
+ rpcErrorMessage?: string | undefined;
521
+ endpointHash?: string | undefined;
522
+ costUnits?: number | undefined;
523
+ shadowOfTraceId?: string | undefined;
524
+ attestation?: {
525
+ signer: string;
526
+ requestHash: string;
527
+ timestamp: string;
528
+ signature: string;
529
+ signatureValid: boolean;
530
+ scheme: "airnode";
531
+ requestBound: boolean;
532
+ signedBody?: string | undefined;
533
+ } | undefined;
534
+ }>>;
535
+ error: z.ZodOptional<z.ZodObject<{
536
+ type: z.ZodString;
537
+ message: z.ZodString;
538
+ stack: z.ZodOptional<z.ZodString>;
539
+ }, "strip", z.ZodTypeAny, {
540
+ type: string;
541
+ message: string;
542
+ stack?: string | undefined;
543
+ }, {
544
+ type: string;
545
+ message: string;
546
+ stack?: string | undefined;
547
+ }>>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ timestamp: string;
550
+ id: string;
551
+ projectId: string;
552
+ serviceName: string;
553
+ environment: string;
554
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
555
+ request: {
556
+ path: string;
557
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
558
+ headers: Record<string, string>;
559
+ query: Record<string, unknown>;
560
+ auth: {
561
+ present: boolean;
562
+ failed: boolean;
563
+ scheme?: string | undefined;
564
+ };
565
+ route?: string | undefined;
566
+ ip?: string | undefined;
567
+ userAgent?: string | undefined;
568
+ body?: unknown;
569
+ };
570
+ response: {
571
+ statusCode: number;
572
+ latencyMs: number;
573
+ bodyBytes?: number | undefined;
574
+ };
575
+ error?: {
576
+ type: string;
577
+ message: string;
578
+ stack?: string | undefined;
579
+ } | undefined;
580
+ traceId?: string | undefined;
581
+ parentSpanId?: string | undefined;
582
+ graphQL?: {
583
+ operationName?: string | undefined;
584
+ operationType?: string | undefined;
585
+ } | undefined;
586
+ evmRpc?: {
587
+ method: string;
588
+ blockNumber?: string | undefined;
589
+ blockHash?: string | undefined;
590
+ chainId?: string | undefined;
591
+ provider?: string | undefined;
592
+ walletAddress?: string | undefined;
593
+ contractAddress?: string | undefined;
594
+ blockTag?: string | undefined;
595
+ resultHash?: string | undefined;
596
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
597
+ resultCount?: number | undefined;
598
+ throttled?: boolean | undefined;
599
+ rpcErrorCode?: number | undefined;
600
+ rpcErrorMessage?: string | undefined;
601
+ endpointHash?: string | undefined;
602
+ costUnits?: number | undefined;
603
+ shadowOfTraceId?: string | undefined;
604
+ attestation?: {
605
+ signer: string;
606
+ requestHash: string;
607
+ timestamp: string;
608
+ signature: string;
609
+ signatureValid: boolean;
610
+ scheme: "airnode";
611
+ requestBound: boolean;
612
+ signedBody?: string | undefined;
613
+ } | undefined;
614
+ } | undefined;
615
+ }, {
616
+ timestamp: string;
617
+ id: string;
618
+ projectId: string;
619
+ serviceName: string;
620
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
621
+ request: {
622
+ path: string;
623
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
624
+ route?: string | undefined;
625
+ ip?: string | undefined;
626
+ userAgent?: string | undefined;
627
+ headers?: Record<string, string> | undefined;
628
+ query?: Record<string, unknown> | undefined;
629
+ body?: unknown;
630
+ auth?: {
631
+ present: boolean;
632
+ scheme?: string | undefined;
633
+ failed?: boolean | undefined;
634
+ } | undefined;
635
+ };
636
+ response: {
637
+ statusCode: number;
638
+ latencyMs: number;
639
+ bodyBytes?: number | undefined;
640
+ };
641
+ error?: {
642
+ type: string;
643
+ message: string;
644
+ stack?: string | undefined;
645
+ } | undefined;
646
+ traceId?: string | undefined;
647
+ parentSpanId?: string | undefined;
648
+ environment?: string | undefined;
649
+ graphQL?: {
650
+ operationName?: string | undefined;
651
+ operationType?: string | undefined;
652
+ } | undefined;
653
+ evmRpc?: {
654
+ method: string;
655
+ blockNumber?: string | undefined;
656
+ blockHash?: string | undefined;
657
+ chainId?: string | undefined;
658
+ provider?: string | undefined;
659
+ walletAddress?: string | undefined;
660
+ contractAddress?: string | undefined;
661
+ blockTag?: string | undefined;
662
+ resultHash?: string | undefined;
663
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
664
+ resultCount?: number | undefined;
665
+ throttled?: boolean | undefined;
666
+ rpcErrorCode?: number | undefined;
667
+ rpcErrorMessage?: string | undefined;
668
+ endpointHash?: string | undefined;
669
+ costUnits?: number | undefined;
670
+ shadowOfTraceId?: string | undefined;
671
+ attestation?: {
672
+ signer: string;
673
+ requestHash: string;
674
+ timestamp: string;
675
+ signature: string;
676
+ signatureValid: boolean;
677
+ scheme: "airnode";
678
+ requestBound: boolean;
679
+ signedBody?: string | undefined;
680
+ } | undefined;
681
+ } | undefined;
682
+ }>, "many">;
683
+ }, "strip", z.ZodTypeAny, {
684
+ events: {
685
+ timestamp: string;
686
+ id: string;
687
+ projectId: string;
688
+ serviceName: string;
689
+ environment: string;
690
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
691
+ request: {
692
+ path: string;
693
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
694
+ headers: Record<string, string>;
695
+ query: Record<string, unknown>;
696
+ auth: {
697
+ present: boolean;
698
+ failed: boolean;
699
+ scheme?: string | undefined;
700
+ };
701
+ route?: string | undefined;
702
+ ip?: string | undefined;
703
+ userAgent?: string | undefined;
704
+ body?: unknown;
705
+ };
706
+ response: {
707
+ statusCode: number;
708
+ latencyMs: number;
709
+ bodyBytes?: number | undefined;
710
+ };
711
+ error?: {
712
+ type: string;
713
+ message: string;
714
+ stack?: string | undefined;
715
+ } | undefined;
716
+ traceId?: string | undefined;
717
+ parentSpanId?: string | undefined;
718
+ graphQL?: {
719
+ operationName?: string | undefined;
720
+ operationType?: string | undefined;
721
+ } | undefined;
722
+ evmRpc?: {
723
+ method: string;
724
+ blockNumber?: string | undefined;
725
+ blockHash?: string | undefined;
726
+ chainId?: string | undefined;
727
+ provider?: string | undefined;
728
+ walletAddress?: string | undefined;
729
+ contractAddress?: string | undefined;
730
+ blockTag?: string | undefined;
731
+ resultHash?: string | undefined;
732
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
733
+ resultCount?: number | undefined;
734
+ throttled?: boolean | undefined;
735
+ rpcErrorCode?: number | undefined;
736
+ rpcErrorMessage?: string | undefined;
737
+ endpointHash?: string | undefined;
738
+ costUnits?: number | undefined;
739
+ shadowOfTraceId?: string | undefined;
740
+ attestation?: {
741
+ signer: string;
742
+ requestHash: string;
743
+ timestamp: string;
744
+ signature: string;
745
+ signatureValid: boolean;
746
+ scheme: "airnode";
747
+ requestBound: boolean;
748
+ signedBody?: string | undefined;
749
+ } | undefined;
750
+ } | undefined;
751
+ }[];
752
+ }, {
753
+ events: {
754
+ timestamp: string;
755
+ id: string;
756
+ projectId: string;
757
+ serviceName: string;
758
+ kind: "rest" | "graphql" | "evm_rpc" | "websocket" | "webhook";
759
+ request: {
760
+ path: string;
761
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
762
+ route?: string | undefined;
763
+ ip?: string | undefined;
764
+ userAgent?: string | undefined;
765
+ headers?: Record<string, string> | undefined;
766
+ query?: Record<string, unknown> | undefined;
767
+ body?: unknown;
768
+ auth?: {
769
+ present: boolean;
770
+ scheme?: string | undefined;
771
+ failed?: boolean | undefined;
772
+ } | undefined;
773
+ };
774
+ response: {
775
+ statusCode: number;
776
+ latencyMs: number;
777
+ bodyBytes?: number | undefined;
778
+ };
779
+ error?: {
780
+ type: string;
781
+ message: string;
782
+ stack?: string | undefined;
783
+ } | undefined;
784
+ traceId?: string | undefined;
785
+ parentSpanId?: string | undefined;
786
+ environment?: string | undefined;
787
+ graphQL?: {
788
+ operationName?: string | undefined;
789
+ operationType?: string | undefined;
790
+ } | undefined;
791
+ evmRpc?: {
792
+ method: string;
793
+ blockNumber?: string | undefined;
794
+ blockHash?: string | undefined;
795
+ chainId?: string | undefined;
796
+ provider?: string | undefined;
797
+ walletAddress?: string | undefined;
798
+ contractAddress?: string | undefined;
799
+ blockTag?: string | undefined;
800
+ resultHash?: string | undefined;
801
+ resultShape?: "null" | "empty_array" | "empty_data" | "value" | "error_in_body" | undefined;
802
+ resultCount?: number | undefined;
803
+ throttled?: boolean | undefined;
804
+ rpcErrorCode?: number | undefined;
805
+ rpcErrorMessage?: string | undefined;
806
+ endpointHash?: string | undefined;
807
+ costUnits?: number | undefined;
808
+ shadowOfTraceId?: string | undefined;
809
+ attestation?: {
810
+ signer: string;
811
+ requestHash: string;
812
+ timestamp: string;
813
+ signature: string;
814
+ signatureValid: boolean;
815
+ scheme: "airnode";
816
+ requestBound: boolean;
817
+ signedBody?: string | undefined;
818
+ } | undefined;
819
+ } | undefined;
820
+ }[];
821
+ }>;
822
+ export type HeightproofEvent = z.infer<typeof HeightproofEventSchema>;
823
+ export type EventBatch = z.infer<typeof EventBatchSchema>;
824
+ export type TrafficKind = z.infer<typeof TrafficKindSchema>;
825
+ export type RedactionConfig = {
826
+ fields?: string[];
827
+ headerFields?: string[];
828
+ replacement?: string;
829
+ };
830
+ export declare function classifyTraffic(path: string, body: unknown): TrafficKind;
831
+ export declare function normalizeRoutePath(path: string): string;
832
+ export declare function normalizeErrorMessage(message: string): string;
833
+ export declare function redactValue(value: unknown, config?: RedactionConfig): unknown;
834
+ export declare function redactHeaders(headers: Record<string, string>, config?: RedactionConfig): Record<string, string>;
835
+ export type ThreatSignal = {
836
+ name: string;
837
+ weight: number;
838
+ reason: string;
839
+ };
840
+ export type ThreatAssessment = {
841
+ score: number;
842
+ severity: "low" | "medium" | "high" | "critical";
843
+ signals: ThreatSignal[];
844
+ };
845
+ export type TraceAttributes = Record<string, AttributeValue | undefined>;
846
+ export type Web3ThreatContext = {
847
+ recentMethodCallCount?: number;
848
+ walletRecentHourTxCount?: number;
849
+ walletBaselineHourlyTxCount?: number;
850
+ providerRecentP95LatencyMs?: number;
851
+ providerBaselineP95LatencyMs?: number;
852
+ providerRecentFailureRate?: number;
853
+ staleHead?: StaleHeadContext;
854
+ silentFailure?: SilentFailureContext;
855
+ costWaste?: CostWasteContext;
856
+ disagreement?: DisagreementContext;
857
+ reorg?: ReorgContext;
858
+ throttling?: ThrottlingContext;
859
+ };
860
+ export declare function withSpan<T>(name: string, attributes: TraceAttributes, operation: () => Promise<T>): Promise<T>;
861
+ export declare function assessThreat(event: HeightproofEvent, recentIpRequestCount?: number, web3Context?: Web3ThreatContext): ThreatAssessment;
862
+ //# sourceMappingURL=index.d.ts.map