@glowlabs-org/utils 0.1.2 → 0.1.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.
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/create-weekly-report/index.d.ts +3 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +3 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/create-weekly-report/index.d.ts +3 -2
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/lib/create-weekly-report/index.ts +6 -15
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
@@ -18897,9 +18897,6 @@ async function createWeeklyReportLegacy(args) {
|
|
18897
18897
|
};
|
18898
18898
|
}
|
18899
18899
|
async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
|
18900
|
-
if (week < 72) {
|
18901
|
-
return createWeeklyReportLegacy({ week, gcaUrls, apiUrl });
|
18902
|
-
}
|
18903
18900
|
const map = new Map();
|
18904
18901
|
const [apiResponse, auditsRes] = await Promise.all([
|
18905
18902
|
fetchFarmsForWeek(week, gcaUrls, apiUrl),
|
@@ -18923,11 +18920,6 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
|
|
18923
18920
|
for (const sid of activeShortIds)
|
18924
18921
|
shortIdToAdjustedCredit.set(String(sid), splitBigInt);
|
18925
18922
|
}
|
18926
|
-
const farmShortIds = new Set(farms.map((f) => String(f.shortId)));
|
18927
|
-
audits.forEach((audit) => audit.activeShortIds?.forEach((sid) => {
|
18928
|
-
if (!farmShortIds.has(String(sid)))
|
18929
|
-
throw new Error(`activeShortId ${sid} from audit ${audit.id} missing in filteredFarms`);
|
18930
|
-
}));
|
18931
18923
|
let totalCreditsProduced18dp = BigInt(0);
|
18932
18924
|
for (const farm of farms) {
|
18933
18925
|
if (farm.status === "Unassigned") {
|
@@ -18949,6 +18941,8 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
|
|
18949
18941
|
throw new Error(`USDG splits ≠1 for farm ${farm.shortId}`);
|
18950
18942
|
const glowBase = viem.parseUnits(customToFixed(farm.weeklyPayment, GLOW_WEIGHT_DECIMAL_PRECISION), GLOW_WEIGHT_DECIMAL_PRECISION);
|
18951
18943
|
const adjustedCreditBigInt = shortIdToAdjustedCredit.get(String(farm.shortId)) ?? BigInt(0);
|
18944
|
+
if (adjustedCreditBigInt <= BigInt(0))
|
18945
|
+
throw new Error(`Adjusted credit is less than or equal to 0 for farm ${farm.shortId}`);
|
18952
18946
|
for (const split of farm.rewardSplits) {
|
18953
18947
|
const glowWeight = multiplyBigIntByDecimalPercentage(glowBase, GLOW_WEIGHT_DECIMAL_PRECISION, split.glowSplitPercent);
|
18954
18948
|
const usdgWeight = multiplyBigIntByDecimalPercentage(adjustedCreditBigInt, USDG_WEIGHT_DECIMAL_PRECISION, split.usdgSplitPercent);
|
@@ -19088,4 +19082,5 @@ async function createWeeklyReport({ week, gcaUrls, apiUrl, }) {
|
|
19088
19082
|
|
19089
19083
|
exports.GENESIS_TIMESTAMP = GENESIS_TIMESTAMP;
|
19090
19084
|
exports.createWeeklyReport = createWeeklyReport;
|
19085
|
+
exports.createWeeklyReportLegacy = createWeeklyReportLegacy;
|
19091
19086
|
//# sourceMappingURL=index.js.map
|