forked from Streampay-Org/StreamPay-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
52 lines (47 loc) · 1.22 KB
/
types.ts
File metadata and controls
52 lines (47 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Aggregate metric snapshot for a specific tenant within a rolling window.
*/
export interface MetricSnapshot {
stellarSubmissionsTotal?: number;
stellarSubmissionsFailed?: number;
dlqDepth?: number;
tenantId: string;
streamCreations: number;
settleAttempts: number;
timestamp: number;
}
export interface AnomalyThresholds {
submissionFailureThreshold?: number;
maxDlqDepth?: number;
creationBurstLimit: number; // e.g., new streams per hour
settleRateLimit: number; // e.g., settle attempts per hour
}
export interface AnomalyAlert {
tenantId: string;
ruleName: "STREAM_CREATION_BURST" | "SETTLE_RATE_SPIKE";
observedValue: number;
threshold: number;
severity: 'low' | 'medium' | 'high';
detectedAt: string;
}
export enum ContractStreamStatus {
DRAFT = "DRAFT",
ACTIVE = "ACTIVE",
PAUSED = "PAUSED",
SETTLED = "SETTLED",
ENDED = "ENDED",
CANCELLED = "CANCELLED",
}
export interface OnChainStream {
id: string;
recipient_address: string;
total_amount: bigint;
released_amount: bigint;
velocity: bigint;
last_update_timestamp: number;
status: ContractStreamStatus;
}
export interface InvariantResult {
isValid: boolean;
error?: string;
}