@berachain/berajs 0.2.8-beta.8 → 0.2.9

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 (225) hide show
  1. package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.ts} +31 -2
  2. package/dist/{HoneyConfigProvider-DVP_9KZn.d.ts → HoneyConfigProvider-Dkj-_a5x.d.ts} +1 -1
  3. package/dist/RequestError-DBOIV65x.d.ts +144 -0
  4. package/dist/abi/exports.mjs +3 -4
  5. package/dist/actions/clients/exports.d.ts +2 -0
  6. package/dist/actions/clients/exports.mjs +12 -0
  7. package/dist/actions/exports.d.ts +108 -187
  8. package/dist/actions/exports.mjs +97 -158
  9. package/dist/actions/governance/exports.d.ts +140 -0
  10. package/dist/actions/governance/exports.mjs +226 -0
  11. package/dist/actions/server/exports.d.ts +13 -0
  12. package/dist/actions/server/exports.mjs +27 -0
  13. package/dist/{chunk-VA3BQ34H.mjs → chunk-3EARVV7K.mjs} +20 -9
  14. package/dist/chunk-4Z4AK6SH.mjs +211 -0
  15. package/dist/chunk-75M6TF7M.mjs +25 -0
  16. package/dist/chunk-AFN4CVD3.mjs +326 -0
  17. package/dist/{chunk-7TFV6UKF.mjs → chunk-BGMRHTBQ.mjs} +0 -1
  18. package/dist/{chunk-3M47ZRXT.mjs → chunk-CDFWPU2R.mjs} +73 -17
  19. package/dist/{chunk-GWSTVITN.mjs → chunk-CDK4YV3D.mjs} +0 -1
  20. package/dist/{chunk-KL6YZ5VR.mjs → chunk-DKMAIU74.mjs} +0 -1
  21. package/dist/chunk-EXIUPSFN.mjs +86 -0
  22. package/dist/{chunk-VA5L5FDG.mjs → chunk-FFB5LFDW.mjs} +2 -3
  23. package/dist/{chunk-ZCEFC2TK.mjs → chunk-HQCOU6GY.mjs} +0 -1
  24. package/dist/{chunk-SGZP4O6R.mjs → chunk-HSSJKHZ4.mjs} +11 -11
  25. package/dist/{chunk-7QKRRIHI.mjs → chunk-J5I45WGQ.mjs} +77 -152
  26. package/dist/chunk-KQUMKB66.mjs +89 -0
  27. package/dist/{chunk-JA4DHMTG.mjs → chunk-NBYLMO2L.mjs} +0 -1
  28. package/dist/{chunk-4GFN4LEP.mjs → chunk-NPBQLVL3.mjs} +4 -21
  29. package/dist/{chunk-I3FTWD6I.mjs → chunk-O2NQFKJK.mjs} +1 -1
  30. package/dist/{chunk-2R73G2PO.mjs → chunk-QJIXTYTZ.mjs} +121 -765
  31. package/dist/{chunk-GLWPRM33.mjs → chunk-SGIJVHZO.mjs} +0 -1
  32. package/dist/chunk-SZ5C44L5.mjs +35 -0
  33. package/dist/{chunk-5NMATIH4.mjs → chunk-WXXOISTU.mjs} +1 -35
  34. package/dist/chunk-XIYN6AL6.mjs +160 -0
  35. package/dist/contexts/exports.d.ts +2 -2
  36. package/dist/contexts/exports.mjs +11 -9
  37. package/dist/enum/exports.d.ts +1 -1
  38. package/dist/enum/exports.mjs +3 -16
  39. package/dist/enum/governance/exports.d.ts +60 -0
  40. package/dist/enum/governance/exports.mjs +14 -0
  41. package/dist/errors/exports.d.ts +5 -90
  42. package/dist/errors/exports.mjs +19 -10
  43. package/dist/exports-BcUTGFUb.d.ts +40 -0
  44. package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts} +2 -2
  45. package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
  46. package/dist/hooks/exports.d.ts +80 -236
  47. package/dist/hooks/exports.mjs +609 -1508
  48. package/dist/hooks/governance/exports.d.ts +181 -0
  49. package/dist/hooks/governance/exports.mjs +888 -0
  50. package/dist/pol.d-CqPA9K6m.d.ts +142 -0
  51. package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
  52. package/dist/types/exports.d.ts +9 -9
  53. package/dist/types/exports.mjs +0 -1
  54. package/dist/types/governance/exports.d.ts +109 -0
  55. package/dist/types/governance/exports.mjs +0 -0
  56. package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
  57. package/dist/utils/exports.d.ts +24 -7
  58. package/dist/utils/exports.mjs +49 -11
  59. package/package.json +60 -13
  60. package/src/actions/__test/transports.ts +61 -0
  61. package/src/actions/clients/BeraApolloClient.ts +9 -0
  62. package/src/actions/clients/exports.ts +4 -0
  63. package/src/actions/clients/getApolloClient.ts +70 -25
  64. package/src/actions/clients/getEnsoClient.ts +20 -9
  65. package/src/actions/dex/aggregators/base.ts +1 -1
  66. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  67. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  68. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  69. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  70. package/src/actions/exports.ts +5 -10
  71. package/src/actions/governance/exports.ts +9 -0
  72. package/src/actions/governance/getAllProposals.ts +10 -65
  73. package/src/actions/governance/getProposalDetails.ts +6 -33
  74. package/src/actions/governance/getProposalVotes.ts +8 -15
  75. package/src/actions/honey/getChartData.ts +27 -21
  76. package/src/actions/honey/getHoney24hVolume.ts +27 -0
  77. package/src/actions/pol/getAutoclaimedIncentives.ts +30 -0
  78. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  79. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +35 -0
  80. package/src/actions/pol/getEarnedStakedBeraVault.ts +15 -9
  81. package/src/actions/pol/getGlobalData.ts +1 -0
  82. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  83. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  84. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  85. package/src/actions/pol/getStakingDailyAssets.ts +11 -8
  86. package/src/actions/server/exports.ts +1 -0
  87. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  88. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  89. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  90. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  91. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  92. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  93. package/src/data/contracts.ts +5 -0
  94. package/src/enum/contracts.ts +1 -0
  95. package/src/enum/exports.ts +0 -1
  96. package/src/enum/governance/exports.ts +1 -0
  97. package/src/errors/BeraError.ts +47 -7
  98. package/src/errors/BeraTracing.unit.test.ts +65 -0
  99. package/src/errors/RequestError.ts +15 -2
  100. package/src/errors/exports.ts +5 -0
  101. package/src/errors/getRevertReason.integration.test.ts +3 -3
  102. package/src/errors/spanStatus.ts +78 -0
  103. package/src/errors/spanStatus.unit.test.ts +62 -0
  104. package/src/hooks/dex/useCreatePool.ts +1 -88
  105. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  106. package/src/hooks/dex/usePriceImpact.ts +12 -5
  107. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  108. package/src/hooks/enso/useBendMultiply.ts +9 -1
  109. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  110. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  111. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  112. package/src/hooks/exports.ts +3 -16
  113. package/src/hooks/governance/exports.ts +14 -0
  114. package/src/hooks/honey/useHoney24hVolume.ts +16 -0
  115. package/src/hooks/pol/useAutoclaimedIncentives.ts +49 -0
  116. package/src/hooks/pol/useStakedAPR.ts +2 -2
  117. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  118. package/src/hooks/validators/useValidator.ts +2 -0
  119. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  120. package/src/types/bribe-boost.d.ts +8 -0
  121. package/src/types/exports.ts +0 -1
  122. package/src/types/governance/exports.ts +1 -0
  123. package/src/utils/beraFetch.ts +76 -15
  124. package/src/utils/exports.ts +1 -0
  125. package/src/utils/getServerSideClient.ts +4 -2
  126. package/src/utils/sanitizeRpcUrl.ts +22 -0
  127. package/src/utils/tracedTransport.ts +35 -0
  128. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  129. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  130. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  131. package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
  132. package/dist/RequestError-Dk97z8rm.d.ts +0 -57
  133. package/dist/abi/exports.cjs +0 -4453
  134. package/dist/abi/exports.cjs.map +0 -1
  135. package/dist/abi/exports.d.cts +0 -6574
  136. package/dist/abi/exports.mjs.map +0 -1
  137. package/dist/actions/exports.cjs +0 -914
  138. package/dist/actions/exports.cjs.map +0 -1
  139. package/dist/actions/exports.d.cts +0 -1644
  140. package/dist/actions/exports.mjs.map +0 -1
  141. package/dist/chunk-2R73G2PO.mjs.map +0 -1
  142. package/dist/chunk-3M47ZRXT.mjs.map +0 -1
  143. package/dist/chunk-4GFN4LEP.mjs.map +0 -1
  144. package/dist/chunk-5N7QQS55.cjs +0 -130
  145. package/dist/chunk-5N7QQS55.cjs.map +0 -1
  146. package/dist/chunk-5NMATIH4.mjs.map +0 -1
  147. package/dist/chunk-7QKRRIHI.mjs.map +0 -1
  148. package/dist/chunk-7TFV6UKF.mjs.map +0 -1
  149. package/dist/chunk-A4FPM7U3.cjs +0 -63
  150. package/dist/chunk-A4FPM7U3.cjs.map +0 -1
  151. package/dist/chunk-BDHINMWQ.cjs +0 -417
  152. package/dist/chunk-BDHINMWQ.cjs.map +0 -1
  153. package/dist/chunk-BEHP54S3.cjs +0 -24
  154. package/dist/chunk-BEHP54S3.cjs.map +0 -1
  155. package/dist/chunk-EGDXV2PT.cjs +0 -36
  156. package/dist/chunk-EGDXV2PT.cjs.map +0 -1
  157. package/dist/chunk-EWBKSMPG.cjs +0 -13
  158. package/dist/chunk-EWBKSMPG.cjs.map +0 -1
  159. package/dist/chunk-F6ZW7ZDD.cjs +0 -403
  160. package/dist/chunk-F6ZW7ZDD.cjs.map +0 -1
  161. package/dist/chunk-FTXTRUYT.cjs +0 -170
  162. package/dist/chunk-FTXTRUYT.cjs.map +0 -1
  163. package/dist/chunk-GLWPRM33.mjs.map +0 -1
  164. package/dist/chunk-GWSTVITN.mjs.map +0 -1
  165. package/dist/chunk-H3Z37RYU.cjs +0 -15
  166. package/dist/chunk-H3Z37RYU.cjs.map +0 -1
  167. package/dist/chunk-I3FTWD6I.mjs.map +0 -1
  168. package/dist/chunk-JA4DHMTG.mjs.map +0 -1
  169. package/dist/chunk-KL6YZ5VR.mjs.map +0 -1
  170. package/dist/chunk-MXWPP6MS.cjs +0 -572
  171. package/dist/chunk-MXWPP6MS.cjs.map +0 -1
  172. package/dist/chunk-SGZP4O6R.mjs.map +0 -1
  173. package/dist/chunk-TDW5SPXR.cjs +0 -244
  174. package/dist/chunk-TDW5SPXR.cjs.map +0 -1
  175. package/dist/chunk-TGK3IXDN.cjs +0 -169
  176. package/dist/chunk-TGK3IXDN.cjs.map +0 -1
  177. package/dist/chunk-TJEW6YCJ.cjs +0 -97
  178. package/dist/chunk-TJEW6YCJ.cjs.map +0 -1
  179. package/dist/chunk-VA3BQ34H.mjs.map +0 -1
  180. package/dist/chunk-VA5L5FDG.mjs.map +0 -1
  181. package/dist/chunk-XSGCRLSD.cjs +0 -1844
  182. package/dist/chunk-XSGCRLSD.cjs.map +0 -1
  183. package/dist/chunk-XV3GG3HC.cjs +0 -135
  184. package/dist/chunk-XV3GG3HC.cjs.map +0 -1
  185. package/dist/chunk-Y5B224UX.cjs +0 -4698
  186. package/dist/chunk-Y5B224UX.cjs.map +0 -1
  187. package/dist/chunk-ZBTRKBSI.mjs +0 -169
  188. package/dist/chunk-ZBTRKBSI.mjs.map +0 -1
  189. package/dist/chunk-ZCEFC2TK.mjs.map +0 -1
  190. package/dist/contexts/exports.cjs +0 -83
  191. package/dist/contexts/exports.cjs.map +0 -1
  192. package/dist/contexts/exports.d.cts +0 -66
  193. package/dist/contexts/exports.mjs.map +0 -1
  194. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  195. package/dist/dex-C_BB0b0O.d.cts +0 -37
  196. package/dist/enum/exports.cjs +0 -59
  197. package/dist/enum/exports.cjs.map +0 -1
  198. package/dist/enum/exports.d.cts +0 -23
  199. package/dist/enum/exports.mjs.map +0 -1
  200. package/dist/errors/exports.cjs +0 -39
  201. package/dist/errors/exports.cjs.map +0 -1
  202. package/dist/errors/exports.d.cts +0 -413
  203. package/dist/errors/exports.mjs.map +0 -1
  204. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  205. package/dist/global.d-B7IeayVX.d.cts +0 -474
  206. package/dist/honey-CYm0RWf4.d.cts +0 -14
  207. package/dist/hooks/exports.cjs +0 -8333
  208. package/dist/hooks/exports.cjs.map +0 -1
  209. package/dist/hooks/exports.d.cts +0 -1748
  210. package/dist/hooks/exports.mjs.map +0 -1
  211. package/dist/polling-BKnyavLI.d.cts +0 -8
  212. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  213. package/dist/types/exports.cjs +0 -1
  214. package/dist/types/exports.cjs.map +0 -1
  215. package/dist/types/exports.d.cts +0 -90
  216. package/dist/types/exports.mjs.map +0 -1
  217. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  218. package/dist/utils/exports.cjs +0 -787
  219. package/dist/utils/exports.cjs.map +0 -1
  220. package/dist/utils/exports.d.cts +0 -412
  221. package/dist/utils/exports.mjs.map +0 -1
  222. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  223. package/src/actions/honey/getHoneyGlobalData.ts +0 -21
  224. package/src/hooks/dex/useExploitedTokens.ts +0 -57
  225. package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
@@ -1,562 +0,0 @@
1
- import { Address, PublicClient, Hex } from 'viem';
2
- import { BeraConfig, ChainId } from '@berachain/config/internal';
3
- import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-DfkjmzEf.cjs';
4
- import { A as Aggregators } from './dex-C_BB0b0O.cjs';
5
- import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorInListFragment } from '@berachain/graphql/pol/api';
6
- import { P as ProtocolMetadata } from './global.d-B7IeayVX.cjs';
7
-
8
- interface GetConvertToAssetsProps {
9
- sharesAmount: bigint;
10
- vaultAddress: Address;
11
- publicClient: PublicClient;
12
- }
13
- declare function getConvertToAssets({ sharesAmount, vaultAddress, publicClient, }: GetConvertToAssetsProps): Promise<{
14
- raw: bigint;
15
- formatted: string;
16
- }>;
17
-
18
- declare abstract class BaseAggregator {
19
- abstract name: Aggregators;
20
- /**
21
- * Supported chains for the aggregator.
22
- * If null, the aggregator is supported on all chains.
23
- */
24
- abstract supportedChains: number[] | null;
25
- static PATH_NOT_FOUND_REASON: string;
26
- needsAccountForQuote: boolean;
27
- notFoundMessages: string[];
28
- config: BeraConfig;
29
- chainId: ChainId;
30
- constructor(args?: BeraJS.BaseFunctionArgs);
31
- /**
32
- * Identifies the url of the last sent request. Might not have all query params.
33
- * Mainly used for error reporting.
34
- */
35
- url: string;
36
- abstract readonly type: "rest" | "graphql" | "rpc";
37
- abstract getQuote(args: IAggregatorArgs): Promise<IRawAggregatorQuote | undefined> | Promise<IRawAggregatorQuote | undefined>;
38
- /**
39
- * return wbera for native tokens to accomodate the aggregator's router logic
40
- */
41
- protected parseAddresses(tokenIn: string, tokenOut: string): {
42
- tokenInAddress: Address;
43
- tokenOutAddress: Address;
44
- isTokenInNative: boolean;
45
- isTokenOutNative: boolean;
46
- };
47
- /**
48
- * Calculate input amount after fees.
49
- *
50
- * @returns Amount in wad format
51
- */
52
- protected getAmountAfterFees(amount: string, aggregatorsFeeBps?: number): string;
53
- /**
54
- * Formats input data for aggregator swaps
55
- */
56
- protected getInputData({ tokenIn, amountIn, isNative, isPermit2Approval, permit2SpenderAddress, }: {
57
- tokenIn: Address;
58
- amountIn: string;
59
- isNative: boolean;
60
- isPermit2Approval?: boolean;
61
- permit2SpenderAddress?: Address | null;
62
- }): {
63
- tokenIn: `0x${string}`;
64
- amountIn: bigint;
65
- isNative: boolean;
66
- isPermit2Approval: boolean;
67
- permit2SpenderAddress: `0x${string}`;
68
- };
69
- /**
70
- * Calculate min amount out
71
- */
72
- protected getMinAmountOut(amountOut: string, slippage: number): bigint;
73
- protected parseAllowanceRequirements({ tokenIn, rawAmount, spender, }: {
74
- tokenIn: Token;
75
- rawAmount: string;
76
- spender: Address;
77
- }): {
78
- token: Token;
79
- amount: {
80
- raw: string;
81
- formatted: string;
82
- };
83
- spender: `0x${string}`;
84
- }[];
85
- /**
86
- * Check if chain is supported
87
- */
88
- checkChainSupport({ tokenIn, tokenOut, }: {
89
- tokenIn: Token;
90
- tokenOut: Token;
91
- honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
92
- underlyingToken?: Token | null;
93
- }): boolean;
94
- assertChainSupport({ tokenIn, tokenOut, underlyingToken, }: {
95
- tokenIn: Token;
96
- tokenOut: Token;
97
- underlyingToken?: Token | null;
98
- }): void;
99
- protected fetch(url: string | URL, options?: RequestInit): Promise<Response>;
100
- }
101
-
102
- interface PoolStatus {
103
- isPoolInRecoveryMode: boolean;
104
- isPoolPaused: boolean;
105
- }
106
- declare function getPoolPausedState({ publicClient, poolAddress, }: {
107
- publicClient: PublicClient;
108
- poolAddress: Address;
109
- }): Promise<PoolStatus>;
110
-
111
- interface OnChainPool {
112
- pausedState: PoolStatus;
113
- address: Address;
114
- id: Hex;
115
- name: string;
116
- poolTokens: [
117
- /**
118
- * The addresses of the tokens in the pool
119
- */
120
- readonly Address[],
121
- /**
122
- * The balances of the tokens in the pool
123
- */
124
- string[],
125
- /**
126
- * The last change block of the pool
127
- */
128
- number
129
- ];
130
- totalSupply: string;
131
- swapFee: string;
132
- decimals: number;
133
- weights: readonly string[] | undefined;
134
- version: unknown;
135
- factory: Address;
136
- type: GqlPoolType;
137
- /**
138
- * For example, if value is 300000n and precision is 1000n, the user-set amplification parameter would be 300000n / 1000n = 300n.
139
- *
140
- * The first number is the raw value, the second number is a boolean indicating if the amplification parameter is being updated, and the third number is the precision factor.
141
- * @see https://github.com/balancer/docs-developers/blob/main/references/valuing-balancer-lp-tokens/pools/stablepools.md#getamplificationparameter
142
- */
143
- amplificationParameter: readonly [number, boolean, number] | undefined;
144
- }
145
- declare function getOnChainPool({ poolId, publicClient, ...args }: {
146
- poolId: string;
147
- publicClient: PublicClient;
148
- } & BeraJS.BaseFunctionArgs): Promise<OnChainPool>;
149
-
150
- interface GetVaultsBalancesArgs extends BeraJS.BaseFunctionArgs {
151
- client: PublicClient;
152
- collateralList: Token[];
153
- honeyFactoryAddress?: Address;
154
- }
155
- interface GetHoneyVaultsBalanceResponse extends BalanceToken {
156
- vault: Address;
157
- }
158
- declare function getHoneyVaultsBalance({ client, collateralList, honeyFactoryAddress, ...args }: GetVaultsBalancesArgs): Promise<GetHoneyVaultsBalanceResponse[]>;
159
-
160
- interface IsBadCollateralArgs extends BeraJS.BaseFunctionArgs {
161
- client: PublicClient;
162
- collateral: Token;
163
- latestPrices: PythLatestUpdates | undefined;
164
- isPythWrapperEnabled: boolean;
165
- }
166
- interface IsBadCollateralResponse {
167
- isBlacklisted: boolean;
168
- isDepegged: boolean;
169
- }
170
- /**
171
- * Checks if a given collateral asset is considered bad, either by being blacklisted or depegged.
172
- *
173
- * @param {Object} args - The arguments object.
174
- * @param {PublicClient} args.client - The client used to interact with the blockchain.
175
- * @param {Token} args.collateral - The collateral asset to check.
176
- *
177
- * @returns {Promise<IsBadCollateralResponse | undefined>} An object indicating if the collateral is blacklisted or depegged.
178
- */
179
- declare function isBadCollateralAsset({ client, collateral, latestPrices, isPythWrapperEnabled, ...args }: IsBadCollateralArgs): Promise<IsBadCollateralResponse | undefined>;
180
-
181
- declare enum RewardVaultDistributionMode {
182
- Duration = "duration",
183
- TargetRate = "targetRate",
184
- TargetApr = "targetApr"
185
- }
186
- interface GetRewardVaultRewardsReturn {
187
- rewardsDuration: number;
188
- manager: Address;
189
- /**
190
- * The amount of BGT that will be distributed per second
191
- */
192
- rewardRate: string;
193
- /**
194
- * The timestamp when rewards will be depleted
195
- */
196
- periodFinish: number;
197
- /**
198
- * The amount of BGT that will be distributed from now until the periodFinish timestamp
199
- */
200
- availableRewards: string;
201
- /**
202
- * The amount of BGT that will be distributed per second.
203
- *
204
- * If this is 0, the duration mode is active.
205
- */
206
- targetRewardsPerSecond: string;
207
- /**
208
- * The minimum reward duration for the target rate
209
- */
210
- minRewardDurationForTargetRate: number;
211
- /**
212
- * The current mode of the vault
213
- */
214
- mode: RewardVaultDistributionMode.Duration | RewardVaultDistributionMode.TargetRate;
215
- }
216
- declare function getRewardVaultRewards(address: Address, publicClient: PublicClient): Promise<GetRewardVaultRewardsReturn>;
217
-
218
- type GetBgtAprSimulationArgs = {
219
- /**
220
- * Staked TVL of the vault in USD.
221
- *
222
- * Null if not available
223
- */
224
- tvl: number | null;
225
- /**
226
- * Price of BGT in USD
227
- */
228
- bgtPrice: number;
229
- /**
230
- * Undistributed BGT rewards
231
- */
232
- availableRewards: number;
233
- /**
234
- * Finish period of the reward distribution in seconds
235
- */
236
- periodFinish: number;
237
- /**
238
- * Current duration of the reward distribution in seconds. This will be used if the reward rate is 0.
239
- *
240
- */
241
- currentDuration: number;
242
- /**
243
- * Maximum reward duration in seconds
244
- */
245
- MAX_REWARD_DURATION: number;
246
- /**
247
- * Minimum reward duration in seconds
248
- */
249
- MIN_REWARD_DURATION: number;
250
- } & ({
251
- /**
252
- *
253
- */
254
- mode: RewardVaultDistributionMode.TargetApr;
255
- apr: number;
256
- /**
257
- * Minimum reward duration for the target rate
258
- */
259
- minRewardDurationForTargetRate: number;
260
- } | {
261
- /**
262
- *
263
- */
264
- mode: RewardVaultDistributionMode.TargetRate;
265
- rewardRate: number;
266
- /**
267
- * Minimum reward duration for the target rate
268
- */
269
- minRewardDurationForTargetRate: number;
270
- } | {
271
- /**
272
- *
273
- */
274
- mode: RewardVaultDistributionMode.Duration;
275
- /**
276
- * Duration of the reward distribution in seconds
277
- */
278
- duration: number;
279
- rewardRate?: never;
280
- /**
281
- * Must be between MIN_REWARD_DURATION and MAX_REWARD_DURATION
282
- */
283
- minRewardDurationForTargetRate?: never;
284
- });
285
- type GetBgtAprSimulationResult = {
286
- apr: number | null;
287
- duration: number;
288
- rewardRate: number;
289
- periodFinish: number;
290
- /**
291
- * It's the input target rate for the target rate mode.
292
- *
293
- * If input was target apr, it will be the calculated reward rate.
294
- *
295
- * If input was duration, it will be null.
296
- */
297
- targetRate: string | null;
298
- /**
299
- * If the mode is changed, this will be the new mode. Null otherwise.
300
- */
301
- mode: RewardVaultDistributionMode | null;
302
- };
303
- declare function getBgtAprSimulation({ availableRewards, periodFinish, tvl, bgtPrice, MIN_REWARD_DURATION, MAX_REWARD_DURATION, ...args }: GetBgtAprSimulationArgs): GetBgtAprSimulationResult;
304
-
305
- type ReturnedFromQuery = GlobalDataQuery["polGetGlobalInfo"] & {
306
- top3EmittingValidators: GlobalDataQuery["top3EmittingValidators"]["validators"];
307
- allValidatorsCount: number;
308
- };
309
- interface GlobalInfo extends Partial<ReturnedFromQuery> {
310
- }
311
-
312
- interface GlobalData extends GlobalInfo {
313
- globalCuttingBoard: ApiVaultFragment[] | undefined;
314
- bgtTotalSupply: string | undefined;
315
- bgtTotalBoosts: string | undefined;
316
- }
317
- declare function getGlobalData(publicClient: PublicClient): Promise<GlobalData>;
318
-
319
- interface GetMarkets {
320
- marketList: ProtocolMetadata[];
321
- marketDictionary: {
322
- [key: string]: ProtocolMetadata;
323
- };
324
- }
325
- declare function getMarkets(args?: BeraJS.BaseFunctionArgs): Promise<GetMarkets>;
326
-
327
- interface RewardVaultIncentive {
328
- token: Address;
329
- manager: Address;
330
- minIncentiveRate: string;
331
- incentiveRate: string;
332
- remainingAmount: string;
333
- name?: string;
334
- symbol?: string;
335
- /**
336
- * Amount of tokens that needs approval before they can be added to the incentive.
337
- *
338
- * Anyone can just `transfer` ERC20 to the vault, but incentive manager need to send accountIncentives to turn on distribution.
339
- */
340
- pendingAmount: string;
341
- decimals: number;
342
- }
343
- declare function getRewardVaultIncentives({ address, stakingToken, publicClient, }: {
344
- address: Address;
345
- stakingToken: Address;
346
- publicClient: PublicClient;
347
- }): Promise<RewardVaultIncentive[]>;
348
-
349
- interface GetGaugeData {
350
- gaugeList: ApiVaultFragment[];
351
- pagination: {
352
- currentPage: number;
353
- totalCount: number;
354
- };
355
- }
356
- declare function getRewardVaults({ filter, publicClient, ...args }?: {
357
- filter?: GetVaultsQueryVariables;
358
- publicClient?: PublicClient | undefined;
359
- } & BeraJS.BaseFunctionArgs): Promise<GetGaugeData>;
360
-
361
- interface VaultMetadata {
362
- current: {
363
- exchangeRate: string;
364
- totalSupply: string;
365
- totalAssets: string;
366
- tvl: string;
367
- };
368
- previous: {
369
- exchangeRate: string;
370
- totalSupply: string;
371
- totalAssets: string;
372
- tvl: string;
373
- };
374
- totalWBeraIssued: string;
375
- lockPeriod?: number;
376
- totalBuyBacks: number;
377
- totalBuyBacksInLast24Hours: number;
378
- address: Address;
379
- }
380
- /**
381
- *
382
- * @param address - The address of the vault
383
- * @param underlyingAsset - The address of the vault's underlying asset token
384
- * @throws {Error} If the vault is not found
385
- * @returns
386
- */
387
- declare function getSWBeraVaultMetadata({ address, underlyingAsset, publicClient, blockTime, }: {
388
- address: Address;
389
- underlyingAsset: Address;
390
- publicClient?: PublicClient;
391
- blockTime: number;
392
- }): Promise<VaultMetadata>;
393
-
394
- /**
395
- * Interface representing a staked BERA withdrawal request
396
- */
397
- interface StakedBeraWithdrawal {
398
- receiptTokenAddress: Address;
399
- withdrawalAmount?: bigint;
400
- timeRemaining?: string;
401
- withdrawalRequestId?: bigint;
402
- }
403
- /**
404
- * Retrieves staked BERA withdrawal information for a given account
405
- *
406
- * This function handles both V1 and V2 versions of the stake vault contract:
407
- * - V1: Uses a single withdrawal request per account
408
- * - V2: Uses ERC721 tokens to represent multiple withdrawal requests per account
409
- *
410
- * @param contractAddress - The address of the stake vault contract
411
- * @param accountAddress - The address of the account to check withdrawals for
412
- * @param publicClient - Viem public client for blockchain interactions
413
- * @param version - The version of the stake vault contract ("V1" or "V2")
414
- * @returns Promise resolving to an array of withdrawal request information
415
- */
416
- declare function getSWBeraWithdrawal({ contractAddress, accountAddress, publicClient, version, }: {
417
- contractAddress: Address;
418
- accountAddress: Address;
419
- publicClient: PublicClient;
420
- version: "V1" | "V2";
421
- }): Promise<StakedBeraWithdrawal[]>;
422
-
423
- interface UserVault {
424
- unclaimedBgt: string;
425
- formattedBalance: string;
426
- stakingTokenPrice: number | null;
427
- vault: ApiVaultFragment;
428
- }
429
- type GetUserVaultsResponse = {
430
- totalStakedValue: number;
431
- totalBgtRewards: string;
432
- vaults: UserVault[];
433
- };
434
- declare function getUserVaults({ account, publicClient, ...args }: {
435
- account: Address;
436
- publicClient: PublicClient;
437
- } & BeraJS.BaseFunctionArgs): Promise<GetUserVaultsResponse>;
438
-
439
- type GetVaultHistoryArgs = {
440
- vault: Address;
441
- chain?: GqlChain;
442
- } & Omit<GetVaultHistoryQueryVariables, "vaultId" | "chain"> & BeraJS.BaseFunctionArgs;
443
- declare function getVaultHistory({ vault, chain, ...args }: GetVaultHistoryArgs): Promise<GetVaultHistoryQuery["polGetRewardVaultSnapshots"] | undefined>;
444
-
445
- interface ValidatorRewardAllocationRaw {
446
- startBlock: bigint;
447
- weights: readonly {
448
- receiver: `0x${string}`;
449
- percentageNumerator: bigint;
450
- }[];
451
- }
452
- interface ValidatorRewardAllocation {
453
- start: {
454
- blockNumber: number;
455
- timestamp: number;
456
- };
457
- weights: readonly {
458
- receiver: `0x${string}`;
459
- /**
460
- * Weight percentage as a number between 0 and 1.
461
- */
462
- percentage: number;
463
- }[];
464
- }
465
- interface ValidatorRewardAllocationUpdate {
466
- active: ValidatorRewardAllocation["start"];
467
- set: ValidatorRewardAllocation["start"];
468
- }
469
- interface ValidatorRewardAllocationUpdateWithExpiration extends ValidatorRewardAllocationUpdate {
470
- expiresAtTs: number;
471
- }
472
- declare function formatValidatorRewardAllocation(raw: ValidatorRewardAllocationRaw, startTs: number): ValidatorRewardAllocation;
473
- declare function isSameRewardAllocation(a: ValidatorRewardAllocation, b: ValidatorRewardAllocation): boolean;
474
- declare function getValidatorRewardAllocation({ client, pubKey, ...args }: BeraJS.BaseFunctionArgs & {
475
- client: PublicClient;
476
- pubKey: Address;
477
- }): Promise<{
478
- /**
479
- * The active reward allocation for the validator.
480
- */
481
- activeRewardAllocation: ValidatorRewardAllocation;
482
- /**
483
- * The set reward allocation for the validator.
484
- *
485
- * It might differ from the active reward allocation if the validator hasn't updated
486
- * the reward allocation for more than the reward allocation inactivity block span.
487
- */
488
- setRewardAllocation: ValidatorRewardAllocation;
489
- /**
490
- * Whether the reward allocation is inactive so it falls back to the baseline reward allocation.
491
- */
492
- isBaseline: boolean;
493
- isNeverSet: boolean;
494
- }>;
495
-
496
- type UserBoostsOnValidator = {
497
- pubkey: Address;
498
- /**
499
- * The amount of boosts that can be dropped.
500
- */
501
- droppableBoostAmount: string;
502
- activeBoostAmount: string;
503
- queuedBoostAmount: string;
504
- queuedBoostStartBlock: number;
505
- queuedDropBoostAmount: string;
506
- queuedDropBoostStartBlock: number;
507
- hasPendingBoosts: boolean;
508
- hasActiveBoosts: boolean;
509
- /**
510
- * Whether the user has active boosts that can be dropped.
511
- */
512
- hasDroppableBoosts: boolean;
513
- };
514
- declare function getUserBoostsOnValidator({ account, pubkey, publicClient, ...args }: {
515
- account: Address;
516
- pubkey: Address;
517
- publicClient: PublicClient | undefined;
518
- } & BeraJS.BaseFunctionArgs): Promise<UserBoostsOnValidator>;
519
-
520
- type ValidatorWithUserBoost = ApiValidatorInListFragment & {
521
- userBoosts: UserBoostsOnValidator;
522
- };
523
- declare function getUserActiveValidators({ account, publicClient, chain, ...args }: {
524
- account: string;
525
- publicClient: PublicClient | undefined;
526
- chain?: GqlChain;
527
- } & BeraJS.BaseFunctionArgs): Promise<ValidatorWithUserBoost[] | undefined>;
528
-
529
- interface StakingPoolAmount {
530
- amount: bigint;
531
- formattedAmount: string;
532
- }
533
- interface UserStakingPoolPosition {
534
- validatorAddress: Address;
535
- earning: number;
536
- staked?: StakingPoolAmount;
537
- rewards?: StakingPoolAmount;
538
- queueData?: {
539
- stake?: StakingPoolAmount[];
540
- unstake?: (StakingPoolAmount & {
541
- timestamp: number;
542
- })[];
543
- };
544
- }
545
- declare function getUserStakingPositions(account: Address): Promise<UserStakingPoolPosition[]>;
546
-
547
- interface ValidatorQueuedCommission {
548
- blockNumberLast: number;
549
- commissionRate: number;
550
- }
551
- declare function getValidatorQueuedCommission({ client, pubKey, ...args }: BeraJS.BaseFunctionArgs & {
552
- client: PublicClient;
553
- pubKey: Address;
554
- }): Promise<ValidatorQueuedCommission | undefined | null>;
555
-
556
- type ValidatorQueuedOperatorAddress = [bigint, string];
557
- declare function getValidatorQueuedOperatorAddress({ client, pubKey, ...args }: {
558
- client: PublicClient;
559
- pubKey: Address;
560
- } & BeraJS.BaseFunctionArgs): Promise<ValidatorQueuedOperatorAddress | undefined>;
561
-
562
- export { getOnChainPool as A, BaseAggregator as B, getPoolPausedState as C, getRewardVaultIncentives as D, getRewardVaultRewards as E, getRewardVaults as F, type GetBgtAprSimulationArgs as G, getSWBeraVaultMetadata as H, type IsBadCollateralArgs as I, getSWBeraWithdrawal as J, getUserActiveValidators as K, getUserBoostsOnValidator as L, getUserStakingPositions as M, getUserVaults as N, type OnChainPool as O, type PoolStatus as P, getValidatorQueuedCommission as Q, RewardVaultDistributionMode as R, type StakedBeraWithdrawal as S, getValidatorQueuedOperatorAddress as T, type UserBoostsOnValidator as U, type ValidatorRewardAllocation as V, getValidatorRewardAllocation as W, getVaultHistory as X, isBadCollateralAsset as Y, isSameRewardAllocation as Z, type GetBgtAprSimulationResult as a, type GetConvertToAssetsProps as b, type GetGaugeData as c, type GetHoneyVaultsBalanceResponse as d, type GetMarkets as e, type GetRewardVaultRewardsReturn as f, type GetUserVaultsResponse as g, type GetVaultHistoryArgs as h, type GlobalData as i, type IsBadCollateralResponse as j, type RewardVaultIncentive as k, type UserStakingPoolPosition as l, type UserVault as m, type ValidatorQueuedCommission as n, type ValidatorQueuedOperatorAddress as o, type ValidatorRewardAllocationRaw as p, type ValidatorRewardAllocationUpdate as q, type ValidatorRewardAllocationUpdateWithExpiration as r, type ValidatorWithUserBoost as s, type VaultMetadata as t, formatValidatorRewardAllocation as u, getBgtAprSimulation as v, getConvertToAssets as w, getGlobalData as x, getHoneyVaultsBalance as y, getMarkets as z };