Skip to content

Commit cf4ca60

Browse files
authored
Merge pull request #11 from oasisprotocol/ptrus/feature/year-2026
Set 2025 epochs, and add 2026 support
2 parents f85740a + 7089079 commit cf4ca60

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

.changelog/11.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Set 2025 epochs, and add 2026 support

src/fetchStakingRewards.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ const fetchBlockTimestamp = async (NEXUS_API, height) => {
8080
// Hardcoded epoch ranges for supported years.
8181
// These values are fixed for completed years and won't change.
8282
// 2024: epoch 28809 (Jan 1 2024 01:58:02 UTC) -> epoch 37689 (Dec 31 2024 23:24:20 UTC)
83-
// 2025: epoch 37690 (Jan 1 2025 00:23:11 UTC) -> ongoing (fetches latest epoch)
83+
// 2025: epoch 37690 (Jan 1 2025 00:23:11 UTC) -> epoch 46647 (Dec 31 2025 23:52:19 UTC)
84+
// 2026: epoch 46648 (Jan 1 2026 00:51:10 UTC) -> ongoing (fetches latest epoch)
8485
const EPOCH_RANGES = {
8586
2024: { startEpoch: 28808, endEpoch: 37690 },
86-
2025: { startEpoch: 37690, endEpoch: null }, // endEpoch fetched dynamically
87+
2025: { startEpoch: 37690, endEpoch: 46648 },
88+
2026: { startEpoch: 46648, endEpoch: null }, // endEpoch fetched dynamically
8789
};
8890

8991
// Hardcoded month boundary epochs (first epoch on or after 1st of each month ~00:00 UTC)
@@ -118,7 +120,12 @@ const MONTH_EPOCHS_2025 = {
118120
10: 44393, // Oct 1 2025 (actual: 2025-10-01T00:13:04Z)
119121
11: 45155, // Nov 1 2025 (actual: 2025-11-01T00:55:48Z)
120122
12: 45889, // Dec 1 2025 (actual: 2025-12-01T00:16:34Z)
121-
// Month 13 (Jan 1 2026) will be added when available
123+
13: 46648, // End of 2025 / Jan 1 2026 (actual: 2026-01-01T00:51:10Z)
124+
};
125+
126+
const MONTH_EPOCHS_2026 = {
127+
1: 46648, // Jan 1 2026 (actual: 2026-01-01T00:51:10Z)
128+
// Remaining months will be added as they become available
122129
};
123130

124131
/**
@@ -378,7 +385,8 @@ export const fetchStakingRewards = async (NEXUS_API, address, year, granularity,
378385
epochsToProcess.push(endEpoch);
379386
} else {
380387
// Monthly: use hardcoded month boundary epochs for accurate calendar alignment
381-
const monthEpochs = year === 2024 ? MONTH_EPOCHS_2024 : MONTH_EPOCHS_2025;
388+
const monthEpochs =
389+
year === 2024 ? MONTH_EPOCHS_2024 : year === 2025 ? MONTH_EPOCHS_2025 : MONTH_EPOCHS_2026;
382390

383391
// Add month boundaries from 2 to 13 (month 1 is the baseline/start)
384392
for (let m = 2; m <= 13; m++) {
@@ -388,7 +396,7 @@ export const fetchStakingRewards = async (NEXUS_API, address, year, granularity,
388396
}
389397
}
390398

391-
// For 2025 or incomplete years, ensure we include the current endEpoch if not already
399+
// For incomplete years (2026+), ensure we include the current endEpoch if not already
392400
if (epochsToProcess.length === 0 || epochsToProcess[epochsToProcess.length - 1] < endEpoch) {
393401
epochsToProcess.push(endEpoch);
394402
}

src/pages/AccountingEvents.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const AccountingEvents = () => {
191191
outline: "none",
192192
}}
193193
>
194+
<option value="2026">2026</option>
194195
<option value="2025">2025</option>
195196
<option value="2024">2024</option>
196197
</select>

src/pages/StakingRewards.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const StakingRewards = () => {
168168
boxSizing: "border-box",
169169
}}
170170
>
171+
<option value="2026">2026</option>
171172
<option value="2025">2025</option>
172173
<option value="2024">2024</option>
173174
</select>

0 commit comments

Comments
 (0)