@iteradian-rpc/sdk 1.0.1

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,893 @@
1
+ interface RegisterRequest {
2
+ email: string;
3
+ password: string;
4
+ organizationName?: string;
5
+ }
6
+ interface LoginRequest {
7
+ email: string;
8
+ password: string;
9
+ twoFactorCode?: string;
10
+ backupCode?: string;
11
+ }
12
+ interface AuthTokens {
13
+ accessToken: string;
14
+ refreshToken: string;
15
+ user: User;
16
+ }
17
+ interface TwoFASetup {
18
+ secret: string;
19
+ qrCode: string;
20
+ }
21
+ interface User {
22
+ id: string;
23
+ email: string;
24
+ emailVerified: boolean;
25
+ systemRole: "user" | "admin" | "super_admin";
26
+ twoFactorEnabled: boolean;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ }
30
+ interface Membership {
31
+ id: string;
32
+ userId: string;
33
+ organizationId: string;
34
+ role: OrgRole;
35
+ joinedAt: string;
36
+ }
37
+ type OrgRole = "owner" | "admin" | "developer" | "viewer";
38
+ interface Organization {
39
+ id: string;
40
+ name: string;
41
+ slug: string;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ }
45
+ interface OrgMember {
46
+ id: string;
47
+ userId: string;
48
+ email: string;
49
+ role: OrgRole;
50
+ joinedAt: string;
51
+ }
52
+ interface UserPermissions {
53
+ role: OrgRole;
54
+ roleLabel: string;
55
+ roleDescription: string;
56
+ permissions: string[];
57
+ }
58
+ interface ApiKey {
59
+ id: string;
60
+ name: string;
61
+ prefix: string;
62
+ environment: "live" | "test";
63
+ status: "active" | "revoked";
64
+ ipAllowlist: string[];
65
+ allowedNetworks: string[];
66
+ rateLimit: number | null;
67
+ dailyLimit: number | null;
68
+ expiresAt: string | null;
69
+ lastUsedAt: string | null;
70
+ createdAt: string;
71
+ revokedAt?: string | null;
72
+ }
73
+ interface CreateApiKeyRequest {
74
+ name: string;
75
+ environment: "live" | "test";
76
+ ipAllowlist?: string[];
77
+ allowedNetworks?: string[];
78
+ rateLimit?: number;
79
+ dailyLimit?: number;
80
+ expiresAt?: string;
81
+ }
82
+ interface UpdateApiKeyRequest {
83
+ name?: string;
84
+ ipAllowlist?: string[];
85
+ allowedNetworks?: string[];
86
+ rateLimit?: number | null;
87
+ dailyLimit?: number | null;
88
+ expiresAt?: string | null;
89
+ }
90
+ interface ApiKeyWithSecret extends ApiKey {
91
+ key: string;
92
+ }
93
+ interface ApiKeyAnalytics {
94
+ keyId: string;
95
+ keyName: string;
96
+ keyPrefix: string;
97
+ period: {
98
+ from: string;
99
+ to: string;
100
+ days: number;
101
+ };
102
+ totals: {
103
+ requests: number;
104
+ errors: number;
105
+ throttled: number;
106
+ avgLatencyMs: number;
107
+ errorRate: number;
108
+ successRate: number;
109
+ };
110
+ dailyData: {
111
+ date: string;
112
+ requests: number;
113
+ errors: number;
114
+ throttled: number;
115
+ avgLatencyMs: number;
116
+ }[];
117
+ }
118
+ type EndpointRegion = "us_east" | "us_west" | "eu_west" | "eu_central" | "asia_east" | "asia_south";
119
+ type EndpointStatus = "active" | "degraded" | "down" | "maintenance";
120
+ type NetworkType = "mainnet" | "testnet";
121
+ interface Network {
122
+ id: string;
123
+ slug: string;
124
+ name: string;
125
+ chainId: number;
126
+ type: NetworkType;
127
+ environment: string;
128
+ rpcUrl?: string;
129
+ wsUrl?: string;
130
+ explorerUrl?: string;
131
+ iconUrl?: string;
132
+ isActive: boolean;
133
+ }
134
+ interface Endpoint {
135
+ id: string;
136
+ organizationId: string;
137
+ networkId: string;
138
+ network?: Network;
139
+ region: EndpointRegion;
140
+ name: string;
141
+ priority: number;
142
+ status: EndpointStatus;
143
+ isEnabled: boolean;
144
+ rateLimitOverride?: number;
145
+ timeoutMs: number;
146
+ retryCount: number;
147
+ lastHealthCheck?: string;
148
+ healthCheckStatus?: EndpointStatus;
149
+ avgLatencyMs?: number;
150
+ successRate?: number;
151
+ totalRequests?: number;
152
+ totalErrors?: number;
153
+ uptime?: number;
154
+ createdAt: string;
155
+ updatedAt: string;
156
+ }
157
+ interface CreateEndpointRequest {
158
+ networkId: string;
159
+ region: EndpointRegion;
160
+ name: string;
161
+ priority?: number;
162
+ timeoutMs?: number;
163
+ retryCount?: number;
164
+ rateLimitOverride?: number;
165
+ }
166
+ interface UpdateEndpointRequest {
167
+ name?: string;
168
+ region?: EndpointRegion;
169
+ priority?: number;
170
+ timeoutMs?: number;
171
+ retryCount?: number;
172
+ rateLimitOverride?: number;
173
+ }
174
+ interface EndpointMetric {
175
+ id: string;
176
+ endpointId: string;
177
+ timestamp: string;
178
+ requests: number;
179
+ errors: number;
180
+ avgLatencyMs: number;
181
+ p50LatencyMs?: number;
182
+ p95LatencyMs?: number;
183
+ p99LatencyMs?: number;
184
+ throttled: number;
185
+ }
186
+ interface UsageSummary {
187
+ totalRequests: number;
188
+ totalErrors: number;
189
+ avgLatencyMs: number;
190
+ byNetwork: UsageByNetwork[];
191
+ byRegion: UsageByRegion[];
192
+ byMethod: UsageByMethod[];
193
+ daily: DailyUsage[];
194
+ }
195
+ interface UsageByNetwork {
196
+ networkId: string;
197
+ networkName: string;
198
+ networkType: string;
199
+ requests: number;
200
+ errors: number;
201
+ avgLatencyMs: number;
202
+ }
203
+ interface UsageByRegion {
204
+ region: string;
205
+ requests: number;
206
+ errors: number;
207
+ avgLatencyMs: number;
208
+ }
209
+ interface UsageByMethod {
210
+ method: string;
211
+ requests: number;
212
+ errors: number;
213
+ avgLatencyMs: number;
214
+ }
215
+ interface DailyUsage {
216
+ date: string;
217
+ requests: number;
218
+ errors: number;
219
+ avgLatencyMs: number;
220
+ }
221
+ interface DashboardData {
222
+ quickStats: QuickStats;
223
+ requestRate: DataPoint[];
224
+ errorRate: DataPoint[];
225
+ }
226
+ interface QuickStats {
227
+ totalRequests: number;
228
+ totalErrors: number;
229
+ avgLatencyMs: number;
230
+ successRate: number;
231
+ activeEndpoints: number;
232
+ }
233
+ interface DataPoint {
234
+ timestamp: string;
235
+ value: number;
236
+ }
237
+ interface HealthStatus {
238
+ status: "healthy" | "degraded" | "down";
239
+ endpoints: {
240
+ id: string;
241
+ name: string;
242
+ status: string;
243
+ }[];
244
+ }
245
+ type AlertSeverity = "info" | "warning" | "critical";
246
+ type AlertStatus = "active" | "acknowledged" | "resolved";
247
+ type AlertMetric = "error_rate" | "latency" | "request_count" | "uptime";
248
+ type AlertCondition = "greater_than" | "less_than" | "equals";
249
+ interface Alert {
250
+ id: string;
251
+ organizationId: string;
252
+ ruleId: string;
253
+ severity: AlertSeverity;
254
+ status: AlertStatus;
255
+ title: string;
256
+ message: string;
257
+ metadata?: Record<string, unknown>;
258
+ acknowledgedAt?: string;
259
+ resolvedAt?: string;
260
+ createdAt: string;
261
+ }
262
+ interface AlertRule {
263
+ id: string;
264
+ organizationId: string;
265
+ name: string;
266
+ description?: string;
267
+ metric: AlertMetric;
268
+ condition: AlertCondition;
269
+ threshold: number;
270
+ severity: AlertSeverity;
271
+ isEnabled: boolean;
272
+ cooldownMinutes: number;
273
+ createdAt: string;
274
+ updatedAt: string;
275
+ }
276
+ interface CreateAlertRuleRequest {
277
+ name: string;
278
+ description?: string;
279
+ metric: AlertMetric;
280
+ condition: AlertCondition;
281
+ threshold: number;
282
+ severity: AlertSeverity;
283
+ cooldownMinutes?: number;
284
+ }
285
+ interface AlertChannel {
286
+ id: string;
287
+ organizationId: string;
288
+ type: "email" | "webhook" | "slack";
289
+ name: string;
290
+ config: Record<string, unknown>;
291
+ isEnabled: boolean;
292
+ createdAt: string;
293
+ }
294
+ interface CreateAlertChannelRequest {
295
+ type: "email" | "webhook" | "slack";
296
+ name: string;
297
+ config: Record<string, unknown>;
298
+ }
299
+ type LogStatus = "success" | "error" | "timeout" | "throttled";
300
+ interface RequestLog {
301
+ id: string;
302
+ organizationId: string;
303
+ apiKeyId?: string;
304
+ apiKeyPrefix?: string;
305
+ method: string;
306
+ path?: string;
307
+ network?: string;
308
+ region?: string;
309
+ status: LogStatus;
310
+ statusCode?: number;
311
+ latencyMs?: number;
312
+ requestBody?: string;
313
+ responseBody?: string;
314
+ errorMessage?: string;
315
+ ipAddress?: string;
316
+ userAgent?: string;
317
+ timestamp: string;
318
+ }
319
+ interface LogsResponse {
320
+ logs: RequestLog[];
321
+ total: number;
322
+ page: number;
323
+ pageSize: number;
324
+ totalPages: number;
325
+ }
326
+ interface LogFilterOptions {
327
+ methods: string[];
328
+ networks: string[];
329
+ regions: string[];
330
+ apiKeys: {
331
+ id: string;
332
+ name: string;
333
+ prefix: string;
334
+ }[];
335
+ }
336
+ interface LogQueryParams {
337
+ page?: number;
338
+ pageSize?: number;
339
+ status?: LogStatus;
340
+ method?: string;
341
+ network?: string;
342
+ region?: string;
343
+ apiKeyId?: string;
344
+ search?: string;
345
+ from?: string;
346
+ to?: string;
347
+ minLatency?: number;
348
+ maxLatency?: number;
349
+ sortBy?: "timestamp" | "latencyMs" | "statusCode";
350
+ sortOrder?: "asc" | "desc";
351
+ }
352
+ interface Subscription {
353
+ id: string;
354
+ organizationId: string;
355
+ planId: string;
356
+ status: "active" | "cancelled" | "past_due" | "trialing";
357
+ currentPeriodStart: string;
358
+ currentPeriodEnd: string;
359
+ cancelAtPeriodEnd: boolean;
360
+ plan: Plan;
361
+ }
362
+ interface Plan {
363
+ id: string;
364
+ name: string;
365
+ slug: string;
366
+ price: number;
367
+ currency: string;
368
+ interval: "month" | "year";
369
+ features: Record<string, unknown>;
370
+ limits: PlanLimits;
371
+ isActive: boolean;
372
+ }
373
+ interface PlanLimits {
374
+ requestsPerMonth: number;
375
+ requestsPerSecond: number;
376
+ apiKeys: number;
377
+ endpoints: number;
378
+ teamMembers: number;
379
+ logRetentionDays: number;
380
+ }
381
+ interface Invoice {
382
+ id: string;
383
+ amount: number;
384
+ currency: string;
385
+ status: string;
386
+ periodStart: string;
387
+ periodEnd: string;
388
+ paidAt?: string;
389
+ createdAt: string;
390
+ }
391
+ type TicketPriority = "low" | "medium" | "high" | "urgent";
392
+ type TicketStatus = "open" | "in_progress" | "waiting" | "resolved" | "closed";
393
+ type TicketCategory = "billing" | "technical" | "account" | "feature_request" | "other";
394
+ interface SupportTicket {
395
+ id: string;
396
+ organizationId: string;
397
+ subject: string;
398
+ category: TicketCategory;
399
+ priority: TicketPriority;
400
+ status: TicketStatus;
401
+ createdAt: string;
402
+ updatedAt: string;
403
+ }
404
+ interface CreateTicketRequest {
405
+ subject: string;
406
+ message: string;
407
+ category: TicketCategory;
408
+ priority: TicketPriority;
409
+ }
410
+ interface TicketMessage {
411
+ id: string;
412
+ ticketId: string;
413
+ content: string;
414
+ isStaff: boolean;
415
+ createdAt: string;
416
+ }
417
+ interface IteradianConfig {
418
+ /** Base URL of the Iteradian control-plane API (default: https://api.iteradian.com/api/v1) */
419
+ baseUrl?: string;
420
+ /**
421
+ * Base URL of the RPC gateway (default: https://rpc.iteradian.com).
422
+ *
423
+ * The gateway is deliberately NOT under the control plane's /api/v1 prefix —
424
+ * it serves `POST /rpc/v1/{network}` at the host root. Sending RPC through
425
+ * `baseUrl` produces `/api/v1/rpc/v1/{network}`, which 404s.
426
+ */
427
+ gatewayUrl?: string;
428
+ /** Bearer access token for authentication */
429
+ accessToken?: string;
430
+ /** API key for authentication (alternative to accessToken) */
431
+ apiKey?: string;
432
+ /** Request timeout in milliseconds (default: 30000) */
433
+ timeout?: number;
434
+ /** Custom headers to include with every request */
435
+ headers?: Record<string, string>;
436
+ /** Retry failed requests (default: true) */
437
+ retry?: boolean;
438
+ /** Maximum number of retries (default: 3) */
439
+ maxRetries?: number;
440
+ }
441
+ interface ApiResponse<T> {
442
+ data: T;
443
+ status: number;
444
+ headers: Record<string, string>;
445
+ }
446
+ interface ApiError {
447
+ message: string;
448
+ statusCode: number;
449
+ error?: string;
450
+ }
451
+ interface PaginatedResponse<T> {
452
+ data: T[];
453
+ total: number;
454
+ page: number;
455
+ pageSize: number;
456
+ totalPages: number;
457
+ }
458
+ interface JsonRpcRequest {
459
+ jsonrpc: "2.0";
460
+ method: string;
461
+ params?: unknown[];
462
+ id: string | number;
463
+ }
464
+ interface JsonRpcResponse {
465
+ jsonrpc: "2.0";
466
+ id: string | number | null;
467
+ result?: unknown;
468
+ error?: JsonRpcError;
469
+ }
470
+ interface JsonRpcError {
471
+ code: number;
472
+ message: string;
473
+ data?: unknown;
474
+ }
475
+
476
+ declare class IteradianError extends Error {
477
+ readonly statusCode: number;
478
+ readonly error?: string;
479
+ /**
480
+ * JSON-RPC error code from the gateway, when the failure came from there.
481
+ *
482
+ * -32005 rate limit or concurrency limit exceeded (retry shortly)
483
+ * -32006 monthly quota exhausted (retrying will not help until `resetsAt`)
484
+ * -32007 overage spend limit reached (same — needs a plan change)
485
+ */
486
+ readonly rpcCode?: number;
487
+ /** Seconds to wait before retrying, when the gateway supplied one. */
488
+ readonly retryAfter?: number;
489
+ /** The gateway's `error.data` payload, e.g. `{quota, used, resetsAt}`. */
490
+ readonly data?: Record<string, unknown>;
491
+ constructor(message: string, statusCode: number, error?: string, rpc?: {
492
+ code?: number;
493
+ retryAfter?: number;
494
+ data?: Record<string, unknown>;
495
+ });
496
+ /** True when the request failed because the subscription is out of allowance. */
497
+ get isQuotaExhausted(): boolean;
498
+ /** True when the request was throttled and is worth retrying. */
499
+ get isRateLimited(): boolean;
500
+ }
501
+ declare class HttpClient {
502
+ private baseUrl;
503
+ private gatewayUrl;
504
+ private accessToken?;
505
+ private apiKey?;
506
+ private timeout;
507
+ private customHeaders;
508
+ private retry;
509
+ private maxRetries;
510
+ constructor(config: IteradianConfig);
511
+ setAccessToken(token: string): void;
512
+ clearAccessToken(): void;
513
+ private buildHeaders;
514
+ private request;
515
+ get<T>(path: string): Promise<T>;
516
+ post<T>(path: string, body?: unknown): Promise<T>;
517
+ put<T>(path: string, body?: unknown): Promise<T>;
518
+ patch<T>(path: string, body?: unknown): Promise<T>;
519
+ /**
520
+ * Call the RPC gateway rather than the control plane.
521
+ *
522
+ * Separate base URL because the gateway is not under `/api/v1`: it serves
523
+ * `POST /rpc/v1/{network}` at the host root.
524
+ */
525
+ gateway<T>(path: string, body?: unknown, signal?: AbortSignal): Promise<T>;
526
+ gatewayGet<T>(path: string, signal?: AbortSignal): Promise<T>;
527
+ delete<T>(path: string, body?: unknown): Promise<T>;
528
+ }
529
+
530
+ declare class AuthResource {
531
+ private http;
532
+ constructor(http: HttpClient);
533
+ /** Register a new user account */
534
+ register(data: RegisterRequest): Promise<AuthTokens>;
535
+ /** Login with email/password (optionally with 2FA code) */
536
+ login(data: LoginRequest): Promise<AuthTokens>;
537
+ /** Logout current session */
538
+ logout(): Promise<void>;
539
+ /** Refresh the access token */
540
+ refresh(refreshToken: string): Promise<AuthTokens>;
541
+ /** Verify email with token */
542
+ verifyEmail(token: string): Promise<void>;
543
+ /** Resend email verification */
544
+ resendVerification(email: string): Promise<void>;
545
+ /** Request password reset email */
546
+ forgotPassword(email: string): Promise<void>;
547
+ /** Reset password with token */
548
+ resetPassword(token: string, newPassword: string): Promise<void>;
549
+ /** Request a magic login link */
550
+ requestMagicLink(email: string): Promise<void>;
551
+ /** Login via magic link token */
552
+ loginWithMagicLink(token: string): Promise<AuthTokens>;
553
+ /** Enable 2FA – returns QR code image and secret */
554
+ enable2FA(password: string): Promise<TwoFASetup>;
555
+ /** Verify 2FA setup with code from authenticator app */
556
+ verify2FA(code: string): Promise<{
557
+ backupCodes: string[];
558
+ }>;
559
+ /** Disable 2FA */
560
+ disable2FA(password: string, code: string): Promise<void>;
561
+ /** Regenerate backup codes */
562
+ regenerateBackupCodes(password: string): Promise<{
563
+ backupCodes: string[];
564
+ }>;
565
+ }
566
+
567
+ declare class OrganizationsResource {
568
+ private http;
569
+ constructor(http: HttpClient);
570
+ /** List organizations the current user belongs to */
571
+ list(): Promise<Organization[]>;
572
+ /** Create a new organization */
573
+ create(data: {
574
+ name: string;
575
+ slug?: string;
576
+ }): Promise<Organization>;
577
+ /** Get organization details */
578
+ get(orgId: string): Promise<Organization>;
579
+ /** Update an organization */
580
+ update(orgId: string, data: {
581
+ name?: string;
582
+ slug?: string;
583
+ }): Promise<Organization>;
584
+ /** Delete an organization */
585
+ delete(orgId: string): Promise<void>;
586
+ /** Leave an organization */
587
+ leave(orgId: string): Promise<void>;
588
+ /** List organization members */
589
+ listMembers(orgId: string): Promise<OrgMember[]>;
590
+ /** Invite a member to the organization */
591
+ inviteMember(orgId: string, data: {
592
+ email: string;
593
+ role: string;
594
+ }): Promise<OrgMember>;
595
+ /** Update a member's role */
596
+ updateMemberRole(orgId: string, memberId: string, role: string): Promise<OrgMember>;
597
+ /** Remove a member from the organization */
598
+ removeMember(orgId: string, memberId: string): Promise<void>;
599
+ /** Get current user's permissions in the organization */
600
+ getMyPermissions(orgId: string): Promise<UserPermissions>;
601
+ }
602
+
603
+ declare class ApiKeysResource {
604
+ private http;
605
+ constructor(http: HttpClient);
606
+ /** List all API keys for an organization */
607
+ list(orgId: string): Promise<ApiKey[]>;
608
+ /** Get a specific API key */
609
+ get(orgId: string, keyId: string): Promise<ApiKey>;
610
+ /** Create a new API key (returns the full key only once) */
611
+ create(orgId: string, data: CreateApiKeyRequest): Promise<ApiKeyWithSecret>;
612
+ /** Update an API key */
613
+ update(orgId: string, keyId: string, data: UpdateApiKeyRequest): Promise<ApiKey>;
614
+ /** Revoke (delete) an API key */
615
+ revoke(orgId: string, keyId: string): Promise<void>;
616
+ /** Rotate an API key (revoke old, create new) */
617
+ rotate(orgId: string, keyId: string): Promise<ApiKeyWithSecret>;
618
+ /** Get analytics for an API key */
619
+ getAnalytics(orgId: string, keyId: string, timeRange?: "1d" | "7d" | "30d" | "90d"): Promise<ApiKeyAnalytics>;
620
+ }
621
+
622
+ declare class EndpointsResource {
623
+ private http;
624
+ constructor(http: HttpClient);
625
+ /** List all available networks */
626
+ getNetworks(): Promise<Network[]>;
627
+ /** Get a specific network */
628
+ getNetwork(networkId: string): Promise<Network>;
629
+ /** List all endpoints for an organization */
630
+ list(orgId: string): Promise<Endpoint[]>;
631
+ /** Get a specific endpoint */
632
+ get(orgId: string, endpointId: string): Promise<Endpoint>;
633
+ /** Create a new endpoint */
634
+ create(orgId: string, data: CreateEndpointRequest): Promise<Endpoint>;
635
+ /** Update an endpoint */
636
+ update(orgId: string, endpointId: string, data: UpdateEndpointRequest): Promise<Endpoint>;
637
+ /** Delete an endpoint */
638
+ delete(orgId: string, endpointId: string): Promise<void>;
639
+ /** Pause an endpoint */
640
+ pause(orgId: string, endpointId: string): Promise<Endpoint>;
641
+ /** Resume an endpoint */
642
+ resume(orgId: string, endpointId: string): Promise<Endpoint>;
643
+ /** Trigger a health check */
644
+ checkHealth(orgId: string, endpointId: string): Promise<{
645
+ status: EndpointStatus;
646
+ latencyMs?: number;
647
+ }>;
648
+ /** Get endpoint health summary */
649
+ getHealthOverview(orgId: string): Promise<unknown>;
650
+ /** Get endpoint metrics */
651
+ getMetrics(orgId: string, endpointId: string, from?: string, to?: string): Promise<EndpointMetric[]>;
652
+ /** Update endpoint priorities */
653
+ updatePriorities(orgId: string, priorities: {
654
+ id: string;
655
+ priority: number;
656
+ }[]): Promise<void>;
657
+ }
658
+
659
+ declare class UsageResource {
660
+ private http;
661
+ constructor(http: HttpClient);
662
+ /** Get usage analytics for a date range */
663
+ get(orgId: string, from: string, to: string): Promise<UsageSummary>;
664
+ /** Get usage summary */
665
+ getSummary(orgId: string): Promise<UsageSummary>;
666
+ }
667
+
668
+ declare class DashboardResource {
669
+ private http;
670
+ constructor(http: HttpClient);
671
+ /** Get full dashboard data */
672
+ get(orgId: string, period?: string): Promise<DashboardData>;
673
+ /** Get system health overview */
674
+ getHealth(orgId: string): Promise<HealthStatus>;
675
+ /** Get quick stats */
676
+ getQuickStats(orgId: string, period?: string): Promise<QuickStats>;
677
+ /** Get request rate time series */
678
+ getRequestRate(orgId: string, period?: string): Promise<DataPoint[]>;
679
+ /** Get error rate time series */
680
+ getErrorRate(orgId: string, period?: string): Promise<DataPoint[]>;
681
+ /** Get latency metrics */
682
+ getLatency(orgId: string, period?: string): Promise<DataPoint[]>;
683
+ /** Get performance metrics */
684
+ getPerformance(orgId: string): Promise<unknown>;
685
+ }
686
+
687
+ declare class AlertsResource {
688
+ private http;
689
+ constructor(http: HttpClient);
690
+ /** List alerts for an organization */
691
+ list(orgId: string): Promise<Alert[]>;
692
+ /** Acknowledge an alert */
693
+ acknowledge(orgId: string, alertId: string): Promise<Alert>;
694
+ /** Resolve an alert */
695
+ resolve(orgId: string, alertId: string): Promise<Alert>;
696
+ /** Evaluate all alert rules now */
697
+ evaluate(orgId: string): Promise<void>;
698
+ /** List alert rules */
699
+ listRules(orgId: string): Promise<AlertRule[]>;
700
+ /** Create a new alert rule */
701
+ createRule(orgId: string, data: CreateAlertRuleRequest): Promise<AlertRule>;
702
+ /** Get a specific alert rule */
703
+ getRule(orgId: string, ruleId: string): Promise<AlertRule>;
704
+ /** Update an alert rule */
705
+ updateRule(orgId: string, ruleId: string, data: Partial<CreateAlertRuleRequest>): Promise<AlertRule>;
706
+ /** Delete an alert rule */
707
+ deleteRule(orgId: string, ruleId: string): Promise<void>;
708
+ /** Toggle an alert rule on/off */
709
+ toggleRule(orgId: string, ruleId: string): Promise<AlertRule>;
710
+ /** Seed default alert rules */
711
+ seedDefaults(orgId: string): Promise<AlertRule[]>;
712
+ /** List notification channels */
713
+ listChannels(orgId: string): Promise<AlertChannel[]>;
714
+ /** Create a notification channel */
715
+ createChannel(orgId: string, data: CreateAlertChannelRequest): Promise<AlertChannel>;
716
+ /** Get a specific channel */
717
+ getChannel(orgId: string, channelId: string): Promise<AlertChannel>;
718
+ /** Update a notification channel */
719
+ updateChannel(orgId: string, channelId: string, data: Partial<CreateAlertChannelRequest>): Promise<AlertChannel>;
720
+ /** Delete a notification channel */
721
+ deleteChannel(orgId: string, channelId: string): Promise<void>;
722
+ /** Test a notification channel */
723
+ testChannel(orgId: string, channelId: string): Promise<void>;
724
+ }
725
+
726
+ declare class LogsResource {
727
+ private http;
728
+ constructor(http: HttpClient);
729
+ /** Query request logs with filters and pagination */
730
+ query(orgId: string, params?: LogQueryParams): Promise<LogsResponse>;
731
+ /** Get a single log entry */
732
+ get(orgId: string, logId: string): Promise<RequestLog>;
733
+ /** Get log statistics */
734
+ getStats(orgId: string): Promise<unknown>;
735
+ /** Get available filter options */
736
+ getFilterOptions(orgId: string): Promise<LogFilterOptions>;
737
+ }
738
+
739
+ declare class SubscriptionsResource {
740
+ private http;
741
+ constructor(http: HttpClient);
742
+ /** Get current subscription */
743
+ get(orgId: string): Promise<Subscription>;
744
+ /** Change subscription plan */
745
+ changePlan(orgId: string, planId: string): Promise<Subscription>;
746
+ /** Cancel subscription */
747
+ cancel(orgId: string): Promise<Subscription>;
748
+ /** Reactivate a cancelled subscription */
749
+ reactivate(orgId: string): Promise<Subscription>;
750
+ /** Get invoices */
751
+ getInvoices(orgId: string, limit?: number): Promise<Invoice[]>;
752
+ }
753
+
754
+ declare class PlansResource {
755
+ private http;
756
+ constructor(http: HttpClient);
757
+ /** List all available plans */
758
+ list(): Promise<Plan[]>;
759
+ /** Get a specific plan */
760
+ get(planId: string): Promise<Plan>;
761
+ }
762
+
763
+ declare class SupportResource {
764
+ private http;
765
+ constructor(http: HttpClient);
766
+ /** Create a support ticket */
767
+ createTicket(orgId: string, data: CreateTicketRequest): Promise<SupportTicket>;
768
+ /** List support tickets */
769
+ listTickets(orgId: string): Promise<SupportTicket[]>;
770
+ /** Get ticket statistics */
771
+ getStats(orgId: string): Promise<unknown>;
772
+ /** Get a specific ticket */
773
+ getTicket(orgId: string, ticketId: string): Promise<SupportTicket>;
774
+ /** Add a message to a ticket */
775
+ addMessage(orgId: string, ticketId: string, content: string): Promise<TicketMessage>;
776
+ /** Update ticket status */
777
+ updateStatus(orgId: string, ticketId: string, status: string): Promise<SupportTicket>;
778
+ }
779
+
780
+ declare class RpcResource {
781
+ private http;
782
+ constructor(http: HttpClient);
783
+ /**
784
+ * Send a JSON-RPC 2.0 request to the specified network via the Iteradian gateway.
785
+ *
786
+ * @example
787
+ * ```ts
788
+ * const result = await client.rpc.call('eth-mainnet', {
789
+ * jsonrpc: '2.0',
790
+ * method: 'eth_blockNumber',
791
+ * params: [],
792
+ * id: 1,
793
+ * });
794
+ * ```
795
+ */
796
+ call(network: string, request: JsonRpcRequest, options?: {
797
+ signal?: AbortSignal;
798
+ }): Promise<JsonRpcResponse>;
799
+ /**
800
+ * Send a batch of JSON-RPC 2.0 requests to the specified network.
801
+ *
802
+ * A batch of N calls costs N against both your per-second rate limit and
803
+ * your monthly request quota — it is a transport optimisation, not a
804
+ * billing one.
805
+ *
806
+ * @example
807
+ * ```ts
808
+ * const results = await client.rpc.batch('eth-mainnet', [
809
+ * { jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 1 },
810
+ * { jsonrpc: '2.0', method: 'net_peerCount', params: [], id: 2 },
811
+ * ]);
812
+ * ```
813
+ */
814
+ batch(network: string, requests: JsonRpcRequest[], options?: {
815
+ signal?: AbortSignal;
816
+ }): Promise<JsonRpcResponse[]>;
817
+ /**
818
+ * List the networks the gateway can currently route to.
819
+ *
820
+ * Only networks with at least one healthy node are advertised.
821
+ */
822
+ networks(): Promise<{
823
+ networks: Array<{
824
+ slug: string;
825
+ aliases: string[];
826
+ name: string;
827
+ type: string;
828
+ environment: string;
829
+ }>;
830
+ usage?: string;
831
+ example?: unknown;
832
+ }>;
833
+ }
834
+
835
+ /**
836
+ * Iteradian Control Plane SDK Client
837
+ *
838
+ * @example
839
+ * ```typescript
840
+ * import { IteradianClient } from '@iteradian/sdk';
841
+ *
842
+ * const client = new IteradianClient({
843
+ * baseUrl: 'https://api.iteradian.com/api/v1',
844
+ * accessToken: 'your-access-token',
845
+ * });
846
+ *
847
+ * // Login
848
+ * const tokens = await client.auth.login({ email: 'user@example.com', password: 'pass' });
849
+ *
850
+ * // List organizations
851
+ * const orgs = await client.organizations.list();
852
+ *
853
+ * // Create an API key
854
+ * const key = await client.apiKeys.create(orgId, { name: 'My Key', environment: 'live' });
855
+ *
856
+ * // Query logs
857
+ * const logs = await client.logs.query(orgId, { status: 'error', pageSize: 50 });
858
+ * ```
859
+ */
860
+ declare class IteradianClient {
861
+ private readonly http;
862
+ /** Authentication (register, login, 2FA, password reset) */
863
+ readonly auth: AuthResource;
864
+ /** Organization management */
865
+ readonly organizations: OrganizationsResource;
866
+ /** API key management */
867
+ readonly apiKeys: ApiKeysResource;
868
+ /** Endpoint & network management */
869
+ readonly endpoints: EndpointsResource;
870
+ /** Usage analytics */
871
+ readonly usage: UsageResource;
872
+ /** Dashboard stats & time series */
873
+ readonly dashboard: DashboardResource;
874
+ /** Alerts, rules, and notification channels */
875
+ readonly alerts: AlertsResource;
876
+ /** Request log querying */
877
+ readonly logs: LogsResource;
878
+ /** Subscription & billing */
879
+ readonly subscriptions: SubscriptionsResource;
880
+ /** Plan catalog */
881
+ readonly plans: PlansResource;
882
+ /** Support tickets */
883
+ readonly support: SupportResource;
884
+ /** JSON-RPC gateway (blockchain calls) */
885
+ readonly rpc: RpcResource;
886
+ constructor(config?: IteradianConfig);
887
+ /** Set the access token for all subsequent requests */
888
+ setAccessToken(token: string): void;
889
+ /** Clear the access token */
890
+ clearAccessToken(): void;
891
+ }
892
+
893
+ export { type Alert, type AlertChannel, type AlertCondition, type AlertMetric, type AlertRule, type AlertSeverity, type AlertStatus, AlertsResource, type ApiError, type ApiKey, type ApiKeyAnalytics, type ApiKeyWithSecret, ApiKeysResource, type ApiResponse, AuthResource, type AuthTokens, type CreateAlertChannelRequest, type CreateAlertRuleRequest, type CreateApiKeyRequest, type CreateEndpointRequest, type CreateTicketRequest, type DailyUsage, type DashboardData, DashboardResource, type DataPoint, type Endpoint, type EndpointMetric, type EndpointRegion, type EndpointStatus, EndpointsResource, type HealthStatus, type Invoice, IteradianClient, type IteradianConfig, IteradianError, type JsonRpcError, type JsonRpcRequest, type JsonRpcResponse, type LogFilterOptions, type LogQueryParams, type LogStatus, type LoginRequest, LogsResource, type LogsResponse, type Membership, type Network, type NetworkType, type OrgMember, type OrgRole, type Organization, OrganizationsResource, type PaginatedResponse, type Plan, type PlanLimits, PlansResource, type QuickStats, type RegisterRequest, type RequestLog, RpcResource, type Subscription, SubscriptionsResource, SupportResource, type SupportTicket, type TicketCategory, type TicketMessage, type TicketPriority, type TicketStatus, type TwoFASetup, type UpdateApiKeyRequest, type UpdateEndpointRequest, type UsageByMethod, type UsageByNetwork, type UsageByRegion, UsageResource, type UsageSummary, type User, type UserPermissions };