@glowlabs-org/utils 0.2.149 → 0.2.151
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/browser.js +1 -1
- package/dist/cjs/{farms-router-JTY1pnmX.js → farms-router-DWSaZD1T.js} +52 -3
- package/dist/cjs/farms-router-DWSaZD1T.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/control-router.d.ts +4 -2
- package/dist/cjs/lib/control-api/region-router.d.ts +3 -1
- package/dist/cjs/lib/types/index.d.ts +50 -0
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-C2Pkoecj.js → farms-router-Cpy_o4_u.js} +52 -3
- package/dist/esm/farms-router-Cpy_o4_u.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/control-router.d.ts +4 -2
- package/dist/esm/lib/control-api/region-router.d.ts +3 -1
- package/dist/esm/lib/types/index.d.ts +50 -0
- package/package.json +1 -1
- package/src/lib/control-api/control-router.ts +53 -8
- package/src/lib/control-api/region-router.ts +86 -0
- package/src/lib/types/index.ts +57 -0
- package/dist/cjs/farms-router-JTY1pnmX.js.map +0 -1
- package/dist/esm/farms-router-C2Pkoecj.js.map +0 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -2586,6 +2586,9 @@ function parseApiError$4(error) {
|
|
|
2586
2586
|
// Public Factory
|
|
2587
2587
|
// --------------------------------------------------------------------------
|
|
2588
2588
|
function ControlRouter(baseUrl) {
|
|
2589
|
+
if (!baseUrl) {
|
|
2590
|
+
throw new Error("CONTROL API base URL is not set");
|
|
2591
|
+
}
|
|
2589
2592
|
// ----------------------- Internal helpers --------------------------------
|
|
2590
2593
|
const request = async (path, init) => {
|
|
2591
2594
|
const res = await fetch(`${baseUrl}${path}`, init);
|
|
@@ -2650,6 +2653,15 @@ function ControlRouter(baseUrl) {
|
|
|
2650
2653
|
throw new Error(parseApiError$4(error));
|
|
2651
2654
|
}
|
|
2652
2655
|
};
|
|
2656
|
+
const fetchHoldersCount = async () => {
|
|
2657
|
+
try {
|
|
2658
|
+
const data = await request(`/holders/count`);
|
|
2659
|
+
return data.holders;
|
|
2660
|
+
}
|
|
2661
|
+
catch (error) {
|
|
2662
|
+
throw new Error(parseApiError$4(error));
|
|
2663
|
+
}
|
|
2664
|
+
};
|
|
2653
2665
|
// Build pagination query helper
|
|
2654
2666
|
const buildPaginationQuery = (page, limit) => {
|
|
2655
2667
|
const p = page ?? 1;
|
|
@@ -2713,6 +2725,19 @@ function ControlRouter(baseUrl) {
|
|
|
2713
2725
|
throw new Error(parseApiError$4(error));
|
|
2714
2726
|
}
|
|
2715
2727
|
};
|
|
2728
|
+
const fetchFarmRewardSplits = async (farmId) => {
|
|
2729
|
+
try {
|
|
2730
|
+
if (!farmId)
|
|
2731
|
+
throw new Error("Farm ID is required");
|
|
2732
|
+
const data = await request(`/farms/${encodeURIComponent(farmId)}/reward-splits`);
|
|
2733
|
+
if ("error" in data)
|
|
2734
|
+
throw new Error(data.error);
|
|
2735
|
+
return data.rewardSplits ?? [];
|
|
2736
|
+
}
|
|
2737
|
+
catch (error) {
|
|
2738
|
+
throw new Error(parseApiError$4(error));
|
|
2739
|
+
}
|
|
2740
|
+
};
|
|
2716
2741
|
// Exposed query with error parsing
|
|
2717
2742
|
const getTransferDetails = async (txId) => {
|
|
2718
2743
|
try {
|
|
@@ -2877,11 +2902,11 @@ function ControlRouter(baseUrl) {
|
|
|
2877
2902
|
level: "info",
|
|
2878
2903
|
data: { baseUrl, operationId },
|
|
2879
2904
|
});
|
|
2880
|
-
await request(`/operations/failed/${operationId}/retry`, {
|
|
2905
|
+
const response = await request(`/operations/failed/${operationId}/retry`, {
|
|
2881
2906
|
method: "POST",
|
|
2882
2907
|
headers: { "Content-Type": "application/json" },
|
|
2883
2908
|
});
|
|
2884
|
-
return
|
|
2909
|
+
return response;
|
|
2885
2910
|
}
|
|
2886
2911
|
catch (error) {
|
|
2887
2912
|
sentryCaptureException(error, {
|
|
@@ -2980,6 +3005,7 @@ function ControlRouter(baseUrl) {
|
|
|
2980
3005
|
fetchGctlPrice,
|
|
2981
3006
|
fetchGlwPrice,
|
|
2982
3007
|
fetchCirculatingSupply,
|
|
3008
|
+
fetchHoldersCount,
|
|
2983
3009
|
fetchLastNonce,
|
|
2984
3010
|
fetchMintedEvents,
|
|
2985
3011
|
fetchStakeEvents,
|
|
@@ -2991,6 +3017,7 @@ function ControlRouter(baseUrl) {
|
|
|
2991
3017
|
fetchWalletRegionCommittedBalance,
|
|
2992
3018
|
fetchTransferDetails: getTransferDetails,
|
|
2993
3019
|
fetchGlwRegionRewards,
|
|
3020
|
+
fetchFarmRewardSplits,
|
|
2994
3021
|
fetchMigrationAmount,
|
|
2995
3022
|
// Mutations
|
|
2996
3023
|
stakeGctl,
|
|
@@ -3787,6 +3814,26 @@ function RegionRouter(baseUrl) {
|
|
|
3787
3814
|
throw new Error(parseApiError$3(error));
|
|
3788
3815
|
}
|
|
3789
3816
|
};
|
|
3817
|
+
const fetchActiveSummary = async () => {
|
|
3818
|
+
try {
|
|
3819
|
+
return await request(`/regions/active/summary`);
|
|
3820
|
+
}
|
|
3821
|
+
catch (error) {
|
|
3822
|
+
throw new Error(parseApiError$3(error));
|
|
3823
|
+
}
|
|
3824
|
+
};
|
|
3825
|
+
const applyInstallerCertification = async (payload) => {
|
|
3826
|
+
try {
|
|
3827
|
+
return await request(`/regions/installers/apply`, {
|
|
3828
|
+
method: "POST",
|
|
3829
|
+
headers: { "Content-Type": "application/json" },
|
|
3830
|
+
body: JSON.stringify(payload),
|
|
3831
|
+
});
|
|
3832
|
+
}
|
|
3833
|
+
catch (error) {
|
|
3834
|
+
throw new Error(parseApiError$3(error));
|
|
3835
|
+
}
|
|
3836
|
+
};
|
|
3790
3837
|
// Kickstarter-related logic moved to kickstarter-router.ts
|
|
3791
3838
|
// -------------------------------------------------------------------------
|
|
3792
3839
|
// Helpers (derived)
|
|
@@ -3834,7 +3881,9 @@ function RegionRouter(baseUrl) {
|
|
|
3834
3881
|
fetchActivationEvents,
|
|
3835
3882
|
fetchRegionByIdOrSlug,
|
|
3836
3883
|
fetchRegionSolarFarms,
|
|
3884
|
+
fetchActiveSummary,
|
|
3837
3885
|
getRegionByCode,
|
|
3886
|
+
applyInstallerCertification,
|
|
3838
3887
|
// Cached data & flags
|
|
3839
3888
|
get regions() {
|
|
3840
3889
|
return cachedRegions;
|
|
@@ -4242,4 +4291,4 @@ exports.useForwarder = useForwarder;
|
|
|
4242
4291
|
exports.useOffchainFractions = useOffchainFractions;
|
|
4243
4292
|
exports.waitForEthersTransactionWithRetry = waitForEthersTransactionWithRetry;
|
|
4244
4293
|
exports.waitForViemTransactionWithRetry = waitForViemTransactionWithRetry;
|
|
4245
|
-
//# sourceMappingURL=farms-router-
|
|
4294
|
+
//# sourceMappingURL=farms-router-DWSaZD1T.js.map
|