@berachain/berajs 0.2.8-beta.7 → 0.2.8-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/RequestError-BRIiJgHk.d.ts +144 -0
  2. package/dist/RequestError-DSUzJ1Iy.d.cts +144 -0
  3. package/dist/abi/exports.mjs +1 -1
  4. package/dist/actions/exports.cjs +1 -1
  5. package/dist/actions/exports.cjs.map +1 -1
  6. package/dist/actions/exports.d.cts +11 -5
  7. package/dist/actions/exports.d.ts +11 -5
  8. package/dist/actions/exports.mjs +1 -1
  9. package/dist/actions/exports.mjs.map +1 -1
  10. package/dist/chunk-45HIEVNI.cjs +4 -0
  11. package/dist/chunk-45HIEVNI.cjs.map +1 -0
  12. package/dist/{chunk-6K252BGM.mjs → chunk-47ILYVHC.mjs} +2 -2
  13. package/dist/{chunk-5W7UKRHX.mjs → chunk-5NVZG5N6.mjs} +2 -2
  14. package/dist/chunk-6DIA6PXV.cjs +2 -0
  15. package/dist/chunk-6DIA6PXV.cjs.map +1 -0
  16. package/dist/{chunk-53TSJM6P.cjs → chunk-6JJIZCVY.cjs} +2 -2
  17. package/dist/{chunk-53TSJM6P.cjs.map → chunk-6JJIZCVY.cjs.map} +1 -1
  18. package/dist/{chunk-3MZ7MLKF.mjs → chunk-7F72ZH4Q.mjs} +2 -2
  19. package/dist/chunk-AUA42YIG.mjs +4 -0
  20. package/dist/chunk-AUA42YIG.mjs.map +1 -0
  21. package/dist/{chunk-UFIM7WQ4.cjs → chunk-BC2WX6O6.cjs} +2 -2
  22. package/dist/{chunk-UFIM7WQ4.cjs.map → chunk-BC2WX6O6.cjs.map} +1 -1
  23. package/dist/chunk-CJOZC5Z2.cjs +2 -0
  24. package/dist/{chunk-DKY4QPWU.cjs.map → chunk-CJOZC5Z2.cjs.map} +1 -1
  25. package/dist/{chunk-RSDCKN4Q.mjs → chunk-GXV2JA36.mjs} +2 -2
  26. package/dist/{chunk-RSDCKN4Q.mjs.map → chunk-GXV2JA36.mjs.map} +1 -1
  27. package/dist/{chunk-UENDEN3M.mjs → chunk-ISYNEDET.mjs} +2 -2
  28. package/dist/chunk-JDDRTHFG.mjs +2 -0
  29. package/dist/chunk-JDDRTHFG.mjs.map +1 -0
  30. package/dist/{chunk-QFLDL4UV.cjs → chunk-LVOXBZMA.cjs} +2 -2
  31. package/dist/{chunk-QFLDL4UV.cjs.map → chunk-LVOXBZMA.cjs.map} +1 -1
  32. package/dist/chunk-PRLVZIKD.mjs +2 -0
  33. package/dist/chunk-PRLVZIKD.mjs.map +1 -0
  34. package/dist/{chunk-JLFBRMOF.cjs → chunk-Q2SNRLW3.cjs} +2 -2
  35. package/dist/{chunk-JLFBRMOF.cjs.map → chunk-Q2SNRLW3.cjs.map} +1 -1
  36. package/dist/chunk-REWME3FY.cjs +2 -0
  37. package/dist/chunk-REWME3FY.cjs.map +1 -0
  38. package/dist/chunk-RJN36GBU.mjs +2 -0
  39. package/dist/chunk-RJN36GBU.mjs.map +1 -0
  40. package/dist/chunk-S4CDSVLK.cjs +2 -0
  41. package/dist/chunk-S4CDSVLK.cjs.map +1 -0
  42. package/dist/{chunk-ZYXVUXFQ.cjs → chunk-SFEULGSX.cjs} +2 -2
  43. package/dist/{chunk-ZYXVUXFQ.cjs.map → chunk-SFEULGSX.cjs.map} +1 -1
  44. package/dist/{chunk-CWKDFUFR.mjs → chunk-WBTS6KFG.mjs} +2 -2
  45. package/dist/contexts/exports.cjs +1 -1
  46. package/dist/contexts/exports.cjs.map +1 -1
  47. package/dist/contexts/exports.mjs +1 -1
  48. package/dist/errors/exports.cjs +1 -1
  49. package/dist/errors/exports.cjs.map +1 -1
  50. package/dist/errors/exports.d.cts +3 -89
  51. package/dist/errors/exports.d.ts +3 -89
  52. package/dist/errors/exports.mjs +1 -1
  53. package/dist/hooks/exports.cjs +3 -3
  54. package/dist/hooks/exports.cjs.map +1 -1
  55. package/dist/hooks/exports.d.cts +13 -27
  56. package/dist/hooks/exports.d.ts +13 -27
  57. package/dist/hooks/exports.mjs +3 -3
  58. package/dist/hooks/exports.mjs.map +1 -1
  59. package/dist/utils/exports.cjs +1 -1
  60. package/dist/utils/exports.cjs.map +1 -1
  61. package/dist/utils/exports.d.cts +10 -2
  62. package/dist/utils/exports.d.ts +10 -2
  63. package/dist/utils/exports.mjs +1 -1
  64. package/dist/utils/exports.mjs.map +1 -1
  65. package/package.json +14 -3
  66. package/src/actions/clients/BeraApolloClient.ts +9 -0
  67. package/src/actions/clients/getApolloClient.ts +12 -2
  68. package/src/actions/dex/aggregators/base.ts +1 -1
  69. package/src/actions/exports.ts +1 -1
  70. package/src/actions/honey/getChartData.ts +5 -5
  71. package/src/actions/honey/getHoney24hVolume.ts +30 -0
  72. package/src/actions/pol/getEarnedStakedBeraVault.ts +12 -2
  73. package/src/actions/pol/getStakingDailyAssets.ts +7 -1
  74. package/src/data/contracts.ts +5 -0
  75. package/src/errors/RequestError.ts +2 -1
  76. package/src/hooks/exports.ts +1 -1
  77. package/src/hooks/honey/useHoney24hVolume.ts +16 -0
  78. package/src/utils/beraFetch.ts +70 -15
  79. package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
  80. package/dist/RequestError-Dk97z8rm.d.ts +0 -57
  81. package/dist/chunk-DKY4QPWU.cjs +0 -2
  82. package/dist/chunk-DTBJO6VT.cjs +0 -2
  83. package/dist/chunk-DTBJO6VT.cjs.map +0 -1
  84. package/dist/chunk-ESAVA5OD.mjs +0 -2
  85. package/dist/chunk-ESAVA5OD.mjs.map +0 -1
  86. package/dist/chunk-KT6L4K4K.cjs +0 -2
  87. package/dist/chunk-KT6L4K4K.cjs.map +0 -1
  88. package/dist/chunk-MASD43N5.mjs +0 -4
  89. package/dist/chunk-MASD43N5.mjs.map +0 -1
  90. package/dist/chunk-MGGPHKA2.cjs +0 -4
  91. package/dist/chunk-MGGPHKA2.cjs.map +0 -1
  92. package/dist/chunk-SSPFPAWX.mjs +0 -2
  93. package/dist/chunk-SSPFPAWX.mjs.map +0 -1
  94. package/src/actions/honey/getHoneyGlobalData.ts +0 -21
  95. package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
  96. /package/dist/{chunk-6K252BGM.mjs.map → chunk-47ILYVHC.mjs.map} +0 -0
  97. /package/dist/{chunk-5W7UKRHX.mjs.map → chunk-5NVZG5N6.mjs.map} +0 -0
  98. /package/dist/{chunk-3MZ7MLKF.mjs.map → chunk-7F72ZH4Q.mjs.map} +0 -0
  99. /package/dist/{chunk-UENDEN3M.mjs.map → chunk-ISYNEDET.mjs.map} +0 -0
  100. /package/dist/{chunk-CWKDFUFR.mjs.map → chunk-WBTS6KFG.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkMGGPHKA2cjs = require('../chunk-MGGPHKA2.cjs');require('../chunk-OUD27MU7.cjs');var _chunkUFIM7WQ4cjs = require('../chunk-UFIM7WQ4.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-WRFDB3QJ.cjs');var _chunkKT6L4K4Kcjs = require('../chunk-KT6L4K4K.cjs');var _chunkZYXVUXFQcjs = require('../chunk-ZYXVUXFQ.cjs');require('../chunk-DTBJO6VT.cjs');var _chunkQFLDL4UVcjs = require('../chunk-QFLDL4UV.cjs');require('../chunk-53TSJM6P.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, r)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var Gt=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return(await e.readContract({address:r.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&_optionalChain([r, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:r}))return r}catch (e2){}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e3){return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=_internal.defaultChainId,publicClient:o}){let n=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function nr({client:e,collateralList:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, a[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.honey.token;return await e.readContract({address:o,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function gr({publicClient:e,factory:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);return e.readContract({address:_nullishCoalesce(t, () => (o.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=_nullishCoalesce(e, () => (n.averageBlockTime)),m=_nullishCoalesce(r, () => (Math.floor(_chunkKT6L4K4Kcjs.q.call(void 0, 1)/a))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunkKT6L4K4Kcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, {...o,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (o.chainId))}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>_chunkZYXVUXFQcjs.e.call(void 0, y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.pol.factory;_chunkQFLDL4UVcjs.b.call(void 0, e,"publicClient"),_chunkQFLDL4UVcjs.d.call(void 0, r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunkQFLDL4UVcjs.c.call(void 0, e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=await t.readContract({address:_nullishCoalesce(r, () => (n.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return a===_viem.zeroAddress?null:a}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunkKT6L4K4Kcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (r.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>_optionalChain([o, 'optionalAccess', _14 => _14.receivingVault])).reduce((o,n)=>{for(let a of _nullishCoalesce(_optionalChain([n, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&a.remainingAmount==="0")continue;let m=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRate).times(n.percentage),i=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,r)=>{if(!r)return t;let o=_nullishCoalesce(_optionalChain([r, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(n=>Number(n.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)]), () => (0));return t+o*r.percentage},0)])}function io({validator:e,bgtPrice:t}){let r=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),o=ne(e);return!o||!r?0:o*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(r*t)}exports.BalancerApi = _chunkMGGPHKA2cjs.f; exports.BaseAggregator = _chunkMGGPHKA2cjs.e; exports.BeraApolloClient = _chunkMGGPHKA2cjs.b; exports.HoneyPreviewMethod = _chunkMGGPHKA2cjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunkMGGPHKA2cjs.o; exports.RewardVaultDistributionMode = _chunkMGGPHKA2cjs.M; exports.aggregateValidatorIncentives = no; exports.beraWriteContract = _chunkMGGPHKA2cjs.ma; exports.checkProposalField = _chunkMGGPHKA2cjs.n; exports.computeActualStatus = _chunkMGGPHKA2cjs.p; exports.formatValidatorRewardAllocation = _chunkMGGPHKA2cjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunkMGGPHKA2cjs.g; exports.getAllProposals = _chunkMGGPHKA2cjs.q; exports.getAllValidators = _chunkMGGPHKA2cjs.na; exports.getAllowances = _chunkMGGPHKA2cjs.ka; exports.getApiEnrichedAllocation = _chunkMGGPHKA2cjs.oa; exports.getApiPool = _chunkMGGPHKA2cjs.h; exports.getApiValidator = _chunkMGGPHKA2cjs.pa; exports.getApolloClient = _chunkMGGPHKA2cjs.c; exports.getBalanceCall = _chunkUFIM7WQ4cjs.b; exports.getBgtAprSimulation = _chunkMGGPHKA2cjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunkMGGPHKA2cjs.L; exports.getBodyErrors = _chunkMGGPHKA2cjs.r; exports.getChartData = _chunkMGGPHKA2cjs.w; exports.getCollateralWeights = _chunkMGGPHKA2cjs.x; exports.getConvertToAssets = _chunkMGGPHKA2cjs.a; exports.getDailyValidatorBlockStats = _chunkMGGPHKA2cjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunkMGGPHKA2cjs.va; exports.getEarnedStakedBeraVault = _chunkMGGPHKA2cjs.P; exports.getEnsoClient = _chunkUFIM7WQ4cjs.a; exports.getGlobalCapLimit = _chunkMGGPHKA2cjs.B; exports.getGlobalData = _chunkMGGPHKA2cjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunkMGGPHKA2cjs.i; exports.getHoneyCollaterals = _chunkMGGPHKA2cjs.z; exports.getHoneyFees = nr; exports.getHoneyGlobalData = _chunkMGGPHKA2cjs.C; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunkMGGPHKA2cjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = gr; exports.getHoneyVaultsBalance = _chunkMGGPHKA2cjs.F; exports.getIncentiveFeeClaimStats = _chunkMGGPHKA2cjs.S; exports.getLSTStakeConfig = Fr; exports.getMarkets = _chunkMGGPHKA2cjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunkMGGPHKA2cjs.k; exports.getPoolEvents = _chunkMGGPHKA2cjs.l; exports.getPoolHistoricalData = _chunkMGGPHKA2cjs.m; exports.getPoolPausedState = _chunkMGGPHKA2cjs.j; exports.getPoolState = Gt; exports.getProposalDetails = _chunkMGGPHKA2cjs.s; exports.getProposalFromTx = _chunkMGGPHKA2cjs.u; exports.getProposalVotes = _chunkMGGPHKA2cjs.v; exports.getPythLatestPrices = _chunkMGGPHKA2cjs.G; exports.getPythUpdateFee = _chunkMGGPHKA2cjs.I; exports.getRelativeCapLimit = _chunkMGGPHKA2cjs.H; exports.getRewardProofsByValidator = _chunkMGGPHKA2cjs.U; exports.getRewardTokenToBeraRate = _chunkMGGPHKA2cjs.V; exports.getRewardVault = _chunkMGGPHKA2cjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunkMGGPHKA2cjs.X; exports.getRewardVaultRewards = _chunkMGGPHKA2cjs.N; exports.getRewardVaultStakingToken = _chunkMGGPHKA2cjs.Y; exports.getRewardVaults = _chunkMGGPHKA2cjs.Q; exports.getSWBeraVaultMetadata = _chunkMGGPHKA2cjs.aa; exports.getSWBeraWithdrawal = _chunkMGGPHKA2cjs.ba; exports.getStakeWithdrawalCooldown = _chunkMGGPHKA2cjs.$; exports.getStakedBeraAPR = _chunkMGGPHKA2cjs.Z; exports.getStakedBeraSnapshots = _chunkMGGPHKA2cjs._; exports.getStakingPoolBatch = _chunkMGGPHKA2cjs.wa; exports.getSwapPayload = _chunkMGGPHKA2cjs.J; exports.getTokenCurrentPrices = _chunkMGGPHKA2cjs.ja; exports.getTokenInformation = _chunkMGGPHKA2cjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunkMGGPHKA2cjs.ca; exports.getUserActiveValidators = _chunkMGGPHKA2cjs.ya; exports.getUserBoostsOnValidator = _chunkMGGPHKA2cjs.xa; exports.getUserClaimableIncentives = _chunkMGGPHKA2cjs.da; exports.getUserStakingPositions = _chunkMGGPHKA2cjs.za; exports.getUserVaultInfo = _chunkMGGPHKA2cjs.fa; exports.getUserVaults = _chunkMGGPHKA2cjs.ga; exports.getUserVaultsReward = _chunkMGGPHKA2cjs.ea; exports.getValidatorAnalytics = _chunkMGGPHKA2cjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunkMGGPHKA2cjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunkMGGPHKA2cjs.Ca; exports.getValidatorOperatorAddress = _chunkMGGPHKA2cjs.Da; exports.getValidatorQueuedCommission = _chunkMGGPHKA2cjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunkMGGPHKA2cjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunkMGGPHKA2cjs.Ga; exports.getValidatorReturnPerBgt = ne; exports.getValidatorRewardAllocation = _chunkMGGPHKA2cjs.ta; exports.getVaultHistory = _chunkMGGPHKA2cjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunkMGGPHKA2cjs.ia; exports.getWalletBalances = _chunkUFIM7WQ4cjs.c; exports.gql = _chunkMGGPHKA2cjs.d; exports.isBadCollateralAsset = _chunkMGGPHKA2cjs.A; exports.isBasketModeEnabled = _chunkMGGPHKA2cjs.K; exports.isDefaultRewardAllocation = _chunkMGGPHKA2cjs.ua; exports.isImpersonateAccount = _chunkMGGPHKA2cjs.la; exports.isSameRewardAllocation = _chunkMGGPHKA2cjs.sa; exports.parseProposalBody = _chunkMGGPHKA2cjs.t;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk45HIEVNIcjs = require('../chunk-45HIEVNI.cjs');require('../chunk-OUD27MU7.cjs');var _chunkBC2WX6O6cjs = require('../chunk-BC2WX6O6.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-WRFDB3QJ.cjs');require('../chunk-REWME3FY.cjs');var _chunkLVOXBZMAcjs = require('../chunk-LVOXBZMA.cjs');var _chunk6DIA6PXVcjs = require('../chunk-6DIA6PXV.cjs');var _chunkSFEULGSXcjs = require('../chunk-SFEULGSX.cjs');require('../chunk-S4CDSVLK.cjs');require('../chunk-6JJIZCVY.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, r)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var Gt=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:r}=_chunkSFEULGSXcjs.a.call(void 0, t);return(await e.readContract({address:r.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&_optionalChain([r, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:r}))return r}catch (e2){}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e3){return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=_internal.defaultChainId,publicClient:o}){let n=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function nr({client:e,collateralList:t,...r}){let{config:o}=_chunkSFEULGSXcjs.a.call(void 0, r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, a[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:r}=_chunkSFEULGSXcjs.a.call(void 0, t),o=r.honey.token;return await e.readContract({address:o,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function gr({publicClient:e,factory:t,...r}){let{config:o}=_chunkSFEULGSXcjs.a.call(void 0, r);return e.readContract({address:_nullishCoalesce(t, () => (o.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){_chunkLVOXBZMAcjs.c.call(void 0, t);let{config:n}=_chunkSFEULGSXcjs.a.call(void 0, o),a=_nullishCoalesce(e, () => (n.averageBlockTime)),m=_nullishCoalesce(r, () => (Math.floor(_chunk6DIA6PXVcjs.q.call(void 0, 1)/a))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunk6DIA6PXVcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){_chunkLVOXBZMAcjs.c.call(void 0, t);let{config:n}=_chunkSFEULGSXcjs.a.call(void 0, {...o,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (o.chainId))}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>_chunkSFEULGSXcjs.e.call(void 0, y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=_chunkSFEULGSXcjs.a.call(void 0, t),o=r.pol.factory;_chunkLVOXBZMAcjs.b.call(void 0, e,"publicClient"),_chunkLVOXBZMAcjs.d.call(void 0, r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunkLVOXBZMAcjs.c.call(void 0, e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=_chunkSFEULGSXcjs.a.call(void 0, o),a=await t.readContract({address:_nullishCoalesce(r, () => (n.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return a===_viem.zeroAddress?null:a}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=_chunkSFEULGSXcjs.a.call(void 0, r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=_chunkSFEULGSXcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunk6DIA6PXVcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (r.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...r}){let{config:o}=_chunkSFEULGSXcjs.a.call(void 0, r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>_optionalChain([o, 'optionalAccess', _14 => _14.receivingVault])).reduce((o,n)=>{for(let a of _nullishCoalesce(_optionalChain([n, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&a.remainingAmount==="0")continue;let m=new (0, _chunk6DIA6PXVcjs.a)(a.incentiveRate).times(n.percentage),i=new (0, _chunk6DIA6PXVcjs.a)(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new (0, _chunk6DIA6PXVcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunk6DIA6PXVcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunk6DIA6PXVcjs.a)(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new (0, _chunk6DIA6PXVcjs.a)(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,r)=>{if(!r)return t;let o=_nullishCoalesce(_optionalChain([r, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(n=>Number(n.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)]), () => (0));return t+o*r.percentage},0)])}function io({validator:e,bgtPrice:t}){let r=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),o=ne(e);return!o||!r?0:o*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(r*t)}exports.BalancerApi = _chunk45HIEVNIcjs.f; exports.BaseAggregator = _chunk45HIEVNIcjs.e; exports.BeraApolloClient = _chunk45HIEVNIcjs.b; exports.HoneyPreviewMethod = _chunk45HIEVNIcjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunk45HIEVNIcjs.o; exports.RewardVaultDistributionMode = _chunk45HIEVNIcjs.M; exports.aggregateValidatorIncentives = no; exports.beraWriteContract = _chunk45HIEVNIcjs.ma; exports.checkProposalField = _chunk45HIEVNIcjs.n; exports.computeActualStatus = _chunk45HIEVNIcjs.p; exports.formatValidatorRewardAllocation = _chunk45HIEVNIcjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunk45HIEVNIcjs.g; exports.getAllProposals = _chunk45HIEVNIcjs.q; exports.getAllValidators = _chunk45HIEVNIcjs.na; exports.getAllowances = _chunk45HIEVNIcjs.ka; exports.getApiEnrichedAllocation = _chunk45HIEVNIcjs.oa; exports.getApiPool = _chunk45HIEVNIcjs.h; exports.getApiValidator = _chunk45HIEVNIcjs.pa; exports.getApolloClient = _chunk45HIEVNIcjs.c; exports.getBalanceCall = _chunkBC2WX6O6cjs.b; exports.getBgtAprSimulation = _chunk45HIEVNIcjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunk45HIEVNIcjs.L; exports.getBodyErrors = _chunk45HIEVNIcjs.r; exports.getChartData = _chunk45HIEVNIcjs.w; exports.getCollateralWeights = _chunk45HIEVNIcjs.x; exports.getConvertToAssets = _chunk45HIEVNIcjs.a; exports.getDailyValidatorBlockStats = _chunk45HIEVNIcjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunk45HIEVNIcjs.va; exports.getEarnedStakedBeraVault = _chunk45HIEVNIcjs.P; exports.getEnsoClient = _chunkBC2WX6O6cjs.a; exports.getGlobalCapLimit = _chunk45HIEVNIcjs.B; exports.getGlobalData = _chunk45HIEVNIcjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunk45HIEVNIcjs.i; exports.getHoney24hVolume = _chunk45HIEVNIcjs.C; exports.getHoneyCollaterals = _chunk45HIEVNIcjs.z; exports.getHoneyFees = nr; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunk45HIEVNIcjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = gr; exports.getHoneyVaultsBalance = _chunk45HIEVNIcjs.F; exports.getIncentiveFeeClaimStats = _chunk45HIEVNIcjs.S; exports.getLSTStakeConfig = Fr; exports.getMarkets = _chunk45HIEVNIcjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunk45HIEVNIcjs.k; exports.getPoolEvents = _chunk45HIEVNIcjs.l; exports.getPoolHistoricalData = _chunk45HIEVNIcjs.m; exports.getPoolPausedState = _chunk45HIEVNIcjs.j; exports.getPoolState = Gt; exports.getProposalDetails = _chunk45HIEVNIcjs.s; exports.getProposalFromTx = _chunk45HIEVNIcjs.u; exports.getProposalVotes = _chunk45HIEVNIcjs.v; exports.getPythLatestPrices = _chunk45HIEVNIcjs.G; exports.getPythUpdateFee = _chunk45HIEVNIcjs.I; exports.getRelativeCapLimit = _chunk45HIEVNIcjs.H; exports.getRewardProofsByValidator = _chunk45HIEVNIcjs.U; exports.getRewardTokenToBeraRate = _chunk45HIEVNIcjs.V; exports.getRewardVault = _chunk45HIEVNIcjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunk45HIEVNIcjs.X; exports.getRewardVaultRewards = _chunk45HIEVNIcjs.N; exports.getRewardVaultStakingToken = _chunk45HIEVNIcjs.Y; exports.getRewardVaults = _chunk45HIEVNIcjs.Q; exports.getSWBeraVaultMetadata = _chunk45HIEVNIcjs.aa; exports.getSWBeraWithdrawal = _chunk45HIEVNIcjs.ba; exports.getStakeWithdrawalCooldown = _chunk45HIEVNIcjs.$; exports.getStakedBeraAPR = _chunk45HIEVNIcjs.Z; exports.getStakedBeraSnapshots = _chunk45HIEVNIcjs._; exports.getStakingPoolBatch = _chunk45HIEVNIcjs.wa; exports.getSwapPayload = _chunk45HIEVNIcjs.J; exports.getTokenCurrentPrices = _chunk45HIEVNIcjs.ja; exports.getTokenInformation = _chunk45HIEVNIcjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunk45HIEVNIcjs.ca; exports.getUserActiveValidators = _chunk45HIEVNIcjs.ya; exports.getUserBoostsOnValidator = _chunk45HIEVNIcjs.xa; exports.getUserClaimableIncentives = _chunk45HIEVNIcjs.da; exports.getUserStakingPositions = _chunk45HIEVNIcjs.za; exports.getUserVaultInfo = _chunk45HIEVNIcjs.fa; exports.getUserVaults = _chunk45HIEVNIcjs.ga; exports.getUserVaultsReward = _chunk45HIEVNIcjs.ea; exports.getValidatorAnalytics = _chunk45HIEVNIcjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunk45HIEVNIcjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunk45HIEVNIcjs.Ca; exports.getValidatorOperatorAddress = _chunk45HIEVNIcjs.Da; exports.getValidatorQueuedCommission = _chunk45HIEVNIcjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunk45HIEVNIcjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunk45HIEVNIcjs.Ga; exports.getValidatorReturnPerBgt = ne; exports.getValidatorRewardAllocation = _chunk45HIEVNIcjs.ta; exports.getVaultHistory = _chunk45HIEVNIcjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunk45HIEVNIcjs.ia; exports.getWalletBalances = _chunkBC2WX6O6cjs.c; exports.gql = _chunk45HIEVNIcjs.d; exports.isBadCollateralAsset = _chunk45HIEVNIcjs.A; exports.isBasketModeEnabled = _chunk45HIEVNIcjs.K; exports.isDefaultRewardAllocation = _chunk45HIEVNIcjs.ua; exports.isImpersonateAccount = _chunk45HIEVNIcjs.la; exports.isSameRewardAllocation = _chunk45HIEVNIcjs.sa; exports.parseProposalBody = _chunk45HIEVNIcjs.t;
2
2
  //# sourceMappingURL=exports.cjs.map
@@ -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","i","_getAbi","contractAddress","chainId","url","appConfig"],"mappings":"AAAA,+1BAAwvB,iCAA8B,yDAA2D,iCAA8B,iCAA8B,yDAA+D,yDAAiD,iCAA8B,yDAAwD,iCAA8B,4BCApjC,8EAEX,MAOlD,SAAsBA,EAAAA,CAAc,CAClC,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CAAwC,CACtC,IAAMC,CAAAA,CAAa,MAAMD,CAAAA,CAAa,YAAA,CAAa,CACjD,OAAA,CAASD,CAAAA,CACT,GAAA,CAAKG,+BAAAA,CACL,YAAA,CAAc,YAAA,CACd,IAAA,CAAM,CAACH,CAAY,CACrB,CAAC,CAAA,CACD,OAAOI,+BAAAA,CAAsB,CAC/B,CCpBA,iEAIO,IAKMC,EAAAA,CAAgBC,CAAAA,EAAAA,CACpB,CACL,IAAA,CAAMC,sCAAAA,CAAYD,CAAQ,IAAI,CAAA,CAC9B,eAAA,CAAiBA,CAAAA,CAAQ,eAAA,CACzB,MAAA,CAAQA,CAAAA,CAAQ,MAAA,CAAO,GAAA,CACpBE,CAAAA,EAAAA,CACE,CACC,GAAGA,CAAAA,CACH,OAAA,CAASA,CAAAA,CAAG,OACd,CAAA,CACJ,CAAA,CACA,EAAA,CAAIF,CAAAA,CAAQ,EAAA,CACZ,OAAA,CAASA,CAAAA,CAAQ,OACnB,CAAA,CAAA,CCpBF,kDAA6C,MAI7C,SAAsBG,EAAAA,CAAoB,CACxC,YAAA,CAAAR,CAAAA,CACA,GAAGS,CACL,CAAA,CAEG,CACD,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,iCAAAA,CAAkB,CAAA,CAQrC,MAAA,CANyB,MAAMX,CAAAA,CAAa,YAAA,CAAa,CACvD,OAAA,CAASU,CAAAA,CAAO,GAAA,CAAI,KAAA,CACpB,GAAA,CAAKE,eAAAA,CACL,YAAA,CAAc,gBAChB,CAAC,CAAA,CAAA,CAEuB,CAAC,CAC3B,CCrBA,sDAa0C,gEAEd,sEACG,SAGtBC,CAAAA,CAAWC,CAAAA,CAAmB,CACrC,OAAOA,CAAAA,CAAI,IAAA,CAAMC,CAAAA,EAAkB,CACjC,IAAMC,CAAAA,CAAID,CAAAA,CAKV,OACEC,CAAAA,CAAE,IAAA,GAAS,gBAAA,EACXA,CAAAA,CAAE,IAAA,GAAS,WAAA,EACVA,CAAAA,CAAE,IAAA,GAAS,aAAA,kBAAiBA,CAAAA,qBAAE,MAAA,4BAAA,CAAS,CAAC,CAAA,6BAAG,MAAA,GAAS,gBAEzD,CAAC,CACH,CAKA,MAAA,SAAeC,CAAAA,CAAQ,CACrB,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAAnB,CACF,CAAA,CAIG,CACD,IAAMoB,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((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"]}
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","i","_getAbi","contractAddress","chainId","url","appConfig"],"mappings":"AAAA,+1BAAwvB,iCAA8B,yDAA2D,iCAA8B,iCAA8B,iCAA8B,yDAAwD,yDAA+D,yDAAiD,iCAA8B,iCAA8B,4BCAllC,8EAEX,MAOlD,SAAsBA,EAAAA,CAAc,CAClC,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CAAwC,CACtC,IAAMC,CAAAA,CAAa,MAAMD,CAAAA,CAAa,YAAA,CAAa,CACjD,OAAA,CAASD,CAAAA,CACT,GAAA,CAAKG,+BAAAA,CACL,YAAA,CAAc,YAAA,CACd,IAAA,CAAM,CAACH,CAAY,CACrB,CAAC,CAAA,CACD,OAAOI,+BAAAA,CAAsB,CAC/B,CCpBA,iEAIO,IAKMC,EAAAA,CAAgBC,CAAAA,EAAAA,CACpB,CACL,IAAA,CAAMC,sCAAAA,CAAYD,CAAQ,IAAI,CAAA,CAC9B,eAAA,CAAiBA,CAAAA,CAAQ,eAAA,CACzB,MAAA,CAAQA,CAAAA,CAAQ,MAAA,CAAO,GAAA,CACpBE,CAAAA,EAAAA,CACE,CACC,GAAGA,CAAAA,CACH,OAAA,CAASA,CAAAA,CAAG,OACd,CAAA,CACJ,CAAA,CACA,EAAA,CAAIF,CAAAA,CAAQ,EAAA,CACZ,OAAA,CAASA,CAAAA,CAAQ,OACnB,CAAA,CAAA,CCpBF,kDAA6C,MAI7C,SAAsBG,EAAAA,CAAoB,CACxC,YAAA,CAAAR,CAAAA,CACA,GAAGS,CACL,CAAA,CAEG,CACD,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,iCAAAA,CAAkB,CAAA,CAQrC,MAAA,CANyB,MAAMX,CAAAA,CAAa,YAAA,CAAa,CACvD,OAAA,CAASU,CAAAA,CAAO,GAAA,CAAI,KAAA,CACpB,GAAA,CAAKE,eAAAA,CACL,YAAA,CAAc,gBAChB,CAAC,CAAA,CAAA,CAEuB,CAAC,CAC3B,CCrBA,sDAa0C,gEAEd,sEACG,SAGtBC,CAAAA,CAAWC,CAAAA,CAAmB,CACrC,OAAOA,CAAAA,CAAI,IAAA,CAAMC,CAAAA,EAAkB,CACjC,IAAMC,CAAAA,CAAID,CAAAA,CAKV,OACEC,CAAAA,CAAE,IAAA,GAAS,gBAAA,EACXA,CAAAA,CAAE,IAAA,GAAS,WAAA,EACVA,CAAAA,CAAE,IAAA,GAAS,aAAA,kBAAiBA,CAAAA,qBAAE,MAAA,4BAAA,CAAS,CAAC,CAAA,6BAAG,MAAA,GAAS,gBAEzD,CAAC,CACH,CAKA,MAAA,SAAeC,CAAAA,CAAQ,CACrB,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAAnB,CACF,CAAA,CAIG,CACD,IAAMoB,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((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"]}
@@ -13,9 +13,10 @@ import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N
13
13
  import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
14
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
- import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
16
+ import { GetSnapshotsQuery } 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';
18
18
  export { C as CollateralRates, k as CollateralRatesArgs, l as HoneyFeeMap, m as HoneyPreviewArgs, n as HoneyPreviewMethod, o as HoneyPreviewReadResult, p as HoneyPreviewResult, q as getHoneyFees, r as getHoneyPreview, s as getPythLatestPrices } from '../HoneyConfigProvider-DfkjmzEf.cjs';
19
+ import BigNumber from '@berachain/utils/pkg/bignumber.js';
19
20
  import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
20
21
  import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
21
22
  import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
@@ -48,11 +49,16 @@ declare class BeraApolloClient extends ApolloClient {
48
49
  * The URL of the endpoint. Used for error reporting only.
49
50
  */
50
51
  protected url: string;
52
+ protected serviceName: string;
51
53
  constructor(options: ApolloClient.Options & {
52
54
  /**
53
55
  * The URL of the endpoint. Used for error reporting only.
54
56
  */
55
57
  url: string;
58
+ /**
59
+ * The name of the graphql service. Used for error reporting only.
60
+ */
61
+ name: string;
56
62
  });
57
63
  query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: Omit<ApolloClient.QueryOptions<TData, TVariables>, "errorPolicy">): Promise<{
58
64
  data: TData;
@@ -681,7 +687,7 @@ declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "d
681
687
 
682
688
  declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
683
689
  days: number;
684
- }): Promise<GetChartDataQuery>;
690
+ }): Promise<GetSnapshotsQuery>;
685
691
 
686
692
  /**
687
693
  * Arguments for the getCollateralWeights function.
@@ -719,6 +725,8 @@ interface GetGlobalCapLimitArgs extends BeraJS.BaseFunctionArgs {
719
725
  */
720
726
  declare function getGlobalCapLimit({ client, asset, amount, isMint, isPythWrapperEnabled, latestPrices, ...args }: GetGlobalCapLimitArgs): Promise<boolean | undefined>;
721
727
 
728
+ declare function getHoney24hVolume({ ...args }?: BeraJS.BaseFunctionArgs): Promise<BigNumber>;
729
+
722
730
  interface GetHoneyCollateralsArgs extends BeraJS.BaseFunctionArgs {
723
731
  /**
724
732
  * The public client for blockchain interactions
@@ -747,8 +755,6 @@ declare function getHoneyCollaterals({ client, tokenData, preferredCollateralOrd
747
755
  referenceCollateral: TokenWithOrder;
748
756
  }>;
749
757
 
750
- declare function getHoneyGlobalData({ ...args }?: BeraJS.BaseFunctionArgs): Promise<GetGlobalDataQuery>;
751
-
752
758
  /**
753
759
  * Gets the pause state of the Honey protocol
754
760
  * @returns boolean
@@ -1641,4 +1647,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
1641
1647
  bgtPrice: number;
1642
1648
  }): number;
1643
1649
 
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 };
1650
+ 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, getHoney24hVolume, getHoneyCollaterals, 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 };
@@ -13,9 +13,10 @@ import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N
13
13
  import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
14
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
- import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
16
+ import { GetSnapshotsQuery } 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';
18
18
  export { C as CollateralRates, k as CollateralRatesArgs, l as HoneyFeeMap, m as HoneyPreviewArgs, n as HoneyPreviewMethod, o as HoneyPreviewReadResult, p as HoneyPreviewResult, q as getHoneyFees, r as getHoneyPreview, s as getPythLatestPrices } from '../HoneyConfigProvider-DVP_9KZn.js';
19
+ import BigNumber from '@berachain/utils/pkg/bignumber.js';
19
20
  import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
20
21
  import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
21
22
  import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
@@ -48,11 +49,16 @@ declare class BeraApolloClient extends ApolloClient {
48
49
  * The URL of the endpoint. Used for error reporting only.
49
50
  */
50
51
  protected url: string;
52
+ protected serviceName: string;
51
53
  constructor(options: ApolloClient.Options & {
52
54
  /**
53
55
  * The URL of the endpoint. Used for error reporting only.
54
56
  */
55
57
  url: string;
58
+ /**
59
+ * The name of the graphql service. Used for error reporting only.
60
+ */
61
+ name: string;
56
62
  });
57
63
  query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: Omit<ApolloClient.QueryOptions<TData, TVariables>, "errorPolicy">): Promise<{
58
64
  data: TData;
@@ -681,7 +687,7 @@ declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "d
681
687
 
682
688
  declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
683
689
  days: number;
684
- }): Promise<GetChartDataQuery>;
690
+ }): Promise<GetSnapshotsQuery>;
685
691
 
686
692
  /**
687
693
  * Arguments for the getCollateralWeights function.
@@ -719,6 +725,8 @@ interface GetGlobalCapLimitArgs extends BeraJS.BaseFunctionArgs {
719
725
  */
720
726
  declare function getGlobalCapLimit({ client, asset, amount, isMint, isPythWrapperEnabled, latestPrices, ...args }: GetGlobalCapLimitArgs): Promise<boolean | undefined>;
721
727
 
728
+ declare function getHoney24hVolume({ ...args }?: BeraJS.BaseFunctionArgs): Promise<BigNumber>;
729
+
722
730
  interface GetHoneyCollateralsArgs extends BeraJS.BaseFunctionArgs {
723
731
  /**
724
732
  * The public client for blockchain interactions
@@ -747,8 +755,6 @@ declare function getHoneyCollaterals({ client, tokenData, preferredCollateralOrd
747
755
  referenceCollateral: TokenWithOrder;
748
756
  }>;
749
757
 
750
- declare function getHoneyGlobalData({ ...args }?: BeraJS.BaseFunctionArgs): Promise<GetGlobalDataQuery>;
751
-
752
758
  /**
753
759
  * Gets the pause state of the Honey protocol
754
760
  * @returns boolean
@@ -1641,4 +1647,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
1641
1647
  bgtPrice: number;
1642
1648
  }): number;
1643
1649
 
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 };
1650
+ 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, getHoney24hVolume, getHoneyCollaterals, 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,2 +1,2 @@
1
- import{$ as rt,A as ve,Aa as Rt,B as De,Ba as Tt,C as Re,Ca as It,D as Te,Da as Mt,E as Ie,Ea as Vt,F as Me,Fa as Ot,G as Ve,Ga as Wt,H as Oe,I as We,J as Je,K as Ue,L as _e,M as He,N as Ee,O as Ge,P as $e,Q as Le,R as qe,S as ze,T as Xe,U as je,V as Ke,W as Ze,X as Qe,Y as Ye,Z as et,_ as tt,a as ae,aa as ot,b as R,ba as nt,c as T,ca as at,d as I,da as it,e as se,ea as st,f as me,fa as mt,g as de,ga as dt,h as ce,ha as ct,i as pe,ia as pt,j as ue,ja as ut,k as le,ka as lt,l as fe,la as yt,m as ge,ma as bt,n as ye,na as At,o as be,oa as xt,p as Ae,pa as ht,q as xe,qa as Ct,r as he,ra as Pt,s as Ce,sa as wt,t as Pe,ta as kt,u as we,ua as Bt,v as ke,va as Ft,w as Be,wa as Nt,x as Fe,xa as St,y as Ne,ya as vt,z as Se,za as Dt}from"../chunk-MASD43N5.mjs";import"../chunk-NLVWRMGD.mjs";import{a as ie,b as ft,c as gt}from"../chunk-6K252BGM.mjs";import"../chunk-NAXAZJJY.mjs";import"../chunk-OGJMSGB2.mjs";import{a as u,d as A,l as P,q as w}from"../chunk-ESAVA5OD.mjs";import{a as d,e as x}from"../chunk-5W7UKRHX.mjs";import"../chunk-SSPFPAWX.mjs";import{b as h,c as l,d as C}from"../chunk-CWKDFUFR.mjs";import"../chunk-RSDCKN4Q.mjs";import{formatEther as M}from"viem";import{metaMorphoV11Abi as V}from"@berachain/abis/bend-metamorpho/metaMorphoV11";async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:V,functionName:"maxDeposit",args:[e]});return M(r)}import{mapPoolType as O}from"@berachain-foundation/berancer-sdk";var Gt=e=>({type:O(e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});import{vaultAbi as W}from"@berachain/abis/bex/vault";async function zt({publicClient:e,...t}){let{config:r}=d(t);return(await e.readContract({address:r.bex.vault,abi:W,functionName:"getPausedState"}))[0]}import{decodeFunctionData as B,erc20Abi as J,pad as U,toFunctionSignature as _,trim as k}from"viem";import{appConfig as H,defaultChainId as E}from"@berachain/config/internal";import{beraChefAbi as G}from"@berachain/abis/pol/rewards/beraChef";import{rewardVaultAbi as $}from"@berachain/abis/pol/rewards/rewardVault";function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&r.inputs?.[0]?.name==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${H.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||k(i)==="0x00")return m;let s=U(k(i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(B({data:t,abi:r}))return r}catch{}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return B({data:e,abi:t})}catch{return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _(e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=E,publicClient:o}){let n=[...G,...$,...J],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}import{formatUnits as g}from"viem";import{honeyFactoryAbi as b}from"@berachain/abis/honey/honeyFactory";async function nr({client:e,collateralList:t,...r}){let{config:o}=d(r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:b,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:b,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:b,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+g(a[p],18),redeemFee:1-+g(m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+g(i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+g(i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}import{honeyAbi as K}from"@berachain/abis/honey/honey";async function mr({client:e,...t}){let{config:r}=d(t),o=r.honey.token;return await e.readContract({address:o,abi:K,functionName:"paused"})}import{rootPriceOracleAbi as Z}from"@berachain/abis/extras/rootPriceOracle";async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:Z,functionName:"pythOracle"})}import{honeyFactoryAbi as Q}from"@berachain/abis/honey/honeyFactory";async function gr({publicClient:e,factory:t,...r}){let{config:o}=d(r);return e.readContract({address:t??o.honey.factory,abi:Q,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){l(t);let{config:n}=d(o),a=e??n.averageBlockTime,m=r??Math.floor(w(1)/a),i=await t?.getBlock({blockTag:"latest"}),s=await t?.getBlock({blockNumber:i.number-BigInt(m)});return(P(Date.now())-Number(s?.timestamp))/(Number(i?.number)-Number(s?.number))}import{lstStakerVaultAbi as Y}from"@berachain/abis/pol/lst/lstStakerVault";async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){l(t);let{config:n}=d({...o,chainId:t.chain?.id??o.chainId}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:Y,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>x(y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}import{rewardVaultAbi as v}from"@berachain/abis/pol/rewards/rewardVault";import{rewardVaultFactoryAbi as ee}from"@berachain/abis/pol/rewards/rewardVaultFactory";var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=d(t),o=r.pol.factory;h(e,"publicClient"),C(r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:ee,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){l(e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:v,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:v,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}import{zeroAddress as te}from"viem";import{rewardVaultFactoryAbi as re}from"@berachain/abis/pol/rewards/rewardVaultFactory";async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=d(o),a=await t.readContract({address:r??n.pol.factory,abi:re,functionName:"getVault",args:[e]});return a===te?null:a}import{pythPriceOracleAbi as oe}from"@berachain/abis/extras/pythPriceOracle";async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=d(r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:oe,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=d(t);return(await A({url:e??r.lists.tokenList,type:"rest",name:"GitHub"})).tokens??[]}import{bgtAbi as D}from"@berachain/abis/pol/bgt";import{beraChefAbi as f}from"@berachain/abis/pol/rewards/beraChef";async function to({publicClient:e,ui:t,...r}){let{config:o}=d(r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:f,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:D,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:D,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>o?.receivingVault).reduce((o,n)=>{for(let a of n.receivingVault?.activeIncentives??[]){if(t&&a.remainingAmount==="0")continue;let m=new u(a.incentiveRate).times(n.percentage),i=new u(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new u(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new u(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new u(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new u(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return e?.rewardAllocationWeights?.reduce((t,r)=>{if(!r)return t;let o=r.receivingVault?.activeIncentives.filter(n=>Number(n.remainingAmount)>0).reduce((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)??0;return t+o*r.percentage},0)}function io({validator:e,bgtPrice:t}){let r=Number(e.dynamicData?.activeBoostAmount??0),o=ne(e);return!o||!r?0:o*Number(e.dynamicData?.lastDayDistributedBGTAmount??0)*365/(r*t)}export{me as BalancerApi,se as BaseAggregator,R as BeraApolloClient,Te as HoneyPreviewMethod,be as MOCKED_PROPOSAL_STATUSES,He as RewardVaultDistributionMode,no as aggregateValidatorIncentives,bt as beraWriteContract,ye as checkProposalField,Ae as computeActualStatus,Pt as formatValidatorRewardAllocation,to as getActiveBoostAndCommissionChangeDelay,de as getAllPools,xe as getAllProposals,At as getAllValidators,lt as getAllowances,xt as getApiEnrichedAllocation,ce as getApiPool,ht as getApiValidator,T as getApolloClient,ft as getBalanceCall,Ge as getBgtAprSimulation,hr as getBlockTime,_e as getBlockTimestamp,he as getBodyErrors,Be as getChartData,Fe as getCollateralWeights,ae as getConvertToAssets,Ct as getDailyValidatorBlockStats,Yt as getDecodedFunctionData,Ft as getDefaultRewardAllocation,$e as getEarnedStakedBeraVault,ie as getEnsoClient,De as getGlobalCapLimit,qe as getGlobalData,pe as getGlobalLiquidityAndSwapVolume,Se as getHoneyCollaterals,nr as getHoneyFees,Re as getHoneyGlobalData,mr as getHoneyPausedState,Ie as getHoneyPreview,qr as getHoneyPythFeeds,pr as getHoneyPythOracle,gr as getHoneyRootPriceOracle,Me as getHoneyVaultsBalance,ze as getIncentiveFeeClaimStats,Fr as getLSTStakeConfig,Xe as getMarkets,_t as getMaxDeposit,le as getOnChainPool,fe as getPoolEvents,ge as getPoolHistoricalData,ue as getPoolPausedState,Gt as getPoolState,Ce as getProposalDetails,we as getProposalFromTx,ke as getProposalVotes,Ve as getPythLatestPrices,We as getPythUpdateFee,Oe as getRelativeCapLimit,je as getRewardProofsByValidator,Ke as getRewardTokenToBeraRate,Ze as getRewardVault,Wr as getRewardVaultDurationConstants,Er as getRewardVaultFromToken,Qe as getRewardVaultIncentives,Ee as getRewardVaultRewards,Ye as getRewardVaultStakingToken,Le as getRewardVaults,ot as getSWBeraVaultMetadata,nt as getSWBeraWithdrawal,rt as getStakeWithdrawalCooldown,et as getStakedBeraAPR,tt as getStakedBeraSnapshots,Nt as getStakingPoolBatch,Je as getSwapPayload,ut as getTokenCurrentPrices,Ne as getTokenInformation,Kr as getTokens,at as getTotalStakedAmount,vt as getUserActiveValidators,St as getUserBoostsOnValidator,it as getUserClaimableIncentives,Dt as getUserStakingPositions,mt as getUserVaultInfo,dt as getUserVaults,st as getUserVaultsReward,Rt as getValidatorAnalytics,io as getValidatorBoostApy,Tt as getValidatorCommission,It as getValidatorEstimatedBgtPerYear,Mt as getValidatorOperatorAddress,Vt as getValidatorQueuedCommission,Ot as getValidatorQueuedOperatorAddress,Wt as getValidatorQueuedRewardAllocation,ne as getValidatorReturnPerBgt,kt as getValidatorRewardAllocation,ct as getVaultHistory,zt as getVaultPausedState,pt as getVaultValidators,gt as getWalletBalances,I as gql,ve as isBadCollateralAsset,Ue as isBasketModeEnabled,Bt as isDefaultRewardAllocation,yt as isImpersonateAccount,wt as isSameRewardAllocation,Pe as parseProposalBody};
1
+ import{$ as rt,A as ve,Aa as Rt,B as De,Ba as Tt,C as Re,Ca as It,D as Te,Da as Mt,E as Ie,Ea as Vt,F as Me,Fa as Ot,G as Ve,Ga as Wt,H as Oe,I as We,J as Je,K as Ue,L as _e,M as He,N as Ee,O as Ge,P as $e,Q as Le,R as qe,S as ze,T as Xe,U as je,V as Ke,W as Ze,X as Qe,Y as Ye,Z as et,_ as tt,a as ae,aa as ot,b as R,ba as nt,c as T,ca as at,d as I,da as it,e as se,ea as st,f as me,fa as mt,g as de,ga as dt,h as ce,ha as ct,i as pe,ia as pt,j as ue,ja as ut,k as le,ka as lt,l as fe,la as yt,m as ge,ma as bt,n as ye,na as At,o as be,oa as xt,p as Ae,pa as ht,q as xe,qa as Ct,r as he,ra as Pt,s as Ce,sa as wt,t as Pe,ta as kt,u as we,ua as Bt,v as ke,va as Ft,w as Be,wa as Nt,x as Fe,xa as St,y as Ne,ya as vt,z as Se,za as Dt}from"../chunk-AUA42YIG.mjs";import"../chunk-NLVWRMGD.mjs";import{a as ie,b as ft,c as gt}from"../chunk-47ILYVHC.mjs";import"../chunk-NAXAZJJY.mjs";import"../chunk-OGJMSGB2.mjs";import"../chunk-RJN36GBU.mjs";import{b as h,c as l,d as C}from"../chunk-WBTS6KFG.mjs";import{a as u,d as A,l as P,q as w}from"../chunk-JDDRTHFG.mjs";import{a as d,e as x}from"../chunk-5NVZG5N6.mjs";import"../chunk-PRLVZIKD.mjs";import"../chunk-GXV2JA36.mjs";import{formatEther as M}from"viem";import{metaMorphoV11Abi as V}from"@berachain/abis/bend-metamorpho/metaMorphoV11";async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:V,functionName:"maxDeposit",args:[e]});return M(r)}import{mapPoolType as O}from"@berachain-foundation/berancer-sdk";var Gt=e=>({type:O(e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});import{vaultAbi as W}from"@berachain/abis/bex/vault";async function zt({publicClient:e,...t}){let{config:r}=d(t);return(await e.readContract({address:r.bex.vault,abi:W,functionName:"getPausedState"}))[0]}import{decodeFunctionData as B,erc20Abi as J,pad as U,toFunctionSignature as _,trim as k}from"viem";import{appConfig as H,defaultChainId as E}from"@berachain/config/internal";import{beraChefAbi as G}from"@berachain/abis/pol/rewards/beraChef";import{rewardVaultAbi as $}from"@berachain/abis/pol/rewards/rewardVault";function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&r.inputs?.[0]?.name==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${H.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||k(i)==="0x00")return m;let s=U(k(i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(B({data:t,abi:r}))return r}catch{}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return B({data:e,abi:t})}catch{return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _(e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=E,publicClient:o}){let n=[...G,...$,...J],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}import{formatUnits as g}from"viem";import{honeyFactoryAbi as b}from"@berachain/abis/honey/honeyFactory";async function nr({client:e,collateralList:t,...r}){let{config:o}=d(r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:b,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:b,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:b,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+g(a[p],18),redeemFee:1-+g(m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+g(i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+g(i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}import{honeyAbi as K}from"@berachain/abis/honey/honey";async function mr({client:e,...t}){let{config:r}=d(t),o=r.honey.token;return await e.readContract({address:o,abi:K,functionName:"paused"})}import{rootPriceOracleAbi as Z}from"@berachain/abis/extras/rootPriceOracle";async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:Z,functionName:"pythOracle"})}import{honeyFactoryAbi as Q}from"@berachain/abis/honey/honeyFactory";async function gr({publicClient:e,factory:t,...r}){let{config:o}=d(r);return e.readContract({address:t??o.honey.factory,abi:Q,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){l(t);let{config:n}=d(o),a=e??n.averageBlockTime,m=r??Math.floor(w(1)/a),i=await t?.getBlock({blockTag:"latest"}),s=await t?.getBlock({blockNumber:i.number-BigInt(m)});return(P(Date.now())-Number(s?.timestamp))/(Number(i?.number)-Number(s?.number))}import{lstStakerVaultAbi as Y}from"@berachain/abis/pol/lst/lstStakerVault";async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){l(t);let{config:n}=d({...o,chainId:t.chain?.id??o.chainId}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:Y,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>x(y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}import{rewardVaultAbi as v}from"@berachain/abis/pol/rewards/rewardVault";import{rewardVaultFactoryAbi as ee}from"@berachain/abis/pol/rewards/rewardVaultFactory";var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=d(t),o=r.pol.factory;h(e,"publicClient"),C(r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:ee,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){l(e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:v,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:v,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}import{zeroAddress as te}from"viem";import{rewardVaultFactoryAbi as re}from"@berachain/abis/pol/rewards/rewardVaultFactory";async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=d(o),a=await t.readContract({address:r??n.pol.factory,abi:re,functionName:"getVault",args:[e]});return a===te?null:a}import{pythPriceOracleAbi as oe}from"@berachain/abis/extras/pythPriceOracle";async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=d(r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:oe,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=d(t);return(await A({url:e??r.lists.tokenList,type:"rest",name:"GitHub"})).tokens??[]}import{bgtAbi as D}from"@berachain/abis/pol/bgt";import{beraChefAbi as f}from"@berachain/abis/pol/rewards/beraChef";async function to({publicClient:e,ui:t,...r}){let{config:o}=d(r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:f,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:D,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:D,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:f,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>o?.receivingVault).reduce((o,n)=>{for(let a of n.receivingVault?.activeIncentives??[]){if(t&&a.remainingAmount==="0")continue;let m=new u(a.incentiveRate).times(n.percentage),i=new u(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new u(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new u(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new u(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new u(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return e?.rewardAllocationWeights?.reduce((t,r)=>{if(!r)return t;let o=r.receivingVault?.activeIncentives.filter(n=>Number(n.remainingAmount)>0).reduce((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)??0;return t+o*r.percentage},0)}function io({validator:e,bgtPrice:t}){let r=Number(e.dynamicData?.activeBoostAmount??0),o=ne(e);return!o||!r?0:o*Number(e.dynamicData?.lastDayDistributedBGTAmount??0)*365/(r*t)}export{me as BalancerApi,se as BaseAggregator,R as BeraApolloClient,Te as HoneyPreviewMethod,be as MOCKED_PROPOSAL_STATUSES,He as RewardVaultDistributionMode,no as aggregateValidatorIncentives,bt as beraWriteContract,ye as checkProposalField,Ae as computeActualStatus,Pt as formatValidatorRewardAllocation,to as getActiveBoostAndCommissionChangeDelay,de as getAllPools,xe as getAllProposals,At as getAllValidators,lt as getAllowances,xt as getApiEnrichedAllocation,ce as getApiPool,ht as getApiValidator,T as getApolloClient,ft as getBalanceCall,Ge as getBgtAprSimulation,hr as getBlockTime,_e as getBlockTimestamp,he as getBodyErrors,Be as getChartData,Fe as getCollateralWeights,ae as getConvertToAssets,Ct as getDailyValidatorBlockStats,Yt as getDecodedFunctionData,Ft as getDefaultRewardAllocation,$e as getEarnedStakedBeraVault,ie as getEnsoClient,De as getGlobalCapLimit,qe as getGlobalData,pe as getGlobalLiquidityAndSwapVolume,Re as getHoney24hVolume,Se as getHoneyCollaterals,nr as getHoneyFees,mr as getHoneyPausedState,Ie as getHoneyPreview,qr as getHoneyPythFeeds,pr as getHoneyPythOracle,gr as getHoneyRootPriceOracle,Me as getHoneyVaultsBalance,ze as getIncentiveFeeClaimStats,Fr as getLSTStakeConfig,Xe as getMarkets,_t as getMaxDeposit,le as getOnChainPool,fe as getPoolEvents,ge as getPoolHistoricalData,ue as getPoolPausedState,Gt as getPoolState,Ce as getProposalDetails,we as getProposalFromTx,ke as getProposalVotes,Ve as getPythLatestPrices,We as getPythUpdateFee,Oe as getRelativeCapLimit,je as getRewardProofsByValidator,Ke as getRewardTokenToBeraRate,Ze as getRewardVault,Wr as getRewardVaultDurationConstants,Er as getRewardVaultFromToken,Qe as getRewardVaultIncentives,Ee as getRewardVaultRewards,Ye as getRewardVaultStakingToken,Le as getRewardVaults,ot as getSWBeraVaultMetadata,nt as getSWBeraWithdrawal,rt as getStakeWithdrawalCooldown,et as getStakedBeraAPR,tt as getStakedBeraSnapshots,Nt as getStakingPoolBatch,Je as getSwapPayload,ut as getTokenCurrentPrices,Ne as getTokenInformation,Kr as getTokens,at as getTotalStakedAmount,vt as getUserActiveValidators,St as getUserBoostsOnValidator,it as getUserClaimableIncentives,Dt as getUserStakingPositions,mt as getUserVaultInfo,dt as getUserVaults,st as getUserVaultsReward,Rt as getValidatorAnalytics,io as getValidatorBoostApy,Tt as getValidatorCommission,It as getValidatorEstimatedBgtPerYear,Mt as getValidatorOperatorAddress,Vt as getValidatorQueuedCommission,Ot as getValidatorQueuedOperatorAddress,Wt as getValidatorQueuedRewardAllocation,ne as getValidatorReturnPerBgt,kt as getValidatorRewardAllocation,ct as getVaultHistory,zt as getVaultPausedState,pt as getVaultValidators,gt as getWalletBalances,I as gql,ve as isBadCollateralAsset,Ue as isBasketModeEnabled,Bt as isDefaultRewardAllocation,yt as isImpersonateAccount,wt as isSameRewardAllocation,Pe as parseProposalBody};
2
2
  //# sourceMappingURL=exports.mjs.map