@berachain/berajs 0.2.10 → 0.2.11
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.mjs +1 -1
- package/dist/actions/exports.d.ts +67 -17
- package/dist/actions/exports.mjs +60 -19
- package/dist/actions/governance/exports.d.ts +3 -11
- package/dist/{chunk-P5WXXULM.mjs → chunk-MRQGHXAN.mjs} +1 -1
- package/dist/{chunk-WNBWX23Q.mjs → chunk-SXUNCX5E.mjs} +5 -4
- package/dist/chunk-UD5IUNCW.mjs +34 -0
- package/dist/{chunk-QBBOWFMH.mjs → chunk-VAA2FVPP.mjs} +58 -12
- package/dist/contexts/exports.d.ts +2 -2
- package/dist/contexts/exports.mjs +4 -2
- package/dist/enum/exports.d.ts +8 -2
- package/dist/getProposalVotes-DAUrdX2n.d.ts +12 -0
- package/dist/{getValidatorQueuedOperatorAddress-DphU3qhE.d.ts → getValidatorQueuedOperatorAddress-Cxt-DlL_.d.ts} +2 -2
- package/dist/{global.d-BuGDKh4k.d.ts → global.d-q_LQWQqs.d.ts} +2 -4
- package/dist/hooks/exports.d.ts +100 -149
- package/dist/hooks/exports.mjs +468 -484
- package/dist/hooks/governance/exports.d.ts +20 -15
- package/dist/hooks/governance/exports.mjs +39 -37
- 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 +4 -0
- package/package.json +8 -7
- package/src/actions/bend/getMaxDeposit.ts +28 -2
- package/src/actions/clients/fetchOpenApi.ts +6 -2
- package/src/actions/clients/fetchOpenApi.unit.test.ts +24 -2
- package/src/actions/exports.ts +1 -0
- package/src/actions/honey/getChartData.ts +53 -12
- package/src/actions/honey/getHoney24hVolume.ts +34 -6
- package/src/actions/honey/getHoneyTxns.ts +93 -0
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +64 -12
- package/src/contexts/SwrFallback.tsx +2 -1
- package/src/data/contracts.ts +4 -0
- package/src/errors/getRevertReason.integration.test.ts +5 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +2 -3
- package/src/hooks/dex/useAggregatorsQuotes.ts +10 -10
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +1 -1
- package/src/hooks/dex/useAllUserPools.ts +7 -5
- package/src/hooks/dex/useApiPool.ts +1 -1
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useOnChainPoolData.ts +1 -1
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -2
- package/src/hooks/dex/usePoolEvents.ts +1 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +2 -3
- package/src/hooks/dex/usePools.ts +4 -2
- 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 +3 -4
- package/src/hooks/enso/useEnsoSwapBundle.ts +1 -1
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +3 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +1 -1
- package/src/hooks/enso/useIsBendAuthorized.ts +1 -1
- package/src/hooks/enso/useZapStakeBera.ts +2 -2
- 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 +3 -3
- package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
- package/src/hooks/governance/usePollProposalVotes.ts +23 -5
- package/src/hooks/governance/usePollUserDelegates.ts +3 -3
- package/src/hooks/governance/useProposalFromTx.ts +2 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -3
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -1
- package/src/hooks/governance/useQuorum.ts +1 -2
- package/src/hooks/honey/useCappedGlobally.ts +3 -6
- package/src/hooks/honey/useCappedRelatively.ts +2 -2
- package/src/hooks/honey/useCollateralWeights.ts +3 -3
- package/src/hooks/honey/useHoney24hVolume.ts +1 -1
- package/src/hooks/honey/useHoneyBalances.ts +1 -1
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneyVaultsBalance.ts +2 -3
- package/src/hooks/honey/useIsBadCollateralAsset.ts +4 -7
- package/src/hooks/honey/useIsBasketModeEnabled.ts +4 -7
- package/src/hooks/honey/usePythLatestPrices.ts +13 -9
- package/src/hooks/perps/usePythUpdateFee.ts +13 -11
- package/src/hooks/pol/useAutoclaimedIncentives.ts +1 -2
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +1 -2
- package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +39 -0
- package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -2
- package/src/hooks/pol/useClaimableFees.ts +1 -1
- package/src/hooks/pol/useHighestVaultsAPR.ts +4 -6
- package/src/hooks/pol/useOnChainRewardVault.ts +77 -72
- package/src/hooks/pol/usePollGlobalData.ts +2 -3
- package/src/hooks/pol/usePollMarkets.ts +2 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +2 -2
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +2 -2
- package/src/hooks/pol/useRewardVault.ts +7 -6
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +4 -4
- package/src/hooks/pol/useRewardVaultFromToken.ts +1 -1
- package/src/hooks/pol/useRewardVaultIncentives.ts +1 -1
- package/src/hooks/pol/useRewardVaultRewards.ts +2 -2
- package/src/hooks/pol/useRewardVaults.ts +3 -6
- package/src/hooks/pol/useStakedAPR.ts +1 -2
- package/src/hooks/pol/useStakedData.ts +90 -41
- package/src/hooks/pol/useStakedSnapshots.ts +1 -1
- package/src/hooks/pol/useStakingVaultsMetadata.ts +1 -1
- package/src/hooks/pol/useTotalStakedAmount.ts +1 -2
- package/src/hooks/pol/useUserVaultInfo.ts +2 -2
- package/src/hooks/pol/useUserVaults.ts +2 -3
- package/src/hooks/pol/useVaultAddress.ts +1 -1
- package/src/hooks/pol/useVaultHistory.ts +1 -2
- package/src/hooks/pol/useVaultValidators.ts +2 -2
- package/src/hooks/tokens/useMultipleTokenInformation.ts +2 -2
- package/src/hooks/tokens/usePollAllowances.ts +3 -4
- package/src/hooks/tokens/usePollBalance.ts +2 -2
- package/src/hooks/tokens/usePollWalletBalances.ts +2 -2
- package/src/hooks/tokens/useStakingTokenInformation.ts +2 -2
- package/src/hooks/tokens/useTokenCurrentPrices.ts +11 -13
- package/src/hooks/tokens/useTokenInformation.ts +2 -2
- 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 +2 -3
- package/src/hooks/validators/useApiEnrichedAllocation.ts +1 -1
- package/src/hooks/validators/useApiValidator.ts +3 -6
- package/src/hooks/validators/useBaselineRewardAllocation.ts +1 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
- package/src/hooks/validators/useDefaultRewardAllocation.ts +2 -3
- package/src/hooks/validators/useManagedValidatorRole.ts +2 -2
- package/src/hooks/validators/useOnChainValidator.ts +3 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +3 -4
- package/src/hooks/validators/useUserActiveValidators.ts +2 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
- package/src/hooks/validators/useUserClaimableIncentives.ts +1 -1
- package/src/hooks/validators/useUserStakingPositions.ts +2 -1
- package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
- package/src/hooks/validators/useValidatorCommission.ts +2 -2
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +2 -2
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +2 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +2 -2
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/global.d.ts +3 -4
- package/src/types/pol.d.ts +17 -3
- package/dist/polling-BKnyavLI.d.ts +0 -8
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { GovernanceTopic, CustomProposalErrors, CustomProposal } from '../../types/governance/exports.js';
|
|
3
|
-
import * as
|
|
4
|
-
import { SWRResponse } from 'swr';
|
|
3
|
+
import * as _berachain_utils_pkg_swr from '@berachain/utils/pkg/swr';
|
|
4
|
+
import { SWRResponse } from '@berachain/utils/pkg/swr';
|
|
5
5
|
import { Address } from 'viem';
|
|
6
|
-
import { P as POLLING } from '../../polling-BKnyavLI.js';
|
|
7
|
-
import * as swr_infinite from 'swr/infinite';
|
|
8
|
-
import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from 'swr/infinite';
|
|
9
6
|
import * as _berachain_graphql_governance from '@berachain/graphql/governance';
|
|
10
7
|
import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
|
|
11
|
-
import {
|
|
8
|
+
import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from '@berachain/utils/pkg/swr/infinite';
|
|
9
|
+
import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-q_LQWQqs.js';
|
|
10
|
+
import * as swr_infinite from 'swr/infinite';
|
|
11
|
+
import { g as getProposalVotes } from '../../getProposalVotes-DAUrdX2n.js';
|
|
12
12
|
import * as swr__internal from 'swr/_internal';
|
|
13
13
|
import '../../enum/governance/exports.js';
|
|
14
14
|
import '@wagmi/core';
|
|
@@ -40,19 +40,16 @@ declare const useGetPastVotes: (args: {
|
|
|
40
40
|
} | {
|
|
41
41
|
proposalId: bigint;
|
|
42
42
|
timepoint?: number | bigint;
|
|
43
|
-
})) =>
|
|
43
|
+
})) => _berachain_utils_pkg_swr.SWRResponse<string, any, any>;
|
|
44
44
|
|
|
45
45
|
declare const useHasVoted: ({ proposalId, wallet, }: {
|
|
46
46
|
proposalId: string;
|
|
47
47
|
wallet?: Address;
|
|
48
|
-
}) =>
|
|
48
|
+
}) => _berachain_utils_pkg_swr.SWRResponse<boolean, any, any>;
|
|
49
49
|
|
|
50
50
|
declare const useIsCanceller: ({ account, ...baseArgs }: {
|
|
51
51
|
account: Address | undefined;
|
|
52
|
-
} & BeraJS.BaseFunctionArgs) =>
|
|
53
|
-
refreshInterval: POLLING;
|
|
54
|
-
revalidateOnFocus: false;
|
|
55
|
-
}>;
|
|
52
|
+
} & BeraJS.BaseFunctionArgs) => _berachain_utils_pkg_swr.SWRResponse<boolean, any, any>;
|
|
56
53
|
|
|
57
54
|
type UsePollAllProposalsArgs = {
|
|
58
55
|
topic: string;
|
|
@@ -79,7 +76,7 @@ type PollAllProposalsKey = [
|
|
|
79
76
|
number,
|
|
80
77
|
string | undefined
|
|
81
78
|
] | null;
|
|
82
|
-
declare function usePollAllProposalsQueryKey(topic: string, args?: Partial<UsePollAllProposalsArgs>): (pageIndex: number, previousPageData?: ProposalSelectionFragment[]) => PollAllProposalsKey;
|
|
79
|
+
declare function usePollAllProposalsQueryKey(topic: string, args?: Partial<UsePollAllProposalsArgs>): (pageIndex: number, previousPageData?: ProposalSelectionFragment[] | null) => PollAllProposalsKey;
|
|
83
80
|
/**
|
|
84
81
|
* Fetch all proposals for a given topic
|
|
85
82
|
*/
|
|
@@ -113,6 +110,14 @@ declare const usePollProposalThreshold: (governorAddress: Address) => DefaultHoo
|
|
|
113
110
|
}>;
|
|
114
111
|
|
|
115
112
|
type UsePollProposalVotesArgs = Omit<GetProposalVotesQueryVariables, "offset" | "limit">;
|
|
113
|
+
type ProposalVotesKey = [
|
|
114
|
+
string,
|
|
115
|
+
number,
|
|
116
|
+
number,
|
|
117
|
+
UsePollProposalVotesArgs["proposalId"],
|
|
118
|
+
UsePollProposalVotesArgs["orderBy"],
|
|
119
|
+
UsePollProposalVotesArgs["orderDirection"]
|
|
120
|
+
] | null;
|
|
116
121
|
/**
|
|
117
122
|
* Fetches all the votes for a proposal from the Subgraph
|
|
118
123
|
* @param args - The arguments to pass to the query
|
|
@@ -121,7 +126,7 @@ type UsePollProposalVotesArgs = Omit<GetProposalVotesQueryVariables, "offset" |
|
|
|
121
126
|
declare const usePollProposalVotes: (args: UsePollProposalVotesArgs, total: number) => swr_infinite.SWRInfiniteResponse<{
|
|
122
127
|
data: _berachain_graphql_governance.GetProposalVotesQuery;
|
|
123
128
|
}, any>;
|
|
124
|
-
declare const usePollProposalVotesQueryKey: ({ ...args }: UsePollProposalVotesArgs, total: number) => SWRInfiniteKeyLoader
|
|
129
|
+
declare const usePollProposalVotesQueryKey: ({ ...args }: UsePollProposalVotesArgs, total: number) => SWRInfiniteKeyLoader<Awaited<ReturnType<typeof getProposalVotes>>, ProposalVotesKey>;
|
|
125
130
|
|
|
126
131
|
declare const usePollUserDelegates: (options?: DefaultHookOptions) => DefaultHookReturnType<{
|
|
127
132
|
delegate: Address;
|
|
@@ -173,7 +178,7 @@ declare function useQuorum({ at }: {
|
|
|
173
178
|
}): {
|
|
174
179
|
data: number | undefined;
|
|
175
180
|
error: any;
|
|
176
|
-
mutate:
|
|
181
|
+
mutate: _berachain_utils_pkg_swr.KeyedMutator<string>;
|
|
177
182
|
isValidating: boolean;
|
|
178
183
|
isLoading: swr__internal.IsLoadingResponse<Data, Config>;
|
|
179
184
|
};
|
|
@@ -7,6 +7,10 @@ import {
|
|
|
7
7
|
getProposalVotes
|
|
8
8
|
} from "../../chunk-GUURQAME.mjs";
|
|
9
9
|
import "../../chunk-DKMAIU74.mjs";
|
|
10
|
+
import {
|
|
11
|
+
useSWR,
|
|
12
|
+
useSWRImmutable
|
|
13
|
+
} from "../../chunk-UD5IUNCW.mjs";
|
|
10
14
|
import "../../chunk-SGIJVHZO.mjs";
|
|
11
15
|
import {
|
|
12
16
|
assertPublicClient
|
|
@@ -289,13 +293,11 @@ var useCreateProposal = ({
|
|
|
289
293
|
};
|
|
290
294
|
|
|
291
295
|
// src/hooks/governance/useGetPastVotes.ts
|
|
292
|
-
import useSWRImmutable2 from "swr/immutable";
|
|
293
296
|
import { formatUnits } from "viem";
|
|
294
297
|
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
295
298
|
import { useBeraWallet, usePublicClient as usePublicClient2 } from "@berachain/wagmi/hooks";
|
|
296
299
|
|
|
297
300
|
// src/hooks/governance/useProposalSnapshot.ts
|
|
298
|
-
import useSWRImmutable from "swr/immutable";
|
|
299
301
|
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
300
302
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
301
303
|
var useProposalSnapshot = ({
|
|
@@ -328,7 +330,7 @@ var useGetPastVotes = (args) => {
|
|
|
328
330
|
});
|
|
329
331
|
const ts = args.timepoint || snapshot;
|
|
330
332
|
const QUERY_KEY = ts && publicClient && wallet ? ["useGetPastVotes", ts, wallet] : null;
|
|
331
|
-
return
|
|
333
|
+
return useSWRImmutable(QUERY_KEY, async ([, ts2, wallet2]) => {
|
|
332
334
|
assertPublicClient(publicClient);
|
|
333
335
|
const { config } = parseBaseArgs({
|
|
334
336
|
chainId: publicClient.chain.id
|
|
@@ -347,7 +349,6 @@ var useGetPastVotes = (args) => {
|
|
|
347
349
|
};
|
|
348
350
|
|
|
349
351
|
// src/hooks/governance/useHasVoted.ts
|
|
350
|
-
import useSWR from "swr";
|
|
351
352
|
import { isAddress } from "viem";
|
|
352
353
|
import { berachainGovernanceAbi as governanceAbi2 } from "@berachain/abis/gov/berachainGovernance";
|
|
353
354
|
import { useBeraWallet as useBeraWallet2, usePublicClient as usePublicClient3 } from "@berachain/wagmi/hooks";
|
|
@@ -376,7 +377,6 @@ var useHasVoted = ({
|
|
|
376
377
|
};
|
|
377
378
|
|
|
378
379
|
// src/hooks/governance/useIsCanceller.ts
|
|
379
|
-
import useSWR2 from "swr";
|
|
380
380
|
import { timeLockAbi as governanceTimelockAbi } from "@berachain/abis/gov/timeLock";
|
|
381
381
|
import { usePublicClient as usePublicClient4 } from "@berachain/wagmi/hooks";
|
|
382
382
|
|
|
@@ -391,7 +391,7 @@ var useIsCanceller = ({
|
|
|
391
391
|
const publicClient = usePublicClient4();
|
|
392
392
|
const { config: chainConfig } = parseBaseArgs(baseArgs);
|
|
393
393
|
const QUERY_KEY = account && publicClient ? ["useCancellerRole", account] : null;
|
|
394
|
-
return
|
|
394
|
+
return useSWR(
|
|
395
395
|
QUERY_KEY,
|
|
396
396
|
async ([, account2]) => {
|
|
397
397
|
assertPublicClient(publicClient);
|
|
@@ -412,11 +412,25 @@ var useIsCanceller = ({
|
|
|
412
412
|
|
|
413
413
|
// src/hooks/governance/usePollAllProposals.ts
|
|
414
414
|
import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
415
|
-
import useSWRInfinite from "swr/infinite";
|
|
416
415
|
import {
|
|
417
416
|
Proposal_OrderBy,
|
|
418
417
|
ProposalStatus
|
|
419
418
|
} from "@berachain/graphql/governance";
|
|
419
|
+
|
|
420
|
+
// ../utils/src/pkg/swr/infinite.ts
|
|
421
|
+
import { unstable_serialize } from "swr/infinite";
|
|
422
|
+
import useOriginalSWRInfinite from "swr/infinite";
|
|
423
|
+
function useSWRInfinite(getKey, fetcher, options) {
|
|
424
|
+
const { isEnabled = true, ...swrConfig } = options ?? {};
|
|
425
|
+
return useOriginalSWRInfinite(
|
|
426
|
+
isEnabled ? getKey : () => null,
|
|
427
|
+
fetcher,
|
|
428
|
+
swrConfig
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
var infinite_default = useSWRInfinite;
|
|
432
|
+
|
|
433
|
+
// src/hooks/governance/usePollAllProposals.ts
|
|
420
434
|
var DEFAULT_PER_PAGE = 10;
|
|
421
435
|
var fromUiStatusToSubgraphStatuses = (status) => {
|
|
422
436
|
switch (status) {
|
|
@@ -483,16 +497,12 @@ function usePollAllProposals(args, options) {
|
|
|
483
497
|
});
|
|
484
498
|
return (proposals ?? []).filter(Boolean);
|
|
485
499
|
}
|
|
486
|
-
const swr =
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
refreshInterval: options?.opts?.refreshInterval ?? 18e4 /* SLOW */,
|
|
493
|
-
...options?.opts
|
|
494
|
-
}
|
|
495
|
-
);
|
|
500
|
+
const swr = infinite_default(getKey, fetcher, {
|
|
501
|
+
// Increase initialSize in order to prefetch more proposals at a time.
|
|
502
|
+
initialSize: 1,
|
|
503
|
+
refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */,
|
|
504
|
+
...options
|
|
505
|
+
});
|
|
496
506
|
const data = useMemo(() => {
|
|
497
507
|
if (!swr.data) return [];
|
|
498
508
|
const flattened = swr.data.flat().filter((p) => {
|
|
@@ -561,7 +571,6 @@ function usePollAllProposals(args, options) {
|
|
|
561
571
|
|
|
562
572
|
// src/hooks/governance/usePollProposal.ts
|
|
563
573
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
564
|
-
import useSWR3 from "swr";
|
|
565
574
|
import {
|
|
566
575
|
ProposalStatus as ProposalStatus2
|
|
567
576
|
} from "@berachain/graphql/governance";
|
|
@@ -570,15 +579,15 @@ var usePollProposal = (proposalId, options) => {
|
|
|
570
579
|
const autoRefreshProposal = options?.autoRefresh ?? false;
|
|
571
580
|
const publicClient = usePublicClient5();
|
|
572
581
|
const QUERY_KEY = proposalId && publicClient ? ["usePollProposal", proposalId] : null;
|
|
573
|
-
const swrResponse =
|
|
582
|
+
const swrResponse = useSWR(
|
|
574
583
|
QUERY_KEY,
|
|
575
584
|
([, proposalId2]) => {
|
|
576
585
|
assertPublicClient(publicClient);
|
|
577
586
|
return getProposalDetails({ proposalId: proposalId2, client: publicClient });
|
|
578
587
|
},
|
|
579
588
|
{
|
|
580
|
-
...options
|
|
581
|
-
refreshInterval: options?.
|
|
589
|
+
...options,
|
|
590
|
+
refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */
|
|
582
591
|
}
|
|
583
592
|
);
|
|
584
593
|
const [timestamp, setTimestamp] = useState3(Date.now());
|
|
@@ -616,14 +625,13 @@ var usePollProposal = (proposalId, options) => {
|
|
|
616
625
|
};
|
|
617
626
|
|
|
618
627
|
// src/hooks/governance/usePollProposalThreshold.ts
|
|
619
|
-
import useSWR4 from "swr";
|
|
620
628
|
import { formatEther } from "viem";
|
|
621
629
|
import { berachainGovernanceAbi as governanceAbi3 } from "@berachain/abis/gov/berachainGovernance";
|
|
622
630
|
import { usePublicClient as usePublicClient6 } from "@berachain/wagmi/hooks";
|
|
623
631
|
var usePollProposalThreshold = (governorAddress) => {
|
|
624
632
|
const publicClient = usePublicClient6();
|
|
625
633
|
const QUERY_KEY = publicClient ? ["usePollProposalThreshold", governorAddress] : null;
|
|
626
|
-
const swrResponse =
|
|
634
|
+
const swrResponse = useSWR(
|
|
627
635
|
QUERY_KEY,
|
|
628
636
|
async ([, governorAddress2]) => {
|
|
629
637
|
assertPublicClient(publicClient);
|
|
@@ -645,10 +653,9 @@ var usePollProposalThreshold = (governorAddress) => {
|
|
|
645
653
|
};
|
|
646
654
|
|
|
647
655
|
// src/hooks/governance/usePollProposalVotes.ts
|
|
648
|
-
import useSWRInfinite2 from "swr/infinite";
|
|
649
656
|
var DEFAULT_LIMIT = 1e3;
|
|
650
657
|
var usePollProposalVotes = (args, total) => {
|
|
651
|
-
return
|
|
658
|
+
return useSWRInfinite(
|
|
652
659
|
usePollProposalVotesQueryKey(args, total),
|
|
653
660
|
async ([_key, page]) => {
|
|
654
661
|
return getProposalVotes({
|
|
@@ -681,7 +688,6 @@ var usePollProposalVotesQueryKey = ({ ...args }, total) => (pageIndex) => {
|
|
|
681
688
|
};
|
|
682
689
|
|
|
683
690
|
// src/hooks/governance/usePollUserDelegates.ts
|
|
684
|
-
import useSWR5 from "swr";
|
|
685
691
|
import { formatEther as formatEther2 } from "viem";
|
|
686
692
|
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
687
693
|
import { useBeraWallet as useBeraWallet3, usePublicClient as usePublicClient7 } from "@berachain/wagmi/hooks";
|
|
@@ -689,7 +695,7 @@ var usePollUserDelegates = (options) => {
|
|
|
689
695
|
const { address: account } = useBeraWallet3();
|
|
690
696
|
const publicClient = usePublicClient7();
|
|
691
697
|
const QUERY_KEY = account ? ["usePollUserDelegates", account] : null;
|
|
692
|
-
const swrResponse =
|
|
698
|
+
const swrResponse = useSWR(
|
|
693
699
|
QUERY_KEY,
|
|
694
700
|
async ([, account2]) => {
|
|
695
701
|
assertPublicClient(publicClient);
|
|
@@ -719,8 +725,8 @@ var usePollUserDelegates = (options) => {
|
|
|
719
725
|
};
|
|
720
726
|
},
|
|
721
727
|
{
|
|
722
|
-
...options
|
|
723
|
-
refreshInterval: options?.
|
|
728
|
+
...options,
|
|
729
|
+
refreshInterval: options?.refreshInterval ?? 18e4 /* SLOW */
|
|
724
730
|
}
|
|
725
731
|
);
|
|
726
732
|
return {
|
|
@@ -730,7 +736,6 @@ var usePollUserDelegates = (options) => {
|
|
|
730
736
|
};
|
|
731
737
|
|
|
732
738
|
// src/hooks/governance/useProposalFromTx.ts
|
|
733
|
-
import useSWR6 from "swr";
|
|
734
739
|
import { usePublicClient as usePublicClient8, useTransactionReceipt } from "@berachain/wagmi/hooks";
|
|
735
740
|
var useProposalFromTx = (txHash) => {
|
|
736
741
|
const { data: tx } = useTransactionReceipt({
|
|
@@ -738,7 +743,7 @@ var useProposalFromTx = (txHash) => {
|
|
|
738
743
|
});
|
|
739
744
|
const publicClient = usePublicClient8();
|
|
740
745
|
const QUERY_KEY = tx && publicClient ? ["useProposalFromTx", txHash] : null;
|
|
741
|
-
const swrResponse =
|
|
746
|
+
const swrResponse = useSWR(QUERY_KEY, async ([, txHash2]) => {
|
|
742
747
|
if (!tx) {
|
|
743
748
|
throw new Error("Transaction not found");
|
|
744
749
|
}
|
|
@@ -751,7 +756,6 @@ var useProposalFromTx = (txHash) => {
|
|
|
751
756
|
};
|
|
752
757
|
|
|
753
758
|
// src/hooks/governance/useProposalState.ts
|
|
754
|
-
import useSWRImmutable3 from "swr/immutable";
|
|
755
759
|
import { berachainGovernanceAbi as governanceAbi4 } from "@berachain/abis/gov/berachainGovernance";
|
|
756
760
|
import { usePublicClient as usePublicClient9 } from "@berachain/wagmi/hooks";
|
|
757
761
|
var ProposalStateMap = {
|
|
@@ -770,7 +774,7 @@ var useProposalState = ({
|
|
|
770
774
|
}) => {
|
|
771
775
|
const publicClient = usePublicClient9();
|
|
772
776
|
const QUERY_KEY = governorAddress && publicClient && proposalId ? ["useProposalState", proposalId] : null;
|
|
773
|
-
return
|
|
777
|
+
return useSWRImmutable(QUERY_KEY, async ([, proposalId2]) => {
|
|
774
778
|
assertPublicClient(publicClient);
|
|
775
779
|
const snapshot = await publicClient.readContract({
|
|
776
780
|
abi: governanceAbi4,
|
|
@@ -783,7 +787,6 @@ var useProposalState = ({
|
|
|
783
787
|
};
|
|
784
788
|
|
|
785
789
|
// src/hooks/governance/useProposalTimelockState.ts
|
|
786
|
-
import useSWR7 from "swr";
|
|
787
790
|
import { timeLockAbi as governanceTimelockAbi2 } from "@berachain/abis/gov/timeLock";
|
|
788
791
|
import { usePublicClient as usePublicClient10 } from "@berachain/wagmi/hooks";
|
|
789
792
|
var TimelockOperationState = {
|
|
@@ -802,7 +805,7 @@ function useProposalTimelockState({
|
|
|
802
805
|
proposalTimelockId,
|
|
803
806
|
timelockAddress
|
|
804
807
|
] : null;
|
|
805
|
-
return
|
|
808
|
+
return useSWR(
|
|
806
809
|
QUERY_KEY,
|
|
807
810
|
async ([, proposalTimelockId2, timelockAddress2]) => {
|
|
808
811
|
assertPublicClient(publicClient);
|
|
@@ -821,7 +824,6 @@ function useProposalTimelockState({
|
|
|
821
824
|
}
|
|
822
825
|
|
|
823
826
|
// src/hooks/governance/useQuorum.ts
|
|
824
|
-
import useSWR8 from "swr";
|
|
825
827
|
import { usePublicClient as usePublicClient11 } from "@berachain/wagmi/hooks";
|
|
826
828
|
|
|
827
829
|
// src/actions/governance/getQuorum.ts
|
|
@@ -857,7 +859,7 @@ function useQuorum({ at }, {
|
|
|
857
859
|
// Using Now because we cannot query quorum in the future, so no need to have different query keys.
|
|
858
860
|
Number(at) > now ? "now" : at
|
|
859
861
|
] : null;
|
|
860
|
-
const response =
|
|
862
|
+
const response = useSWR(QUERY_KEY, async ([, at2]) => {
|
|
861
863
|
if (at2 === "now") {
|
|
862
864
|
return getQuorum({ publicClient });
|
|
863
865
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
|
-
import { a as TokenWithMetadata, b as Token } from './HoneyConfigProvider-
|
|
2
|
+
import { a as TokenWithMetadata, b as Token } from './HoneyConfigProvider-COOuDNra.js';
|
|
3
3
|
import { ApiValidatorFragment } from '@berachain/graphql/pol/api';
|
|
4
4
|
|
|
5
5
|
interface BribeBoostReward {
|
|
@@ -142,11 +142,25 @@ interface UserVaultInfo {
|
|
|
142
142
|
|
|
143
143
|
type StakedBeraAsset = {
|
|
144
144
|
token: TokenWithMetadata;
|
|
145
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Staking APR, or `undefined` when unavailable (e.g. the APR backend is
|
|
147
|
+
* down). `undefined` lets the UI render a "—" placeholder instead of a
|
|
148
|
+
* misleading "0%".
|
|
149
|
+
*/
|
|
150
|
+
apr: number | undefined;
|
|
146
151
|
stakedAmount: number;
|
|
147
|
-
|
|
152
|
+
/**
|
|
153
|
+
* USD value of the staked amount, or `undefined` when the token price is
|
|
154
|
+
* unavailable (e.g. the price backend is down). `undefined` lets the UI
|
|
155
|
+
* render a "—" placeholder instead of a misleading "$0.00".
|
|
156
|
+
*/
|
|
157
|
+
stakedAmountUsd: number | undefined;
|
|
148
158
|
earnedAmount: number;
|
|
149
|
-
|
|
159
|
+
/**
|
|
160
|
+
* USD value of the earned amount, or `undefined` when the token price is
|
|
161
|
+
* unavailable. See {@link stakedAmountUsd}.
|
|
162
|
+
*/
|
|
163
|
+
earnedAmountUsd: number | undefined;
|
|
150
164
|
isLoadingEarnings?: boolean;
|
|
151
165
|
};
|
|
152
166
|
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { d as AggregatedTokenTotals, A as AutoclaimedIncentivesResponse, a as AutoclaimedIncentivesTxHashResponse, e as BribeBoostReward, b as BribeBoostRewardItem, B as BribeBoostRewardProof, f as BribeBoostValidatorApr, C as ClaimedIncentives, g as ClaimedIncentivesLocalState, I as IncentiveReward, h as IncentiveRewardChunksWithValidatorData, P as ProtocolMetadata, c as StakedBeraAsset, S as StakingConfig, U as UserVaultInfo } from '../pol.d-
|
|
2
|
-
import { M as MinimalERC20 } from '../HoneyConfigProvider-
|
|
3
|
-
export { A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken,
|
|
1
|
+
export { d as AggregatedTokenTotals, A as AutoclaimedIncentivesResponse, a as AutoclaimedIncentivesTxHashResponse, e as BribeBoostReward, b as BribeBoostRewardItem, B as BribeBoostRewardProof, f as BribeBoostValidatorApr, C as ClaimedIncentives, g as ClaimedIncentivesLocalState, I as IncentiveReward, h as IncentiveRewardChunksWithValidatorData, P as ProtocolMetadata, c as StakedBeraAsset, S as StakingConfig, U as UserVaultInfo } from '../pol.d-CeRgXBL8.js';
|
|
2
|
+
import { M as MinimalERC20 } from '../HoneyConfigProvider-COOuDNra.js';
|
|
3
|
+
export { A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, x as BexStatus, y as Calldata, H as HoneySwapActions, I as IAggregatorArgs, z as IAggregatorQuote, g as IRawAggregatorQuote, v as IUserPosition, h as PythPriceFeedMap, S as SwapRequest, b as Token, i as TokenCurrentPriceMap, w as TokenPriceInfo, t as TokenWithAmount, a as TokenWithMetadata, D as TokenWithPrice } from '../HoneyConfigProvider-COOuDNra.js';
|
|
4
4
|
import { BundleData, EnsoClient } from '@ensofinance/sdk';
|
|
5
5
|
import { TransactionRequest, Address, Hex, PublicClient } from 'viem';
|
|
6
|
-
export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-
|
|
6
|
+
export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-q_LQWQqs.js';
|
|
7
7
|
import '@berachain/graphql/pol/api';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
9
|
import 'react';
|
|
10
10
|
import '@berachain-foundation/berancer-sdk';
|
|
11
11
|
import '../honey-CYm0RWf4.js';
|
|
12
12
|
import '@wagmi/core';
|
|
13
|
-
import 'swr';
|
|
14
13
|
import '@berachain/config';
|
|
14
|
+
import '@berachain/utils/pkg/swr';
|
|
15
15
|
import '../txnEnum-ByI5dtDi.js';
|
|
16
16
|
import '../BeraError-7-A5JYy_.js';
|
|
17
17
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { T as TokenWithOrder, H as HoneySwapActions } from './HoneyConfigProvider-
|
|
2
|
+
import { T as TokenWithOrder, H as HoneySwapActions } from './HoneyConfigProvider-COOuDNra.js';
|
|
3
3
|
|
|
4
4
|
interface IHoneySwapState {
|
|
5
5
|
actionType: "mint" | "redeem";
|
package/dist/utils/exports.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as viem from 'viem';
|
|
|
5
5
|
import { Address, PublicClient, Transport } from 'viem';
|
|
6
6
|
import * as _berachain_config_internal from '@berachain/config/internal';
|
|
7
7
|
import { ChainId, BeraConfig } from '@berachain/config/internal';
|
|
8
|
-
import { I as IHoneySwapState } from '../useHoneySwapState-
|
|
8
|
+
import { I as IHoneySwapState } from '../useHoneySwapState-twi7NTaO.js';
|
|
9
9
|
import * as _berachain_graphql_bend_whisk from '@berachain/graphql/bend/whisk';
|
|
10
10
|
import { TokenInfoFragmentFragment } from '@berachain/graphql/bend/whisk';
|
|
11
11
|
import * as _berachain_config from '@berachain/config';
|
|
@@ -14,7 +14,7 @@ import '@berachain/config/internal/flags';
|
|
|
14
14
|
import '@apollo/client';
|
|
15
15
|
import '../BeraError-7-A5JYy_.js';
|
|
16
16
|
import 'react';
|
|
17
|
-
import '../HoneyConfigProvider-
|
|
17
|
+
import '../HoneyConfigProvider-COOuDNra.js';
|
|
18
18
|
import 'react/jsx-runtime';
|
|
19
19
|
import '@berachain-foundation/berancer-sdk';
|
|
20
20
|
import '../honey-CYm0RWf4.js';
|
package/dist/utils/exports.mjs
CHANGED
|
@@ -484,6 +484,10 @@ var contracts = [
|
|
|
484
484
|
"80094": "0x2880aB155794e7179c9eE2e38200202908C17B43",
|
|
485
485
|
name: "external.pyth"
|
|
486
486
|
},
|
|
487
|
+
{
|
|
488
|
+
"80094": "0xB5f473c4b7F402d8f7bED42b6D516f5ff3306B01",
|
|
489
|
+
name: "bend.production.supportedVaults.1"
|
|
490
|
+
},
|
|
487
491
|
{
|
|
488
492
|
"80069": null,
|
|
489
493
|
"80094": "0xC5FabF3a7E98a2ed89f5d5057Ab010634Ca7e71f",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/berajs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"@apollo/client": "4.1.6",
|
|
14
14
|
"@berachain-foundation/berancer-sdk": "1.1.7",
|
|
15
15
|
"@berachain/abis": "0.1.3-beta.0",
|
|
16
|
-
"@berachain/config": "0.1.
|
|
17
|
-
"@berachain/graphql": "0.5.
|
|
16
|
+
"@berachain/config": "0.1.20",
|
|
17
|
+
"@berachain/graphql": "0.5.1",
|
|
18
18
|
"@ensofinance/sdk": "2.3.1",
|
|
19
19
|
"@pythnetwork/hermes-client": "2.0.0",
|
|
20
20
|
"@wagmi/core": "2.22.1",
|
|
21
|
-
"gray-matter": "4.0.3"
|
|
22
|
-
"swr": "2.4.1"
|
|
21
|
+
"gray-matter": "4.0.3"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
24
|
"@types/react-dom": "19.2.3",
|
|
26
25
|
"@types/react": "19.2.14",
|
|
27
26
|
"@typescript/analyze-trace": "0.10.1",
|
|
27
|
+
"swr": "2.4.1",
|
|
28
28
|
"tsup": "8.5.1",
|
|
29
29
|
"typescript": "5.5.4",
|
|
30
|
-
"viem": "2.
|
|
31
|
-
"vitest": "3.2.
|
|
30
|
+
"viem": "2.52.0",
|
|
31
|
+
"vitest": "3.2.6",
|
|
32
32
|
"@berachain/utils": "0.1.0",
|
|
33
33
|
"@berachain/wagmi": "0.4.2-beta.6"
|
|
34
34
|
},
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"react": "^19.1",
|
|
88
88
|
"react-dom": "^19.1",
|
|
89
|
+
"swr": "^2.4.1",
|
|
89
90
|
"viem": "^2.41.2",
|
|
90
91
|
"@berachain/wagmi": "0.4.2-beta.6"
|
|
91
92
|
},
|
|
@@ -7,15 +7,41 @@ interface GetMaxDepositProps {
|
|
|
7
7
|
publicClient: PublicClient;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export interface MaxDeposit {
|
|
11
|
+
/** `maxDeposit` formatted as an ether-denominated decimal string. */
|
|
12
|
+
formatted: string;
|
|
13
|
+
/**
|
|
14
|
+
* True when the vault has no real deposit cap. MetaMorpho's `maxDeposit` sums
|
|
15
|
+
* each enabled market's remaining capacity (its supply cap minus current
|
|
16
|
+
* supply); an uncapped market stores `type(uint184).max` as its cap, so the
|
|
17
|
+
* sum lands at ~uint184.max (≈2.45e55) — not uint256.max. `formatted` turns
|
|
18
|
+
* that into an astronomical number, so callers must key off this flag, not
|
|
19
|
+
* the formatted value, to detect "unlimited".
|
|
20
|
+
*
|
|
21
|
+
* A genuine cap is many orders of magnitude smaller (e.g. Re7 HONEY's ~92M =
|
|
22
|
+
* ~9.2e25), so the uint184-based threshold cleanly separates the two. The sum
|
|
23
|
+
* can exceed uint184.max when several markets are uncapped, so we compare with
|
|
24
|
+
* `>=` rather than testing for the exact sentinel.
|
|
25
|
+
*/
|
|
26
|
+
isUncapped: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const UINT_184_MAX = (1n << 184n) - 1n;
|
|
30
|
+
// 1% below uint184.max — any maxDeposit at/above this is effectively unlimited.
|
|
31
|
+
const UNCAPPED_THRESHOLD = (UINT_184_MAX * 99n) / 100n;
|
|
32
|
+
|
|
10
33
|
export async function getMaxDeposit({
|
|
11
34
|
vaultAddress,
|
|
12
35
|
publicClient,
|
|
13
|
-
}: GetMaxDepositProps): Promise<
|
|
36
|
+
}: GetMaxDepositProps): Promise<MaxDeposit> {
|
|
14
37
|
const maxDeposit = await publicClient.readContract({
|
|
15
38
|
address: vaultAddress,
|
|
16
39
|
abi: metaMorphoAbi,
|
|
17
40
|
functionName: "maxDeposit",
|
|
18
41
|
args: [vaultAddress],
|
|
19
42
|
});
|
|
20
|
-
return
|
|
43
|
+
return {
|
|
44
|
+
formatted: formatEther(maxDeposit),
|
|
45
|
+
isUncapped: maxDeposit >= UNCAPPED_THRESHOLD,
|
|
46
|
+
};
|
|
21
47
|
}
|
|
@@ -65,7 +65,7 @@ export function fetchOpenApi<Paths extends AnyPaths, P extends GetPath<Paths>>(
|
|
|
65
65
|
): Promise<GetResponse<Paths, P>> {
|
|
66
66
|
const { path: pathParams, query } = params as {
|
|
67
67
|
path?: Record<string, string | number>;
|
|
68
|
-
query?: Record<string, string | number>;
|
|
68
|
+
query?: Record<string, string | number | undefined>;
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
// Substitute `{param}` placeholders from the typed path params.
|
|
@@ -80,9 +80,13 @@ export function fetchOpenApi<Paths extends AnyPaths, P extends GetPath<Paths>>(
|
|
|
80
80
|
return encodeURIComponent(String(value));
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
+
// Omit params whose value is `undefined` rather than serializing them as the
|
|
84
|
+
// literal string "undefined" (e.g. optional filters left unset by callers).
|
|
83
85
|
const search = query
|
|
84
86
|
? new URLSearchParams(
|
|
85
|
-
Object.entries(query)
|
|
87
|
+
Object.entries(query)
|
|
88
|
+
.filter(([, v]) => v !== undefined)
|
|
89
|
+
.map(([k, v]) => [k, String(v)]),
|
|
86
90
|
).toString()
|
|
87
91
|
: "";
|
|
88
92
|
|
|
@@ -72,6 +72,23 @@ describe("fetchOpenApi", () => {
|
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
it("omits query params whose value is undefined", async () => {
|
|
76
|
+
await fetchOpenApi<beepPaths, "/v0/honey/transactions/latest">(
|
|
77
|
+
NAMED_LINK,
|
|
78
|
+
"/v0/honey/transactions/latest",
|
|
79
|
+
// `perPage` is set; `page` is left undefined and must not be serialized
|
|
80
|
+
// as the literal string "undefined".
|
|
81
|
+
{ query: { page: undefined, perPage: "10" } },
|
|
82
|
+
"beep",
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
expect(beraFetchJson).toHaveBeenCalledWith(
|
|
86
|
+
expect.objectContaining({
|
|
87
|
+
url: `${BASE}/v0/honey/transactions/latest?perPage=10`,
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
75
92
|
it("url-encodes path param values", async () => {
|
|
76
93
|
// `pubkey` is a free-form string segment; reserved chars must be encoded.
|
|
77
94
|
await fetchOpenApi<beepPaths, "/v0/validators/{pubkey}/incentives">(
|
|
@@ -153,12 +170,17 @@ describe("fetchBeep", () => {
|
|
|
153
170
|
);
|
|
154
171
|
});
|
|
155
172
|
|
|
156
|
-
it("throws when config.beep is not set (e.g.
|
|
173
|
+
it("throws when config.beep is not set (e.g. a chain not yet migrated)", () => {
|
|
174
|
+
// Construct the no-beep case explicitly rather than relying on a real
|
|
175
|
+
// chain config: `mainnet.beep` is env-gated, so it may be set in some
|
|
176
|
+
// environments.
|
|
177
|
+
const configWithoutBeep = { ...mainnet, beep: null };
|
|
178
|
+
|
|
157
179
|
expect(() =>
|
|
158
180
|
fetchBeep(
|
|
159
181
|
"/v0/stake/{vault}/earnings/{owner}",
|
|
160
182
|
{ path: { vault: VAULT, owner: OWNER } },
|
|
161
|
-
{ config:
|
|
183
|
+
{ config: configWithoutBeep },
|
|
162
184
|
),
|
|
163
185
|
).toThrow(/`beep` backend is not configured/);
|
|
164
186
|
});
|
package/src/actions/exports.ts
CHANGED
|
@@ -35,6 +35,7 @@ export * from "./honey/getHoneyPausedState";
|
|
|
35
35
|
export * from "./honey/getHoneyPreview";
|
|
36
36
|
export * from "./honey/getHoneyPythPriceOracle";
|
|
37
37
|
export * from "./honey/getHoneyRootPriceOracle";
|
|
38
|
+
export * from "./honey/getHoneyTxns";
|
|
38
39
|
export * from "./honey/getHoneyVaultsBalance";
|
|
39
40
|
export * from "./honey/getPythLatestPrices";
|
|
40
41
|
export * from "./honey/getRelativeCapLimit";
|