@glowlabs-org/utils 0.2.150 → 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-CMpG0RGM.js → farms-router-DWSaZD1T.js} +30 -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/types/index.d.ts +15 -12
- package/dist/esm/browser.js +2 -2
- package/dist/esm/{farms-router-wk3VSuCV.js → farms-router-Cpy_o4_u.js} +30 -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/types/index.d.ts +15 -12
- package/package.json +1 -1
- package/src/lib/control-api/control-router.ts +53 -8
- package/src/lib/control-api/region-router.ts +53 -0
- package/src/lib/types/index.ts +17 -12
- package/dist/cjs/farms-router-CMpG0RGM.js.map +0 -1
- package/dist/esm/farms-router-wk3VSuCV.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,
|
|
@@ -4264,4 +4291,4 @@ exports.useForwarder = useForwarder;
|
|
|
4264
4291
|
exports.useOffchainFractions = useOffchainFractions;
|
|
4265
4292
|
exports.waitForEthersTransactionWithRetry = waitForEthersTransactionWithRetry;
|
|
4266
4293
|
exports.waitForViemTransactionWithRetry = waitForViemTransactionWithRetry;
|
|
4267
|
-
//# sourceMappingURL=farms-router-
|
|
4294
|
+
//# sourceMappingURL=farms-router-DWSaZD1T.js.map
|