@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
|
@@ -1,2 +1,78 @@
|
|
|
1
|
-
|
|
1
|
+
import { paths } from '@berachain/graphql/beep';
|
|
2
|
+
import { HttpLink } from '@berachain/config';
|
|
3
|
+
import { paths as paths$1 } from '@berachain/graphql/api';
|
|
4
|
+
export { g as getApolloClient } from '../../getApolloClient-BcUTGFUb.js';
|
|
2
5
|
export { gql } from '@apollo/client';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A minimal, fully-typed GET helper for our `openapi-typescript`-generated
|
|
9
|
+
* backends. Both backends serve only GETs, so rather than a full OpenAPI client
|
|
10
|
+
* we type a single `fetchOpenApi` against a schema's `paths` and wrap it per
|
|
11
|
+
* backend (`fetchBeep`, `fetchRailwayBackend`).
|
|
12
|
+
*
|
|
13
|
+
* The `path`, its path/query params and the response body are all type-checked
|
|
14
|
+
* against the schema, so route shapes can never drift out of sync with the
|
|
15
|
+
* backend. Requests go through {@link beraFetchJson} so they keep the same
|
|
16
|
+
* Sentry tracing, `RequestError` handling and URL sanitization as the rest of
|
|
17
|
+
* the codebase.
|
|
18
|
+
*/
|
|
19
|
+
/** Any `openapi-typescript` `paths` object. */
|
|
20
|
+
type AnyPaths = Record<string, any>;
|
|
21
|
+
/** Paths in a schema that expose a JSON GET response. */
|
|
22
|
+
type GetPath<Paths extends AnyPaths> = {
|
|
23
|
+
[P in keyof Paths]: Paths[P] extends {
|
|
24
|
+
get: {
|
|
25
|
+
responses: {
|
|
26
|
+
200: {
|
|
27
|
+
content: {
|
|
28
|
+
"application/json": unknown;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
} ? P : never;
|
|
34
|
+
}[keyof Paths];
|
|
35
|
+
type GetParams<Paths extends AnyPaths, P extends GetPath<Paths>> = Paths[P]["get"] extends {
|
|
36
|
+
parameters: infer Params;
|
|
37
|
+
} ? Params : never;
|
|
38
|
+
type GetResponse<Paths extends AnyPaths, P extends GetPath<Paths>> = Paths[P]["get"]["responses"][200]["content"]["application/json"];
|
|
39
|
+
type DefinedParams<Paths extends AnyPaths, P extends GetPath<Paths>> = {
|
|
40
|
+
[K in keyof GetParams<Paths, P> as GetParams<Paths, P>[K] extends never ? never : K]: GetParams<Paths, P>[K];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Perform a typed GET against an OpenAPI backend.
|
|
44
|
+
*
|
|
45
|
+
* @param link The backend `HttpLink`. The base URL and monitoring name are
|
|
46
|
+
* read from it.
|
|
47
|
+
* @param path An OpenAPI path template, e.g. `/v0/stake/{vault}/stats-by-day`.
|
|
48
|
+
* @param params Path and query params, typed from the schema for `path`.
|
|
49
|
+
* @param fallbackName Monitoring name to use when `link` is a bare string.
|
|
50
|
+
*/
|
|
51
|
+
declare function fetchOpenApi<Paths extends AnyPaths, P extends GetPath<Paths>>(link: HttpLink, path: P, params: DefinedParams<Paths, P>, fallbackName: string): Promise<GetResponse<Paths, P>>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Typed GET against the next-gen "beep" backend.
|
|
55
|
+
*
|
|
56
|
+
* The `path`, its path/query params and the response are all type-checked
|
|
57
|
+
* against the beep schema (`@berachain/graphql/beep`), so route shapes (e.g.
|
|
58
|
+
* the `/v0/stake/*` namespace) can never drift out of sync with the backend.
|
|
59
|
+
* The base URL is resolved from `config.beep`.
|
|
60
|
+
*
|
|
61
|
+
* @throws if `config.beep` is not set for the active chain. Callers should only
|
|
62
|
+
* reach for beep when `config.beep` is non-null.
|
|
63
|
+
*/
|
|
64
|
+
declare function fetchBeep<P extends GetPath<paths>>(path: P, params: DefinedParams<paths, P>, args?: BeraJS.BaseFunctionArgs): Promise<GetResponse<paths, P>>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Typed GET against the legacy Railway backend.
|
|
68
|
+
*
|
|
69
|
+
* The `path`, its path/query params and the response are all type-checked
|
|
70
|
+
* against the Railway schema (`@berachain/graphql/api`). The base URL is
|
|
71
|
+
* resolved from `config.backend`.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated The Railway backend is being replaced by beep; prefer
|
|
74
|
+
* {@link fetchBeep} where `config.beep` is available.
|
|
75
|
+
*/
|
|
76
|
+
declare function fetchRailwayBackend<P extends GetPath<paths$1>>(path: P, params: DefinedParams<paths$1, P>, args?: BeraJS.BaseFunctionArgs): Promise<GetResponse<paths$1, P>>;
|
|
77
|
+
|
|
78
|
+
export { fetchBeep, fetchOpenApi, fetchRailwayBackend };
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchBeep,
|
|
3
|
+
fetchOpenApi,
|
|
4
|
+
fetchRailwayBackend
|
|
5
|
+
} from "../../chunk-P5WXXULM.mjs";
|
|
1
6
|
import {
|
|
2
7
|
getApolloClient,
|
|
3
8
|
gql
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
9
|
+
} from "../../chunk-3JJLQ2JX.mjs";
|
|
10
|
+
import "../../chunk-Y6THHG77.mjs";
|
|
11
|
+
import "../../chunk-DQRH5VE3.mjs";
|
|
6
12
|
import "../../chunk-SZ5C44L5.mjs";
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-ZLTMIFCZ.mjs";
|
|
14
|
+
import "../../chunk-KHXJDYA4.mjs";
|
|
9
15
|
export {
|
|
16
|
+
fetchBeep,
|
|
17
|
+
fetchOpenApi,
|
|
18
|
+
fetchRailwayBackend,
|
|
10
19
|
getApolloClient,
|
|
11
20
|
gql
|
|
12
21
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
2
|
-
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
1
|
+
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-DphU3qhE.js';
|
|
2
|
+
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-DphU3qhE.js';
|
|
3
3
|
import { Address, PublicClient, Abi, ContractFunctionArgs, ContractFunctionName, TransactionReceipt, WalletCallReceipt } from 'viem';
|
|
4
|
-
export { B as BeraApolloClient, g as getApolloClient } from '../
|
|
4
|
+
export { B as BeraApolloClient, g as getApolloClient } from '../getApolloClient-BcUTGFUb.js';
|
|
5
5
|
import { EnsoClient } from '@ensofinance/sdk';
|
|
6
6
|
import { PoolState } from '@berachain-foundation/berancer-sdk';
|
|
7
7
|
export { BalancerApi } from '@berachain-foundation/berancer-sdk';
|
|
@@ -18,8 +18,8 @@ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
|
|
|
18
18
|
import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
|
|
19
19
|
import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
|
|
20
20
|
import { I as IHoneySwapState } from '../useHoneySwapState-vFmuFF0g.js';
|
|
21
|
-
import { A as AutoclaimedIncentivesResponse, S as StakingConfig, B as BribeBoostRewardProof,
|
|
22
|
-
import
|
|
21
|
+
import { A as AutoclaimedIncentivesResponse, a as AutoclaimedIncentivesTxHashResponse, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo } from '../pol.d-Dw5SQcRX.js';
|
|
22
|
+
import * as _berachain_graphql_beep from '@berachain/graphql/beep';
|
|
23
23
|
import { Address as Address$1, ChainId } from '@berachain/config';
|
|
24
24
|
import { Config } from '@wagmi/core';
|
|
25
25
|
import { I as IContractWrite } from '../global.d-BuGDKh4k.js';
|
|
@@ -98,8 +98,7 @@ declare function getAllPools({ textSearch, chain, first, orderBy, orderDirection
|
|
|
98
98
|
__typename?: "GqlRewardVaultDynamicData";
|
|
99
99
|
activeIncentivesValueUsd: string;
|
|
100
100
|
apr?: number | null;
|
|
101
|
-
|
|
102
|
-
allTimeReceivedBGTAmount: string;
|
|
101
|
+
rewardCapturePercentage: number;
|
|
103
102
|
} | null;
|
|
104
103
|
} | null;
|
|
105
104
|
}[];
|
|
@@ -154,8 +153,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
154
153
|
__typename?: "GqlRewardVaultDynamicData";
|
|
155
154
|
activeIncentivesValueUsd: string;
|
|
156
155
|
apr?: number | null;
|
|
157
|
-
|
|
158
|
-
allTimeReceivedBGTAmount: string;
|
|
156
|
+
rewardCapturePercentage: number;
|
|
159
157
|
} | null;
|
|
160
158
|
} | null;
|
|
161
159
|
} | {
|
|
@@ -203,8 +201,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
203
201
|
__typename?: "GqlRewardVaultDynamicData";
|
|
204
202
|
activeIncentivesValueUsd: string;
|
|
205
203
|
apr?: number | null;
|
|
206
|
-
|
|
207
|
-
allTimeReceivedBGTAmount: string;
|
|
204
|
+
rewardCapturePercentage: number;
|
|
208
205
|
} | null;
|
|
209
206
|
} | null;
|
|
210
207
|
} | {
|
|
@@ -252,8 +249,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
252
249
|
__typename?: "GqlRewardVaultDynamicData";
|
|
253
250
|
activeIncentivesValueUsd: string;
|
|
254
251
|
apr?: number | null;
|
|
255
|
-
|
|
256
|
-
allTimeReceivedBGTAmount: string;
|
|
252
|
+
rewardCapturePercentage: number;
|
|
257
253
|
} | null;
|
|
258
254
|
} | null;
|
|
259
255
|
} | {
|
|
@@ -301,8 +297,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
301
297
|
__typename?: "GqlRewardVaultDynamicData";
|
|
302
298
|
activeIncentivesValueUsd: string;
|
|
303
299
|
apr?: number | null;
|
|
304
|
-
|
|
305
|
-
allTimeReceivedBGTAmount: string;
|
|
300
|
+
rewardCapturePercentage: number;
|
|
306
301
|
} | null;
|
|
307
302
|
} | null;
|
|
308
303
|
} | {
|
|
@@ -350,8 +345,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
350
345
|
__typename?: "GqlRewardVaultDynamicData";
|
|
351
346
|
activeIncentivesValueUsd: string;
|
|
352
347
|
apr?: number | null;
|
|
353
|
-
|
|
354
|
-
allTimeReceivedBGTAmount: string;
|
|
348
|
+
rewardCapturePercentage: number;
|
|
355
349
|
} | null;
|
|
356
350
|
} | null;
|
|
357
351
|
} | {
|
|
@@ -399,8 +393,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
399
393
|
__typename?: "GqlRewardVaultDynamicData";
|
|
400
394
|
activeIncentivesValueUsd: string;
|
|
401
395
|
apr?: number | null;
|
|
402
|
-
|
|
403
|
-
allTimeReceivedBGTAmount: string;
|
|
396
|
+
rewardCapturePercentage: number;
|
|
404
397
|
} | null;
|
|
405
398
|
} | null;
|
|
406
399
|
} | {
|
|
@@ -448,8 +441,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
448
441
|
__typename?: "GqlRewardVaultDynamicData";
|
|
449
442
|
activeIncentivesValueUsd: string;
|
|
450
443
|
apr?: number | null;
|
|
451
|
-
|
|
452
|
-
allTimeReceivedBGTAmount: string;
|
|
444
|
+
rewardCapturePercentage: number;
|
|
453
445
|
} | null;
|
|
454
446
|
} | null;
|
|
455
447
|
} | {
|
|
@@ -497,8 +489,7 @@ declare function getApiPool({ poolId, account, ...args }: {
|
|
|
497
489
|
__typename?: "GqlRewardVaultDynamicData";
|
|
498
490
|
activeIncentivesValueUsd: string;
|
|
499
491
|
apr?: number | null;
|
|
500
|
-
|
|
501
|
-
allTimeReceivedBGTAmount: string;
|
|
492
|
+
rewardCapturePercentage: number;
|
|
502
493
|
} | null;
|
|
503
494
|
} | null;
|
|
504
495
|
}>;
|
|
@@ -692,11 +683,26 @@ declare function getBlockTimestamp({ block, currentBlock, blockTime, publicClien
|
|
|
692
683
|
* Server-side function to fetch the incentives the bot autoclaimed on behalf
|
|
693
684
|
* of a wallet during the BGT → BERA cutover. Only valid to call once the
|
|
694
685
|
* bgtIncentiveDistributor contract is paused.
|
|
686
|
+
*
|
|
687
|
+
* Returns `null` on 404 — the endpoint 404s when the bot has not yet processed
|
|
688
|
+
* the wallet, which is a normal "no data yet" state rather than an error.
|
|
695
689
|
*/
|
|
696
690
|
declare function getAutoclaimedIncentives({ account, ...args }: {
|
|
697
691
|
account: Address;
|
|
698
692
|
} & BeraJS.BaseFunctionArgs): Promise<AutoclaimedIncentivesResponse | null>;
|
|
699
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Companion to `getAutoclaimedIncentives` that fetches the on-chain tx hash
|
|
696
|
+
* for each autoclaimed token. Same nested shape as `/autoclaimed`, but each
|
|
697
|
+
* token leaf is `{ txhash }` where the hash may be absent or empty while the
|
|
698
|
+
* bot is still in flight.
|
|
699
|
+
*
|
|
700
|
+
* Returns `null` on 404 (bot has not run yet for this wallet).
|
|
701
|
+
*/
|
|
702
|
+
declare function getAutoclaimedIncentivesTxHash({ account, ...args }: {
|
|
703
|
+
account: Address;
|
|
704
|
+
} & BeraJS.BaseFunctionArgs): Promise<AutoclaimedIncentivesTxHashResponse | null>;
|
|
705
|
+
|
|
700
706
|
type GetBeraTokenTotalSupplyArgs = BeraJS.BaseFunctionArgs;
|
|
701
707
|
/**
|
|
702
708
|
* Fetches the native BERA total supply (in whole BERA units) from the
|
|
@@ -708,8 +714,6 @@ declare function getBeraTokenTotalSupply(args?: GetBeraTokenTotalSupplyArgs): Pr
|
|
|
708
714
|
* Reads `paused()` on the BGT incentive distributor. Used to gate the
|
|
709
715
|
* autoclaim banner — when `true`, users can no longer self-claim and the
|
|
710
716
|
* bot is responsible for distributing incentives on their behalf.
|
|
711
|
-
*
|
|
712
|
-
* Fails closed: any read error returns `false` so the banner stays hidden.
|
|
713
717
|
*/
|
|
714
718
|
declare function getBgtIncentiveDistributorPaused({ publicClient, ...args }: {
|
|
715
719
|
publicClient: PublicClient | undefined;
|
|
@@ -731,7 +735,35 @@ type GetEarnedStakedBeraVaultArgs = {
|
|
|
731
735
|
*/
|
|
732
736
|
account: Address;
|
|
733
737
|
};
|
|
734
|
-
declare function getEarnedStakedBeraVault({ address, account, ...args }: BeraJS.BaseFunctionArgs & GetEarnedStakedBeraVaultArgs): Promise<
|
|
738
|
+
declare function getEarnedStakedBeraVault({ address, account, ...args }: BeraJS.BaseFunctionArgs & GetEarnedStakedBeraVaultArgs): Promise<{
|
|
739
|
+
currentDepositRate: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
740
|
+
earningsTotal: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
741
|
+
earningsRealized: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
742
|
+
earningsUnrealized: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
743
|
+
shareLots: {
|
|
744
|
+
shares: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
745
|
+
depositRate: _berachain_graphql_beep.components["schemas"]["DecimalStr"];
|
|
746
|
+
}[];
|
|
747
|
+
sortedEvents: ({
|
|
748
|
+
_height: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
749
|
+
_log_index: number;
|
|
750
|
+
assets: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
751
|
+
shares: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
752
|
+
_type: "deposit" | "withdrawal";
|
|
753
|
+
sender: string;
|
|
754
|
+
owner: string;
|
|
755
|
+
total_assets: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
756
|
+
} | {
|
|
757
|
+
_height: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
758
|
+
_log_index: number;
|
|
759
|
+
assets: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
760
|
+
shares: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
761
|
+
_type: "transfer";
|
|
762
|
+
from: string;
|
|
763
|
+
to: string;
|
|
764
|
+
value: _berachain_graphql_beep.components["schemas"]["BigIntStr"];
|
|
765
|
+
})[];
|
|
766
|
+
}>;
|
|
735
767
|
|
|
736
768
|
interface HeroEarnVaults {
|
|
737
769
|
/**
|
|
@@ -1562,4 +1594,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
|
|
|
1562
1594
|
bgtPrice: number;
|
|
1563
1595
|
}): number;
|
|
1564
1596
|
|
|
1565
|
-
export { type ActiveBoostAndCommissionChangeDelay, type GetAllowances, type GetAllowancesResponse, type GetBeraTokenTotalSupplyArgs, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, type HeroEarnVaults, type IncentiveFeeClaimStats, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getAutoclaimedIncentives, getBalanceCall, getBeraTokenTotalSupply, getBgtIncentiveDistributorPaused, getBlockTime, getBlockTimestamp, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHeroEarnVaults, getHoney24hVolume, getHoneyCollaterals, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount };
|
|
1597
|
+
export { type ActiveBoostAndCommissionChangeDelay, type GetAllowances, type GetAllowancesResponse, type GetBeraTokenTotalSupplyArgs, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, type HeroEarnVaults, type IncentiveFeeClaimStats, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getAutoclaimedIncentives, getAutoclaimedIncentivesTxHash, getBalanceCall, getBeraTokenTotalSupply, getBgtIncentiveDistributorPaused, getBlockTime, getBlockTimestamp, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHeroEarnVaults, getHoney24hVolume, getHoneyCollaterals, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount };
|
package/dist/actions/exports.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getApiPool,
|
|
13
13
|
getApiValidator,
|
|
14
14
|
getAutoclaimedIncentives,
|
|
15
|
+
getAutoclaimedIncentivesTxHash,
|
|
15
16
|
getBgtAprSimulation,
|
|
16
17
|
getBlockTimestamp,
|
|
17
18
|
getChartData,
|
|
@@ -75,41 +76,44 @@ import {
|
|
|
75
76
|
isDefaultRewardAllocation,
|
|
76
77
|
isImpersonateAccount,
|
|
77
78
|
isSameRewardAllocation
|
|
78
|
-
} from "../chunk-
|
|
79
|
+
} from "../chunk-QBBOWFMH.mjs";
|
|
80
|
+
import "../chunk-P5WXXULM.mjs";
|
|
79
81
|
import {
|
|
80
82
|
BeraApolloClient,
|
|
81
83
|
getApolloClient,
|
|
82
84
|
gql
|
|
83
|
-
} from "../chunk-
|
|
85
|
+
} from "../chunk-3JJLQ2JX.mjs";
|
|
84
86
|
import "../chunk-CDK4YV3D.mjs";
|
|
85
87
|
import {
|
|
86
88
|
getBalanceCall,
|
|
87
89
|
getEnsoClient,
|
|
88
90
|
getWalletBalances
|
|
89
|
-
} from "../chunk-
|
|
91
|
+
} from "../chunk-HYDP32P6.mjs";
|
|
90
92
|
import "../chunk-HQCOU6GY.mjs";
|
|
91
|
-
import "../chunk-
|
|
92
|
-
import "../chunk-
|
|
93
|
+
import "../chunk-AUOPN6NK.mjs";
|
|
94
|
+
import "../chunk-7YVNSDXG.mjs";
|
|
93
95
|
import {
|
|
94
96
|
assertAddress,
|
|
95
97
|
assertDefined,
|
|
96
98
|
assertPublicClient
|
|
97
|
-
} from "../chunk-
|
|
99
|
+
} from "../chunk-GY6B3PD5.mjs";
|
|
98
100
|
import {
|
|
99
|
-
beraFetchJson,
|
|
100
101
|
bignumber_js_default,
|
|
101
102
|
hoursInSeconds,
|
|
102
103
|
msToSeconds
|
|
103
|
-
} from "../chunk-
|
|
104
|
+
} from "../chunk-E7YFXBBQ.mjs";
|
|
105
|
+
import {
|
|
106
|
+
beraFetchJson
|
|
107
|
+
} from "../chunk-Y6THHG77.mjs";
|
|
104
108
|
import {
|
|
105
109
|
isToken
|
|
106
|
-
} from "../chunk-
|
|
110
|
+
} from "../chunk-IXIBY5FP.mjs";
|
|
107
111
|
import {
|
|
108
112
|
parseBaseArgs
|
|
109
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-DQRH5VE3.mjs";
|
|
110
114
|
import "../chunk-SZ5C44L5.mjs";
|
|
111
|
-
import "../chunk-
|
|
112
|
-
import "../chunk-
|
|
115
|
+
import "../chunk-ZLTMIFCZ.mjs";
|
|
116
|
+
import "../chunk-KHXJDYA4.mjs";
|
|
113
117
|
|
|
114
118
|
// src/actions/bend/getMaxDeposit.ts
|
|
115
119
|
import { formatEther } from "viem";
|
|
@@ -295,16 +299,11 @@ async function getBgtIncentiveDistributorPaused({
|
|
|
295
299
|
}) {
|
|
296
300
|
assertPublicClient(publicClient);
|
|
297
301
|
const { config } = parseBaseArgs(args);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
304
|
-
return paused;
|
|
305
|
-
} catch {
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
302
|
+
return publicClient.readContract({
|
|
303
|
+
address: config.pol.bgtIncentiveDistributor,
|
|
304
|
+
abi: bgtIncentiveDistributorAbi,
|
|
305
|
+
functionName: "paused"
|
|
306
|
+
});
|
|
308
307
|
}
|
|
309
308
|
|
|
310
309
|
// src/actions/pol/getBlockTime.ts
|
|
@@ -744,7 +743,7 @@ function getValidatorBoostApy({
|
|
|
744
743
|
if (!returnPerBgt || !validatorActiveBoostAmount) {
|
|
745
744
|
return 0;
|
|
746
745
|
}
|
|
747
|
-
const boostApy = returnPerBgt * Number(validator.dynamicData?.
|
|
746
|
+
const boostApy = returnPerBgt * Number(validator.dynamicData?.lastDayDistributedRewards ?? 0) * 365 / (validatorActiveBoostAmount * bgtPrice);
|
|
748
747
|
return boostApy;
|
|
749
748
|
}
|
|
750
749
|
export {
|
|
@@ -765,6 +764,7 @@ export {
|
|
|
765
764
|
getApiValidator,
|
|
766
765
|
getApolloClient,
|
|
767
766
|
getAutoclaimedIncentives,
|
|
767
|
+
getAutoclaimedIncentivesTxHash,
|
|
768
768
|
getBalanceCall,
|
|
769
769
|
getBeraTokenTotalSupply,
|
|
770
770
|
getBgtAprSimulation,
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
getProposalFromTx,
|
|
7
7
|
getProposalVotes,
|
|
8
8
|
parseProposalBody
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-GUURQAME.mjs";
|
|
10
10
|
import "../../chunk-DKMAIU74.mjs";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-GY6B3PD5.mjs";
|
|
12
|
+
import "../../chunk-KHXJDYA4.mjs";
|
|
13
13
|
|
|
14
14
|
// src/actions/governance/computeActualStatus.ts
|
|
15
15
|
import {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getApolloClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-3JJLQ2JX.mjs";
|
|
4
|
+
import "../../chunk-DQRH5VE3.mjs";
|
|
5
5
|
import "../../chunk-SZ5C44L5.mjs";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-ZLTMIFCZ.mjs";
|
|
7
|
+
import "../../chunk-KHXJDYA4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/actions/server/getDailyValidatorBlockStats.ts
|
|
10
10
|
import {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseBaseArgs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BeraTracing
|
|
6
6
|
} from "./chunk-SZ5C44L5.mjs";
|
|
7
7
|
import {
|
|
8
8
|
RequestError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZLTMIFCZ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
BeraError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
13
13
|
|
|
14
14
|
// src/actions/clients/BeraApolloClient.ts
|
|
15
15
|
import {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RequestError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZLTMIFCZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BeraError,
|
|
6
6
|
parseViemError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/errors/initBeraError.ts
|
|
10
10
|
import { BaseError } from "viem";
|
|
@@ -1,123 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BeraTracing
|
|
3
|
-
} from "./chunk-SZ5C44L5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
RequestError
|
|
6
|
-
} from "./chunk-XIYN6AL6.mjs";
|
|
7
|
-
|
|
8
|
-
// src/utils/getErrorResponse.ts
|
|
9
|
-
async function getErrorResponse(response) {
|
|
10
|
-
const contentType = response.headers.get("content-type");
|
|
11
|
-
if (contentType?.includes("application/json")) {
|
|
12
|
-
return response.json();
|
|
13
|
-
} else {
|
|
14
|
-
const text = await response.text();
|
|
15
|
-
try {
|
|
16
|
-
return JSON.parse(text);
|
|
17
|
-
} catch {
|
|
18
|
-
return {
|
|
19
|
-
message: "Unknown error, can't decode response into JSON",
|
|
20
|
-
cause: text
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/utils/sanitizeRpcUrl.ts
|
|
27
|
-
function sanitizeRpcUrl(url) {
|
|
28
|
-
if (!url) return "";
|
|
29
|
-
try {
|
|
30
|
-
const parsed = new URL(url);
|
|
31
|
-
if (parsed.hostname.endsWith(".quiknode.pro")) {
|
|
32
|
-
parsed.pathname = "/";
|
|
33
|
-
parsed.search = "";
|
|
34
|
-
return parsed.toString();
|
|
35
|
-
}
|
|
36
|
-
return url;
|
|
37
|
-
} catch {
|
|
38
|
-
return url;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/utils/beraFetch.ts
|
|
43
|
-
async function beraFetch(endpoint, options, spanContext) {
|
|
44
|
-
try {
|
|
45
|
-
let spanUrl = sanitizeRpcUrl(
|
|
46
|
-
typeof endpoint === "string" || endpoint instanceof URL ? endpoint.toString() : endpoint.url.toString()
|
|
47
|
-
).replace(/0x[a-fA-F0-9]{40}/g, ":address");
|
|
48
|
-
if (spanContext?.keepQueryParams !== true && URL.canParse(spanUrl)) {
|
|
49
|
-
const queryParams = new URL(spanUrl).searchParams;
|
|
50
|
-
if (Array.isArray(spanContext?.keepQueryParams)) {
|
|
51
|
-
const searchParams = new URLSearchParams();
|
|
52
|
-
for (const param of spanContext.keepQueryParams) {
|
|
53
|
-
searchParams.set(param, queryParams.get(param) ?? "");
|
|
54
|
-
}
|
|
55
|
-
const newUrl = new URL(spanUrl);
|
|
56
|
-
newUrl.search = searchParams.toString();
|
|
57
|
-
spanUrl = newUrl.toString();
|
|
58
|
-
} else {
|
|
59
|
-
const newUrl = new URL(spanUrl);
|
|
60
|
-
newUrl.search = "";
|
|
61
|
-
spanUrl = newUrl.toString();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const endpointName = typeof endpoint === "string" || endpoint instanceof URL ? void 0 : endpoint.name;
|
|
65
|
-
return await BeraTracing.startSpan(
|
|
66
|
-
{
|
|
67
|
-
op: "beraFetch",
|
|
68
|
-
name: endpointName ? `beraFetch ${endpointName}` : "beraFetch",
|
|
69
|
-
attributes: typeof endpoint === "string" || endpoint instanceof URL ? {
|
|
70
|
-
"operation.source.url": spanUrl,
|
|
71
|
-
...spanContext?.attributes
|
|
72
|
-
} : {
|
|
73
|
-
"operation.source.url": spanUrl,
|
|
74
|
-
"operation.source.type": endpoint.type,
|
|
75
|
-
"operation.source.name": endpoint.name,
|
|
76
|
-
...spanContext?.attributes
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
async () => {
|
|
80
|
-
const response = await fetch(
|
|
81
|
-
typeof endpoint === "string" || endpoint instanceof URL ? endpoint : endpoint.url,
|
|
82
|
-
{
|
|
83
|
-
...options
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
const error = await getErrorResponse(response);
|
|
88
|
-
throw new RequestError({
|
|
89
|
-
cause: error,
|
|
90
|
-
// @to-do import getErrorResponse logic in this function
|
|
91
|
-
// when it's removed from other places
|
|
92
|
-
response,
|
|
93
|
-
endpoint
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if (error instanceof RequestError) {
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
throw new RequestError({
|
|
104
|
-
cause: error,
|
|
105
|
-
endpoint,
|
|
106
|
-
response: void 0
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function beraFetchJson(endpoint, options) {
|
|
111
|
-
const response = await beraFetch(endpoint, {
|
|
112
|
-
...options,
|
|
113
|
-
headers: {
|
|
114
|
-
Accept: "application/json",
|
|
115
|
-
...options?.headers
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return response.json();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
1
|
// src/utils/constants.ts
|
|
122
2
|
import { parseEther } from "viem";
|
|
123
3
|
var CAP_LIMIT_BUFFER = parseEther("0.005");
|
|
@@ -438,10 +318,6 @@ function getTestClient(chainId = defaultChainId) {
|
|
|
438
318
|
|
|
439
319
|
export {
|
|
440
320
|
bignumber_js_default,
|
|
441
|
-
getErrorResponse,
|
|
442
|
-
sanitizeRpcUrl,
|
|
443
|
-
beraFetch,
|
|
444
|
-
beraFetchJson,
|
|
445
321
|
CAP_LIMIT_BUFFER,
|
|
446
322
|
MAX_CUSTOM_DEADLINE,
|
|
447
323
|
MIN_CUSTOM_DEADLINE,
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
assertAddress,
|
|
6
6
|
assertDefined,
|
|
7
7
|
assertPublicClient
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GY6B3PD5.mjs";
|
|
9
9
|
import {
|
|
10
10
|
isToken
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IXIBY5FP.mjs";
|
|
12
12
|
import {
|
|
13
13
|
parseBaseArgs
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
15
15
|
|
|
16
16
|
// src/actions/clients/getEnsoClient.ts
|
|
17
17
|
import { EnsoClient } from "@ensofinance/sdk";
|