@berachain/berajs 0.2.8-beta.6 → 0.2.8-beta.8

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 (173) hide show
  1. package/dist/abi/exports.cjs +4452 -1
  2. package/dist/abi/exports.cjs.map +1 -1
  3. package/dist/abi/exports.mjs +4452 -1
  4. package/dist/abi/exports.mjs.map +1 -1
  5. package/dist/actions/exports.cjs +913 -1
  6. package/dist/actions/exports.cjs.map +1 -1
  7. package/dist/actions/exports.d.cts +95 -50
  8. package/dist/actions/exports.d.ts +95 -50
  9. package/dist/actions/exports.mjs +913 -1
  10. package/dist/actions/exports.mjs.map +1 -1
  11. package/dist/chunk-2R73G2PO.mjs +4698 -0
  12. package/dist/chunk-2R73G2PO.mjs.map +1 -0
  13. package/dist/chunk-3M47ZRXT.mjs +417 -0
  14. package/dist/{chunk-ESAVA5OD.mjs.map → chunk-3M47ZRXT.mjs.map} +1 -1
  15. package/dist/chunk-4GFN4LEP.mjs +97 -0
  16. package/dist/{chunk-5W7UKRHX.mjs.map → chunk-4GFN4LEP.mjs.map} +1 -1
  17. package/dist/chunk-5N7QQS55.cjs +130 -0
  18. package/dist/chunk-5N7QQS55.cjs.map +1 -0
  19. package/dist/chunk-5NMATIH4.mjs +130 -0
  20. package/dist/{chunk-SSPFPAWX.mjs.map → chunk-5NMATIH4.mjs.map} +1 -1
  21. package/dist/chunk-7QKRRIHI.mjs +1844 -0
  22. package/dist/{chunk-RSDCKN4Q.mjs.map → chunk-7QKRRIHI.mjs.map} +1 -1
  23. package/dist/chunk-7TFV6UKF.mjs +24 -0
  24. package/dist/{chunk-MK5NS5B5.mjs.map → chunk-7TFV6UKF.mjs.map} +1 -1
  25. package/dist/chunk-A4FPM7U3.cjs +63 -0
  26. package/dist/chunk-A4FPM7U3.cjs.map +1 -0
  27. package/dist/chunk-BDHINMWQ.cjs +417 -0
  28. package/dist/chunk-BDHINMWQ.cjs.map +1 -0
  29. package/dist/chunk-BEHP54S3.cjs +24 -0
  30. package/dist/chunk-BEHP54S3.cjs.map +1 -0
  31. package/dist/chunk-EGDXV2PT.cjs +36 -0
  32. package/dist/chunk-EGDXV2PT.cjs.map +1 -0
  33. package/dist/chunk-EWBKSMPG.cjs +13 -0
  34. package/dist/chunk-EWBKSMPG.cjs.map +1 -0
  35. package/dist/chunk-F6ZW7ZDD.cjs +403 -0
  36. package/dist/chunk-F6ZW7ZDD.cjs.map +1 -0
  37. package/dist/chunk-FTXTRUYT.cjs +170 -0
  38. package/dist/chunk-FTXTRUYT.cjs.map +1 -0
  39. package/dist/chunk-GLWPRM33.mjs +13 -0
  40. package/dist/{chunk-575OK77P.mjs.map → chunk-GLWPRM33.mjs.map} +1 -1
  41. package/dist/chunk-GWSTVITN.mjs +572 -0
  42. package/dist/{chunk-NLVWRMGD.mjs.map → chunk-GWSTVITN.mjs.map} +1 -1
  43. package/dist/chunk-H3Z37RYU.cjs +15 -0
  44. package/dist/chunk-H3Z37RYU.cjs.map +1 -0
  45. package/dist/chunk-I3FTWD6I.mjs +170 -0
  46. package/dist/{chunk-T5FSQ3YE.mjs.map → chunk-I3FTWD6I.mjs.map} +1 -1
  47. package/dist/chunk-JA4DHMTG.mjs +15 -0
  48. package/dist/{chunk-OGBD5YOG.mjs.map → chunk-JA4DHMTG.mjs.map} +1 -1
  49. package/dist/chunk-KL6YZ5VR.mjs +63 -0
  50. package/dist/{chunk-OGJMSGB2.mjs.map → chunk-KL6YZ5VR.mjs.map} +1 -1
  51. package/dist/chunk-MXWPP6MS.cjs +572 -0
  52. package/dist/chunk-MXWPP6MS.cjs.map +1 -0
  53. package/dist/chunk-SGZP4O6R.mjs +135 -0
  54. package/dist/{chunk-G4CNETLS.mjs.map → chunk-SGZP4O6R.mjs.map} +1 -1
  55. package/dist/chunk-TDW5SPXR.cjs +244 -0
  56. package/dist/chunk-TDW5SPXR.cjs.map +1 -0
  57. package/dist/chunk-TGK3IXDN.cjs +169 -0
  58. package/dist/chunk-TGK3IXDN.cjs.map +1 -0
  59. package/dist/chunk-TJEW6YCJ.cjs +97 -0
  60. package/dist/chunk-TJEW6YCJ.cjs.map +1 -0
  61. package/dist/chunk-VA3BQ34H.mjs +403 -0
  62. package/dist/{chunk-S5VOCVBR.mjs.map → chunk-VA3BQ34H.mjs.map} +1 -1
  63. package/dist/chunk-VA5L5FDG.mjs +36 -0
  64. package/dist/{chunk-3MZ7MLKF.mjs.map → chunk-VA5L5FDG.mjs.map} +1 -1
  65. package/dist/chunk-XSGCRLSD.cjs +1844 -0
  66. package/dist/chunk-XSGCRLSD.cjs.map +1 -0
  67. package/dist/chunk-XV3GG3HC.cjs +135 -0
  68. package/dist/chunk-XV3GG3HC.cjs.map +1 -0
  69. package/dist/chunk-Y5B224UX.cjs +4698 -0
  70. package/dist/chunk-Y5B224UX.cjs.map +1 -0
  71. package/dist/chunk-ZBTRKBSI.mjs +169 -0
  72. package/dist/{chunk-CWKDFUFR.mjs.map → chunk-ZBTRKBSI.mjs.map} +1 -1
  73. package/dist/chunk-ZCEFC2TK.mjs +244 -0
  74. package/dist/{chunk-NAXAZJJY.mjs.map → chunk-ZCEFC2TK.mjs.map} +1 -1
  75. package/dist/contexts/exports.cjs +82 -1
  76. package/dist/contexts/exports.cjs.map +1 -1
  77. package/dist/contexts/exports.mjs +82 -1
  78. package/dist/contexts/exports.mjs.map +1 -1
  79. package/dist/enum/exports.cjs +58 -1
  80. package/dist/enum/exports.cjs.map +1 -1
  81. package/dist/enum/exports.d.cts +1 -1
  82. package/dist/enum/exports.d.ts +1 -1
  83. package/dist/enum/exports.mjs +58 -1
  84. package/dist/enum/exports.mjs.map +1 -1
  85. package/dist/errors/exports.cjs +38 -1
  86. package/dist/errors/exports.cjs.map +1 -1
  87. package/dist/errors/exports.mjs +38 -1
  88. package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts} +2 -2
  89. package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-Cql_D50j.d.cts} +2 -2
  90. package/dist/{global.d-SU9Epq0M.d.ts → global.d-5w_lvl2J.d.ts} +1 -1
  91. package/dist/{global.d-6aSWIkV_.d.cts → global.d-B7IeayVX.d.cts} +1 -1
  92. package/dist/hooks/exports.cjs +8332 -3
  93. package/dist/hooks/exports.cjs.map +1 -1
  94. package/dist/hooks/exports.d.cts +4 -4
  95. package/dist/hooks/exports.d.ts +4 -4
  96. package/dist/hooks/exports.mjs +8332 -3
  97. package/dist/hooks/exports.mjs.map +1 -1
  98. package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-7_o92X3N.d.cts} +2 -0
  99. package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-7_o92X3N.d.ts} +2 -0
  100. package/dist/types/exports.d.cts +2 -2
  101. package/dist/types/exports.d.ts +2 -2
  102. package/dist/utils/exports.cjs +786 -1
  103. package/dist/utils/exports.cjs.map +1 -1
  104. package/dist/utils/exports.mjs +786 -1
  105. package/dist/utils/exports.mjs.map +1 -1
  106. package/package.json +4 -4
  107. package/src/actions/clients/getApolloClient.ts +11 -4
  108. package/src/actions/dex/getOnChainPool.ts +1 -1
  109. package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
  110. package/src/actions/enso/util.ts +6 -8
  111. package/src/actions/governance/checkProposalField.ts +108 -54
  112. package/src/actions/governance/computeActualStatus.ts +7 -3
  113. package/src/actions/governance/getAllProposals.ts +15 -8
  114. package/src/actions/governance/getBodyErrors.ts +13 -5
  115. package/src/actions/governance/getDecodedFunctionData.ts +27 -19
  116. package/src/actions/governance/getProposalDetails.ts +8 -4
  117. package/src/actions/governance/getProposalFromTx.ts +19 -10
  118. package/src/actions/governance/getProposalParams.ts +17 -17
  119. package/src/actions/governance/getProposalVotes.ts +7 -3
  120. package/src/actions/governance/getQuorum.ts +7 -7
  121. package/src/actions/governance/parseProposalBody.ts +19 -9
  122. package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
  123. package/src/actions/tokens/getTokenInformation.ts +8 -15
  124. package/src/enum/txnEnum.ts +2 -0
  125. package/dist/chunk-3MZ7MLKF.mjs +0 -2
  126. package/dist/chunk-53TSJM6P.cjs +0 -2
  127. package/dist/chunk-53TSJM6P.cjs.map +0 -1
  128. package/dist/chunk-575OK77P.mjs +0 -2
  129. package/dist/chunk-5NDYN2IB.mjs +0 -4
  130. package/dist/chunk-5NDYN2IB.mjs.map +0 -1
  131. package/dist/chunk-5W7UKRHX.mjs +0 -2
  132. package/dist/chunk-7EAKCNQT.cjs +0 -2
  133. package/dist/chunk-7EAKCNQT.cjs.map +0 -1
  134. package/dist/chunk-CWKDFUFR.mjs +0 -2
  135. package/dist/chunk-DDEQFR3M.cjs +0 -2
  136. package/dist/chunk-DDEQFR3M.cjs.map +0 -1
  137. package/dist/chunk-DKY4QPWU.cjs +0 -2
  138. package/dist/chunk-DKY4QPWU.cjs.map +0 -1
  139. package/dist/chunk-DTBJO6VT.cjs +0 -2
  140. package/dist/chunk-DTBJO6VT.cjs.map +0 -1
  141. package/dist/chunk-E32UP4GV.cjs +0 -2
  142. package/dist/chunk-E32UP4GV.cjs.map +0 -1
  143. package/dist/chunk-ESAVA5OD.mjs +0 -2
  144. package/dist/chunk-G4CNETLS.mjs +0 -2
  145. package/dist/chunk-I7M43BB4.cjs +0 -2
  146. package/dist/chunk-I7M43BB4.cjs.map +0 -1
  147. package/dist/chunk-KT6L4K4K.cjs +0 -2
  148. package/dist/chunk-KT6L4K4K.cjs.map +0 -1
  149. package/dist/chunk-MK5NS5B5.mjs +0 -2
  150. package/dist/chunk-NAXAZJJY.mjs +0 -2
  151. package/dist/chunk-NLVWRMGD.mjs +0 -2
  152. package/dist/chunk-OGBD5YOG.mjs +0 -2
  153. package/dist/chunk-OGJMSGB2.mjs +0 -2
  154. package/dist/chunk-OIYXOKTT.cjs +0 -2
  155. package/dist/chunk-OIYXOKTT.cjs.map +0 -1
  156. package/dist/chunk-OUD27MU7.cjs +0 -2
  157. package/dist/chunk-OUD27MU7.cjs.map +0 -1
  158. package/dist/chunk-QFLDL4UV.cjs +0 -2
  159. package/dist/chunk-QFLDL4UV.cjs.map +0 -1
  160. package/dist/chunk-RSDCKN4Q.mjs +0 -2
  161. package/dist/chunk-RWOICHRW.cjs +0 -2
  162. package/dist/chunk-RWOICHRW.cjs.map +0 -1
  163. package/dist/chunk-S5VOCVBR.mjs +0 -2
  164. package/dist/chunk-SSPFPAWX.mjs +0 -2
  165. package/dist/chunk-T5FSQ3YE.mjs +0 -2
  166. package/dist/chunk-WD4B3SXS.cjs +0 -4
  167. package/dist/chunk-WD4B3SXS.cjs.map +0 -1
  168. package/dist/chunk-WRFDB3QJ.cjs +0 -2
  169. package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
  170. package/dist/chunk-XNJLSA6P.cjs +0 -2
  171. package/dist/chunk-XNJLSA6P.cjs.map +0 -1
  172. package/dist/chunk-ZYXVUXFQ.cjs +0 -2
  173. package/dist/chunk-ZYXVUXFQ.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts"],"names":["getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","getPoolState","apiPool","mapPoolType","pt","getVaultPausedState","args","config","parseBaseArgs","balancerVaultAbi","isProxyABI","abi","item","_getAbi","contractAddress","chainId","url","appConfig"],"mappings":"AAAA,+1BAAwvB,yDAA2D,iCAA8B,yDAA+D,yDAAiD,iCAA8B,iCAA8B,iCAA8B,yDAAwD,iCAA8B,4BCApjC,8EAEX,MAOlD,SAAsBA,EAAAA,CAAc,CAClC,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CAAwC,CACtC,IAAMC,CAAAA,CAAa,MAAMD,C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gBACjC,CACF,CAKA,MAAA,SAAeC,CAAAA,CAAQ,CACrB,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAAlB,CACF,CAAA,CAIG,CACD,IAAMmB,CAAAA,CAAM,CAAA,sEAAA,EAAyEF,CAAe,CAAA,QAAA,EAAWG,mBAAAA,CAAU,OAAA,CAAQ,OAAA,CAAQ,SAAS,CAAA,SAAA,EAAYF,CAAO,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","sourcesContent":[null,"import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoV11Abi as metaMorphoAbi } from \"@berachain/abis/bend-metamorpho/metaMorphoV11\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi[]): boolean {\n return abi.some(\n (item: any) =>\n item.name === \"implementation\" ||\n item.name === \"proxyType\" ||\n (item.type === \"constructor\" &&\n item.inputs?.[0]?.name === \"implementation\"),\n );\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n\n return _getAbi({ contractAddress: address, chainId, publicClient }).catch(\n () => undefined,\n );\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * This function attempts to decode the provided calldata using a known set of ABIs.\n * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.\n *\n * @param address - The contract address.\n * @param callData - The calldata to decode, in hexadecimal format.\n * @returns An object containing the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n chainId?: number;\n publicClient: PublicClient;\n}) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n"]}
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts","../../src/actions/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/aggregateValidatorIncentives.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"names":["honeyFactoryAbi","rewardVaultAbi","rewardVaultFactoryAbi","beraChefAbi"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACA;AAC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;AACzB,MAAA;AACM,MAAA;AACT,IAAA;AACC,IAAA;AACH,EAAA;AACF;AV8XwK;AACA;AWhczI;AXkcyI;AACA;AYnclI;AZqckI;AACA;AaxcrI;AACjC,EAAA;AACU,IAAA;AAC2D,MAAA;AACjE,MAAA;AACgB,QAAA;AACR,QAAA;AACA,QAAA;AACR,MAAA;AACF,IAAA;AACiB,IAAA;AACX,IAAA;AACR,EAAA;AACgE,EAAA;AACL,EAAA;AACT,EAAA;AAClD,EAAA;AACa,IAAA;AACH,IAAA;AACN,MAAA;AACW,QAAA;AACK,QAAA;AACR,QAAA;AACA,QAAA;AACR,MAAA;AACA,MAAA;AACW,QAAA;AACK,QAAA;AACR,QAAA;AACA,QAAA;AACR,MAAA;AACF,IAAA;AACM,IAAA;AACA,IAAA;AACR,EAAA;AACA,EAAA;AACa,IAAA;AACH,IAAA;AACN,MAAA;AACW,QAAA;AACK,QAAA;AACR,QAAA;AACA,QAAA;AACR,MAAA;AACF,IAAA;AACM,IAAA;AACA,IAAA;AACR,EAAA;AACA,EAAA;AACW,IAAA;AACH,IAAA;AACgE,IAAA;AACrD,IAAA;AACX,IAAA;AACR,EAAA;AACA,EAAA;AACW,IAAA;AACH,IAAA;AACgE,IAAA;AACrD,IAAA;AACX,IAAA;AACR,EAAA;AACA,EAAA;AACW,IAAA;AACH,IAAA;AACI,IAAA;AACO,IAAA;AACX,IAAA;AACR,EAAA;AACA,EAAA;AACyE,IAAA;AACjE,IAAA;AACI,IAAA;AACO,IAAA;AACX,IAAA;AACR,EAAA;AACA,EAAA;AACU,IAAA;AACgE,MAAA;AACxE,IAAA;AACM,IAAA;AACI,IAAA;AACO,IAAA;AACX,IAAA;AACR,EAAA;AACF;Ab0cwK;AACA;AYrhB/G;AACvD,EAAA;AACG,EAAA;AAGgB;AACkB,EAAA;AACH,EAAA;AACQ,EAAA;AACQ,EAAA;AAGH,EAAA;AACpC,IAAA;AACJ,IAAA;AACS,IAAA;AACf,EAAA;AAGgC,EAAA;AACt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,MAAA;AAEjC,IAAA;AAEyB,IAAA;AACpC,EAAA;AACN;AAEqC;AACnC,EAAA;AACA,EAAA;AAOS;AAC0B,EAAA;AACW,qCAAA;AAC9C,EAAA;AAEuD,EAAA;AAEL,EAAA;AAGzC,IAAA;AACT,EAAA;AAMgC,EAAA;AAEzB,EAAA;AACT;AnByuBwK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","sourcesContent":[null,"import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoV11Abi as metaMorphoAbi } from \"@berachain/abis/bend-metamorpho/metaMorphoV11\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi): boolean {\n return abi.some((item: AbiItem) => {\n const i = item as {\n name?: string;\n type: string;\n inputs?: readonly { name?: string }[];\n };\n return (\n i.name === \"implementation\" ||\n i.name === \"proxyType\" ||\n (i.type === \"constructor\" && i.inputs?.[0]?.name === \"implementation\")\n );\n });\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n\n return _getAbi({ contractAddress: address, chainId, publicClient }).catch(\n () => undefined,\n );\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\nexport interface GetDecodedFunctionDataArgs {\n /** Contract address that emitted the calldata */\n address: Address;\n /** Raw calldata to decode */\n callData: `0x${string}`;\n /** @default defaultChainId */\n chainId?: number;\n publicClient: PublicClient;\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * Attempts to decode using a known set of ABIs first, then falls back to\n * fetching the ABI from the block-explorer API.\n *\n * @returns An object with the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: GetDecodedFunctionDataArgs) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n","import { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"@berachain/abis/honey/honey\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rootPriceOracleAbi as honeyRootOracleAbi } from \"@berachain/abis/extras/rootPriceOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import type { PublicClient } from \"viem\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"../../utils/time\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n publicClient,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n publicClient: PublicClient | undefined;\n} & BeraJS.BaseFunctionArgs): Promise<number> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs(args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const currentBlock = await publicClient?.getBlock({ blockTag: \"latest\" });\n const oldestBlock = await publicClient?.getBlock({\n blockNumber: currentBlock.number - BigInt(span),\n });\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(oldestBlock?.timestamp)) /\n (Number(currentBlock?.number) - Number(oldestBlock?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"@berachain/abis/pol/lst/lstStakerVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { TokenWithMetadata } from \"../../types/dex\";\nimport type { StakingConfig } from \"../../types/staking\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { upgradableBeaconAbi } from \"../../abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"@berachain/abis/extras/pythPriceOracle\";\n\nimport type { PythPriceFeedMap } from \"../../types/honeySwap\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"../../types/dex\";\nimport { beraFetchJson } from \"../../utils/beraFetch\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type {\n ApiMinimalVaultIncentiveFragment,\n ApiValidatorRewardAllocationWeightFragment,\n} from \"@berachain/graphql/pol/api\";\nimport BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\nexport function aggregateValidatorIncentives({\n rewardAllocationWeights,\n activeOnly = true,\n}: {\n rewardAllocationWeights: ApiValidatorRewardAllocationWeightFragment[];\n activeOnly?: boolean;\n}): ApiMinimalVaultIncentiveFragment[] {\n const map = rewardAllocationWeights\n .filter((x) => x?.receivingVault)\n\n .reduce((acc, rv) => {\n for (const incentive of rv.receivingVault?.activeIncentives ?? []) {\n if (activeOnly && incentive.remainingAmount === \"0\") {\n continue;\n }\n const incentiveRate = new BigNumber(incentive.incentiveRate).times(\n rv.percentage,\n );\n\n const incentiveRateUsd = new BigNumber(\n incentive.incentiveRateUsd,\n ).times(rv.percentage);\n\n const token = incentive.token.address.toLowerCase();\n\n const existing = acc.get(token);\n if (existing) {\n acc.set(token, {\n ...existing,\n incentiveRate: new BigNumber(existing.incentiveRate)\n .plus(incentiveRate)\n .toString(),\n incentiveRateUsd: new BigNumber(existing.incentiveRateUsd)\n .plus(incentiveRateUsd)\n .toString(),\n remainingAmount: new BigNumber(existing.remainingAmount)\n .plus(incentive.remainingAmount)\n .toString(),\n remainingAmountUsd: new BigNumber(existing.remainingAmountUsd)\n .plus(incentive.remainingAmountUsd)\n .toString(),\n });\n } else {\n acc.set(token, {\n ...incentive,\n tokenAddress: incentive.token.address,\n token: incentive.token,\n incentiveRate: incentiveRate.toString(),\n incentiveRateUsd: incentiveRateUsd.toString(),\n remainingAmount: incentive.remainingAmount,\n });\n }\n }\n return acc;\n }, new Map<string, ApiMinimalVaultIncentiveFragment>());\n\n return Array.from(map.values());\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-BQXkSFd9.cjs';
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-BQXkSFd9.cjs';
1
+ import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-Cql_D50j.cjs';
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-Cql_D50j.cjs';
3
3
  import { Address, PublicClient, AbiParameter, AbiFunction, TransactionReceipt, Abi, ContractFunctionArgs, ContractFunctionName, WalletCallReceipt } from 'viem';
4
4
  import { ApolloClient, OperationVariables, FetchPolicy } from '@apollo/client';
5
5
  export { gql } from '@apollo/client';
@@ -9,9 +9,9 @@ export { BalancerApi } from '@berachain-foundation/berancer-sdk';
9
9
  import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
10
10
  import { GetPoolsQueryVariables, GetGlobalLiquidityAndSwapVolumeQuery, GetPoolEventsQuery, GqlChain, PoolHistoricalDataFragment, MinimalPoolFragment } from '@berachain/graphql/dex/api';
11
11
  import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment, ApiValidatorRewardAllocationWeightFragment, ApiMinimalVaultIncentiveFragment } from '@berachain/graphql/pol/api';
12
- import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-CCuQUFlh.cjs';
12
+ import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N.cjs';
13
13
  import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
14
- import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-6aSWIkV_.cjs';
14
+ import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-B7IeayVX.cjs';
15
15
  import graymatter from 'gray-matter';
16
16
  import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
17
17
  import { b as Token, P as PythLatestUpdates, a as TokenWithMetadata, T as TokenWithOrder, h as PythPriceFeedMap, i as TokenCurrentPriceMap, A as AllowanceQueryItem, j as AllowanceToken, M as MinimalERC20, B as BalanceToken } from '../HoneyConfigProvider-DfkjmzEf.cjs';
@@ -20,7 +20,7 @@ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
20
20
  import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
21
21
  import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
22
22
  import { I as IHoneySwapState } from '../useHoneySwapState-D6vpv19r.cjs';
23
- import { Address as Address$1 } from '@berachain/config';
23
+ import { Address as Address$1, ChainId } from '@berachain/config';
24
24
  import { Config } from '@wagmi/core';
25
25
  import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
26
26
  import '@berachain/config/internal';
@@ -548,58 +548,82 @@ declare function getVaultPausedState({ publicClient, ...args }: BeraJS.BaseFunct
548
548
 
549
549
  type CheckProposalFieldResultMinimal = ProposalErrorCodes | null;
550
550
  type CheckProposalFieldResult = ProposalErrorCodes | null | CheckProposalFieldResultMinimal[] | Record<string, CheckProposalFieldResultMinimal>;
551
- interface CheckProposalField {
552
- (arg: {
553
- fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
554
- value: any;
555
- required?: boolean;
556
- baseUrl?: string;
557
- components?: readonly (AbiParameter | readonly AbiParameter[])[];
558
- }): CheckProposalFieldResultMinimal;
559
- (arg: {
560
- fieldOrType: "tuple[]" | "tuple";
561
- value: any;
562
- required?: boolean;
563
- baseUrl?: string;
564
- components?: readonly (AbiParameter | readonly AbiParameter[])[];
565
- }): CheckProposalFieldResult;
566
- }
567
- declare const checkProposalField: CheckProposalField;
551
+ /**
552
+ * Validates a single proposal field or ABI-typed value.
553
+ * Returns `null` if valid, or a `ProposalErrorCodes` value describing the problem.
554
+ */
555
+ declare function checkProposalField(arg: {
556
+ fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
557
+ value: unknown;
558
+ required?: boolean;
559
+ baseUrl?: string;
560
+ components?: readonly (AbiParameter | readonly AbiParameter[])[];
561
+ }): CheckProposalFieldResultMinimal;
562
+ /**
563
+ * For tuple/tuple[] types, may return nested error structures.
564
+ */
565
+ declare function checkProposalField(arg: {
566
+ fieldOrType: "tuple[]" | "tuple";
567
+ value: unknown;
568
+ required?: boolean;
569
+ baseUrl?: string;
570
+ components?: readonly (AbiParameter | readonly AbiParameter[])[];
571
+ }): CheckProposalFieldResult;
568
572
 
569
573
  declare const MOCKED_PROPOSAL_STATUSES: readonly ProposalStatus[];
570
- declare function computeActualStatus(proposal: ProposalSelectionFragment,
571
574
  /**
572
- * Value returned by the `state` function of the governance contract.
575
+ * Derives the effective `ProposalStatus` by reconciling subgraph data with the
576
+ * on-chain contract state. Falls back to subgraph timestamps when the on-chain
577
+ * state is unavailable.
573
578
  */
579
+ declare function computeActualStatus(
580
+ /** Subgraph proposal data */
581
+ proposal: ProposalSelectionFragment,
582
+ /** Value returned by the `state` function of the governance contract */
574
583
  proposalOnChainState?: ProposalState): ProposalStatus;
575
584
 
576
- declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: BeraJS.BaseFunctionArgs & {
577
- offset?: number;
585
+ type GetAllProposalsArgs = BeraJS.BaseFunctionArgs & {
586
+ /** Subgraph filter applied to the proposals query */
578
587
  where: Proposal_Filter;
588
+ /** Number of proposals to skip (for pagination) */
589
+ offset?: number;
590
+ /** Maximum proposals per page; must be ≤ 1000 */
579
591
  perPage?: number;
580
592
  orderBy?: Proposal_OrderBy;
581
593
  orderDirection?: OrderDirection;
594
+ /** Full-text search query; switches to the search endpoint when provided */
582
595
  text?: string;
583
- }): Promise<ProposalSelectionFragment[] | undefined>;
584
-
585
- declare const getBodyErrors: (proposal: CustomProposal, currentTopic: GovernanceTopic) => CustomProposalErrors;
596
+ };
597
+ /** Fetches a paginated list of governance proposals from the subgraph */
598
+ declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: GetAllProposalsArgs): Promise<ProposalSelectionFragment[] | undefined>;
599
+
600
+ interface GetBodyErrorsArgs {
601
+ /** The proposal to validate */
602
+ proposal: CustomProposal;
603
+ /** The current governance topic, used for forum link base URL validation */
604
+ currentTopic: GovernanceTopic;
605
+ }
606
+ /** Validates the body fields (title, description, forum link) of a proposal */
607
+ declare function getBodyErrors({ proposal, currentTopic, }: GetBodyErrorsArgs): CustomProposalErrors;
586
608
 
609
+ interface GetDecodedFunctionDataArgs {
610
+ /** Contract address that emitted the calldata */
611
+ address: Address;
612
+ /** Raw calldata to decode */
613
+ callData: `0x${string}`;
614
+ /** @default defaultChainId */
615
+ chainId?: number;
616
+ publicClient: PublicClient;
617
+ }
587
618
  /**
588
619
  * Decodes the function data from a given contract address and calldata.
589
620
  *
590
- * This function attempts to decode the provided calldata using a known set of ABIs.
591
- * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.
621
+ * Attempts to decode using a known set of ABIs first, then falls back to
622
+ * fetching the ABI from the block-explorer API.
592
623
  *
593
- * @param address - The contract address.
594
- * @param callData - The calldata to decode, in hexadecimal format.
595
- * @returns An object containing the decoded ABI item, function signature, function name, and arguments.
624
+ * @returns An object with the decoded ABI item, function signature, function name, and arguments.
596
625
  */
597
- declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: {
598
- address: Address;
599
- callData: `0x${string}`;
600
- chainId?: number;
601
- publicClient: PublicClient;
602
- }): Promise<{
626
+ declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: GetDecodedFunctionDataArgs): Promise<{
603
627
  args: never[];
604
628
  abiItem?: undefined;
605
629
  functionSignature?: undefined;
@@ -611,28 +635,49 @@ declare function getDecodedFunctionData({ address, callData, chainId, publicClie
611
635
  args: unknown[];
612
636
  }>;
613
637
 
614
- declare function getProposalDetails({ proposalId, ...args }: BeraJS.BaseFunctionArgs & {
638
+ type GetProposalDetailsArgs = BeraJS.BaseFunctionArgs & {
639
+ /** On-chain proposal ID */
615
640
  proposalId: string;
616
641
  client?: PublicClient;
617
- }): Promise<ProposalWithVotesFragment | undefined>;
642
+ };
643
+ /** Fetches a single proposal with its vote data from the subgraph */
644
+ declare function getProposalDetails({ proposalId, ...args }: GetProposalDetailsArgs): Promise<ProposalWithVotesFragment | undefined>;
618
645
 
619
- declare function getProposalFromTx(args: {
646
+ type GetProposalFromTxArgs = {
647
+ /** Viem public client used to fetch block and receipt data */
620
648
  publicClient: PublicClient | undefined;
621
649
  } & ({
650
+ /** Pre-fetched transaction receipt */
622
651
  tx: TransactionReceipt;
623
652
  } | {
653
+ /** Transaction hash to look up */
624
654
  txHash: Address;
625
- })): Promise<ProposalWithVotesFragment | null>;
655
+ });
656
+ /**
657
+ * Reconstructs a `ProposalWithVotesFragment` from the `ProposalCreated` event
658
+ * emitted in a given transaction. Returns `null` if the event is not found.
659
+ */
660
+ declare function getProposalFromTx(args: GetProposalFromTxArgs): Promise<ProposalWithVotesFragment | null>;
626
661
 
627
- declare function getProposalVotes({ variables, ...args }: BeraJS.BaseFunctionArgs & {
662
+ type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {
663
+ /** GraphQL variables forwarded to the GetProposalVotes query */
628
664
  variables: GetProposalVotesQueryVariables;
629
- }): Promise<{
665
+ };
666
+ /** Fetches the votes for a proposal from the subgraph */
667
+ declare function getProposalVotes({ variables, ...args }: GetProposalVotesArgs): Promise<{
630
668
  data: GetProposalVotesQuery;
631
669
  }>;
632
670
 
633
- declare const parseProposalBody: (proposal?: Pick<ProposalSelectionFragment, "description">) => graymatter.GrayMatterFile<string> & {
671
+ type ParseProposalBodyResult = graymatter.GrayMatterFile<string> & {
672
+ /** Whether the body uses YAML front-matter (true) or legacy heading format (false) */
634
673
  isFrontMatter: boolean;
635
674
  };
675
+ /**
676
+ * Parses the body of a governance proposal into structured front-matter and content.
677
+ * Supports YAML front-matter format and a legacy heading-based format.
678
+ * Falls back to raw description on parse failure.
679
+ */
680
+ declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "description">): ParseProposalBodyResult;
636
681
 
637
682
  declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
638
683
  days: number;
@@ -976,9 +1021,9 @@ declare function getAllowances({ items: itemsList, account, config, }: GetAllowa
976
1021
  interface GetTokenInformation {
977
1022
  address: Address;
978
1023
  publicClient: PublicClient;
979
- chainId: number;
1024
+ chainId: ChainId;
980
1025
  }
981
- type GetTokenInformationResponse = MinimalERC20 | undefined;
1026
+ type GetTokenInformationResponse = MinimalERC20;
982
1027
  declare function getTokenInformation({ address, publicClient, chainId, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
983
1028
 
984
1029
  declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
@@ -1596,4 +1641,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
1596
1641
  bgtPrice: number;
1597
1642
  }): number;
1598
1643
 
1599
- export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllowances, type GetAllowancesResponse, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, 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, parseProposalBody };
1644
+ export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllProposalsArgs, type GetAllowances, type GetAllowancesResponse, type GetBodyErrorsArgs, type GetDecodedFunctionDataArgs, type GetLSTStakeConfigArgs, type GetProposalDetailsArgs, type GetProposalFromTxArgs, type GetProposalVotesArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type ParseProposalBodyResult, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, 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, parseProposalBody };
@@ -1,5 +1,5 @@
1
- import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-DUZOmxLV.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-DUZOmxLV.js';
1
+ import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-BcyxE9uw.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-BcyxE9uw.js';
3
3
  import { Address, PublicClient, AbiParameter, AbiFunction, TransactionReceipt, Abi, ContractFunctionArgs, ContractFunctionName, WalletCallReceipt } from 'viem';
4
4
  import { ApolloClient, OperationVariables, FetchPolicy } from '@apollo/client';
5
5
  export { gql } from '@apollo/client';
@@ -9,9 +9,9 @@ export { BalancerApi } from '@berachain-foundation/berancer-sdk';
9
9
  import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
10
10
  import { GetPoolsQueryVariables, GetGlobalLiquidityAndSwapVolumeQuery, GetPoolEventsQuery, GqlChain, PoolHistoricalDataFragment, MinimalPoolFragment } from '@berachain/graphql/dex/api';
11
11
  import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment, ApiValidatorRewardAllocationWeightFragment, ApiMinimalVaultIncentiveFragment } from '@berachain/graphql/pol/api';
12
- import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-CCuQUFlh.js';
12
+ import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N.js';
13
13
  import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
14
- import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-SU9Epq0M.js';
14
+ import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-5w_lvl2J.js';
15
15
  import graymatter from 'gray-matter';
16
16
  import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
17
17
  import { b as Token, P as PythLatestUpdates, a as TokenWithMetadata, T as TokenWithOrder, h as PythPriceFeedMap, i as TokenCurrentPriceMap, A as AllowanceQueryItem, j as AllowanceToken, M as MinimalERC20, B as BalanceToken } from '../HoneyConfigProvider-DVP_9KZn.js';
@@ -20,7 +20,7 @@ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
20
20
  import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
21
21
  import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
22
22
  import { I as IHoneySwapState } from '../useHoneySwapState-B494PQDl.js';
23
- import { Address as Address$1 } from '@berachain/config';
23
+ import { Address as Address$1, ChainId } from '@berachain/config';
24
24
  import { Config } from '@wagmi/core';
25
25
  import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
26
26
  import '@berachain/config/internal';
@@ -548,58 +548,82 @@ declare function getVaultPausedState({ publicClient, ...args }: BeraJS.BaseFunct
548
548
 
549
549
  type CheckProposalFieldResultMinimal = ProposalErrorCodes | null;
550
550
  type CheckProposalFieldResult = ProposalErrorCodes | null | CheckProposalFieldResultMinimal[] | Record<string, CheckProposalFieldResultMinimal>;
551
- interface CheckProposalField {
552
- (arg: {
553
- fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
554
- value: any;
555
- required?: boolean;
556
- baseUrl?: string;
557
- components?: readonly (AbiParameter | readonly AbiParameter[])[];
558
- }): CheckProposalFieldResultMinimal;
559
- (arg: {
560
- fieldOrType: "tuple[]" | "tuple";
561
- value: any;
562
- required?: boolean;
563
- baseUrl?: string;
564
- components?: readonly (AbiParameter | readonly AbiParameter[])[];
565
- }): CheckProposalFieldResult;
566
- }
567
- declare const checkProposalField: CheckProposalField;
551
+ /**
552
+ * Validates a single proposal field or ABI-typed value.
553
+ * Returns `null` if valid, or a `ProposalErrorCodes` value describing the problem.
554
+ */
555
+ declare function checkProposalField(arg: {
556
+ fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
557
+ value: unknown;
558
+ required?: boolean;
559
+ baseUrl?: string;
560
+ components?: readonly (AbiParameter | readonly AbiParameter[])[];
561
+ }): CheckProposalFieldResultMinimal;
562
+ /**
563
+ * For tuple/tuple[] types, may return nested error structures.
564
+ */
565
+ declare function checkProposalField(arg: {
566
+ fieldOrType: "tuple[]" | "tuple";
567
+ value: unknown;
568
+ required?: boolean;
569
+ baseUrl?: string;
570
+ components?: readonly (AbiParameter | readonly AbiParameter[])[];
571
+ }): CheckProposalFieldResult;
568
572
 
569
573
  declare const MOCKED_PROPOSAL_STATUSES: readonly ProposalStatus[];
570
- declare function computeActualStatus(proposal: ProposalSelectionFragment,
571
574
  /**
572
- * Value returned by the `state` function of the governance contract.
575
+ * Derives the effective `ProposalStatus` by reconciling subgraph data with the
576
+ * on-chain contract state. Falls back to subgraph timestamps when the on-chain
577
+ * state is unavailable.
573
578
  */
579
+ declare function computeActualStatus(
580
+ /** Subgraph proposal data */
581
+ proposal: ProposalSelectionFragment,
582
+ /** Value returned by the `state` function of the governance contract */
574
583
  proposalOnChainState?: ProposalState): ProposalStatus;
575
584
 
576
- declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: BeraJS.BaseFunctionArgs & {
577
- offset?: number;
585
+ type GetAllProposalsArgs = BeraJS.BaseFunctionArgs & {
586
+ /** Subgraph filter applied to the proposals query */
578
587
  where: Proposal_Filter;
588
+ /** Number of proposals to skip (for pagination) */
589
+ offset?: number;
590
+ /** Maximum proposals per page; must be ≤ 1000 */
579
591
  perPage?: number;
580
592
  orderBy?: Proposal_OrderBy;
581
593
  orderDirection?: OrderDirection;
594
+ /** Full-text search query; switches to the search endpoint when provided */
582
595
  text?: string;
583
- }): Promise<ProposalSelectionFragment[] | undefined>;
584
-
585
- declare const getBodyErrors: (proposal: CustomProposal, currentTopic: GovernanceTopic) => CustomProposalErrors;
596
+ };
597
+ /** Fetches a paginated list of governance proposals from the subgraph */
598
+ declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: GetAllProposalsArgs): Promise<ProposalSelectionFragment[] | undefined>;
599
+
600
+ interface GetBodyErrorsArgs {
601
+ /** The proposal to validate */
602
+ proposal: CustomProposal;
603
+ /** The current governance topic, used for forum link base URL validation */
604
+ currentTopic: GovernanceTopic;
605
+ }
606
+ /** Validates the body fields (title, description, forum link) of a proposal */
607
+ declare function getBodyErrors({ proposal, currentTopic, }: GetBodyErrorsArgs): CustomProposalErrors;
586
608
 
609
+ interface GetDecodedFunctionDataArgs {
610
+ /** Contract address that emitted the calldata */
611
+ address: Address;
612
+ /** Raw calldata to decode */
613
+ callData: `0x${string}`;
614
+ /** @default defaultChainId */
615
+ chainId?: number;
616
+ publicClient: PublicClient;
617
+ }
587
618
  /**
588
619
  * Decodes the function data from a given contract address and calldata.
589
620
  *
590
- * This function attempts to decode the provided calldata using a known set of ABIs.
591
- * If the call data cannot be decoded with the known ABIs, it fetches the ABI from the blockexplorer API.
621
+ * Attempts to decode using a known set of ABIs first, then falls back to
622
+ * fetching the ABI from the block-explorer API.
592
623
  *
593
- * @param address - The contract address.
594
- * @param callData - The calldata to decode, in hexadecimal format.
595
- * @returns An object containing the decoded ABI item, function signature, function name, and arguments.
624
+ * @returns An object with the decoded ABI item, function signature, function name, and arguments.
596
625
  */
597
- declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: {
598
- address: Address;
599
- callData: `0x${string}`;
600
- chainId?: number;
601
- publicClient: PublicClient;
602
- }): Promise<{
626
+ declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: GetDecodedFunctionDataArgs): Promise<{
603
627
  args: never[];
604
628
  abiItem?: undefined;
605
629
  functionSignature?: undefined;
@@ -611,28 +635,49 @@ declare function getDecodedFunctionData({ address, callData, chainId, publicClie
611
635
  args: unknown[];
612
636
  }>;
613
637
 
614
- declare function getProposalDetails({ proposalId, ...args }: BeraJS.BaseFunctionArgs & {
638
+ type GetProposalDetailsArgs = BeraJS.BaseFunctionArgs & {
639
+ /** On-chain proposal ID */
615
640
  proposalId: string;
616
641
  client?: PublicClient;
617
- }): Promise<ProposalWithVotesFragment | undefined>;
642
+ };
643
+ /** Fetches a single proposal with its vote data from the subgraph */
644
+ declare function getProposalDetails({ proposalId, ...args }: GetProposalDetailsArgs): Promise<ProposalWithVotesFragment | undefined>;
618
645
 
619
- declare function getProposalFromTx(args: {
646
+ type GetProposalFromTxArgs = {
647
+ /** Viem public client used to fetch block and receipt data */
620
648
  publicClient: PublicClient | undefined;
621
649
  } & ({
650
+ /** Pre-fetched transaction receipt */
622
651
  tx: TransactionReceipt;
623
652
  } | {
653
+ /** Transaction hash to look up */
624
654
  txHash: Address;
625
- })): Promise<ProposalWithVotesFragment | null>;
655
+ });
656
+ /**
657
+ * Reconstructs a `ProposalWithVotesFragment` from the `ProposalCreated` event
658
+ * emitted in a given transaction. Returns `null` if the event is not found.
659
+ */
660
+ declare function getProposalFromTx(args: GetProposalFromTxArgs): Promise<ProposalWithVotesFragment | null>;
626
661
 
627
- declare function getProposalVotes({ variables, ...args }: BeraJS.BaseFunctionArgs & {
662
+ type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {
663
+ /** GraphQL variables forwarded to the GetProposalVotes query */
628
664
  variables: GetProposalVotesQueryVariables;
629
- }): Promise<{
665
+ };
666
+ /** Fetches the votes for a proposal from the subgraph */
667
+ declare function getProposalVotes({ variables, ...args }: GetProposalVotesArgs): Promise<{
630
668
  data: GetProposalVotesQuery;
631
669
  }>;
632
670
 
633
- declare const parseProposalBody: (proposal?: Pick<ProposalSelectionFragment, "description">) => graymatter.GrayMatterFile<string> & {
671
+ type ParseProposalBodyResult = graymatter.GrayMatterFile<string> & {
672
+ /** Whether the body uses YAML front-matter (true) or legacy heading format (false) */
634
673
  isFrontMatter: boolean;
635
674
  };
675
+ /**
676
+ * Parses the body of a governance proposal into structured front-matter and content.
677
+ * Supports YAML front-matter format and a legacy heading-based format.
678
+ * Falls back to raw description on parse failure.
679
+ */
680
+ declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "description">): ParseProposalBodyResult;
636
681
 
637
682
  declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
638
683
  days: number;
@@ -976,9 +1021,9 @@ declare function getAllowances({ items: itemsList, account, config, }: GetAllowa
976
1021
  interface GetTokenInformation {
977
1022
  address: Address;
978
1023
  publicClient: PublicClient;
979
- chainId: number;
1024
+ chainId: ChainId;
980
1025
  }
981
- type GetTokenInformationResponse = MinimalERC20 | undefined;
1026
+ type GetTokenInformationResponse = MinimalERC20;
982
1027
  declare function getTokenInformation({ address, publicClient, chainId, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
983
1028
 
984
1029
  declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
@@ -1596,4 +1641,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
1596
1641
  bgtPrice: number;
1597
1642
  }): number;
1598
1643
 
1599
- export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllowances, type GetAllowancesResponse, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, 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, parseProposalBody };
1644
+ export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllProposalsArgs, type GetAllowances, type GetAllowancesResponse, type GetBodyErrorsArgs, type GetDecodedFunctionDataArgs, type GetLSTStakeConfigArgs, type GetProposalDetailsArgs, type GetProposalFromTxArgs, type GetProposalVotesArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type ParseProposalBodyResult, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, 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, parseProposalBody };