@berachain/berajs 0.2.10 → 0.2.12
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/{HoneyConfigProvider-Dkj-_a5x.d.ts → HoneyConfigProvider-COOuDNra.d.ts} +1 -1
- package/dist/actions/clients/exports.d.ts +5 -21
- package/dist/actions/clients/exports.mjs +5 -7
- package/dist/actions/exports.d.ts +117 -31
- package/dist/actions/exports.mjs +36 -25
- package/dist/actions/governance/exports.d.ts +3 -11
- package/dist/actions/server/exports.mjs +2 -2
- package/dist/chunk-4ML4Y6UN.mjs +46 -0
- package/dist/{chunk-7YVNSDXG.mjs → chunk-FGION6F6.mjs} +1 -1
- package/dist/{chunk-3JJLQ2JX.mjs → chunk-MKSFQIKC.mjs} +1 -4
- package/dist/{chunk-ZLTMIFCZ.mjs → chunk-RFJGL4MF.mjs} +3 -3
- package/dist/{chunk-Y6THHG77.mjs → chunk-T43JPYQS.mjs} +1 -1
- package/dist/{chunk-WNBWX23Q.mjs → chunk-W2VODV76.mjs} +7 -10
- package/dist/{chunk-QBBOWFMH.mjs → chunk-XDG26EG6.mjs} +115 -162
- package/dist/{chunk-P5WXXULM.mjs → chunk-YLTWPFCJ.mjs} +3 -18
- package/dist/contexts/exports.d.ts +2 -2
- package/dist/contexts/exports.mjs +6 -4
- package/dist/enum/exports.d.ts +8 -2
- package/dist/errors/exports.mjs +2 -2
- package/dist/{getApolloClient-BcUTGFUb.d.ts → getApolloClient-MWm_iq4u.d.ts} +4 -5
- package/dist/getProposalVotes-DAUrdX2n.d.ts +12 -0
- package/dist/{getValidatorQueuedOperatorAddress-DphU3qhE.d.ts → getValidatorQueuedOperatorAddress-Cc05dlO3.d.ts} +8 -59
- package/dist/{global.d-BuGDKh4k.d.ts → global.d-CR3zicga.d.ts} +3 -10
- package/dist/hooks/exports.d.ts +145 -403
- package/dist/hooks/exports.mjs +496 -755
- package/dist/hooks/governance/exports.d.ts +24 -19
- package/dist/hooks/governance/exports.mjs +43 -53
- package/dist/{pol.d-Dw5SQcRX.d.ts → pol.d-CeRgXBL8.d.ts} +18 -4
- package/dist/types/exports.d.ts +5 -5
- package/dist/{useHoneySwapState-vFmuFF0g.d.ts → useHoneySwapState-twi7NTaO.d.ts} +1 -1
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +6 -2
- package/package.json +8 -7
- package/src/actions/bend/getMaxDeposit.ts +28 -2
- package/src/actions/clients/exports.ts +0 -1
- package/src/actions/clients/fetchBeep.ts +0 -7
- package/src/actions/clients/fetchOpenApi.ts +10 -6
- package/src/actions/clients/fetchOpenApi.unit.test.ts +20 -14
- package/src/actions/clients/getApolloClient.ts +4 -9
- package/src/actions/exports.ts +1 -1
- package/src/actions/honey/getChartData.ts +14 -14
- package/src/actions/honey/getHoney24hVolume.ts +17 -8
- package/src/actions/honey/getHoneyTxns.ts +45 -0
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +3 -3
- package/src/actions/pol/getEarnedStakedBeraVault.ts +0 -15
- package/src/actions/pol/getGlobalData.ts +10 -29
- package/src/actions/pol/getRewardVaults.ts +4 -4
- package/src/actions/pol/getSWBeraVaultMetadata.ts +0 -7
- package/src/actions/pol/getStakingDailyAssets.ts +0 -14
- package/src/actions/validators/getApiEnrichedAllocation.ts +1 -1
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +43 -13
- package/src/contexts/SwrFallback.tsx +2 -1
- package/src/data/contracts.ts +4 -0
- package/src/errors/RequestError.ts +3 -3
- package/src/errors/getRevertReason.integration.test.ts +5 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +3 -11
- package/src/hooks/dex/useAggregatorsQuotes.ts +13 -11
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -7
- package/src/hooks/dex/useAllUserPools.ts +8 -13
- package/src/hooks/dex/useApiPool.ts +2 -9
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -2
- package/src/hooks/dex/useOnChainPoolData.ts +3 -4
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +3 -9
- package/src/hooks/dex/usePoolEvents.ts +1 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +3 -9
- package/src/hooks/dex/usePools.ts +6 -4
- package/src/hooks/dex/useSingleAggregatorQuote.ts +6 -18
- package/src/hooks/enso/useBendDemultiply.ts +3 -4
- package/src/hooks/enso/useBendMultiply.ts +3 -4
- package/src/hooks/enso/useBendZapSupply.ts +4 -5
- package/src/hooks/enso/useEnsoSwapBundle.ts +2 -2
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +4 -10
- package/src/hooks/enso/useEnsoWalletV2Address.ts +1 -1
- package/src/hooks/enso/useIsBendAuthorized.ts +1 -1
- package/src/hooks/enso/useZapStakeBera.ts +2 -5
- package/src/hooks/exports.ts +1 -0
- package/src/hooks/governance/useGetPastVotes.ts +1 -1
- package/src/hooks/governance/useHasVoted.ts +1 -1
- package/src/hooks/governance/useIsCanceller.ts +1 -1
- package/src/hooks/governance/usePollAllProposals.ts +13 -12
- package/src/hooks/governance/usePollProposal.ts +7 -10
- package/src/hooks/governance/usePollProposalThreshold.ts +2 -7
- package/src/hooks/governance/usePollProposalVotes.ts +23 -5
- package/src/hooks/governance/usePollUserDelegates.ts +4 -9
- package/src/hooks/governance/useProposalFromTx.ts +4 -5
- package/src/hooks/governance/useProposalSnapshot.ts +3 -4
- package/src/hooks/governance/useProposalState.ts +3 -3
- package/src/hooks/governance/useProposalTimelockState.ts +3 -2
- package/src/hooks/governance/useQuorum.ts +1 -2
- package/src/hooks/honey/useCappedGlobally.ts +4 -12
- package/src/hooks/honey/useCappedRelatively.ts +3 -8
- package/src/hooks/honey/useCollateralWeights.ts +4 -9
- package/src/hooks/honey/useHoney24hVolume.ts +2 -6
- package/src/hooks/honey/useHoneyBalances.ts +2 -7
- package/src/hooks/honey/useHoneyChartData.ts +4 -12
- package/src/hooks/honey/useHoneyVaultsBalance.ts +3 -9
- package/src/hooks/honey/useIsBadCollateralAsset.ts +5 -13
- package/src/hooks/honey/useIsBasketModeEnabled.ts +5 -13
- package/src/hooks/honey/usePythLatestPrices.ts +15 -13
- package/src/hooks/perps/usePythUpdateFee.ts +13 -11
- package/src/hooks/pol/useAutoclaimedIncentives.ts +2 -8
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +2 -8
- package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +34 -0
- package/src/hooks/pol/useBgtUnstakedBalance.ts +3 -8
- package/src/hooks/pol/useClaimableFees.ts +2 -6
- package/src/hooks/pol/useHighestVaultsAPR.ts +6 -11
- package/src/hooks/pol/useOnChainRewardVault.ts +77 -72
- package/src/hooks/pol/usePollGlobalData.ts +3 -9
- package/src/hooks/pol/usePollMarkets.ts +3 -8
- package/src/hooks/pol/useQueuedBeraUnlock.ts +3 -12
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +2 -2
- package/src/hooks/pol/useRewardVault.ts +9 -8
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +6 -6
- package/src/hooks/pol/useRewardVaultFromToken.ts +24 -30
- package/src/hooks/pol/useRewardVaultIncentives.ts +2 -7
- package/src/hooks/pol/useRewardVaultRewards.ts +3 -8
- package/src/hooks/pol/useRewardVaults.ts +4 -12
- package/src/hooks/pol/useStakedAPR.ts +2 -8
- package/src/hooks/pol/useStakedData.ts +90 -41
- package/src/hooks/pol/useStakedSnapshots.ts +4 -9
- package/src/hooks/pol/useStakingVaultsMetadata.ts +1 -1
- package/src/hooks/pol/useTotalStakedAmount.ts +2 -8
- package/src/hooks/pol/useUserVaultInfo.ts +3 -8
- package/src/hooks/pol/useUserVaults.ts +3 -8
- package/src/hooks/pol/useVaultAddress.ts +1 -1
- package/src/hooks/pol/useVaultHistory.ts +2 -8
- package/src/hooks/pol/useVaultValidators.ts +3 -8
- package/src/hooks/tokens/useMultipleTokenInformation.ts +3 -8
- package/src/hooks/tokens/usePollAllowances.ts +4 -11
- package/src/hooks/tokens/usePollBalance.ts +2 -5
- package/src/hooks/tokens/usePollWalletBalances.ts +3 -3
- package/src/hooks/tokens/useStakingTokenInformation.ts +3 -12
- package/src/hooks/tokens/useTokenCurrentPrices.ts +11 -13
- package/src/hooks/tokens/useTokenInformation.ts +3 -8
- package/src/hooks/tokens/useTokenPrice.ts +2 -1
- package/src/hooks/tokens/useTokenPrices.ts +3 -4
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +1 -2
- package/src/hooks/useBlockToTimestamp.ts +1 -2
- package/src/hooks/useGetVerifiedAbi.ts +2 -1
- package/src/hooks/validators/useAllValidators.ts +3 -9
- package/src/hooks/validators/useApiEnrichedAllocation.ts +1 -1
- package/src/hooks/validators/useApiValidator.ts +4 -12
- package/src/hooks/validators/useBaselineRewardAllocation.ts +1 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +2 -4
- package/src/hooks/validators/useDefaultRewardAllocation.ts +3 -9
- package/src/hooks/validators/useManagedValidatorRole.ts +2 -3
- package/src/hooks/validators/useOnChainValidator.ts +4 -11
- package/src/hooks/validators/useStakingPoolBatch.ts +4 -10
- package/src/hooks/validators/useUserActiveValidators.ts +3 -9
- package/src/hooks/validators/useUserBoostsOnValidator.ts +2 -4
- package/src/hooks/validators/useUserClaimableIncentives.ts +3 -3
- package/src/hooks/validators/useUserStakingPositions.ts +3 -9
- package/src/hooks/validators/useValidatorAnalytics.ts +2 -4
- package/src/hooks/validators/useValidatorCommission.ts +3 -8
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +4 -6
- package/src/hooks/validators/useValidatorQueuedCommission.ts +3 -8
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +3 -8
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +3 -8
- package/src/hooks/validators/useValidatorRewardAllocation.ts +3 -8
- package/src/types/global.d.ts +7 -10
- package/src/types/pol.d.ts +17 -3
- package/dist/polling-BKnyavLI.d.ts +0 -8
- package/src/actions/clients/fetchRailwayBackend.ts +0 -34
- package/src/actions/pol/getGlobalCuttingBoard.ts +0 -25
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +0 -24
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address } from "viem";
|
|
3
2
|
|
|
4
3
|
import type { GetValidatorAnalyticsQuery } from "@berachain/graphql/pol/subgraph";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getValidatorAnalytics } from "../../actions/validators/getValidatorAnalytics";
|
|
7
7
|
import { POLLING } from "../../enum/polling";
|
|
@@ -19,7 +19,7 @@ export function useValidatorAnalytics({
|
|
|
19
19
|
? (["useValidatorAnalytics", pubkey, dayRange] as const)
|
|
20
20
|
: null;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
return useSWR(
|
|
23
23
|
QUERY_KEY,
|
|
24
24
|
async ([, pubkey, dayRange]) => {
|
|
25
25
|
return await getValidatorAnalytics({
|
|
@@ -31,6 +31,4 @@ export function useValidatorAnalytics({
|
|
|
31
31
|
refreshInterval: POLLING.SLOW,
|
|
32
32
|
},
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
return { ...swrResponse, refresh: () => swrResponse.mutate() };
|
|
36
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address, PublicClient } from "viem";
|
|
3
2
|
|
|
4
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
|
+
import useSWR from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getValidatorCommission } from "../../actions/validators/getValidatorCommission";
|
|
7
7
|
import type {
|
|
@@ -19,7 +19,7 @@ export const useValidatorCommission = (
|
|
|
19
19
|
? (["useValidatorCommission", pubKey] as const)
|
|
20
20
|
: null;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
return useSWR(
|
|
23
23
|
QUERY_KEY,
|
|
24
24
|
async ([, pubKey]) => {
|
|
25
25
|
return await getValidatorCommission({
|
|
@@ -28,12 +28,7 @@ export const useValidatorCommission = (
|
|
|
28
28
|
});
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
...options
|
|
31
|
+
...options,
|
|
32
32
|
},
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...swrResponse,
|
|
37
|
-
refresh: () => swrResponse.mutate(),
|
|
38
|
-
};
|
|
39
34
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address } from "viem";
|
|
3
2
|
|
|
4
|
-
import type {
|
|
3
|
+
import type { ValidatorIncentivesResponse } from "@berachain/graphql/beep";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getValidatorIncentiveDistribution } from "../../actions/validators/getValidatorIncentiveDistribution";
|
|
7
7
|
import { POLLING } from "../../enum/polling";
|
|
@@ -19,13 +19,13 @@ export function useValidatorIncentiveDistribution({
|
|
|
19
19
|
}: {
|
|
20
20
|
pubkey: Address | undefined;
|
|
21
21
|
dayRange: number;
|
|
22
|
-
}): DefaultHookReturnType<
|
|
22
|
+
}): DefaultHookReturnType<ValidatorIncentivesResponse> {
|
|
23
23
|
const QUERY_KEY =
|
|
24
24
|
pubkey && dayRange
|
|
25
25
|
? (["useValidatorIncentiveDistribution", pubkey, dayRange] as const)
|
|
26
26
|
: null;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
return useSWR(
|
|
29
29
|
QUERY_KEY,
|
|
30
30
|
async ([, pubkey, dayRange]) => {
|
|
31
31
|
return await getValidatorIncentiveDistribution({ pubkey, dayRange });
|
|
@@ -34,6 +34,4 @@ export function useValidatorIncentiveDistribution({
|
|
|
34
34
|
refreshInterval: POLLING.SLOW,
|
|
35
35
|
},
|
|
36
36
|
);
|
|
37
|
-
|
|
38
|
-
return { ...swrResponse, refresh: () => swrResponse.mutate() };
|
|
39
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address } from "viem";
|
|
3
2
|
|
|
4
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
getValidatorQueuedCommission,
|
|
@@ -23,7 +23,7 @@ export function useValidatorQueuedCommission(
|
|
|
23
23
|
? (["useValidatorQueuedCommission", pubKey] as const)
|
|
24
24
|
: null;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
return useSWR(
|
|
27
27
|
QUERY_KEY,
|
|
28
28
|
async ([, pubKey]) => {
|
|
29
29
|
assertPublicClient(publicClient);
|
|
@@ -33,12 +33,7 @@ export function useValidatorQueuedCommission(
|
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
...options
|
|
36
|
+
...options,
|
|
37
37
|
},
|
|
38
38
|
);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
...swrResponse,
|
|
42
|
-
refresh: () => swrResponse.mutate(),
|
|
43
|
-
};
|
|
44
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address, PublicClient } from "viem";
|
|
3
2
|
|
|
4
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
getValidatorQueuedOperatorAddress,
|
|
@@ -22,7 +22,7 @@ export const useValidatorQueuedOperatorAddress = (
|
|
|
22
22
|
? (["useValidatorQueuedOperatorAddress", pubKey] as const)
|
|
23
23
|
: null;
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
return useSWR(
|
|
26
26
|
QUERY_KEY,
|
|
27
27
|
async ([, pubKey]) => {
|
|
28
28
|
return await getValidatorQueuedOperatorAddress({
|
|
@@ -31,12 +31,7 @@ export const useValidatorQueuedOperatorAddress = (
|
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
...options
|
|
34
|
+
...options,
|
|
35
35
|
},
|
|
36
36
|
);
|
|
37
|
-
|
|
38
|
-
return {
|
|
39
|
-
...swrResponse,
|
|
40
|
-
refresh: () => swrResponse.mutate(),
|
|
41
|
-
};
|
|
42
37
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address, PublicClient } from "viem";
|
|
3
2
|
|
|
4
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getValidatorQueuedRewardAllocation } from "../../actions/validators/getValidatorQueuedRewardAllocation";
|
|
7
7
|
import type { ValidatorRewardAllocation } from "../../actions/validators/getValidatorRewardAllocation";
|
|
@@ -20,7 +20,7 @@ export const useValidatorQueuedRewardAllocation = (
|
|
|
20
20
|
? (["useValidatorQueuedRewardAllocation", pubKey] as const)
|
|
21
21
|
: null;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
return useSWR(
|
|
24
24
|
QUERY_KEY,
|
|
25
25
|
async ([, pubKey]) => {
|
|
26
26
|
return await getValidatorQueuedRewardAllocation({
|
|
@@ -29,12 +29,7 @@ export const useValidatorQueuedRewardAllocation = (
|
|
|
29
29
|
});
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
...options
|
|
32
|
+
...options,
|
|
33
33
|
},
|
|
34
34
|
);
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
...swrResponse,
|
|
38
|
-
refresh: () => swrResponse.mutate(),
|
|
39
|
-
};
|
|
40
35
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import useSWR from "swr";
|
|
2
1
|
import type { Address, PublicClient } from "viem";
|
|
3
2
|
|
|
4
3
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
4
|
+
import { useSWR } from "@berachain/utils/pkg/swr";
|
|
5
5
|
|
|
6
6
|
import { getValidatorRewardAllocation } from "../../actions/validators/getValidatorRewardAllocation";
|
|
7
7
|
import type { DefaultHookOptions } from "../../types/global";
|
|
@@ -16,7 +16,7 @@ export function useValidatorRewardAllocation(
|
|
|
16
16
|
? (["useValidatorRewardAllocation", pubKey] as const)
|
|
17
17
|
: null;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
return useSWR(
|
|
20
20
|
QUERY_KEY,
|
|
21
21
|
async ([, pubKey]) => {
|
|
22
22
|
return getValidatorRewardAllocation({
|
|
@@ -25,12 +25,7 @@ export function useValidatorRewardAllocation(
|
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
...options
|
|
28
|
+
...options,
|
|
29
29
|
},
|
|
30
30
|
);
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
...swrResponse,
|
|
34
|
-
refresh: () => swrResponse.mutate(),
|
|
35
|
-
};
|
|
36
31
|
}
|
package/src/types/global.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Config, GetWalletClientReturnType } from "@wagmi/core";
|
|
2
|
-
import type { SWRConfiguration, SWRResponse } from "swr";
|
|
3
2
|
import type {
|
|
4
3
|
Abi,
|
|
5
4
|
Account,
|
|
@@ -13,6 +12,11 @@ import type {
|
|
|
13
12
|
|
|
14
13
|
import type { BeraConfig, ChainId } from "@berachain/config";
|
|
15
14
|
|
|
15
|
+
import type {
|
|
16
|
+
BeraSwrResponse,
|
|
17
|
+
SWRConfiguration,
|
|
18
|
+
} from "@berachain/utils/pkg/swr";
|
|
19
|
+
|
|
16
20
|
import type { ContractName } from "../enum/contracts";
|
|
17
21
|
import type { TransactionActionType } from "../enum/txnEnum";
|
|
18
22
|
import type {
|
|
@@ -20,16 +24,9 @@ import type {
|
|
|
20
24
|
TxnEventKeys,
|
|
21
25
|
} from "../hooks/useContractWrite/types";
|
|
22
26
|
|
|
23
|
-
export type DefaultHookOptions = {
|
|
24
|
-
opts?: SWRConfiguration & { isEnabled?: boolean };
|
|
25
|
-
};
|
|
27
|
+
export type DefaultHookOptions = SWRConfiguration & { isEnabled?: boolean };
|
|
26
28
|
|
|
27
|
-
export type DefaultHookReturnType<T = any> =
|
|
28
|
-
SWRResponse<T, any, any>,
|
|
29
|
-
"mutate"
|
|
30
|
-
> & {
|
|
31
|
-
refresh: () => void;
|
|
32
|
-
};
|
|
29
|
+
export type DefaultHookReturnType<T = any> = BeraSwrResponse<T, any>;
|
|
33
30
|
|
|
34
31
|
export type IContractWriteFn = <
|
|
35
32
|
abi extends Abi | undefined = undefined,
|
package/src/types/pol.d.ts
CHANGED
|
@@ -55,10 +55,24 @@ export interface UserVaultInfo {
|
|
|
55
55
|
|
|
56
56
|
export type StakedBeraAsset = {
|
|
57
57
|
token: TokenWithMetadata;
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Staking APR, or `undefined` when unavailable (e.g. the APR backend is
|
|
60
|
+
* down). `undefined` lets the UI render a "—" placeholder instead of a
|
|
61
|
+
* misleading "0%".
|
|
62
|
+
*/
|
|
63
|
+
apr: number | undefined;
|
|
59
64
|
stakedAmount: number;
|
|
60
|
-
|
|
65
|
+
/**
|
|
66
|
+
* USD value of the staked amount, or `undefined` when the token price is
|
|
67
|
+
* unavailable (e.g. the price backend is down). `undefined` lets the UI
|
|
68
|
+
* render a "—" placeholder instead of a misleading "$0.00".
|
|
69
|
+
*/
|
|
70
|
+
stakedAmountUsd: number | undefined;
|
|
61
71
|
earnedAmount: number;
|
|
62
|
-
|
|
72
|
+
/**
|
|
73
|
+
* USD value of the earned amount, or `undefined` when the token price is
|
|
74
|
+
* unavailable. See {@link stakedAmountUsd}.
|
|
75
|
+
*/
|
|
76
|
+
earnedAmountUsd: number | undefined;
|
|
63
77
|
isLoadingEarnings?: boolean;
|
|
64
78
|
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { paths } from "@berachain/graphql/api";
|
|
2
|
-
|
|
3
|
-
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
4
|
-
import {
|
|
5
|
-
type DefinedParams,
|
|
6
|
-
fetchOpenApi,
|
|
7
|
-
type GetPath,
|
|
8
|
-
type GetResponse,
|
|
9
|
-
} from "./fetchOpenApi";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Typed GET against the legacy Railway backend.
|
|
13
|
-
*
|
|
14
|
-
* The `path`, its path/query params and the response are all type-checked
|
|
15
|
-
* against the Railway schema (`@berachain/graphql/api`). The base URL is
|
|
16
|
-
* resolved from `config.backend`.
|
|
17
|
-
*
|
|
18
|
-
* @deprecated The Railway backend is being replaced by beep; prefer
|
|
19
|
-
* {@link fetchBeep} where `config.beep` is available.
|
|
20
|
-
*/
|
|
21
|
-
export function fetchRailwayBackend<P extends GetPath<paths>>(
|
|
22
|
-
path: P,
|
|
23
|
-
params: DefinedParams<paths, P>,
|
|
24
|
-
args: BeraJS.BaseFunctionArgs = {},
|
|
25
|
-
): Promise<GetResponse<paths, P>> {
|
|
26
|
-
const { config } = parseBaseArgs(args);
|
|
27
|
-
|
|
28
|
-
return fetchOpenApi<paths, P>(
|
|
29
|
-
config.backend,
|
|
30
|
-
path,
|
|
31
|
-
params,
|
|
32
|
-
"backend-railway",
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ApiVaultFragment,
|
|
3
|
-
GqlRewardVaultOrderBy,
|
|
4
|
-
GqlRewardVaultOrderDirection,
|
|
5
|
-
} from "@berachain/graphql/pol/api";
|
|
6
|
-
|
|
7
|
-
import { getRewardVaults } from "./getRewardVaults";
|
|
8
|
-
|
|
9
|
-
export async function getGlobalCuttingBoard(
|
|
10
|
-
threshold: number,
|
|
11
|
-
): Promise<ApiVaultFragment[]> {
|
|
12
|
-
const { gaugeList } = await getRewardVaults({
|
|
13
|
-
filter: {
|
|
14
|
-
// TODO sort by bgt capture percentage
|
|
15
|
-
orderBy: GqlRewardVaultOrderBy.Apr,
|
|
16
|
-
orderDirection: GqlRewardVaultOrderDirection.Desc,
|
|
17
|
-
pageSize: threshold,
|
|
18
|
-
where: {
|
|
19
|
-
includeNonWhitelisted: false,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
return gaugeList;
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BeraError } from "../../errors/BeraError";
|
|
2
|
-
import { beraFetchJson } from "../../utils/beraFetch";
|
|
3
|
-
|
|
4
|
-
export type IncentiveFeeClaimStats = {
|
|
5
|
-
sumAllClaims: number;
|
|
6
|
-
sumClaimsInLast24Hours: number;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/** Browser-only. Hits `/api/pol/incentive-fee-claims` (server computes totals). */
|
|
10
|
-
export async function getIncentiveFeeClaimStats(): Promise<IncentiveFeeClaimStats> {
|
|
11
|
-
if (typeof window === "undefined") {
|
|
12
|
-
throw new BeraError({
|
|
13
|
-
message:
|
|
14
|
-
"getIncentiveFeeClaimStats is browser-only; call from a Client Component / SWR hook",
|
|
15
|
-
level: "error",
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return beraFetchJson<IncentiveFeeClaimStats>({
|
|
20
|
-
url: "/api/pol/incentive-fee-claims",
|
|
21
|
-
name: "pol-incentive-fee-claims",
|
|
22
|
-
type: "rest",
|
|
23
|
-
});
|
|
24
|
-
}
|