@berachain/berajs 0.2.8-beta.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.
Files changed (254) 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-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
  4. package/dist/abi/exports.mjs +4452 -2
  5. package/dist/actions/clients/exports.d.ts +78 -0
  6. package/dist/actions/clients/exports.mjs +21 -0
  7. package/dist/actions/exports.d.ts +154 -207
  8. package/dist/actions/exports.mjs +853 -2
  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-3JJLQ2JX.mjs +211 -0
  14. package/dist/chunk-7YVNSDXG.mjs +86 -0
  15. package/dist/chunk-AUOPN6NK.mjs +96 -0
  16. package/dist/chunk-BGMRHTBQ.mjs +23 -0
  17. package/dist/chunk-CDK4YV3D.mjs +571 -0
  18. package/dist/chunk-DKMAIU74.mjs +62 -0
  19. package/dist/chunk-DQRH5VE3.mjs +25 -0
  20. package/dist/chunk-E7YFXBBQ.mjs +349 -0
  21. package/dist/chunk-GUURQAME.mjs +326 -0
  22. package/dist/chunk-GY6B3PD5.mjs +89 -0
  23. package/dist/chunk-HQCOU6GY.mjs +243 -0
  24. package/dist/chunk-HYDP32P6.mjs +135 -0
  25. package/dist/chunk-IXIBY5FP.mjs +80 -0
  26. package/dist/chunk-KHXJDYA4.mjs +1776 -0
  27. package/dist/chunk-NBYLMO2L.mjs +14 -0
  28. package/dist/chunk-O2NQFKJK.mjs +170 -0
  29. package/dist/chunk-P5WXXULM.mjs +54 -0
  30. package/dist/chunk-QBBOWFMH.mjs +4129 -0
  31. package/dist/chunk-QVHEM4BG.mjs +35 -0
  32. package/dist/chunk-SGIJVHZO.mjs +12 -0
  33. package/dist/chunk-SZ5C44L5.mjs +35 -0
  34. package/dist/chunk-WNBWX23Q.mjs +426 -0
  35. package/dist/chunk-Y6THHG77.mjs +126 -0
  36. package/dist/chunk-ZLTMIFCZ.mjs +165 -0
  37. package/dist/contexts/exports.d.ts +2 -2
  38. package/dist/contexts/exports.mjs +85 -2
  39. package/dist/enum/exports.d.ts +1 -1
  40. package/dist/enum/exports.mjs +46 -2
  41. package/dist/enum/governance/exports.d.ts +60 -0
  42. package/dist/enum/governance/exports.mjs +14 -0
  43. package/dist/errors/exports.d.ts +4 -3
  44. package/dist/errors/exports.mjs +48 -2
  45. package/dist/getApolloClient-BcUTGFUb.d.ts +40 -0
  46. package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-DphU3qhE.d.ts} +2 -2
  47. package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
  48. package/dist/hooks/exports.d.ts +83 -226
  49. package/dist/hooks/exports.mjs +7463 -4
  50. package/dist/hooks/governance/exports.d.ts +181 -0
  51. package/dist/hooks/governance/exports.mjs +888 -0
  52. package/dist/pol.d-Dw5SQcRX.d.ts +153 -0
  53. package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
  54. package/dist/types/exports.d.ts +9 -9
  55. package/dist/types/exports.mjs +0 -1
  56. package/dist/types/governance/exports.d.ts +109 -0
  57. package/dist/types/governance/exports.mjs +0 -0
  58. package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
  59. package/dist/utils/exports.d.ts +15 -6
  60. package/dist/utils/exports.mjs +827 -2
  61. package/package.json +49 -13
  62. package/src/actions/__test/transports.ts +61 -0
  63. package/src/actions/clients/exports.ts +7 -0
  64. package/src/actions/clients/fetchBeep.ts +34 -0
  65. package/src/actions/clients/fetchOpenApi.ts +93 -0
  66. package/src/actions/clients/fetchOpenApi.unit.test.ts +223 -0
  67. package/src/actions/clients/fetchRailwayBackend.ts +34 -0
  68. package/src/actions/clients/getApolloClient.ts +58 -23
  69. package/src/actions/clients/getEnsoClient.ts +20 -9
  70. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  71. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  72. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  73. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  74. package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
  75. package/src/actions/exports.ts +5 -9
  76. package/src/actions/governance/exports.ts +9 -0
  77. package/src/actions/governance/getAllProposals.ts +10 -65
  78. package/src/actions/governance/getProposalDetails.ts +6 -33
  79. package/src/actions/governance/getProposalVotes.ts +8 -15
  80. package/src/actions/honey/getChartData.ts +27 -21
  81. package/src/actions/honey/getHoney24hVolume.ts +19 -22
  82. package/src/actions/honey/getPythLatestPrices.ts +7 -0
  83. package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
  84. package/src/actions/pol/getAutoclaimedIncentives.ts +41 -0
  85. package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
  86. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  87. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +28 -0
  88. package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -20
  89. package/src/actions/pol/getGlobalData.ts +1 -0
  90. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  91. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  92. package/src/actions/pol/getRewardVaults.ts +4 -4
  93. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  94. package/src/actions/pol/getStakingDailyAssets.ts +18 -17
  95. package/src/actions/server/exports.ts +1 -0
  96. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  97. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  98. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  99. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  100. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  101. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  102. package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
  103. package/src/enum/contracts.ts +1 -0
  104. package/src/enum/exports.ts +0 -1
  105. package/src/enum/governance/exports.ts +1 -0
  106. package/src/errors/BeraError.ts +47 -7
  107. package/src/errors/BeraTracing.unit.test.ts +65 -0
  108. package/src/errors/RequestError.ts +25 -4
  109. package/src/errors/RequestError.unit.test.ts +55 -0
  110. package/src/errors/errorMap.ts +8 -0
  111. package/src/errors/exports.ts +5 -0
  112. package/src/errors/getRevertReason.integration.test.ts +3 -3
  113. package/src/errors/spanStatus.ts +78 -0
  114. package/src/errors/spanStatus.unit.test.ts +62 -0
  115. package/src/hooks/dex/useCreatePool.ts +1 -88
  116. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  117. package/src/hooks/dex/usePriceImpact.ts +12 -5
  118. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  119. package/src/hooks/enso/useBendMultiply.ts +9 -1
  120. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  121. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  122. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  123. package/src/hooks/exports.ts +3 -15
  124. package/src/hooks/governance/exports.ts +14 -0
  125. package/src/hooks/pol/useAutoclaimedIncentives.ts +40 -0
  126. package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +45 -0
  127. package/src/hooks/pol/useStakedAPR.ts +2 -2
  128. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  129. package/src/hooks/validators/useValidator.ts +6 -8
  130. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  131. package/src/types/bribe-boost.d.ts +19 -0
  132. package/src/types/exports.ts +0 -1
  133. package/src/types/governance/exports.ts +1 -0
  134. package/src/utils/beraFetch.ts +9 -3
  135. package/src/utils/exports.ts +1 -0
  136. package/src/utils/getServerSideClient.ts +4 -2
  137. package/src/utils/polyfillAbortSignalAny.ts +53 -0
  138. package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
  139. package/src/utils/sanitizeRpcUrl.ts +22 -0
  140. package/src/utils/tracedTransport.ts +35 -0
  141. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  142. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  143. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  144. package/dist/RequestError-DSUzJ1Iy.d.cts +0 -144
  145. package/dist/abi/exports.cjs +0 -2
  146. package/dist/abi/exports.cjs.map +0 -1
  147. package/dist/abi/exports.d.cts +0 -6574
  148. package/dist/abi/exports.mjs.map +0 -1
  149. package/dist/actions/exports.cjs +0 -2
  150. package/dist/actions/exports.cjs.map +0 -1
  151. package/dist/actions/exports.d.cts +0 -1650
  152. package/dist/actions/exports.mjs.map +0 -1
  153. package/dist/chunk-45HIEVNI.cjs +0 -4
  154. package/dist/chunk-45HIEVNI.cjs.map +0 -1
  155. package/dist/chunk-47ILYVHC.mjs +0 -2
  156. package/dist/chunk-47ILYVHC.mjs.map +0 -1
  157. package/dist/chunk-575OK77P.mjs +0 -2
  158. package/dist/chunk-575OK77P.mjs.map +0 -1
  159. package/dist/chunk-5NVZG5N6.mjs +0 -2
  160. package/dist/chunk-5NVZG5N6.mjs.map +0 -1
  161. package/dist/chunk-6DIA6PXV.cjs +0 -2
  162. package/dist/chunk-6DIA6PXV.cjs.map +0 -1
  163. package/dist/chunk-6JJIZCVY.cjs +0 -2
  164. package/dist/chunk-6JJIZCVY.cjs.map +0 -1
  165. package/dist/chunk-7F72ZH4Q.mjs +0 -2
  166. package/dist/chunk-7F72ZH4Q.mjs.map +0 -1
  167. package/dist/chunk-AUA42YIG.mjs +0 -4
  168. package/dist/chunk-AUA42YIG.mjs.map +0 -1
  169. package/dist/chunk-BC2WX6O6.cjs +0 -2
  170. package/dist/chunk-BC2WX6O6.cjs.map +0 -1
  171. package/dist/chunk-CJOZC5Z2.cjs +0 -2
  172. package/dist/chunk-CJOZC5Z2.cjs.map +0 -1
  173. package/dist/chunk-D6L7LTA2.cjs +0 -2
  174. package/dist/chunk-D6L7LTA2.cjs.map +0 -1
  175. package/dist/chunk-DDEQFR3M.cjs +0 -2
  176. package/dist/chunk-DDEQFR3M.cjs.map +0 -1
  177. package/dist/chunk-GXV2JA36.mjs +0 -2
  178. package/dist/chunk-GXV2JA36.mjs.map +0 -1
  179. package/dist/chunk-ISYNEDET.mjs +0 -2
  180. package/dist/chunk-ISYNEDET.mjs.map +0 -1
  181. package/dist/chunk-JDDRTHFG.mjs +0 -2
  182. package/dist/chunk-JDDRTHFG.mjs.map +0 -1
  183. package/dist/chunk-JDZGYU5T.mjs +0 -2
  184. package/dist/chunk-JDZGYU5T.mjs.map +0 -1
  185. package/dist/chunk-LVOXBZMA.cjs +0 -2
  186. package/dist/chunk-LVOXBZMA.cjs.map +0 -1
  187. package/dist/chunk-MK5NS5B5.mjs +0 -2
  188. package/dist/chunk-MK5NS5B5.mjs.map +0 -1
  189. package/dist/chunk-NAXAZJJY.mjs +0 -2
  190. package/dist/chunk-NAXAZJJY.mjs.map +0 -1
  191. package/dist/chunk-NLVWRMGD.mjs +0 -2
  192. package/dist/chunk-NLVWRMGD.mjs.map +0 -1
  193. package/dist/chunk-OGBD5YOG.mjs +0 -2
  194. package/dist/chunk-OGBD5YOG.mjs.map +0 -1
  195. package/dist/chunk-OGJMSGB2.mjs +0 -2
  196. package/dist/chunk-OGJMSGB2.mjs.map +0 -1
  197. package/dist/chunk-OIYXOKTT.cjs +0 -2
  198. package/dist/chunk-OIYXOKTT.cjs.map +0 -1
  199. package/dist/chunk-OUD27MU7.cjs +0 -2
  200. package/dist/chunk-OUD27MU7.cjs.map +0 -1
  201. package/dist/chunk-PRLVZIKD.mjs +0 -2
  202. package/dist/chunk-PRLVZIKD.mjs.map +0 -1
  203. package/dist/chunk-Q2SNRLW3.cjs +0 -2
  204. package/dist/chunk-Q2SNRLW3.cjs.map +0 -1
  205. package/dist/chunk-REWME3FY.cjs +0 -2
  206. package/dist/chunk-REWME3FY.cjs.map +0 -1
  207. package/dist/chunk-RJN36GBU.mjs +0 -2
  208. package/dist/chunk-RJN36GBU.mjs.map +0 -1
  209. package/dist/chunk-RWOICHRW.cjs +0 -2
  210. package/dist/chunk-RWOICHRW.cjs.map +0 -1
  211. package/dist/chunk-S4CDSVLK.cjs +0 -2
  212. package/dist/chunk-S4CDSVLK.cjs.map +0 -1
  213. package/dist/chunk-SFEULGSX.cjs +0 -2
  214. package/dist/chunk-SFEULGSX.cjs.map +0 -1
  215. package/dist/chunk-WBTS6KFG.mjs +0 -2
  216. package/dist/chunk-WBTS6KFG.mjs.map +0 -1
  217. package/dist/chunk-WRFDB3QJ.cjs +0 -2
  218. package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
  219. package/dist/chunk-XNJLSA6P.cjs +0 -2
  220. package/dist/chunk-XNJLSA6P.cjs.map +0 -1
  221. package/dist/contexts/exports.cjs +0 -2
  222. package/dist/contexts/exports.cjs.map +0 -1
  223. package/dist/contexts/exports.d.cts +0 -66
  224. package/dist/contexts/exports.mjs.map +0 -1
  225. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  226. package/dist/dex-C_BB0b0O.d.cts +0 -37
  227. package/dist/enum/exports.cjs +0 -2
  228. package/dist/enum/exports.cjs.map +0 -1
  229. package/dist/enum/exports.d.cts +0 -23
  230. package/dist/enum/exports.mjs.map +0 -1
  231. package/dist/errors/exports.cjs +0 -2
  232. package/dist/errors/exports.cjs.map +0 -1
  233. package/dist/errors/exports.d.cts +0 -327
  234. package/dist/errors/exports.mjs.map +0 -1
  235. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  236. package/dist/global.d-B7IeayVX.d.cts +0 -474
  237. package/dist/honey-CYm0RWf4.d.cts +0 -14
  238. package/dist/hooks/exports.cjs +0 -4
  239. package/dist/hooks/exports.cjs.map +0 -1
  240. package/dist/hooks/exports.d.cts +0 -1734
  241. package/dist/hooks/exports.mjs.map +0 -1
  242. package/dist/polling-BKnyavLI.d.cts +0 -8
  243. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  244. package/dist/types/exports.cjs +0 -1
  245. package/dist/types/exports.cjs.map +0 -1
  246. package/dist/types/exports.d.cts +0 -90
  247. package/dist/types/exports.mjs.map +0 -1
  248. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  249. package/dist/utils/exports.cjs +0 -2
  250. package/dist/utils/exports.cjs.map +0 -1
  251. package/dist/utils/exports.d.cts +0 -420
  252. package/dist/utils/exports.mjs.map +0 -1
  253. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  254. package/src/hooks/dex/useExploitedTokens.ts +0 -57
@@ -1,390 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { Address, PublicClient, Abi, Hex } from 'viem';
4
- import { Token as Token$1 } from '@berachain/graphql/pol/api';
5
- import { SwapKind } from '@berachain-foundation/berancer-sdk';
6
- import { H as HoneySwapAction } from './honey-CYm0RWf4.cjs';
7
-
8
- interface CollateralRates {
9
- mintFee: number;
10
- redeemFee: number;
11
- }
12
- interface HoneyFeeMap {
13
- single: Record<Address, CollateralRates>;
14
- basket: CollateralRates;
15
- }
16
- interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {
17
- client: PublicClient;
18
- collateralList: Token$1[];
19
- }
20
- /**
21
- * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates
22
- * @param {Object} params - The parameters object
23
- * @param {PublicClient} params.client - The Viem public client instance
24
- * @param {Address[]} params.collateralList - Array of collateral token addresses
25
- * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,
26
- * or undefined if the operation fails
27
- */
28
- declare function getHoneyFees({ client, collateralList, ...args }: CollateralRatesArgs): Promise<HoneyFeeMap>;
29
-
30
- type MinimalERC20 = {
31
- address: Address;
32
- decimals: number;
33
- symbol: string;
34
- name: string;
35
- chainId: number;
36
- };
37
-
38
- type TokenWithMetadata = MinimalERC20 & {
39
- tags?: string[];
40
- base64?: string;
41
- logoURI?: string;
42
- };
43
-
44
- type Token = TokenWithMetadata & {
45
- totalSupply?: string;
46
- weight?: number | string | null;
47
- };
48
-
49
- interface TokenPriceInfo {
50
- price: number;
51
- updatedAt: number;
52
- chainId: number;
53
- }
54
-
55
- type TokenCurrentPriceMap = Record<
56
- Lowercase<Address> | string,
57
- TokenPriceInfo | undefined
58
- >;
59
-
60
- interface TokenWithAmount extends Token {
61
- amount: string;
62
- exceeding?: boolean;
63
- }
64
-
65
- interface TokenWithPrice extends Token {
66
- price: number;
67
- }
68
-
69
- interface BalanceToken extends Token {
70
- balance: {
71
- /**
72
- * This is the string representation of the balance in wei.
73
- *
74
- * It can be safely parsed to a bigint, but we're returning it as a string to avoid serialization issues.
75
- *
76
- * @example "1200000000000000000"
77
- */
78
- raw: string;
79
- /**
80
- * This is the formatted representation of the balance in the token's decimals.
81
- *
82
- * @example "1.2"
83
- */
84
- formatted: string;
85
- };
86
- /**
87
- * Price of the token in USD.
88
- */
89
- price?: number;
90
- /**
91
- * Balance value in USD.
92
- * Calculated as balance * price.
93
- */
94
- usdValue?: number;
95
- }
96
-
97
- interface SwapRequest {
98
- tokenIn: Address;
99
- tokenOut: Address;
100
- tokenInDecimals: number;
101
- tokenOutDecimals: number;
102
- amount: string;
103
- wberaIsBera: boolean;
104
- swapKind: SwapKind;
105
- }
106
-
107
- /**
108
- * Object with properties to check the allowance of a token.
109
- */
110
- interface AllowanceQueryItem {
111
- token: MinimalERC20;
112
- /**
113
- * The amount of the token to approve.
114
- */
115
- amount: {
116
- raw: string;
117
- formatted: string;
118
- };
119
- /**
120
- * The address to approve the tokens to.
121
- */
122
- spender: Address;
123
- }
124
-
125
- interface AllowanceToken extends AllowanceQueryItem {
126
- /**
127
- * The current allowance of the token.
128
- */
129
- allowance: {
130
- raw: string;
131
- formatted: string;
132
- };
133
- /**
134
- * Whether the allowance is needed to perform the transaction.
135
- */
136
- needsApproval: boolean;
137
- }
138
-
139
- interface IUserPosition {
140
- lpBalance?: BalanceToken;
141
- tokenBalances?: Omit<BalanceToken, "chainId">[];
142
- userSharePercentage?: number;
143
- stakedBalance?: Pick<BalanceToken, "address" | "balance" | "usdValue">;
144
- /**
145
- * Just a utility to detect if there is a price for the LP token.
146
- */
147
- lpTokenPrice?: number;
148
- }
149
- type BexStatus = {
150
- protocol: {
151
- /**
152
- * If the whole protocol is paused (i.e. ~the~ vault contract) disable any functionality except withdrawing proportional
153
- * liquidity (provided that pool's recovery mode is enabled). Specifically we disable swaps and pool creation.
154
- */
155
- isPaused: boolean;
156
- };
157
- /**
158
- * Pool is undefined if pool status is still loading if no pool address was provided.
159
- */
160
- pool?: {
161
- /**
162
- * Pool should be put into recovery mode if tx are reverting on-chain to do with fee computation or pool exits.
163
- * It reduces the computation needed to withdraw liquidity and does not charge protocol fees on exits while enabled.
164
- *
165
- * NOTE: that you can potentially still do regular exits/joins/etc in recovery mode, but if the flag is true will only
166
- * present the safe exit option to the user in FE.
167
- */
168
- isInRecoveryMode: boolean;
169
- /**
170
- * If the pool is paused you cannot do anything unless you also enable recovery mode (then you can withdraw safely).
171
- */
172
- isPaused: boolean;
173
- /**
174
- * Disable withdrawals for a pool due to a combination of pool and vault statuses.
175
- */
176
- disablePoolWithdrawals: boolean;
177
- /**
178
- * Disable deposits for a pool due to a combination of pool and vault statuses.
179
- */
180
- disablePoolDeposits: boolean;
181
- };
182
- };
183
-
184
- type IAggregatorArgs = {
185
- tokenIn: MinimalERC20;
186
- tokenOut: MinimalERC20;
187
- /**
188
- * Amount of tokenIn to swap in wei.
189
- */
190
- amount: string;
191
- slippage: number;
192
- account?: Address;
193
- publicClient?: PublicClient;
194
- aggregatorsFeeBps?: number;
195
- proxyAggregatorsThroughVercel?: boolean;
196
- referrer?: SwapReferrer;
197
- /**
198
- * If provided, the aggregator will swap to the underlying token and deposit it into the vault (tokenOut).
199
- *
200
- * The aggregator won't check if the tokenOut is an ERC4626 vault, so this needs to be asserted by the caller.
201
- * This is used for Staked BERA/iBera and Bend Vaults.
202
- */
203
- underlyingToken?: MinimalERC20 | null;
204
- /**
205
- * If provided, the aggregator will stake into the reward vault after the swap.
206
- */
207
- rewardVault?: Address;
208
- /**
209
- * Only needed by the honey mint/redeem aggregator.
210
- */
211
- honeyNativeState?: Pick<HoneyConfigContextReturn, "collateralList">;
212
- };
213
-
214
- type Calldata = {
215
- params?: readonly unknown[] | undefined;
216
- functionName?: string;
217
- abi?: Abi;
218
- address: Address;
219
- data?: Hex;
220
- value: bigint;
221
- gasLimit?: bigint;
222
- };
223
-
224
- type IRawAggregatorQuote = {
225
- amountOut: string;
226
- amountIn: string;
227
- name: Aggregators;
228
- allowanceRequirements: AllowanceQueryItem[];
229
- /**
230
- * True if it's bera wrap/unwrap or bgt redeem.
231
- */
232
- isNativeSwap?: boolean;
233
- priceImpactPercentage?: number | null;
234
- swapFeeBps: number;
235
- getCalldata?: ({ account }: { account: Address }) => Calldata;
236
- };
237
-
238
- type IAggregatorQuote =
239
- // no need to force to swapAndStake as type check is done on each getQuote
240
- IRawAggregatorQuote & {
241
- amountOut: string;
242
- amountOutUsd: string;
243
- amountIn: string;
244
- amountInUsd: string;
245
- priceImpactPercentage: number;
246
- exchangeRate: number;
247
- relativeLossPercentage: number;
248
- isBest?: boolean;
249
- };
250
-
251
- /**
252
- * Interface representing the latest Pyth price updates
253
- * @interface PythLatestUpdates
254
- * @property {`0x${string}`[]} calldata - Array of hex-encoded calldata for price updates
255
- * @property {string[]} prices - Array of formatted price strings
256
- */
257
- interface PythLatestUpdates {
258
- calldata: `0x${string}`[];
259
- prices: string[];
260
- }
261
- /**
262
- * Fetches the latest price updates from Pyth Network's Hermes service
263
- * @param {Object} params - The parameters object
264
- * @param {string[]} params.priceFeedId - Array of Pyth price feed IDs to fetch updates for
265
- * @returns {Promise<PythLatestUpdates>} Promise resolving to the latest price updates
266
- * @example
267
- * ```ts
268
- * const updates = await getPythLatestPrices({
269
- * priceFeedId: ["0x123...", "0x456..."]
270
- * });
271
- * ```
272
- */
273
- declare function getPythLatestPrices({ priceFeedId, }: {
274
- priceFeedId: string[];
275
- }): Promise<PythLatestUpdates>;
276
-
277
- declare enum HoneyPreviewMethod {
278
- Mint = "previewMintHoney",
279
- MintWithPrice = "previewMintHoneyWithPrices",
280
- RequiredCollateral = "previewMintCollaterals",
281
- RequiredCollateralWithPrice = "previewMintCollateralsWithPrices",
282
- Redeem = "previewRedeemCollaterals",
283
- RedeemWithPrice = "previewRedeemCollateralsWithPrices",
284
- HoneyToRedeem = "previewRedeemHoney",
285
- HoneyToRedeemWithPrice = "previewRedeemHoneyWithPrices"
286
- }
287
- interface HoneyPreviewArgs extends BeraJS.BaseFunctionArgs {
288
- client: PublicClient;
289
- collateral: Token;
290
- collateralList: TokenWithOrder[];
291
- amount: string;
292
- method: HoneyPreviewMethod;
293
- latestPrices?: PythLatestUpdates;
294
- isPythWrapperEnabled: boolean;
295
- }
296
- interface HoneyPreviewResult {
297
- collaterals: Record<Address, bigint>;
298
- honey: bigint;
299
- }
300
- interface HoneyPreviewReadResult {
301
- collaterals: bigint[];
302
- honey: bigint;
303
- }
304
- /**
305
- * Calculates preview amounts for Honey protocol operations including minting and redeeming.
306
- * This function handles different preview methods to calculate either the amount of Honey tokens
307
- * that can be minted with given collateral or the amount of collateral needed to mint/redeem Honey tokens.
308
- *
309
- * @param {Object} params - The parameters for the preview calculation
310
- * @param {PublicClient} params.client - The Viem public client for blockchain interaction
311
- * @param {Token} params.collateral - The primary collateral token being used
312
- * @param {Address[]} params.collateralList - List of all supported collateral tokens
313
- * @param {string} params.amount - The amount to calculate preview for (in token units)
314
- * @param {HoneyPreviewMethod} params.method - The type of preview calculation to perform
315
- * @param {PythLatestUpdates | undefined} params.latestPrices - Optional latest price updates from Pyth oracle
316
- *
317
- * @returns {Promise<HoneyPreviewResult | undefined>} An object containing:
318
- * - collaterals: Record mapping collateral token addresses to their respective amounts
319
- * - honey: The amount of Honey tokens involved in the operation
320
- *
321
- * @throws {Error} If there's an error during the contract interaction or calculation
322
- */
323
- declare function getHoneyPreview({ client, collateral, collateralList, amount, method, latestPrices, isPythWrapperEnabled, ...baseArgs }: HoneyPreviewArgs): Promise<HoneyPreviewResult | undefined>;
324
-
325
- type PythPriceFeedMap = Record<Address, Hex>;
326
-
327
- type HoneySwapActions =
328
- | { type: HoneySwapAction.RESET_AMOUNTS }
329
- | { type: HoneySwapAction.ACTION_TYPE_CHANGE; value: "mint" | "redeem" }
330
- | { type: HoneySwapAction.COLLATERALS_CHANGE; value: TokenWithOrder[] }
331
- | { type: HoneySwapAction.FROM_AMOUNT_CHANGE; index: number; value: string }
332
- | { type: HoneySwapAction.TO_AMOUNT_CHANGE; index: number; value: string }
333
- | {
334
- type: HoneySwapAction.PREVIEW_CHANGE;
335
- value: HoneyPreviewResult;
336
- changedAsset: Address;
337
- }
338
- | { type: HoneySwapAction.IS_BASKET_MODE_ENABLED_CHANGE; value: boolean }
339
- | { type: HoneySwapAction.IS_TYPING_CHANGE; value: boolean }
340
- | { type: HoneySwapAction.IS_SUBMITTING_CHANGE; value: boolean }
341
- | { type: HoneySwapAction.IS_LOADING_CHANGE; value: boolean };
342
-
343
- declare const HoneyConfigContext: react.Context<HoneyConfigContextReturn | undefined>;
344
- type TokenWithOrder = TokenWithMetadata & {
345
- order: number;
346
- };
347
- interface HoneyConfigContextReturn {
348
- /**
349
- * Map of the Pyth price feed ids for each collateral
350
- */
351
- priceFeedMap: PythPriceFeedMap;
352
- /**
353
- * This is the list of all the collaterals that are supported by the Honey protocol
354
- */
355
- collateralList: TokenWithOrder[];
356
- /**
357
- * This is the main collateral that is used to calculate the relative cap limit
358
- */
359
- referenceCollateral: TokenWithOrder;
360
- /**
361
- * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode
362
- */
363
- feeMap: HoneyFeeMap;
364
- flags: {
365
- /**
366
- * If true, mint/redeem will also update pyth prices
367
- */
368
- isPythWrapperEnabled: boolean;
369
- };
370
- /**
371
- * Honey protocol configs
372
- */
373
- protocol: {
374
- /**
375
- * Honey protocol paused state
376
- */
377
- isPaused: boolean;
378
- /**
379
- * The label for the Honey protocol paused message
380
- */
381
- pausedBannerLabel?: string;
382
- };
383
- }
384
- interface HoneyConfigProviderProps extends HoneyConfigContextReturn {
385
- children: React.ReactNode;
386
- }
387
- declare function HoneyConfigProvider({ children, ...props }: HoneyConfigProviderProps): react_jsx_runtime.JSX.Element;
388
- declare function useHoneyConfig(): HoneyConfigContextReturn;
389
-
390
- export { type AllowanceQueryItem as A, type BalanceToken as B, type CollateralRates as C, type TokenWithPrice as D, type HoneySwapActions as H, type IAggregatorArgs as I, type MinimalERC20 as M, type PythLatestUpdates as P, type SwapRequest as S, type TokenWithOrder as T, type TokenWithMetadata as a, type Token as b, HoneyConfigContext as c, type HoneyConfigContextReturn as d, HoneyConfigProvider as e, type HoneyConfigProviderProps as f, type IRawAggregatorQuote as g, type PythPriceFeedMap as h, type TokenCurrentPriceMap as i, type AllowanceToken as j, type CollateralRatesArgs as k, type HoneyFeeMap as l, type HoneyPreviewArgs as m, HoneyPreviewMethod as n, type HoneyPreviewReadResult as o, type HoneyPreviewResult as p, getHoneyFees as q, getHoneyPreview as r, getPythLatestPrices as s, type TokenWithAmount as t, useHoneyConfig as u, type IUserPosition as v, type Calldata as w, type TokenPriceInfo as x, type BexStatus as y, type IAggregatorQuote as z };
@@ -1,144 +0,0 @@
1
- import { ErrorLike } from '@apollo/client';
2
- import { B as BeraError, I as IBeraErrorArgs } from './BeraError-_mQdkanr.cjs';
3
-
4
- interface EventsMap {
5
- [event: string]: any;
6
- }
7
- interface DefaultEvents extends EventsMap {
8
- [event: string]: (...args: any) => void;
9
- }
10
- type Unsubscribe = () => void;
11
- /**
12
- * An interface for mixins that expose the `on` function (without the emitter
13
- * bound to `this`)
14
- *
15
- * ```js
16
- * import { createEmitter } from '~utils/createEmitter'
17
- *
18
- * class Ticker implements EmitterMixin<Events> {
19
- * constructor() {
20
- * this.emitter = createEmitter()
21
- * }
22
- * on(...args) {
23
- * return this.emitter.on(...args)
24
- * }
25
- * tick() {
26
- * this.emitter.emit('tick')
27
- * }
28
- * }
29
- * ```
30
- */
31
- interface EmitterMixin<Events extends EventsMap = DefaultEvents> {
32
- on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;
33
- }
34
-
35
- /**
36
- * Span context passed to tracing handlers.
37
- * Compatible with Sentry's StartSpanOptions (name, op, attributes).
38
- */
39
- type SpanContext = {
40
- name: string;
41
- op: string;
42
- attributes: Record<string, string | number | boolean | undefined>;
43
- };
44
- /**
45
- * A function that wraps a callback in a tracing span.
46
- * Compatible with Sentry.startSpan's signature.
47
- */
48
- type StartSpanFn = <T>(context: SpanContext, callback: () => Promise<T>) => Promise<T>;
49
- /**
50
- * A generic span-tracing module for berajs.
51
- *
52
- * Instead of calling Sentry.startSpan directly, berajs calls
53
- * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on("span", handler)`
54
- * and forward spans to their tracing provider (Sentry, Datadog, etc.).
55
- *
56
- * Multiple handlers are supported and chain in registration order:
57
- * the first registered handler is the outermost wrapper.
58
- *
59
- * @example
60
- * ```ts
61
- * // In berajs code:
62
- * import { BeraTracing } from "./BeraTracing";
63
- * const result = await BeraTracing.startSpan(
64
- * { name: "GraphQL query", op: "graphql.query", attributes: {} },
65
- * () => executeQuery(),
66
- * );
67
- *
68
- * // In app instrumentation:
69
- * import { BeraTracing } from "@berachain/berajs/errors";
70
- * BeraTracing.addSpanHandler(Sentry.startSpan);
71
- * ```
72
- */
73
- declare const BeraTracing: {
74
- /**
75
- * Execute a callback, wrapping it in all registered span handlers.
76
- *
77
- * Handlers chain so each wraps the next. First registered = outermost wrapper.
78
- * If no handlers are registered, the callback is executed directly.
79
- */
80
- startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T>;
81
- /**
82
- * Register a span tracing handler.
83
- *
84
- * @param _event - Must be "span". Exists for API consistency with BeraMonitoring.
85
- * @param handler - A StartSpanFn, e.g. Sentry.startSpan.
86
- * @returns An unsubscribe function to remove the handler.
87
- */
88
- addSpanHandler(handler: StartSpanFn): Unsubscribe;
89
- };
90
-
91
- /**
92
- * This is an error class that should be used to handle errors from fetch requests.
93
- */
94
- declare class RequestError extends BeraError {
95
- /**
96
- * The error response from the request.
97
- */
98
- response: Response | ErrorLike | undefined;
99
- static isCorsError(error: Error): boolean;
100
- /**
101
- * The endpoint that was requested.
102
- */
103
- endpoint: {
104
- name?: string;
105
- url: string;
106
- type?: "rest" | "graphql" | "rpc";
107
- };
108
- /**
109
- * A list of domains that should have their query params removed.
110
- */
111
- private queryRichfulDomains;
112
- statusCode: number | undefined;
113
- payload?: object;
114
- static readonly REASON_MAP: {
115
- readonly 429: "RATE_LIMITED_429";
116
- readonly NETWORK_ERROR: "NETWORK_ERROR";
117
- readonly CORS_ERROR: "CORS";
118
- };
119
- constructor(args: IBeraErrorArgs & {
120
- response: Response | ErrorLike | undefined;
121
- /**
122
- * The payload sent to the request.
123
- */
124
- payload?: object;
125
- endpoint: string | URL | {
126
- name?: string;
127
- url: string | URL;
128
- type: "rest" | "graphql" | "rpc";
129
- };
130
- statusCode?: number;
131
- });
132
- setEndpoint(endpoint: string | URL | {
133
- name?: string;
134
- url: string | URL;
135
- type?: "rest" | "graphql" | "rpc";
136
- }): {
137
- name?: string;
138
- url: string;
139
- type?: "rest" | "graphql" | "rpc";
140
- };
141
- private tryMatchNetworkError;
142
- }
143
-
144
- export { BeraTracing as B, type EmitterMixin as E, RequestError as R, type SpanContext as S };