@glowlabs-org/utils 0.2.3 → 0.2.4

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,153 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Common / Shared Types
3
+ // ---------------------------------------------------------------------------
4
+
5
+ // ----------------------------- Control-API ----------------------------------
6
+ export interface MintedEvent {
7
+ txId: string;
8
+ epoch: number;
9
+ wallet: string;
10
+ amountRaw: string;
11
+ currency: string;
12
+ gctlMinted: string;
13
+ ts: string; // ISO date string
14
+ }
15
+
16
+ export interface StakedEvent {
17
+ id: string;
18
+ epoch: number;
19
+ wallet: string;
20
+ regionId: number;
21
+ amount: string;
22
+ direction: "stake" | "unstake";
23
+ ts: string; // ISO date string
24
+ }
25
+
26
+ export interface PendingTransfer {
27
+ txId: string;
28
+ wallet: string;
29
+ amountRaw: string;
30
+ type: string;
31
+ currency: string;
32
+ status: string;
33
+ ts: string; // ISO date string
34
+ applicationId?: string;
35
+ farmId?: string;
36
+ regionId?: number;
37
+ }
38
+
39
+ export interface TransferDetails extends PendingTransfer {
40
+ blockNumber: string;
41
+ failureInfo?: {
42
+ failureType: string;
43
+ errorMessage: string;
44
+ errorDetails?: string;
45
+ isRetryable: boolean;
46
+ retryCount: number;
47
+ lastRetryAt?: string; // ISO date string
48
+ };
49
+ }
50
+
51
+ export interface FailedOperation {
52
+ id: string;
53
+ txId: string;
54
+ operation: string;
55
+ failureType: string;
56
+ errorMessage: string;
57
+ errorDetails?: string;
58
+ isRetryable: string;
59
+ retryCount: number;
60
+ lastRetryAt?: string; // ISO date string
61
+ resolvedAt?: string; // ISO date string
62
+ wallet?: string;
63
+ amountRaw?: string;
64
+ currency?: string;
65
+ createdAt: string; // ISO date string
66
+ updatedAt: string; // ISO date string
67
+ }
68
+
69
+ export interface GctlPrice {
70
+ currentPriceUsdc: number;
71
+ }
72
+
73
+ export interface StakeRequest {
74
+ wallet: string;
75
+ regionId: number;
76
+ amount: string; // Amount in atomic units (10^6 = 1 GCTL)
77
+ }
78
+
79
+ export interface RegionStake {
80
+ regionId: number;
81
+ currentGctlStake: string;
82
+ }
83
+
84
+ export interface WalletRegionStake {
85
+ wallet: string;
86
+ regionId: number;
87
+ currentGctlStake: string;
88
+ }
89
+
90
+ export interface WalletRegionUnlocked {
91
+ wallet: string;
92
+ regionId: number;
93
+ unlocked: string;
94
+ }
95
+
96
+ // ----------------------------- Regions --------------------------------------
97
+ // A superset of fields coming from both control-api regions and regions-service.
98
+ export interface Region {
99
+ id: number;
100
+ name: string;
101
+
102
+ // Optional metadata
103
+ flag?: string;
104
+ isUs?: boolean;
105
+
106
+ // Activation / status
107
+ isActive: boolean;
108
+
109
+ // Stake / GCTL info
110
+ currentGctlStake?: string; // value from control-api
111
+ stake?: string; // aggregated current stake
112
+ stakeProgress?: number;
113
+
114
+ // Solar farm info
115
+ solarFarmCount: number;
116
+ solarFarmProgress?: number;
117
+
118
+ // Installer info
119
+ installerCount?: number;
120
+ installerProgress?: number;
121
+ }
122
+
123
+ export interface RegionWithMetadata extends Region {
124
+ code: string;
125
+ description?: string;
126
+ }
127
+
128
+ export interface ActivationConfig {
129
+ duration: number; // number of days
130
+ minimumAmountOfGCTL: number;
131
+ minimumAmountOfFarms: number;
132
+ minimumAmountOfInstallers: number;
133
+ }
134
+
135
+ export interface CreateRegionPayload {
136
+ code: string;
137
+ name: string;
138
+ isUs: boolean;
139
+ }
140
+
141
+ // ----------------------------- Region Metadata -----------------------------
142
+ export interface RegionMetadata {
143
+ code: string;
144
+ name: string;
145
+ description: string;
146
+ isUs: boolean;
147
+ flag?: string;
148
+ }
149
+
150
+ // ---------------------------------------------------------------------------
151
+ // Barrel exports (convenience)
152
+ // ---------------------------------------------------------------------------
153
+ export type { MintedEvent as ControlMintedEvent };