@berachain/berajs 0.1.0-alpha.0

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/BeraError-CfcNTfpH.d.ts +69 -0
  4. package/dist/BexStatusProvider-nS3NcdxI.d.ts +70 -0
  5. package/dist/RequestError-CtJLUaAc.d.ts +57 -0
  6. package/dist/abi/index.d.ts +26765 -0
  7. package/dist/abi/index.mjs +1 -0
  8. package/dist/actions/index.d.ts +1649 -0
  9. package/dist/actions/index.mjs +1 -0
  10. package/dist/aggregatorsRouter-Cny4B_MB.d.ts +593 -0
  11. package/dist/chunk-4IBBLGNS.mjs +1 -0
  12. package/dist/chunk-5GPS724E.mjs +1 -0
  13. package/dist/chunk-5UFI7X4U.mjs +1 -0
  14. package/dist/chunk-AHAZC5K3.mjs +1 -0
  15. package/dist/chunk-JQDPAEK2.mjs +2 -0
  16. package/dist/chunk-K4NZIO2Z.mjs +1 -0
  17. package/dist/chunk-MTBICGRP.mjs +1 -0
  18. package/dist/chunk-RNESAHY2.mjs +3 -0
  19. package/dist/chunk-SMZ3PG6A.mjs +1 -0
  20. package/dist/chunk-XX77QPIR.mjs +1 -0
  21. package/dist/chunk-YKNKCICU.mjs +1 -0
  22. package/dist/contexts/index.d.ts +81 -0
  23. package/dist/contexts/index.mjs +1 -0
  24. package/dist/defaultFlags-V-tJs2K8.d.ts +10 -0
  25. package/dist/dex-BD7Bq3pJ.d.ts +562 -0
  26. package/dist/dex-DreiokgL.d.ts +562 -0
  27. package/dist/enum/index.d.ts +31 -0
  28. package/dist/enum/index.mjs +1 -0
  29. package/dist/errors/index.d.ts +204 -0
  30. package/dist/errors/index.mjs +1 -0
  31. package/dist/getValidatorQueuedOperatorAddress--AXNo9IY.d.ts +440 -0
  32. package/dist/getValidatorQueuedOperatorAddress-DK2Xv19c.d.ts +440 -0
  33. package/dist/hooks/index.d.ts +1703 -0
  34. package/dist/hooks/index.mjs +3 -0
  35. package/dist/polling-BKnyavLI.d.ts +8 -0
  36. package/dist/pythWrapper-CBjsmmsK.d.ts +1958 -0
  37. package/dist/staking-Cggi38So.d.ts +246 -0
  38. package/dist/staking-DYbVFigB.d.ts +246 -0
  39. package/dist/txnEnum-BQKDfaeH.d.ts +81 -0
  40. package/dist/txnEnum-Diichv9Z.d.ts +80 -0
  41. package/dist/types/index.d.ts +56 -0
  42. package/dist/types/index.mjs +1 -0
  43. package/dist/useHoneySwapState-CW49RVci.d.ts +32 -0
  44. package/dist/useHoneySwapState-Ci8_c2bT.d.ts +32 -0
  45. package/dist/utils/index.d.ts +349 -0
  46. package/dist/utils/index.mjs +1 -0
  47. package/package.json +64 -0
@@ -0,0 +1,1703 @@
1
+ import * as swr from 'swr';
2
+ import { SWRResponse } from 'swr';
3
+ import { G as GetConvertToAssetsProps, O as OnChainPool, c as GetHoneyVaultsBalanceResponse, e as IsBadCollateralResponse, f as GetBgtAprSimulationArgs, h as GetBgtAprSimulationResult, k as GlobalData, m as GetMarkets, S as StakedBeraWithdrawal, R as RewardVaultIncentive, q as GetRewardVaultRewardsReturn, s as GetGaugeData, u as GetStakedBeraSnapshotsArgs, x as GetUserVaultsResponse, z as GetVaultHistoryArgs, V as ValidatorRewardAllocation, B as ValidatorWithUserBoost, D as UserBoostsOnValidator, F as UserStakingPoolPosition, J as ValidatorQueuedCommission, L as ValidatorQueuedOperatorAddress } from '../getValidatorQueuedOperatorAddress-DK2Xv19c.js';
4
+ import { D as DefaultHookOptions, S as SwapReferrer, d as HoneyConfigContextReturn, I as IRawAggregatorQuote, A as Aggregators, a as Token, x as TokenInput, y as PoolCreationStep, k as TokenCurrentPriceMap, z as TokenWithAmount, E as DefaultHookReturnType, F as IUserPosition, l as AllowanceToken, G as BalanceTokenWithMetadata, B as BalanceToken, j as PythPriceFeedMap, P as PythLatestUpdates, b as TokenWithMetadata, J as TokenPriceInfo, K as IUseContractWriteArgs, U as UseContractWriteApi } from '../dex-DreiokgL.js';
5
+ export { L as TxnEventKeys } from '../dex-DreiokgL.js';
6
+ import { Address, Hex } from 'viem';
7
+ import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
8
+ import { GetPoolsQueryVariables, MinimalPoolFragment, GqlPoolEventType, PoolHistoricalDataFragment, GqlRewardVaultDynamicData, GqlValidatorDynamicData } from '@berachain/graphql/dex/api';
9
+ export { u as useBexStatus } from '../BexStatusProvider-nS3NcdxI.js';
10
+ import { PoolType } from '@berachain-foundation/berancer-sdk';
11
+ import { SubgraphPoolFragment } from '@berachain/graphql/dex/subgraph';
12
+ import { P as POLLING } from '../polling-BKnyavLI.js';
13
+ import * as swr__internal from 'swr/_internal';
14
+ import { GetZapTransactions, GetZapTransactionResponse } from '../types/index.js';
15
+ import * as _ensofinance_sdk from '@ensofinance/sdk';
16
+ export { BundleData } from '@ensofinance/sdk';
17
+ import * as react from 'react';
18
+ import react__default from 'react';
19
+ import { G as GovernanceTopic, c as CustomProposalErrors, C as CustomProposal, U as UserVaultInfo, B as BribeBoostRewardProof } from '../staking-Cggi38So.js';
20
+ import * as swr_infinite from 'swr/infinite';
21
+ import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from 'swr/infinite';
22
+ import * as _berachain_graphql_governance from '@berachain/graphql/governance';
23
+ import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
24
+ import { I as IHoneySwapState } from '../useHoneySwapState-Ci8_c2bT.js';
25
+ export { r as reducer, u as useHoneySwapState } from '../useHoneySwapState-Ci8_c2bT.js';
26
+ import * as _berachain_graphql_honey from '@berachain/graphql/honey';
27
+ import BigNumber from 'bignumber.js';
28
+ import * as _berachain_graphql_pol_api from '@berachain/graphql/pol/api';
29
+ import { GqlRewardVaultFilter, ApiVaultFragment, GetVaultsQueryVariables, GetSWberaVaultSnapshotsQuery, GetVaultHistoryQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GqlChain, GetValidatorsQuery, GetValidatorQuery, ApiValidatorMinimalFragment } from '@berachain/graphql/pol/api';
30
+ import * as react_jsx_runtime from 'react/jsx-runtime';
31
+ import { Config } from '@wagmi/core';
32
+ import { T as TransactionActionType } from '../txnEnum-BQKDfaeH.js';
33
+ import * as _berachain_graphql_pol_subgraph from '@berachain/graphql/pol/subgraph';
34
+ import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
35
+ import '../aggregatorsRouter-Cny4B_MB.js';
36
+ import '@berachain/config';
37
+ import '../BeraError-CfcNTfpH.js';
38
+ import '@sentry/nextjs';
39
+ import '@berachain/config/internal/edge-config';
40
+
41
+ declare const useGetConvertToAssets: ({ sharesAmount, vaultAddress, vaultChainId, }: Omit<GetConvertToAssetsProps, "publicClient"> & {
42
+ vaultChainId?: number;
43
+ }, options?: DefaultHookOptions) => {
44
+ refresh: () => void;
45
+ data: {
46
+ raw: bigint;
47
+ formatted: string;
48
+ } | undefined;
49
+ error: any;
50
+ mutate: swr.KeyedMutator<{
51
+ raw: bigint;
52
+ formatted: string;
53
+ }>;
54
+ isValidating: boolean;
55
+ isLoading: boolean;
56
+ };
57
+
58
+ type IUseAggregatorsQuotesArgs = BeraJS.BaseFunctionArgs & {
59
+ tokenIn: Address;
60
+ tokenOut: Address;
61
+ tokenInDecimals: number;
62
+ tokenOutDecimals: number;
63
+ amount: string;
64
+ slippage: number;
65
+ referrer?: SwapReferrer;
66
+ rewardVault?: Address;
67
+ /**
68
+ * Useful cause the collaterals are provided byt he honeyContext and this way we can
69
+ * use the Provider only in the swap page where is needed.
70
+ *
71
+ * The collaterals for the honey mint/redeem aggregator.
72
+ */
73
+ honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList" | "protocol">;
74
+ };
75
+ declare const USE_AGGREGATORS_QUOTES_QUERY_KEY = "useAggregatorsQuotes";
76
+ declare const useAggregatorsQuotes: (args: IUseAggregatorsQuotesArgs, options?: DefaultHookOptions) => {
77
+ refresh: () => Promise<IRawAggregatorQuote<false> | IRawAggregatorQuote | undefined>[];
78
+ quotes: IRawAggregatorQuote[];
79
+ loadingAggregatorsNames: (Aggregators | null)[];
80
+ isLoading: boolean;
81
+ error: any;
82
+ };
83
+
84
+ declare const useAggregatorsRouterFeeBps: () => {
85
+ refresh: swr.KeyedMutator<number>;
86
+ data: number | undefined;
87
+ error: any;
88
+ mutate: swr.KeyedMutator<number>;
89
+ isValidating: boolean;
90
+ isLoading: boolean;
91
+ };
92
+
93
+ declare const useAllUserPoolsQueryKey: ({ query, }?: {
94
+ query?: GetPoolsQueryVariables;
95
+ }) => (string | _berachain_graphql_dex_api.Exact<{
96
+ textSearch?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["String"]["input"]>;
97
+ first?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["Int"]["input"]>;
98
+ userAddress?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["String"]["input"]>;
99
+ chain: Array<_berachain_graphql_dex_api.GqlChain> | _berachain_graphql_dex_api.GqlChain;
100
+ orderBy?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.GqlPoolOrderBy>;
101
+ skip?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["Int"]["input"]>;
102
+ orderDirection?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.GqlPoolOrderDirection>;
103
+ blacklistedPoolIds?: _berachain_graphql_dex_api.InputMaybe<Array<_berachain_graphql_dex_api.Scalars["String"]["input"]> | _berachain_graphql_dex_api.Scalars["String"]["input"]>;
104
+ }> | undefined)[];
105
+ declare const useAllUserPools: (query: GetPoolsQueryVariables, options?: DefaultHookOptions) => {
106
+ refresh: () => void;
107
+ data: {
108
+ pools: {
109
+ __typename?: "GqlPoolMinimal";
110
+ id: string;
111
+ name: string;
112
+ address: `0x${string}`;
113
+ factory?: `0x${string}` | null;
114
+ protocolVersion: number;
115
+ type: _berachain_graphql_dex_api.GqlPoolType;
116
+ tokens: Array<{
117
+ __typename?: "GqlPoolTokenExpanded";
118
+ address: `0x${string}`;
119
+ symbol: string;
120
+ name: string;
121
+ decimals: number;
122
+ }>;
123
+ dynamicData: {
124
+ __typename?: "GqlPoolDynamicData";
125
+ totalShares: string;
126
+ fees24h: string;
127
+ volume24h: string;
128
+ swapFee: string;
129
+ isInRecoveryMode: boolean;
130
+ isPaused: boolean;
131
+ totalLiquidity: string;
132
+ aprItems: Array<{
133
+ __typename?: "GqlPoolAprItem";
134
+ apr: number;
135
+ type: _berachain_graphql_dex_api.GqlPoolAprItemType;
136
+ id: string;
137
+ }>;
138
+ };
139
+ userBalance?: {
140
+ __typename?: "GqlPoolUserBalance";
141
+ totalBalanceUsd: number;
142
+ walletBalance: any;
143
+ walletBalanceUsd: number;
144
+ } | null;
145
+ rewardVault?: {
146
+ __typename?: "GqlRewardVault";
147
+ isVaultWhitelisted: boolean;
148
+ vaultAddress: `0x${string}`;
149
+ stakingTokenAddress: `0x${string}`;
150
+ dynamicData?: {
151
+ __typename?: "GqlRewardVaultDynamicData";
152
+ activeIncentivesValueUsd: string;
153
+ apr?: number | null;
154
+ bgtCapturePercentage: string;
155
+ allTimeReceivedBGTAmount: string;
156
+ } | null;
157
+ } | null;
158
+ }[];
159
+ count: number;
160
+ } | undefined;
161
+ error: any;
162
+ mutate: swr.KeyedMutator<{
163
+ pools: {
164
+ __typename?: "GqlPoolMinimal";
165
+ id: string;
166
+ name: string;
167
+ address: `0x${string}`;
168
+ factory?: `0x${string}` | null;
169
+ protocolVersion: number;
170
+ type: _berachain_graphql_dex_api.GqlPoolType;
171
+ tokens: Array<{
172
+ __typename?: "GqlPoolTokenExpanded";
173
+ address: `0x${string}`;
174
+ symbol: string;
175
+ name: string;
176
+ decimals: number;
177
+ }>;
178
+ dynamicData: {
179
+ __typename?: "GqlPoolDynamicData";
180
+ totalShares: string;
181
+ fees24h: string;
182
+ volume24h: string;
183
+ swapFee: string;
184
+ isInRecoveryMode: boolean;
185
+ isPaused: boolean;
186
+ totalLiquidity: string;
187
+ aprItems: Array<{
188
+ __typename?: "GqlPoolAprItem";
189
+ apr: number;
190
+ type: _berachain_graphql_dex_api.GqlPoolAprItemType;
191
+ id: string;
192
+ }>;
193
+ };
194
+ userBalance?: {
195
+ __typename?: "GqlPoolUserBalance";
196
+ totalBalanceUsd: number;
197
+ walletBalance: any;
198
+ walletBalanceUsd: number;
199
+ } | null;
200
+ rewardVault?: {
201
+ __typename?: "GqlRewardVault";
202
+ isVaultWhitelisted: boolean;
203
+ vaultAddress: `0x${string}`;
204
+ stakingTokenAddress: `0x${string}`;
205
+ dynamicData?: {
206
+ __typename?: "GqlRewardVaultDynamicData";
207
+ activeIncentivesValueUsd: string;
208
+ apr?: number | null;
209
+ bgtCapturePercentage: string;
210
+ allTimeReceivedBGTAmount: string;
211
+ } | null;
212
+ } | null;
213
+ }[];
214
+ count: number;
215
+ }>;
216
+ isValidating: boolean;
217
+ isLoading: boolean;
218
+ };
219
+
220
+ declare const useApiPoolQueryKey: ({ poolId, account, }: {
221
+ poolId: Hex;
222
+ account?: Address;
223
+ }) => readonly ["usePool-api", `0x${string}`, `0x${string}` | undefined] | null;
224
+ declare function useApiPool({ poolId, account, }: {
225
+ poolId: Hex;
226
+ account?: Address;
227
+ }): {
228
+ refresh: () => void;
229
+ data: MinimalPoolFragment | undefined;
230
+ error: any;
231
+ mutate: swr.KeyedMutator<MinimalPoolFragment>;
232
+ isValidating: boolean;
233
+ isLoading: boolean;
234
+ };
235
+
236
+ interface UseCreatePoolProps extends BeraJS.BaseFunctionArgs {
237
+ poolCreateTokens: Token[];
238
+ initialLiquidityTokens: TokenInput[];
239
+ normalizedWeights: bigint[];
240
+ poolType: PoolType;
241
+ swapFee: number;
242
+ owner: string;
243
+ poolSymbol: string;
244
+ poolName: string;
245
+ amplification: number;
246
+ weightsDuplicationThreshold?: number;
247
+ oracles: Oracle[];
248
+ }
249
+ interface UseCreatePoolReturn {
250
+ generatedPoolName: string;
251
+ generatedPoolSymbol: string;
252
+ isDupePool: boolean;
253
+ dupePool?: SubgraphPoolFragment | null;
254
+ createPoolArgs: any;
255
+ isLoadingPools: boolean;
256
+ errorLoadingPools: boolean;
257
+ }
258
+ declare enum OracleMode {
259
+ None = "None",
260
+ Custom = "Custom"
261
+ }
262
+ interface Oracle {
263
+ mode: OracleMode;
264
+ address: string;
265
+ tokenAddress: string;
266
+ cacheDuration: number;
267
+ }
268
+ declare const useCreatePool: ({ poolCreateTokens, initialLiquidityTokens, normalizedWeights, poolType, poolName, poolSymbol, swapFee, owner, amplification, oracles, weightsDuplicationThreshold, ...baseArgs }: UseCreatePoolProps) => UseCreatePoolReturn;
269
+
270
+ declare const useExploitedTokensQueryKey: (tokens: Token[] | undefined) => readonly ["useExploitedTokens", Token[]] | null;
271
+ /**
272
+ * This hook checks if any of provided tokens might have been exploited by frontrunning its deployment.
273
+ *
274
+ * @see {@link getIsTokenExploited} for more details
275
+ * @returns a record of tokens and whether they might have been exploited
276
+ */
277
+ declare const useExploitedTokens: ({ tokens, }: {
278
+ tokens: Token[] | undefined;
279
+ }) => {
280
+ refresh: () => Promise<Record<`0x${string}`, boolean> | undefined>;
281
+ data: Record<`0x${string}`, boolean> | undefined;
282
+ error: any;
283
+ mutate: swr.KeyedMutator<Record<`0x${string}`, boolean>>;
284
+ isValidating: boolean;
285
+ isLoading: boolean;
286
+ };
287
+
288
+ declare const useGlobalLiquidityAndSwapVolume: () => {
289
+ data: {
290
+ totalLiquidity: number;
291
+ swapVolume24h: number;
292
+ };
293
+ refresh: () => Promise<_berachain_graphql_dex_api.GetGlobalLiquidityAndSwapVolumeQuery | undefined>;
294
+ error: any;
295
+ mutate: swr.KeyedMutator<_berachain_graphql_dex_api.GetGlobalLiquidityAndSwapVolumeQuery>;
296
+ isValidating: boolean;
297
+ isLoading: boolean;
298
+ };
299
+
300
+ type LiquidityMismatchInfo = {
301
+ title: string | null;
302
+ message: string | null;
303
+ suggestWeighted?: boolean;
304
+ };
305
+ interface UseLiquidityMismatchParams {
306
+ currentStep: PoolCreationStep;
307
+ tokenPrices?: TokenCurrentPriceMap;
308
+ isLoadingTokenPrices: boolean;
309
+ tokens: TokenWithAmount[] | null;
310
+ weights: bigint[] | null;
311
+ weightsError: string | null;
312
+ poolType: PoolType;
313
+ liquidityMismatchTolerancePercent?: number;
314
+ oracles: Oracle[];
315
+ }
316
+ /**
317
+ * Hook for detecting liquidity mismatches.
318
+ *
319
+ * @param {PoolCreationStep} currentStep - The current step of the pool creation process.
320
+ * @param {Record<string, number>} tokenPrices - The current token prices.
321
+ * @param {boolean} isLoadingTokenPrices - Whether the token prices are still loading.
322
+ * @param {Array<{ address: string, amount: number }>} tokens - The tokens in the pool, including their addresses and amounts.
323
+ * @param {Record<string, number>} weights - The per-token weights in the pool we are creating.
324
+ * @param {string | null} weightsError - An error message for the weights indicating that the weights are invalid.
325
+ * @param {string} poolType - The type of pool being created.
326
+ * @param {number} liquidityMismatchTolerancePercent - The tolerance for liquidity mismatches in percent.
327
+ * @returns {Object} The liquidity mismatch info.
328
+ */
329
+ declare const useLiquidityMismatch: ({ currentStep, tokenPrices, isLoadingTokenPrices, tokens, weights, weightsError, poolType, liquidityMismatchTolerancePercent, oracles, }: UseLiquidityMismatchParams) => LiquidityMismatchInfo;
330
+
331
+ type IUseLpPositionArgs = {
332
+ pool: MinimalPoolFragment | undefined;
333
+ vaultAddress?: Address | undefined;
334
+ };
335
+ /**
336
+ * Given a pool and used within an initialized viem context, returns the user's position
337
+ */
338
+ declare const useLpPosition: ({ pool, vaultAddress }: IUseLpPositionArgs, options?: DefaultHookOptions) => DefaultHookReturnType<IUserPosition>;
339
+
340
+ type NeedsApprovalToken = AllowanceToken & {
341
+ maxAmountIn: bigint;
342
+ };
343
+ declare const useMultipleTokenApprovalsWithSlippage: (tokenInput: TokenInput[], spender: Address | undefined, slippage?: number) => {
344
+ needsApproval: NeedsApprovalToken[];
345
+ refresh: () => void;
346
+ isLoading: boolean;
347
+ };
348
+
349
+ declare function useOnChainPoolDataQueryKey(args: {
350
+ poolId: string;
351
+ } | {
352
+ address: Address;
353
+ }): readonly ["useOnChainPoolData", `0x${string}`] | null;
354
+ interface OnChainPoolFragment extends SubgraphPoolFragment {
355
+ amplificationParameter: {
356
+ currentFormattedValue: number | undefined;
357
+ } | undefined;
358
+ }
359
+ declare function useOnChainPoolData(poolId: string): {
360
+ data: OnChainPoolFragment | undefined;
361
+ error: any;
362
+ isLoading: boolean;
363
+ mutate: swr.KeyedMutator<OnChainPool>;
364
+ refresh: () => Promise<OnChainPool | undefined>;
365
+ };
366
+
367
+ /**
368
+ * Hook for fetching relayer approval status with SWR
369
+ *
370
+ * @returns SWR data spread and refresh function
371
+ */
372
+ declare const usePollPoolCreationRelayerApproval: (options?: DefaultHookOptions) => {
373
+ refreshPoolCreationApproval: () => void;
374
+ data: boolean | undefined;
375
+ error: any;
376
+ mutate: swr.KeyedMutator<boolean>;
377
+ isValidating: boolean;
378
+ isLoading: boolean;
379
+ };
380
+
381
+ declare function useSubgraphPoolQueryKey({ poolId }: {
382
+ poolId: string;
383
+ }): string[] | null;
384
+ declare const usePool: ({ poolId }: {
385
+ poolId: Hex;
386
+ }) => {
387
+ data: readonly [{
388
+ __typename?: "Pool";
389
+ id: string;
390
+ name?: string | null;
391
+ address: `0x${string}`;
392
+ factory?: `0x${string}` | null;
393
+ swapFee: string;
394
+ totalShares: string;
395
+ totalLiquidity: string;
396
+ createTime: number;
397
+ owner?: `0x${string}` | null;
398
+ type?: string | null;
399
+ tokens?: Array<{
400
+ __typename?: "PoolToken";
401
+ address: `0x${string}`;
402
+ name: string;
403
+ decimals: number;
404
+ symbol: string;
405
+ index?: number | null;
406
+ weight?: string | null;
407
+ balance: string;
408
+ }> | null;
409
+ } | undefined, _berachain_graphql_dex_api.MinimalPoolFragment | undefined, OnChainPoolFragment | undefined];
410
+ isLoading: boolean;
411
+ isError: any;
412
+ refresh: () => void;
413
+ };
414
+
415
+ declare const usePoolEvents: ({ poolId, typeInArray, }: {
416
+ poolId: string | undefined;
417
+ typeInArray: GqlPoolEventType[];
418
+ }) => swr.SWRResponse<_berachain_graphql_dex_api.GetPoolEventsQuery, any, {
419
+ refreshInterval: POLLING;
420
+ }>;
421
+
422
+ type UsePoolHistoricalDataArgs = {
423
+ poolId: string | undefined;
424
+ };
425
+ declare const usePoolHistoricalData: ({ poolId, ...baseArgs }: UsePoolHistoricalDataArgs & BeraJS.BaseFunctionArgs, options?: DefaultHookOptions) => DefaultHookReturnType<PoolHistoricalDataFragment[] | undefined>;
426
+
427
+ declare const usePoolsQueryKey: ({ query, }?: {
428
+ query?: GetPoolsQueryVariables;
429
+ }) => (string | _berachain_graphql_dex_api.Exact<{
430
+ textSearch?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["String"]["input"]>;
431
+ first?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["Int"]["input"]>;
432
+ userAddress?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["String"]["input"]>;
433
+ chain: Array<_berachain_graphql_dex_api.GqlChain> | _berachain_graphql_dex_api.GqlChain;
434
+ orderBy?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.GqlPoolOrderBy>;
435
+ skip?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.Scalars["Int"]["input"]>;
436
+ orderDirection?: _berachain_graphql_dex_api.InputMaybe<_berachain_graphql_dex_api.GqlPoolOrderDirection>;
437
+ blacklistedPoolIds?: _berachain_graphql_dex_api.InputMaybe<Array<_berachain_graphql_dex_api.Scalars["String"]["input"]> | _berachain_graphql_dex_api.Scalars["String"]["input"]>;
438
+ }> | undefined)[];
439
+ /**
440
+ * Returns all pools from bex api, including user's pools if logged in
441
+ * @todo add subgraph fallback
442
+ */
443
+ declare const usePools: (query: GetPoolsQueryVariables, options?: DefaultHookOptions) => {
444
+ pools: {
445
+ __typename?: "GqlPoolMinimal";
446
+ id: string;
447
+ name: string;
448
+ address: `0x${string}`;
449
+ factory?: `0x${string}` | null;
450
+ protocolVersion: number;
451
+ type: _berachain_graphql_dex_api.GqlPoolType;
452
+ tokens: Array<{
453
+ __typename?: "GqlPoolTokenExpanded";
454
+ address: `0x${string}`;
455
+ symbol: string;
456
+ name: string;
457
+ decimals: number;
458
+ }>;
459
+ dynamicData: {
460
+ __typename?: "GqlPoolDynamicData";
461
+ totalShares: string;
462
+ fees24h: string;
463
+ volume24h: string;
464
+ swapFee: string;
465
+ isInRecoveryMode: boolean;
466
+ isPaused: boolean;
467
+ totalLiquidity: string;
468
+ aprItems: Array<{
469
+ __typename?: "GqlPoolAprItem";
470
+ apr: number;
471
+ type: _berachain_graphql_dex_api.GqlPoolAprItemType;
472
+ id: string;
473
+ }>;
474
+ };
475
+ userBalance?: {
476
+ __typename?: "GqlPoolUserBalance";
477
+ totalBalanceUsd: number;
478
+ walletBalance: any;
479
+ walletBalanceUsd: number;
480
+ } | null;
481
+ rewardVault?: {
482
+ __typename?: "GqlRewardVault";
483
+ isVaultWhitelisted: boolean;
484
+ vaultAddress: `0x${string}`;
485
+ stakingTokenAddress: `0x${string}`;
486
+ dynamicData?: {
487
+ __typename?: "GqlRewardVaultDynamicData";
488
+ activeIncentivesValueUsd: string;
489
+ apr?: number | null;
490
+ bgtCapturePercentage: string;
491
+ allTimeReceivedBGTAmount: string;
492
+ } | null;
493
+ } | null;
494
+ }[];
495
+ walletPools: {
496
+ __typename?: "GqlPoolMinimal";
497
+ id: string;
498
+ name: string;
499
+ address: `0x${string}`;
500
+ factory?: `0x${string}` | null;
501
+ protocolVersion: number;
502
+ type: _berachain_graphql_dex_api.GqlPoolType;
503
+ tokens: Array<{
504
+ __typename?: "GqlPoolTokenExpanded";
505
+ address: `0x${string}`;
506
+ symbol: string;
507
+ name: string;
508
+ decimals: number;
509
+ }>;
510
+ dynamicData: {
511
+ __typename?: "GqlPoolDynamicData";
512
+ totalShares: string;
513
+ fees24h: string;
514
+ volume24h: string;
515
+ swapFee: string;
516
+ isInRecoveryMode: boolean;
517
+ isPaused: boolean;
518
+ totalLiquidity: string;
519
+ aprItems: Array<{
520
+ __typename?: "GqlPoolAprItem";
521
+ apr: number;
522
+ type: _berachain_graphql_dex_api.GqlPoolAprItemType;
523
+ id: string;
524
+ }>;
525
+ };
526
+ userBalance?: {
527
+ __typename?: "GqlPoolUserBalance";
528
+ totalBalanceUsd: number;
529
+ walletBalance: any;
530
+ walletBalanceUsd: number;
531
+ } | null;
532
+ rewardVault?: {
533
+ __typename?: "GqlRewardVault";
534
+ isVaultWhitelisted: boolean;
535
+ vaultAddress: `0x${string}`;
536
+ stakingTokenAddress: `0x${string}`;
537
+ dynamicData?: {
538
+ __typename?: "GqlRewardVaultDynamicData";
539
+ activeIncentivesValueUsd: string;
540
+ apr?: number | null;
541
+ bgtCapturePercentage: string;
542
+ allTimeReceivedBGTAmount: string;
543
+ } | null;
544
+ } | null;
545
+ }[];
546
+ isLoading: boolean;
547
+ refresh: () => void;
548
+ pagination: {
549
+ page: number;
550
+ pageSize: _berachain_graphql_dex_api.InputMaybe<number> | undefined;
551
+ count: number;
552
+ };
553
+ };
554
+
555
+ type UseBendTransactionRequestsArgs = {
556
+ tokenIn?: Pick<BalanceTokenWithMetadata, "address" | "decimals" | "price" | "formattedBalance" | "chainId">;
557
+ loanTokenAddress: Address;
558
+ loanTokenPrice: number | undefined;
559
+ bendVault: Address;
560
+ rewardVault?: Address;
561
+ amount?: string;
562
+ slippage?: number;
563
+ chainId?: number;
564
+ };
565
+ /**
566
+ * Get the bend transaction requests for swapping tokens using Enso.
567
+ * @param {UseBendTransactionRequestsArgs} props - The props for the hook see {@link UseBendTransactionRequestsArgs}
568
+ * @returns {DefaultHookReturnType<GetZapTransactionResponse> & {tokens: BalanceTokenWithMetadata[], refresh: () => void}}
569
+ *
570
+ * The bend transaction response data with polling enabled, see {@link GetZapTransactionResponse} and {@link BalanceTokenWithMetadata}
571
+ * @remarks The hook is only enabled when all parameters are provided and amount is greater than 0
572
+ * @see {@link useEnsoZap}
573
+ */
574
+ declare function useBendTransactionRequests({ tokenIn, loanTokenAddress, loanTokenPrice, bendVault, rewardVault, amount, slippage, chainId, }: UseBendTransactionRequestsArgs, options?: DefaultHookOptions): {
575
+ nativeFee: bigint;
576
+ error: any;
577
+ tokens: BalanceTokenWithMetadata[] | undefined;
578
+ refresh: () => void;
579
+ data: {
580
+ bundle: _ensofinance_sdk.BundleData;
581
+ transactions: GetZapTransactions;
582
+ supplyAmount: {
583
+ raw: bigint;
584
+ formatted: string;
585
+ };
586
+ priceImpact: number | undefined;
587
+ } | undefined;
588
+ mutate: swr.KeyedMutator<{
589
+ bundle: _ensofinance_sdk.BundleData;
590
+ transactions: GetZapTransactions;
591
+ supplyAmount: {
592
+ raw: bigint;
593
+ formatted: string;
594
+ };
595
+ priceImpact: number | undefined;
596
+ }>;
597
+ isValidating: boolean;
598
+ isLoading: boolean;
599
+ };
600
+ declare function useBendTransactionRequestsHelper({ tokenIn, loanTokenAddress, loanTokenPrice, bendVault, rewardVault, amount, slippage, chainId, }: UseBendTransactionRequestsArgs, options?: DefaultHookOptions): swr.SWRResponse<{
601
+ bundle: _ensofinance_sdk.BundleData;
602
+ transactions: GetZapTransactions;
603
+ supplyAmount: {
604
+ raw: bigint;
605
+ formatted: string;
606
+ };
607
+ priceImpact: number | undefined;
608
+ }, any, {
609
+ refreshInterval: POLLING;
610
+ errorRetryInterval?: number | undefined;
611
+ errorRetryCount?: number;
612
+ loadingTimeout?: number | undefined;
613
+ focusThrottleInterval?: number | undefined;
614
+ dedupingInterval?: number | undefined;
615
+ refreshWhenHidden?: boolean;
616
+ refreshWhenOffline?: boolean;
617
+ revalidateOnFocus?: boolean | undefined;
618
+ revalidateOnReconnect?: boolean | undefined;
619
+ revalidateOnMount?: boolean;
620
+ revalidateIfStale?: boolean | undefined;
621
+ shouldRetryOnError?: boolean | ((err: any) => boolean) | undefined;
622
+ keepPreviousData?: boolean;
623
+ suspense?: boolean;
624
+ fallbackData?: any;
625
+ fetcher?: swr.BareFetcher<any> | undefined;
626
+ use?: swr.Middleware[];
627
+ fallback?: {
628
+ [key: string]: any;
629
+ } | undefined;
630
+ isPaused?: (() => boolean) | undefined;
631
+ onLoadingSlow?: ((key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
632
+ onSuccess?: ((data: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
633
+ onError?: ((err: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
634
+ onErrorRetry?: ((err: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>, revalidate: swr.Revalidator, revalidateOpts: Required<swr.RevalidatorOptions>) => void) | undefined;
635
+ onDiscarded?: ((key: string) => void) | undefined;
636
+ compare?: ((a: any, b: any) => boolean) | undefined;
637
+ isOnline?: (() => boolean) | undefined;
638
+ isVisible?: (() => boolean) | undefined;
639
+ initFocus?: ((callback: () => void) => (() => void) | void) | undefined;
640
+ initReconnect?: ((callback: () => void) => (() => void) | void) | undefined;
641
+ provider?: (cache: Readonly<swr.Cache>) => swr.Cache;
642
+ isEnabled?: boolean;
643
+ }>;
644
+
645
+ /**
646
+ * Get the enso client.
647
+ * @returns {EnsoClient} The enso client, see {@link EnsoClient}
648
+ * @see {@link useEnsoBalances}
649
+ * @see {@link useTokens}
650
+ */
651
+ declare function useEnsoZap({ chainId }: {
652
+ chainId?: number;
653
+ }): {
654
+ tokens: BalanceTokenWithMetadata[] | undefined;
655
+ getBendTransactionRequests: ({ tokenIn, amount, loanToken, bendVault, rewardVault, slippage, }: {
656
+ tokenIn?: Pick<BalanceToken, "address" | "decimals" | "chainId">;
657
+ amount: string;
658
+ loanToken: Address;
659
+ bendVault: Address;
660
+ rewardVault?: Address;
661
+ slippage: number;
662
+ }) => Promise<GetZapTransactionResponse>;
663
+ getZapTransactionRequests: ({ tokenIn, tokenOut, amount, slippage, }: {
664
+ tokenIn?: Pick<BalanceToken, "address" | "decimals" | "chainId">;
665
+ tokenOut: Address;
666
+ amount: string;
667
+ slippage: number;
668
+ }) => Promise<GetZapTransactionResponse>;
669
+ refreshTokens: () => Promise<BalanceTokenWithMetadata[] | undefined>;
670
+ };
671
+
672
+ /**
673
+ * Get the zap transaction requests for swapping tokens using Enso.
674
+ * @param {Pick<BalanceToken, "address" | "decimals">} tokenIn - The input token to swap from
675
+ * @param {Pick<BalanceToken, "address" | "decimals">} tokenOut - The output token to swap to
676
+ * @param {string} amount - The amount of input token to swap
677
+ * @param {number} slippage - The slippage tolerance to use for the route in percentage
678
+ * @returns {DefaultHookReturnType<GetZapTransactionResponse> & {tokens: BalanceTokenWithMetadata[], refresh: () => void}}
679
+ *
680
+ * The zap transaction response data with polling enabled, see {@link GetZapTransactionResponse} and {@link BalanceTokenWithMetadata}
681
+ * @remarks The hook is only enabled when all parameters are provided and amount is greater than 0
682
+ * @see {@link useEnsoZap}
683
+ */
684
+ declare const useZapTransactionRequests: ({ tokenIn, tokenOut, amount, slippage, chainId, }: {
685
+ tokenIn?: Pick<BalanceToken, "address" | "decimals">;
686
+ tokenOut?: Pick<BalanceToken, "address" | "decimals">;
687
+ amount?: string;
688
+ slippage?: number;
689
+ chainId?: number;
690
+ }) => {
691
+ tokens: BalanceTokenWithMetadata[] | undefined;
692
+ refresh: () => void;
693
+ data: GetZapTransactionResponse | undefined;
694
+ error: any;
695
+ mutate: swr.KeyedMutator<GetZapTransactionResponse>;
696
+ isValidating: boolean;
697
+ isLoading: boolean;
698
+ };
699
+
700
+ declare const useCreateProposal: ({ initialData, currentTopic, onError, }: {
701
+ initialData?: any;
702
+ currentTopic: GovernanceTopic;
703
+ onError: (e: CustomProposalErrors) => void;
704
+ }) => {
705
+ proposal: CustomProposal;
706
+ setProposal: react.Dispatch<react.SetStateAction<CustomProposal>>;
707
+ addProposalAction: () => void;
708
+ removeProposalAction: (idx: number) => void;
709
+ computeParamsAndErrors: () => readonly [`0x${string}`[], bigint[], `0x${string}`[], string] | undefined;
710
+ };
711
+
712
+ /**
713
+ * Returns the amount of voting power that a wallet had when the voting period began.
714
+ * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#Votes-getPastVotes-address-uint256-}
715
+ */
716
+ declare const useGetPastVotes: (args: {
717
+ wallet?: Address;
718
+ } & ({
719
+ proposalId?: bigint;
720
+ timepoint: number | bigint;
721
+ } | {
722
+ proposalId: bigint;
723
+ timepoint?: number | bigint;
724
+ })) => swr.SWRResponse<string, any, any>;
725
+
726
+ declare const useHasVoted: ({ proposalId, wallet, }: {
727
+ proposalId: string;
728
+ wallet?: Address;
729
+ }) => swr.SWRResponse<boolean, any, any>;
730
+
731
+ declare const useIsCanceller: ({ account, ...baseArgs }: {
732
+ account: Address | undefined;
733
+ } & BeraJS.BaseFunctionArgs) => swr.SWRResponse<boolean, any, {
734
+ refreshInterval: POLLING;
735
+ revalidateOnFocus: false;
736
+ }>;
737
+
738
+ type UsePollAllProposalsArgs = {
739
+ topic: string;
740
+ where?: Proposal_Filter;
741
+ perPage?: number;
742
+ orderBy?: Proposal_OrderBy;
743
+ orderDirection?: OrderDirection;
744
+ status_in?: ProposalStatus[];
745
+ text?: string;
746
+ autoRefreshProposals?: boolean;
747
+ };
748
+ type ProposalResult = {
749
+ data: ProposalSelectionFragment[][];
750
+ hasMore: boolean;
751
+ } & Omit<SWRInfiniteResponse<ProposalSelectionFragment[]>, "data">;
752
+ type PollAllProposalsKey = [
753
+ "usePollAllProposals",
754
+ number,
755
+ string,
756
+ Proposal_Filter | undefined,
757
+ ProposalStatus[] | undefined,
758
+ Proposal_OrderBy | undefined,
759
+ OrderDirection | undefined,
760
+ number,
761
+ string | undefined
762
+ ] | null;
763
+ declare function usePollAllProposalsQueryKey(topic: string, args?: Partial<UsePollAllProposalsArgs>): (pageIndex: number, previousPageData?: ProposalSelectionFragment[]) => PollAllProposalsKey;
764
+ /**
765
+ * Fetch all proposals for a given topic
766
+ */
767
+ declare function usePollAllProposals(args: UsePollAllProposalsArgs, options?: DefaultHookOptions & {
768
+ autoRefresh?: boolean;
769
+ }): ProposalResult;
770
+
771
+ interface UsePollProposalResponse extends DefaultHookReturnType<ProposalWithVotesFragment> {
772
+ }
773
+ /**
774
+ * Polls a proposal and returns the proposal details.
775
+ * Pulls data from the subgraph and onchain.
776
+ *
777
+ * @param proposalId - The ID of the proposal to poll
778
+ * @param options - Optional configuration options
779
+ * @param options.autoRefresh - If true, the data will be refreshed automatically based on the block number and status threshold
780
+ * @returns {UsePollProposalResponse} Object containing:
781
+ * - data: ProposalWithVotesFragment | undefined - The proposal data if successful
782
+ * - error: Error | undefined - Error object if request failed
783
+ * - isLoading: boolean - True while data is being fetched
784
+ * - isValidating: boolean - True while data is being revalidated
785
+ * - mutate: () => Promise<ProposalWithVotesFragment | undefined> - Function to manually refresh the data
786
+ * - refresh: () => Promise<void> - Function to manually refresh the data
787
+ */
788
+ declare const usePollProposal: (proposalId: string, options?: DefaultHookOptions & {
789
+ autoRefresh?: boolean;
790
+ }) => UsePollProposalResponse;
791
+
792
+ declare const usePollProposalThreshold: (governorAddress: Address) => DefaultHookReturnType<{
793
+ votesThreshold: string;
794
+ }>;
795
+
796
+ type UsePollProposalVotesArgs = Omit<GetProposalVotesQueryVariables, "offset" | "limit">;
797
+ /**
798
+ * Fetches all the votes for a proposal from the Subgraph
799
+ * @param args - The arguments to pass to the query
800
+ * @param total - The total amount of pages of votes to fetch
801
+ */
802
+ declare const usePollProposalVotes: (args: UsePollProposalVotesArgs, total: number) => swr_infinite.SWRInfiniteResponse<{
803
+ data: _berachain_graphql_governance.GetProposalVotesQuery;
804
+ }, any>;
805
+ declare const usePollProposalVotesQueryKey: ({ ...args }: UsePollProposalVotesArgs, total: number) => SWRInfiniteKeyLoader;
806
+
807
+ declare const usePollUserDelegates: (options?: DefaultHookOptions) => DefaultHookReturnType<{
808
+ delegate: Address;
809
+ currentVotes: string | undefined;
810
+ }>;
811
+
812
+ declare const useProposalFromTx: (txHash?: Address) => SWRResponse<ProposalWithVotesFragment | null>;
813
+
814
+ /**
815
+ * Timepoint used to retrieve user’s votes and quorum. If using block
816
+ * number (as per Compound’s Comp), the snapshot is performed at
817
+ * the end of this block. Hence, voting for this proposal starts at the beginning of the following block.
818
+ *
819
+ * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#IGovernor-proposalSnapshot-uint256-}
820
+ */
821
+ declare const useProposalSnapshot: ({ proposalId, }: {
822
+ proposalId: number | bigint | string | undefined;
823
+ }) => SWRResponse<string>;
824
+
825
+ declare const useProposalState: ({ proposalId, governorAddress, }: {
826
+ proposalId: number | bigint | string | undefined;
827
+ governorAddress: Address;
828
+ }) => SWRResponse<string>;
829
+
830
+ declare const TimelockOperationState: {
831
+ readonly 0: "unset";
832
+ readonly 1: "waiting";
833
+ readonly 2: "ready";
834
+ readonly 3: "done";
835
+ };
836
+ /**
837
+ * Fetches the state of a proposal timelock
838
+ * @returns state of the proposal timelock (unset, waiting, ready, done)
839
+ */
840
+ declare const useProposalTimelockState: ({ proposalTimelockId, timelockAddress, }: {
841
+ proposalTimelockId: Address | undefined;
842
+ timelockAddress: Address;
843
+ }) => SWRResponse<(typeof TimelockOperationState)[keyof typeof TimelockOperationState]>;
844
+
845
+ /**
846
+ * Queries the quorum for a given timestamp.
847
+ *
848
+ * @returns current quorum if timestamp is in the future.
849
+ */
850
+ declare function useQuorum({ at }: {
851
+ at: number | string;
852
+ }, { isEnabled, }: {
853
+ isEnabled?: boolean;
854
+ }): {
855
+ data: number | undefined;
856
+ error: any;
857
+ mutate: swr.KeyedMutator<string>;
858
+ isValidating: boolean;
859
+ isLoading: boolean;
860
+ };
861
+
862
+ interface UseCappedGloballyResponse extends DefaultHookReturnType<boolean | undefined> {
863
+ }
864
+ declare const useCappedGlobally: ({ asset, amount, isMint, isBasketModeEnabled, }: {
865
+ asset: Token | undefined;
866
+ amount: string | undefined;
867
+ isMint: boolean;
868
+ isBasketModeEnabled: boolean | undefined;
869
+ }, options?: DefaultHookOptions) => UseCappedGloballyResponse;
870
+
871
+ interface UseCappedRelativelyResponse extends DefaultHookReturnType<boolean | undefined> {
872
+ }
873
+ declare const useCappedRelatively: ({ asset, amount, isMint, isBasketModeEnabled, }: {
874
+ asset: Address | undefined;
875
+ amount: string | undefined;
876
+ isMint: boolean;
877
+ isBasketModeEnabled: boolean | undefined;
878
+ }, options?: DefaultHookOptions) => UseCappedRelativelyResponse;
879
+
880
+ interface UseCollateralWeightsResponse extends DefaultHookReturnType<Record<Address, bigint> | undefined> {
881
+ }
882
+ declare const useCollateralWeights: ({ collateralList, }: {
883
+ collateralList: Token[] | undefined;
884
+ }, options?: DefaultHookOptions) => UseCollateralWeightsResponse;
885
+
886
+ /**
887
+ * Interface defining the state props that we need without the entire IHoneySwapState
888
+ */
889
+ type HoneyAlertStateProps = Pick<IHoneySwapState, "actionType" | "fromAmount" | "toAmount" | "collaterals" | "isBasketModeEnabled">;
890
+ /**
891
+ * Interface defining the alert states returned by the useHoneyAlerts hook
892
+ */
893
+ interface HoneyAlertsReturn {
894
+ /** Indicates if the vault's liquidity is completely depleted (balance <= 1) */
895
+ isLiquidityDepleted: boolean;
896
+ isLiquidityDepletedCollaterals: Token[] | undefined;
897
+ /** Indicates if the requested redeem amount exceeds available liquidity in the vault*/
898
+ isRedeemMoreThanLiquidity: boolean;
899
+ isRedeemMoreThanLiquidityCollaterals: Token[] | undefined;
900
+ /** Indicates if the vault's liquidity is low (balance <= 1000) */
901
+ isLowLiquidity: boolean;
902
+ isLiquidityLowCollaterals: Token[] | undefined;
903
+ /** Indicates if the selected collateral is flagged as bad (blacklisted or depegged) */
904
+ isDepegged: boolean;
905
+ /** Indicates if the selected collateral is blacklisted */
906
+ isBlacklisted: boolean;
907
+ /** Indicates if the input amount exceeds the global cap limit */
908
+ isCappedGlobally: boolean | undefined;
909
+ /** Indicates if the input amount exceeds the relative cap limit */
910
+ isCappedRelatively: boolean | undefined;
911
+ /** Indicates if the input amount exceeds the balance of the user */
912
+ isExceedingBalance: boolean;
913
+ }
914
+ /**
915
+ * Hook that monitors various alert conditions for Honey swap operations
916
+ *
917
+ * This hook tracks multiple states that could affect swap operations:
918
+ * - Liquidity levels in vaults (depleted, low)
919
+ * - Collateral quality (blacklisted, depegged)
920
+ * - Cap limits for transactions (global, relative)
921
+ * - Balance checks
922
+ *
923
+ * @param {Object} params - The parameters object
924
+ * @param {HoneyAlertStateProps} params.state - The current state of the Honey swap operation
925
+ * @returns {HoneyAlertsReturn} Object containing various alert states
926
+
927
+ */
928
+ declare const useHoneyAlerts: ({ actionType, collaterals, fromAmount, toAmount, isBasketModeEnabled, }: HoneyAlertStateProps) => HoneyAlertsReturn;
929
+
930
+ /**
931
+ * Hook that fetches and maintains balances for HONEY token and collateral tokens
932
+ *
933
+ * This hook:
934
+ * - Fetches balances for all collateral tokens and the HONEY token
935
+ * - Updates balances at regular intervals (10s)
936
+ * - Returns a map of token addresses to their respective balances
937
+ * - Provides a refresh function to manually trigger balance updates
938
+ *
939
+ * The hook requires:
940
+ * - A connected wallet account
941
+ * - A public client
942
+ * - BeraJS configuration
943
+ * - A list of collateral tokens
944
+ *
945
+ * @returns {DefaultHookReturnType<Record<Address, BalanceToken>>} Object containing:
946
+ * - data: Map of token addresses to their balances
947
+ * - error: Any error that occurred during fetching
948
+ * - isLoading: Loading state
949
+ * - refresh: Function to manually refresh balances
950
+ */
951
+ declare const useHoneyBalances: () => DefaultHookReturnType<Record<Address, BalanceToken>>;
952
+
953
+ declare function useHoneyChartData({ days }: {
954
+ days: number;
955
+ }): {
956
+ refresh: () => Promise<_berachain_graphql_honey.GetChartDataQuery | undefined>;
957
+ data: _berachain_graphql_honey.GetChartDataQuery | undefined;
958
+ error: any;
959
+ mutate: swr.KeyedMutator<_berachain_graphql_honey.GetChartDataQuery>;
960
+ isValidating: boolean;
961
+ isLoading: boolean;
962
+ };
963
+
964
+ declare function useHoneyGlobalData(): {
965
+ data: {
966
+ dailyVolume: BigNumber | undefined;
967
+ __typename?: "Query";
968
+ honeySnapshots?: {
969
+ __typename?: "HoneySnapshot";
970
+ id: string;
971
+ allTimeVolume: string;
972
+ totalVolume: string;
973
+ timestamp: string;
974
+ totalSupply: string;
975
+ mintVolume: string;
976
+ redeemVolume: string;
977
+ }[] | undefined;
978
+ };
979
+ refresh: () => Promise<_berachain_graphql_honey.GetGlobalDataQuery | undefined>;
980
+ error: any;
981
+ mutate: swr.KeyedMutator<_berachain_graphql_honey.GetGlobalDataQuery>;
982
+ isValidating: boolean;
983
+ isLoading: boolean;
984
+ };
985
+
986
+ declare const useHoneyVaultsBalance: (options?: DefaultHookOptions) => DefaultHookReturnType<GetHoneyVaultsBalanceResponse[]>;
987
+
988
+ interface UseIsBadCollateralResponse extends DefaultHookReturnType<IsBadCollateralResponse | undefined> {
989
+ }
990
+ declare const useIsBadCollateralAsset: ({ collateral }: {
991
+ collateral: Token | undefined;
992
+ }, options?: DefaultHookOptions) => UseIsBadCollateralResponse;
993
+
994
+ declare function useIsBasketModeEnabled({ state }: {
995
+ state: IHoneySwapState;
996
+ }, options?: DefaultHookOptions): DefaultHookReturnType<boolean | undefined>;
997
+
998
+ /**
999
+ * Hook to fetch the latest Pyth price updates for specified pair addresses
1000
+ * @param {Object} params - The parameters object
1001
+ * @param {Address[] | undefined} params.pairMainAddress - Array of pair addresses to fetch price updates for
1002
+ * @returns {SWRResponse<PythLatestUpdates>} SWR response containing the latest Pyth price updates
1003
+ * @example
1004
+ * ```ts
1005
+ * const { data, error } = usePythLatestPrices({
1006
+ * pairMainAddress: ["0x123...", "0x456..."]
1007
+ * });
1008
+ * ```
1009
+ */
1010
+ declare function usePythLatestPrices({ priceFeedMap, }: {
1011
+ priceFeedMap: PythPriceFeedMap | undefined;
1012
+ }, options?: DefaultHookOptions): SWRResponse<PythLatestUpdates>;
1013
+
1014
+ declare const usePythUpdateFee: ({ pythPriceFeedCalldata, tokenListLength, }: {
1015
+ pythPriceFeedCalldata: Address[] | undefined;
1016
+ tokenListLength: number;
1017
+ }, options?: DefaultHookOptions) => {
1018
+ QUERY_KEY: readonly ["usePythUpdateFee", `0x${string}`[]] | null;
1019
+ data: bigint;
1020
+ isLoading: boolean;
1021
+ };
1022
+
1023
+ declare function useBgtAprSimulation(args: GetBgtAprSimulationArgs | undefined): GetBgtAprSimulationResult
1024
+ /**
1025
+ * Returns undefined if still loading
1026
+ */
1027
+ | undefined;
1028
+
1029
+ declare const useBgtUnstakedBalance: (options?: DefaultHookOptions) => DefaultHookReturnType<string | undefined>;
1030
+
1031
+ declare const useClaimableFees: () => {
1032
+ refresh: () => Promise<string | undefined>;
1033
+ data: string | undefined;
1034
+ error: any;
1035
+ mutate: swr.KeyedMutator<string>;
1036
+ isValidating: boolean;
1037
+ isLoading: boolean;
1038
+ };
1039
+
1040
+ type UseEarnedStakedBeraVaultArgs = {
1041
+ /**
1042
+ * The token that the user has staked
1043
+ */
1044
+ receiptToken: TokenWithMetadata;
1045
+ };
1046
+ declare function useEarnedStakedBeraVault({ receiptToken }: UseEarnedStakedBeraVaultArgs, opt?: DefaultHookOptions): DefaultHookReturnType<string>;
1047
+
1048
+ /**
1049
+ * Hook that fetches and returns the highest APR (Annual Percentage Rate) from reward vaults.
1050
+ *
1051
+ * @param {`0x${string}`[]} [params.filteringVaults=[]] - Optional array of vault addresses to filter by
1052
+ *
1053
+ * @returns {Object} An object containing:
1054
+ * - highestApr: The highest APR value from the reward vaults
1055
+ * - refresh: Function to manually refresh the data
1056
+ * - ...swrResponse: All properties from the underlying SWR response
1057
+ *
1058
+ * @example
1059
+ * const { highestApr } = useHighestVaultsAPR({
1060
+ * filteringVaults: ['0x123...', '0x456...']
1061
+ * });
1062
+ */
1063
+ declare const useHighestVaultsAPR: (where?: GqlRewardVaultFilter, { isEnabled }?: {
1064
+ isEnabled?: boolean;
1065
+ }) => {
1066
+ highestApr: GqlRewardVaultDynamicData["apr"] | undefined;
1067
+ isLoading: boolean;
1068
+ refresh: () => void;
1069
+ };
1070
+
1071
+ declare const usePollGlobalData: (options?: DefaultHookOptions) => DefaultHookReturnType<GlobalData>;
1072
+
1073
+ interface UsePollMarketsResponse extends DefaultHookReturnType<GetMarkets> {
1074
+ }
1075
+ declare const usePollMarketsQueryKey: () => string;
1076
+ declare const usePollMarkets: (options?: DefaultHookOptions) => UsePollMarketsResponse;
1077
+
1078
+ declare function useQueuedBeraUnlock({ receiptTokenAddress, account, version, }: {
1079
+ receiptTokenAddress?: Address | string;
1080
+ account?: Address | string;
1081
+ version: "V1" | "V2";
1082
+ }, options?: DefaultHookOptions): {
1083
+ refresh: () => Promise<StakedBeraWithdrawal[] | undefined>;
1084
+ data: StakedBeraWithdrawal[] | undefined;
1085
+ error: any;
1086
+ mutate: swr.KeyedMutator<StakedBeraWithdrawal[]>;
1087
+ isValidating: boolean;
1088
+ isLoading: boolean;
1089
+ };
1090
+
1091
+ declare const useRewardTokenToBeraRate: ({ address, }: {
1092
+ address: Address | undefined;
1093
+ }, opt?: DefaultHookOptions) => swr.SWRResponse<number, any, {
1094
+ errorRetryInterval?: number | undefined;
1095
+ errorRetryCount?: number;
1096
+ loadingTimeout?: number | undefined;
1097
+ focusThrottleInterval?: number | undefined;
1098
+ dedupingInterval?: number | undefined;
1099
+ refreshInterval?: number | ((latestData: any) => number) | undefined;
1100
+ refreshWhenHidden?: boolean;
1101
+ refreshWhenOffline?: boolean;
1102
+ revalidateOnFocus?: boolean | undefined;
1103
+ revalidateOnReconnect?: boolean | undefined;
1104
+ revalidateOnMount?: boolean;
1105
+ revalidateIfStale?: boolean | undefined;
1106
+ shouldRetryOnError?: boolean | ((err: any) => boolean) | undefined;
1107
+ keepPreviousData?: boolean;
1108
+ suspense?: boolean;
1109
+ fallbackData?: any;
1110
+ fetcher?: swr.BareFetcher<any> | undefined;
1111
+ use?: swr.Middleware[];
1112
+ fallback?: {
1113
+ [key: string]: any;
1114
+ } | undefined;
1115
+ isPaused?: (() => boolean) | undefined;
1116
+ onLoadingSlow?: ((key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
1117
+ onSuccess?: ((data: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
1118
+ onError?: ((err: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>) => void) | undefined;
1119
+ onErrorRetry?: ((err: any, key: string, config: Readonly<swr__internal.PublicConfiguration<any, any, swr.BareFetcher<any>>>, revalidate: swr.Revalidator, revalidateOpts: Required<swr.RevalidatorOptions>) => void) | undefined;
1120
+ onDiscarded?: ((key: string) => void) | undefined;
1121
+ compare?: ((a: any, b: any) => boolean) | undefined;
1122
+ isOnline?: (() => boolean) | undefined;
1123
+ isVisible?: (() => boolean) | undefined;
1124
+ initFocus?: ((callback: () => void) => (() => void) | void) | undefined;
1125
+ initReconnect?: ((callback: () => void) => (() => void) | void) | undefined;
1126
+ provider?: (cache: Readonly<swr.Cache>) => swr.Cache;
1127
+ isEnabled?: boolean;
1128
+ }>;
1129
+
1130
+ interface UseRewardVaultResponse extends DefaultHookReturnType<ApiVaultFragment> {
1131
+ }
1132
+ declare const useRewardVaultQueryKey: (address: Address | undefined) => readonly ["useRewardVault", `0x${string}`] | null;
1133
+ declare const useRewardVault: (id: Address | undefined, options?: DefaultHookOptions) => UseRewardVaultResponse;
1134
+
1135
+ declare const useRewardVaultBalanceFromStakingToken: ({ stakingToken, rewardVaultAddress: _rewardVaultAddress, }: {
1136
+ stakingToken: Address | undefined;
1137
+ rewardVaultAddress?: Address;
1138
+ }, options?: DefaultHookOptions) => {
1139
+ refresh: () => void;
1140
+ isLoading: boolean;
1141
+ data: {
1142
+ address: `0x${string}`;
1143
+ balance: bigint;
1144
+ } | undefined;
1145
+ error: any;
1146
+ mutate: swr.KeyedMutator<{
1147
+ address: `0x${string}`;
1148
+ balance: bigint;
1149
+ }>;
1150
+ isValidating: boolean;
1151
+ };
1152
+
1153
+ declare const useRewardVaultFromToken: ({ tokenAddress, }: {
1154
+ tokenAddress: Address | string | undefined;
1155
+ }, { isEnabled, }?: {
1156
+ isEnabled?: boolean;
1157
+ }) => {
1158
+ refresh: () => Promise<`0x${string}` | undefined>;
1159
+ data: `0x${string}` | undefined;
1160
+ error: any;
1161
+ mutate: swr.KeyedMutator<`0x${string}` | undefined>;
1162
+ isValidating: boolean;
1163
+ isLoading: boolean;
1164
+ };
1165
+
1166
+ declare function useRewardVaultIncentives({ address, stakingToken, }: {
1167
+ address: Address | undefined;
1168
+ stakingToken: Address | undefined;
1169
+ }): {
1170
+ refresh: () => Promise<RewardVaultIncentive[] | undefined>;
1171
+ data: RewardVaultIncentive[] | undefined;
1172
+ error: any;
1173
+ mutate: swr.KeyedMutator<RewardVaultIncentive[]>;
1174
+ isValidating: boolean;
1175
+ isLoading: boolean;
1176
+ };
1177
+
1178
+ declare const useRewardVaultRewards: (address: Address, options?: DefaultHookOptions) => {
1179
+ refresh: () => Promise<GetRewardVaultRewardsReturn | undefined>;
1180
+ data: GetRewardVaultRewardsReturn | undefined;
1181
+ error: any;
1182
+ mutate: swr.KeyedMutator<GetRewardVaultRewardsReturn>;
1183
+ isValidating: boolean;
1184
+ isLoading: boolean;
1185
+ };
1186
+
1187
+ declare const useRewardVaultsQueryKey: (filter?: GetVaultsQueryVariables, onChainIncentives?: boolean) => readonly ["useRewardVaults", _berachain_graphql_pol_api.Exact<{
1188
+ where?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlRewardVaultFilter>;
1189
+ pageSize?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["Int"]["input"]>;
1190
+ skip?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["Int"]["input"]>;
1191
+ orderBy?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlRewardVaultOrderBy>;
1192
+ orderDirection?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlRewardVaultOrderDirection>;
1193
+ search?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["String"]["input"]>;
1194
+ }> | undefined, boolean];
1195
+ declare const useRewardVaults: (args: {
1196
+ filter?: GetVaultsQueryVariables;
1197
+ onChainIncentives?: boolean;
1198
+ }, options?: DefaultHookOptions) => {
1199
+ refresh: swr.KeyedMutator<GetGaugeData>;
1200
+ data: GetGaugeData | undefined;
1201
+ error: any;
1202
+ mutate: swr.KeyedMutator<GetGaugeData>;
1203
+ isValidating: boolean;
1204
+ isLoading: boolean;
1205
+ };
1206
+
1207
+ declare const useStakedBeraSnapshots: ({ range, }: GetStakedBeraSnapshotsArgs) => DefaultHookReturnType<GetSWberaVaultSnapshotsQuery["polGetSWberaVaultSnapshots"]>;
1208
+
1209
+ declare const useUserVaultInfo: (args: {
1210
+ vaultAddress: Address | undefined;
1211
+ }, options?: DefaultHookOptions) => DefaultHookReturnType<UserVaultInfo>;
1212
+
1213
+ declare const useUserVaults: (options?: DefaultHookOptions) => DefaultHookReturnType<GetUserVaultsResponse>;
1214
+
1215
+ interface RewardVault {
1216
+ stakeToken: Address;
1217
+ address: Address;
1218
+ }
1219
+ declare const useVaultAddress: (vaultAddress: Address) => swr.SWRResponse<{
1220
+ stakeToken: `0x${string}`;
1221
+ address: `0x${string}`;
1222
+ }, any, any>;
1223
+
1224
+ declare const useVaultHistory: ({ vault, range, resolution, }: GetVaultHistoryArgs) => DefaultHookReturnType<GetVaultHistoryQuery["polGetRewardVaultSnapshots"]>;
1225
+
1226
+ interface UsePollValidatorInfoResponse$1 extends DefaultHookReturnType<ApiValidatorFragment[] | undefined> {
1227
+ }
1228
+ declare const useVaultValidators: (id: Address, options?: DefaultHookOptions) => UsePollValidatorInfoResponse$1;
1229
+
1230
+ /**
1231
+ * Shorthand for `useTokenCurrentPrice` with the Bera token address.
1232
+ * @returns
1233
+ */
1234
+ declare function useBeraCurrentPrice(opts?: DefaultHookOptions): DefaultHookReturnType<TokenPriceInfo>;
1235
+
1236
+ type UseMultipleTokenInformationResponse = DefaultHookReturnType<Token[]>;
1237
+ type useMultipleTokenInformationArgs = {
1238
+ addresses: string[] | readonly string[] | undefined;
1239
+ };
1240
+ declare const useMultipleTokenInformation: (args: useMultipleTokenInformationArgs, options?: DefaultHookOptions) => UseMultipleTokenInformationResponse;
1241
+
1242
+ type UsePollAllowancesArgs = {
1243
+ spender: string | undefined;
1244
+ tokens: Token[];
1245
+ };
1246
+ interface UsePollAllowancesResponse extends DefaultHookReturnType<AllowanceToken[] | undefined> {
1247
+ }
1248
+ /**
1249
+ *
1250
+ * @brief Allows the user to poll the allowances of a given token array.
1251
+ *
1252
+ * @param contract the address of the ERC20 token contract
1253
+ * @param tokens the list of tokens to poll allowances for
1254
+ */
1255
+ declare const usePollAllowances: (args: UsePollAllowancesArgs, options?: DefaultHookOptions) => UsePollAllowancesResponse;
1256
+
1257
+ declare function usePollBalance({ address: addressString, owner, chainId, }: {
1258
+ /**
1259
+ * Token address to get the balance of
1260
+ */
1261
+ address: string | undefined;
1262
+ owner?: Address | undefined;
1263
+ chainId?: number;
1264
+ }, options?: DefaultHookOptions): Omit<DefaultHookReturnType<BalanceToken | undefined>, "mutate">;
1265
+
1266
+ type UsePollWalletBalancesArgs = {
1267
+ /**
1268
+ * If provided, the tokens will be used instead of the default token list.
1269
+ */
1270
+ tokens?: Token[];
1271
+ walletAddress?: Address;
1272
+ };
1273
+ interface UsePollBalancesResponse extends DefaultHookReturnType<BalanceToken[] | undefined> {
1274
+ }
1275
+ declare function usePollWalletBalances(args?: UsePollWalletBalancesArgs, options?: DefaultHookOptions): UsePollBalancesResponse;
1276
+
1277
+ type UseStakingTokenInformationResponse = DefaultHookReturnType<Partial<Token> | undefined>;
1278
+ type useStakingTokenInformationArgs = {
1279
+ address: string | undefined;
1280
+ };
1281
+ declare const useStakingTokenInformation: (args: useStakingTokenInformationArgs, options?: DefaultHookOptions) => UseStakingTokenInformationResponse;
1282
+
1283
+ declare function useTokenCurrentPrice({ address }: {
1284
+ address: `0x${string}` | undefined;
1285
+ }, options?: DefaultHookOptions): DefaultHookReturnType<TokenPriceInfo>;
1286
+
1287
+ declare function useTokenCurrentPrices({ addressIn, }?: {
1288
+ addressIn?: string[] | readonly string[];
1289
+ }, options?: DefaultHookOptions): DefaultHookReturnType<TokenCurrentPriceMap>;
1290
+
1291
+ type UseTokenInformationResponse = DefaultHookReturnType<Token | undefined>;
1292
+ type UseTokenInformationArgs = {
1293
+ address: string | undefined;
1294
+ chainId?: number;
1295
+ };
1296
+ declare const useTokenInformation: (args: UseTokenInformationArgs, options?: DefaultHookOptions) => UseTokenInformationResponse;
1297
+
1298
+ declare function useTokens(): {
1299
+ /**
1300
+ * @deprecated use useTokens().tokenList instead
1301
+ */
1302
+ data: {
1303
+ tokenList: TokenWithMetadata[];
1304
+ customTokenList: Token[];
1305
+ featuredTokenList: TokenWithMetadata[];
1306
+ };
1307
+ tokenList: TokenWithMetadata[];
1308
+ userTokens: Token[];
1309
+ featuredTokens: TokenWithMetadata[];
1310
+ onRemoveToken: (token: Token) => void;
1311
+ onAddToken: (token: Token) => void;
1312
+ };
1313
+
1314
+ declare function useTotalSupply({ address }: {
1315
+ address: Address | undefined;
1316
+ }): swr.SWRResponse<bigint, any, any>;
1317
+
1318
+ type TransactionStatus = "pending" | "confirmed" | "failed";
1319
+ interface Transaction {
1320
+ hash: string;
1321
+ description: string;
1322
+ actionType?: TransactionActionType;
1323
+ timestamp: number;
1324
+ status: TransactionStatus;
1325
+ confirmations?: number;
1326
+ chainId: number;
1327
+ }
1328
+ type NewTransaction = Omit<Transaction, "status">;
1329
+ type DataLegacy = Record<string, Record<number, Transaction[] | undefined>>;
1330
+ type Data = Record<string, Transaction[] | undefined>;
1331
+ declare function safeParseJsonData<T = DataLegacy | Data>(string: string | null): T;
1332
+ /**
1333
+ *
1334
+ * @param legacyData - The legacy data to convert to the new data format.
1335
+ * removes the nested chains and converts the data to a flat array.
1336
+ * @returns Data in the new format with the chainId added to each transaction.
1337
+ */
1338
+ declare function convertLegacyDataToNewData(legacyData: DataLegacy): Data;
1339
+ /**
1340
+ * Filter out duplicate transactions by hash
1341
+ */
1342
+ declare const filterDuplicatefn: (tx: Transaction, idx: number, arr: Transaction[]) => boolean;
1343
+ declare function mergeData(legacyData: DataLegacy, newData: Data): Data;
1344
+ declare function createTransactionStore({ config }: {
1345
+ config: Config;
1346
+ }): {
1347
+ addTransaction: (account: string, transaction: NewTransaction) => void;
1348
+ clearTransactions: (account: string) => void;
1349
+ getTransactions: (account: string) => Transaction[];
1350
+ onChange: (fn: () => void) => () => void;
1351
+ waitForPendingTransactions: (account: string) => Promise<void>;
1352
+ };
1353
+ type TransactionStore = ReturnType<typeof createTransactionStore>;
1354
+
1355
+ declare function TransactionStoreProvider({ children, }: {
1356
+ children: react__default.ReactNode;
1357
+ }): react_jsx_runtime.JSX.Element;
1358
+ declare function useTransactionStore(): TransactionStore;
1359
+
1360
+ declare function useAddRecentTransaction(): (transaction: NewTransaction) => void;
1361
+
1362
+ declare function useRecentTransactions(): Transaction[];
1363
+
1364
+ /**
1365
+ *
1366
+ * @returns Timestamp in seconds
1367
+ */
1368
+ declare function useBlockToTimestamp(inputBlock: number | bigint | string): number | undefined;
1369
+
1370
+ declare function useBeraContractWrite({ onlyPermissionless, onSuccess, onError, onLoading, onWarning, onSubmission, }?: IUseContractWriteArgs & {
1371
+ /**
1372
+ * Whether to allow only permissionless transactions.
1373
+ *
1374
+ * This is useful when UI is reading data for another account compared to the connected account.
1375
+ */
1376
+ onlyPermissionless?: boolean;
1377
+ }): UseContractWriteApi;
1378
+
1379
+ declare const useGetVerifiedAbi: (address?: string) => swr.SWRResponse<string, any, swr.SWRConfiguration<string, any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<string>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<string>)> | undefined>;
1380
+
1381
+ type UseHistoryStateOptions<T> = {
1382
+ key: string;
1383
+ defaultValue: T;
1384
+ };
1385
+ /**
1386
+ * useHistoryState is a hook that allows storing state in the browser's history state
1387
+ * it is useful for storing state that you want to persist across pages
1388
+ * It is indexed by the key parameter to be able to store multiple states on the same page and
1389
+ * also to not override nextjs usage of the history state
1390
+ * @param {string} key - the key to store the state under
1391
+ * @param {T} defaultValue - the default value to use if the state is not found
1392
+ * @returns {T} state - the current state
1393
+ * @returns {function} setHistoryState - a function to set the state
1394
+ */
1395
+ declare function useHistoryState<T>({ key, defaultValue, }: UseHistoryStateOptions<T>): readonly [T, (value: T | ((prev: T) => T)) => void];
1396
+
1397
+ /**
1398
+ * Returns the previous value of a variable before the render
1399
+ * @param value - the value to return the previous value for
1400
+ */
1401
+ declare function usePrevious<T>(value: T): T | undefined;
1402
+
1403
+ declare const useAllValidatorsQueryKey: ({ variables, }?: {
1404
+ variables?: GetValidatorsQueryVariables;
1405
+ }) => (string | _berachain_graphql_pol_api.Exact<{
1406
+ where?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlValidatorFilter>;
1407
+ sortBy?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlValidatorOrderBy>;
1408
+ sortOrder?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.GqlValidatorOrderDirection>;
1409
+ pageSize?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["Int"]["input"]>;
1410
+ skip?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["Int"]["input"]>;
1411
+ search?: _berachain_graphql_pol_api.InputMaybe<_berachain_graphql_pol_api.Scalars["String"]["input"]>;
1412
+ chain?: _berachain_graphql_pol_api.InputMaybe<GqlChain>;
1413
+ }> | undefined)[];
1414
+ declare const useAllValidators: (variables: GetValidatorsQueryVariables & BeraJS.BaseFunctionArgs, options?: DefaultHookOptions) => DefaultHookReturnType<GetValidatorsQuery | undefined>;
1415
+
1416
+ declare function useApiEnrichedAllocation({ allocation, }: {
1417
+ allocation: ValidatorRewardAllocation | undefined;
1418
+ }): swr.SWRResponse<_berachain_graphql_pol_api.ApiRewardAllocationWeightFragment[], any, any>;
1419
+
1420
+ interface UsePollValidatorInfoResponse extends DefaultHookReturnType<GetValidatorQuery> {
1421
+ }
1422
+ declare const useApiValidatorQueryKey: (id: Address) => readonly ["useApiValidator", `0x${string}`] | null;
1423
+ declare const useApiValidator: (id: Address, options?: DefaultHookOptions) => UsePollValidatorInfoResponse;
1424
+
1425
+ declare function useBaselineRewardAllocation(): swr.SWRResponse<ValidatorRewardAllocation, any, any>;
1426
+
1427
+ declare const useDailyValidatorBlockStats: ({ pubKey, first, }: {
1428
+ pubKey: Address | undefined;
1429
+ first?: number;
1430
+ }) => DefaultHookReturnType<GetValidatorBlockStatsQuery>;
1431
+
1432
+ declare function useDefaultRewardAllocation(options?: DefaultHookOptions): {
1433
+ refresh: () => Promise<ValidatorRewardAllocation | undefined>;
1434
+ data: ValidatorRewardAllocation | undefined;
1435
+ error: any;
1436
+ mutate: swr.KeyedMutator<ValidatorRewardAllocation | undefined>;
1437
+ isValidating: boolean;
1438
+ isLoading: boolean;
1439
+ };
1440
+
1441
+ /**
1442
+ * Return the validators managed by the account
1443
+ * Roles:
1444
+ * - Validator Operator
1445
+ * - Validator Reward Allocator
1446
+ * @param address
1447
+ * @param options
1448
+ * @returns
1449
+ */
1450
+ declare const useManagedValidatorByAccount: ({ account }: {
1451
+ account: Address | undefined;
1452
+ }, options?: DefaultHookOptions) => {
1453
+ refresh: () => Promise<_berachain_graphql_pol_subgraph.GetValidatorByAccountQuery | undefined>;
1454
+ data: _berachain_graphql_pol_subgraph.GetValidatorByAccountQuery | undefined;
1455
+ error: any;
1456
+ mutate: swr.KeyedMutator<_berachain_graphql_pol_subgraph.GetValidatorByAccountQuery | undefined>;
1457
+ isValidating: boolean;
1458
+ isLoading: boolean;
1459
+ };
1460
+
1461
+ type ManagedValidatorRole = {
1462
+ operator: Address | null;
1463
+ rewardAllocator: Address | null;
1464
+ hasOperatorRole: boolean;
1465
+ hasRewardAllocatorRole: boolean;
1466
+ };
1467
+ declare function useManagedValidatorRole({ pubKey, account: accountAddress, }: {
1468
+ pubKey: Address | undefined;
1469
+ account?: Address | undefined;
1470
+ }, options?: DefaultHookOptions): DefaultHookReturnType<ManagedValidatorRole | undefined>;
1471
+
1472
+ declare const useOnChainValidator: ({ pubkey }: {
1473
+ pubkey: Address;
1474
+ }, options: DefaultHookOptions) => DefaultHookReturnType<Partial<ApiValidatorFragment>>;
1475
+
1476
+ declare const useStakingPoolBatch: ({ valPubKey, options, }: {
1477
+ valPubKey: Address;
1478
+ options?: DefaultHookOptions;
1479
+ }) => DefaultHookReturnType<number | undefined>;
1480
+
1481
+ declare const useSubgraphUserValidators: ({ account: _account, }?: {
1482
+ account?: Address;
1483
+ }) => swr.SWRResponse<{
1484
+ __typename?: "UserBoost";
1485
+ id: `0x${string}`;
1486
+ queuedBoostAmount: string;
1487
+ activeBoostAmount: string;
1488
+ queuedDropBoostAmount: string;
1489
+ queuedDropBoostStartBlock?: string | null;
1490
+ queuedBoostStartBlock?: string | null;
1491
+ user: `0x${string}`;
1492
+ validator: {
1493
+ __typename?: "Validator";
1494
+ id: `0x${string}`;
1495
+ publicKey: `0x${string}`;
1496
+ activeBoostAmount: string;
1497
+ };
1498
+ }[], any, any>;
1499
+
1500
+ interface UseUserActiveValidatorsResponse extends DefaultHookReturnType<ValidatorWithUserBoost[] | undefined> {
1501
+ }
1502
+ declare const useUserActiveValidators: (options?: DefaultHookOptions) => UseUserActiveValidatorsResponse;
1503
+
1504
+ declare const useUserBoostsOnValidator: ({ pubkey, ...args }: {
1505
+ pubkey: Address | undefined;
1506
+ account?: Address;
1507
+ }) => DefaultHookReturnType<UserBoostsOnValidator>;
1508
+
1509
+ interface UseUserClaimableIncentivesReturnType extends DefaultHookReturnType<BribeBoostRewardProof[]> {
1510
+ tokenMap?: Set<string> | undefined;
1511
+ }
1512
+ declare const useUserClaimableIncentives: () => UseUserClaimableIncentivesReturnType;
1513
+
1514
+ /**
1515
+ * Hook to fetch and manage user staking positions for validators
1516
+ *
1517
+ * This hook retrieves staking positions for a given account and optionally filters
1518
+ * by a specific validator address.
1519
+ *
1520
+ * @param params - Configuration parameters for the hook
1521
+ * @param params.account - The user's wallet address to fetch staking positions for
1522
+ * @param params.validatorAddress - Optional validator address to filter positions by
1523
+ *
1524
+ *
1525
+ * @example
1526
+ * ```tsx
1527
+ * // Fetch all staking positions for a user
1528
+ * const { data, isLoading, error } = useUserStakingPositions({
1529
+ * account: userAddress
1530
+ * });
1531
+ *
1532
+ * // Fetch staking positions for a specific validator
1533
+ * const { data, isLoading, error } = useUserStakingPositions({
1534
+ * account: userAddress,
1535
+ * validatorAddress: "0x1234..."
1536
+ * });
1537
+ * ```
1538
+ */
1539
+ declare const useUserStakingPositions: ({ account, validatorAddress, }: {
1540
+ account: Address | undefined;
1541
+ validatorAddress?: Address;
1542
+ }) => {
1543
+ refresh: () => void;
1544
+ data: UserStakingPoolPosition[] | undefined;
1545
+ error: any;
1546
+ mutate: swr.KeyedMutator<UserStakingPoolPosition[]>;
1547
+ isValidating: boolean;
1548
+ isLoading: boolean;
1549
+ };
1550
+
1551
+ declare function useValidator({ pubkey }: {
1552
+ pubkey: Address;
1553
+ }, options: DefaultHookOptions): {
1554
+ data: {
1555
+ uptime: {
1556
+ __typename?: "GqlValidatorBlockUptime";
1557
+ isActive: boolean;
1558
+ isProposer: boolean;
1559
+ isSigner: boolean;
1560
+ status: _berachain_graphql_pol_api.GqlValidatorBlockUptimeStatus;
1561
+ blockNumber: number;
1562
+ }[] | undefined;
1563
+ validator: {
1564
+ operator: `0x${string}` | null | undefined;
1565
+ dynamicData: {
1566
+ activeBoostAmount: string;
1567
+ queuedBoostAmount: string;
1568
+ usersActiveBoostCount: number;
1569
+ usersQueuedBoostCount: number;
1570
+ allTimeDistributedBGTAmount: string;
1571
+ rewardRate: string;
1572
+ stakedBeraAmount: string;
1573
+ lastDayDistributedBGTAmount: string;
1574
+ activeBoostAmountRank: number;
1575
+ boostApr: GqlValidatorDynamicData["boostApr"];
1576
+ commissionOnIncentives: number;
1577
+ };
1578
+ id: Address;
1579
+ pubkey: Address;
1580
+ metadata: {
1581
+ __typename?: "GqlValidatorMetadata";
1582
+ name: string;
1583
+ logoURI: string;
1584
+ website: string;
1585
+ description: string;
1586
+ } | null | undefined;
1587
+ rewardAllocationWeights: {
1588
+ __typename?: "GqlValidatorRewardAllocationWeight";
1589
+ percentage: number;
1590
+ receiver: `0x${string}`;
1591
+ startBlock: number;
1592
+ receivingVault?: {
1593
+ __typename?: "GqlRewardVault";
1594
+ vaultAddress: `0x${string}`;
1595
+ isVaultWhitelisted: boolean;
1596
+ stakingTokenAmount: string;
1597
+ id: `0x${string}`;
1598
+ address: `0x${string}`;
1599
+ dynamicData?: {
1600
+ __typename?: "GqlRewardVaultDynamicData";
1601
+ allTimeReceivedBGTAmount: string;
1602
+ apr?: number | null;
1603
+ bgtCapturePercentage: string;
1604
+ bgtCapturePerBlock: string;
1605
+ activeIncentivesValueUsd: string;
1606
+ activeIncentivesRateUsd: string;
1607
+ tvl?: number | null;
1608
+ } | null;
1609
+ stakingToken: {
1610
+ __typename?: "GqlToken";
1611
+ address: `0x${string}`;
1612
+ name: string;
1613
+ symbol: string;
1614
+ decimals: number;
1615
+ };
1616
+ metadata?: {
1617
+ __typename?: "GqlRewardVaultMetadata";
1618
+ name: string;
1619
+ logoURI: string;
1620
+ url: string;
1621
+ protocolName: string;
1622
+ protocolIcon: string;
1623
+ description: string;
1624
+ categories: Array<string>;
1625
+ action: string;
1626
+ } | null;
1627
+ activeIncentives: Array<{
1628
+ __typename?: "GqlRewardVaultIncentive";
1629
+ active: boolean;
1630
+ remainingAmount: string;
1631
+ remainingAmountUsd: string;
1632
+ incentiveRate: string;
1633
+ incentiveRateUsd: string;
1634
+ tokenAddress: `0x${string}`;
1635
+ token: {
1636
+ __typename?: "GqlToken";
1637
+ address: `0x${string}`;
1638
+ name: string;
1639
+ symbol: string;
1640
+ decimals: number;
1641
+ };
1642
+ }>;
1643
+ } | null;
1644
+ }[];
1645
+ __typename?: "GqlValidator";
1646
+ rewardAllocator?: `0x${string}` | null;
1647
+ lastBlockUptime?: {
1648
+ __typename?: "GqlValidatorBlockUptime";
1649
+ isActive: boolean;
1650
+ isProposer: boolean;
1651
+ isSigner: boolean;
1652
+ status: _berachain_graphql_pol_api.GqlValidatorBlockUptimeStatus;
1653
+ blockNumber: number;
1654
+ } | null | undefined;
1655
+ } | null;
1656
+ };
1657
+ isLoading: boolean;
1658
+ error: any;
1659
+ };
1660
+
1661
+ declare const useValidatorAnalytics: ({ pubkey, dayRange, }: {
1662
+ pubkey: Address | undefined;
1663
+ dayRange: number;
1664
+ }) => DefaultHookReturnType<GetValidatorAnalyticsQuery>;
1665
+
1666
+ declare const useValidatorCommission: (pubKey: Address, options?: DefaultHookOptions) => DefaultHookReturnType<number | undefined | null>;
1667
+
1668
+ declare const useValidatorEstimatedBgtPerYear: (validator: ApiValidatorMinimalFragment) => {
1669
+ data: number | undefined;
1670
+ isLoading: boolean;
1671
+ };
1672
+
1673
+ declare function useValidatorQueuedCommission(pubKey: Address, options?: DefaultHookOptions): DefaultHookReturnType<ValidatorQueuedCommission | undefined | null>;
1674
+
1675
+ declare const useValidatorQueuedOperatorAddress: (pubKey: Address, options?: DefaultHookOptions) => DefaultHookReturnType<ValidatorQueuedOperatorAddress | undefined>;
1676
+
1677
+ declare const useValidatorQueuedRewardAllocation: (pubKey: Address, options?: DefaultHookOptions) => DefaultHookReturnType<ValidatorRewardAllocation | undefined>;
1678
+
1679
+ declare function useValidatorRewardAllocation(pubKey: Address, options?: DefaultHookOptions): {
1680
+ refresh: () => Promise<{
1681
+ activeRewardAllocation: ValidatorRewardAllocation;
1682
+ setRewardAllocation: ValidatorRewardAllocation;
1683
+ isBaseline: boolean;
1684
+ isNeverSet: boolean;
1685
+ } | undefined>;
1686
+ data: {
1687
+ activeRewardAllocation: ValidatorRewardAllocation;
1688
+ setRewardAllocation: ValidatorRewardAllocation;
1689
+ isBaseline: boolean;
1690
+ isNeverSet: boolean;
1691
+ } | undefined;
1692
+ error: any;
1693
+ mutate: swr.KeyedMutator<{
1694
+ activeRewardAllocation: ValidatorRewardAllocation;
1695
+ setRewardAllocation: ValidatorRewardAllocation;
1696
+ isBaseline: boolean;
1697
+ isNeverSet: boolean;
1698
+ }>;
1699
+ isValidating: boolean;
1700
+ isLoading: boolean;
1701
+ };
1702
+
1703
+ export { BalanceTokenWithMetadata, type Data, type DataLegacy, GetZapTransactionResponse, IHoneySwapState, IUseContractWriteArgs, type LiquidityMismatchInfo, type ManagedValidatorRole, type NewTransaction, type OnChainPoolFragment, type Oracle, OracleMode, type RewardVault, type Transaction, type TransactionStore, TransactionStoreProvider, USE_AGGREGATORS_QUOTES_QUERY_KEY, type UseCappedGloballyResponse, type UseCappedRelativelyResponse, type UseCollateralWeightsResponse, UseContractWriteApi, type UseIsBadCollateralResponse, type UseMultipleTokenInformationResponse, type UsePollAllowancesArgs, type UsePollAllowancesResponse, type UsePollBalancesResponse, type UsePollMarketsResponse, type UsePollProposalResponse, type UsePollValidatorInfoResponse, type UsePollWalletBalancesArgs, type UseRewardVaultResponse, type UseStakingTokenInformationResponse, type UseTokenInformationArgs, type UseTokenInformationResponse, convertLegacyDataToNewData, createTransactionStore, filterDuplicatefn, mergeData, safeParseJsonData, useAddRecentTransaction, useAggregatorsQuotes, useAggregatorsRouterFeeBps, useAllUserPools, useAllUserPoolsQueryKey, useAllValidators, useAllValidatorsQueryKey, useApiEnrichedAllocation, useApiPool, useApiPoolQueryKey, useApiValidator, useApiValidatorQueryKey, useBaselineRewardAllocation, useBendTransactionRequests, useBendTransactionRequestsHelper, useBeraContractWrite, useBeraCurrentPrice, useBgtAprSimulation, useBgtUnstakedBalance, useBlockToTimestamp, useCappedGlobally, useCappedRelatively, useClaimableFees, useCollateralWeights, useCreatePool, useCreateProposal, useDailyValidatorBlockStats, useDefaultRewardAllocation, useEarnedStakedBeraVault, useEnsoZap, useExploitedTokens, useExploitedTokensQueryKey, useGetConvertToAssets, useGetPastVotes, useGetVerifiedAbi, useGlobalLiquidityAndSwapVolume, useHasVoted, useHighestVaultsAPR, useHistoryState, useHoneyAlerts, useHoneyBalances, useHoneyChartData, useHoneyGlobalData, useHoneyVaultsBalance, useIsBadCollateralAsset, useIsBasketModeEnabled, useIsCanceller, useLiquidityMismatch, useLpPosition, useManagedValidatorByAccount, useManagedValidatorRole, useMultipleTokenApprovalsWithSlippage, useMultipleTokenInformation, type useMultipleTokenInformationArgs, useOnChainPoolData, useOnChainPoolDataQueryKey, useOnChainValidator, usePollAllProposals, usePollAllProposalsQueryKey, usePollAllowances, usePollBalance, usePollGlobalData, usePollMarkets, usePollMarketsQueryKey, usePollPoolCreationRelayerApproval, usePollProposal, usePollProposalThreshold, usePollProposalVotes, usePollProposalVotesQueryKey, usePollUserDelegates, usePollWalletBalances, usePool, usePoolEvents, usePoolHistoricalData, usePools, usePoolsQueryKey, usePrevious, useProposalFromTx, useProposalSnapshot, useProposalState, useProposalTimelockState, usePythLatestPrices, usePythUpdateFee, useQueuedBeraUnlock, useQuorum, useRecentTransactions, useRewardTokenToBeraRate, useRewardVault, useRewardVaultBalanceFromStakingToken, useRewardVaultFromToken, useRewardVaultIncentives, useRewardVaultQueryKey, useRewardVaultRewards, useRewardVaults, useRewardVaultsQueryKey, useStakedBeraSnapshots, useStakingPoolBatch, useStakingTokenInformation, type useStakingTokenInformationArgs, useSubgraphPoolQueryKey, useSubgraphUserValidators, useTokenCurrentPrice, useTokenCurrentPrices, useTokenInformation, useTokens, useTotalSupply, useTransactionStore, useUserActiveValidators, useUserBoostsOnValidator, useUserClaimableIncentives, useUserStakingPositions, useUserVaultInfo, useUserVaults, useValidator, useValidatorAnalytics, useValidatorCommission, useValidatorEstimatedBgtPerYear, useValidatorQueuedCommission, useValidatorQueuedOperatorAddress, useValidatorQueuedRewardAllocation, useValidatorRewardAllocation, useVaultAddress, useVaultHistory, useVaultValidators, useZapTransactionRequests };