@obelyzk/sdk 0.5.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,4749 @@
1
+ /**
2
+ * BitSage SDK Types
3
+ */
4
+ /** Job identifier */
5
+ type JobId = string;
6
+ /** Worker identifier */
7
+ type WorkerId = string;
8
+ /** Job types supported by BitSage network */
9
+ type JobType = {
10
+ type: 'ai_inference';
11
+ model_type: string;
12
+ batch_size: number;
13
+ } | {
14
+ type: 'zk_proof';
15
+ circuit_type: string;
16
+ proof_system: string;
17
+ } | {
18
+ type: 'computer_vision';
19
+ model_name: string;
20
+ input_format: string;
21
+ } | {
22
+ type: 'data_pipeline';
23
+ pipeline_type: string;
24
+ tee_required: boolean;
25
+ } | {
26
+ type: 'render_3d';
27
+ resolution: string;
28
+ frames: number;
29
+ } | {
30
+ type: 'video_processing';
31
+ codec: string;
32
+ operation: string;
33
+ } | {
34
+ type: 'custom';
35
+ name: string;
36
+ parallelizable: boolean;
37
+ };
38
+ /** Job status */
39
+ type JobStatus = 'pending' | 'assigned' | 'running' | 'completed' | 'failed' | 'cancelled' | 'timeout';
40
+ /** GPU tier classification */
41
+ type GpuTier$1 = 'consumer' | 'workstation' | 'data_center' | 'enterprise' | 'frontier';
42
+ /** Worker status */
43
+ type WorkerStatus$1 = 'available' | 'busy' | 'offline' | 'suspended';
44
+ /** Proof verification status */
45
+ type ProofVerificationStatus = 'pending' | 'verified' | 'failed';
46
+ /** Worker capabilities */
47
+ interface WorkerCapabilities$1 {
48
+ gpu_model: string;
49
+ gpu_memory_gb: number;
50
+ cpu_cores: number;
51
+ ram_gb: number;
52
+ has_tee: boolean;
53
+ tee_type?: string;
54
+ supported_job_types: string[];
55
+ }
56
+ /** Worker information */
57
+ interface WorkerInfo$1 {
58
+ id: WorkerId;
59
+ address: string;
60
+ capabilities: WorkerCapabilities$1;
61
+ status: WorkerStatus$1;
62
+ reputation: number;
63
+ stake_amount: bigint;
64
+ gpu_tier: GpuTier$1;
65
+ registered_at: Date;
66
+ }
67
+ /** Proof details */
68
+ interface ProofDetails {
69
+ proof_hash: string;
70
+ job_id: JobId;
71
+ proof_type: string;
72
+ verification_status: ProofVerificationStatus;
73
+ created_at: Date;
74
+ verified_at?: Date;
75
+ gas_cost?: bigint;
76
+ }
77
+ /** Network statistics */
78
+ interface NetworkStats$1 {
79
+ total_workers: number;
80
+ active_workers: number;
81
+ total_jobs_completed: bigint;
82
+ jobs_in_progress: number;
83
+ total_compute_hours: number;
84
+ average_job_duration_secs: number;
85
+ network_utilization: number;
86
+ }
87
+ /** Staking information */
88
+ interface StakeInfo$1 {
89
+ staked_amount: bigint;
90
+ locked_until?: Date;
91
+ pending_rewards: bigint;
92
+ total_rewards_claimed: bigint;
93
+ gpu_tier: GpuTier$1;
94
+ is_slashable: boolean;
95
+ }
96
+ /** Faucet status */
97
+ interface FaucetStatus {
98
+ can_claim: boolean;
99
+ time_until_next_claim_secs: number;
100
+ last_claim_at?: Date;
101
+ total_claimed: bigint;
102
+ claim_amount: bigint;
103
+ }
104
+ /** Submit job request */
105
+ interface SubmitJobRequest {
106
+ job_type: JobType;
107
+ input_data: string;
108
+ max_cost_sage: bigint;
109
+ max_duration_secs: number;
110
+ priority: number;
111
+ require_tee: boolean;
112
+ deadline?: Date;
113
+ callback_url?: string;
114
+ }
115
+ /** Submit job response */
116
+ interface SubmitJobResponse {
117
+ job_id: JobId;
118
+ status: JobStatus;
119
+ estimated_cost_sage: bigint;
120
+ estimated_completion_secs?: number;
121
+ queue_position?: number;
122
+ }
123
+ /** Job status response */
124
+ interface JobStatusResponse {
125
+ job_id: JobId;
126
+ status: JobStatus;
127
+ worker_id?: WorkerId;
128
+ created_at: Date;
129
+ started_at?: Date;
130
+ completed_at?: Date;
131
+ error_message?: string;
132
+ result_hash?: string;
133
+ }
134
+ /** Job result */
135
+ interface JobResult {
136
+ job_id: JobId;
137
+ output_data?: string;
138
+ output_files: string[];
139
+ execution_time_secs: number;
140
+ actual_cost_sage: bigint;
141
+ proof_hash?: string;
142
+ worker_id: WorkerId;
143
+ error?: string;
144
+ }
145
+ /** List jobs parameters */
146
+ interface ListJobsParams {
147
+ limit?: number;
148
+ offset?: number;
149
+ status?: JobStatus;
150
+ }
151
+ /** List jobs response */
152
+ interface ListJobsResponse {
153
+ jobs: JobStatusResponse[];
154
+ total: bigint;
155
+ has_more: boolean;
156
+ }
157
+ /** Faucet claim response */
158
+ interface FaucetClaimResponse {
159
+ success: boolean;
160
+ amount: bigint;
161
+ transaction_hash: string;
162
+ }
163
+ /** Get minimum stake for GPU tier */
164
+ declare function getMinStake(tier: GpuTier$1): bigint;
165
+ /** Get GPU tier from model name */
166
+ declare function getGpuTier(model: string): GpuTier$1;
167
+
168
+ /**
169
+ * BitSage SDK Client
170
+ */
171
+
172
+ /** Network selection */
173
+ type Network$1 = 'mainnet' | 'sepolia' | 'local';
174
+ /** Client configuration */
175
+ interface ClientConfig {
176
+ /** Base URL for BitSage API */
177
+ apiUrl: string;
178
+ /** Starknet RPC URL */
179
+ starknetRpcUrl: string;
180
+ /** Request timeout in ms */
181
+ timeout: number;
182
+ /** Network */
183
+ network: Network$1;
184
+ }
185
+ /** Wallet configuration */
186
+ interface WalletConfig {
187
+ privateKey: string;
188
+ accountAddress: string;
189
+ }
190
+ /** Default configuration for Sepolia testnet */
191
+ declare const DEFAULT_CONFIG: ClientConfig;
192
+ /** SDK Error */
193
+ declare class SdkError extends Error {
194
+ code: string;
195
+ statusCode?: number | undefined;
196
+ constructor(message: string, code: string, statusCode?: number | undefined);
197
+ }
198
+ /**
199
+ * BitSage SDK Client
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * const client = new BitSageClient();
204
+ *
205
+ * // Submit a job
206
+ * const response = await client.submitJob({
207
+ * job_type: { type: 'ai_inference', model_type: 'llama-7b', batch_size: 1 },
208
+ * input_data: 'base64_data',
209
+ * max_cost_sage: 100n,
210
+ * max_duration_secs: 3600,
211
+ * priority: 5,
212
+ * require_tee: false,
213
+ * });
214
+ *
215
+ * // Wait for completion
216
+ * const result = await client.waitForCompletion(response.job_id);
217
+ * ```
218
+ */
219
+ declare class BitSageClient {
220
+ private config;
221
+ private wallet?;
222
+ constructor(config?: Partial<ClientConfig>);
223
+ /** Set wallet for signing transactions */
224
+ withWallet(wallet: WalletConfig): this;
225
+ /** Submit a new job */
226
+ submitJob(request: SubmitJobRequest): Promise<SubmitJobResponse>;
227
+ /** Get job status */
228
+ getJobStatus(jobId: JobId): Promise<JobStatusResponse>;
229
+ /** Get job result */
230
+ getJobResult(jobId: JobId): Promise<JobResult>;
231
+ /** Cancel a job */
232
+ cancelJob(jobId: JobId): Promise<void>;
233
+ /** List jobs */
234
+ listJobs(params?: ListJobsParams): Promise<ListJobsResponse>;
235
+ /** Wait for job completion with polling */
236
+ waitForCompletion(jobId: JobId, pollIntervalMs?: number, timeoutSecs?: number): Promise<JobResult>;
237
+ /** Stream job status updates (async iterator) */
238
+ streamJobStatus(jobId: JobId, pollIntervalMs?: number): AsyncIterable<JobStatusResponse>;
239
+ /** List available workers */
240
+ listWorkers(): Promise<WorkerInfo$1[]>;
241
+ /** Get worker details */
242
+ getWorker(workerId: WorkerId): Promise<WorkerInfo$1>;
243
+ /** Get proof details */
244
+ getProof(proofHash: string): Promise<ProofDetails>;
245
+ /** Verify a proof */
246
+ verifyProof(proofHash: string): Promise<boolean>;
247
+ /** Stake SAGE tokens */
248
+ stake(amount: bigint, gpuTier: GpuTier$1): Promise<string>;
249
+ /** Unstake SAGE tokens */
250
+ unstake(amount: bigint): Promise<string>;
251
+ /** Claim staking rewards */
252
+ claimRewards(): Promise<bigint>;
253
+ /** Get stake information */
254
+ getStakeInfo(): Promise<StakeInfo$1>;
255
+ /** Get network statistics */
256
+ getNetworkStats(): Promise<NetworkStats$1>;
257
+ /** Claim tokens from faucet */
258
+ faucetClaim(address: string): Promise<FaucetClaimResponse>;
259
+ /** Get faucet status */
260
+ faucetStatus(address: string): Promise<FaucetStatus>;
261
+ private requireWallet;
262
+ private fetch;
263
+ private sleep;
264
+ }
265
+
266
+ /**
267
+ * Mining Rewards Types
268
+ * Generated from BitSage-Cairo-Smart-Contracts/src/economics/mining_rewards.cairo
269
+ */
270
+ /** Staking tier determines daily mining caps */
271
+ type StakeTier = 'None' | 'Bronze' | 'Silver' | 'Gold' | 'Platinum';
272
+ /** Daily mining statistics */
273
+ interface DailyStats {
274
+ /** Day number (unix timestamp / 86400) */
275
+ day: number;
276
+ /** Number of jobs completed this day */
277
+ jobs_completed: number;
278
+ /** SAGE earned today (wei) */
279
+ earned_today: bigint;
280
+ }
281
+ /** Worker's lifetime mining statistics */
282
+ interface WorkerMiningStats {
283
+ /** Total jobs completed since registration */
284
+ total_jobs: bigint;
285
+ /** Total SAGE earned (wei) */
286
+ total_earned: bigint;
287
+ /** Daily statistics array */
288
+ daily_stats: DailyStats[];
289
+ /** Timestamp of first job */
290
+ first_job_at: number;
291
+ /** Timestamp of most recent job */
292
+ last_job_at: number;
293
+ }
294
+ /** Mining pool status */
295
+ interface MiningPoolStatus {
296
+ /** Total SAGE distributed from pool (wei) */
297
+ total_distributed: bigint;
298
+ /** Remaining SAGE in mining pool (wei) */
299
+ remaining_pool: bigint;
300
+ /** Current base reward per job with halvening applied (wei) */
301
+ current_base_reward: bigint;
302
+ /** Current halvening multiplier (basis points, 10000 = 1.0x) */
303
+ halvening_multiplier: number;
304
+ /** Year number since mining started */
305
+ current_year: number;
306
+ }
307
+ /** Mining configuration */
308
+ interface MiningConfig {
309
+ /** Base reward per job (wei) - 2 SAGE in Year 1 */
310
+ base_reward_wei: bigint;
311
+ /** Timestamp when mining started */
312
+ start_timestamp: number;
313
+ /** Halvening period in seconds (1 year) */
314
+ halvening_period_secs: number;
315
+ /** Daily caps by stake tier (wei) */
316
+ caps_by_tier: {
317
+ None: bigint;
318
+ Bronze: bigint;
319
+ Silver: bigint;
320
+ Gold: bigint;
321
+ Platinum: bigint;
322
+ };
323
+ /** GPU multipliers by tier (basis points, 10000 = 1.0x) */
324
+ gpu_multipliers: {
325
+ Consumer: number;
326
+ Workstation: number;
327
+ DataCenter: number;
328
+ Enterprise: number;
329
+ Frontier: number;
330
+ };
331
+ }
332
+ /** Result of mining reward calculation */
333
+ interface RewardResult {
334
+ /** Calculated reward amount (wei) */
335
+ amount: bigint;
336
+ /** Whether the reward was capped by daily limit */
337
+ capped: boolean;
338
+ /** Remaining daily cap after this reward (wei) */
339
+ remaining_cap: bigint;
340
+ /** Worker's current stake tier */
341
+ stake_tier: StakeTier;
342
+ }
343
+ /** GPU tier for mining multipliers */
344
+ type MiningGpuTier = 'Consumer' | 'Workstation' | 'DataCenter' | 'Enterprise' | 'Frontier';
345
+ /** Stake tier thresholds (in SAGE wei) */
346
+ declare const STAKE_TIER_THRESHOLDS: {
347
+ readonly None: 0n;
348
+ readonly Bronze: bigint;
349
+ readonly Silver: bigint;
350
+ readonly Gold: bigint;
351
+ readonly Platinum: bigint;
352
+ };
353
+ /** Daily caps by stake tier (in SAGE wei) */
354
+ declare const DAILY_CAPS: {
355
+ readonly None: bigint;
356
+ readonly Bronze: bigint;
357
+ readonly Silver: bigint;
358
+ readonly Gold: bigint;
359
+ readonly Platinum: bigint;
360
+ };
361
+ /** GPU multipliers (basis points, 10000 = 1.0x) */
362
+ declare const GPU_MULTIPLIERS: {
363
+ readonly Consumer: 10000;
364
+ readonly Workstation: 12500;
365
+ readonly DataCenter: 15000;
366
+ readonly Enterprise: 20000;
367
+ readonly Frontier: 25000;
368
+ };
369
+ /** Halvening schedule (year -> multiplier in basis points) */
370
+ declare const HALVENING_SCHEDULE: {
371
+ readonly 1: 10000;
372
+ readonly 2: 7500;
373
+ readonly 3: 5000;
374
+ readonly 4: 3750;
375
+ readonly 5: 2500;
376
+ };
377
+ /** Helper to get stake tier from staked amount */
378
+ declare function getStakeTierFromAmount(stakedAmount: bigint): StakeTier;
379
+ /** Helper to get daily cap for stake tier */
380
+ declare function getDailyCapForTier(tier: StakeTier): bigint;
381
+ /** Helper to get GPU multiplier */
382
+ declare function getGpuMultiplier(tier: MiningGpuTier): number;
383
+
384
+ /**
385
+ * Obelysk Privacy Types
386
+ * Generated from BitSage-Cairo-Smart-Contracts/src/obelysk/
387
+ */
388
+ /** Elliptic curve point (STARK curve) */
389
+ interface ECPoint {
390
+ /** X coordinate (felt252) */
391
+ x: bigint;
392
+ /** Y coordinate (felt252) */
393
+ y: bigint;
394
+ }
395
+ /** ElGamal ciphertext (encrypted value) */
396
+ interface ElGamalCiphertext {
397
+ /** First component C1 = r*G */
398
+ c1: ECPoint;
399
+ /** Second component C2 = M + r*PK */
400
+ c2: ECPoint;
401
+ }
402
+ /** Encrypted balance with pending operations */
403
+ interface EncryptedBalance {
404
+ /** Main encrypted balance */
405
+ ciphertext: ElGamalCiphertext;
406
+ /** Pending incoming amount (encrypted) */
407
+ pending_in: ElGamalCiphertext;
408
+ /** Pending outgoing amount (encrypted) */
409
+ pending_out: ElGamalCiphertext;
410
+ /** Current epoch for balance updates */
411
+ epoch: number;
412
+ }
413
+ /** Schnorr proof for knowledge of discrete log */
414
+ interface SchnorrProof {
415
+ /** Commitment point R = k*G */
416
+ commitment: ECPoint;
417
+ /** Challenge c = H(R || P || context) */
418
+ challenge: bigint;
419
+ /** Response s = k + c*x */
420
+ response: bigint;
421
+ }
422
+ /** Range proof for value bounds (0 <= v < 2^64) */
423
+ interface RangeProof {
424
+ /** Commitment to value V = v*G + r*H */
425
+ commitment: ECPoint;
426
+ /** Proof hash (compressed representation) */
427
+ proof_hash: bigint;
428
+ /** Bit commitments for range decomposition */
429
+ bit_commitments: ECPoint[];
430
+ }
431
+ /** Complete transfer proof */
432
+ interface TransferProof {
433
+ /** Proof sender has sufficient balance */
434
+ sender_proof: SchnorrProof;
435
+ /** Proof receiver received correct amount */
436
+ receiver_proof: SchnorrProof;
437
+ /** Range proof that amount is valid */
438
+ balance_proof: RangeProof;
439
+ /** Nullifier to prevent double-spending */
440
+ nullifier: bigint;
441
+ }
442
+ /** Same encryption proof (auditable transfers) */
443
+ interface SameEncryption3Proof {
444
+ /** Proof that all ciphertexts encrypt same value */
445
+ commitment: ECPoint;
446
+ /** Challenge */
447
+ challenge: bigint;
448
+ /** Response */
449
+ response: bigint;
450
+ /** Second commitment for 3-party proof */
451
+ commitment2: ECPoint;
452
+ /** Second response */
453
+ response2: bigint;
454
+ }
455
+ /** AE (Additively Encrypted) hint for fast decryption */
456
+ interface AEHint {
457
+ /** Hint component 0 */
458
+ c0: bigint;
459
+ /** Hint component 1 */
460
+ c1: bigint;
461
+ /** Hint component 2 */
462
+ c2: bigint;
463
+ }
464
+ /** Private account state */
465
+ interface PrivateAccount {
466
+ /** Account owner address */
467
+ owner: string;
468
+ /** ElGamal public key for receiving */
469
+ public_key: ECPoint;
470
+ /** Current encrypted balance */
471
+ balance: EncryptedBalance;
472
+ /** AE hints for fast balance lookup */
473
+ hints: AEHint;
474
+ /** Account creation timestamp */
475
+ created_at: number;
476
+ /** Last activity timestamp */
477
+ last_activity: number;
478
+ }
479
+ /** Account hints for fast decryption */
480
+ interface AccountHints {
481
+ /** AE hint data */
482
+ hint: AEHint;
483
+ /** Last update epoch */
484
+ epoch: number;
485
+ /** Hint verification hash */
486
+ verification_hash: bigint;
487
+ }
488
+ /** Privacy key pair */
489
+ interface PrivacyKeyPair {
490
+ /** Public key for receiving encrypted funds */
491
+ publicKey: ECPoint;
492
+ /** Private key (never expose, use via WASM only) */
493
+ privateKey: Uint8Array;
494
+ }
495
+ /** Stealth address for one-time payments */
496
+ interface StealthAddress {
497
+ /** Ephemeral public key (for ECDH) */
498
+ ephemeral_pubkey: ECPoint;
499
+ /** Stealth public key derived via ECDH */
500
+ stealth_pubkey: ECPoint;
501
+ /** View tag for scanning optimization */
502
+ view_tag: number;
503
+ }
504
+ /** Steganographic transaction (uniform format) */
505
+ interface SteganographicTransaction {
506
+ /** Transaction type hidden in uniform format */
507
+ type_commitment: bigint;
508
+ /** Encrypted amount */
509
+ encrypted_amount: ElGamalCiphertext;
510
+ /** Sender's new balance (encrypted) */
511
+ sender_new_balance: ElGamalCiphertext;
512
+ /** Receiver's new balance (encrypted) */
513
+ receiver_new_balance: ElGamalCiphertext;
514
+ /** Proof of correctness */
515
+ proof: TransferProof;
516
+ /** Random padding for uniformity */
517
+ padding: bigint[];
518
+ }
519
+ /** Ring signature member */
520
+ interface RingMember {
521
+ /** Member's public key */
522
+ public_key: ECPoint;
523
+ /** Member's commitment */
524
+ commitment: ECPoint;
525
+ }
526
+ /** Ring signature for anonymity */
527
+ interface RingSignature {
528
+ /** Key image (prevents double-spending) */
529
+ key_image: ECPoint;
530
+ /** Ring members (including real signer) */
531
+ ring: RingMember[];
532
+ /** Signature components c values */
533
+ c_values: bigint[];
534
+ /** Signature components r values */
535
+ r_values: bigint[];
536
+ }
537
+ /** Mixing transaction for anonymity set */
538
+ interface MixingTransaction {
539
+ /** Ring signature */
540
+ signature: RingSignature;
541
+ /** Encrypted output amount */
542
+ output: ElGamalCiphertext;
543
+ /** Recipient's stealth address */
544
+ recipient: StealthAddress;
545
+ /** Fee commitment */
546
+ fee_commitment: ECPoint;
547
+ }
548
+ /** Mixing output for anonymity pool */
549
+ interface MixingOutput {
550
+ /** Output commitment */
551
+ commitment: ECPoint;
552
+ /** Encrypted amount */
553
+ encrypted_amount: ElGamalCiphertext;
554
+ /** Public key for claiming */
555
+ claim_key: ECPoint;
556
+ /** Timestamp */
557
+ created_at: number;
558
+ /** Whether used as decoy */
559
+ is_decoy_eligible: boolean;
560
+ }
561
+ /** Ragequit proof for emergency withdrawal */
562
+ interface RagequitProof {
563
+ /** Proof of account ownership */
564
+ ownership_proof: SchnorrProof;
565
+ /** Revealed balance amount */
566
+ revealed_amount: bigint;
567
+ /** Balance proof */
568
+ balance_proof: RangeProof;
569
+ /** Current timestamp */
570
+ timestamp: number;
571
+ }
572
+ /** DKG (Distributed Key Generation) share */
573
+ interface DKGShare {
574
+ /** Participant index */
575
+ index: number;
576
+ /** Share value */
577
+ share: bigint;
578
+ /** Commitment to share */
579
+ commitment: ECPoint;
580
+ /** Verification shares for VSS */
581
+ verification_shares: ECPoint[];
582
+ }
583
+ /** Threshold decryption request */
584
+ interface ThresholdDecryptionRequest {
585
+ /** Request ID */
586
+ id: bigint;
587
+ /** Ciphertext to decrypt */
588
+ ciphertext: ElGamalCiphertext;
589
+ /** Requester address */
590
+ requester: string;
591
+ /** Shares received so far */
592
+ shares_received: number;
593
+ /** Required threshold */
594
+ threshold: number;
595
+ /** Status */
596
+ status: 'pending' | 'in_progress' | 'completed' | 'failed';
597
+ }
598
+ /** Multi-asset encrypted balance */
599
+ interface MultiAssetBalance {
600
+ /** Asset token address */
601
+ asset: string;
602
+ /** Encrypted balance for this asset */
603
+ balance: EncryptedBalance;
604
+ }
605
+ /** Multi-asset balances container */
606
+ interface MultiAssetBalances {
607
+ /** SAGE token balance */
608
+ SAGE: EncryptedBalance;
609
+ /** USDC balance */
610
+ USDC: EncryptedBalance;
611
+ /** STRK balance */
612
+ STRK: EncryptedBalance;
613
+ /** WBTC balance */
614
+ WBTC: EncryptedBalance;
615
+ /** ETH balance */
616
+ ETH: EncryptedBalance;
617
+ }
618
+ /** Private swap parameters */
619
+ interface PrivateSwapParams {
620
+ /** Source asset */
621
+ from_asset: 'SAGE' | 'USDC' | 'STRK' | 'WBTC' | 'ETH';
622
+ /** Destination asset */
623
+ to_asset: 'SAGE' | 'USDC' | 'STRK' | 'WBTC' | 'ETH';
624
+ /** Encrypted amount to swap */
625
+ encrypted_amount: ElGamalCiphertext;
626
+ /** Minimum output proof */
627
+ min_output_proof: RangeProof;
628
+ /** Swap proof */
629
+ swap_proof: TransferProof;
630
+ }
631
+ /** Audit report for compliance */
632
+ interface AuditReport {
633
+ /** Auditor address */
634
+ auditor: string;
635
+ /** Transaction hash audited */
636
+ tx_hash: bigint;
637
+ /** Decrypted amount (only auditor sees) */
638
+ decrypted_amount: bigint;
639
+ /** Audit timestamp */
640
+ timestamp: number;
641
+ /** Signature of audit */
642
+ signature: bigint;
643
+ }
644
+ /** Private transfer parameters */
645
+ interface PrivateTransferParams {
646
+ /** Recipient address */
647
+ to: string;
648
+ /** Encrypted amount to transfer */
649
+ encrypted_amount: ElGamalCiphertext;
650
+ /** Sender's new balance (encrypted) */
651
+ sender_new_balance: ElGamalCiphertext;
652
+ /** Receiver's new balance (encrypted) */
653
+ receiver_new_balance: ElGamalCiphertext;
654
+ /** Transfer proof */
655
+ proof: TransferProof;
656
+ }
657
+ /** Private transfer with audit parameters */
658
+ interface PrivateTransferWithAuditParams extends PrivateTransferParams {
659
+ /** Encrypted amount for auditor */
660
+ auditor_encrypted: ElGamalCiphertext;
661
+ /** Proof all three encrypt same value */
662
+ same_encryption_proof: SameEncryption3Proof;
663
+ }
664
+ /** Worker payment envelope */
665
+ interface PrivateWorkerPayment {
666
+ /** Job ID */
667
+ job_id: bigint;
668
+ /** Worker address */
669
+ worker: string;
670
+ /** Encrypted payment amount */
671
+ encrypted_amount: ElGamalCiphertext;
672
+ /** Payment assets (multi-asset) */
673
+ assets: {
674
+ asset: string;
675
+ amount: ElGamalCiphertext;
676
+ }[];
677
+ /** Payment proof */
678
+ proof: TransferProof;
679
+ }
680
+
681
+ /**
682
+ * Payment Router Types
683
+ * Generated from BitSage-Cairo-Smart-Contracts/src/payments/
684
+ */
685
+ /** Supported payment tokens */
686
+ type PaymentToken = 'USDC' | 'STRK' | 'WBTC' | 'SAGE' | 'STAKED_SAGE' | 'PRIVACY_CREDIT';
687
+ /** Payment quote from router */
688
+ interface PaymentQuote {
689
+ /** Unique quote ID */
690
+ quote_id: bigint;
691
+ /** Token to pay with */
692
+ payment_token: PaymentToken;
693
+ /** Amount in payment token (wei) */
694
+ payment_amount: bigint;
695
+ /** SAGE equivalent amount (wei) */
696
+ sage_equivalent: bigint;
697
+ /** Discount applied (basis points) */
698
+ discount_bps: number;
699
+ /** USD value (6 decimals) */
700
+ usd_value: bigint;
701
+ /** Quote expiration timestamp */
702
+ expires_at: number;
703
+ }
704
+ /** Discount tiers by payment method */
705
+ interface DiscountTiers {
706
+ /** Stablecoin discount (0%) */
707
+ stablecoin_discount_bps: number;
708
+ /** STRK discount (0%) */
709
+ strk_discount_bps: number;
710
+ /** WBTC discount (0%) */
711
+ wbtc_discount_bps: number;
712
+ /** SAGE direct payment discount (5%) */
713
+ sage_discount_bps: number;
714
+ /** Staked SAGE discount (10%) */
715
+ staked_sage_discount_bps: number;
716
+ /** Privacy credit discount (2%) */
717
+ privacy_credit_discount_bps: number;
718
+ }
719
+ /** Fee distribution configuration */
720
+ interface FeeDistribution {
721
+ /** Worker share (80%) */
722
+ worker_bps: number;
723
+ /** Protocol fee (20%) */
724
+ protocol_fee_bps: number;
725
+ /** Burn share of protocol fee (70%) */
726
+ burn_share_bps: number;
727
+ /** Treasury share of protocol fee (20%) */
728
+ treasury_share_bps: number;
729
+ /** Staker rewards share of protocol fee (10%) */
730
+ staker_share_bps: number;
731
+ }
732
+ /** OTC desk configuration */
733
+ interface OTCConfig {
734
+ /** USDC token address */
735
+ usdc_address: string;
736
+ /** STRK token address */
737
+ strk_address: string;
738
+ /** WBTC token address */
739
+ wbtc_address: string;
740
+ /** SAGE token address */
741
+ sage_address: string;
742
+ /** Pragma oracle address */
743
+ oracle_address: string;
744
+ /** Maximum slippage (basis points) */
745
+ max_slippage_bps: number;
746
+ /** Quote validity duration (seconds) */
747
+ quote_validity_secs: number;
748
+ }
749
+ /** Payment statistics */
750
+ interface PaymentStats {
751
+ /** Total payments in USD (6 decimals) */
752
+ total_payments_usd: bigint;
753
+ /** Total SAGE burned (wei) */
754
+ total_sage_burned: bigint;
755
+ /** Total paid to workers (wei) */
756
+ total_worker_payments: bigint;
757
+ /** Total staker rewards (wei) */
758
+ total_staker_rewards: bigint;
759
+ /** Total treasury collected (wei) */
760
+ total_treasury_collected: bigint;
761
+ /** Number of payments processed */
762
+ payment_count: bigint;
763
+ }
764
+ /** Job payment record */
765
+ interface JobPaymentRecord {
766
+ /** Job ID */
767
+ job_id: bigint;
768
+ /** Worker address */
769
+ worker: string;
770
+ /** Client address */
771
+ client: string;
772
+ /** Payment amount in SAGE (wei) */
773
+ sage_amount: bigint;
774
+ /** USD value (6 decimals) */
775
+ usd_value: bigint;
776
+ /** Whether privacy is enabled */
777
+ privacy_enabled: boolean;
778
+ /** Payment status */
779
+ status: PaymentStatus;
780
+ /** Proof hash (if verified) */
781
+ proof_hash?: bigint;
782
+ /** Registration timestamp */
783
+ registered_at: number;
784
+ /** Completion timestamp */
785
+ completed_at?: number;
786
+ }
787
+ /** Payment status */
788
+ type PaymentStatus = 'Pending' | 'ProofVerified' | 'PaymentReleased' | 'Disputed' | 'Cancelled';
789
+ /** Verification source for payment release */
790
+ type VerificationSource = 'STWOProof' | 'TEEOptimistic' | 'TEEChallenged';
791
+ /** Metered billing checkpoint */
792
+ interface ComputeCheckpoint {
793
+ /** Checkpoint ID */
794
+ checkpoint_id: bigint;
795
+ /** Job ID */
796
+ job_id: bigint;
797
+ /** Hour number (1-indexed) */
798
+ hour_number: number;
799
+ /** Proof data hash */
800
+ proof_hash: bigint;
801
+ /** Checkpoint status */
802
+ status: CheckpointStatus;
803
+ /** Submitted at timestamp */
804
+ submitted_at: number;
805
+ /** Verified at timestamp */
806
+ verified_at?: number;
807
+ /** Payment released at */
808
+ paid_at?: number;
809
+ }
810
+ /** Checkpoint status */
811
+ type CheckpointStatus = 'Submitted' | 'Verified' | 'Paid' | 'Failed';
812
+ /** Privacy credit deposit */
813
+ interface PrivacyCreditDeposit {
814
+ /** Depositor address */
815
+ depositor: string;
816
+ /** Amount deposited (wei) */
817
+ amount: bigint;
818
+ /** Commitment for privacy */
819
+ commitment: bigint;
820
+ /** Timestamp */
821
+ deposited_at: number;
822
+ }
823
+ /** Privacy credit usage */
824
+ interface PrivacyCreditUsage {
825
+ /** Job ID paid for */
826
+ job_id: bigint;
827
+ /** USD amount used (6 decimals) */
828
+ usd_amount: bigint;
829
+ /** Nullifier to prevent double-spend */
830
+ nullifier: bigint;
831
+ /** Timestamp */
832
+ used_at: number;
833
+ }
834
+ /** Transaction result */
835
+ interface TransactionResult$6 {
836
+ /** Transaction hash */
837
+ transaction_hash: string;
838
+ /** Status */
839
+ status: 'pending' | 'accepted' | 'rejected';
840
+ /** Block number (if accepted) */
841
+ block_number?: number;
842
+ /** Gas used */
843
+ gas_used?: bigint;
844
+ }
845
+ /** Default discount tiers */
846
+ declare const DEFAULT_DISCOUNT_TIERS: DiscountTiers;
847
+ /** Default fee distribution */
848
+ declare const DEFAULT_FEE_DISTRIBUTION: FeeDistribution;
849
+
850
+ /**
851
+ * Staking Types
852
+ * Generated from BitSage-Cairo-Smart-Contracts/src/staking/prover_staking.cairo
853
+ */
854
+ /** GPU tier classification for staking */
855
+ type GpuTier = 'Consumer' | 'Workstation' | 'DataCenter' | 'Enterprise' | 'Frontier';
856
+ /** Worker tier (8 levels for tokenomics v3.0) */
857
+ type WorkerTier = 'Basic' | 'Premium' | 'Enterprise' | 'Infrastructure' | 'Fleet' | 'Datacenter' | 'Hyperscale' | 'Institutional';
858
+ /** Holder tier based on stake amount */
859
+ type HolderTier = 'Regular' | 'Whale' | 'Institution' | 'HyperWhale';
860
+ /** Slash reason codes */
861
+ type SlashReason = 'InvalidProof' | 'Timeout' | 'RepeatedFailures' | 'Malicious' | 'BenchmarkFraud' | 'ProtocolViolation' | 'Unavailable' | 'PoorPerformance' | 'Fraud';
862
+ /** Worker stake information */
863
+ interface WorkerStake {
864
+ /** Total staked amount (wei) */
865
+ amount: bigint;
866
+ /** Amount locked (cannot unstake) */
867
+ locked_amount: bigint;
868
+ /** Timestamp when staked */
869
+ staked_at: number;
870
+ /** Last rewards claim timestamp */
871
+ last_claim_at: number;
872
+ /** GPU tier */
873
+ gpu_tier: GpuTier;
874
+ /** Whether worker is active */
875
+ is_active: boolean;
876
+ /** Consecutive job failures */
877
+ consecutive_failures: number;
878
+ /** Total successful jobs */
879
+ total_successes: bigint;
880
+ /** Total slashed amount */
881
+ total_slashed: bigint;
882
+ /** Whether has TEE support */
883
+ has_tee: boolean;
884
+ /** TEE type if applicable */
885
+ tee_type?: 'IntelTDX' | 'AMDSEVSNP' | 'NvidiaCC';
886
+ }
887
+ /** Extended stake info with rewards */
888
+ interface StakeInfo {
889
+ /** Core stake data */
890
+ stake: WorkerStake;
891
+ /** Pending rewards (wei) */
892
+ pending_rewards: bigint;
893
+ /** Total rewards claimed (wei) */
894
+ total_rewards_claimed: bigint;
895
+ /** Current APY estimate (basis points) */
896
+ estimated_apy_bps: number;
897
+ /** Worker tier */
898
+ worker_tier: WorkerTier;
899
+ /** Holder tier */
900
+ holder_tier: HolderTier;
901
+ /** Locked until timestamp (for unstaking) */
902
+ locked_until?: number;
903
+ /** Is eligible for jobs */
904
+ is_eligible: boolean;
905
+ }
906
+ /** Staking configuration */
907
+ interface StakingConfig {
908
+ /** Minimum stake per GPU tier (wei) */
909
+ min_stake_per_tier: {
910
+ Consumer: bigint;
911
+ Workstation: bigint;
912
+ DataCenter: bigint;
913
+ Enterprise: bigint;
914
+ Frontier: bigint;
915
+ };
916
+ /** Slash percentages per reason (basis points) */
917
+ slash_percentages: {
918
+ InvalidProof: number;
919
+ Timeout: number;
920
+ RepeatedFailures: number;
921
+ Malicious: number;
922
+ BenchmarkFraud: number;
923
+ ProtocolViolation: number;
924
+ Unavailable: number;
925
+ PoorPerformance: number;
926
+ Fraud: number;
927
+ };
928
+ /** Unstake lockup period (seconds) */
929
+ unstake_lockup_secs: number;
930
+ /** Base reward APY (basis points) */
931
+ reward_apy_bps: number;
932
+ /** TEE bonus APY (basis points) */
933
+ tee_bonus_apy_bps: number;
934
+ }
935
+ /** Slash record */
936
+ interface SlashRecord {
937
+ /** Slash ID */
938
+ slash_id: bigint;
939
+ /** Worker address */
940
+ worker: string;
941
+ /** Slash reason */
942
+ reason: SlashReason;
943
+ /** Amount slashed (wei) */
944
+ amount: bigint;
945
+ /** Percentage slashed (basis points) */
946
+ percentage_bps: number;
947
+ /** Related job ID if applicable */
948
+ job_id?: bigint;
949
+ /** Challenger address if any */
950
+ challenger?: string;
951
+ /** Timestamp */
952
+ slashed_at: number;
953
+ /** Evidence hash */
954
+ evidence_hash?: bigint;
955
+ /** Is disputed */
956
+ is_disputed: boolean;
957
+ /** Dispute ID if disputed */
958
+ dispute_id?: bigint;
959
+ }
960
+ /** Dispute record for slash challenges */
961
+ interface DisputeRecord {
962
+ /** Dispute ID */
963
+ dispute_id: bigint;
964
+ /** Related slash ID */
965
+ slash_id: bigint;
966
+ /** Challenger address */
967
+ challenger: string;
968
+ /** Dispute bond amount (wei) */
969
+ bond_amount: bigint;
970
+ /** Evidence hash provided */
971
+ evidence_hash: bigint;
972
+ /** Dispute status */
973
+ status: DisputeStatus;
974
+ /** Submitted at timestamp */
975
+ submitted_at: number;
976
+ /** Resolution timestamp */
977
+ resolved_at?: number;
978
+ /** Resolution reason */
979
+ resolution_reason?: string;
980
+ /** Whether slash was upheld */
981
+ slash_upheld?: boolean;
982
+ }
983
+ /** Dispute status */
984
+ type DisputeStatus = 'Pending' | 'UnderReview' | 'Resolved' | 'Rejected' | 'Expired';
985
+ /** Worker tier benefits */
986
+ interface WorkerTierBenefits {
987
+ /** Tier name */
988
+ tier: WorkerTier;
989
+ /** Required stake USD value */
990
+ required_stake_usd: bigint;
991
+ /** Priority queue access */
992
+ priority_queue: boolean;
993
+ /** Job multiplier (basis points) */
994
+ job_multiplier_bps: number;
995
+ /** Reduced slashing (basis points reduction) */
996
+ slash_reduction_bps: number;
997
+ /** Governance voting weight multiplier */
998
+ voting_weight_multiplier: number;
999
+ }
1000
+ /** Unstake request */
1001
+ interface UnstakeRequest {
1002
+ /** Request ID */
1003
+ request_id: bigint;
1004
+ /** Worker address */
1005
+ worker: string;
1006
+ /** Amount to unstake (wei) */
1007
+ amount: bigint;
1008
+ /** Request timestamp */
1009
+ requested_at: number;
1010
+ /** Available after timestamp */
1011
+ available_at: number;
1012
+ /** Status */
1013
+ status: 'Pending' | 'Available' | 'Completed' | 'Cancelled';
1014
+ }
1015
+ /** Minimum stake requirements */
1016
+ declare const MIN_STAKE: {
1017
+ readonly Consumer: bigint;
1018
+ readonly Workstation: bigint;
1019
+ readonly DataCenter: bigint;
1020
+ readonly Enterprise: bigint;
1021
+ readonly Frontier: bigint;
1022
+ };
1023
+ /** Slash percentages (basis points) */
1024
+ declare const SLASH_PERCENTAGES: {
1025
+ readonly InvalidProof: 1000;
1026
+ readonly Timeout: 500;
1027
+ readonly RepeatedFailures: 1500;
1028
+ readonly Malicious: 5000;
1029
+ readonly BenchmarkFraud: 3000;
1030
+ readonly ProtocolViolation: 2000;
1031
+ readonly Unavailable: 200;
1032
+ readonly PoorPerformance: 500;
1033
+ readonly Fraud: 10000;
1034
+ };
1035
+ /** Unstake lockup period (7 days) */
1036
+ declare const UNSTAKE_LOCKUP_SECS: number;
1037
+ /** Helper to check if worker is eligible */
1038
+ declare function isWorkerEligible(stake: WorkerStake): boolean;
1039
+ /** Helper to get min stake for tier */
1040
+ declare function getMinStakeForTier(tier: GpuTier): bigint;
1041
+
1042
+ /**
1043
+ * SAGE Token Governance Types
1044
+ * Generated from BitSage-Cairo-Smart-Contracts/src/sage_token.cairo
1045
+ */
1046
+ /** Proposal status */
1047
+ type ProposalStatus = 'Draft' | 'Active' | 'Succeeded' | 'Executed' | 'Defeated' | 'Cancelled' | 'Expired';
1048
+ /** Proposal type for enhanced governance */
1049
+ type ProposalType = 'Standard' | 'InflationAdjustment' | 'BurnRateChange' | 'TreasurySpend' | 'ProtocolUpgrade' | 'Emergency';
1050
+ /** Governance proposal */
1051
+ interface GovernanceProposal {
1052
+ /** Proposal ID */
1053
+ proposal_id: bigint;
1054
+ /** Proposer address */
1055
+ proposer: string;
1056
+ /** Description of proposal */
1057
+ description: string;
1058
+ /** Proposal type */
1059
+ proposal_type: ProposalType;
1060
+ /** Inflation change (basis points, signed) */
1061
+ inflation_change_bps: number;
1062
+ /** Burn rate change (basis points, signed) */
1063
+ burn_rate_change_bps: number;
1064
+ /** Treasury spend amount (if applicable) */
1065
+ treasury_spend_amount?: bigint;
1066
+ /** Treasury spend recipient */
1067
+ treasury_spend_recipient?: string;
1068
+ /** Votes in favor */
1069
+ votes_for: bigint;
1070
+ /** Votes against */
1071
+ votes_against: bigint;
1072
+ /** Current status */
1073
+ status: ProposalStatus;
1074
+ /** Creation timestamp */
1075
+ created_at: number;
1076
+ /** Voting start timestamp */
1077
+ voting_starts_at: number;
1078
+ /** Voting end timestamp */
1079
+ voting_ends_at: number;
1080
+ /** Execution timestamp (if executed) */
1081
+ executed_at?: number;
1082
+ /** Quorum required (basis points) */
1083
+ quorum_bps: number;
1084
+ /** Snapshot block number */
1085
+ snapshot_block: number;
1086
+ }
1087
+ /** Governance rights for an address */
1088
+ interface GovernanceRights {
1089
+ /** Address */
1090
+ address: string;
1091
+ /** Current voting power */
1092
+ voting_power: bigint;
1093
+ /** Can create standard proposals */
1094
+ can_create_standard: boolean;
1095
+ /** Can create inflation proposals */
1096
+ can_create_inflation: boolean;
1097
+ /** Can create emergency proposals */
1098
+ can_create_emergency: boolean;
1099
+ /** Number of active proposals */
1100
+ active_proposals: number;
1101
+ /** Last proposal timestamp */
1102
+ last_proposal_at?: number;
1103
+ /** Delegated voting power */
1104
+ delegated_power: bigint;
1105
+ /** Address delegated to */
1106
+ delegated_to?: string;
1107
+ }
1108
+ /** Governance statistics */
1109
+ interface GovernanceStats {
1110
+ /** Total proposals created */
1111
+ total_proposals: bigint;
1112
+ /** Total executed proposals */
1113
+ executed_proposals: bigint;
1114
+ /** Total defeated proposals */
1115
+ defeated_proposals: bigint;
1116
+ /** Current total voting power */
1117
+ total_voting_power: bigint;
1118
+ /** Average participation rate (basis points) */
1119
+ avg_participation_bps: number;
1120
+ /** Current quorum threshold (basis points) */
1121
+ quorum_threshold_bps: number;
1122
+ /** Minimum proposal threshold (SAGE) */
1123
+ proposal_threshold: bigint;
1124
+ }
1125
+ /** Token pool balances */
1126
+ interface PoolBalances {
1127
+ /** Ecosystem pool (40%) */
1128
+ ecosystem: bigint;
1129
+ /** Treasury pool (15%) */
1130
+ treasury: bigint;
1131
+ /** Team pool (15%) */
1132
+ team: bigint;
1133
+ /** Public sale pool (10%) */
1134
+ public_sale: bigint;
1135
+ /** Pre-seed pool (2%) */
1136
+ pre_seed: bigint;
1137
+ /** Seed pool (5%) */
1138
+ seed: bigint;
1139
+ /** Strategic pool (8%) */
1140
+ strategic: bigint;
1141
+ /** Advisors pool (3%) */
1142
+ advisors: bigint;
1143
+ /** Code dev pool (2%) */
1144
+ code_dev: bigint;
1145
+ }
1146
+ /** Vesting status */
1147
+ interface VestingStatus {
1148
+ /** Treasury vesting progress (basis points) */
1149
+ treasury_vested_bps: number;
1150
+ /** Team vesting progress (basis points) */
1151
+ team_vested_bps: number;
1152
+ /** Whether team cliff has passed */
1153
+ team_cliff_passed: boolean;
1154
+ /** Public sale vesting progress (basis points) */
1155
+ public_sale_vested_bps: number;
1156
+ /** Months since TGE */
1157
+ months_since_tge: number;
1158
+ /** Next vesting release timestamp */
1159
+ next_release_at: number;
1160
+ }
1161
+ /** Security budget information */
1162
+ interface SecurityBudget {
1163
+ /** Annual security budget (wei) */
1164
+ annual_budget: bigint;
1165
+ /** Remaining budget this year (wei) */
1166
+ remaining_budget: bigint;
1167
+ /** Reserve fund (wei) */
1168
+ reserve_fund: bigint;
1169
+ /** Last audit timestamp */
1170
+ last_audit_at: number;
1171
+ /** Current security score (0-100) */
1172
+ security_score: number;
1173
+ }
1174
+ /** Burn event record */
1175
+ interface BurnEvent {
1176
+ /** Event ID */
1177
+ event_id: bigint;
1178
+ /** Amount burned (wei) */
1179
+ amount: bigint;
1180
+ /** Revenue source */
1181
+ revenue_source: string;
1182
+ /** Execution price (6 decimals) */
1183
+ execution_price: bigint;
1184
+ /** Timestamp */
1185
+ burned_at: number;
1186
+ /** Transaction hash */
1187
+ tx_hash: string;
1188
+ }
1189
+ /** Ecosystem emission status */
1190
+ interface EcosystemEmissionStatus {
1191
+ /** Remaining to emit (wei) */
1192
+ remaining: bigint;
1193
+ /** Total emitted (wei) */
1194
+ total_emitted: bigint;
1195
+ /** Current month number */
1196
+ current_month: number;
1197
+ /** Last emission timestamp */
1198
+ last_emission_at: number;
1199
+ /** Current emission rate (wei/month) */
1200
+ emission_rate: bigint;
1201
+ }
1202
+ /** Token flow summary */
1203
+ interface TokenFlowSummary {
1204
+ /** Total minted (wei) */
1205
+ total_minted: bigint;
1206
+ /** Total burned (wei) */
1207
+ total_burned: bigint;
1208
+ /** Net change (wei, absolute value) */
1209
+ net_change_abs: bigint;
1210
+ /** Whether net deflationary */
1211
+ is_deflationary: boolean;
1212
+ /** Period start timestamp */
1213
+ period_start: number;
1214
+ /** Period end timestamp */
1215
+ period_end: number;
1216
+ }
1217
+ /** Milestone status flags */
1218
+ interface MilestoneStatus {
1219
+ /** Burned 10% of supply */
1220
+ burn_10_percent: boolean;
1221
+ /** Burned 25% of supply */
1222
+ burn_25_percent: boolean;
1223
+ /** Burned 50% of supply */
1224
+ burn_50_percent: boolean;
1225
+ /** Reached 1M USD monthly revenue */
1226
+ revenue_1m_usd: boolean;
1227
+ /** Reached 10M USD monthly revenue */
1228
+ revenue_10m_usd: boolean;
1229
+ }
1230
+ /** Rate limit info for large transfers */
1231
+ interface RateLimitInfo {
1232
+ /** Amount already transferred this period */
1233
+ amount_transferred: bigint;
1234
+ /** Period start timestamp */
1235
+ period_start: number;
1236
+ /** Maximum allowed per period */
1237
+ max_per_period: bigint;
1238
+ /** Cooldown remaining (seconds) */
1239
+ cooldown_remaining: number;
1240
+ }
1241
+ /** Pending large transfer */
1242
+ interface PendingTransfer {
1243
+ /** Transfer ID */
1244
+ transfer_id: bigint;
1245
+ /** Sender address */
1246
+ from: string;
1247
+ /** Recipient address */
1248
+ to: string;
1249
+ /** Amount (wei) */
1250
+ amount: bigint;
1251
+ /** Initiated timestamp */
1252
+ initiated_at: number;
1253
+ /** Executable after timestamp */
1254
+ executable_after: number;
1255
+ /** Status */
1256
+ status: 'Pending' | 'Executed' | 'Cancelled';
1257
+ }
1258
+ /** Create proposal parameters */
1259
+ interface CreateProposalParams {
1260
+ /** Proposal description */
1261
+ description: string;
1262
+ /** Proposal type */
1263
+ proposal_type: ProposalType;
1264
+ /** Inflation change (optional, basis points) */
1265
+ inflation_change_bps?: number;
1266
+ /** Burn rate change (optional, basis points) */
1267
+ burn_rate_change_bps?: number;
1268
+ /** Treasury spend amount (optional, wei) */
1269
+ treasury_spend_amount?: bigint;
1270
+ /** Treasury spend recipient (optional) */
1271
+ treasury_spend_recipient?: string;
1272
+ }
1273
+ /** Governance configuration constants */
1274
+ declare const GOVERNANCE_CONFIG: {
1275
+ /** Voting period (3 days) */
1276
+ readonly VOTING_PERIOD_SECS: number;
1277
+ /** Execution delay (1 day) */
1278
+ readonly EXECUTION_DELAY_SECS: number;
1279
+ /** Quorum threshold (4%) */
1280
+ readonly QUORUM_BPS: 400;
1281
+ /** Proposal threshold (100,000 SAGE) */
1282
+ readonly PROPOSAL_THRESHOLD: bigint;
1283
+ /** Emergency proposal threshold (1,000,000 SAGE) */
1284
+ readonly EMERGENCY_THRESHOLD: bigint;
1285
+ /** Maximum inflation change per proposal (1%) */
1286
+ readonly MAX_INFLATION_CHANGE_BPS: 100;
1287
+ /** Maximum burn rate change per proposal (5%) */
1288
+ readonly MAX_BURN_RATE_CHANGE_BPS: 500;
1289
+ /** Rate limit window (24 hours) */
1290
+ readonly RATE_LIMIT_WINDOW_SECS: number;
1291
+ /** Large transfer threshold */
1292
+ readonly LARGE_TRANSFER_THRESHOLD: bigint;
1293
+ /** Large transfer timelock (24 hours) */
1294
+ readonly LARGE_TRANSFER_TIMELOCK_SECS: number;
1295
+ };
1296
+
1297
+ /**
1298
+ * STWO Verifier and Proof Types
1299
+ * Generated from BitSage-Cairo-Smart-Contracts/src/obelysk/stwo_verifier.cairo
1300
+ */
1301
+ /** Proof verification status */
1302
+ type VerificationStatus = 'NotSubmitted' | 'Pending' | 'Verified' | 'Failed' | 'Rejected' | 'OptimisticPending' | 'Challenged';
1303
+ /** Proof source type */
1304
+ type ProofSource = 'StandardSTWO' | 'GpuTeeSTWO' | 'Unknown';
1305
+ /** TEE type for GPU attestation */
1306
+ type TeeType$1 = 'IntelTDX' | 'AMDSEVSNP' | 'NvidiaCC';
1307
+ /** TEE attestation data */
1308
+ interface TeeAttestation {
1309
+ /** TEE type */
1310
+ tee_type: TeeType$1;
1311
+ /** Enclave measurement hash */
1312
+ enclave_measurement: bigint;
1313
+ /** Quote hash */
1314
+ quote_hash: bigint;
1315
+ /** Attestation timestamp */
1316
+ attestation_timestamp: number;
1317
+ /** Whether enclave is whitelisted */
1318
+ is_whitelisted: boolean;
1319
+ }
1320
+ /** Proof metadata */
1321
+ interface ProofMetadata {
1322
+ /** Proof hash */
1323
+ proof_hash: bigint;
1324
+ /** Public input hash */
1325
+ public_input_hash: bigint;
1326
+ /** Security bits */
1327
+ security_bits: number;
1328
+ /** Submission timestamp */
1329
+ submitted_at: number;
1330
+ /** Submitter address */
1331
+ submitter: string;
1332
+ /** Verification status */
1333
+ status: VerificationStatus;
1334
+ /** Proof source */
1335
+ source: ProofSource;
1336
+ /** TEE attestation (if GPU-TEE proof) */
1337
+ tee_attestation?: TeeAttestation;
1338
+ /** Verification timestamp */
1339
+ verified_at?: number;
1340
+ /** Gas used for verification */
1341
+ gas_used?: bigint;
1342
+ /** Challenge window end (for optimistic proofs) */
1343
+ challenge_window_end?: number;
1344
+ }
1345
+ /** GPU-TEE proof submission parameters */
1346
+ interface GpuTeeProofParams {
1347
+ /** Proof data (serialized) */
1348
+ proof_data: string[];
1349
+ /** Public input hash */
1350
+ public_input_hash: bigint;
1351
+ /** TEE type (1=Intel TDX, 2=AMD SEV-SNP, 3=NVIDIA CC) */
1352
+ tee_type: number;
1353
+ /** Enclave measurement */
1354
+ enclave_measurement: bigint;
1355
+ /** Quote hash */
1356
+ quote_hash: bigint;
1357
+ /** Attestation timestamp */
1358
+ attestation_timestamp: number;
1359
+ }
1360
+ /** Batch verification status */
1361
+ interface BatchStatus {
1362
+ /** Batch ID */
1363
+ batch_id: string;
1364
+ /** Batch hash */
1365
+ batch_hash: bigint;
1366
+ /** Number of proofs in batch */
1367
+ proof_count: number;
1368
+ /** Number verified */
1369
+ verified_count: number;
1370
+ /** Number failed */
1371
+ failed_count: number;
1372
+ /** Overall status */
1373
+ status: 'Pending' | 'InProgress' | 'Completed' | 'PartialFailure' | 'Failed';
1374
+ /** Submitted at */
1375
+ submitted_at: number;
1376
+ /** Completed at */
1377
+ completed_at?: number;
1378
+ /** Total gas used */
1379
+ total_gas_used?: bigint;
1380
+ }
1381
+ /** Proof job specification */
1382
+ interface ProofJobSpec {
1383
+ /** Proof type */
1384
+ proof_type: ProofType;
1385
+ /** Batch hash (what we're proving) */
1386
+ batch_hash: bigint;
1387
+ /** Public input hash */
1388
+ public_input_hash: bigint;
1389
+ /** Priority level */
1390
+ priority: ProofPriority;
1391
+ /** Base reward in USDC (6 decimals) */
1392
+ reward_usdc: bigint;
1393
+ /** Bonus in SAGE (wei) */
1394
+ bonus_sage: bigint;
1395
+ /** Deadline timestamp */
1396
+ deadline_timestamp: number;
1397
+ /** Required TEE attestations */
1398
+ required_attestations: number;
1399
+ /** Minimum stake requirement */
1400
+ min_stake_requirement: bigint;
1401
+ }
1402
+ /** Proof type */
1403
+ type ProofType = 'StarknetBatch' | 'RecursiveProof' | 'ZKMLInference' | 'CrossChainBridge' | 'ApplicationSpecific';
1404
+ /** Proof priority level */
1405
+ type ProofPriority = 'Standard' | 'High' | 'Critical' | 'Emergency';
1406
+ /** Proof submission for verification */
1407
+ interface ProofSubmission {
1408
+ /** Job ID being proven */
1409
+ job_id: bigint;
1410
+ /** Proof data (serialized) */
1411
+ proof_data: string[];
1412
+ /** Public inputs */
1413
+ public_inputs: bigint[];
1414
+ /** Worker address */
1415
+ worker: string;
1416
+ /** TEE attestation (if using GPU-TEE) */
1417
+ tee_attestation?: TeeAttestation;
1418
+ /** Computation proof hash */
1419
+ computation_proof_hash: bigint;
1420
+ }
1421
+ /** Prover metrics */
1422
+ interface ProverMetrics {
1423
+ /** Worker ID */
1424
+ worker_id: string;
1425
+ /** Total proofs submitted */
1426
+ total_proofs: bigint;
1427
+ /** Total verified */
1428
+ verified_proofs: bigint;
1429
+ /** Total failed */
1430
+ failed_proofs: bigint;
1431
+ /** Average verification time (ms) */
1432
+ avg_verification_time_ms: number;
1433
+ /** Current reputation score */
1434
+ reputation_score: number;
1435
+ /** Total rewards earned (wei) */
1436
+ total_rewards: bigint;
1437
+ }
1438
+ /** Compression statistics */
1439
+ interface CompressionStats {
1440
+ /** Original proof size (bytes) */
1441
+ original_size: number;
1442
+ /** Compressed size (bytes) */
1443
+ compressed_size: number;
1444
+ /** Compression ratio (0.0-1.0) */
1445
+ compression_ratio: number;
1446
+ /** Algorithm used */
1447
+ algorithm: 'zstd' | 'lz4' | 'snappy';
1448
+ /** Compression time (ms) */
1449
+ compression_time_ms: number;
1450
+ }
1451
+ /** Compressed proof envelope */
1452
+ interface CompressedProof {
1453
+ /** Algorithm used */
1454
+ algorithm: 'zstd' | 'lz4' | 'snappy';
1455
+ /** Compressed data */
1456
+ data: Uint8Array;
1457
+ /** Original size for validation */
1458
+ original_size: number;
1459
+ /** Integrity hash */
1460
+ integrity_hash: bigint;
1461
+ }
1462
+ /** TEE quote for attestation */
1463
+ interface TeeQuote {
1464
+ /** Quote data (raw) */
1465
+ quote_data: Uint8Array;
1466
+ /** Enclave measurement */
1467
+ enclave_measurement: bigint;
1468
+ /** Timestamp */
1469
+ timestamp: number;
1470
+ /** Additional claims */
1471
+ claims: Record<string, bigint>;
1472
+ }
1473
+ /** Execution metrics from TEE */
1474
+ interface ExecutionMetrics {
1475
+ /** CPU cycles */
1476
+ cpu_cycles: bigint;
1477
+ /** Memory peak (bytes) */
1478
+ memory_peak: bigint;
1479
+ /** Execution time (ms) */
1480
+ execution_time_ms: number;
1481
+ /** GPU utilization (if applicable) */
1482
+ gpu_utilization?: number;
1483
+ }
1484
+ /** Enclave information */
1485
+ interface EnclaveInfo {
1486
+ /** Enclave measurement */
1487
+ measurement: bigint;
1488
+ /** TEE type */
1489
+ tee_type: TeeType$1;
1490
+ /** Whitelisted at */
1491
+ whitelisted_at: number;
1492
+ /** Whitelisted by */
1493
+ whitelisted_by: string;
1494
+ /** Is currently valid */
1495
+ is_valid: boolean;
1496
+ /** Revoked at (if revoked) */
1497
+ revoked_at?: number;
1498
+ }
1499
+ /** Verification constants */
1500
+ declare const VERIFICATION_CONFIG: {
1501
+ /** Standard verification gas estimate */
1502
+ readonly STANDARD_GAS: 500000n;
1503
+ /** GPU-TEE verification gas estimate */
1504
+ readonly GPU_TEE_GAS: 100000n;
1505
+ /** Challenge period (24 hours) */
1506
+ readonly CHALLENGE_PERIOD_SECS: number;
1507
+ /** Minimum challenge stake */
1508
+ readonly MIN_CHALLENGE_STAKE: bigint;
1509
+ /** Maximum proof size (256KB) */
1510
+ readonly MAX_PROOF_SIZE: number;
1511
+ /** Security bits required */
1512
+ readonly REQUIRED_SECURITY_BITS: 128;
1513
+ };
1514
+
1515
+ /**
1516
+ * HTTP Client with retry logic and error handling
1517
+ */
1518
+ interface HttpConfig {
1519
+ /** Base URL for API */
1520
+ baseUrl: string;
1521
+ /** Request timeout in ms */
1522
+ timeout: number;
1523
+ /** Maximum retry attempts */
1524
+ maxRetries: number;
1525
+ /** Retry delay base (ms) - uses exponential backoff */
1526
+ retryDelayMs: number;
1527
+ /** Custom headers */
1528
+ headers?: Record<string, string>;
1529
+ }
1530
+ declare const DEFAULT_HTTP_CONFIG: HttpConfig;
1531
+ /**
1532
+ * HTTP Client with automatic retry and error handling
1533
+ */
1534
+ declare class HttpClient {
1535
+ private config;
1536
+ constructor(config?: Partial<HttpConfig>);
1537
+ /**
1538
+ * GET request
1539
+ */
1540
+ get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
1541
+ /**
1542
+ * POST request
1543
+ */
1544
+ post<T>(path: string, body?: unknown): Promise<T>;
1545
+ /**
1546
+ * PUT request
1547
+ */
1548
+ put<T>(path: string, body?: unknown): Promise<T>;
1549
+ /**
1550
+ * DELETE request
1551
+ */
1552
+ delete<T>(path: string): Promise<T>;
1553
+ /**
1554
+ * Build URL with query parameters
1555
+ */
1556
+ private buildUrl;
1557
+ /**
1558
+ * Execute request with retry logic
1559
+ */
1560
+ private request;
1561
+ /**
1562
+ * Execute single request
1563
+ */
1564
+ private executeRequest;
1565
+ /**
1566
+ * Check if error is retryable
1567
+ */
1568
+ private isRetryable;
1569
+ /**
1570
+ * Sleep helper
1571
+ */
1572
+ private sleep;
1573
+ /**
1574
+ * Update configuration
1575
+ */
1576
+ updateConfig(config: Partial<HttpConfig>): void;
1577
+ /**
1578
+ * Get current configuration
1579
+ */
1580
+ getConfig(): HttpConfig;
1581
+ }
1582
+
1583
+ /**
1584
+ * WebSocket Client with auto-reconnect and subscription management
1585
+ */
1586
+ interface WsConfig {
1587
+ /** WebSocket URL */
1588
+ url: string;
1589
+ /** Auto-reconnect on disconnect */
1590
+ reconnect: boolean;
1591
+ /** Initial reconnect delay (ms) */
1592
+ reconnectIntervalMs: number;
1593
+ /** Maximum reconnect attempts */
1594
+ maxReconnectAttempts: number;
1595
+ /** Heartbeat interval (ms) */
1596
+ heartbeatIntervalMs: number;
1597
+ /** Connection timeout (ms) */
1598
+ connectTimeoutMs: number;
1599
+ }
1600
+ declare const DEFAULT_WS_CONFIG: WsConfig;
1601
+ /** WebSocket event types */
1602
+ type WsEventType = 'job_update' | 'worker_update' | 'network_stats' | 'proof_verified' | 'heartbeat' | 'error';
1603
+ /** Base WebSocket event */
1604
+ interface WsEvent {
1605
+ type: WsEventType;
1606
+ timestamp: number;
1607
+ data: unknown;
1608
+ }
1609
+ /** Job update event */
1610
+ interface JobUpdateEvent extends WsEvent {
1611
+ type: 'job_update';
1612
+ data: {
1613
+ job_id: string;
1614
+ status: string;
1615
+ progress?: number;
1616
+ error?: string;
1617
+ worker_id?: string;
1618
+ };
1619
+ }
1620
+ /** Worker update event */
1621
+ interface WorkerUpdateEvent extends WsEvent {
1622
+ type: 'worker_update';
1623
+ data: {
1624
+ worker_id: string;
1625
+ status: string;
1626
+ gpu_utilization?: number;
1627
+ memory_usage?: number;
1628
+ active_jobs?: number;
1629
+ temperature?: number;
1630
+ };
1631
+ }
1632
+ /** Network stats event */
1633
+ interface NetworkStatsEvent extends WsEvent {
1634
+ type: 'network_stats';
1635
+ data: {
1636
+ active_workers: number;
1637
+ jobs_in_progress: number;
1638
+ tps: number;
1639
+ jobs_completed_last_hour: number;
1640
+ };
1641
+ }
1642
+ /** Proof verified event */
1643
+ interface ProofVerifiedEvent extends WsEvent {
1644
+ type: 'proof_verified';
1645
+ data: {
1646
+ proof_hash: string;
1647
+ job_id: string;
1648
+ verified: boolean;
1649
+ gas_used?: bigint;
1650
+ tx_hash?: string;
1651
+ };
1652
+ }
1653
+ type EventCallback<T extends WsEvent = WsEvent> = (event: T) => void;
1654
+ type Unsubscribe = () => void;
1655
+ /**
1656
+ * WebSocket Client with auto-reconnect and subscriptions
1657
+ */
1658
+ declare class WebSocketClient {
1659
+ private config;
1660
+ private ws;
1661
+ private subscriptions;
1662
+ private reconnectAttempts;
1663
+ private heartbeatTimer;
1664
+ private reconnectTimer;
1665
+ private isIntentionallyClosed;
1666
+ private onReconnectCallback?;
1667
+ private onErrorCallback?;
1668
+ private onDisconnectCallback?;
1669
+ constructor(config?: Partial<WsConfig>);
1670
+ /**
1671
+ * Connect to WebSocket server
1672
+ */
1673
+ connect(): Promise<void>;
1674
+ /**
1675
+ * Disconnect from WebSocket server
1676
+ */
1677
+ disconnect(): void;
1678
+ /**
1679
+ * Check if connected
1680
+ */
1681
+ isConnected(): boolean;
1682
+ /**
1683
+ * Subscribe to job updates
1684
+ */
1685
+ subscribeToJobUpdates(jobId: string, callback: EventCallback<JobUpdateEvent>): Unsubscribe;
1686
+ /**
1687
+ * Subscribe to worker updates
1688
+ */
1689
+ subscribeToWorkerUpdates(workerId: string, callback: EventCallback<WorkerUpdateEvent>): Unsubscribe;
1690
+ /**
1691
+ * Subscribe to network stats
1692
+ */
1693
+ subscribeToNetworkStats(callback: EventCallback<NetworkStatsEvent>): Unsubscribe;
1694
+ /**
1695
+ * Subscribe to proof verified events
1696
+ */
1697
+ subscribeToProofVerified(proofHash: string, callback: EventCallback<ProofVerifiedEvent>): Unsubscribe;
1698
+ /**
1699
+ * Generic subscribe method
1700
+ */
1701
+ subscribe(channel: string, callback: EventCallback): Unsubscribe;
1702
+ /**
1703
+ * Set reconnect callback
1704
+ */
1705
+ onReconnect(callback: () => void): Unsubscribe;
1706
+ /**
1707
+ * Set error callback
1708
+ */
1709
+ onError(callback: (error: Error) => void): Unsubscribe;
1710
+ /**
1711
+ * Set disconnect callback
1712
+ */
1713
+ onDisconnect(callback: () => void): Unsubscribe;
1714
+ /**
1715
+ * Handle incoming message
1716
+ */
1717
+ private handleMessage;
1718
+ /**
1719
+ * Get channel from event
1720
+ */
1721
+ private getChannelFromEvent;
1722
+ /**
1723
+ * Send subscribe message
1724
+ */
1725
+ private sendSubscribe;
1726
+ /**
1727
+ * Send unsubscribe message
1728
+ */
1729
+ private sendUnsubscribe;
1730
+ /**
1731
+ * Send message
1732
+ */
1733
+ private send;
1734
+ /**
1735
+ * Start heartbeat
1736
+ */
1737
+ private startHeartbeat;
1738
+ /**
1739
+ * Stop heartbeat
1740
+ */
1741
+ private stopHeartbeat;
1742
+ /**
1743
+ * Schedule reconnection
1744
+ */
1745
+ private scheduleReconnect;
1746
+ /**
1747
+ * Clear reconnect timer
1748
+ */
1749
+ private clearReconnectTimer;
1750
+ /**
1751
+ * Resubscribe to all channels after reconnect
1752
+ */
1753
+ private resubscribeAll;
1754
+ /**
1755
+ * Update configuration
1756
+ */
1757
+ updateConfig(config: Partial<WsConfig>): void;
1758
+ }
1759
+
1760
+ /**
1761
+ * Starknet Contract Client
1762
+ * Handles direct contract interactions for on-chain operations
1763
+ */
1764
+
1765
+ interface ContractConfig {
1766
+ /** Starknet RPC URL */
1767
+ rpcUrl: string;
1768
+ /** Network (mainnet, sepolia, local) */
1769
+ network: 'mainnet' | 'sepolia' | 'local';
1770
+ /** Account address for signing */
1771
+ accountAddress?: string;
1772
+ /** Private key for signing */
1773
+ privateKey?: string;
1774
+ /** Maximum gas price (wei) */
1775
+ maxGasPrice?: bigint;
1776
+ /** Transaction confirmation timeout (ms) */
1777
+ confirmationTimeoutMs: number;
1778
+ /** Polling interval for transaction status (ms) */
1779
+ pollingIntervalMs: number;
1780
+ }
1781
+ declare const DEFAULT_CONTRACT_CONFIG: ContractConfig;
1782
+ /** Transaction status */
1783
+ type TxStatus = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
1784
+ /** Transaction receipt */
1785
+ interface TransactionReceipt {
1786
+ transaction_hash: string;
1787
+ status: TxStatus;
1788
+ block_hash?: string;
1789
+ block_number?: number;
1790
+ actual_fee?: {
1791
+ amount: string;
1792
+ unit: string;
1793
+ };
1794
+ execution_status?: 'SUCCEEDED' | 'REVERTED';
1795
+ revert_reason?: string;
1796
+ }
1797
+ /**
1798
+ * Starknet Contract Client
1799
+ *
1800
+ * Provides direct contract interaction capabilities for:
1801
+ * - Reading contract state (call)
1802
+ * - Writing to contracts (invoke)
1803
+ * - Waiting for transaction confirmation
1804
+ */
1805
+ declare class ContractClient {
1806
+ private config;
1807
+ constructor(config?: Partial<ContractConfig>);
1808
+ /**
1809
+ * Configure wallet for signing transactions
1810
+ */
1811
+ withWallet(accountAddress: string, privateKey: string): this;
1812
+ /**
1813
+ * Call a contract method (read-only, no gas)
1814
+ */
1815
+ call(contractAddress: string, entrypoint: string, calldata?: string[]): Promise<string[]>;
1816
+ /**
1817
+ * Invoke a contract method (write, requires gas)
1818
+ */
1819
+ invoke(contractAddress: string, entrypoint: string, calldata?: string[]): Promise<TransactionResult$6>;
1820
+ /**
1821
+ * Invoke and wait for confirmation
1822
+ */
1823
+ invokeAndWait(contractAddress: string, entrypoint: string, calldata?: string[]): Promise<TransactionResult$6>;
1824
+ /**
1825
+ * Wait for transaction to be accepted
1826
+ */
1827
+ waitForTransaction(txHash: string): Promise<TransactionResult$6>;
1828
+ /**
1829
+ * Get transaction receipt
1830
+ */
1831
+ getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
1832
+ /**
1833
+ * Get transaction status
1834
+ */
1835
+ getTransactionStatus(txHash: string): Promise<TxStatus>;
1836
+ /**
1837
+ * Get current block number
1838
+ */
1839
+ getBlockNumber(): Promise<number>;
1840
+ /**
1841
+ * Get chain ID
1842
+ */
1843
+ getChainId(): Promise<string>;
1844
+ /**
1845
+ * Send transaction (internal)
1846
+ */
1847
+ private sendTransaction;
1848
+ /**
1849
+ * Make RPC call
1850
+ */
1851
+ private rpcCall;
1852
+ /**
1853
+ * Get selector from function name
1854
+ */
1855
+ private getSelectorFromName;
1856
+ /**
1857
+ * Simplified Starknet Keccak (for selector calculation)
1858
+ */
1859
+ private starknetKeccak;
1860
+ /**
1861
+ * Require wallet to be configured
1862
+ */
1863
+ private requireWallet;
1864
+ /**
1865
+ * Sleep helper
1866
+ */
1867
+ private sleep;
1868
+ /**
1869
+ * Update configuration
1870
+ */
1871
+ updateConfig(config: Partial<ContractConfig>): void;
1872
+ /**
1873
+ * Get current configuration
1874
+ */
1875
+ getConfig(): ContractConfig;
1876
+ }
1877
+ /**
1878
+ * Helper to encode felt252 values
1879
+ */
1880
+ declare function toFelt(value: string | number | bigint): string;
1881
+ /**
1882
+ * Helper to decode felt252 values
1883
+ */
1884
+ declare function fromFelt(felt: string): bigint;
1885
+ /**
1886
+ * Split u256 into two felt252 (low, high)
1887
+ */
1888
+ declare function splitU256(value: bigint): [string, string];
1889
+ /**
1890
+ * Join two felt252 into u256
1891
+ */
1892
+ declare function joinU256(low: string, high: string): bigint;
1893
+
1894
+ /**
1895
+ * Contract Address Registry
1896
+ * Maintains deployed contract addresses for all networks
1897
+ */
1898
+ /** Contract registry interface */
1899
+ interface ContractRegistry {
1900
+ /** SAGE ERC20 token */
1901
+ sageToken: string;
1902
+ /** Prover staking contract */
1903
+ proverStaking: string;
1904
+ /** Mining rewards contract */
1905
+ miningRewards: string;
1906
+ /** Job manager contract */
1907
+ jobManager: string;
1908
+ /** CDC Pool (worker registry) */
1909
+ cdcPool: string;
1910
+ /** Reputation manager */
1911
+ reputationManager: string;
1912
+ /** Payment router */
1913
+ paymentRouter: string;
1914
+ /** Proof-gated payment */
1915
+ proofGatedPayment: string;
1916
+ /** STWO verifier */
1917
+ stwoVerifier: string;
1918
+ /** Privacy router (Obelysk) */
1919
+ privacyRouter: string;
1920
+ /** Optimistic TEE verifier */
1921
+ optimisticTee: string;
1922
+ /** Faucet (testnet only) */
1923
+ faucet?: string;
1924
+ }
1925
+ /** Sepolia testnet contract addresses */
1926
+ declare const SEPOLIA_CONTRACTS: ContractRegistry;
1927
+ /** Mainnet contract addresses (to be updated at launch) */
1928
+ declare const MAINNET_CONTRACTS: ContractRegistry;
1929
+ /** Local development contract addresses */
1930
+ declare const LOCAL_CONTRACTS: ContractRegistry;
1931
+ /** Network type */
1932
+ type Network = 'mainnet' | 'sepolia' | 'local';
1933
+ /**
1934
+ * Get contract addresses for a network
1935
+ */
1936
+ declare function getContractsForNetwork(network: Network): ContractRegistry;
1937
+ /**
1938
+ * Check if a contract address is configured (not zero)
1939
+ */
1940
+ declare function isContractConfigured(address: string): boolean;
1941
+ /**
1942
+ * External token addresses (not BitSage contracts)
1943
+ */
1944
+ interface ExternalTokens {
1945
+ /** USDC stablecoin */
1946
+ usdc: string;
1947
+ /** Starknet token (STRK) */
1948
+ strk: string;
1949
+ /** Wrapped Bitcoin */
1950
+ wbtc: string;
1951
+ /** Wrapped Ethereum */
1952
+ weth: string;
1953
+ }
1954
+ /** Sepolia external tokens */
1955
+ declare const SEPOLIA_TOKENS: ExternalTokens;
1956
+ /** Mainnet external tokens */
1957
+ declare const MAINNET_TOKENS: ExternalTokens;
1958
+ /**
1959
+ * Get external tokens for a network
1960
+ */
1961
+ declare function getTokensForNetwork(network: Network): ExternalTokens;
1962
+ /**
1963
+ * Pragma Oracle addresses
1964
+ */
1965
+ declare const PRAGMA_ORACLE: {
1966
+ readonly sepolia: "0x036031daa264c24520b11d93af622c848b2499b66b41d611bac95e13cfca131a";
1967
+ readonly mainnet: "0x2a85bd616f912537c50a49a4076db02c00b29b2cdc8a197ce92ed1837fa875b";
1968
+ };
1969
+
1970
+ /**
1971
+ * Mining Rewards Module
1972
+ * Interacts with the MiningRewards contract for per-job rewards
1973
+ */
1974
+
1975
+ interface MiningClientConfig {
1976
+ /** Mining rewards contract address */
1977
+ contractAddress: string;
1978
+ }
1979
+ /**
1980
+ * Mining Rewards Client
1981
+ *
1982
+ * Provides access to the mining rewards system including:
1983
+ * - Per-job reward estimation
1984
+ * - Worker mining statistics
1985
+ * - Mining pool status and halvening
1986
+ * - Daily caps by stake tier
1987
+ *
1988
+ * @example
1989
+ * ```typescript
1990
+ * const mining = new MiningClient(httpClient, contractClient, { contractAddress: '0x...' });
1991
+ *
1992
+ * // Estimate reward for a job
1993
+ * const estimate = await mining.getMiningRewardEstimate('Frontier');
1994
+ * console.log(`Expected reward: ${estimate.amount / 10n**18n} SAGE`);
1995
+ *
1996
+ * // Check worker stats
1997
+ * const stats = await mining.getWorkerMiningStats('worker-123');
1998
+ * console.log(`Total earned: ${stats.total_earned} SAGE`);
1999
+ * ```
2000
+ */
2001
+ declare class MiningClient {
2002
+ private http;
2003
+ private contract;
2004
+ private config;
2005
+ constructor(http: HttpClient, contract: ContractClient, config: MiningClientConfig);
2006
+ /**
2007
+ * Estimate mining reward for a job completion
2008
+ *
2009
+ * @param gpuTier - GPU tier of the worker
2010
+ * @param workerAddress - Optional worker address for accurate daily cap
2011
+ * @returns Estimated reward with cap status
2012
+ */
2013
+ getMiningRewardEstimate(gpuTier: MiningGpuTier, workerAddress?: string): Promise<RewardResult>;
2014
+ /**
2015
+ * Get worker's mining statistics
2016
+ *
2017
+ * @param workerId - Worker identifier
2018
+ * @returns Lifetime mining statistics
2019
+ */
2020
+ getWorkerMiningStats(workerId: string): Promise<WorkerMiningStats>;
2021
+ /**
2022
+ * Get mining pool status
2023
+ *
2024
+ * @returns Current pool status including distributed amount and halvening
2025
+ */
2026
+ getMiningPoolStatus(): Promise<MiningPoolStatus>;
2027
+ /**
2028
+ * Get daily cap for a stake tier
2029
+ *
2030
+ * @param stakeTier - Stake tier
2031
+ * @returns Daily cap in wei
2032
+ */
2033
+ getDailyCap(stakeTier: StakeTier): Promise<bigint>;
2034
+ /**
2035
+ * Get current base reward (with halvening applied)
2036
+ *
2037
+ * @returns Base reward per job in wei
2038
+ */
2039
+ getCurrentBaseReward(): Promise<bigint>;
2040
+ /**
2041
+ * Get GPU multiplier for a tier
2042
+ *
2043
+ * @param gpuTier - GPU tier
2044
+ * @returns Multiplier in basis points (10000 = 1.0x)
2045
+ */
2046
+ getGPUMultiplier(gpuTier: MiningGpuTier): number;
2047
+ /**
2048
+ * Get remaining daily cap for a worker
2049
+ *
2050
+ * @param workerAddress - Worker address
2051
+ * @returns Remaining cap in wei
2052
+ */
2053
+ getRemainingDailyCap(workerAddress: string): Promise<bigint>;
2054
+ /**
2055
+ * Get mining configuration
2056
+ *
2057
+ * @returns Full mining configuration
2058
+ */
2059
+ getMiningConfig(): Promise<MiningConfig>;
2060
+ /**
2061
+ * Get worker's daily statistics for a specific day
2062
+ *
2063
+ * @param workerId - Worker identifier
2064
+ * @param day - Day number (optional, defaults to today)
2065
+ * @returns Daily statistics
2066
+ */
2067
+ getWorkerDailyStats(workerId: string, day?: number): Promise<DailyStats>;
2068
+ /**
2069
+ * Get total distributed from mining pool
2070
+ *
2071
+ * @returns Total distributed in wei
2072
+ */
2073
+ getTotalDistributed(): Promise<bigint>;
2074
+ /**
2075
+ * Get remaining in mining pool
2076
+ *
2077
+ * @returns Remaining pool in wei
2078
+ */
2079
+ getRemainingPool(): Promise<bigint>;
2080
+ /**
2081
+ * Get current halvening year and multiplier
2082
+ *
2083
+ * @returns Halvening info
2084
+ */
2085
+ getHalveningInfo(): Promise<{
2086
+ year: number;
2087
+ multiplier: number;
2088
+ }>;
2089
+ /**
2090
+ * Calculate expected reward locally (without API call)
2091
+ *
2092
+ * @param gpuTier - GPU tier
2093
+ * @param stakeTier - Stake tier
2094
+ * @param baseReward - Base reward (optional, uses Year 1 default)
2095
+ * @param halveningYear - Halvening year (optional, defaults to 1)
2096
+ * @returns Calculated reward
2097
+ */
2098
+ calculateRewardLocally(gpuTier: MiningGpuTier, stakeTier: StakeTier, baseReward?: bigint, // 2 SAGE default
2099
+ halveningYear?: number): bigint;
2100
+ /**
2101
+ * Record job completion and distribute mining reward
2102
+ * Note: This is typically called by the coordinator, not directly by workers
2103
+ *
2104
+ * @param jobId - Completed job ID
2105
+ * @param gpuTier - Worker's GPU tier
2106
+ * @returns Transaction result
2107
+ */
2108
+ recordJobCompletion(jobId: string, gpuTier: MiningGpuTier): Promise<TransactionResult$6>;
2109
+ /**
2110
+ * Get worker stats directly from contract
2111
+ *
2112
+ * @param workerAddress - Worker address
2113
+ * @returns Worker mining stats
2114
+ */
2115
+ getWorkerMiningStatsFromContract(workerAddress: string): Promise<WorkerMiningStats>;
2116
+ /**
2117
+ * Get remaining cap from contract
2118
+ *
2119
+ * @param workerAddress - Worker address
2120
+ * @returns Remaining cap in wei
2121
+ */
2122
+ getRemainingCapFromContract(workerAddress: string): Promise<bigint>;
2123
+ /**
2124
+ * Get stake tier from contract
2125
+ *
2126
+ * @param workerAddress - Worker address
2127
+ * @returns Stake tier
2128
+ */
2129
+ getStakeTierFromContract(workerAddress: string): Promise<StakeTier>;
2130
+ /**
2131
+ * Convert GPU tier to contract enum value
2132
+ */
2133
+ private gpuTierToContractValue;
2134
+ /**
2135
+ * Convert contract value to stake tier
2136
+ */
2137
+ private contractValueToStakeTier;
2138
+ /**
2139
+ * Parse worker stats response from contract
2140
+ */
2141
+ private parseWorkerStatsResponse;
2142
+ }
2143
+ /**
2144
+ * Create a MiningClient instance
2145
+ */
2146
+ declare function createMiningClient(http: HttpClient, contract: ContractClient, contractAddress: string): MiningClient;
2147
+
2148
+ /**
2149
+ * Dashboard API Module
2150
+ * Provides validator metrics, GPU stats, and network information
2151
+ */
2152
+
2153
+ /** Validator registration status */
2154
+ type ValidatorStatus = 'unregistered' | 'pending' | 'active' | 'suspended' | 'exiting';
2155
+ /** Validator status response */
2156
+ interface ValidatorStatusResponse {
2157
+ /** Wallet address */
2158
+ address: string;
2159
+ /** Worker ID (if registered) */
2160
+ worker_id?: string;
2161
+ /** Registration status */
2162
+ status: ValidatorStatus;
2163
+ /** GPU tier */
2164
+ gpu_tier?: GpuTier;
2165
+ /** Stake tier */
2166
+ stake_tier?: StakeTier;
2167
+ /** Reputation score (0-1000) */
2168
+ reputation_score: number;
2169
+ /** Uptime percentage (basis points) */
2170
+ uptime_bps: number;
2171
+ /** Total jobs completed */
2172
+ jobs_completed: number;
2173
+ /** Jobs in progress */
2174
+ jobs_in_progress: number;
2175
+ /** Registration timestamp */
2176
+ registered_at?: number;
2177
+ /** Last activity timestamp */
2178
+ last_activity_at?: number;
2179
+ }
2180
+ /** Individual GPU metrics */
2181
+ interface GpuMetrics {
2182
+ /** GPU index */
2183
+ index: number;
2184
+ /** GPU model name */
2185
+ model: string;
2186
+ /** GPU tier classification */
2187
+ tier: GpuTier;
2188
+ /** Total VRAM in GB */
2189
+ vram_total_gb: number;
2190
+ /** Used VRAM in GB */
2191
+ vram_used_gb: number;
2192
+ /** VRAM utilization percentage */
2193
+ vram_utilization: number;
2194
+ /** GPU compute utilization percentage */
2195
+ compute_utilization: number;
2196
+ /** Temperature in Celsius */
2197
+ temperature_celsius: number;
2198
+ /** Power usage in watts */
2199
+ power_watts: number;
2200
+ /** Current job ID (if busy) */
2201
+ current_job_id?: string;
2202
+ /** Driver version */
2203
+ driver_version: string;
2204
+ /** CUDA version */
2205
+ cuda_version?: string;
2206
+ /** Whether has TEE support */
2207
+ has_tee: boolean;
2208
+ /** TEE type if available */
2209
+ tee_type?: 'IntelTDX' | 'AMDSEVSNP' | 'NvidiaCC';
2210
+ }
2211
+ /** GPU metrics response */
2212
+ interface GpuMetricsResponse {
2213
+ /** Array of GPU metrics */
2214
+ gpus: GpuMetrics[];
2215
+ /** Total GPUs */
2216
+ total_gpus: number;
2217
+ /** Active GPUs (currently processing) */
2218
+ active_gpus: number;
2219
+ /** Average utilization */
2220
+ avg_utilization: number;
2221
+ /** Total compute power (TFLOPs) */
2222
+ total_tflops: number;
2223
+ }
2224
+ /** Rewards information */
2225
+ interface RewardsInfo {
2226
+ /** Claimable rewards (wei) */
2227
+ claimable_rewards: bigint;
2228
+ /** Pending rewards (not yet claimable) */
2229
+ pending_rewards: bigint;
2230
+ /** Total rewards earned (lifetime) */
2231
+ total_earned: bigint;
2232
+ /** Total rewards claimed (lifetime) */
2233
+ total_claimed: bigint;
2234
+ /** Estimated APY (basis points) */
2235
+ estimated_apy_bps: number;
2236
+ /** Last claim timestamp */
2237
+ last_claim_at?: number;
2238
+ /** Mining rewards (from jobs) */
2239
+ mining_rewards: bigint;
2240
+ /** Staking rewards */
2241
+ staking_rewards: bigint;
2242
+ }
2243
+ /** Period filter for history */
2244
+ type HistoryPeriod = 'day' | 'week' | 'month' | 'year' | 'all';
2245
+ /** Reward history entry */
2246
+ interface RewardHistoryEntry {
2247
+ /** Timestamp */
2248
+ timestamp: number;
2249
+ /** Amount earned (wei) */
2250
+ amount: bigint;
2251
+ /** Reward type */
2252
+ type: 'mining' | 'staking' | 'bonus';
2253
+ /** Related job ID (for mining rewards) */
2254
+ job_id?: string;
2255
+ /** Transaction hash (for claimed rewards) */
2256
+ tx_hash?: string;
2257
+ }
2258
+ /** Reward history response */
2259
+ interface RewardHistoryResponse {
2260
+ /** History entries */
2261
+ entries: RewardHistoryEntry[];
2262
+ /** Total for period (wei) */
2263
+ total: bigint;
2264
+ /** Period */
2265
+ period: HistoryPeriod;
2266
+ /** Period start */
2267
+ period_start: number;
2268
+ /** Period end */
2269
+ period_end: number;
2270
+ }
2271
+ /** Job analytics */
2272
+ interface JobAnalytics {
2273
+ /** Total jobs received */
2274
+ total_jobs: number;
2275
+ /** Completed jobs */
2276
+ completed_jobs: number;
2277
+ /** Failed jobs */
2278
+ failed_jobs: number;
2279
+ /** Success rate (basis points) */
2280
+ success_rate_bps: number;
2281
+ /** Average completion time (ms) */
2282
+ avg_completion_time_ms: number;
2283
+ /** Jobs by type */
2284
+ jobs_by_type: Record<string, number>;
2285
+ /** Average reward per job (wei) */
2286
+ avg_reward_per_job: bigint;
2287
+ /** Total compute hours */
2288
+ total_compute_hours: number;
2289
+ }
2290
+ /** Recent job */
2291
+ interface RecentJob {
2292
+ /** Job ID */
2293
+ job_id: string;
2294
+ /** Job type */
2295
+ job_type: string;
2296
+ /** Status */
2297
+ status: string;
2298
+ /** Reward earned (wei) */
2299
+ reward: bigint;
2300
+ /** Duration (ms) */
2301
+ duration_ms: number;
2302
+ /** Completed at */
2303
+ completed_at: number;
2304
+ /** Proof hash */
2305
+ proof_hash?: string;
2306
+ }
2307
+ /** Network statistics */
2308
+ interface NetworkStats {
2309
+ /** Total registered workers */
2310
+ total_workers: number;
2311
+ /** Currently active workers */
2312
+ active_workers: number;
2313
+ /** Workers by GPU tier */
2314
+ workers_by_tier: Record<GpuTier, number>;
2315
+ /** Total jobs completed (all time) */
2316
+ total_jobs_completed: bigint;
2317
+ /** Jobs in progress */
2318
+ jobs_in_progress: number;
2319
+ /** Network TPS (jobs per second) */
2320
+ current_tps: number;
2321
+ /** Total compute hours (all time) */
2322
+ total_compute_hours: number;
2323
+ /** Network utilization (basis points) */
2324
+ utilization_bps: number;
2325
+ /** Total SAGE staked (wei) */
2326
+ total_staked: bigint;
2327
+ /** Average APY (basis points) */
2328
+ avg_apy_bps: number;
2329
+ }
2330
+ /** Worker summary for network view */
2331
+ interface WorkerSummary {
2332
+ /** Worker ID */
2333
+ worker_id: string;
2334
+ /** GPU tier */
2335
+ gpu_tier: GpuTier;
2336
+ /** Reputation score */
2337
+ reputation: number;
2338
+ /** Jobs completed (last 24h) */
2339
+ jobs_24h: number;
2340
+ /** Is currently active */
2341
+ is_active: boolean;
2342
+ /** Location hash (privacy-preserving) */
2343
+ location_hash?: string;
2344
+ }
2345
+ /** Network workers response */
2346
+ interface NetworkWorkersResponse {
2347
+ /** Worker summaries */
2348
+ workers: WorkerSummary[];
2349
+ /** Total count */
2350
+ total: number;
2351
+ /** Page */
2352
+ page: number;
2353
+ /** Page size */
2354
+ page_size: number;
2355
+ /** Has more pages */
2356
+ has_more: boolean;
2357
+ }
2358
+ /**
2359
+ * Dashboard API Client
2360
+ *
2361
+ * Provides comprehensive dashboard data for validators including:
2362
+ * - Validator status and registration
2363
+ * - GPU metrics and utilization
2364
+ * - Rewards tracking and history
2365
+ * - Job analytics
2366
+ * - Network statistics
2367
+ *
2368
+ * @example
2369
+ * ```typescript
2370
+ * const dashboard = new DashboardClient(httpClient);
2371
+ *
2372
+ * // Get validator status
2373
+ * const status = await dashboard.getValidatorStatus();
2374
+ * console.log(`Status: ${status.status}, Reputation: ${status.reputation_score}`);
2375
+ *
2376
+ * // Get GPU metrics
2377
+ * const gpus = await dashboard.getGPUMetrics();
2378
+ * gpus.gpus.forEach(gpu => {
2379
+ * console.log(`${gpu.model}: ${gpu.compute_utilization}% utilization`);
2380
+ * });
2381
+ * ```
2382
+ */
2383
+ declare class DashboardClient {
2384
+ private http;
2385
+ constructor(http: HttpClient);
2386
+ /**
2387
+ * Get current validator status
2388
+ *
2389
+ * @returns Validator status and metrics
2390
+ */
2391
+ getValidatorStatus(): Promise<ValidatorStatusResponse>;
2392
+ /**
2393
+ * Get GPU metrics for all GPUs
2394
+ *
2395
+ * @returns GPU metrics array
2396
+ */
2397
+ getGPUMetrics(): Promise<GpuMetricsResponse>;
2398
+ /**
2399
+ * Get rewards information
2400
+ *
2401
+ * @returns Claimable and pending rewards
2402
+ */
2403
+ getRewardsInfo(): Promise<RewardsInfo>;
2404
+ /**
2405
+ * Get rewards history
2406
+ *
2407
+ * @param period - Time period filter
2408
+ * @returns Reward history entries
2409
+ */
2410
+ getRewardsHistory(period?: HistoryPeriod): Promise<RewardHistoryResponse>;
2411
+ /**
2412
+ * Get job analytics
2413
+ *
2414
+ * @returns Job completion statistics
2415
+ */
2416
+ getJobAnalytics(): Promise<JobAnalytics>;
2417
+ /**
2418
+ * Get recent completed jobs
2419
+ *
2420
+ * @param limit - Maximum number of jobs to return
2421
+ * @returns Recent job list
2422
+ */
2423
+ getRecentJobs(limit?: number): Promise<RecentJob[]>;
2424
+ /**
2425
+ * Get network-wide statistics
2426
+ *
2427
+ * @returns Network statistics
2428
+ */
2429
+ getNetworkStats(): Promise<NetworkStats>;
2430
+ /**
2431
+ * Get list of network workers
2432
+ *
2433
+ * @param page - Page number (1-indexed)
2434
+ * @param pageSize - Items per page
2435
+ * @returns Paginated worker list
2436
+ */
2437
+ getNetworkWorkers(page?: number, pageSize?: number): Promise<NetworkWorkersResponse>;
2438
+ /**
2439
+ * Get deployed contract addresses
2440
+ *
2441
+ * @returns Contract registry
2442
+ */
2443
+ getContractAddresses(): Promise<ContractRegistry>;
2444
+ /**
2445
+ * Check API health
2446
+ *
2447
+ * @returns Health status
2448
+ */
2449
+ healthCheck(): Promise<{
2450
+ status: 'healthy' | 'degraded' | 'unhealthy';
2451
+ latency_ms: number;
2452
+ }>;
2453
+ }
2454
+ /**
2455
+ * Create a DashboardClient instance
2456
+ */
2457
+ declare function createDashboardClient(http: HttpClient): DashboardClient;
2458
+
2459
+ /**
2460
+ * Batch Operations Module
2461
+ * Provides gas-optimized batch operations for jobs and proofs
2462
+ */
2463
+
2464
+ /** Maximum jobs per batch */
2465
+ declare const MAX_BATCH_SIZE = 100;
2466
+ /** Batch job submission response */
2467
+ interface BatchJobResponse {
2468
+ /** Successfully submitted jobs */
2469
+ submitted: SubmitJobResponse[];
2470
+ /** Failed submissions with errors */
2471
+ failed: Array<{
2472
+ index: number;
2473
+ request: SubmitJobRequest;
2474
+ error: string;
2475
+ }>;
2476
+ /** Total submitted count */
2477
+ submitted_count: number;
2478
+ /** Total failed count */
2479
+ failed_count: number;
2480
+ /** Estimated total gas saved (vs individual) */
2481
+ gas_saved_estimate: bigint;
2482
+ }
2483
+ /** Batch status response */
2484
+ interface BatchStatusResponse {
2485
+ /** Job statuses by ID */
2486
+ statuses: Map<string, JobStatusResponse>;
2487
+ /** Jobs not found */
2488
+ not_found: string[];
2489
+ }
2490
+ /** Batch operation type for gas estimation */
2491
+ type BatchOperationType = 'submit_job' | 'cancel_job' | 'verify_proof' | 'claim_rewards';
2492
+ /** Batch operation for gas estimation */
2493
+ interface BatchOperation {
2494
+ type: BatchOperationType;
2495
+ /** Number of operations */
2496
+ count: number;
2497
+ /** Estimated calldata size per operation */
2498
+ calldata_size?: number;
2499
+ }
2500
+ /** Gas estimate result */
2501
+ interface GasEstimate {
2502
+ /** Total estimated gas */
2503
+ total_gas: bigint;
2504
+ /** Gas per operation */
2505
+ gas_per_operation: bigint;
2506
+ /** Estimated gas savings vs individual calls */
2507
+ savings_bps: number;
2508
+ /** Estimated cost in SAGE (wei) */
2509
+ estimated_cost_sage: bigint;
2510
+ }
2511
+ /** Batch proof verification request */
2512
+ interface BatchVerifyRequest {
2513
+ /** Proof hashes to verify */
2514
+ proof_hashes: string[];
2515
+ }
2516
+ /** Batch proof verification response */
2517
+ interface BatchVerifyResponse {
2518
+ /** Verification results by proof hash */
2519
+ results: Map<string, boolean>;
2520
+ /** Total verified */
2521
+ verified_count: number;
2522
+ /** Total failed */
2523
+ failed_count: number;
2524
+ /** Gas used */
2525
+ gas_used: bigint;
2526
+ }
2527
+ /**
2528
+ * Batch Operations Client
2529
+ *
2530
+ * Provides gas-optimized batch operations for:
2531
+ * - Submitting multiple jobs at once
2532
+ * - Checking status of multiple jobs
2533
+ * - Verifying multiple proofs
2534
+ *
2535
+ * Batch operations can save up to 60% on gas costs compared to
2536
+ * individual transactions.
2537
+ *
2538
+ * @example
2539
+ * ```typescript
2540
+ * const batch = new BatchClient(httpClient);
2541
+ *
2542
+ * // Submit multiple jobs
2543
+ * const jobs: SubmitJobRequest[] = [...];
2544
+ * const result = await batch.submitJobBatch(jobs);
2545
+ * console.log(`Submitted ${result.submitted_count} jobs, saved ~${result.gas_saved_estimate} gas`);
2546
+ *
2547
+ * // Check multiple job statuses
2548
+ * const jobIds = result.submitted.map(j => j.job_id);
2549
+ * const statuses = await batch.getJobStatusBatch(jobIds);
2550
+ * ```
2551
+ */
2552
+ declare class BatchClient {
2553
+ private http;
2554
+ constructor(http: HttpClient);
2555
+ /**
2556
+ * Submit multiple jobs in a single batch
2557
+ *
2558
+ * @param jobs - Array of job requests (max 100)
2559
+ * @returns Batch submission result
2560
+ * @throws Error if batch size exceeds maximum
2561
+ */
2562
+ submitJobBatch(jobs: SubmitJobRequest[]): Promise<BatchJobResponse>;
2563
+ /**
2564
+ * Get status of multiple jobs
2565
+ *
2566
+ * @param jobIds - Array of job IDs
2567
+ * @returns Map of job ID to status
2568
+ */
2569
+ getJobStatusBatch(jobIds: string[]): Promise<BatchStatusResponse>;
2570
+ /**
2571
+ * Verify multiple proofs in batch
2572
+ *
2573
+ * @param proofHashes - Array of proof hashes
2574
+ * @returns Verification results
2575
+ */
2576
+ verifyProofBatch(proofHashes: string[]): Promise<BatchVerifyResponse>;
2577
+ /**
2578
+ * Estimate gas for batch operations
2579
+ *
2580
+ * @param operations - Operations to estimate
2581
+ * @returns Gas estimate
2582
+ */
2583
+ estimateBatchGas(operations: BatchOperation[]): Promise<GasEstimate>;
2584
+ /**
2585
+ * Cancel multiple jobs in batch
2586
+ *
2587
+ * @param jobIds - Array of job IDs to cancel
2588
+ * @returns Cancellation results
2589
+ */
2590
+ cancelJobBatch(jobIds: string[]): Promise<{
2591
+ cancelled: string[];
2592
+ failed: Array<{
2593
+ job_id: string;
2594
+ error: string;
2595
+ }>;
2596
+ }>;
2597
+ /**
2598
+ * Split large array into batches
2599
+ *
2600
+ * @param items - Items to split
2601
+ * @param batchSize - Size of each batch (default: MAX_BATCH_SIZE)
2602
+ * @returns Array of batches
2603
+ */
2604
+ static splitIntoBatches<T>(items: T[], batchSize?: number): T[][];
2605
+ /**
2606
+ * Process items in batches with parallel execution
2607
+ *
2608
+ * @param items - Items to process
2609
+ * @param processor - Batch processor function
2610
+ * @param options - Processing options
2611
+ * @returns Combined results
2612
+ */
2613
+ static processBatches<T, R>(items: T[], processor: (batch: T[]) => Promise<R[]>, options?: {
2614
+ batchSize?: number;
2615
+ concurrency?: number;
2616
+ }): Promise<R[]>;
2617
+ }
2618
+ /**
2619
+ * Create a BatchClient instance
2620
+ */
2621
+ declare function createBatchClient(http: HttpClient): BatchClient;
2622
+
2623
+ /**
2624
+ * Payments Module
2625
+ * Multi-token payment system with OTC desk and privacy credits
2626
+ */
2627
+
2628
+ interface PaymentsClientConfig {
2629
+ /** Payment router contract address */
2630
+ paymentRouterAddress: string;
2631
+ /** Proof-gated payment contract address */
2632
+ proofGatedPaymentAddress: string;
2633
+ }
2634
+ /**
2635
+ * Payments Client
2636
+ *
2637
+ * Handles all payment operations including:
2638
+ * - Multi-token payment quotes (USDC, STRK, WBTC, SAGE)
2639
+ * - Direct SAGE payments with discounts
2640
+ * - Staked SAGE payments (10% discount)
2641
+ * - Privacy credits for anonymous payments
2642
+ * - Metered billing with hourly checkpoints
2643
+ *
2644
+ * @example
2645
+ * ```typescript
2646
+ * const payments = new PaymentsClient(httpClient, contractClient, config);
2647
+ *
2648
+ * // Get a payment quote
2649
+ * const quote = await payments.getPaymentQuote('SAGE', 100n * 10n**6n); // $100 worth
2650
+ * console.log(`Pay ${quote.payment_amount} SAGE (${quote.discount_bps/100}% discount)`);
2651
+ *
2652
+ * // Execute the payment
2653
+ * const result = await payments.executePayment(quote.quote_id, jobId);
2654
+ * ```
2655
+ */
2656
+ declare class PaymentsClient {
2657
+ private http;
2658
+ private contract;
2659
+ private config;
2660
+ constructor(http: HttpClient, contract: ContractClient, config: PaymentsClientConfig);
2661
+ /**
2662
+ * Get a payment quote for a USD amount
2663
+ *
2664
+ * @param token - Payment token to use
2665
+ * @param usdAmount - Amount in USD (6 decimals, e.g., 100_000_000 = $100)
2666
+ * @returns Payment quote with conversion rate and discount
2667
+ */
2668
+ getPaymentQuote(token: PaymentToken, usdAmount: bigint): Promise<PaymentQuote>;
2669
+ /**
2670
+ * Execute a quoted payment
2671
+ *
2672
+ * @param quoteId - Quote ID from getPaymentQuote
2673
+ * @param jobId - Job being paid for
2674
+ * @returns Transaction result
2675
+ */
2676
+ executePayment(quoteId: bigint, jobId: bigint): Promise<TransactionResult$6>;
2677
+ /**
2678
+ * Pay directly with SAGE tokens (5% discount)
2679
+ *
2680
+ * @param amount - SAGE amount (wei)
2681
+ * @param jobId - Job being paid for
2682
+ * @returns Transaction result
2683
+ */
2684
+ payWithSAGE(amount: bigint, jobId: bigint): Promise<TransactionResult$6>;
2685
+ /**
2686
+ * Pay with staked SAGE (10% discount)
2687
+ *
2688
+ * @param usdAmount - USD amount (6 decimals)
2689
+ * @param jobId - Job being paid for
2690
+ * @returns Transaction result
2691
+ */
2692
+ payWithStakedSAGE(usdAmount: bigint, jobId: bigint): Promise<TransactionResult$6>;
2693
+ /**
2694
+ * Deposit tokens as privacy credits
2695
+ *
2696
+ * @param amount - Amount to deposit (wei)
2697
+ * @param commitment - Privacy commitment hash
2698
+ * @returns Transaction result
2699
+ */
2700
+ depositPrivacyCredits(amount: bigint, commitment: string): Promise<TransactionResult$6>;
2701
+ /**
2702
+ * Pay anonymously using privacy credits (2% discount)
2703
+ *
2704
+ * @param usdAmount - USD amount (6 decimals)
2705
+ * @param nullifier - Nullifier to prevent double-spending
2706
+ * @param proof - ZK proof of valid credit
2707
+ * @returns Transaction result
2708
+ */
2709
+ payWithPrivacyCredits(usdAmount: bigint, nullifier: string, proof: string[]): Promise<TransactionResult$6>;
2710
+ /**
2711
+ * Get current discount tiers
2712
+ *
2713
+ * @returns Discount configuration
2714
+ */
2715
+ getDiscountTiers(): Promise<DiscountTiers>;
2716
+ /**
2717
+ * Get fee distribution configuration
2718
+ *
2719
+ * @returns Fee distribution (worker/burn/treasury/stakers split)
2720
+ */
2721
+ getFeeDistribution(): Promise<FeeDistribution>;
2722
+ /**
2723
+ * Get payment statistics
2724
+ *
2725
+ * @returns Payment volume statistics
2726
+ */
2727
+ getStats(): Promise<PaymentStats>;
2728
+ /**
2729
+ * Check if payment is ready for release
2730
+ *
2731
+ * @param jobId - Job ID
2732
+ * @returns Whether proof has been verified and payment can be released
2733
+ */
2734
+ isPaymentReady(jobId: bigint): Promise<boolean>;
2735
+ /**
2736
+ * Get job payment record
2737
+ *
2738
+ * @param jobId - Job ID
2739
+ * @returns Payment record details
2740
+ */
2741
+ getJobPayment(jobId: bigint): Promise<JobPaymentRecord>;
2742
+ /**
2743
+ * Manually release payment (if proof verified)
2744
+ *
2745
+ * @param jobId - Job ID
2746
+ * @returns Transaction result
2747
+ */
2748
+ releasePayment(jobId: bigint): Promise<TransactionResult$6>;
2749
+ /**
2750
+ * Submit hourly compute checkpoint
2751
+ *
2752
+ * @param jobId - Job ID
2753
+ * @param hour - Hour number (1-indexed)
2754
+ * @param proofData - Proof of computation
2755
+ * @param proofHash - Hash of the proof
2756
+ * @returns Transaction result
2757
+ */
2758
+ submitCheckpoint(jobId: bigint, hour: number, proofData: string[], proofHash: string): Promise<TransactionResult$6>;
2759
+ /**
2760
+ * Verify and pay for a checkpoint
2761
+ *
2762
+ * @param checkpointId - Checkpoint ID
2763
+ * @returns Transaction result
2764
+ */
2765
+ verifyAndPayCheckpoint(checkpointId: bigint): Promise<TransactionResult$6>;
2766
+ /**
2767
+ * Get checkpoints for a job
2768
+ *
2769
+ * @param jobId - Job ID
2770
+ * @returns Array of checkpoint records
2771
+ */
2772
+ getJobCheckpoints(jobId: bigint): Promise<ComputeCheckpoint[]>;
2773
+ /**
2774
+ * Calculate discount amount
2775
+ *
2776
+ * @param baseAmount - Base amount (wei)
2777
+ * @param discountBps - Discount in basis points
2778
+ * @returns Discounted amount
2779
+ */
2780
+ static calculateDiscount(baseAmount: bigint, discountBps: number): bigint;
2781
+ /**
2782
+ * Get discount for payment token
2783
+ *
2784
+ * @param token - Payment token
2785
+ * @param tiers - Discount tiers (or uses defaults)
2786
+ * @returns Discount in basis points
2787
+ */
2788
+ static getDiscountForToken(token: PaymentToken, tiers?: DiscountTiers): number;
2789
+ }
2790
+ /**
2791
+ * Create a PaymentsClient instance
2792
+ */
2793
+ declare function createPaymentsClient(http: HttpClient, contract: ContractClient, paymentRouterAddress: string, proofGatedPaymentAddress: string): PaymentsClient;
2794
+
2795
+ /**
2796
+ * Enhanced Staking Module
2797
+ * Full staking system with TEE support, slashing, and worker tiers
2798
+ */
2799
+
2800
+ interface StakingClientConfig {
2801
+ /** Prover staking contract address */
2802
+ proverStakingAddress: string;
2803
+ /** CDC Pool contract address */
2804
+ cdcPoolAddress: string;
2805
+ }
2806
+ /** Transaction result */
2807
+ interface TransactionResult$5 {
2808
+ transaction_hash: string;
2809
+ status: 'pending' | 'accepted' | 'rejected';
2810
+ receipt?: TransactionReceipt;
2811
+ }
2812
+ /** TEE type for enhanced staking */
2813
+ type TeeType = 'IntelTDX' | 'AMDSEVSNP' | 'NvidiaCC';
2814
+ /**
2815
+ * Enhanced Staking Client
2816
+ *
2817
+ * Full staking system including:
2818
+ * - Basic staking operations (stake, unstake, claim)
2819
+ * - TEE-enhanced staking with bonus rewards
2820
+ * - 8-level worker tier system
2821
+ * - Slashing and dispute mechanisms
2822
+ * - Delegation support
2823
+ *
2824
+ * @example
2825
+ * ```typescript
2826
+ * const staking = new StakingClient(httpClient, contractClient, config);
2827
+ *
2828
+ * // Stake with TEE support
2829
+ * await staking.stakeWithTEE(5000n * 10n**18n, 'DataCenter', true, 'NvidiaCC');
2830
+ *
2831
+ * // Check worker tier and benefits
2832
+ * const tier = await staking.getWorkerTier(workerAddress);
2833
+ * const benefits = await staking.getWorkerTierBenefits(tier);
2834
+ * console.log(`Tier: ${tier}, Job multiplier: ${benefits.job_multiplier_bps/100}%`);
2835
+ *
2836
+ * // Claim rewards
2837
+ * await staking.claimRewards();
2838
+ * ```
2839
+ */
2840
+ declare class StakingClient {
2841
+ private http;
2842
+ private contract;
2843
+ private config;
2844
+ constructor(http: HttpClient, contract: ContractClient, config: StakingClientConfig);
2845
+ /**
2846
+ * Stake SAGE tokens
2847
+ *
2848
+ * @param amount - Amount to stake (wei)
2849
+ * @param gpuTier - GPU tier classification
2850
+ * @returns Transaction result
2851
+ */
2852
+ stake(amount: bigint, gpuTier: GpuTier): Promise<TransactionResult$5>;
2853
+ /**
2854
+ * Stake with TEE support for bonus rewards
2855
+ *
2856
+ * @param amount - Amount to stake (wei)
2857
+ * @param gpuTier - GPU tier classification
2858
+ * @param hasTEE - Whether worker has TEE support
2859
+ * @param teeType - Type of TEE if hasTEE is true
2860
+ * @returns Transaction result
2861
+ */
2862
+ stakeWithTEE(amount: bigint, gpuTier: GpuTier, hasTEE: boolean, teeType?: TeeType): Promise<TransactionResult$5>;
2863
+ /**
2864
+ * Request to unstake tokens (enters lockup period)
2865
+ *
2866
+ * @param amount - Amount to unstake (wei)
2867
+ * @returns Transaction result with unstake request ID
2868
+ */
2869
+ requestUnstake(amount: bigint): Promise<TransactionResult$5>;
2870
+ /**
2871
+ * Complete unstake after lockup period
2872
+ *
2873
+ * @param requestId - Unstake request ID
2874
+ * @returns Transaction result
2875
+ */
2876
+ completeUnstake(requestId: bigint): Promise<TransactionResult$5>;
2877
+ /**
2878
+ * Cancel pending unstake request
2879
+ *
2880
+ * @param requestId - Unstake request ID
2881
+ * @returns Transaction result
2882
+ */
2883
+ cancelUnstake(requestId: bigint): Promise<TransactionResult$5>;
2884
+ /**
2885
+ * Claim pending staking rewards
2886
+ *
2887
+ * @returns Transaction result
2888
+ */
2889
+ claimRewards(): Promise<TransactionResult$5>;
2890
+ /**
2891
+ * Get stake info for an address
2892
+ *
2893
+ * @param address - Worker address
2894
+ * @returns Complete stake information
2895
+ */
2896
+ getStakeInfo(address: string): Promise<StakeInfo>;
2897
+ /**
2898
+ * Get minimum stake for GPU tier with optional TEE
2899
+ *
2900
+ * @param gpuTier - GPU tier
2901
+ * @param hasTEE - Whether has TEE support
2902
+ * @param reputationScore - Optional reputation score (0-100)
2903
+ * @returns Minimum stake amount (wei)
2904
+ */
2905
+ getMinStake(gpuTier: GpuTier, hasTEE?: boolean, reputationScore?: number): bigint;
2906
+ /**
2907
+ * Get minimum stake for tier with TEE (private helper)
2908
+ */
2909
+ private getMinStakeForTierWithTEE;
2910
+ /**
2911
+ * Get worker's current tier
2912
+ *
2913
+ * @param workerAddress - Worker address
2914
+ * @returns Worker tier
2915
+ */
2916
+ getWorkerTier(workerAddress: string): Promise<WorkerTier>;
2917
+ /**
2918
+ * Get benefits for a worker tier
2919
+ *
2920
+ * @param tier - Worker tier
2921
+ * @returns Tier benefits
2922
+ */
2923
+ getWorkerTierBenefits(tier: WorkerTier): Promise<WorkerTierBenefits>;
2924
+ /**
2925
+ * Get pending unstake requests for an address
2926
+ *
2927
+ * @param address - Worker address
2928
+ * @returns Array of unstake requests
2929
+ */
2930
+ getUnstakeRequests(address: string): Promise<UnstakeRequest[]>;
2931
+ /**
2932
+ * Slash a worker (governance/protocol only)
2933
+ *
2934
+ * @param worker - Worker address to slash
2935
+ * @param percentage - Slash percentage (basis points)
2936
+ * @param reason - Slash reason
2937
+ * @param jobId - Related job ID if applicable
2938
+ * @param evidenceHash - Hash of evidence
2939
+ * @returns Transaction result
2940
+ */
2941
+ slash(worker: string, percentage: number, reason: SlashReason, jobId?: bigint, evidenceHash?: bigint): Promise<TransactionResult$5>;
2942
+ /**
2943
+ * Challenge a slash (stake bond to dispute)
2944
+ *
2945
+ * @param slashId - Slash ID to challenge
2946
+ * @param evidence - Evidence supporting the challenge
2947
+ * @returns Transaction result with dispute ID
2948
+ */
2949
+ challengeSlash(slashId: bigint, evidence: string[]): Promise<TransactionResult$5>;
2950
+ /**
2951
+ * Resolve a slash challenge (governance only)
2952
+ *
2953
+ * @param disputeId - Dispute ID
2954
+ * @param upheld - Whether the original slash is upheld
2955
+ * @param reason - Resolution reason
2956
+ * @returns Transaction result
2957
+ */
2958
+ resolveSlashChallenge(disputeId: bigint, upheld: boolean, reason: string): Promise<TransactionResult$5>;
2959
+ /**
2960
+ * Get slash record
2961
+ *
2962
+ * @param slashId - Slash ID
2963
+ * @returns Slash record details
2964
+ */
2965
+ getSlashRecord(slashId: bigint): Promise<SlashRecord>;
2966
+ /**
2967
+ * Get dispute record
2968
+ *
2969
+ * @param disputeId - Dispute ID
2970
+ * @returns Dispute record details
2971
+ */
2972
+ getDisputeRecord(disputeId: bigint): Promise<DisputeRecord>;
2973
+ /**
2974
+ * Get staking configuration
2975
+ *
2976
+ * @returns Staking config
2977
+ */
2978
+ getStakingConfig(): Promise<StakingConfig>;
2979
+ /**
2980
+ * Get total staked amount
2981
+ *
2982
+ * @returns Total staked (wei)
2983
+ */
2984
+ getTotalStaked(): Promise<bigint>;
2985
+ /**
2986
+ * Get total slashed amount
2987
+ *
2988
+ * @returns Total slashed (wei)
2989
+ */
2990
+ getTotalSlashed(): Promise<bigint>;
2991
+ /**
2992
+ * Get staking leaderboard
2993
+ *
2994
+ * @param limit - Number of entries
2995
+ * @returns Leaderboard entries
2996
+ */
2997
+ getStakingLeaderboard(limit?: number): Promise<Array<{
2998
+ rank: number;
2999
+ worker: string;
3000
+ staked: bigint;
3001
+ tier: WorkerTier;
3002
+ apy_bps: number;
3003
+ }>>;
3004
+ /**
3005
+ * Delegate stake to a worker
3006
+ *
3007
+ * @param worker - Worker to delegate to
3008
+ * @param amount - Amount to delegate (wei)
3009
+ * @returns Transaction result
3010
+ */
3011
+ delegateStake(worker: string, amount: bigint): Promise<TransactionResult$5>;
3012
+ /**
3013
+ * Undelegate stake from a worker
3014
+ *
3015
+ * @param worker - Worker to undelegate from
3016
+ * @param amount - Amount to undelegate (wei)
3017
+ * @returns Transaction result
3018
+ */
3019
+ undelegateStake(worker: string, amount: bigint): Promise<TransactionResult$5>;
3020
+ /**
3021
+ * Get delegation info
3022
+ *
3023
+ * @param delegator - Delegator address
3024
+ * @returns Delegation info
3025
+ */
3026
+ getDelegationInfo(delegator: string): Promise<Array<{
3027
+ worker: string;
3028
+ amount: bigint;
3029
+ rewards_share_bps: number;
3030
+ delegated_at: number;
3031
+ }>>;
3032
+ /**
3033
+ * Check if worker is eligible for jobs
3034
+ *
3035
+ * @param stake - Worker stake info
3036
+ * @returns Whether worker is eligible
3037
+ */
3038
+ static isEligible(stake: WorkerStake): boolean;
3039
+ /**
3040
+ * Get lockup end timestamp
3041
+ *
3042
+ * @param requestedAt - When unstake was requested
3043
+ * @returns Timestamp when unstake becomes available
3044
+ */
3045
+ static getLockupEndTimestamp(requestedAt: number): number;
3046
+ /**
3047
+ * Calculate expected slash amount
3048
+ *
3049
+ * @param stakeAmount - Current stake (wei)
3050
+ * @param reason - Slash reason
3051
+ * @returns Expected slash amount (wei)
3052
+ */
3053
+ static calculateSlashAmount(stakeAmount: bigint, reason: SlashReason): bigint;
3054
+ private gpuTierToFelt;
3055
+ private teeTypeToFelt;
3056
+ private slashReasonToFelt;
3057
+ }
3058
+ /**
3059
+ * Create a StakingClient instance
3060
+ */
3061
+ declare function createStakingClient(http: HttpClient, contract: ContractClient, proverStakingAddress: string, cdcPoolAddress: string): StakingClient;
3062
+
3063
+ /**
3064
+ * Enhanced Workers Module
3065
+ * Full worker management with registration, heartbeat, and leaderboard
3066
+ */
3067
+
3068
+ interface WorkersClientConfig {
3069
+ /** CDC Pool contract address */
3070
+ cdcPoolAddress: string;
3071
+ /** Reputation Manager contract address */
3072
+ reputationManagerAddress: string;
3073
+ }
3074
+ /** Transaction result */
3075
+ interface TransactionResult$4 {
3076
+ transaction_hash: string;
3077
+ status: 'pending' | 'accepted' | 'rejected';
3078
+ receipt?: TransactionReceipt;
3079
+ }
3080
+ /** Worker status */
3081
+ type WorkerStatus = 'Active' | 'Inactive' | 'Suspended' | 'Banned' | 'PendingRegistration';
3082
+ /** Worker capabilities flags */
3083
+ interface WorkerCapabilities {
3084
+ /** Has GPU */
3085
+ has_gpu: boolean;
3086
+ /** GPU tier if has_gpu */
3087
+ gpu_tier?: GpuTier;
3088
+ /** VRAM in GB */
3089
+ vram_gb?: number;
3090
+ /** Has TEE support */
3091
+ has_tee: boolean;
3092
+ /** TEE type */
3093
+ tee_type?: 'IntelTDX' | 'AMDSEVSNP' | 'NvidiaCC';
3094
+ /** Supported job types (bitfield) */
3095
+ supported_job_types: number;
3096
+ /** Maximum concurrent jobs */
3097
+ max_concurrent_jobs: number;
3098
+ /** Network bandwidth (Mbps) */
3099
+ bandwidth_mbps: number;
3100
+ /** Available storage (GB) */
3101
+ storage_gb: number;
3102
+ /** CPU cores */
3103
+ cpu_cores: number;
3104
+ /** RAM (GB) */
3105
+ ram_gb: number;
3106
+ }
3107
+ /** Worker capability flags */
3108
+ declare const CAPABILITY_FLAGS: {
3109
+ readonly AI_INFERENCE: number;
3110
+ readonly ZK_PROVING: number;
3111
+ readonly IMAGE_GENERATION: number;
3112
+ readonly VIDEO_GENERATION: number;
3113
+ readonly TRAINING: number;
3114
+ readonly FINE_TUNING: number;
3115
+ readonly EMBEDDINGS: number;
3116
+ readonly CUSTOM_COMPUTE: number;
3117
+ };
3118
+ /** Worker basic info */
3119
+ interface WorkerInfo {
3120
+ /** Worker address */
3121
+ address: string;
3122
+ /** Worker ID (may differ from address) */
3123
+ worker_id: string;
3124
+ /** Current status */
3125
+ status: WorkerStatus;
3126
+ /** Registration timestamp */
3127
+ registered_at: number;
3128
+ /** Capabilities */
3129
+ capabilities: WorkerCapabilities;
3130
+ /** Reputation score (0-100) */
3131
+ reputation: number;
3132
+ /** Total jobs completed */
3133
+ total_jobs: bigint;
3134
+ /** Success rate (basis points) */
3135
+ success_rate_bps: number;
3136
+ /** Current stake */
3137
+ stake: bigint;
3138
+ /** Worker tier */
3139
+ tier: WorkerTier;
3140
+ /** Geographic region */
3141
+ region?: string;
3142
+ /** Last heartbeat timestamp */
3143
+ last_heartbeat: number;
3144
+ }
3145
+ /** Worker detailed profile */
3146
+ interface WorkerProfile {
3147
+ /** Basic info */
3148
+ info: WorkerInfo;
3149
+ /** Total earnings (wei) */
3150
+ total_earnings: bigint;
3151
+ /** Average job completion time (seconds) */
3152
+ avg_completion_time_secs: number;
3153
+ /** Jobs in last 24h */
3154
+ jobs_24h: number;
3155
+ /** Earnings in last 24h (wei) */
3156
+ earnings_24h: bigint;
3157
+ /** Proof success rate (basis points) */
3158
+ proof_success_rate_bps: number;
3159
+ /** Consecutive successful jobs */
3160
+ consecutive_successes: number;
3161
+ /** Slash history count */
3162
+ slash_count: number;
3163
+ /** Total slashed amount (wei) */
3164
+ total_slashed: bigint;
3165
+ /** Delegated stake amount (wei) */
3166
+ delegated_stake: bigint;
3167
+ /** Number of delegators */
3168
+ delegator_count: number;
3169
+ /** TEE attestation status */
3170
+ tee_attestation_valid: boolean;
3171
+ /** TEE attestation expiry */
3172
+ tee_attestation_expiry?: number;
3173
+ }
3174
+ /** Worker performance data for heartbeat */
3175
+ interface PerformanceData {
3176
+ /** Current CPU usage (0-100) */
3177
+ cpu_usage: number;
3178
+ /** Current memory usage (0-100) */
3179
+ memory_usage: number;
3180
+ /** Current GPU usage (0-100) */
3181
+ gpu_usage?: number;
3182
+ /** Current GPU temperature (Celsius) */
3183
+ gpu_temp?: number;
3184
+ /** Current GPU memory usage (0-100) */
3185
+ gpu_memory_usage?: number;
3186
+ /** Active jobs count */
3187
+ active_jobs: number;
3188
+ /** Queue depth */
3189
+ queue_depth: number;
3190
+ /** Network latency (ms) */
3191
+ network_latency_ms: number;
3192
+ /** Is available for new jobs */
3193
+ is_available: boolean;
3194
+ /** Custom metrics */
3195
+ custom_metrics?: Record<string, number>;
3196
+ }
3197
+ /** Leaderboard metric type */
3198
+ type LeaderboardMetric = 'reputation' | 'earnings' | 'jobs' | 'stake' | 'success_rate';
3199
+ /** Leaderboard entry */
3200
+ interface LeaderboardEntry {
3201
+ /** Rank */
3202
+ rank: number;
3203
+ /** Worker address */
3204
+ worker: string;
3205
+ /** Metric value */
3206
+ value: bigint | number;
3207
+ /** Worker tier */
3208
+ tier: WorkerTier;
3209
+ /** Change from previous period */
3210
+ change: number;
3211
+ }
3212
+ /** Worker registration params */
3213
+ interface RegisterWorkerParams {
3214
+ /** Worker capabilities */
3215
+ capabilities: WorkerCapabilities;
3216
+ /** TEE attestation proof (if has TEE) */
3217
+ tee_attestation?: string;
3218
+ /** Geographic region code */
3219
+ region?: string;
3220
+ /** Initial stake amount (wei) */
3221
+ initial_stake: bigint;
3222
+ /** Benchmark proof */
3223
+ benchmark_proof: string;
3224
+ /** Benchmark result hash */
3225
+ benchmark_hash: string;
3226
+ }
3227
+ /**
3228
+ * Enhanced Workers Client
3229
+ *
3230
+ * Full worker management including:
3231
+ * - Worker registration and onboarding
3232
+ * - Heartbeat and health monitoring
3233
+ * - Profile and capability queries
3234
+ * - Leaderboard and rankings
3235
+ * - Delegation support
3236
+ * - Dispute handling
3237
+ *
3238
+ * @example
3239
+ * ```typescript
3240
+ * const workers = new WorkersClient(httpClient, contractClient, config);
3241
+ *
3242
+ * // Register a new worker
3243
+ * await workers.registerWorker({
3244
+ * capabilities: {
3245
+ * has_gpu: true,
3246
+ * gpu_tier: 'DataCenter',
3247
+ * vram_gb: 80,
3248
+ * has_tee: true,
3249
+ * tee_type: 'NvidiaCC',
3250
+ * supported_job_types: CAPABILITY_FLAGS.AI_INFERENCE | CAPABILITY_FLAGS.ZK_PROVING,
3251
+ * max_concurrent_jobs: 4,
3252
+ * bandwidth_mbps: 1000,
3253
+ * storage_gb: 500,
3254
+ * cpu_cores: 32,
3255
+ * ram_gb: 256,
3256
+ * },
3257
+ * initial_stake: 5000n * 10n**18n,
3258
+ * benchmark_proof: '0x...',
3259
+ * benchmark_hash: '0x...',
3260
+ * });
3261
+ *
3262
+ * // Submit periodic heartbeat
3263
+ * await workers.submitHeartbeat({
3264
+ * cpu_usage: 45,
3265
+ * memory_usage: 60,
3266
+ * gpu_usage: 80,
3267
+ * gpu_temp: 72,
3268
+ * active_jobs: 2,
3269
+ * queue_depth: 5,
3270
+ * network_latency_ms: 15,
3271
+ * is_available: true,
3272
+ * });
3273
+ * ```
3274
+ */
3275
+ declare class WorkersClient {
3276
+ private http;
3277
+ private contract;
3278
+ private config;
3279
+ constructor(http: HttpClient, contract: ContractClient, config: WorkersClientConfig);
3280
+ /**
3281
+ * Register a new worker
3282
+ *
3283
+ * @param params - Registration parameters
3284
+ * @returns Transaction result
3285
+ */
3286
+ registerWorker(params: RegisterWorkerParams): Promise<TransactionResult$4>;
3287
+ /**
3288
+ * Update worker capabilities
3289
+ *
3290
+ * @param capabilities - New capabilities
3291
+ * @returns Transaction result
3292
+ */
3293
+ updateCapabilities(capabilities: WorkerCapabilities): Promise<TransactionResult$4>;
3294
+ /**
3295
+ * Deregister worker
3296
+ *
3297
+ * @returns Transaction result
3298
+ */
3299
+ deregisterWorker(): Promise<TransactionResult$4>;
3300
+ /**
3301
+ * Submit worker heartbeat with performance data
3302
+ *
3303
+ * @param performanceData - Current performance metrics
3304
+ * @returns Transaction result
3305
+ */
3306
+ submitHeartbeat(performanceData: PerformanceData): Promise<TransactionResult$4>;
3307
+ /**
3308
+ * Mark worker as unavailable
3309
+ *
3310
+ * @param reason - Reason for unavailability
3311
+ * @param estimatedReturnTime - Unix timestamp for estimated return
3312
+ * @returns Transaction result
3313
+ */
3314
+ setUnavailable(reason: string, estimatedReturnTime?: number): Promise<TransactionResult$4>;
3315
+ /**
3316
+ * Mark worker as available
3317
+ *
3318
+ * @returns Transaction result
3319
+ */
3320
+ setAvailable(): Promise<TransactionResult$4>;
3321
+ /**
3322
+ * List all workers
3323
+ *
3324
+ * @param params - Filter parameters
3325
+ * @returns Array of worker info
3326
+ */
3327
+ listWorkers(params?: {
3328
+ status?: WorkerStatus;
3329
+ min_reputation?: number;
3330
+ gpu_tier?: GpuTier;
3331
+ has_tee?: boolean;
3332
+ capability_flags?: number;
3333
+ limit?: number;
3334
+ offset?: number;
3335
+ }): Promise<WorkerInfo[]>;
3336
+ /**
3337
+ * Get worker info by ID
3338
+ *
3339
+ * @param workerId - Worker ID or address
3340
+ * @returns Worker info
3341
+ */
3342
+ getWorker(workerId: string): Promise<WorkerInfo>;
3343
+ /**
3344
+ * Get detailed worker profile
3345
+ *
3346
+ * @param workerId - Worker ID or address
3347
+ * @returns Detailed worker profile
3348
+ */
3349
+ getWorkerProfile(workerId: string): Promise<WorkerProfile>;
3350
+ /**
3351
+ * Get workers by capability flags
3352
+ *
3353
+ * @param flags - Capability flags (bitfield)
3354
+ * @param minReputation - Minimum reputation score
3355
+ * @returns Array of worker addresses
3356
+ */
3357
+ getWorkersByCapability(flags: number, minReputation?: number): Promise<string[]>;
3358
+ /**
3359
+ * Get available workers for a job type
3360
+ *
3361
+ * @param jobType - Job type capability flag
3362
+ * @param gpuTierRequired - Minimum GPU tier required
3363
+ * @returns Array of available worker addresses
3364
+ */
3365
+ getAvailableWorkers(jobType: number, gpuTierRequired?: GpuTier): Promise<string[]>;
3366
+ /**
3367
+ * Get worker leaderboard
3368
+ *
3369
+ * @param metric - Ranking metric
3370
+ * @param limit - Number of entries
3371
+ * @param period - Time period ('day' | 'week' | 'month' | 'all')
3372
+ * @returns Leaderboard entries
3373
+ */
3374
+ getLeaderboard(metric: LeaderboardMetric, limit?: number, period?: 'day' | 'week' | 'month' | 'all'): Promise<LeaderboardEntry[]>;
3375
+ /**
3376
+ * Get worker rank for a metric
3377
+ *
3378
+ * @param workerId - Worker ID
3379
+ * @param metric - Ranking metric
3380
+ * @returns Worker's rank
3381
+ */
3382
+ getWorkerRank(workerId: string, metric: LeaderboardMetric): Promise<number>;
3383
+ /**
3384
+ * Get worker reputation details
3385
+ *
3386
+ * @param workerId - Worker ID
3387
+ * @returns Reputation breakdown
3388
+ */
3389
+ getReputationDetails(workerId: string): Promise<{
3390
+ overall: number;
3391
+ job_completion: number;
3392
+ proof_accuracy: number;
3393
+ uptime: number;
3394
+ response_time: number;
3395
+ peer_reviews: number;
3396
+ stake_factor: number;
3397
+ history: Array<{
3398
+ timestamp: number;
3399
+ change: number;
3400
+ reason: string;
3401
+ }>;
3402
+ }>;
3403
+ /**
3404
+ * Submit peer review (for other workers)
3405
+ *
3406
+ * @param workerId - Worker being reviewed
3407
+ * @param jobId - Job the review is for
3408
+ * @param rating - Rating (1-5)
3409
+ * @param comment - Optional comment
3410
+ * @returns Transaction result
3411
+ */
3412
+ submitPeerReview(workerId: string, jobId: bigint, rating: number, comment?: string): Promise<TransactionResult$4>;
3413
+ /**
3414
+ * Challenge a slash against this worker
3415
+ *
3416
+ * @param slashId - Slash ID to challenge
3417
+ * @param evidence - Evidence supporting the challenge
3418
+ * @param bond - Bond amount (wei)
3419
+ * @returns Transaction result with dispute ID
3420
+ */
3421
+ challengeSlash(slashId: bigint, evidence: string[], bond: bigint): Promise<TransactionResult$4>;
3422
+ /**
3423
+ * Get dispute status
3424
+ *
3425
+ * @param disputeId - Dispute ID
3426
+ * @returns Dispute record
3427
+ */
3428
+ getDisputeStatus(disputeId: bigint): Promise<DisputeRecord>;
3429
+ /**
3430
+ * Get slash records for a worker
3431
+ *
3432
+ * @param workerId - Worker ID
3433
+ * @returns Array of slash records
3434
+ */
3435
+ getSlashHistory(workerId: string): Promise<SlashRecord[]>;
3436
+ /**
3437
+ * Submit TEE attestation
3438
+ *
3439
+ * @param attestation - TEE attestation data
3440
+ * @returns Transaction result
3441
+ */
3442
+ submitTeeAttestation(attestation: string): Promise<TransactionResult$4>;
3443
+ /**
3444
+ * Verify worker's TEE attestation
3445
+ *
3446
+ * @param workerId - Worker ID
3447
+ * @returns Whether attestation is valid
3448
+ */
3449
+ verifyTeeAttestation(workerId: string): Promise<{
3450
+ valid: boolean;
3451
+ tee_type?: string;
3452
+ expires_at?: number;
3453
+ measurement?: string;
3454
+ }>;
3455
+ /**
3456
+ * Get network-wide worker statistics
3457
+ *
3458
+ * @returns Worker statistics
3459
+ */
3460
+ getNetworkStats(): Promise<{
3461
+ total_workers: number;
3462
+ active_workers: number;
3463
+ total_stake: bigint;
3464
+ avg_reputation: number;
3465
+ workers_by_tier: Record<WorkerTier, number>;
3466
+ workers_by_gpu_tier: Record<GpuTier, number>;
3467
+ tee_enabled_workers: number;
3468
+ }>;
3469
+ private encodeCapabilities;
3470
+ private gpuTierToFelt;
3471
+ private teeTypeToFelt;
3472
+ }
3473
+ /**
3474
+ * Create a WorkersClient instance
3475
+ */
3476
+ declare function createWorkersClient(http: HttpClient, contract: ContractClient, cdcPoolAddress: string, reputationManagerAddress: string): WorkersClient;
3477
+
3478
+ /**
3479
+ * Obelysk Privacy Module
3480
+ * Full privacy system with ElGamal encryption, threshold decryption, and ring signatures
3481
+ */
3482
+
3483
+ interface PrivacyClientConfig {
3484
+ /** Privacy router contract address */
3485
+ privacyRouterAddress: string;
3486
+ /** DKG coordinator contract address */
3487
+ dkgCoordinatorAddress?: string;
3488
+ /** Mixing pool contract address */
3489
+ mixingPoolAddress?: string;
3490
+ }
3491
+ /** Transaction result */
3492
+ interface TransactionResult$3 {
3493
+ transaction_hash: string;
3494
+ status: 'pending' | 'accepted' | 'rejected';
3495
+ receipt?: TransactionReceipt;
3496
+ }
3497
+ /** Supported privacy assets */
3498
+ type PrivacyAsset = 'SAGE' | 'USDC' | 'STRK' | 'WBTC' | 'ETH';
3499
+ /**
3500
+ * Obelysk Privacy Client
3501
+ *
3502
+ * Full privacy functionality including:
3503
+ * - Account registration and management
3504
+ * - Private transfers with zero-knowledge proofs
3505
+ * - Auditable transfers (with designated auditor)
3506
+ * - Steganographic operations (hidden transaction types)
3507
+ * - Ring signatures for transaction mixing
3508
+ * - Threshold decryption via DKG
3509
+ * - Multi-asset privacy support
3510
+ * - Emergency ragequit (privacy exit)
3511
+ *
3512
+ * @example
3513
+ * ```typescript
3514
+ * const privacy = new PrivacyClient(httpClient, contractClient, config);
3515
+ *
3516
+ * // Generate privacy keys
3517
+ * const keys = await privacy.generateKeys();
3518
+ * // Or derive from wallet
3519
+ * const sig = await wallet.signMessage(getPrivacyDerivationMessage(address));
3520
+ * const keys = await privacy.deriveKeysFromWallet(sig);
3521
+ *
3522
+ * // Register private account
3523
+ * await privacy.registerAccount(keys.publicKey);
3524
+ *
3525
+ * // Get encrypted balance
3526
+ * const balance = await privacy.getEncryptedBalance(address);
3527
+ *
3528
+ * // Reveal balance (client-side decryption)
3529
+ * const revealed = await privacy.revealBalance(balance, keys.privateKey);
3530
+ *
3531
+ * // Private transfer
3532
+ * await privacy.privateTransfer({
3533
+ * to: recipientAddress,
3534
+ * amount: 100n * 10n**18n,
3535
+ * keys,
3536
+ * });
3537
+ * ```
3538
+ */
3539
+ declare class PrivacyClient {
3540
+ private http;
3541
+ private contract;
3542
+ private config;
3543
+ private keyManager;
3544
+ constructor(http: HttpClient, contract: ContractClient, config: PrivacyClientConfig);
3545
+ /**
3546
+ * Generate fresh privacy keys
3547
+ *
3548
+ * @returns New privacy keypair
3549
+ */
3550
+ generateKeys(): Promise<PrivacyKeyPair>;
3551
+ /**
3552
+ * Derive privacy keys from wallet signature
3553
+ *
3554
+ * @param signature - Wallet signature of derivation message
3555
+ * @returns Derived privacy keypair
3556
+ */
3557
+ deriveKeysFromWallet(signature: string): Promise<PrivacyKeyPair>;
3558
+ /**
3559
+ * Store keys encrypted in local storage
3560
+ *
3561
+ * @param keys - Keypair to store
3562
+ * @param password - Encryption password
3563
+ */
3564
+ storeKeys(keys: PrivacyKeyPair, password: string): Promise<void>;
3565
+ /**
3566
+ * Retrieve keys from local storage
3567
+ *
3568
+ * @param password - Decryption password
3569
+ * @returns Keypair or null if not found/wrong password
3570
+ */
3571
+ retrieveKeys(password: string): Promise<PrivacyKeyPair | null>;
3572
+ /**
3573
+ * Check if keys are stored
3574
+ */
3575
+ hasStoredKeys(): boolean;
3576
+ /**
3577
+ * Clear stored keys
3578
+ */
3579
+ clearKeys(): void;
3580
+ /**
3581
+ * Register a private account
3582
+ *
3583
+ * @param publicKey - ElGamal public key
3584
+ * @returns Transaction result
3585
+ */
3586
+ registerAccount(publicKey: ECPoint): Promise<TransactionResult$3>;
3587
+ /**
3588
+ * Get private account info
3589
+ *
3590
+ * @param address - Account address
3591
+ * @returns Private account or null
3592
+ */
3593
+ getAccount(address: string): Promise<PrivateAccount | null>;
3594
+ /**
3595
+ * Get encrypted balance for an address
3596
+ *
3597
+ * @param address - Account address
3598
+ * @returns Encrypted balance
3599
+ */
3600
+ getEncryptedBalance(address: string): Promise<EncryptedBalance>;
3601
+ /**
3602
+ * Reveal balance (client-side decryption)
3603
+ *
3604
+ * @param balance - Encrypted balance
3605
+ * @param privateKey - Private key for decryption
3606
+ * @param hint - Optional AE hint for fast decryption
3607
+ * @returns Decrypted balance amount
3608
+ */
3609
+ revealBalance(balance: EncryptedBalance, privateKey: Uint8Array, hint?: AEHint): Promise<bigint>;
3610
+ /**
3611
+ * Execute a private transfer
3612
+ *
3613
+ * @param params - Transfer parameters
3614
+ * @returns Transaction result
3615
+ */
3616
+ privateTransfer(params: {
3617
+ to: string;
3618
+ amount: bigint;
3619
+ keys: PrivacyKeyPair;
3620
+ }): Promise<TransactionResult$3>;
3621
+ /**
3622
+ * Execute raw private transfer with pre-computed proof
3623
+ *
3624
+ * @param params - Pre-computed transfer parameters
3625
+ * @returns Transaction result
3626
+ */
3627
+ executePrivateTransfer(params: PrivateTransferParams): Promise<TransactionResult$3>;
3628
+ /**
3629
+ * Execute private transfer with audit trail
3630
+ *
3631
+ * @param params - Transfer parameters with audit info
3632
+ * @returns Transaction result
3633
+ */
3634
+ privateTransferWithAudit(params: PrivateTransferWithAuditParams): Promise<TransactionResult$3>;
3635
+ /**
3636
+ * Generate a stealth address for one-time payments
3637
+ *
3638
+ * @param recipientPublicKey - Recipient's public key
3639
+ * @returns Stealth address
3640
+ */
3641
+ generateStealthAddress(recipientPublicKey: ECPoint): StealthAddress;
3642
+ /**
3643
+ * Scan for stealth payments
3644
+ *
3645
+ * @param privateKey - Recipient's private key
3646
+ * @param startBlock - Block to start scanning from
3647
+ * @returns Array of received stealth payments
3648
+ */
3649
+ scanStealthPayments(privateKey: Uint8Array, startBlock?: number): Promise<Array<{
3650
+ stealthAddress: StealthAddress;
3651
+ amount: bigint;
3652
+ blockNumber: number;
3653
+ }>>;
3654
+ /**
3655
+ * Execute stealth (steganographic) transfer
3656
+ *
3657
+ * @param stegTx - Steganographic transaction
3658
+ * @returns Transaction result
3659
+ */
3660
+ stealthTransfer(stegTx: SteganographicTransaction): Promise<TransactionResult$3>;
3661
+ /**
3662
+ * Execute stealth deposit (hide deposit as transfer)
3663
+ *
3664
+ * @param stegTx - Steganographic transaction
3665
+ * @returns Transaction result
3666
+ */
3667
+ stealthDeposit(stegTx: SteganographicTransaction): Promise<TransactionResult$3>;
3668
+ /**
3669
+ * Execute stealth withdrawal (hide withdrawal as transfer)
3670
+ *
3671
+ * @param stegTx - Steganographic transaction
3672
+ * @returns Transaction result
3673
+ */
3674
+ stealthWithdraw(stegTx: SteganographicTransaction): Promise<TransactionResult$3>;
3675
+ /**
3676
+ * Execute mixed transaction using ring signature
3677
+ *
3678
+ * @param mixingTx - Mixing transaction with ring signature
3679
+ * @returns Transaction result
3680
+ */
3681
+ mixTransaction(mixingTx: MixingTransaction): Promise<TransactionResult$3>;
3682
+ /**
3683
+ * Register a mixing output (add to anonymity set)
3684
+ *
3685
+ * @param output - Mixing output to register
3686
+ * @returns Transaction result
3687
+ */
3688
+ registerMixingOutput(output: MixingOutput): Promise<TransactionResult$3>;
3689
+ /**
3690
+ * Get available mixing outputs for ring construction
3691
+ *
3692
+ * @param count - Number of outputs to fetch
3693
+ * @returns Array of mixing outputs
3694
+ */
3695
+ getMixingOutputs(count: number): Promise<MixingOutput[]>;
3696
+ /**
3697
+ * Initiate DKG ceremony
3698
+ *
3699
+ * @param participants - Participant addresses
3700
+ * @param threshold - Required threshold (t of n)
3701
+ * @returns Transaction result with DKG session ID
3702
+ */
3703
+ initiateDKG(participants: string[], threshold: number): Promise<TransactionResult$3>;
3704
+ /**
3705
+ * Submit DKG share
3706
+ *
3707
+ * @param share - DKG share with commitments
3708
+ * @returns Transaction result
3709
+ */
3710
+ submitDKGShare(share: DKGShare): Promise<TransactionResult$3>;
3711
+ /**
3712
+ * Request threshold decryption
3713
+ *
3714
+ * @param ciphertext - Ciphertext to decrypt
3715
+ * @returns Transaction result with request ID
3716
+ */
3717
+ requestThresholdDecryption(ciphertext: ElGamalCiphertext): Promise<TransactionResult$3>;
3718
+ /**
3719
+ * Get threshold decryption request status
3720
+ *
3721
+ * @param requestId - Request ID
3722
+ * @returns Request status
3723
+ */
3724
+ getThresholdDecryptionStatus(requestId: bigint): Promise<ThresholdDecryptionRequest>;
3725
+ /**
3726
+ * Get private balances for all supported assets
3727
+ *
3728
+ * @param address - Account address
3729
+ * @returns Multi-asset encrypted balances
3730
+ */
3731
+ getPrivateBalances(address: string): Promise<MultiAssetBalances>;
3732
+ /**
3733
+ * Execute private swap between assets
3734
+ *
3735
+ * @param params - Swap parameters
3736
+ * @returns Transaction result
3737
+ */
3738
+ privateSwap(params: PrivateSwapParams): Promise<TransactionResult$3>;
3739
+ /**
3740
+ * Execute ragequit (emergency withdrawal)
3741
+ *
3742
+ * Reveals balance and withdraws to public address.
3743
+ * Use only in emergencies as it breaks privacy.
3744
+ *
3745
+ * @param proof - Ragequit proof with ownership and balance
3746
+ * @returns Transaction result
3747
+ */
3748
+ ragequit(proof: RagequitProof): Promise<TransactionResult$3>;
3749
+ /**
3750
+ * Create ragequit proof
3751
+ *
3752
+ * @param privateKey - Private key
3753
+ * @param publicKey - Public key
3754
+ * @param balance - Current encrypted balance
3755
+ * @returns Ragequit proof
3756
+ */
3757
+ createRagequitProof(privateKey: Uint8Array, publicKey: ECPoint, balance: EncryptedBalance, hint?: AEHint): Promise<RagequitProof>;
3758
+ /**
3759
+ * Encrypt an amount for a recipient
3760
+ *
3761
+ * @param amount - Amount to encrypt
3762
+ * @param recipientPublicKey - Recipient's public key
3763
+ * @returns ElGamal ciphertext
3764
+ */
3765
+ encrypt(amount: bigint, recipientPublicKey: ECPoint): ElGamalCiphertext;
3766
+ /**
3767
+ * Add two encrypted values
3768
+ *
3769
+ * @param a - First ciphertext
3770
+ * @param b - Second ciphertext
3771
+ * @returns Sum ciphertext
3772
+ */
3773
+ homomorphicAdd(a: ElGamalCiphertext, b: ElGamalCiphertext): ElGamalCiphertext;
3774
+ /**
3775
+ * Subtract encrypted values
3776
+ *
3777
+ * @param a - First ciphertext
3778
+ * @param b - Second ciphertext
3779
+ * @returns Difference ciphertext
3780
+ */
3781
+ homomorphicSub(a: ElGamalCiphertext, b: ElGamalCiphertext): ElGamalCiphertext;
3782
+ private parseEncryptedBalance;
3783
+ private parseCiphertext;
3784
+ private encodeCiphertext;
3785
+ private encodeTransferProof;
3786
+ private encodeSchnorrProof;
3787
+ private encodeRangeProof;
3788
+ private encodeSameEncryptionProof;
3789
+ private encodeMixingTransaction;
3790
+ }
3791
+ /**
3792
+ * Create a PrivacyClient instance
3793
+ */
3794
+ declare function createPrivacyClient(http: HttpClient, contract: ContractClient, privacyRouterAddress: string, dkgCoordinatorAddress?: string, mixingPoolAddress?: string): PrivacyClient;
3795
+
3796
+ /**
3797
+ * SAGE Token Governance Module
3798
+ * Full governance system with proposals, voting, and tokenomics
3799
+ */
3800
+
3801
+ interface GovernanceClientConfig {
3802
+ /** SAGE token contract address */
3803
+ sageTokenAddress: string;
3804
+ /** Governance contract address (if separate) */
3805
+ governanceAddress?: string;
3806
+ /** Burn manager contract address */
3807
+ burnManagerAddress?: string;
3808
+ }
3809
+ /** Transaction result */
3810
+ interface TransactionResult$2 {
3811
+ transaction_hash: string;
3812
+ status: 'pending' | 'accepted' | 'rejected';
3813
+ receipt?: TransactionReceipt;
3814
+ }
3815
+ /** Vote direction */
3816
+ type VoteDirection = 'for' | 'against' | 'abstain';
3817
+ /** Delegation info */
3818
+ interface DelegationInfo {
3819
+ /** Address delegated to */
3820
+ delegatee: string;
3821
+ /** Amount of voting power delegated */
3822
+ voting_power: bigint;
3823
+ /** When delegation started */
3824
+ delegated_at: number;
3825
+ }
3826
+ /** Voter info for a specific proposal */
3827
+ interface VoterInfo {
3828
+ /** Has voted */
3829
+ has_voted: boolean;
3830
+ /** Vote direction (if voted) */
3831
+ vote_direction?: VoteDirection;
3832
+ /** Voting power used */
3833
+ voting_power_used: bigint;
3834
+ /** Timestamp of vote */
3835
+ voted_at?: number;
3836
+ }
3837
+ /**
3838
+ * SAGE Token Governance Client
3839
+ *
3840
+ * Full governance functionality including:
3841
+ * - Proposal creation and management
3842
+ * - Voting with delegation support
3843
+ * - Tokenomics (burn rate, inflation, pools)
3844
+ * - Treasury management
3845
+ * - Large transfer rate limiting
3846
+ * - Vesting schedules
3847
+ *
3848
+ * @example
3849
+ * ```typescript
3850
+ * const governance = new GovernanceClient(httpClient, contractClient, config);
3851
+ *
3852
+ * // Check voting power
3853
+ * const power = await governance.getVotingPower(myAddress);
3854
+ * console.log(`Voting power: ${power / 10n**18n} SAGE`);
3855
+ *
3856
+ * // Create a proposal
3857
+ * const result = await governance.createProposal({
3858
+ * description: 'Increase burn rate by 1%',
3859
+ * proposal_type: 'BurnRateChange',
3860
+ * burn_rate_change_bps: 100,
3861
+ * });
3862
+ *
3863
+ * // Vote on a proposal
3864
+ * await governance.vote(proposalId, 'for');
3865
+ *
3866
+ * // Check tokenomics
3867
+ * const burned = await governance.getTotalBurned();
3868
+ * const rate = await governance.getBurnRate();
3869
+ * ```
3870
+ */
3871
+ declare class GovernanceClient {
3872
+ private http;
3873
+ private contract;
3874
+ private config;
3875
+ constructor(http: HttpClient, contract: ContractClient, config: GovernanceClientConfig);
3876
+ /**
3877
+ * Create a new governance proposal
3878
+ *
3879
+ * @param params - Proposal parameters
3880
+ * @returns Transaction result with proposal ID
3881
+ */
3882
+ createProposal(params: CreateProposalParams): Promise<TransactionResult$2>;
3883
+ /**
3884
+ * Get proposal details
3885
+ *
3886
+ * @param proposalId - Proposal ID
3887
+ * @returns Proposal details
3888
+ */
3889
+ getProposal(proposalId: bigint): Promise<GovernanceProposal>;
3890
+ /**
3891
+ * List proposals with filtering
3892
+ *
3893
+ * @param params - Filter parameters
3894
+ * @returns Array of proposals
3895
+ */
3896
+ listProposals(params?: {
3897
+ status?: ProposalStatus;
3898
+ proposal_type?: ProposalType;
3899
+ proposer?: string;
3900
+ limit?: number;
3901
+ offset?: number;
3902
+ }): Promise<GovernanceProposal[]>;
3903
+ /**
3904
+ * Cancel a proposal (proposer only)
3905
+ *
3906
+ * @param proposalId - Proposal ID
3907
+ * @returns Transaction result
3908
+ */
3909
+ cancelProposal(proposalId: bigint): Promise<TransactionResult$2>;
3910
+ /**
3911
+ * Execute a succeeded proposal
3912
+ *
3913
+ * @param proposalId - Proposal ID
3914
+ * @returns Transaction result
3915
+ */
3916
+ executeProposal(proposalId: bigint): Promise<TransactionResult$2>;
3917
+ /**
3918
+ * Vote on a proposal
3919
+ *
3920
+ * @param proposalId - Proposal ID
3921
+ * @param direction - Vote direction
3922
+ * @returns Transaction result
3923
+ */
3924
+ vote(proposalId: bigint, direction: VoteDirection): Promise<TransactionResult$2>;
3925
+ /**
3926
+ * Vote with specific voting power
3927
+ *
3928
+ * @param proposalId - Proposal ID
3929
+ * @param direction - Vote direction
3930
+ * @param votingPower - Amount of voting power to use
3931
+ * @returns Transaction result
3932
+ */
3933
+ voteWithPower(proposalId: bigint, direction: VoteDirection, votingPower: bigint): Promise<TransactionResult$2>;
3934
+ /**
3935
+ * Get voter info for a proposal
3936
+ *
3937
+ * @param proposalId - Proposal ID
3938
+ * @param voter - Voter address
3939
+ * @returns Voter info
3940
+ */
3941
+ getVoterInfo(proposalId: bigint, voter: string): Promise<VoterInfo>;
3942
+ /**
3943
+ * Get voting power for an address
3944
+ *
3945
+ * @param address - Address to check
3946
+ * @returns Voting power (wei)
3947
+ */
3948
+ getVotingPower(address: string): Promise<bigint>;
3949
+ /**
3950
+ * Get governance rights for an address
3951
+ *
3952
+ * @param address - Address to check
3953
+ * @returns Governance rights
3954
+ */
3955
+ getGovernanceRights(address: string): Promise<GovernanceRights>;
3956
+ /**
3957
+ * Delegate voting power to another address
3958
+ *
3959
+ * @param delegatee - Address to delegate to
3960
+ * @returns Transaction result
3961
+ */
3962
+ delegate(delegatee: string): Promise<TransactionResult$2>;
3963
+ /**
3964
+ * Undelegate voting power
3965
+ *
3966
+ * @returns Transaction result
3967
+ */
3968
+ undelegate(): Promise<TransactionResult$2>;
3969
+ /**
3970
+ * Get delegation info for an address
3971
+ *
3972
+ * @param address - Address to check
3973
+ * @returns Delegation info or null if not delegating
3974
+ */
3975
+ getDelegationInfo(address: string): Promise<DelegationInfo | null>;
3976
+ /**
3977
+ * Get total SAGE burned
3978
+ *
3979
+ * @returns Total burned (wei)
3980
+ */
3981
+ getTotalBurned(): Promise<bigint>;
3982
+ /**
3983
+ * Get current burn rate
3984
+ *
3985
+ * @returns Burn rate in basis points
3986
+ */
3987
+ getBurnRate(): Promise<number>;
3988
+ /**
3989
+ * Get current inflation rate
3990
+ *
3991
+ * @returns Inflation rate in basis points
3992
+ */
3993
+ getInflationRate(): Promise<number>;
3994
+ /**
3995
+ * Get pool balances
3996
+ *
3997
+ * @returns All pool balances
3998
+ */
3999
+ getPoolBalances(): Promise<PoolBalances>;
4000
+ /**
4001
+ * Get vesting status
4002
+ *
4003
+ * @returns Current vesting status
4004
+ */
4005
+ getVestingStatus(): Promise<VestingStatus>;
4006
+ /**
4007
+ * Get security budget
4008
+ *
4009
+ * @returns Security budget info
4010
+ */
4011
+ getSecurityBudget(): Promise<SecurityBudget>;
4012
+ /**
4013
+ * Get ecosystem emission status
4014
+ *
4015
+ * @returns Emission status
4016
+ */
4017
+ getEcosystemEmissionStatus(): Promise<EcosystemEmissionStatus>;
4018
+ /**
4019
+ * Get burn event history
4020
+ *
4021
+ * @param limit - Number of events
4022
+ * @returns Array of burn events
4023
+ */
4024
+ getBurnHistory(limit?: number): Promise<BurnEvent[]>;
4025
+ /**
4026
+ * Get token flow summary
4027
+ *
4028
+ * @param periodDays - Number of days for period
4029
+ * @returns Token flow summary
4030
+ */
4031
+ getTokenFlowSummary(periodDays?: number): Promise<TokenFlowSummary>;
4032
+ /**
4033
+ * Get milestone status
4034
+ *
4035
+ * @returns Milestone flags
4036
+ */
4037
+ getMilestoneStatus(): Promise<MilestoneStatus>;
4038
+ /**
4039
+ * Get rate limit info for an address
4040
+ *
4041
+ * @param address - Address to check
4042
+ * @returns Rate limit info
4043
+ */
4044
+ getRateLimitInfo(address: string): Promise<RateLimitInfo>;
4045
+ /**
4046
+ * Initiate a large transfer (requires timelock)
4047
+ *
4048
+ * @param to - Recipient address
4049
+ * @param amount - Amount (wei)
4050
+ * @returns Transaction result with transfer ID
4051
+ */
4052
+ initiateLargeTransfer(to: string, amount: bigint): Promise<TransactionResult$2>;
4053
+ /**
4054
+ * Execute a pending large transfer
4055
+ *
4056
+ * @param transferId - Transfer ID
4057
+ * @returns Transaction result
4058
+ */
4059
+ executeLargeTransfer(transferId: bigint): Promise<TransactionResult$2>;
4060
+ /**
4061
+ * Cancel a pending large transfer
4062
+ *
4063
+ * @param transferId - Transfer ID
4064
+ * @returns Transaction result
4065
+ */
4066
+ cancelLargeTransfer(transferId: bigint): Promise<TransactionResult$2>;
4067
+ /**
4068
+ * Get pending large transfers for an address
4069
+ *
4070
+ * @param address - Address to check
4071
+ * @returns Array of pending transfers
4072
+ */
4073
+ getPendingTransfers(address: string): Promise<PendingTransfer[]>;
4074
+ /**
4075
+ * Get governance statistics
4076
+ *
4077
+ * @returns Governance stats
4078
+ */
4079
+ getGovernanceStats(): Promise<GovernanceStats>;
4080
+ /**
4081
+ * Get top voters by participation
4082
+ *
4083
+ * @param limit - Number of voters
4084
+ * @returns Array of top voters
4085
+ */
4086
+ getTopVoters(limit?: number): Promise<Array<{
4087
+ address: string;
4088
+ voting_power: bigint;
4089
+ proposals_voted: number;
4090
+ participation_rate_bps: number;
4091
+ }>>;
4092
+ /**
4093
+ * Check if address can create a proposal
4094
+ *
4095
+ * @param address - Address to check
4096
+ * @param proposalType - Type of proposal
4097
+ * @returns Whether address can create this proposal type
4098
+ */
4099
+ canCreateProposal(address: string, proposalType: ProposalType): Promise<boolean>;
4100
+ /**
4101
+ * Get proposal quorum progress
4102
+ *
4103
+ * @param proposalId - Proposal ID
4104
+ * @returns Quorum progress (basis points of quorum achieved)
4105
+ */
4106
+ getQuorumProgress(proposalId: bigint): Promise<{
4107
+ current_participation_bps: number;
4108
+ quorum_required_bps: number;
4109
+ quorum_reached: boolean;
4110
+ }>;
4111
+ /**
4112
+ * Check if proposal can be executed
4113
+ *
4114
+ * @param proposalId - Proposal ID
4115
+ * @returns Whether proposal can be executed
4116
+ */
4117
+ canExecuteProposal(proposalId: bigint): Promise<{
4118
+ can_execute: boolean;
4119
+ reason?: string;
4120
+ }>;
4121
+ private validateProposalParams;
4122
+ private proposalTypeToFelt;
4123
+ private voteDirectionToFelt;
4124
+ }
4125
+ /**
4126
+ * Create a GovernanceClient instance
4127
+ */
4128
+ declare function createGovernanceClient(http: HttpClient, contract: ContractClient, sageTokenAddress: string, governanceAddress?: string, burnManagerAddress?: string): GovernanceClient;
4129
+
4130
+ /**
4131
+ * STWO Verifier Module
4132
+ * STWO proof verification, GPU-TEE proofs, and batch verification
4133
+ */
4134
+
4135
+ interface StwoClientConfig {
4136
+ /** STWO verifier contract address */
4137
+ stwoVerifierAddress: string;
4138
+ /** Optimistic TEE contract address */
4139
+ optimisticTeeAddress?: string;
4140
+ /** Batch verifier contract address */
4141
+ batchVerifierAddress?: string;
4142
+ }
4143
+ /** Transaction result */
4144
+ interface TransactionResult$1 {
4145
+ transaction_hash: string;
4146
+ status: 'pending' | 'accepted' | 'rejected';
4147
+ receipt?: TransactionReceipt;
4148
+ }
4149
+ /** Challenge submission parameters */
4150
+ interface ChallengeParams {
4151
+ /** Proof hash to challenge */
4152
+ proof_hash: bigint;
4153
+ /** Challenge stake (wei) */
4154
+ stake: bigint;
4155
+ /** Fraud proof data */
4156
+ fraud_proof: string[];
4157
+ /** Challenge reason */
4158
+ reason: string;
4159
+ }
4160
+ /** Challenge status */
4161
+ interface ChallengeStatus {
4162
+ /** Challenge ID */
4163
+ challenge_id: bigint;
4164
+ /** Challenged proof hash */
4165
+ proof_hash: bigint;
4166
+ /** Challenger address */
4167
+ challenger: string;
4168
+ /** Challenge stake */
4169
+ stake: bigint;
4170
+ /** Status */
4171
+ status: 'Pending' | 'Resolved' | 'Rejected' | 'Slashed';
4172
+ /** Submitted at */
4173
+ submitted_at: number;
4174
+ /** Resolution timestamp */
4175
+ resolved_at?: number;
4176
+ /** Challenge upheld */
4177
+ upheld?: boolean;
4178
+ }
4179
+ /**
4180
+ * STWO Verifier Client
4181
+ *
4182
+ * Full STWO proof verification including:
4183
+ * - Standard proof submission and verification
4184
+ * - GPU-TEE optimistic proofs with challenge window
4185
+ * - Batch verification for multiple proofs
4186
+ * - Proof compression (zstd, lz4, snappy)
4187
+ * - Enclave whitelist management
4188
+ * - Prover metrics and statistics
4189
+ *
4190
+ * @example
4191
+ * ```typescript
4192
+ * const stwo = new StwoClient(httpClient, contractClient, config);
4193
+ *
4194
+ * // Submit a standard proof
4195
+ * const proofHash = await stwo.submitProof(proofData, publicInputHash);
4196
+ *
4197
+ * // Verify the proof
4198
+ * const isValid = await stwo.verifyProof(proofHash);
4199
+ *
4200
+ * // Submit GPU-TEE proof (optimistic)
4201
+ * await stwo.submitGpuTeeProof({
4202
+ * proof_data: proofData,
4203
+ * public_input_hash: publicInputHash,
4204
+ * tee_type: 3, // NvidiaCC
4205
+ * enclave_measurement: measurement,
4206
+ * quote_hash: quoteHash,
4207
+ * attestation_timestamp: Date.now(),
4208
+ * });
4209
+ *
4210
+ * // Check if proof is finalized
4211
+ * const metadata = await stwo.getProofMetadata(proofHash);
4212
+ * if (metadata.status === 'Verified') {
4213
+ * console.log('Proof verified!');
4214
+ * }
4215
+ * ```
4216
+ */
4217
+ declare class StwoClient {
4218
+ private http;
4219
+ private contract;
4220
+ private config;
4221
+ constructor(http: HttpClient, contract: ContractClient, config: StwoClientConfig);
4222
+ /**
4223
+ * Submit a proof for verification
4224
+ *
4225
+ * @param proofData - Serialized proof data
4226
+ * @param publicInputHash - Hash of public inputs
4227
+ * @returns Proof hash
4228
+ */
4229
+ submitProof(proofData: string[], publicInputHash: bigint): Promise<string>;
4230
+ /**
4231
+ * Verify a submitted proof
4232
+ *
4233
+ * @param proofHash - Hash of the proof
4234
+ * @returns Whether proof is valid
4235
+ */
4236
+ verifyProof(proofHash: string): Promise<boolean>;
4237
+ /**
4238
+ * Submit and verify proof in one operation
4239
+ *
4240
+ * @param proofData - Serialized proof data
4241
+ * @param publicInputHash - Hash of public inputs
4242
+ * @param jobId - Associated job ID
4243
+ * @returns Whether proof was verified
4244
+ */
4245
+ submitAndVerifyProof(proofData: string[], publicInputHash: bigint, jobId: bigint): Promise<boolean>;
4246
+ /**
4247
+ * Get proof metadata
4248
+ *
4249
+ * @param proofHash - Hash of the proof
4250
+ * @returns Proof metadata
4251
+ */
4252
+ getProofMetadata(proofHash: string): Promise<ProofMetadata>;
4253
+ /**
4254
+ * Check if proof is verified
4255
+ *
4256
+ * @param proofHash - Hash of the proof
4257
+ * @returns Whether proof is verified
4258
+ */
4259
+ isProofVerified(proofHash: string): Promise<boolean>;
4260
+ /**
4261
+ * Submit a GPU-TEE proof (optimistic verification)
4262
+ *
4263
+ * @param params - GPU-TEE proof parameters
4264
+ * @returns Proof hash
4265
+ */
4266
+ submitGpuTeeProof(params: GpuTeeProofParams): Promise<string>;
4267
+ /**
4268
+ * Finalize a GPU-TEE proof after challenge window
4269
+ *
4270
+ * @param proofHash - Hash of the proof
4271
+ * @returns Whether finalization succeeded
4272
+ */
4273
+ finalizeGpuTeeProof(proofHash: string): Promise<boolean>;
4274
+ /**
4275
+ * Challenge a GPU-TEE proof with fraud proof
4276
+ *
4277
+ * @param params - Challenge parameters
4278
+ * @returns Transaction result with challenge ID
4279
+ */
4280
+ challengeGpuTeeProof(params: ChallengeParams): Promise<TransactionResult$1>;
4281
+ /**
4282
+ * Get challenge status
4283
+ *
4284
+ * @param challengeId - Challenge ID
4285
+ * @returns Challenge status
4286
+ */
4287
+ getChallengeStatus(challengeId: bigint): Promise<ChallengeStatus>;
4288
+ /**
4289
+ * Check if proof can be finalized
4290
+ *
4291
+ * @param proofHash - Hash of the proof
4292
+ * @returns Finalization status
4293
+ */
4294
+ canFinalizeProof(proofHash: string): Promise<{
4295
+ can_finalize: boolean;
4296
+ reason?: string;
4297
+ time_remaining_secs?: number;
4298
+ }>;
4299
+ /**
4300
+ * Verify multiple proofs in batch
4301
+ *
4302
+ * @param batchHash - Hash identifying the batch
4303
+ * @param proofs - Array of proof data arrays
4304
+ * @returns Whether batch verification succeeded
4305
+ */
4306
+ verifyBatch(batchHash: string, proofs: string[][]): Promise<boolean>;
4307
+ /**
4308
+ * Get batch status
4309
+ *
4310
+ * @param batchId - Batch ID
4311
+ * @returns Batch status
4312
+ */
4313
+ getBatchStatus(batchId: string): Promise<BatchStatus>;
4314
+ /**
4315
+ * Submit proofs for batch verification
4316
+ *
4317
+ * @param proofs - Array of proof submissions
4318
+ * @returns Batch ID
4319
+ */
4320
+ submitBatch(proofs: ProofSubmission[]): Promise<string>;
4321
+ /**
4322
+ * Check if enclave is whitelisted
4323
+ *
4324
+ * @param measurement - Enclave measurement hash
4325
+ * @returns Whether enclave is whitelisted
4326
+ */
4327
+ isEnclaveWhitelisted(measurement: string): Promise<boolean>;
4328
+ /**
4329
+ * Get whitelisted enclaves
4330
+ *
4331
+ * @returns Array of enclave info
4332
+ */
4333
+ getWhitelistedEnclaves(): Promise<EnclaveInfo[]>;
4334
+ /**
4335
+ * Get TEE attestation for a proof
4336
+ *
4337
+ * @param proofHash - Hash of the proof
4338
+ * @returns TEE attestation if available
4339
+ */
4340
+ getTeeAttestation(proofHash: string): Promise<TeeAttestation | null>;
4341
+ /**
4342
+ * Compress proof data
4343
+ *
4344
+ * @param proof - Raw proof data
4345
+ * @param algorithm - Compression algorithm
4346
+ * @returns Compressed proof
4347
+ */
4348
+ compressProof(proof: Uint8Array, algorithm?: 'zstd' | 'lz4' | 'snappy'): Promise<CompressedProof>;
4349
+ /**
4350
+ * Decompress proof data
4351
+ *
4352
+ * @param compressed - Compressed proof
4353
+ * @returns Decompressed proof data
4354
+ */
4355
+ decompressProof(compressed: CompressedProof): Promise<Uint8Array>;
4356
+ /**
4357
+ * Get compression stats for a proof
4358
+ *
4359
+ * @param proofHash - Hash of the proof
4360
+ * @returns Compression statistics
4361
+ */
4362
+ getCompressionStats(proofHash: string): Promise<CompressionStats | null>;
4363
+ /**
4364
+ * Get prover metrics for a worker
4365
+ *
4366
+ * @param workerId - Worker ID
4367
+ * @returns Prover metrics
4368
+ */
4369
+ getProverMetrics(workerId: string): Promise<ProverMetrics>;
4370
+ /**
4371
+ * Get proof leaderboard
4372
+ *
4373
+ * @param limit - Number of entries
4374
+ * @returns Leaderboard entries
4375
+ */
4376
+ getProofLeaderboard(limit?: number): Promise<Array<{
4377
+ rank: number;
4378
+ worker_id: string;
4379
+ verified_proofs: bigint;
4380
+ success_rate_bps: number;
4381
+ total_rewards: bigint;
4382
+ }>>;
4383
+ /**
4384
+ * Get global proof verification statistics
4385
+ *
4386
+ * @returns Verification statistics
4387
+ */
4388
+ getVerificationStats(): Promise<{
4389
+ total_proofs: bigint;
4390
+ verified_proofs: bigint;
4391
+ failed_proofs: bigint;
4392
+ pending_proofs: bigint;
4393
+ total_gas_used: bigint;
4394
+ avg_verification_time_ms: number;
4395
+ standard_proofs: bigint;
4396
+ gpu_tee_proofs: bigint;
4397
+ challenges_submitted: bigint;
4398
+ challenges_upheld: bigint;
4399
+ }>;
4400
+ /**
4401
+ * Get proof history for a job
4402
+ *
4403
+ * @param jobId - Job ID
4404
+ * @returns Array of proof metadata
4405
+ */
4406
+ getJobProofHistory(jobId: bigint): Promise<ProofMetadata[]>;
4407
+ /**
4408
+ * Estimate gas for proof verification
4409
+ *
4410
+ * @param proofSize - Size of proof in bytes
4411
+ * @param isGpuTee - Whether it's a GPU-TEE proof
4412
+ * @returns Estimated gas
4413
+ */
4414
+ estimateVerificationGas(proofSize: number, isGpuTee?: boolean): bigint;
4415
+ /**
4416
+ * Validate proof data before submission
4417
+ *
4418
+ * @param proofData - Proof data to validate
4419
+ * @returns Validation result
4420
+ */
4421
+ validateProofData(proofData: string[]): {
4422
+ valid: boolean;
4423
+ error?: string;
4424
+ };
4425
+ }
4426
+ /**
4427
+ * Create a StwoClient instance
4428
+ */
4429
+ declare function createStwoClient(http: HttpClient, contract: ContractClient, stwoVerifierAddress: string, optimisticTeeAddress?: string, batchVerifierAddress?: string): StwoClient;
4430
+
4431
+ /**
4432
+ * TEE Integration Module
4433
+ * Trusted Execution Environment attestation and verification
4434
+ */
4435
+
4436
+ interface TeeClientConfig {
4437
+ /** Optimistic TEE contract address */
4438
+ optimisticTeeAddress: string;
4439
+ /** TEE Registry contract address */
4440
+ teeRegistryAddress?: string;
4441
+ }
4442
+ /** Transaction result */
4443
+ interface TransactionResult {
4444
+ transaction_hash: string;
4445
+ status: 'pending' | 'accepted' | 'rejected';
4446
+ receipt?: TransactionReceipt;
4447
+ }
4448
+ /** TEE result submission parameters */
4449
+ interface TeeResultParams {
4450
+ /** Job ID */
4451
+ job_id: bigint;
4452
+ /** Output data hash */
4453
+ output_hash: bigint;
4454
+ /** TEE quote */
4455
+ quote: TeeQuote;
4456
+ /** Execution metrics */
4457
+ execution_metrics: ExecutionMetrics;
4458
+ }
4459
+ /** TEE job result */
4460
+ interface TeeJobResult {
4461
+ /** Job ID */
4462
+ job_id: bigint;
4463
+ /** Worker address */
4464
+ worker: string;
4465
+ /** Output hash */
4466
+ output_hash: bigint;
4467
+ /** TEE type used */
4468
+ tee_type: TeeType$1;
4469
+ /** Enclave measurement */
4470
+ enclave_measurement: bigint;
4471
+ /** Status */
4472
+ status: 'Pending' | 'Accepted' | 'Challenged' | 'Finalized' | 'Rejected';
4473
+ /** Submission timestamp */
4474
+ submitted_at: number;
4475
+ /** Finalization timestamp */
4476
+ finalized_at?: number;
4477
+ /** Challenge window end */
4478
+ challenge_window_end: number;
4479
+ /** Challenge ID if challenged */
4480
+ challenge_id?: bigint;
4481
+ }
4482
+ /** TEE challenge parameters */
4483
+ interface TeeChallengeParams {
4484
+ /** Job ID to challenge */
4485
+ job_id: bigint;
4486
+ /** Challenge stake (wei) */
4487
+ stake: bigint;
4488
+ /** Challenge reason */
4489
+ reason: string;
4490
+ /** Evidence data */
4491
+ evidence?: string[];
4492
+ }
4493
+ /** TEE challenge status */
4494
+ interface TeeChallengeStatus {
4495
+ /** Challenge ID */
4496
+ challenge_id: bigint;
4497
+ /** Job ID challenged */
4498
+ job_id: bigint;
4499
+ /** Challenger address */
4500
+ challenger: string;
4501
+ /** Stake amount */
4502
+ stake: bigint;
4503
+ /** Reason */
4504
+ reason: string;
4505
+ /** Status */
4506
+ status: 'Pending' | 'Investigating' | 'Resolved' | 'Rejected';
4507
+ /** Submitted at */
4508
+ submitted_at: number;
4509
+ /** Resolution timestamp */
4510
+ resolved_at?: number;
4511
+ /** Whether challenge was upheld */
4512
+ upheld?: boolean;
4513
+ /** Reward/penalty amount */
4514
+ result_amount?: bigint;
4515
+ }
4516
+ /** GPU attestation details */
4517
+ interface GpuAttestation {
4518
+ /** GPU model */
4519
+ gpu_model: string;
4520
+ /** GPU serial (hashed) */
4521
+ gpu_serial_hash: bigint;
4522
+ /** TEE type */
4523
+ tee_type: TeeType$1;
4524
+ /** Driver version */
4525
+ driver_version: string;
4526
+ /** Firmware hash */
4527
+ firmware_hash: bigint;
4528
+ /** Attestation timestamp */
4529
+ attestation_timestamp: number;
4530
+ /** Expiry timestamp */
4531
+ expiry_timestamp: number;
4532
+ /** Is valid */
4533
+ is_valid: boolean;
4534
+ }
4535
+ /** Worker TEE status */
4536
+ interface WorkerTeeStatus {
4537
+ /** Worker address */
4538
+ worker: string;
4539
+ /** Has valid TEE attestation */
4540
+ has_valid_attestation: boolean;
4541
+ /** TEE types supported */
4542
+ tee_types: TeeType$1[];
4543
+ /** GPU attestations */
4544
+ gpu_attestations: GpuAttestation[];
4545
+ /** Last attestation refresh */
4546
+ last_refresh: number;
4547
+ /** Attestation expiry */
4548
+ attestation_expiry: number;
4549
+ /** Jobs processed with TEE */
4550
+ tee_jobs_count: bigint;
4551
+ /** TEE failure rate (basis points) */
4552
+ failure_rate_bps: number;
4553
+ }
4554
+ /**
4555
+ * TEE Integration Client
4556
+ *
4557
+ * Manages Trusted Execution Environment operations including:
4558
+ * - TEE result submission and verification
4559
+ * - Challenge and dispute mechanisms
4560
+ * - Enclave attestation management
4561
+ * - GPU TEE (H100/H200/B200) support
4562
+ * - Worker TEE status tracking
4563
+ *
4564
+ * @example
4565
+ * ```typescript
4566
+ * const tee = new TeeClient(httpClient, contractClient, config);
4567
+ *
4568
+ * // Submit TEE result for a job
4569
+ * await tee.submitTeeResult({
4570
+ * job_id: jobId,
4571
+ * output_hash: outputHash,
4572
+ * quote: {
4573
+ * quote_data: quoteBytes,
4574
+ * enclave_measurement: measurement,
4575
+ * timestamp: Date.now(),
4576
+ * claims: {},
4577
+ * },
4578
+ * execution_metrics: {
4579
+ * cpu_cycles: 1000000n,
4580
+ * memory_peak: 1024n * 1024n * 1024n,
4581
+ * execution_time_ms: 5000,
4582
+ * },
4583
+ * });
4584
+ *
4585
+ * // Verify enclave attestation
4586
+ * const isValid = await tee.verifyEnclaveAttestation(measurement);
4587
+ *
4588
+ * // Check worker TEE status
4589
+ * const status = await tee.getWorkerTeeStatus(workerAddress);
4590
+ * ```
4591
+ */
4592
+ declare class TeeClient {
4593
+ private http;
4594
+ private contract;
4595
+ private config;
4596
+ constructor(http: HttpClient, contract: ContractClient, config: TeeClientConfig);
4597
+ /**
4598
+ * Submit TEE execution result
4599
+ *
4600
+ * @param params - TEE result parameters
4601
+ * @returns Transaction result
4602
+ */
4603
+ submitTeeResult(params: TeeResultParams): Promise<TransactionResult>;
4604
+ /**
4605
+ * Get TEE result for a job
4606
+ *
4607
+ * @param jobId - Job ID
4608
+ * @returns TEE job result
4609
+ */
4610
+ getTeeResult(jobId: bigint): Promise<TeeJobResult | null>;
4611
+ /**
4612
+ * Finalize TEE result after challenge window
4613
+ *
4614
+ * @param jobId - Job ID
4615
+ * @returns Transaction result
4616
+ */
4617
+ finalizeTeeResult(jobId: bigint): Promise<TransactionResult>;
4618
+ /**
4619
+ * Check if TEE result can be finalized
4620
+ *
4621
+ * @param jobId - Job ID
4622
+ * @returns Finalization status
4623
+ */
4624
+ canFinalizeTeeResult(jobId: bigint): Promise<{
4625
+ can_finalize: boolean;
4626
+ reason?: string;
4627
+ time_remaining_secs?: number;
4628
+ }>;
4629
+ /**
4630
+ * Challenge a TEE result
4631
+ *
4632
+ * @param params - Challenge parameters
4633
+ * @returns Transaction result with challenge ID
4634
+ */
4635
+ challengeTeeResult(params: TeeChallengeParams): Promise<TransactionResult>;
4636
+ /**
4637
+ * Get challenge status
4638
+ *
4639
+ * @param challengeId - Challenge ID
4640
+ * @returns Challenge status
4641
+ */
4642
+ getChallengeStatus(challengeId: bigint): Promise<TeeChallengeStatus>;
4643
+ /**
4644
+ * Get challenges for a job
4645
+ *
4646
+ * @param jobId - Job ID
4647
+ * @returns Array of challenges
4648
+ */
4649
+ getJobChallenges(jobId: bigint): Promise<TeeChallengeStatus[]>;
4650
+ /**
4651
+ * Verify enclave attestation
4652
+ *
4653
+ * @param measurement - Enclave measurement hash
4654
+ * @returns Whether attestation is valid
4655
+ */
4656
+ verifyEnclaveAttestation(measurement: string): Promise<boolean>;
4657
+ /**
4658
+ * Get enclave info
4659
+ *
4660
+ * @param measurement - Enclave measurement
4661
+ * @returns Enclave info or null
4662
+ */
4663
+ getEnclaveInfo(measurement: string): Promise<EnclaveInfo | null>;
4664
+ /**
4665
+ * Get all whitelisted enclaves
4666
+ *
4667
+ * @returns Array of enclave info
4668
+ */
4669
+ getWhitelistedEnclaves(): Promise<EnclaveInfo[]>;
4670
+ /**
4671
+ * Submit GPU attestation for worker
4672
+ *
4673
+ * @param attestation - GPU attestation data
4674
+ * @returns Transaction result
4675
+ */
4676
+ submitGpuAttestation(attestation: GpuAttestation): Promise<TransactionResult>;
4677
+ /**
4678
+ * Refresh worker TEE attestation
4679
+ *
4680
+ * @returns Transaction result
4681
+ */
4682
+ refreshAttestation(): Promise<TransactionResult>;
4683
+ /**
4684
+ * Get worker TEE status
4685
+ *
4686
+ * @param workerAddress - Worker address
4687
+ * @returns Worker TEE status
4688
+ */
4689
+ getWorkerTeeStatus(workerAddress: string): Promise<WorkerTeeStatus>;
4690
+ /**
4691
+ * Get workers with valid TEE attestation
4692
+ *
4693
+ * @param teeType - Optional TEE type filter
4694
+ * @returns Array of worker addresses
4695
+ */
4696
+ getTeeEnabledWorkers(teeType?: TeeType$1): Promise<string[]>;
4697
+ /**
4698
+ * Get TEE statistics
4699
+ *
4700
+ * @returns TEE statistics
4701
+ */
4702
+ getTeeStats(): Promise<{
4703
+ total_tee_jobs: bigint;
4704
+ finalized_jobs: bigint;
4705
+ challenged_jobs: bigint;
4706
+ challenge_success_rate_bps: number;
4707
+ avg_finalization_time_secs: number;
4708
+ workers_with_tee: number;
4709
+ tee_type_breakdown: Record<TeeType$1, number>;
4710
+ }>;
4711
+ /**
4712
+ * Get TEE job history for worker
4713
+ *
4714
+ * @param workerAddress - Worker address
4715
+ * @param limit - Number of jobs
4716
+ * @returns Array of TEE job results
4717
+ */
4718
+ getWorkerTeeHistory(workerAddress: string, limit?: number): Promise<TeeJobResult[]>;
4719
+ /**
4720
+ * Check if TEE type is supported
4721
+ *
4722
+ * @param teeType - TEE type to check
4723
+ * @returns Whether TEE type is supported
4724
+ */
4725
+ isTeeTypeSupported(teeType: TeeType$1): boolean;
4726
+ /**
4727
+ * Get TEE type display name
4728
+ *
4729
+ * @param teeType - TEE type
4730
+ * @returns Display name
4731
+ */
4732
+ getTeeTypeDisplayName(teeType: TeeType$1): string;
4733
+ /**
4734
+ * Calculate challenge window end
4735
+ *
4736
+ * @param submittedAt - Submission timestamp
4737
+ * @param windowSecs - Challenge window duration (default 24h)
4738
+ * @returns Challenge window end timestamp
4739
+ */
4740
+ calculateChallengeWindowEnd(submittedAt: number, windowSecs?: number): number;
4741
+ private teeTypeToFelt;
4742
+ private getTeeTypeFromQuote;
4743
+ }
4744
+ /**
4745
+ * Create a TeeClient instance
4746
+ */
4747
+ declare function createTeeClient(http: HttpClient, contract: ContractClient, optimisticTeeAddress: string, teeRegistryAddress?: string): TeeClient;
4748
+
4749
+ export { type TransactionReceipt as $, type AEHint as A, BitSageClient as B, type ClientConfig as C, DEFAULT_CONFIG as D, type ECPoint as E, type FaucetStatus as F, type GpuTier$1 as G, HttpClient as H, ContractClient as I, type JobId as J, DEFAULT_CONTRACT_CONFIG as K, type ListJobsParams as L, toFelt as M, type Network$1 as N, fromFelt as O, type PrivacyKeyPair as P, splitU256 as Q, joinU256 as R, type SchnorrProof as S, type TransferProof as T, type HttpConfig as U, type JobUpdateEvent as V, type WsConfig as W, type WorkerUpdateEvent as X, type NetworkStatsEvent as Y, type ProofVerifiedEvent as Z, type ContractConfig as _, WebSocketClient as a, type TransactionResult$5 as a$, type TxStatus as a0, SEPOLIA_CONTRACTS as a1, MAINNET_CONTRACTS as a2, LOCAL_CONTRACTS as a3, getContractsForNetwork as a4, isContractConfigured as a5, SEPOLIA_TOKENS as a6, MAINNET_TOKENS as a7, getTokensForNetwork as a8, PRAGMA_ORACLE as a9, StwoClient as aA, createStwoClient as aB, VERIFICATION_CONFIG as aC, TeeClient as aD, createTeeClient as aE, type MiningClientConfig as aF, type ValidatorStatus as aG, type ValidatorStatusResponse as aH, type GpuMetrics as aI, type GpuMetricsResponse as aJ, type RewardsInfo as aK, type HistoryPeriod as aL, type RewardHistoryEntry as aM, type RewardHistoryResponse as aN, type JobAnalytics as aO, type RecentJob as aP, type WorkerSummary as aQ, type NetworkWorkersResponse as aR, type BatchJobResponse as aS, type BatchStatusResponse as aT, type BatchOperationType as aU, type BatchOperation as aV, type GasEstimate as aW, type BatchVerifyRequest as aX, type BatchVerifyResponse as aY, type PaymentsClientConfig as aZ, type StakingClientConfig as a_, type ContractRegistry as aa, type ExternalTokens as ab, MiningClient as ac, createMiningClient as ad, DashboardClient as ae, createDashboardClient as af, BatchClient as ag, createBatchClient as ah, MAX_BATCH_SIZE as ai, PaymentsClient as aj, createPaymentsClient as ak, StakingClient as al, createStakingClient as am, MIN_STAKE as an, SLASH_PERCENTAGES as ao, UNSTAKE_LOCKUP_SECS as ap, isWorkerEligible as aq, getMinStakeForTier as ar, WorkersClient as as, createWorkersClient as at, CAPABILITY_FLAGS as au, PrivacyClient as av, createPrivacyClient as aw, GovernanceClient as ax, createGovernanceClient as ay, GOVERNANCE_CONFIG as az, type WsEvent as b, type ProofType as b$, type TeeType as b0, type WorkerTier as b1, type HolderTier as b2, type SlashReason as b3, type WorkerStake as b4, type StakingConfig as b5, type SlashRecord as b6, type DisputeRecord as b7, type WorkerTierBenefits as b8, type UnstakeRequest as b9, type ProposalType as bA, type GovernanceProposal as bB, type GovernanceRights as bC, type GovernanceStats as bD, type PoolBalances as bE, type VestingStatus as bF, type SecurityBudget as bG, type BurnEvent as bH, type EcosystemEmissionStatus as bI, type TokenFlowSummary as bJ, type MilestoneStatus as bK, type RateLimitInfo as bL, type PendingTransfer as bM, type CreateProposalParams as bN, type VoteDirection as bO, type DelegationInfo as bP, type VoterInfo as bQ, type StwoClientConfig as bR, type TransactionResult$1 as bS, type VerificationStatus as bT, type ProofSource as bU, type TeeType$1 as bV, type TeeAttestation as bW, type ProofMetadata as bX, type GpuTeeProofParams as bY, type BatchStatus as bZ, type ProofJobSpec as b_, type WorkersClientConfig as ba, type TransactionResult$4 as bb, type WorkerCapabilities as bc, type WorkerProfile as bd, type PerformanceData as be, type LeaderboardMetric as bf, type LeaderboardEntry as bg, type RegisterWorkerParams as bh, type PrivacyClientConfig as bi, type TransactionResult$3 as bj, type PrivacyAsset as bk, type PrivateAccount as bl, type PrivateTransferParams as bm, type PrivateTransferWithAuditParams as bn, type SteganographicTransaction as bo, type MixingTransaction as bp, type MixingOutput as bq, type RagequitProof as br, type DKGShare as bs, type ThresholdDecryptionRequest as bt, type MultiAssetBalances as bu, type PrivateSwapParams as bv, type StealthAddress as bw, type GovernanceClientConfig as bx, type TransactionResult$2 as by, type ProposalStatus as bz, type ElGamalCiphertext as c, type ProofPriority as c0, type ProofSubmission as c1, type ProverMetrics as c2, type CompressionStats as c3, type CompressedProof as c4, type EnclaveInfo as c5, type ChallengeParams as c6, type ChallengeStatus as c7, type TeeClientConfig as c8, type TransactionResult as c9, type AuditReport as cA, type PrivateWorkerPayment as cB, type PaymentToken as cC, type PaymentQuote as cD, type DiscountTiers as cE, type FeeDistribution as cF, type OTCConfig as cG, type PaymentStats as cH, type JobPaymentRecord as cI, type PaymentStatus as cJ, type VerificationSource as cK, type ComputeCheckpoint as cL, type CheckpointStatus as cM, type PrivacyCreditDeposit as cN, type PrivacyCreditUsage as cO, type TransactionResult$6 as cP, DEFAULT_DISCOUNT_TIERS as cQ, DEFAULT_FEE_DISTRIBUTION as cR, type DisputeStatus as cS, type TeeQuote as cT, type ExecutionMetrics as cU, type GpuTier as cV, type StakeInfo as cW, type WorkerInfo as cX, type NetworkStats as cY, type TeeResultParams as ca, type TeeJobResult as cb, type TeeChallengeParams as cc, type TeeChallengeStatus as cd, type GpuAttestation as ce, type WorkerTeeStatus as cf, type StakeTier as cg, type DailyStats as ch, type WorkerMiningStats as ci, type MiningPoolStatus as cj, type MiningConfig as ck, type RewardResult as cl, type MiningGpuTier as cm, STAKE_TIER_THRESHOLDS as cn, DAILY_CAPS as co, GPU_MULTIPLIERS as cp, HALVENING_SCHEDULE as cq, getStakeTierFromAmount as cr, getDailyCapForTier as cs, getGpuMultiplier as ct, type RangeProof as cu, type SameEncryption3Proof as cv, type AccountHints as cw, type RingMember as cx, type RingSignature as cy, type MultiAssetBalance as cz, type EncryptedBalance as d, SdkError as e, type WalletConfig as f, type WorkerId as g, type JobType as h, type JobStatus as i, type WorkerStatus$1 as j, type ProofVerificationStatus as k, type WorkerCapabilities$1 as l, type WorkerInfo$1 as m, type ProofDetails as n, type NetworkStats$1 as o, type StakeInfo$1 as p, type SubmitJobRequest as q, type SubmitJobResponse as r, type JobStatusResponse as s, type JobResult as t, type ListJobsResponse as u, type FaucetClaimResponse as v, getMinStake as w, getGpuTier as x, DEFAULT_HTTP_CONFIG as y, DEFAULT_WS_CONFIG as z };