@berachain/berajs 0.2.9 → 0.2.10
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/actions/clients/exports.d.ts +77 -1
- package/dist/actions/clients/exports.mjs +13 -4
- package/dist/actions/exports.d.ts +59 -27
- package/dist/actions/exports.mjs +23 -23
- package/dist/actions/governance/exports.mjs +3 -3
- package/dist/actions/server/exports.mjs +4 -4
- package/dist/{chunk-4Z4AK6SH.mjs → chunk-3JJLQ2JX.mjs} +3 -3
- package/dist/{chunk-EXIUPSFN.mjs → chunk-7YVNSDXG.mjs} +2 -2
- package/dist/{chunk-WXXOISTU.mjs → chunk-AUOPN6NK.mjs} +1 -1
- package/dist/{chunk-75M6TF7M.mjs → chunk-DQRH5VE3.mjs} +1 -1
- package/dist/{chunk-CDFWPU2R.mjs → chunk-E7YFXBBQ.mjs} +0 -124
- package/dist/{chunk-AFN4CVD3.mjs → chunk-GUURQAME.mjs} +1 -1
- package/dist/{chunk-KQUMKB66.mjs → chunk-GY6B3PD5.mjs} +1 -1
- package/dist/{chunk-HSSJKHZ4.mjs → chunk-HYDP32P6.mjs} +3 -3
- package/dist/{chunk-NPBQLVL3.mjs → chunk-IXIBY5FP.mjs} +2 -2
- package/dist/{chunk-J5I45WGQ.mjs → chunk-KHXJDYA4.mjs} +7 -0
- package/dist/chunk-P5WXXULM.mjs +54 -0
- package/dist/{chunk-QJIXTYTZ.mjs → chunk-QBBOWFMH.mjs} +105 -30
- package/dist/{chunk-FFB5LFDW.mjs → chunk-QVHEM4BG.mjs} +2 -2
- package/dist/{chunk-3EARVV7K.mjs → chunk-WNBWX23Q.mjs} +17 -5
- package/dist/chunk-Y6THHG77.mjs +126 -0
- package/dist/{chunk-XIYN6AL6.mjs → chunk-ZLTMIFCZ.mjs} +10 -5
- package/dist/contexts/exports.mjs +8 -8
- package/dist/errors/exports.mjs +5 -5
- package/dist/{getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts → getValidatorQueuedOperatorAddress-DphU3qhE.d.ts} +1 -1
- package/dist/hooks/exports.d.ts +17 -18
- package/dist/hooks/exports.mjs +161 -132
- package/dist/hooks/governance/exports.mjs +4 -4
- package/dist/{pol.d-CqPA9K6m.d.ts → pol.d-Dw5SQcRX.d.ts} +15 -4
- package/dist/types/exports.d.ts +1 -1
- package/dist/utils/exports.mjs +11 -9
- package/package.json +4 -4
- package/src/actions/clients/exports.ts +3 -0
- package/src/actions/clients/fetchBeep.ts +34 -0
- package/src/actions/clients/fetchOpenApi.ts +93 -0
- package/src/actions/clients/fetchOpenApi.unit.test.ts +223 -0
- package/src/actions/clients/fetchRailwayBackend.ts +34 -0
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
- package/src/actions/exports.ts +1 -0
- package/src/actions/honey/getPythLatestPrices.ts +7 -0
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getAutoclaimedIncentives.ts +21 -10
- package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
- package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +5 -12
- package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -16
- package/src/actions/pol/getRewardVaults.ts +4 -4
- package/src/actions/pol/getStakingDailyAssets.ts +18 -14
- package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
- package/src/errors/RequestError.ts +12 -3
- package/src/errors/RequestError.unit.test.ts +55 -0
- package/src/errors/errorMap.ts +8 -0
- package/src/hooks/exports.ts +1 -0
- package/src/hooks/pol/useAutoclaimedIncentives.ts +1 -10
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +45 -0
- package/src/hooks/validators/useValidator.ts +4 -8
- package/src/types/bribe-boost.d.ts +14 -3
- package/src/utils/polyfillAbortSignalAny.ts +53 -0
- package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
- /package/dist/{exports-BcUTGFUb.d.ts → getApolloClient-BcUTGFUb.d.ts} +0 -0
package/dist/hooks/exports.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
getApiPool,
|
|
14
14
|
getApiValidator,
|
|
15
15
|
getAutoclaimedIncentives,
|
|
16
|
+
getAutoclaimedIncentivesTxHash,
|
|
16
17
|
getBgtAprSimulation,
|
|
17
18
|
getBlockTimestamp,
|
|
18
19
|
getChartData,
|
|
@@ -69,8 +70,12 @@ import {
|
|
|
69
70
|
getVaultValidators,
|
|
70
71
|
isBadCollateralAsset,
|
|
71
72
|
isBasketModeEnabled
|
|
72
|
-
} from "../chunk-
|
|
73
|
-
import
|
|
73
|
+
} from "../chunk-QBBOWFMH.mjs";
|
|
74
|
+
import {
|
|
75
|
+
fetchBeep,
|
|
76
|
+
fetchRailwayBackend
|
|
77
|
+
} from "../chunk-P5WXXULM.mjs";
|
|
78
|
+
import "../chunk-3JJLQ2JX.mjs";
|
|
74
79
|
import "../chunk-CDK4YV3D.mjs";
|
|
75
80
|
import {
|
|
76
81
|
TokenContext,
|
|
@@ -79,57 +84,59 @@ import {
|
|
|
79
84
|
useBlockTime,
|
|
80
85
|
useEnsoUserTokensWithBalances,
|
|
81
86
|
useHoneyConfig
|
|
82
|
-
} from "../chunk-
|
|
87
|
+
} from "../chunk-WNBWX23Q.mjs";
|
|
83
88
|
import {
|
|
84
89
|
getEnsoClient,
|
|
85
90
|
getWalletBalances
|
|
86
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-HYDP32P6.mjs";
|
|
87
92
|
import "../chunk-HQCOU6GY.mjs";
|
|
88
93
|
import "../chunk-O2NQFKJK.mjs";
|
|
89
94
|
import "../chunk-SGIJVHZO.mjs";
|
|
90
95
|
import {
|
|
91
96
|
TransactionFailedError
|
|
92
|
-
} from "../chunk-
|
|
97
|
+
} from "../chunk-AUOPN6NK.mjs";
|
|
93
98
|
import {
|
|
94
99
|
BeraMonitoring,
|
|
95
100
|
initBeraError
|
|
96
|
-
} from "../chunk-
|
|
101
|
+
} from "../chunk-7YVNSDXG.mjs";
|
|
97
102
|
import {
|
|
98
103
|
assertAddress,
|
|
99
104
|
assertAmount,
|
|
100
105
|
assertDefined,
|
|
101
106
|
assertPositive,
|
|
102
107
|
assertPublicClient
|
|
103
|
-
} from "../chunk-
|
|
108
|
+
} from "../chunk-GY6B3PD5.mjs";
|
|
104
109
|
import {
|
|
105
110
|
computePriceImpact,
|
|
106
111
|
wrapNativeTokens
|
|
107
|
-
} from "../chunk-
|
|
112
|
+
} from "../chunk-QVHEM4BG.mjs";
|
|
108
113
|
import {
|
|
109
114
|
DEFAULT_METAMASK_GAS_LIMIT,
|
|
110
|
-
beraFetchJson,
|
|
111
115
|
bignumber_js_default,
|
|
112
116
|
getPythDefaultUpdateFee,
|
|
113
117
|
msToSeconds,
|
|
114
118
|
seconds
|
|
115
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-E7YFXBBQ.mjs";
|
|
120
|
+
import {
|
|
121
|
+
beraFetchJson
|
|
122
|
+
} from "../chunk-Y6THHG77.mjs";
|
|
116
123
|
import "../chunk-BGMRHTBQ.mjs";
|
|
117
124
|
import {
|
|
118
125
|
beraToken,
|
|
119
126
|
getHoneyToken,
|
|
120
127
|
isToken
|
|
121
|
-
} from "../chunk-
|
|
128
|
+
} from "../chunk-IXIBY5FP.mjs";
|
|
122
129
|
import {
|
|
123
130
|
parseBaseArgs
|
|
124
|
-
} from "../chunk-
|
|
131
|
+
} from "../chunk-DQRH5VE3.mjs";
|
|
125
132
|
import "../chunk-SZ5C44L5.mjs";
|
|
126
133
|
import {
|
|
127
134
|
RequestError
|
|
128
|
-
} from "../chunk-
|
|
135
|
+
} from "../chunk-ZLTMIFCZ.mjs";
|
|
129
136
|
import {
|
|
130
137
|
BeraError,
|
|
131
138
|
InvalidArgumentError
|
|
132
|
-
} from "../chunk-
|
|
139
|
+
} from "../chunk-KHXJDYA4.mjs";
|
|
133
140
|
|
|
134
141
|
// src/hooks/bend/useGetConvertToAssets.ts
|
|
135
142
|
import useSWR from "swr";
|
|
@@ -5349,15 +5356,7 @@ function useAutoclaimedIncentives({
|
|
|
5349
5356
|
const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentives", account] : null;
|
|
5350
5357
|
const swrResponse = useSWR31(
|
|
5351
5358
|
QUERY_KEY,
|
|
5352
|
-
async ([, account2]) => {
|
|
5353
|
-
if (!account2) {
|
|
5354
|
-
throw new BeraError({
|
|
5355
|
-
message: "useAutoclaimedIncentives needs a logged in account",
|
|
5356
|
-
level: "error"
|
|
5357
|
-
});
|
|
5358
|
-
}
|
|
5359
|
-
return await getAutoclaimedIncentives({ account: account2 });
|
|
5360
|
-
},
|
|
5359
|
+
async ([, account2]) => getAutoclaimedIncentives({ account: account2 }),
|
|
5361
5360
|
{
|
|
5362
5361
|
revalidateOnFocus: false,
|
|
5363
5362
|
revalidateOnReconnect: false,
|
|
@@ -5370,6 +5369,34 @@ function useAutoclaimedIncentives({
|
|
|
5370
5369
|
};
|
|
5371
5370
|
}
|
|
5372
5371
|
|
|
5372
|
+
// src/hooks/pol/useAutoclaimedIncentivesTxHash.ts
|
|
5373
|
+
import useSWR32 from "swr";
|
|
5374
|
+
import { useBeraWallet as useBeraWallet18 } from "@berachain/wagmi/hooks";
|
|
5375
|
+
function useAutoclaimedIncentivesTxHash({
|
|
5376
|
+
enabled
|
|
5377
|
+
}) {
|
|
5378
|
+
const { address: account } = useBeraWallet18();
|
|
5379
|
+
const QUERY_KEY = enabled && account ? ["useAutoclaimedIncentivesTxHash", account] : null;
|
|
5380
|
+
const swrResponse = useSWR32(
|
|
5381
|
+
QUERY_KEY,
|
|
5382
|
+
async ([, account2]) => getAutoclaimedIncentivesTxHash({ account: account2 }),
|
|
5383
|
+
{
|
|
5384
|
+
// txhashes flip from absent → present as the bot processes each token,
|
|
5385
|
+
// so we need to actually poll. Cadence matches the bot's tx cadence
|
|
5386
|
+
// (minutes, not seconds) and lets the user watch pending → claimed
|
|
5387
|
+
// transitions without reloading the page.
|
|
5388
|
+
refreshInterval: 1e5 /* NORMAL */,
|
|
5389
|
+
revalidateOnFocus: true,
|
|
5390
|
+
revalidateOnReconnect: true,
|
|
5391
|
+
revalidateIfStale: false
|
|
5392
|
+
}
|
|
5393
|
+
);
|
|
5394
|
+
return {
|
|
5395
|
+
...swrResponse,
|
|
5396
|
+
refresh: () => swrResponse?.mutate?.()
|
|
5397
|
+
};
|
|
5398
|
+
}
|
|
5399
|
+
|
|
5373
5400
|
// src/hooks/pol/useBgtAprSimulation.ts
|
|
5374
5401
|
import { useMemo as useMemo11 } from "react";
|
|
5375
5402
|
function useBgtAprSimulation(args) {
|
|
@@ -5382,15 +5409,15 @@ function useBgtAprSimulation(args) {
|
|
|
5382
5409
|
}
|
|
5383
5410
|
|
|
5384
5411
|
// src/hooks/pol/useBgtUnstakedBalance.ts
|
|
5385
|
-
import
|
|
5412
|
+
import useSWR33 from "swr";
|
|
5386
5413
|
import { formatEther as formatEther5 } from "viem";
|
|
5387
5414
|
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
5388
|
-
import { useBeraWallet as
|
|
5415
|
+
import { useBeraWallet as useBeraWallet19, usePublicClient as usePublicClient26 } from "@berachain/wagmi/hooks";
|
|
5389
5416
|
var useBgtUnstakedBalance = (options) => {
|
|
5390
|
-
const { address: account } =
|
|
5417
|
+
const { address: account } = useBeraWallet19();
|
|
5391
5418
|
const publicClient = usePublicClient26();
|
|
5392
5419
|
const QUERY_KEY = account && publicClient ? ["useBgtUnstakedBalance", account] : null;
|
|
5393
|
-
const swrResponse =
|
|
5420
|
+
const swrResponse = useSWR33(
|
|
5394
5421
|
QUERY_KEY,
|
|
5395
5422
|
async ([, account2]) => {
|
|
5396
5423
|
assertPublicClient(publicClient);
|
|
@@ -5417,14 +5444,14 @@ var useBgtUnstakedBalance = (options) => {
|
|
|
5417
5444
|
};
|
|
5418
5445
|
|
|
5419
5446
|
// src/hooks/pol/useClaimableFees.ts
|
|
5420
|
-
import
|
|
5447
|
+
import useSWR34 from "swr";
|
|
5421
5448
|
import { formatUnits as formatUnits11 } from "viem";
|
|
5422
|
-
import { useBeraWallet as
|
|
5449
|
+
import { useBeraWallet as useBeraWallet20, usePublicClient as usePublicClient27 } from "@berachain/wagmi/hooks";
|
|
5423
5450
|
var useClaimableFees = () => {
|
|
5424
|
-
const { address: account } =
|
|
5451
|
+
const { address: account } = useBeraWallet20();
|
|
5425
5452
|
const publicClient = usePublicClient27();
|
|
5426
5453
|
const QUERY_KEY = account && publicClient ? ["useClaimableFees", account] : null;
|
|
5427
|
-
const swrResponse =
|
|
5454
|
+
const swrResponse = useSWR34(
|
|
5428
5455
|
QUERY_KEY,
|
|
5429
5456
|
async ([, account2]) => {
|
|
5430
5457
|
assertPublicClient(publicClient);
|
|
@@ -5455,7 +5482,7 @@ import {
|
|
|
5455
5482
|
} from "@berachain/graphql/pol/api";
|
|
5456
5483
|
|
|
5457
5484
|
// src/hooks/pol/useRewardVaults.ts
|
|
5458
|
-
import
|
|
5485
|
+
import useSWR35 from "swr";
|
|
5459
5486
|
import { usePublicClient as usePublicClient28 } from "@berachain/wagmi/hooks";
|
|
5460
5487
|
var useRewardVaultsQueryKey = (filter, onChainIncentives = false) => {
|
|
5461
5488
|
return ["useRewardVaults", filter, onChainIncentives];
|
|
@@ -5466,7 +5493,7 @@ var useRewardVaults = (args, options) => {
|
|
|
5466
5493
|
args.onChainIncentives
|
|
5467
5494
|
);
|
|
5468
5495
|
const publicClient = usePublicClient28();
|
|
5469
|
-
const swrResponse =
|
|
5496
|
+
const swrResponse = useSWR35(
|
|
5470
5497
|
options?.opts?.isEnabled ?? true ? QUERY_KEY : null,
|
|
5471
5498
|
async ([, filter, onChainIncentives]) => {
|
|
5472
5499
|
return await getRewardVaults({
|
|
@@ -5512,11 +5539,11 @@ var useHighestVaultsAPR = (where = {}, { isEnabled = true } = {}) => {
|
|
|
5512
5539
|
};
|
|
5513
5540
|
|
|
5514
5541
|
// src/hooks/pol/usePollGlobalData.ts
|
|
5515
|
-
import
|
|
5542
|
+
import useSWR36 from "swr";
|
|
5516
5543
|
import { usePublicClient as usePublicClient29 } from "@berachain/wagmi/hooks";
|
|
5517
5544
|
var usePollGlobalData = (options) => {
|
|
5518
5545
|
const publicClient = usePublicClient29();
|
|
5519
|
-
const swrResponse =
|
|
5546
|
+
const swrResponse = useSWR36(
|
|
5520
5547
|
publicClient ? "usePollGlobalData" : null,
|
|
5521
5548
|
async () => {
|
|
5522
5549
|
assertPublicClient(publicClient);
|
|
@@ -5599,7 +5626,7 @@ function useQueuedBeraUnlock({
|
|
|
5599
5626
|
}
|
|
5600
5627
|
|
|
5601
5628
|
// src/hooks/pol/useRewardTokenToBeraRate.ts
|
|
5602
|
-
import
|
|
5629
|
+
import useSWR37 from "swr";
|
|
5603
5630
|
import { isAddress as isAddress10 } from "viem";
|
|
5604
5631
|
import { defaultChainId as defaultChainId11 } from "@berachain/config/internal";
|
|
5605
5632
|
import { usePublicClient as usePublicClient31 } from "@berachain/wagmi/hooks";
|
|
@@ -5608,7 +5635,7 @@ var useRewardTokenToBeraRate = ({
|
|
|
5608
5635
|
}, opt) => {
|
|
5609
5636
|
const QUERY_KEY = address ? ["useRewardTokenToBeraRate", address] : null;
|
|
5610
5637
|
const publicClient = usePublicClient31({ chainId: defaultChainId11 });
|
|
5611
|
-
return
|
|
5638
|
+
return useSWR37(
|
|
5612
5639
|
QUERY_KEY,
|
|
5613
5640
|
async ([_, address2]) => {
|
|
5614
5641
|
if (!address2 || !isAddress10(address2)) {
|
|
@@ -5631,10 +5658,10 @@ var useRewardTokenToBeraRate = ({
|
|
|
5631
5658
|
};
|
|
5632
5659
|
|
|
5633
5660
|
// src/hooks/pol/useRewardVault.ts
|
|
5634
|
-
import
|
|
5661
|
+
import useSWR39 from "swr";
|
|
5635
5662
|
|
|
5636
5663
|
// src/hooks/pol/useOnChainRewardVault.ts
|
|
5637
|
-
import
|
|
5664
|
+
import useSWR38 from "swr";
|
|
5638
5665
|
import { erc20Abi as erc20Abi4, formatUnits as formatUnits13, isAddress as isAddress11 } from "viem";
|
|
5639
5666
|
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
5640
5667
|
import { usePublicClient as usePublicClient32 } from "@berachain/wagmi/hooks";
|
|
@@ -5689,7 +5716,7 @@ var useOnChainRewardVault = ({
|
|
|
5689
5716
|
const publicClient = usePublicClient32();
|
|
5690
5717
|
const isEnabled = opt.opts?.isEnabled ?? true;
|
|
5691
5718
|
const QUERY_KEY = useOnChainRewardVaultQueryKey(address);
|
|
5692
|
-
return
|
|
5719
|
+
return useSWR38(isEnabled && publicClient ? QUERY_KEY : null, async ([, address2]) => {
|
|
5693
5720
|
assertPublicClient(publicClient);
|
|
5694
5721
|
const { config } = parseBaseArgs({
|
|
5695
5722
|
chainId: publicClient.chain.id
|
|
@@ -5767,7 +5794,7 @@ var useOnChainRewardVault = ({
|
|
|
5767
5794
|
var useRewardVaultQueryKey = (address) => address ? ["useRewardVault", address.toLowerCase()] : null;
|
|
5768
5795
|
var useRewardVault = (id, options) => {
|
|
5769
5796
|
const QUERY_KEY = useRewardVaultQueryKey(id);
|
|
5770
|
-
const swrResponse =
|
|
5797
|
+
const swrResponse = useSWR39(
|
|
5771
5798
|
QUERY_KEY,
|
|
5772
5799
|
async ([_, id2]) => getRewardVault({ address: id2 }),
|
|
5773
5800
|
{
|
|
@@ -5792,7 +5819,7 @@ var useRewardVault = (id, options) => {
|
|
|
5792
5819
|
};
|
|
5793
5820
|
|
|
5794
5821
|
// src/hooks/pol/useRewardVaultIncentives.ts
|
|
5795
|
-
import
|
|
5822
|
+
import useSWR40 from "swr";
|
|
5796
5823
|
import { usePublicClient as usePublicClient33 } from "@berachain/wagmi/hooks";
|
|
5797
5824
|
function useRewardVaultIncentives({
|
|
5798
5825
|
address,
|
|
@@ -5800,7 +5827,7 @@ function useRewardVaultIncentives({
|
|
|
5800
5827
|
}) {
|
|
5801
5828
|
const publicClient = usePublicClient33();
|
|
5802
5829
|
const QUERY_KEY = publicClient && address && stakingToken ? ["useRewardVaultIncentives", address, stakingToken] : null;
|
|
5803
|
-
const swrResponse =
|
|
5830
|
+
const swrResponse = useSWR40(QUERY_KEY, async ([, address2, stakingToken2]) => {
|
|
5804
5831
|
assertPublicClient(publicClient);
|
|
5805
5832
|
return await getRewardVaultIncentives({
|
|
5806
5833
|
address: address2,
|
|
@@ -5815,12 +5842,12 @@ function useRewardVaultIncentives({
|
|
|
5815
5842
|
}
|
|
5816
5843
|
|
|
5817
5844
|
// src/hooks/pol/useRewardVaultRewards.ts
|
|
5818
|
-
import
|
|
5845
|
+
import useSWR41 from "swr";
|
|
5819
5846
|
import { usePublicClient as usePublicClient34 } from "@berachain/wagmi/hooks";
|
|
5820
5847
|
var useRewardVaultRewards = (address, options) => {
|
|
5821
5848
|
const publicClient = usePublicClient34();
|
|
5822
5849
|
const QUERY_KEY = publicClient && address ? ["useRewardVaultRewards", address] : null;
|
|
5823
|
-
const swrResponse =
|
|
5850
|
+
const swrResponse = useSWR41(
|
|
5824
5851
|
QUERY_KEY,
|
|
5825
5852
|
async ([, address2]) => {
|
|
5826
5853
|
assertPublicClient(publicClient);
|
|
@@ -5837,7 +5864,7 @@ var useRewardVaultRewards = (address, options) => {
|
|
|
5837
5864
|
};
|
|
5838
5865
|
|
|
5839
5866
|
// src/hooks/pol/useStakedAPR.ts
|
|
5840
|
-
import
|
|
5867
|
+
import useSWR42 from "swr";
|
|
5841
5868
|
|
|
5842
5869
|
// src/utils/filter.ts
|
|
5843
5870
|
var dailyResolution = (data) => {
|
|
@@ -5866,7 +5893,7 @@ function useStakedAPR({
|
|
|
5866
5893
|
range
|
|
5867
5894
|
}) {
|
|
5868
5895
|
const QUERY_KEY = range ? ["useStakedAPR", range] : null;
|
|
5869
|
-
const swrResponse =
|
|
5896
|
+
const swrResponse = useSWR42(QUERY_KEY, async ([, range2]) => {
|
|
5870
5897
|
const unsortedStakedBeraSnapshots = await getStakedBeraSnapshots({
|
|
5871
5898
|
range: range2
|
|
5872
5899
|
});
|
|
@@ -5886,12 +5913,12 @@ function useStakedAPR({
|
|
|
5886
5913
|
|
|
5887
5914
|
// src/hooks/pol/useStakedData.ts
|
|
5888
5915
|
import { useMemo as useMemo12 } from "react";
|
|
5889
|
-
import
|
|
5890
|
-
import { useBeraWallet as
|
|
5916
|
+
import useSWR43 from "swr";
|
|
5917
|
+
import { useBeraWallet as useBeraWallet21, usePublicClient as usePublicClient35 } from "@berachain/wagmi/hooks";
|
|
5891
5918
|
var useStakedData = (stakingConfigs) => {
|
|
5892
5919
|
const window2 = useBeraFlag("swberaAprWindow");
|
|
5893
5920
|
const publicClient = usePublicClient35();
|
|
5894
|
-
const { address: account } =
|
|
5921
|
+
const { address: account } = useBeraWallet21();
|
|
5895
5922
|
const receiptTokens = useMemo12(
|
|
5896
5923
|
() => stakingConfigs.map((config) => config.receiptToken),
|
|
5897
5924
|
[stakingConfigs]
|
|
@@ -5901,7 +5928,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5901
5928
|
[stakingConfigs]
|
|
5902
5929
|
);
|
|
5903
5930
|
const aprKey = window2 ? ["useStakedData:apr", window2] : null;
|
|
5904
|
-
const { data: apr } =
|
|
5931
|
+
const { data: apr } = useSWR43(
|
|
5905
5932
|
aprKey,
|
|
5906
5933
|
async ([, window3]) => getStakedBeraAPR({ window: window3 }),
|
|
5907
5934
|
{ refreshInterval: 1e5 /* NORMAL */ }
|
|
@@ -5909,7 +5936,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5909
5936
|
const { data: walletBalances, isLoading: isLoadingBalances } = usePollWalletBalances({ tokens: receiptTokens });
|
|
5910
5937
|
const { getTokenPrice } = useTokenPrices({ tokens: inputTokens });
|
|
5911
5938
|
const exchangeRatesKey = publicClient && receiptTokens.length > 0 ? ["useStakedData:exchangeRates", receiptTokens] : null;
|
|
5912
|
-
const { data: exchangeRates } =
|
|
5939
|
+
const { data: exchangeRates } = useSWR43(
|
|
5913
5940
|
exchangeRatesKey,
|
|
5914
5941
|
async ([, receiptTokens2]) => {
|
|
5915
5942
|
assertPublicClient(publicClient);
|
|
@@ -5950,7 +5977,7 @@ var useStakedData = (stakingConfigs) => {
|
|
|
5950
5977
|
data: positionsRaw,
|
|
5951
5978
|
isLoading: isLoadingPositions,
|
|
5952
5979
|
isValidating: isValidatingPositions
|
|
5953
|
-
} =
|
|
5980
|
+
} = useSWR43(
|
|
5954
5981
|
positionsKey,
|
|
5955
5982
|
async ([, account2, stakingConfigs2]) => {
|
|
5956
5983
|
assertPublicClient(publicClient);
|
|
@@ -6015,20 +6042,23 @@ var useStakedData = (stakingConfigs) => {
|
|
|
6015
6042
|
};
|
|
6016
6043
|
|
|
6017
6044
|
// src/hooks/pol/useStakedSnapshots.ts
|
|
6018
|
-
import
|
|
6045
|
+
import useSWR44 from "swr";
|
|
6019
6046
|
|
|
6020
6047
|
// src/actions/pol/getStakingDailyAssets.ts
|
|
6021
|
-
import { getUriFromLink as getUriFromLink2 } from "@berachain/config";
|
|
6022
6048
|
async function getStakingDailyAssets({
|
|
6023
6049
|
address,
|
|
6024
6050
|
range
|
|
6025
6051
|
}) {
|
|
6026
6052
|
const { config } = parseBaseArgs({});
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6053
|
+
if (!config.beep) {
|
|
6054
|
+
return fetchRailwayBackend("/vaults/{vault}/stats-by-day", {
|
|
6055
|
+
path: { vault: address },
|
|
6056
|
+
query: { days: `${range}` }
|
|
6057
|
+
});
|
|
6058
|
+
}
|
|
6059
|
+
return fetchBeep("/v0/stake/{vault}/stats-by-day", {
|
|
6060
|
+
path: { vault: address },
|
|
6061
|
+
query: { days: `${range}` }
|
|
6032
6062
|
});
|
|
6033
6063
|
}
|
|
6034
6064
|
|
|
@@ -6038,7 +6068,7 @@ function useStakedSnapshots({
|
|
|
6038
6068
|
addresses
|
|
6039
6069
|
}) {
|
|
6040
6070
|
const QUERY_KEY = range ? ["useStakedSnapshots", range, addresses] : null;
|
|
6041
|
-
const swrResponse =
|
|
6071
|
+
const swrResponse = useSWR44(QUERY_KEY, async ([, range2, addresses2]) => {
|
|
6042
6072
|
const [...sortedStakingDailyAssetsArray] = await Promise.all([
|
|
6043
6073
|
...addresses2.map(async (address) => {
|
|
6044
6074
|
const unstakingDailyAssets = await getStakingDailyAssets({
|
|
@@ -6065,13 +6095,13 @@ function useStakedSnapshots({
|
|
|
6065
6095
|
}
|
|
6066
6096
|
|
|
6067
6097
|
// src/hooks/pol/useStakingVaultsMetadata.ts
|
|
6068
|
-
import
|
|
6098
|
+
import useSWR45 from "swr";
|
|
6069
6099
|
import { usePublicClient as usePublicClient36 } from "@berachain/wagmi/hooks";
|
|
6070
6100
|
var useStakingVaultsMetadata = (vaults = []) => {
|
|
6071
6101
|
const publicClient = usePublicClient36();
|
|
6072
6102
|
const blockTime = useBlockTime();
|
|
6073
6103
|
const QUERY_KEY = vaults.length > 0 && publicClient && blockTime ? ["useStakingVaultMetadata", vaults, publicClient, blockTime] : null;
|
|
6074
|
-
return
|
|
6104
|
+
return useSWR45(
|
|
6075
6105
|
QUERY_KEY,
|
|
6076
6106
|
async ([, vaults2, publicClient2, blockTime2]) => {
|
|
6077
6107
|
assertPublicClient(publicClient2);
|
|
@@ -6091,13 +6121,13 @@ var useStakingVaultsMetadata = (vaults = []) => {
|
|
|
6091
6121
|
};
|
|
6092
6122
|
|
|
6093
6123
|
// src/hooks/pol/useTotalStakedAmount.ts
|
|
6094
|
-
import
|
|
6124
|
+
import useSWR46 from "swr";
|
|
6095
6125
|
import { usePublicClient as usePublicClient37 } from "@berachain/wagmi/hooks";
|
|
6096
6126
|
function useTotalStakedAmount({
|
|
6097
6127
|
vaultAddresses
|
|
6098
6128
|
}) {
|
|
6099
6129
|
const publicClient = usePublicClient37();
|
|
6100
|
-
const swrResponse =
|
|
6130
|
+
const swrResponse = useSWR46(
|
|
6101
6131
|
vaultAddresses && publicClient ? ["useTotalStakedAmount", vaultAddresses] : null,
|
|
6102
6132
|
([, vaultAddresses2]) => {
|
|
6103
6133
|
return getTotalStakedAmount({ vaultAddresses: vaultAddresses2, publicClient });
|
|
@@ -6110,13 +6140,13 @@ function useTotalStakedAmount({
|
|
|
6110
6140
|
}
|
|
6111
6141
|
|
|
6112
6142
|
// src/hooks/pol/useUserVaultInfo.ts
|
|
6113
|
-
import
|
|
6114
|
-
import { useBeraWallet as
|
|
6143
|
+
import useSWR47 from "swr";
|
|
6144
|
+
import { useBeraWallet as useBeraWallet22, usePublicClient as usePublicClient38 } from "@berachain/wagmi/hooks";
|
|
6115
6145
|
var useUserVaultInfo = (args, options) => {
|
|
6116
|
-
const { address: account } =
|
|
6146
|
+
const { address: account } = useBeraWallet22();
|
|
6117
6147
|
const publicClient = usePublicClient38();
|
|
6118
6148
|
const QUERY_KEY = account && publicClient && args.vaultAddress ? ["useUserVaultInfo", account, args.vaultAddress] : null;
|
|
6119
|
-
const swrResponse =
|
|
6149
|
+
const swrResponse = useSWR47(
|
|
6120
6150
|
QUERY_KEY,
|
|
6121
6151
|
async ([, account2, vaultAddress]) => {
|
|
6122
6152
|
assertPublicClient(publicClient);
|
|
@@ -6138,13 +6168,13 @@ var useUserVaultInfo = (args, options) => {
|
|
|
6138
6168
|
};
|
|
6139
6169
|
|
|
6140
6170
|
// src/hooks/pol/useUserVaults.ts
|
|
6141
|
-
import
|
|
6142
|
-
import { useBeraWallet as
|
|
6171
|
+
import useSWR48 from "swr";
|
|
6172
|
+
import { useBeraWallet as useBeraWallet23, usePublicClient as usePublicClient39 } from "@berachain/wagmi/hooks";
|
|
6143
6173
|
var useUserVaults = (options) => {
|
|
6144
|
-
const { address: account } =
|
|
6174
|
+
const { address: account } = useBeraWallet23();
|
|
6145
6175
|
const publicClient = usePublicClient39();
|
|
6146
6176
|
const QUERY_KEY = account && publicClient ? ["useUserVaults", account] : null;
|
|
6147
|
-
const swrResponse =
|
|
6177
|
+
const swrResponse = useSWR48(
|
|
6148
6178
|
QUERY_KEY,
|
|
6149
6179
|
async ([, account2]) => {
|
|
6150
6180
|
assertPublicClient(publicClient);
|
|
@@ -6166,12 +6196,12 @@ var useUserVaults = (options) => {
|
|
|
6166
6196
|
};
|
|
6167
6197
|
|
|
6168
6198
|
// src/hooks/pol/useVaultAddress.ts
|
|
6169
|
-
import
|
|
6199
|
+
import useSWR49 from "swr";
|
|
6170
6200
|
import { usePublicClient as usePublicClient40 } from "@berachain/wagmi/hooks";
|
|
6171
6201
|
var useVaultAddress = (vaultAddress) => {
|
|
6172
6202
|
const publicClient = usePublicClient40();
|
|
6173
6203
|
const QUERY_KEY = vaultAddress && publicClient ? ["useVaultAddress", vaultAddress] : null;
|
|
6174
|
-
return
|
|
6204
|
+
return useSWR49(QUERY_KEY, async ([, vaultAddress2]) => {
|
|
6175
6205
|
assertPublicClient(publicClient);
|
|
6176
6206
|
const [stakeToken] = await Promise.all([
|
|
6177
6207
|
getRewardVaultStakingToken({
|
|
@@ -6184,14 +6214,14 @@ var useVaultAddress = (vaultAddress) => {
|
|
|
6184
6214
|
};
|
|
6185
6215
|
|
|
6186
6216
|
// src/hooks/pol/useVaultHistory.ts
|
|
6187
|
-
import
|
|
6217
|
+
import useSWR50 from "swr";
|
|
6188
6218
|
var useVaultHistory = ({
|
|
6189
6219
|
vault,
|
|
6190
6220
|
range,
|
|
6191
6221
|
resolution
|
|
6192
6222
|
}) => {
|
|
6193
6223
|
const QUERY_KEY = vault ? ["useVaultHistory", vault, range, resolution] : null;
|
|
6194
|
-
const swrResponse =
|
|
6224
|
+
const swrResponse = useSWR50(
|
|
6195
6225
|
QUERY_KEY,
|
|
6196
6226
|
([, vault2, range2, resolution2]) => getVaultHistory({ vault: vault2, range: range2, resolution: resolution2 })
|
|
6197
6227
|
);
|
|
@@ -6202,10 +6232,10 @@ var useVaultHistory = ({
|
|
|
6202
6232
|
};
|
|
6203
6233
|
|
|
6204
6234
|
// src/hooks/pol/useVaultValidators.ts
|
|
6205
|
-
import
|
|
6235
|
+
import useSWR51 from "swr";
|
|
6206
6236
|
var useVaultValidators = (id, options) => {
|
|
6207
6237
|
const QUERY_KEY = id ? ["useVaultValidators", id] : null;
|
|
6208
|
-
const swrResponse =
|
|
6238
|
+
const swrResponse = useSWR51(
|
|
6209
6239
|
QUERY_KEY,
|
|
6210
6240
|
async ([, address]) => {
|
|
6211
6241
|
return await getVaultValidators({
|
|
@@ -6288,12 +6318,12 @@ function useTokenPrice({ token }, options) {
|
|
|
6288
6318
|
}
|
|
6289
6319
|
|
|
6290
6320
|
// src/hooks/tokens/useTotalSupply.ts
|
|
6291
|
-
import
|
|
6321
|
+
import useSWR52 from "swr";
|
|
6292
6322
|
import { erc20Abi as erc20Abi5 } from "viem";
|
|
6293
6323
|
import { usePublicClient as usePublicClient42 } from "@berachain/wagmi/hooks";
|
|
6294
6324
|
function useTotalSupply({ address }) {
|
|
6295
6325
|
const publicClient = usePublicClient42();
|
|
6296
|
-
return
|
|
6326
|
+
return useSWR52(
|
|
6297
6327
|
address && publicClient ? ["useTotalSupply", address] : null,
|
|
6298
6328
|
([, address2]) => {
|
|
6299
6329
|
assertPublicClient(publicClient);
|
|
@@ -6538,7 +6568,7 @@ function usePrevious(value) {
|
|
|
6538
6568
|
}
|
|
6539
6569
|
|
|
6540
6570
|
// src/hooks/validators/useAllValidators.ts
|
|
6541
|
-
import
|
|
6571
|
+
import useSWR53 from "swr";
|
|
6542
6572
|
var useAllValidatorsQueryKey = ({
|
|
6543
6573
|
variables
|
|
6544
6574
|
} = {}) => {
|
|
@@ -6546,7 +6576,7 @@ var useAllValidatorsQueryKey = ({
|
|
|
6546
6576
|
};
|
|
6547
6577
|
var useAllValidators = (variables, options) => {
|
|
6548
6578
|
const { config } = parseBaseArgs(variables);
|
|
6549
|
-
const swrResponse =
|
|
6579
|
+
const swrResponse = useSWR53(
|
|
6550
6580
|
useAllValidatorsQueryKey({ variables }),
|
|
6551
6581
|
async ([, variables2]) => {
|
|
6552
6582
|
const result = await getAllValidators({
|
|
@@ -6569,11 +6599,11 @@ var useAllValidators = (variables, options) => {
|
|
|
6569
6599
|
};
|
|
6570
6600
|
|
|
6571
6601
|
// src/hooks/validators/useApiEnrichedAllocation.ts
|
|
6572
|
-
import
|
|
6602
|
+
import useSWR54 from "swr";
|
|
6573
6603
|
function useApiEnrichedAllocation({
|
|
6574
6604
|
allocation
|
|
6575
6605
|
}) {
|
|
6576
|
-
return
|
|
6606
|
+
return useSWR54(
|
|
6577
6607
|
allocation ? ["useApiEnrichedAllocation", allocation] : null,
|
|
6578
6608
|
([, allocation2]) => {
|
|
6579
6609
|
return getApiEnrichedAllocation({ allocation: allocation2 });
|
|
@@ -6582,13 +6612,13 @@ function useApiEnrichedAllocation({
|
|
|
6582
6612
|
}
|
|
6583
6613
|
|
|
6584
6614
|
// src/hooks/validators/useApiValidator.ts
|
|
6585
|
-
import
|
|
6615
|
+
import useSWR55 from "swr";
|
|
6586
6616
|
import { isHex } from "viem";
|
|
6587
6617
|
var useApiValidatorQueryKey = (id) => id ? ["useApiValidator", id] : null;
|
|
6588
6618
|
var useApiValidator = (id, options) => {
|
|
6589
6619
|
const QUERY_KEY = useApiValidatorQueryKey(id);
|
|
6590
6620
|
const isEnabled = options?.opts?.isEnabled ?? true;
|
|
6591
|
-
const swrResponse =
|
|
6621
|
+
const swrResponse = useSWR55(
|
|
6592
6622
|
isEnabled && id ? QUERY_KEY : null,
|
|
6593
6623
|
async ([, id2]) => {
|
|
6594
6624
|
if (!id2 || !isHex(id2)) throw new Error(`Invalid validator ID: ${id2}`);
|
|
@@ -6605,7 +6635,7 @@ var useApiValidator = (id, options) => {
|
|
|
6605
6635
|
};
|
|
6606
6636
|
|
|
6607
6637
|
// src/hooks/validators/useBaselineRewardAllocation.ts
|
|
6608
|
-
import
|
|
6638
|
+
import useSWR56 from "swr";
|
|
6609
6639
|
import { usePublicClient as usePublicClient44 } from "@berachain/wagmi/hooks";
|
|
6610
6640
|
|
|
6611
6641
|
// src/actions/validators/getBaselineRewardAllocation.ts
|
|
@@ -6629,7 +6659,7 @@ async function getBaselineRewardAllocation({
|
|
|
6629
6659
|
// src/hooks/validators/useBaselineRewardAllocation.ts
|
|
6630
6660
|
function useBaselineRewardAllocation() {
|
|
6631
6661
|
const publicClient = usePublicClient44();
|
|
6632
|
-
return
|
|
6662
|
+
return useSWR56(publicClient ? ["baselineRewardAllocation"] : null, () => {
|
|
6633
6663
|
assertPublicClient(publicClient);
|
|
6634
6664
|
return getBaselineRewardAllocation({
|
|
6635
6665
|
publicClient
|
|
@@ -6638,13 +6668,13 @@ function useBaselineRewardAllocation() {
|
|
|
6638
6668
|
}
|
|
6639
6669
|
|
|
6640
6670
|
// src/hooks/validators/useDailyValidatorBlockStats.ts
|
|
6641
|
-
import
|
|
6671
|
+
import useSWR57 from "swr";
|
|
6642
6672
|
var useDailyValidatorBlockStats = ({
|
|
6643
6673
|
pubKey,
|
|
6644
6674
|
first = 1
|
|
6645
6675
|
}) => {
|
|
6646
6676
|
const QUERY_KEY = pubKey ? ["useDailyValidatorBlockStats", pubKey, first] : null;
|
|
6647
|
-
const swrResponse =
|
|
6677
|
+
const swrResponse = useSWR57(
|
|
6648
6678
|
QUERY_KEY,
|
|
6649
6679
|
async ([, pubKey2, first2]) => {
|
|
6650
6680
|
return await getDailyValidatorBlockStats({
|
|
@@ -6660,12 +6690,12 @@ var useDailyValidatorBlockStats = ({
|
|
|
6660
6690
|
};
|
|
6661
6691
|
|
|
6662
6692
|
// src/hooks/validators/useDefaultRewardAllocation.ts
|
|
6663
|
-
import
|
|
6693
|
+
import useSWR58 from "swr";
|
|
6664
6694
|
import { usePublicClient as usePublicClient45 } from "@berachain/wagmi/hooks";
|
|
6665
6695
|
function useDefaultRewardAllocation(options) {
|
|
6666
6696
|
const publicClient = usePublicClient45();
|
|
6667
6697
|
const QUERY_KEY = publicClient ? ["useDefaultRewardAllocation"] : null;
|
|
6668
|
-
const swrResponse =
|
|
6698
|
+
const swrResponse = useSWR58(
|
|
6669
6699
|
QUERY_KEY,
|
|
6670
6700
|
async () => {
|
|
6671
6701
|
assertPublicClient(publicClient);
|
|
@@ -6685,8 +6715,8 @@ function useDefaultRewardAllocation(options) {
|
|
|
6685
6715
|
|
|
6686
6716
|
// src/hooks/validators/useManagedValidatorRole.ts
|
|
6687
6717
|
import { useMemo as useMemo13 } from "react";
|
|
6688
|
-
import
|
|
6689
|
-
import { useBeraWallet as
|
|
6718
|
+
import useSWR59 from "swr";
|
|
6719
|
+
import { useBeraWallet as useBeraWallet24, usePublicClient as usePublicClient46 } from "@berachain/wagmi/hooks";
|
|
6690
6720
|
|
|
6691
6721
|
// src/actions/validators/getValidatorRewardAllocatorAddress.ts
|
|
6692
6722
|
import { zeroAddress as zeroAddress25 } from "viem";
|
|
@@ -6739,9 +6769,9 @@ function useManagedValidatorRole({
|
|
|
6739
6769
|
"mockValidatorRewardAllocator"
|
|
6740
6770
|
);
|
|
6741
6771
|
const QUERY_KEY = publicClient && pubKey ? ["useManagedValidatorRole", pubKey] : null;
|
|
6742
|
-
const { address: connectedAccount } =
|
|
6772
|
+
const { address: connectedAccount } = useBeraWallet24();
|
|
6743
6773
|
const account = accountAddress ?? connectedAccount;
|
|
6744
|
-
const swrResponse =
|
|
6774
|
+
const swrResponse = useSWR59(
|
|
6745
6775
|
QUERY_KEY,
|
|
6746
6776
|
async ([, pubKey2]) => {
|
|
6747
6777
|
assertPublicClient(publicClient);
|
|
@@ -6782,7 +6812,7 @@ function useManagedValidatorRole({
|
|
|
6782
6812
|
}
|
|
6783
6813
|
|
|
6784
6814
|
// src/hooks/validators/useOnChainValidator.ts
|
|
6785
|
-
import
|
|
6815
|
+
import useSWR60 from "swr";
|
|
6786
6816
|
import { keccak256 as keccak2562 } from "viem";
|
|
6787
6817
|
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
6788
6818
|
import { bgtAbi as bgtAbi2 } from "@berachain/abis/pol/bgt";
|
|
@@ -6792,7 +6822,7 @@ var useOnChainValidator = ({ pubkey }, options) => {
|
|
|
6792
6822
|
const publicClient = usePublicClient47();
|
|
6793
6823
|
const QUERY_KEY = pubkey ? ["useOnChainValidator", pubkey] : null;
|
|
6794
6824
|
const isEnabled = options.opts?.isEnabled ?? true;
|
|
6795
|
-
const swrResponse =
|
|
6825
|
+
const swrResponse = useSWR60(
|
|
6796
6826
|
isEnabled && publicClient ? QUERY_KEY : null,
|
|
6797
6827
|
async ([, pubkey2]) => {
|
|
6798
6828
|
assertPublicClient(publicClient);
|
|
@@ -6836,7 +6866,7 @@ var useOnChainValidator = ({ pubkey }, options) => {
|
|
|
6836
6866
|
};
|
|
6837
6867
|
|
|
6838
6868
|
// src/hooks/validators/useStakingPoolBatch.ts
|
|
6839
|
-
import
|
|
6869
|
+
import useSWR61 from "swr";
|
|
6840
6870
|
import { usePublicClient as usePublicClient48 } from "@berachain/wagmi/hooks";
|
|
6841
6871
|
var useStakingPoolBatch = ({
|
|
6842
6872
|
valPubKey,
|
|
@@ -6845,7 +6875,7 @@ var useStakingPoolBatch = ({
|
|
|
6845
6875
|
const publicClient = usePublicClient48();
|
|
6846
6876
|
const isEnabled = options?.opts?.isEnabled ?? true;
|
|
6847
6877
|
const QUERY_KEY = isEnabled && publicClient && valPubKey ? ["useStakingPoolBatch", valPubKey] : null;
|
|
6848
|
-
const swrResponse =
|
|
6878
|
+
const swrResponse = useSWR61(
|
|
6849
6879
|
QUERY_KEY,
|
|
6850
6880
|
async ([, valPubKey2]) => {
|
|
6851
6881
|
assertPublicClient(publicClient);
|
|
@@ -6866,13 +6896,13 @@ var useStakingPoolBatch = ({
|
|
|
6866
6896
|
};
|
|
6867
6897
|
|
|
6868
6898
|
// src/hooks/validators/useUserActiveValidators.ts
|
|
6869
|
-
import
|
|
6870
|
-
import { useBeraWallet as
|
|
6899
|
+
import useSWR62 from "swr";
|
|
6900
|
+
import { useBeraWallet as useBeraWallet25, usePublicClient as usePublicClient49 } from "@berachain/wagmi/hooks";
|
|
6871
6901
|
var useUserActiveValidators = (options) => {
|
|
6872
|
-
const { address: account } =
|
|
6902
|
+
const { address: account } = useBeraWallet25();
|
|
6873
6903
|
const publicClient = usePublicClient49();
|
|
6874
6904
|
const QUERY_KEY = publicClient && account ? ["useUserActiveValidators", account] : null;
|
|
6875
|
-
const swrResponse =
|
|
6905
|
+
const swrResponse = useSWR62(
|
|
6876
6906
|
QUERY_KEY,
|
|
6877
6907
|
async ([, account2]) => {
|
|
6878
6908
|
return await getUserActiveValidators({
|
|
@@ -6893,17 +6923,17 @@ var useUserActiveValidators = (options) => {
|
|
|
6893
6923
|
};
|
|
6894
6924
|
|
|
6895
6925
|
// src/hooks/validators/useUserBoostsOnValidator.ts
|
|
6896
|
-
import
|
|
6897
|
-
import { useBeraWallet as
|
|
6926
|
+
import useSWR63 from "swr";
|
|
6927
|
+
import { useBeraWallet as useBeraWallet26, usePublicClient as usePublicClient50 } from "@berachain/wagmi/hooks";
|
|
6898
6928
|
var useUserBoostsOnValidator = ({
|
|
6899
6929
|
pubkey,
|
|
6900
6930
|
...args
|
|
6901
6931
|
}) => {
|
|
6902
|
-
const { address: connectedAccount } =
|
|
6932
|
+
const { address: connectedAccount } = useBeraWallet26();
|
|
6903
6933
|
const publicClient = usePublicClient50();
|
|
6904
6934
|
const account = args.account ?? connectedAccount;
|
|
6905
6935
|
const QUERY_KEY = account && pubkey ? ["useUserBoostsOnValidator", pubkey, account] : null;
|
|
6906
|
-
const swrResponse =
|
|
6936
|
+
const swrResponse = useSWR63(
|
|
6907
6937
|
QUERY_KEY,
|
|
6908
6938
|
async ([, pubkey2, account2]) => {
|
|
6909
6939
|
return await getUserBoostsOnValidator({
|
|
@@ -6921,8 +6951,8 @@ var useUserBoostsOnValidator = ({
|
|
|
6921
6951
|
|
|
6922
6952
|
// src/hooks/validators/useUserClaimableIncentives.ts
|
|
6923
6953
|
import { useCallback as useCallback4, useMemo as useMemo14 } from "react";
|
|
6924
|
-
import
|
|
6925
|
-
import { useBeraWallet as
|
|
6954
|
+
import useSWR64 from "swr";
|
|
6955
|
+
import { useBeraWallet as useBeraWallet27 } from "@berachain/wagmi/hooks";
|
|
6926
6956
|
|
|
6927
6957
|
// src/utils/formatIncentivesTokenMap.ts
|
|
6928
6958
|
var formatIncentivesTokenMap = (allRewards) => {
|
|
@@ -6941,9 +6971,9 @@ var formatIncentivesTokenMap = (allRewards) => {
|
|
|
6941
6971
|
|
|
6942
6972
|
// src/hooks/validators/useUserClaimableIncentives.ts
|
|
6943
6973
|
var useUserClaimableIncentives = () => {
|
|
6944
|
-
const { address: account } =
|
|
6974
|
+
const { address: account } = useBeraWallet27();
|
|
6945
6975
|
const REWARDS_QUERY_KEY = account ? ["useUserClaimableIncentives", account] : null;
|
|
6946
|
-
const allRewardsResponse =
|
|
6976
|
+
const allRewardsResponse = useSWR64(
|
|
6947
6977
|
REWARDS_QUERY_KEY,
|
|
6948
6978
|
async ([, account2]) => {
|
|
6949
6979
|
if (!account2) {
|
|
@@ -6984,7 +7014,7 @@ var useUserClaimableIncentives = () => {
|
|
|
6984
7014
|
return formatIncentivesTokenMap(allRewards);
|
|
6985
7015
|
}, [allRewards, account]);
|
|
6986
7016
|
const QUERY_KEY = account && allRewards ? ["useUserClaimableIncentives", account, allRewards] : null;
|
|
6987
|
-
const swrResponse =
|
|
7017
|
+
const swrResponse = useSWR64(
|
|
6988
7018
|
QUERY_KEY,
|
|
6989
7019
|
async ([, account2, allRewards2]) => {
|
|
6990
7020
|
if (!account2) {
|
|
@@ -7092,12 +7122,10 @@ function useValidator({ pubkey }, options) {
|
|
|
7092
7122
|
dynamicData: {
|
|
7093
7123
|
activeBoostAmount: onChainValidator?.dynamicData?.activeBoostAmount ?? indexerValidator?.dynamicData?.activeBoostAmount ?? "",
|
|
7094
7124
|
queuedBoostAmount: indexerValidator?.dynamicData?.queuedBoostAmount ?? "",
|
|
7095
|
-
|
|
7096
|
-
usersQueuedBoostCount: indexerValidator?.dynamicData?.usersQueuedBoostCount ?? 0,
|
|
7097
|
-
allTimeDistributedBGTAmount: indexerValidator?.dynamicData?.allTimeDistributedBGTAmount ?? "0",
|
|
7125
|
+
allTimeDistributedRewards: indexerValidator?.dynamicData?.allTimeDistributedRewards ?? "0",
|
|
7098
7126
|
rewardRate: onChainValidator?.dynamicData?.rewardRate ?? indexerValidator?.dynamicData?.rewardRate ?? "",
|
|
7099
7127
|
stakedBeraAmount: indexerValidator?.dynamicData?.stakedBeraAmount ?? "",
|
|
7100
|
-
|
|
7128
|
+
lastDayDistributedRewards: indexerValidator?.dynamicData?.lastDayDistributedRewards ?? "",
|
|
7101
7129
|
lastDayProposedBlockCount: indexerValidator?.dynamicData?.lastDayProposedBlockCount ?? 0,
|
|
7102
7130
|
activeBoostAmountRank: indexerValidator?.dynamicData?.activeBoostAmountRank ?? 0,
|
|
7103
7131
|
boostApr: indexerValidator?.dynamicData?.boostApr ?? // todo: remove 'as' once BE has migrated types
|
|
@@ -7116,13 +7144,13 @@ function useValidator({ pubkey }, options) {
|
|
|
7116
7144
|
}
|
|
7117
7145
|
|
|
7118
7146
|
// src/hooks/validators/useValidatorAnalytics.ts
|
|
7119
|
-
import
|
|
7147
|
+
import useSWR65 from "swr";
|
|
7120
7148
|
function useValidatorAnalytics({
|
|
7121
7149
|
pubkey,
|
|
7122
7150
|
dayRange
|
|
7123
7151
|
}) {
|
|
7124
7152
|
const QUERY_KEY = pubkey && dayRange ? ["useValidatorAnalytics", pubkey, dayRange] : null;
|
|
7125
|
-
const swrResponse =
|
|
7153
|
+
const swrResponse = useSWR65(
|
|
7126
7154
|
QUERY_KEY,
|
|
7127
7155
|
async ([, pubkey2, dayRange2]) => {
|
|
7128
7156
|
return await getValidatorAnalytics({
|
|
@@ -7138,12 +7166,12 @@ function useValidatorAnalytics({
|
|
|
7138
7166
|
}
|
|
7139
7167
|
|
|
7140
7168
|
// src/hooks/validators/useValidatorCommission.ts
|
|
7141
|
-
import
|
|
7169
|
+
import useSWR66 from "swr";
|
|
7142
7170
|
import { usePublicClient as usePublicClient51 } from "@berachain/wagmi/hooks";
|
|
7143
7171
|
var useValidatorCommission = (pubKey, options) => {
|
|
7144
7172
|
const publicClient = usePublicClient51();
|
|
7145
7173
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorCommission", pubKey] : null;
|
|
7146
|
-
const swrResponse =
|
|
7174
|
+
const swrResponse = useSWR66(
|
|
7147
7175
|
QUERY_KEY,
|
|
7148
7176
|
async ([, pubKey2]) => {
|
|
7149
7177
|
return await getValidatorCommission({
|
|
@@ -7176,7 +7204,7 @@ var useValidatorEstimatedBgtPerYear = (validator) => {
|
|
|
7176
7204
|
};
|
|
7177
7205
|
|
|
7178
7206
|
// src/hooks/validators/useValidatorIncentiveDistribution.ts
|
|
7179
|
-
import
|
|
7207
|
+
import useSWR67 from "swr";
|
|
7180
7208
|
|
|
7181
7209
|
// src/actions/validators/getValidatorIncentiveDistribution.ts
|
|
7182
7210
|
async function getValidatorIncentiveDistribution({
|
|
@@ -7206,7 +7234,7 @@ function useValidatorIncentiveDistribution({
|
|
|
7206
7234
|
dayRange
|
|
7207
7235
|
}) {
|
|
7208
7236
|
const QUERY_KEY = pubkey && dayRange ? ["useValidatorIncentiveDistribution", pubkey, dayRange] : null;
|
|
7209
|
-
const swrResponse =
|
|
7237
|
+
const swrResponse = useSWR67(
|
|
7210
7238
|
QUERY_KEY,
|
|
7211
7239
|
async ([, pubkey2, dayRange2]) => {
|
|
7212
7240
|
return await getValidatorIncentiveDistribution({ pubkey: pubkey2, dayRange: dayRange2 });
|
|
@@ -7219,12 +7247,12 @@ function useValidatorIncentiveDistribution({
|
|
|
7219
7247
|
}
|
|
7220
7248
|
|
|
7221
7249
|
// src/hooks/validators/useValidatorQueuedCommission.ts
|
|
7222
|
-
import
|
|
7250
|
+
import useSWR68 from "swr";
|
|
7223
7251
|
import { usePublicClient as usePublicClient52 } from "@berachain/wagmi/hooks";
|
|
7224
7252
|
function useValidatorQueuedCommission(pubKey, options) {
|
|
7225
7253
|
const publicClient = usePublicClient52();
|
|
7226
7254
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedCommission", pubKey] : null;
|
|
7227
|
-
const swrResponse =
|
|
7255
|
+
const swrResponse = useSWR68(
|
|
7228
7256
|
QUERY_KEY,
|
|
7229
7257
|
async ([, pubKey2]) => {
|
|
7230
7258
|
assertPublicClient(publicClient);
|
|
@@ -7244,12 +7272,12 @@ function useValidatorQueuedCommission(pubKey, options) {
|
|
|
7244
7272
|
}
|
|
7245
7273
|
|
|
7246
7274
|
// src/hooks/validators/useValidatorQueuedOperatorAddress.ts
|
|
7247
|
-
import
|
|
7275
|
+
import useSWR69 from "swr";
|
|
7248
7276
|
import { usePublicClient as usePublicClient53 } from "@berachain/wagmi/hooks";
|
|
7249
7277
|
var useValidatorQueuedOperatorAddress = (pubKey, options) => {
|
|
7250
7278
|
const publicClient = usePublicClient53();
|
|
7251
7279
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedOperatorAddress", pubKey] : null;
|
|
7252
|
-
const swrResponse =
|
|
7280
|
+
const swrResponse = useSWR69(
|
|
7253
7281
|
QUERY_KEY,
|
|
7254
7282
|
async ([, pubKey2]) => {
|
|
7255
7283
|
return await getValidatorQueuedOperatorAddress({
|
|
@@ -7268,12 +7296,12 @@ var useValidatorQueuedOperatorAddress = (pubKey, options) => {
|
|
|
7268
7296
|
};
|
|
7269
7297
|
|
|
7270
7298
|
// src/hooks/validators/useValidatorQueuedRewardAllocation.ts
|
|
7271
|
-
import
|
|
7299
|
+
import useSWR70 from "swr";
|
|
7272
7300
|
import { usePublicClient as usePublicClient54 } from "@berachain/wagmi/hooks";
|
|
7273
7301
|
var useValidatorQueuedRewardAllocation = (pubKey, options) => {
|
|
7274
7302
|
const publicClient = usePublicClient54();
|
|
7275
7303
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorQueuedRewardAllocation", pubKey] : null;
|
|
7276
|
-
const swrResponse =
|
|
7304
|
+
const swrResponse = useSWR70(
|
|
7277
7305
|
QUERY_KEY,
|
|
7278
7306
|
async ([, pubKey2]) => {
|
|
7279
7307
|
return await getValidatorQueuedRewardAllocation({
|
|
@@ -7292,12 +7320,12 @@ var useValidatorQueuedRewardAllocation = (pubKey, options) => {
|
|
|
7292
7320
|
};
|
|
7293
7321
|
|
|
7294
7322
|
// src/hooks/validators/useValidatorRewardAllocation.ts
|
|
7295
|
-
import
|
|
7323
|
+
import useSWR71 from "swr";
|
|
7296
7324
|
import { usePublicClient as usePublicClient55 } from "@berachain/wagmi/hooks";
|
|
7297
7325
|
function useValidatorRewardAllocation(pubKey, options) {
|
|
7298
7326
|
const publicClient = usePublicClient55();
|
|
7299
7327
|
const QUERY_KEY = publicClient && pubKey ? ["useValidatorRewardAllocation", pubKey] : null;
|
|
7300
|
-
const swrResponse =
|
|
7328
|
+
const swrResponse = useSWR71(
|
|
7301
7329
|
QUERY_KEY,
|
|
7302
7330
|
async ([, pubKey2]) => {
|
|
7303
7331
|
return getValidatorRewardAllocation({
|
|
@@ -7330,6 +7358,7 @@ export {
|
|
|
7330
7358
|
useApiValidator,
|
|
7331
7359
|
useApiValidatorQueryKey,
|
|
7332
7360
|
useAutoclaimedIncentives,
|
|
7361
|
+
useAutoclaimedIncentivesTxHash,
|
|
7333
7362
|
useBaselineRewardAllocation,
|
|
7334
7363
|
useBendDemultiply,
|
|
7335
7364
|
useBendMultiply,
|