@berachain/berajs 0.2.8-beta.11 → 0.2.8-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.cts} +31 -2
- package/dist/{BeraError-_mQdkanr.d.ts → BeraError-7-A5JYy_.d.ts} +31 -2
- package/dist/{RequestError-DSUzJ1Iy.d.cts → RequestError-02juqN-5.d.cts} +1 -1
- package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +2 -2
- package/dist/actions/exports.d.ts +2 -2
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/governance/exports.cjs +1 -1
- package/dist/actions/governance/exports.cjs.map +1 -1
- package/dist/actions/governance/exports.mjs +1 -1
- package/dist/chunk-2A347ZVN.mjs +2 -0
- package/dist/{chunk-NXXMW2O7.mjs.map → chunk-2A347ZVN.mjs.map} +1 -1
- package/dist/{chunk-WLJHFHKF.mjs → chunk-2VO2D4QO.mjs} +2 -2
- package/dist/chunk-5FVW5XU3.mjs +2 -0
- package/dist/chunk-5FVW5XU3.mjs.map +1 -0
- package/dist/{chunk-GXV2JA36.mjs → chunk-5SIQ7BKT.mjs} +2 -2
- package/dist/chunk-5SIQ7BKT.mjs.map +1 -0
- package/dist/{chunk-ENT2OSXT.mjs → chunk-5XOEJ6XX.mjs} +2 -2
- package/dist/{chunk-ZW2N63FI.mjs → chunk-A5BNPBXN.mjs} +2 -2
- package/dist/{chunk-4TALWNXE.cjs → chunk-COSP3YIF.cjs} +2 -2
- package/dist/chunk-COSP3YIF.cjs.map +1 -0
- package/dist/chunk-D6L7LTA2.cjs.map +1 -1
- package/dist/{chunk-JXM5S4IU.mjs → chunk-DA7GK43B.mjs} +2 -2
- package/dist/chunk-DDEQFR3M.cjs.map +1 -1
- package/dist/{chunk-6JJIZCVY.cjs → chunk-DKZGCMH4.cjs} +2 -2
- package/dist/chunk-DKZGCMH4.cjs.map +1 -0
- package/dist/{chunk-Y2FETC6T.cjs → chunk-F4V5B6F7.cjs} +2 -2
- package/dist/chunk-F4V5B6F7.cjs.map +1 -0
- package/dist/{chunk-QVIAMSZ6.cjs → chunk-FDEUAXET.cjs} +2 -2
- package/dist/chunk-FDEUAXET.cjs.map +1 -0
- package/dist/{chunk-33XNWMPP.cjs → chunk-FQSOUEIJ.cjs} +2 -2
- package/dist/chunk-FQSOUEIJ.cjs.map +1 -0
- package/dist/{chunk-XZC34BHM.cjs → chunk-GEIY554A.cjs} +2 -2
- package/dist/chunk-GEIY554A.cjs.map +1 -0
- package/dist/{chunk-KUQEX7H3.mjs → chunk-JHUVLM54.mjs} +2 -2
- package/dist/{chunk-RCWM55DE.cjs → chunk-JZL5JPDJ.cjs} +2 -2
- package/dist/chunk-JZL5JPDJ.cjs.map +1 -0
- package/dist/{chunk-H6ZO4SLB.mjs → chunk-LUNZGZWN.mjs} +2 -2
- package/dist/{chunk-RJN36GBU.mjs → chunk-OCAMR6XC.mjs} +2 -2
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/{chunk-JIPSTWKO.mjs → chunk-OYF32BQQ.mjs} +2 -2
- package/dist/{chunk-54BTOQE3.cjs → chunk-PFUVKW6F.cjs} +2 -2
- package/dist/chunk-PFUVKW6F.cjs.map +1 -0
- package/dist/{chunk-JSTCUTXP.cjs → chunk-QHCLZTCK.cjs} +2 -2
- package/dist/chunk-QHCLZTCK.cjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -1
- package/dist/{chunk-CHFETMC6.cjs → chunk-S2TNHMSV.cjs} +3 -3
- package/dist/chunk-S2TNHMSV.cjs.map +1 -0
- package/dist/chunk-S4CDSVLK.cjs.map +1 -1
- package/dist/{chunk-5QAFKFM5.mjs → chunk-TU63NRNL.mjs} +2 -2
- package/dist/{chunk-REWME3FY.cjs → chunk-W4JE2NIN.cjs} +2 -2
- package/dist/chunk-W4JE2NIN.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XB2SEO4Y.cjs +2 -0
- package/dist/chunk-XB2SEO4Y.cjs.map +1 -0
- package/dist/chunk-XCVDZUEF.mjs +2 -0
- package/dist/{chunk-K5L2B4DU.mjs.map → chunk-XCVDZUEF.mjs.map} +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/chunk-YYUSCGVI.cjs +2 -0
- package/dist/chunk-YYUSCGVI.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/governance/exports.cjs.map +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +4 -3
- package/dist/errors/exports.d.ts +4 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{global.d-ylUk_etZ.d.ts → global.d-C4FnE4cz.d.ts} +1 -1
- package/dist/{global.d-B9nLZ7ul.d.cts → global.d-CicOIudf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +2 -2
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +3 -3
- package/dist/hooks/exports.d.ts +3 -3
- package/dist/hooks/exports.mjs +2 -2
- package/dist/hooks/governance/exports.cjs +1 -1
- package/dist/hooks/governance/exports.cjs.map +1 -1
- package/dist/hooks/governance/exports.d.cts +2 -2
- package/dist/hooks/governance/exports.d.ts +2 -2
- package/dist/hooks/governance/exports.mjs +1 -1
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/dist/types/governance/exports.cjs.map +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +13 -4
- package/dist/utils/exports.d.ts +13 -4
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +46 -40
- package/src/actions/__test/transports.ts +61 -0
- package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
- package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
- package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
- package/src/data/contracts.ts +5 -0
- package/src/errors/BeraError.ts +27 -0
- package/src/errors/BeraTracing.unit.test.ts +65 -0
- package/src/errors/RequestError.ts +12 -0
- package/src/errors/exports.ts +5 -0
- package/src/errors/getRevertReason.integration.test.ts +3 -3
- package/src/errors/spanStatus.ts +78 -0
- package/src/errors/spanStatus.unit.test.ts +62 -0
- package/src/utils/beraFetch.ts +9 -3
- package/src/utils/exports.ts +1 -0
- package/src/utils/getServerSideClient.ts +4 -2
- package/src/utils/sanitizeRpcUrl.ts +22 -0
- package/src/utils/tracedTransport.ts +35 -0
- package/dist/chunk-33XNWMPP.cjs.map +0 -1
- package/dist/chunk-4TALWNXE.cjs.map +0 -1
- package/dist/chunk-54BTOQE3.cjs.map +0 -1
- package/dist/chunk-6DIA6PXV.cjs +0 -2
- package/dist/chunk-6DIA6PXV.cjs.map +0 -1
- package/dist/chunk-6JJIZCVY.cjs.map +0 -1
- package/dist/chunk-BE6B4PQF.cjs +0 -2
- package/dist/chunk-BE6B4PQF.cjs.map +0 -1
- package/dist/chunk-CHFETMC6.cjs.map +0 -1
- package/dist/chunk-GXV2JA36.mjs.map +0 -1
- package/dist/chunk-JDDRTHFG.mjs +0 -2
- package/dist/chunk-JDDRTHFG.mjs.map +0 -1
- package/dist/chunk-JSTCUTXP.cjs.map +0 -1
- package/dist/chunk-K5L2B4DU.mjs +0 -2
- package/dist/chunk-NXXMW2O7.mjs +0 -2
- package/dist/chunk-QVIAMSZ6.cjs.map +0 -1
- package/dist/chunk-RCWM55DE.cjs.map +0 -1
- package/dist/chunk-REWME3FY.cjs.map +0 -1
- package/dist/chunk-XZC34BHM.cjs.map +0 -1
- package/dist/chunk-Y2FETC6T.cjs.map +0 -1
- /package/dist/{chunk-WLJHFHKF.mjs.map → chunk-2VO2D4QO.mjs.map} +0 -0
- /package/dist/{chunk-ENT2OSXT.mjs.map → chunk-5XOEJ6XX.mjs.map} +0 -0
- /package/dist/{chunk-ZW2N63FI.mjs.map → chunk-A5BNPBXN.mjs.map} +0 -0
- /package/dist/{chunk-JXM5S4IU.mjs.map → chunk-DA7GK43B.mjs.map} +0 -0
- /package/dist/{chunk-KUQEX7H3.mjs.map → chunk-JHUVLM54.mjs.map} +0 -0
- /package/dist/{chunk-H6ZO4SLB.mjs.map → chunk-LUNZGZWN.mjs.map} +0 -0
- /package/dist/{chunk-RJN36GBU.mjs.map → chunk-OCAMR6XC.mjs.map} +0 -0
- /package/dist/{chunk-JIPSTWKO.mjs.map → chunk-OYF32BQQ.mjs.map} +0 -0
- /package/dist/{chunk-5QAFKFM5.mjs.map → chunk-TU63NRNL.mjs.map} +0 -0
package/dist/actions/exports.cjs
CHANGED
|
@@ -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 _chunk4TALWNXEcjs = require('../chunk-4TALWNXE.cjs');var _chunkJSTCUTXPcjs = require('../chunk-JSTCUTXP.cjs');require('../chunk-OUD27MU7.cjs');var _chunkXZC34BHMcjs = require('../chunk-XZC34BHM.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-REWME3FY.cjs');require('../chunk-Y2FETC6T.cjs');var _chunk33XNWMPPcjs = require('../chunk-33XNWMPP.cjs');var _chunk6DIA6PXVcjs = require('../chunk-6DIA6PXV.cjs');var _chunk54BTOQE3cjs = require('../chunk-54BTOQE3.cjs');var _chunkQVIAMSZ6cjs = require('../chunk-QVIAMSZ6.cjs');require('../chunk-S4CDSVLK.cjs');require('../chunk-6JJIZCVY.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function yt({vaultAddress:e,publicClient:t}){let o=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, o)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var xt=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 wt({publicClient:e,...t}){let{config:o}=_chunkQVIAMSZ6cjs.a.call(void 0, t);return(await e.readContract({address:o.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function Rt({client:e,collateralList:t,...o}){let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, o);try{let a={mint:[],redeem:[]};for(let m of t)a.mint.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[m.address]})),a.redeem.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[m.address]}));let[n,d,s]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((m,p)=>{let c=t.indexOf(p);return m.single[p.address]={mintFee:1-+_viem.formatUnits.call(void 0, n[c],18),redeemFee:1-+_viem.formatUnits.call(void 0, d[c],18)},m.basket.mintFee+=m.single[p.address].mintFee*+_viem.formatUnits.call(void 0, s[c],18),m.basket.redeemFee+=m.single[p.address].redeemFee*+_viem.formatUnits.call(void 0, s[c],18),m},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}var _honey = require('@berachain/abis/honey/honey');async function Tt({client:e,...t}){let{config:o}=_chunkQVIAMSZ6cjs.a.call(void 0, t),r=o.honey.token;return await e.readContract({address:r,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function It({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function Jt({publicClient:e,factory:t,...o}){let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, o);return e.readContract({address:_nullishCoalesce(t, () => (r.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function _t({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){_chunk33XNWMPPcjs.b.call(void 0, t);let{config:a}=_chunkQVIAMSZ6cjs.a.call(void 0, r),n=_nullishCoalesce(e, () => (a.averageBlockTime)),d=_nullishCoalesce(o, () => (Math.floor(_chunk6DIA6PXVcjs.q.call(void 0, 1)/n))),s=await _optionalChain([t, 'optionalAccess', _2 => _2.getBlock, 'call', _3 => _3({blockTag:"latest"})]),m=await _optionalChain([t, 'optionalAccess', _4 => _4.getBlock, 'call', _5 => _5({blockNumber:s.number-BigInt(d)})]);return(_chunk6DIA6PXVcjs.l.call(void 0, Date.now())-Number(_optionalChain([m, 'optionalAccess', _6 => _6.timestamp])))/(Number(_optionalChain([s, 'optionalAccess', _7 => _7.number]))-Number(_optionalChain([m, 'optionalAccess', _8 => _8.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Kt({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){_chunk33XNWMPPcjs.b.call(void 0, t);let{config:a}=_chunkQVIAMSZ6cjs.a.call(void 0, {...r,chainId:_nullishCoalesce(_optionalChain([t, 'access', _9 => _9.chain, 'optionalAccess', _10 => _10.id]), () => (r.chainId))}),n=e.filter(s=>o.includes(s.address));return n.length===0?[]:(await Promise.all(n.map(async s=>({assetTokenAddress:await t.readContract({address:s.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:s})))).reduce((s,{assetTokenAddress:m,stakingToken:p})=>{let c=e.find(y=>_chunk54BTOQE3cjs.d.call(void 0, y,m));return c&&s.push({id:p.address,receiptToken:p,inputTokens:[c]}),s},[])}var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var B=[{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 k({publicClient:e,...t}){let{config:o}=_chunkQVIAMSZ6cjs.a.call(void 0, t),r=o.pol.factory;_chunk33XNWMPPcjs.a.call(void 0, e,"publicClient"),_chunk33XNWMPPcjs.c.call(void 0, o.pol.factory,"factoryAddress");let a=await e.readContract({address:r,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:a,abi:B,functionName:"implementation"})}async function sr({publicClient:e,...t}){_chunk33XNWMPPcjs.b.call(void 0, e);let o=await k({publicClient:e,...t}),[r,a]=await Promise.all([e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(r),maxRewardDuration:Number(a)}}async function lr({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:a}=_chunkQVIAMSZ6cjs.a.call(void 0, r),n=await t.readContract({address:_nullishCoalesce(o, () => (a.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return n===_viem.zeroAddress?null:n}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function yr({tokenList:e,publicClient:t,...o}){let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, o);try{let a=await Promise.all(e.map(n=>t.readContract({address:r.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[n]})));return e.reduce((n,d,s)=>({...n,[d]:a[s]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function hr({url:e,...t}={}){let{config:o}=_chunkQVIAMSZ6cjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunk6DIA6PXVcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (o.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');async function kr({publicClient:e,ui:t,...o}){let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, o),[a,n,d,s,m,p,c,y]=await Promise.all([e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(c),unboostDelay:Number(p),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(d),maxWeightPerVault:Number(s)/1e4,maxNumWeightsPerRewardAllocation:Number(m),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function Rr({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>_optionalChain([r, 'optionalAccess', _11 => _11.receivingVault])).reduce((r,a)=>{for(let n of _nullishCoalesce(_optionalChain([a, 'access', _12 => _12.receivingVault, 'optionalAccess', _13 => _13.activeIncentives]), () => ([]))){if(t&&n.remainingAmount==="0")continue;let d=new (0, _chunk6DIA6PXVcjs.a)(n.incentiveRate).times(a.percentage),s=new (0, _chunk6DIA6PXVcjs.a)(n.incentiveRateUsd).times(a.percentage),m=n.token.address.toLowerCase(),p=r.get(m);p?r.set(m,{...p,incentiveRate:new (0, _chunk6DIA6PXVcjs.a)(p.incentiveRate).plus(d).toString(),incentiveRateUsd:new (0, _chunk6DIA6PXVcjs.a)(p.incentiveRateUsd).plus(s).toString(),remainingAmount:new (0, _chunk6DIA6PXVcjs.a)(p.remainingAmount).plus(n.remainingAmount).toString(),remainingAmountUsd:new (0, _chunk6DIA6PXVcjs.a)(p.remainingAmountUsd).plus(n.remainingAmountUsd).toString()}):r.set(m,{...n,tokenAddress:n.token.address,token:n.token,incentiveRate:d.toString(),incentiveRateUsd:s.toString(),remainingAmount:n.remainingAmount})}return r},new Map);return Array.from(o.values())}function G(e){return _optionalChain([e, 'optionalAccess', _14 => _14.rewardAllocationWeights, 'optionalAccess', _15 => _15.reduce, 'call', _16 => _16((t,o)=>{if(!o)return t;let r=_nullishCoalesce(_optionalChain([o, 'access', _17 => _17.receivingVault, 'optionalAccess', _18 => _18.activeIncentives, 'access', _19 => _19.filter, 'call', _20 => _20(a=>Number(a.remainingAmount)>0), 'access', _21 => _21.reduce, 'call', _22 => _22((a,n)=>{let d=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*d},0)]), () => (0));return t+r*o.percentage},0)])}function Fr({validator:e,bgtPrice:t}){let o=Number(_nullishCoalesce(_optionalChain([e, 'access', _23 => _23.dynamicData, 'optionalAccess', _24 => _24.activeBoostAmount]), () => (0))),r=G(e);return!r||!o?0:r*Number(_nullishCoalesce(_optionalChain([e, 'access', _25 => _25.dynamicData, 'optionalAccess', _26 => _26.lastDayDistributedBGTAmount]), () => (0)))*365/(o*t)}exports.BalancerApi = _chunk4TALWNXEcjs.c; exports.BaseAggregator = _chunk4TALWNXEcjs.b; exports.BeraApolloClient = _chunkJSTCUTXPcjs.a; exports.HoneyPreviewMethod = _chunk4TALWNXEcjs.r; exports.RewardVaultDistributionMode = _chunk4TALWNXEcjs.A; exports.aggregateValidatorIncentives = Rr; exports.beraWriteContract = _chunk4TALWNXEcjs.aa; exports.formatValidatorRewardAllocation = _chunk4TALWNXEcjs.fa; exports.getActiveBoostAndCommissionChangeDelay = kr; exports.getAllPools = _chunk4TALWNXEcjs.d; exports.getAllValidators = _chunk4TALWNXEcjs.ba; exports.getAllowances = _chunk4TALWNXEcjs._; exports.getApiEnrichedAllocation = _chunk4TALWNXEcjs.ca; exports.getApiPool = _chunk4TALWNXEcjs.e; exports.getApiValidator = _chunk4TALWNXEcjs.da; exports.getApolloClient = _chunkJSTCUTXPcjs.b; exports.getBalanceCall = _chunkXZC34BHMcjs.b; exports.getBgtAprSimulation = _chunk4TALWNXEcjs.C; exports.getBlockTime = _t; exports.getBlockTimestamp = _chunk4TALWNXEcjs.z; exports.getChartData = _chunk4TALWNXEcjs.k; exports.getCollateralWeights = _chunk4TALWNXEcjs.l; exports.getConvertToAssets = _chunk4TALWNXEcjs.a; exports.getDailyValidatorBlockStats = _chunk4TALWNXEcjs.ea; exports.getDefaultRewardAllocation = _chunk4TALWNXEcjs.ja; exports.getEarnedStakedBeraVault = _chunk4TALWNXEcjs.D; exports.getEnsoClient = _chunkXZC34BHMcjs.a; exports.getGlobalCapLimit = _chunk4TALWNXEcjs.p; exports.getGlobalData = _chunk4TALWNXEcjs.F; exports.getGlobalLiquidityAndSwapVolume = _chunk4TALWNXEcjs.f; exports.getHoney24hVolume = _chunk4TALWNXEcjs.q; exports.getHoneyCollaterals = _chunk4TALWNXEcjs.n; exports.getHoneyFees = Rt; exports.getHoneyPausedState = Tt; exports.getHoneyPreview = _chunk4TALWNXEcjs.s; exports.getHoneyPythFeeds = yr; exports.getHoneyPythOracle = It; exports.getHoneyRootPriceOracle = Jt; exports.getHoneyVaultsBalance = _chunk4TALWNXEcjs.t; exports.getIncentiveFeeClaimStats = _chunk4TALWNXEcjs.G; exports.getLSTStakeConfig = Kt; exports.getMarkets = _chunk4TALWNXEcjs.H; exports.getMaxDeposit = yt; exports.getOnChainPool = _chunk4TALWNXEcjs.h; exports.getPoolEvents = _chunk4TALWNXEcjs.i; exports.getPoolHistoricalData = _chunk4TALWNXEcjs.j; exports.getPoolPausedState = _chunk4TALWNXEcjs.g; exports.getPoolState = xt; exports.getPythLatestPrices = _chunk4TALWNXEcjs.u; exports.getPythUpdateFee = _chunk4TALWNXEcjs.w; exports.getRelativeCapLimit = _chunk4TALWNXEcjs.v; exports.getRewardProofsByValidator = _chunk4TALWNXEcjs.I; exports.getRewardTokenToBeraRate = _chunk4TALWNXEcjs.J; exports.getRewardVault = _chunk4TALWNXEcjs.K; exports.getRewardVaultDurationConstants = sr; exports.getRewardVaultFromToken = lr; exports.getRewardVaultIncentives = _chunk4TALWNXEcjs.L; exports.getRewardVaultRewards = _chunk4TALWNXEcjs.B; exports.getRewardVaultStakingToken = _chunk4TALWNXEcjs.M; exports.getRewardVaults = _chunk4TALWNXEcjs.E; exports.getSWBeraVaultMetadata = _chunk4TALWNXEcjs.Q; exports.getSWBeraWithdrawal = _chunk4TALWNXEcjs.R; exports.getStakeWithdrawalCooldown = _chunk4TALWNXEcjs.P; exports.getStakedBeraAPR = _chunk4TALWNXEcjs.N; exports.getStakedBeraSnapshots = _chunk4TALWNXEcjs.O; exports.getStakingPoolBatch = _chunk4TALWNXEcjs.ka; exports.getSwapPayload = _chunk4TALWNXEcjs.x; exports.getTokenCurrentPrices = _chunk4TALWNXEcjs.Z; exports.getTokenInformation = _chunk4TALWNXEcjs.m; exports.getTokens = hr; exports.getTotalStakedAmount = _chunk4TALWNXEcjs.S; exports.getUserActiveValidators = _chunk4TALWNXEcjs.ma; exports.getUserBoostsOnValidator = _chunk4TALWNXEcjs.la; exports.getUserClaimableIncentives = _chunk4TALWNXEcjs.T; exports.getUserStakingPositions = _chunk4TALWNXEcjs.na; exports.getUserVaultInfo = _chunk4TALWNXEcjs.V; exports.getUserVaults = _chunk4TALWNXEcjs.W; exports.getUserVaultsReward = _chunk4TALWNXEcjs.U; exports.getValidatorAnalytics = _chunk4TALWNXEcjs.oa; exports.getValidatorBoostApy = Fr; exports.getValidatorCommission = _chunk4TALWNXEcjs.pa; exports.getValidatorEstimatedBgtPerYear = _chunk4TALWNXEcjs.qa; exports.getValidatorOperatorAddress = _chunk4TALWNXEcjs.ra; exports.getValidatorQueuedCommission = _chunk4TALWNXEcjs.sa; exports.getValidatorQueuedOperatorAddress = _chunk4TALWNXEcjs.ta; exports.getValidatorQueuedRewardAllocation = _chunk4TALWNXEcjs.ua; exports.getValidatorReturnPerBgt = G; exports.getValidatorRewardAllocation = _chunk4TALWNXEcjs.ha; exports.getVaultHistory = _chunk4TALWNXEcjs.X; exports.getVaultPausedState = wt; exports.getVaultValidators = _chunk4TALWNXEcjs.Y; exports.getWalletBalances = _chunkXZC34BHMcjs.c; exports.gql = _chunkJSTCUTXPcjs.c; exports.isBadCollateralAsset = _chunk4TALWNXEcjs.o; exports.isBasketModeEnabled = _chunk4TALWNXEcjs.y; exports.isDefaultRewardAllocation = _chunk4TALWNXEcjs.ia; exports.isImpersonateAccount = _chunk4TALWNXEcjs.$; exports.isSameRewardAllocation = _chunk4TALWNXEcjs.ga;
|
|
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 _chunkCOSP3YIFcjs = require('../chunk-COSP3YIF.cjs');var _chunkXB2SEO4Ycjs = require('../chunk-XB2SEO4Y.cjs');var _chunkGEIY554Acjs = require('../chunk-GEIY554A.cjs');var _chunkPFUVKW6Fcjs = require('../chunk-PFUVKW6F.cjs');require('../chunk-W4JE2NIN.cjs');require('../chunk-F4V5B6F7.cjs');require('../chunk-OUD27MU7.cjs');require('../chunk-OIYXOKTT.cjs');var _chunkQHCLZTCKcjs = require('../chunk-QHCLZTCK.cjs');var _chunkFDEUAXETcjs = require('../chunk-FDEUAXET.cjs');require('../chunk-S4CDSVLK.cjs');var _chunkFQSOUEIJcjs = require('../chunk-FQSOUEIJ.cjs');require('../chunk-DKZGCMH4.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function yt({vaultAddress:e,publicClient:t}){let o=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, o)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var xt=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 wt({publicClient:e,...t}){let{config:o}=_chunkFDEUAXETcjs.a.call(void 0, t);return(await e.readContract({address:o.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function Rt({client:e,collateralList:t,...o}){let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, o);try{let a={mint:[],redeem:[]};for(let m of t)a.mint.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[m.address]})),a.redeem.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[m.address]}));let[n,d,s]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((m,p)=>{let c=t.indexOf(p);return m.single[p.address]={mintFee:1-+_viem.formatUnits.call(void 0, n[c],18),redeemFee:1-+_viem.formatUnits.call(void 0, d[c],18)},m.basket.mintFee+=m.single[p.address].mintFee*+_viem.formatUnits.call(void 0, s[c],18),m.basket.redeemFee+=m.single[p.address].redeemFee*+_viem.formatUnits.call(void 0, s[c],18),m},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}var _honey = require('@berachain/abis/honey/honey');async function Tt({client:e,...t}){let{config:o}=_chunkFDEUAXETcjs.a.call(void 0, t),r=o.honey.token;return await e.readContract({address:r,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function It({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function Jt({publicClient:e,factory:t,...o}){let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, o);return e.readContract({address:_nullishCoalesce(t, () => (r.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function _t({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){_chunkFQSOUEIJcjs.b.call(void 0, t);let{config:a}=_chunkFDEUAXETcjs.a.call(void 0, r),n=_nullishCoalesce(e, () => (a.averageBlockTime)),d=_nullishCoalesce(o, () => (Math.floor(_chunkXB2SEO4Ycjs.r.call(void 0, 1)/n))),s=await _optionalChain([t, 'optionalAccess', _2 => _2.getBlock, 'call', _3 => _3({blockTag:"latest"})]),m=await _optionalChain([t, 'optionalAccess', _4 => _4.getBlock, 'call', _5 => _5({blockNumber:s.number-BigInt(d)})]);return(_chunkXB2SEO4Ycjs.m.call(void 0, Date.now())-Number(_optionalChain([m, 'optionalAccess', _6 => _6.timestamp])))/(Number(_optionalChain([s, 'optionalAccess', _7 => _7.number]))-Number(_optionalChain([m, 'optionalAccess', _8 => _8.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Kt({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){_chunkFQSOUEIJcjs.b.call(void 0, t);let{config:a}=_chunkFDEUAXETcjs.a.call(void 0, {...r,chainId:_nullishCoalesce(_optionalChain([t, 'access', _9 => _9.chain, 'optionalAccess', _10 => _10.id]), () => (r.chainId))}),n=e.filter(s=>o.includes(s.address));return n.length===0?[]:(await Promise.all(n.map(async s=>({assetTokenAddress:await t.readContract({address:s.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:s})))).reduce((s,{assetTokenAddress:m,stakingToken:p})=>{let c=e.find(y=>_chunkPFUVKW6Fcjs.d.call(void 0, y,m));return c&&s.push({id:p.address,receiptToken:p,inputTokens:[c]}),s},[])}var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var B=[{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 k({publicClient:e,...t}){let{config:o}=_chunkFDEUAXETcjs.a.call(void 0, t),r=o.pol.factory;_chunkFQSOUEIJcjs.a.call(void 0, e,"publicClient"),_chunkFQSOUEIJcjs.c.call(void 0, o.pol.factory,"factoryAddress");let a=await e.readContract({address:r,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:a,abi:B,functionName:"implementation"})}async function sr({publicClient:e,...t}){_chunkFQSOUEIJcjs.b.call(void 0, e);let o=await k({publicClient:e,...t}),[r,a]=await Promise.all([e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:o,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(r),maxRewardDuration:Number(a)}}async function lr({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:a}=_chunkFDEUAXETcjs.a.call(void 0, r),n=await t.readContract({address:_nullishCoalesce(o, () => (a.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return n===_viem.zeroAddress?null:n}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function yr({tokenList:e,publicClient:t,...o}){let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, o);try{let a=await Promise.all(e.map(n=>t.readContract({address:r.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[n]})));return e.reduce((n,d,s)=>({...n,[d]:a[s]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function hr({url:e,...t}={}){let{config:o}=_chunkFDEUAXETcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunkXB2SEO4Ycjs.e.call(void 0, {url:_nullishCoalesce(e, () => (o.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');async function kr({publicClient:e,ui:t,...o}){let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, o),[a,n,d,s,m,p,c,y]=await Promise.all([e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:r.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:r.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(c),unboostDelay:Number(p),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(d),maxWeightPerVault:Number(s)/1e4,maxNumWeightsPerRewardAllocation:Number(m),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function Rr({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>_optionalChain([r, 'optionalAccess', _11 => _11.receivingVault])).reduce((r,a)=>{for(let n of _nullishCoalesce(_optionalChain([a, 'access', _12 => _12.receivingVault, 'optionalAccess', _13 => _13.activeIncentives]), () => ([]))){if(t&&n.remainingAmount==="0")continue;let d=new (0, _chunkXB2SEO4Ycjs.a)(n.incentiveRate).times(a.percentage),s=new (0, _chunkXB2SEO4Ycjs.a)(n.incentiveRateUsd).times(a.percentage),m=n.token.address.toLowerCase(),p=r.get(m);p?r.set(m,{...p,incentiveRate:new (0, _chunkXB2SEO4Ycjs.a)(p.incentiveRate).plus(d).toString(),incentiveRateUsd:new (0, _chunkXB2SEO4Ycjs.a)(p.incentiveRateUsd).plus(s).toString(),remainingAmount:new (0, _chunkXB2SEO4Ycjs.a)(p.remainingAmount).plus(n.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkXB2SEO4Ycjs.a)(p.remainingAmountUsd).plus(n.remainingAmountUsd).toString()}):r.set(m,{...n,tokenAddress:n.token.address,token:n.token,incentiveRate:d.toString(),incentiveRateUsd:s.toString(),remainingAmount:n.remainingAmount})}return r},new Map);return Array.from(o.values())}function G(e){return _optionalChain([e, 'optionalAccess', _14 => _14.rewardAllocationWeights, 'optionalAccess', _15 => _15.reduce, 'call', _16 => _16((t,o)=>{if(!o)return t;let r=_nullishCoalesce(_optionalChain([o, 'access', _17 => _17.receivingVault, 'optionalAccess', _18 => _18.activeIncentives, 'access', _19 => _19.filter, 'call', _20 => _20(a=>Number(a.remainingAmount)>0), 'access', _21 => _21.reduce, 'call', _22 => _22((a,n)=>{let d=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*d},0)]), () => (0));return t+r*o.percentage},0)])}function Fr({validator:e,bgtPrice:t}){let o=Number(_nullishCoalesce(_optionalChain([e, 'access', _23 => _23.dynamicData, 'optionalAccess', _24 => _24.activeBoostAmount]), () => (0))),r=G(e);return!r||!o?0:r*Number(_nullishCoalesce(_optionalChain([e, 'access', _25 => _25.dynamicData, 'optionalAccess', _26 => _26.lastDayDistributedBGTAmount]), () => (0)))*365/(o*t)}exports.BalancerApi = _chunkCOSP3YIFcjs.c; exports.BaseAggregator = _chunkCOSP3YIFcjs.b; exports.BeraApolloClient = _chunkQHCLZTCKcjs.a; exports.HoneyPreviewMethod = _chunkCOSP3YIFcjs.r; exports.RewardVaultDistributionMode = _chunkCOSP3YIFcjs.A; exports.aggregateValidatorIncentives = Rr; exports.beraWriteContract = _chunkCOSP3YIFcjs.aa; exports.formatValidatorRewardAllocation = _chunkCOSP3YIFcjs.fa; exports.getActiveBoostAndCommissionChangeDelay = kr; exports.getAllPools = _chunkCOSP3YIFcjs.d; exports.getAllValidators = _chunkCOSP3YIFcjs.ba; exports.getAllowances = _chunkCOSP3YIFcjs._; exports.getApiEnrichedAllocation = _chunkCOSP3YIFcjs.ca; exports.getApiPool = _chunkCOSP3YIFcjs.e; exports.getApiValidator = _chunkCOSP3YIFcjs.da; exports.getApolloClient = _chunkQHCLZTCKcjs.b; exports.getBalanceCall = _chunkGEIY554Acjs.b; exports.getBgtAprSimulation = _chunkCOSP3YIFcjs.C; exports.getBlockTime = _t; exports.getBlockTimestamp = _chunkCOSP3YIFcjs.z; exports.getChartData = _chunkCOSP3YIFcjs.k; exports.getCollateralWeights = _chunkCOSP3YIFcjs.l; exports.getConvertToAssets = _chunkCOSP3YIFcjs.a; exports.getDailyValidatorBlockStats = _chunkCOSP3YIFcjs.ea; exports.getDefaultRewardAllocation = _chunkCOSP3YIFcjs.ja; exports.getEarnedStakedBeraVault = _chunkCOSP3YIFcjs.D; exports.getEnsoClient = _chunkGEIY554Acjs.a; exports.getGlobalCapLimit = _chunkCOSP3YIFcjs.p; exports.getGlobalData = _chunkCOSP3YIFcjs.F; exports.getGlobalLiquidityAndSwapVolume = _chunkCOSP3YIFcjs.f; exports.getHoney24hVolume = _chunkCOSP3YIFcjs.q; exports.getHoneyCollaterals = _chunkCOSP3YIFcjs.n; exports.getHoneyFees = Rt; exports.getHoneyPausedState = Tt; exports.getHoneyPreview = _chunkCOSP3YIFcjs.s; exports.getHoneyPythFeeds = yr; exports.getHoneyPythOracle = It; exports.getHoneyRootPriceOracle = Jt; exports.getHoneyVaultsBalance = _chunkCOSP3YIFcjs.t; exports.getIncentiveFeeClaimStats = _chunkCOSP3YIFcjs.G; exports.getLSTStakeConfig = Kt; exports.getMarkets = _chunkCOSP3YIFcjs.H; exports.getMaxDeposit = yt; exports.getOnChainPool = _chunkCOSP3YIFcjs.h; exports.getPoolEvents = _chunkCOSP3YIFcjs.i; exports.getPoolHistoricalData = _chunkCOSP3YIFcjs.j; exports.getPoolPausedState = _chunkCOSP3YIFcjs.g; exports.getPoolState = xt; exports.getPythLatestPrices = _chunkCOSP3YIFcjs.u; exports.getPythUpdateFee = _chunkCOSP3YIFcjs.w; exports.getRelativeCapLimit = _chunkCOSP3YIFcjs.v; exports.getRewardProofsByValidator = _chunkCOSP3YIFcjs.I; exports.getRewardTokenToBeraRate = _chunkCOSP3YIFcjs.J; exports.getRewardVault = _chunkCOSP3YIFcjs.K; exports.getRewardVaultDurationConstants = sr; exports.getRewardVaultFromToken = lr; exports.getRewardVaultIncentives = _chunkCOSP3YIFcjs.L; exports.getRewardVaultRewards = _chunkCOSP3YIFcjs.B; exports.getRewardVaultStakingToken = _chunkCOSP3YIFcjs.M; exports.getRewardVaults = _chunkCOSP3YIFcjs.E; exports.getSWBeraVaultMetadata = _chunkCOSP3YIFcjs.Q; exports.getSWBeraWithdrawal = _chunkCOSP3YIFcjs.R; exports.getStakeWithdrawalCooldown = _chunkCOSP3YIFcjs.P; exports.getStakedBeraAPR = _chunkCOSP3YIFcjs.N; exports.getStakedBeraSnapshots = _chunkCOSP3YIFcjs.O; exports.getStakingPoolBatch = _chunkCOSP3YIFcjs.ka; exports.getSwapPayload = _chunkCOSP3YIFcjs.x; exports.getTokenCurrentPrices = _chunkCOSP3YIFcjs.Z; exports.getTokenInformation = _chunkCOSP3YIFcjs.m; exports.getTokens = hr; exports.getTotalStakedAmount = _chunkCOSP3YIFcjs.S; exports.getUserActiveValidators = _chunkCOSP3YIFcjs.ma; exports.getUserBoostsOnValidator = _chunkCOSP3YIFcjs.la; exports.getUserClaimableIncentives = _chunkCOSP3YIFcjs.T; exports.getUserStakingPositions = _chunkCOSP3YIFcjs.na; exports.getUserVaultInfo = _chunkCOSP3YIFcjs.V; exports.getUserVaults = _chunkCOSP3YIFcjs.W; exports.getUserVaultsReward = _chunkCOSP3YIFcjs.U; exports.getValidatorAnalytics = _chunkCOSP3YIFcjs.oa; exports.getValidatorBoostApy = Fr; exports.getValidatorCommission = _chunkCOSP3YIFcjs.pa; exports.getValidatorEstimatedBgtPerYear = _chunkCOSP3YIFcjs.qa; exports.getValidatorOperatorAddress = _chunkCOSP3YIFcjs.ra; exports.getValidatorQueuedCommission = _chunkCOSP3YIFcjs.sa; exports.getValidatorQueuedOperatorAddress = _chunkCOSP3YIFcjs.ta; exports.getValidatorQueuedRewardAllocation = _chunkCOSP3YIFcjs.ua; exports.getValidatorReturnPerBgt = G; exports.getValidatorRewardAllocation = _chunkCOSP3YIFcjs.ha; exports.getVaultHistory = _chunkCOSP3YIFcjs.X; exports.getVaultPausedState = wt; exports.getVaultValidators = _chunkCOSP3YIFcjs.Y; exports.getWalletBalances = _chunkGEIY554Acjs.c; exports.gql = _chunkQHCLZTCKcjs.c; exports.isBadCollateralAsset = _chunkCOSP3YIFcjs.o; exports.isBasketModeEnabled = _chunkCOSP3YIFcjs.y; exports.isDefaultRewardAllocation = _chunkCOSP3YIFcjs.ia; exports.isImpersonateAccount = _chunkCOSP3YIFcjs.$; exports.isSameRewardAllocation = _chunkCOSP3YIFcjs.ga;
|
|
2
2
|
//# sourceMappingURL=exports.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/actions/exports.cjs","../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/aggregateValidatorIncentives.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"names":["getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","getPoolState","apiPool","mapPoolType","pt","getVaultPausedState","args","config","parseBaseArgs","balancerVaultAbi","getHoneyFees","client","collateralList","promiseList","coll","honeyFactoryAbi","mintRates","redeemRates","collateralWeights","acc","collIdx","formatUnits","e","getHoneyPausedState","honeyAddress","honeyAbi","getHoneyPythOracle","pythOracle","honeyRootOracleAbi","getHoneyRootPriceOracle","factory","getBlockTime","defaultBlockTime","blocksSpan","assertPublicClient","blockTime","span","hoursInSeconds","currentBlock","oldestBlock","msToSeconds","getLSTStakeConfig","tokenList","lstStakingVaults","lstStakingTokens","token","stakingToken","lstStakerVaultAbi","assetTokenAddress","assetToken","isToken","upgradableBeaconAbi","getRewardVaultBeaconImplementation","factoryAddress","assertDefined","assertAddress","beacon","rewardVaultFactoryAbi","getRewardVaultDurationConstants","baseArgs","beaconImplementation","minRewardDuration","maxRewardDuration","rewardVaultAbi","getRewardVaultFromToken","tokenAddress","zeroAddress","getHoneyPythFeeds","priceFeedIds","pythPriceOracleAbi","index","getTokens","url","beraFetchJson","getActiveBoostAndCommissionChangeDelay","ui","maxCommissionRate","commissionChangeDelay","rewardAllocationBlockDelay","maxWeightPerVault","maxNumWeightsPerRewardAllocation","dropBoostDelay","activateBoostDelay","rewardAllocationInactivityBlockSpan","beraChefAbi","bgtAbi","aggregateValidatorIncentives","rewardAllocationWeights","activeOnly","map","x","rv","incentive","incentiveRate","bignumber_js_default","incentiveRateUsd","existing","getValidatorReturnPerBgt","validator","ab","totalIncentiveValue","inc","currIncentive","tokenPrice","getValidatorBoostApy","bgtPrice","validatorActiveBoostAmount","returnPerBgt"],"mappings":"AAAA,+1BAAsoB,yDAAwD,iCAA8B,yDAA0D,iCAA8B,iCAA8B,iCAA8B,yDAAwD,yDAA+D,yDAA0C,yDAA0C,iCAA8B,iCAA8B,4BCA1jC,8EAEX,MAOlD,SAAsBA,EAAAA,CAA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,CAAC,GAAA,SAAK,GAAA,CAEb,OAAOpF,CAAAA,CAAMiF,CAAAA,CAAsBD,CAAAA,CAAG,UACxC,CAAA,CAAG,CAAC,GACN,CAEO,SAASK,EAAAA,CAAqB,CACnC,SAAA,CAAAN,CAAAA,CACA,QAAA,CAAAO,CACF,CAAA,CAMW,CACT,IAAMC,CAAAA,CAA6B,MAAA,kCACjCR,CAAAA,uBAAU,WAAA,+BAAa,mBAAA,SAAqB,GAC9C,CAAA,CAEMS,CAAAA,CAAeV,CAAAA,CAAyBC,CAAS,CAAA,CAEvD,MAAI,CAACS,CAAAA,EAAgB,CAACD,CAAAA,CAGb,CAAA,CAINC,CAAAA,CACC,MAAA,kCAAOT,CAAAA,uBAAU,WAAA,+BAAa,6BAAA,SAA+B,GAAC,CAAA,CAC9D,GAAA,CAAA,CACDQ,CAAAA,CAA6BD,CAAAA,CAGlC,CAAA,wrJAAA","file":"/Users/liammcaweeney/Work/bera/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 { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"@berachain/abis/honey/honey\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rootPriceOracleAbi as honeyRootOracleAbi } from \"@berachain/abis/extras/rootPriceOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import type { PublicClient } from \"viem\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"../../utils/time\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n publicClient,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n publicClient: PublicClient | undefined;\n} & BeraJS.BaseFunctionArgs): Promise<number> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs(args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const currentBlock = await publicClient?.getBlock({ blockTag: \"latest\" });\n const oldestBlock = await publicClient?.getBlock({\n blockNumber: currentBlock.number - BigInt(span),\n });\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(oldestBlock?.timestamp)) /\n (Number(currentBlock?.number) - Number(oldestBlock?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"@berachain/abis/pol/lst/lstStakerVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { TokenWithMetadata } from \"../../types/dex\";\nimport type { StakingConfig } from \"../../types/staking\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { upgradableBeaconAbi } from \"../../abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"@berachain/abis/extras/pythPriceOracle\";\n\nimport type { PythPriceFeedMap } from \"../../types/honeySwap\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"../../types/dex\";\nimport { beraFetchJson } from \"../../utils/beraFetch\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type {\n ApiMinimalVaultIncentiveFragment,\n ApiValidatorRewardAllocationWeightFragment,\n} from \"@berachain/graphql/pol/api\";\nimport BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\nexport function aggregateValidatorIncentives({\n rewardAllocationWeights,\n activeOnly = true,\n}: {\n rewardAllocationWeights: ApiValidatorRewardAllocationWeightFragment[];\n activeOnly?: boolean;\n}): ApiMinimalVaultIncentiveFragment[] {\n const map = rewardAllocationWeights\n .filter((x) => x?.receivingVault)\n\n .reduce((acc, rv) => {\n for (const incentive of rv.receivingVault?.activeIncentives ?? []) {\n if (activeOnly && incentive.remainingAmount === \"0\") {\n continue;\n }\n const incentiveRate = new BigNumber(incentive.incentiveRate).times(\n rv.percentage,\n );\n\n const incentiveRateUsd = new BigNumber(\n incentive.incentiveRateUsd,\n ).times(rv.percentage);\n\n const token = incentive.token.address.toLowerCase();\n\n const existing = acc.get(token);\n if (existing) {\n acc.set(token, {\n ...existing,\n incentiveRate: new BigNumber(existing.incentiveRate)\n .plus(incentiveRate)\n .toString(),\n incentiveRateUsd: new BigNumber(existing.incentiveRateUsd)\n .plus(incentiveRateUsd)\n .toString(),\n remainingAmount: new BigNumber(existing.remainingAmount)\n .plus(incentive.remainingAmount)\n .toString(),\n remainingAmountUsd: new BigNumber(existing.remainingAmountUsd)\n .plus(incentive.remainingAmountUsd)\n .toString(),\n });\n } else {\n acc.set(token, {\n ...incentive,\n tokenAddress: incentive.token.address,\n token: incentive.token,\n incentiveRate: incentiveRate.toString(),\n incentiveRateUsd: incentiveRateUsd.toString(),\n remainingAmount: incentive.remainingAmount,\n });\n }\n }\n return acc;\n }, new Map<string, ApiMinimalVaultIncentiveFragment>());\n\n return Array.from(map.values());\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"]}
|
|
1
|
+
{"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/honey/getHoneyFees.ts","../../src/actions/honey/getHoneyPausedState.ts","../../src/actions/honey/getHoneyPythPriceOracle.ts","../../src/actions/honey/getHoneyRootPriceOracle.ts","../../src/actions/pol/getBlockTime.ts","../../src/actions/pol/getLSTStakeConfig.ts","../../src/actions/pol/getRewardVaultDurationConstants.ts","../../src/actions/pol/getRewardVaultBeaconImplementation.ts","../../src/abi/utils/upgradableBeacon.ts","../../src/actions/pol/getRewardVaultFromToken.ts","../../src/actions/pyth/getHoneyPythFeeds.ts","../../src/actions/tokens/getTokens.ts","../../src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts","../../src/actions/validators/utils/aggregateValidatorIncentives.ts","../../src/actions/validators/utils/getValidatorBoostApy.ts"],"names":["getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","getPoolState","apiPool","mapPoolType","pt","getVaultPausedState","args","config","parseBaseArgs","balancerVaultAbi","getHoneyFees","client","collateralList","promiseList","coll","honeyFactoryAbi","mintRates","redeemRates","collateralWeights","acc","collIdx","formatUnits","e","getHoneyPausedState","honeyAddress","honeyAbi","getHoneyPythOracle","pythOracle","honeyRootOracleAbi","getHoneyRootPriceOracle","factory","getBlockTime","defaultBlockTime","blocksSpan","assertPublicClient","blockTime","span","hoursInSeconds","currentBlock","oldestBlock","msToSeconds","getLSTStakeConfig","tokenList","lstStakingVaults","lstStakingTokens","token","stakingToken","lstStakerVaultAbi","assetTokenAddress","assetToken","isToken","upgradableBeaconAbi","getRewardVaultBeaconImplementation","factoryAddress","assertDefined","assertAddress","beacon","rewardVaultFactoryAbi","getRewardVaultDurationConstants","baseArgs","beaconImplementation","minRewardDuration","maxRewardDuration","rewardVaultAbi","getRewardVaultFromToken","tokenAddress","zeroAddress","getHoneyPythFeeds","priceFeedIds","pythPriceOracleAbi","index","getTokens","url","beraFetchJson","getActiveBoostAndCommissionChangeDelay","ui","maxCommissionRate","commissionChangeDelay","rewardAllocationBlockDelay","maxWeightPerVault","maxNumWeightsPerRewardAllocation","dropBoostDelay","activateBoostDelay","rewardAllocationInactivityBlockSpan","beraChefAbi","bgtAbi","aggregateValidatorIncentives","rewardAllocationWeights","activeOnly","map","x","rv","incentive","incentiveRate","bignumber_js_default","incentiveRateUsd","existing","getValidatorReturnPerBgt","validator","ab","totalIncentiveValue","inc","currIncentive","tokenPrice","getValidatorBoostApy","bgtPrice","validatorActiveBoostAmount","returnPerBgt"],"mappings":"AAAA,+1BAAsoB,yDAA+D,yDAA0D,yDAA0C,iCAA8B,iCAA8B,iCAA8B,iCAA8B,yDAAwD,yDAA0C,iCAA8B,yDAAwD,iCAA8B,4BCA1jC,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,CAAA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D,GAAA,CAAA,CACDQ,CAAAA,CAA6BD,CAAAA,CAGlC,CAAA,wrJAAA","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 { type Address, formatUnits, type PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport type { Token } from \"@berachain/graphql/pol/api\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface CollateralRates {\n mintFee: number;\n redeemFee: number;\n}\n\nexport interface HoneyFeeMap {\n single: Record<Address, CollateralRates>;\n basket: CollateralRates;\n}\n\nexport interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {\n client: PublicClient;\n collateralList: Token[];\n}\n\n/**\n * Fetches the mint and redeem rates for all collateral tokens and calculates the weighted basket rates\n * @param {Object} params - The parameters object\n * @param {PublicClient} params.client - The Viem public client instance\n * @param {Address[]} params.collateralList - Array of collateral token addresses\n * @returns {Promise<HoneyFeeMap | undefined>} Object containing individual collateral rates and weighted basket rates,\n * or undefined if the operation fails\n */\nexport async function getHoneyFees({\n client,\n collateralList,\n ...args\n}: CollateralRatesArgs): Promise<HoneyFeeMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n // create a list for all the promises needed, fetch the mint and redeem rates for each collateral token\n const promiseList: Record<\"mint\" | \"redeem\", Promise<bigint>[]> = {\n mint: [],\n redeem: [],\n };\n for (const coll of collateralList) {\n promiseList.mint.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"mintRates\",\n args: [coll.address as Address],\n }),\n );\n promiseList.redeem.push(\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"redeemRates\",\n args: [coll.address as Address],\n }),\n );\n }\n const [mintRates, redeemRates, collateralWeights] = await Promise.all([\n Promise.all(promiseList.mint),\n Promise.all(promiseList.redeem),\n // fetch the collateral weights, needed to calculate the weighted basket rates\n client.readContract({\n address: config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"getWeights\",\n }),\n ]);\n\n // calculate the weighted basket rates and the single collateral rates\n\n return collateralList.reduce<HoneyFeeMap>(\n (acc, coll) => {\n const collIdx = collateralList.indexOf(coll);\n acc.single[coll.address as Address] = {\n mintFee: 1 - +formatUnits(mintRates[collIdx], 18),\n redeemFee: 1 - +formatUnits(redeemRates[collIdx], 18),\n };\n acc.basket.mintFee +=\n acc.single[coll.address as Address].mintFee *\n +formatUnits(collateralWeights[collIdx], 18);\n\n acc.basket.redeemFee +=\n acc.single[coll.address as Address].redeemFee *\n +formatUnits(collateralWeights[collIdx], 18);\n return acc;\n },\n {\n single: {},\n basket: { mintFee: 0, redeemFee: 0 },\n },\n );\n } catch (e) {\n console.log(e);\n throw e;\n }\n}\n","import type { PublicClient } from \"viem\";\n\nimport { honeyAbi } from \"@berachain/abis/honey/honey\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the pause state of the Honey protocol\n * @returns boolean\n */\nexport async function getHoneyPausedState({\n client,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n client: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n const honeyAddress = config.honey.token;\n const honeyPausedState = await client.readContract({\n address: honeyAddress,\n abi: honeyAbi,\n functionName: \"paused\",\n });\n\n return honeyPausedState;\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rootPriceOracleAbi as honeyRootOracleAbi } from \"@berachain/abis/extras/rootPriceOracle\";\n\n/**\n * Gets the address of the Honey Pyth Oracle, which is called by the Honey Root Price Oracle to get the price of the collaterals\n * @returns\n */\nexport async function getHoneyPythOracle({\n pythOracle,\n publicClient,\n}: {\n publicClient: PublicClient;\n pythOracle: Address;\n}) {\n return publicClient.readContract({\n address: pythOracle,\n abi: honeyRootOracleAbi,\n functionName: \"pythOracle\",\n });\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { honeyFactoryAbi } from \"@berachain/abis/honey/honeyFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Gets the address of the Honey Root Price Oracle, which keeps the logic to price the collaterals\n */\nexport async function getHoneyRootPriceOracle({\n publicClient,\n factory,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n factory?: Address;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n return publicClient.readContract({\n address: factory ?? config.honey.factory,\n abi: honeyFactoryAbi,\n functionName: \"priceOracle\",\n });\n}\n","import type { PublicClient } from \"viem\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { hoursInSeconds, msToSeconds } from \"../../utils/time\";\n\nexport async function getBlockTime({\n defaultBlockTime,\n publicClient,\n blocksSpan,\n ...args\n}: {\n defaultBlockTime?: number;\n blocksSpan?: number;\n publicClient: PublicClient | undefined;\n} & BeraJS.BaseFunctionArgs): Promise<number> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs(args);\n\n const blockTime = defaultBlockTime ?? config.averageBlockTime;\n const span = blocksSpan ?? Math.floor(hoursInSeconds(1) / blockTime);\n\n const currentBlock = await publicClient?.getBlock({ blockTag: \"latest\" });\n const oldestBlock = await publicClient?.getBlock({\n blockNumber: currentBlock.number - BigInt(span),\n });\n\n return (\n // we need to use current timestamp as the latest block might not have been minted (chain halted)\n (msToSeconds(Date.now()) - Number(oldestBlock?.timestamp)) /\n (Number(currentBlock?.number) - Number(oldestBlock?.number))\n );\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { lstStakerVaultAbi } from \"@berachain/abis/pol/lst/lstStakerVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { TokenWithMetadata } from \"../../types/dex\";\nimport type { StakingConfig } from \"../../types/staking\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport type GetLSTStakeConfigArgs = {\n tokenList: TokenWithMetadata[];\n publicClient?: PublicClient;\n lstStakingVaults: Address[];\n} & BeraJS.BaseFunctionArgs;\n\n/**\n * Builds staking configs from on-chain LST vaults and optional native configs.\n */\nexport async function getLSTStakeConfig({\n tokenList,\n publicClient,\n lstStakingVaults,\n ...args\n}: GetLSTStakeConfigArgs): Promise<StakingConfig[]> {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n ...args,\n chainId: publicClient.chain?.id ?? args.chainId,\n });\n\n const lstStakingTokens = tokenList.filter((token) =>\n lstStakingVaults.includes(token.address),\n );\n\n if (lstStakingTokens.length === 0) {\n return [];\n }\n\n const assets = await Promise.all(\n lstStakingTokens.map(async (stakingToken) => {\n // read the asset token address from the lst staking vault\n const assetTokenAddress = await publicClient.readContract({\n address: stakingToken.address,\n abi: lstStakerVaultAbi,\n functionName: \"asset\",\n });\n return { assetTokenAddress, stakingToken };\n }),\n );\n\n return assets.reduce<StakingConfig[]>(\n (acc, { assetTokenAddress, stakingToken }) => {\n const assetToken = tokenList.find((token) =>\n isToken(token, assetTokenAddress),\n );\n if (!assetToken) return acc;\n acc.push({\n id: stakingToken.address,\n receiptToken: stakingToken,\n inputTokens: [assetToken],\n });\n return acc;\n },\n [],\n );\n}\n","import type { PublicClient } from \"viem\";\n\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { getRewardVaultBeaconImplementation } from \"./getRewardVaultBeaconImplementation\";\n\nexport interface RewardVaultDurationConstants {\n minRewardDuration: number;\n maxRewardDuration: number;\n}\n\n/**\n * Returns the minimum and maximum reward duration constants for all reward vaults.\n */\nexport async function getRewardVaultDurationConstants({\n publicClient,\n ...baseArgs\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<RewardVaultDurationConstants> {\n assertPublicClient(publicClient);\n\n const beaconImplementation = await getRewardVaultBeaconImplementation({\n publicClient,\n ...baseArgs,\n });\n\n const [minRewardDuration, maxRewardDuration] = await Promise.all([\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MIN_REWARD_DURATION\",\n }),\n publicClient.readContract({\n address: beaconImplementation,\n abi: rewardVaultAbi,\n functionName: \"MAX_REWARD_DURATION\",\n }),\n ]);\n\n return {\n minRewardDuration: Number(minRewardDuration),\n maxRewardDuration: Number(maxRewardDuration),\n };\n}\n","import type { Address, PublicClient } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { upgradableBeaconAbi } from \"../../abi/utils/upgradableBeacon\";\nimport { assertAddress, assertDefined } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Returns the beacon implementation address for all reward vaults.\n */\nexport async function getRewardVaultBeaconImplementation({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}): Promise<Address> {\n const { config } = parseBaseArgs(args);\n const factoryAddress = config.pol.factory;\n assertDefined(publicClient, \"publicClient\");\n assertAddress(config.pol.factory, \"factoryAddress\");\n\n // from the factory contract, we get the beacon address\n const beacon = await publicClient.readContract({\n address: factoryAddress,\n abi: rewardVaultFactoryAbi,\n functionName: \"beacon\",\n });\n\n // from the beacon contract, we get the current implementation address\n return publicClient.readContract({\n address: beacon,\n abi: upgradableBeaconAbi,\n functionName: \"implementation\",\n });\n}\n","export const upgradableBeaconAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"initialOwner\", type: \"address\" },\n {\n internalType: \"address\",\n name: \"initialImplementation\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"NewImplementationHasNoCode\", type: \"error\" },\n { inputs: [], name: \"NewOwnerIsZeroAddress\", type: \"error\" },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"oldOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"result\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"renounceOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n","import { type Address, type PublicClient, zeroAddress } from \"viem\";\n\nimport { rewardVaultFactoryAbi } from \"@berachain/abis/pol/rewards/rewardVaultFactory\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getRewardVaultFromToken({\n tokenAddress,\n publicClient,\n factoryAddress,\n ...args\n}: {\n tokenAddress: Address;\n publicClient: PublicClient;\n factoryAddress?: Address;\n} & BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n const vaultAddress = await publicClient.readContract({\n address: factoryAddress ?? config.pol.factory,\n abi: rewardVaultFactoryAbi,\n functionName: \"getVault\",\n args: [tokenAddress],\n });\n\n if (vaultAddress === zeroAddress) {\n return null;\n }\n\n return vaultAddress;\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { Address } from \"@berachain/config\";\n\nimport { pythPriceOracleAbi } from \"@berachain/abis/extras/pythPriceOracle\";\n\nimport type { PythPriceFeedMap } from \"../../types/honeySwap\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Given a list of tokens, it will return the price feed ids for each token according to honey priceOracle\n * @returns\n */\nexport async function getHoneyPythFeeds({\n tokenList,\n publicClient,\n ...args\n}: {\n tokenList: readonly Address[];\n publicClient: PublicClient;\n} & BeraJS.BaseFunctionArgs): Promise<PythPriceFeedMap> {\n const { config } = parseBaseArgs(args);\n\n try {\n const priceFeedIds = await Promise.all(\n tokenList.map((token) =>\n publicClient.readContract({\n address: config.honey.pythOracle,\n abi: pythPriceOracleAbi,\n functionName: \"feeds\",\n args: [token],\n }),\n ),\n );\n\n return tokenList.reduce<PythPriceFeedMap>(\n (acc, token, index) => ({\n ...acc,\n [token]: priceFeedIds[index],\n }),\n {},\n );\n } catch (e) {\n console.error(\"getPythPriceFeedId\", e);\n throw e;\n }\n}\n","import type { TokenWithMetadata } from \"../../types/dex\";\nimport { beraFetchJson } from \"../../utils/beraFetch\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getTokens({\n url,\n ...args\n}: BeraJS.BaseFunctionArgs & { url?: string } = {}): Promise<\n TokenWithMetadata[]\n> {\n const { config } = parseBaseArgs(args);\n const tokenList = await beraFetchJson<{ tokens: TokenWithMetadata[] }>({\n url: url ?? config.lists.tokenList,\n type: \"rest\",\n name: \"GitHub\",\n });\n\n return tokenList.tokens ?? [];\n}\n","import type { PublicClient } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport interface ActiveBoostAndCommissionChangeDelay {\n boostDelay: number;\n unboostDelay: number;\n commissionChangeDelay: number;\n rewardAllocationBlockDelay: number;\n maxWeightPerVault: number;\n maxNumWeightsPerRewardAllocation: number;\n /**\n * Percentage of the validator's commission rate that can be changed at once.\n *\n * @example 1 => 100%\n */\n maxCommissionRate: number;\n /**\n * The number of blocks after which a reward allocation is considered stale and will fallback\n * to baseline reward allocation.\n *\n */\n rewardAllocationInactivityBlockSpan: number;\n /**\n * The number of hours in advance to warn the operator that the reward allocation is expiring.\n */\n ui: EdgeConfigSchema[\"pol\"][\"automatedRewardAllocation\"];\n}\n\nexport async function getActiveBoostAndCommissionChangeDelay({\n publicClient,\n ui,\n ...args\n}: BeraJS.BaseFunctionArgs &\n Pick<ActiveBoostAndCommissionChangeDelay, \"ui\"> & {\n publicClient: PublicClient;\n }): Promise<ActiveBoostAndCommissionChangeDelay> {\n const { config } = parseBaseArgs(args);\n\n const [\n maxCommissionRate,\n commissionChangeDelay,\n rewardAllocationBlockDelay,\n maxWeightPerVault,\n maxNumWeightsPerRewardAllocation,\n dropBoostDelay,\n activateBoostDelay,\n rewardAllocationInactivityBlockSpan,\n ] = await Promise.all([\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"MAX_COMMISSION_RATE\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"commissionChangeDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationBlockDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxWeightPerVault\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"maxNumWeightsPerRewardAllocation\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"dropBoostDelay\",\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"activateBoostDelay\",\n }),\n publicClient.readContract({\n address: config.pol.beraChef,\n abi: beraChefAbi,\n functionName: \"rewardAllocationInactivityBlockSpan\",\n }),\n ]);\n\n return {\n maxCommissionRate: Number(maxCommissionRate) / 1e4,\n boostDelay: Number(activateBoostDelay),\n unboostDelay: Number(dropBoostDelay),\n commissionChangeDelay: Number(commissionChangeDelay),\n rewardAllocationBlockDelay: Number(rewardAllocationBlockDelay),\n maxWeightPerVault: Number(maxWeightPerVault) / 1e4,\n maxNumWeightsPerRewardAllocation: Number(maxNumWeightsPerRewardAllocation),\n rewardAllocationInactivityBlockSpan: Number(\n rewardAllocationInactivityBlockSpan,\n ),\n ui,\n };\n}\n","import type {\n ApiMinimalVaultIncentiveFragment,\n ApiValidatorRewardAllocationWeightFragment,\n} from \"@berachain/graphql/pol/api\";\nimport BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\nexport function aggregateValidatorIncentives({\n rewardAllocationWeights,\n activeOnly = true,\n}: {\n rewardAllocationWeights: ApiValidatorRewardAllocationWeightFragment[];\n activeOnly?: boolean;\n}): ApiMinimalVaultIncentiveFragment[] {\n const map = rewardAllocationWeights\n .filter((x) => x?.receivingVault)\n\n .reduce((acc, rv) => {\n for (const incentive of rv.receivingVault?.activeIncentives ?? []) {\n if (activeOnly && incentive.remainingAmount === \"0\") {\n continue;\n }\n const incentiveRate = new BigNumber(incentive.incentiveRate).times(\n rv.percentage,\n );\n\n const incentiveRateUsd = new BigNumber(\n incentive.incentiveRateUsd,\n ).times(rv.percentage);\n\n const token = incentive.token.address.toLowerCase();\n\n const existing = acc.get(token);\n if (existing) {\n acc.set(token, {\n ...existing,\n incentiveRate: new BigNumber(existing.incentiveRate)\n .plus(incentiveRate)\n .toString(),\n incentiveRateUsd: new BigNumber(existing.incentiveRateUsd)\n .plus(incentiveRateUsd)\n .toString(),\n remainingAmount: new BigNumber(existing.remainingAmount)\n .plus(incentive.remainingAmount)\n .toString(),\n remainingAmountUsd: new BigNumber(existing.remainingAmountUsd)\n .plus(incentive.remainingAmountUsd)\n .toString(),\n });\n } else {\n acc.set(token, {\n ...incentive,\n tokenAddress: incentive.token.address,\n token: incentive.token,\n incentiveRate: incentiveRate.toString(),\n incentiveRateUsd: incentiveRateUsd.toString(),\n remainingAmount: incentive.remainingAmount,\n });\n }\n }\n return acc;\n }, new Map<string, ApiMinimalVaultIncentiveFragment>());\n\n return Array.from(map.values());\n}\n","import type { ApiValidatorFragment } from \"@berachain/graphql/pol/api\";\n\nexport function getValidatorReturnPerBgt(\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >,\n): number {\n return validator?.rewardAllocationWeights?.reduce((acc, ab) => {\n if (!ab) return acc;\n\n const totalIncentiveValue =\n ab.receivingVault?.activeIncentives\n .filter((inc) => Number(inc.remainingAmount) > 0)\n .reduce((totalIncentiveValue, currIncentive) => {\n const tokenPrice =\n Number(currIncentive.remainingAmountUsd) /\n Number(currIncentive.remainingAmount);\n\n return (\n totalIncentiveValue +\n Number(currIncentive.incentiveRate) * tokenPrice\n );\n }, 0) ?? 0;\n\n return acc + totalIncentiveValue * ab.percentage;\n }, 0);\n}\n\nexport function getValidatorBoostApy({\n validator,\n bgtPrice,\n}: {\n validator: Pick<\n ApiValidatorFragment,\n \"dynamicData\" | \"rewardAllocationWeights\"\n >;\n bgtPrice: number;\n}): number {\n const validatorActiveBoostAmount = Number(\n validator.dynamicData?.activeBoostAmount ?? 0,\n );\n\n const returnPerBgt = getValidatorReturnPerBgt(validator);\n\n if (!returnPerBgt || !validatorActiveBoostAmount) {\n // As of now, a validator cannot send rewards to the vaults if it has no active boost amount\n // If baseRate changes on chain, we should update this function\n return 0;\n }\n\n const boostApy =\n (returnPerBgt *\n Number(validator.dynamicData?.lastDayDistributedBGTAmount ?? 0) *\n 365) /\n (validatorActiveBoostAmount * bgtPrice);\n\n return boostApy;\n}\n"]}
|
|
@@ -20,7 +20,7 @@ import { I as IHoneySwapState } from '../useHoneySwapState-D6vpv19r.cjs';
|
|
|
20
20
|
import { S as StakingConfig, B as BribeBoostRewardProof, a as BribeBoostRewardItem, U as UserVaultInfo } from '../pol.d-o6Iw75bK.cjs';
|
|
21
21
|
import { Address as Address$1, ChainId } from '@berachain/config';
|
|
22
22
|
import { Config } from '@wagmi/core';
|
|
23
|
-
import { I as IContractWrite } from '../global.d-
|
|
23
|
+
import { I as IContractWrite } from '../global.d-CicOIudf.cjs';
|
|
24
24
|
import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
|
|
25
25
|
import '@berachain/config/internal';
|
|
26
26
|
import '../dex-C_BB0b0O.cjs';
|
|
@@ -29,7 +29,7 @@ import 'react';
|
|
|
29
29
|
import '../honey-CYm0RWf4.cjs';
|
|
30
30
|
import 'swr';
|
|
31
31
|
import '../txnEnum-CwAJN4zV.cjs';
|
|
32
|
-
import '../BeraError-
|
|
32
|
+
import '../BeraError-7-A5JYy_.cjs';
|
|
33
33
|
|
|
34
34
|
interface GetMaxDepositProps {
|
|
35
35
|
vaultAddress: Address;
|
|
@@ -20,7 +20,7 @@ import { I as IHoneySwapState } from '../useHoneySwapState-B494PQDl.js';
|
|
|
20
20
|
import { S as StakingConfig, B as BribeBoostRewardProof, a as BribeBoostRewardItem, U as UserVaultInfo } from '../pol.d-qR8bGEP5.js';
|
|
21
21
|
import { Address as Address$1, ChainId } from '@berachain/config';
|
|
22
22
|
import { Config } from '@wagmi/core';
|
|
23
|
-
import { I as IContractWrite } from '../global.d-
|
|
23
|
+
import { I as IContractWrite } from '../global.d-C4FnE4cz.js';
|
|
24
24
|
import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
|
|
25
25
|
import '@berachain/config/internal';
|
|
26
26
|
import '../dex-C_BB0b0O.js';
|
|
@@ -29,7 +29,7 @@ import 'react';
|
|
|
29
29
|
import '../honey-CYm0RWf4.js';
|
|
30
30
|
import 'swr';
|
|
31
31
|
import '../txnEnum-CwAJN4zV.js';
|
|
32
|
-
import '../BeraError-
|
|
32
|
+
import '../BeraError-7-A5JYy_.js';
|
|
33
33
|
|
|
34
34
|
interface GetMaxDepositProps {
|
|
35
35
|
vaultAddress: Address;
|
package/dist/actions/exports.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as ze,A as be,B as Ae,C as xe,D as he,E as Ce,F as Pe,G as we,H as Be,I as ke,J as ve,K as Ne,L as Re,M as Se,N as Fe,O as De,P as Te,Q as Me,R as Ve,S as Ie,T as Oe,U as We,V as Ue,W as Je,X as He,Y as Le,Z as Ee,_ as Ge,a as _,aa as Xe,b as z,ba as Ze,c as X,ca as je,d as Z,da as Ke,e as j,ea as Qe,f as K,fa as Ye,g as Q,ga as $e,h as Y,ha as et,i as $,ia as tt,j as ee,ja as rt,k as te,ka as ot,l as re,la as at,m as oe,ma as nt,n as ae,na as it,o as ne,oa as st,p as ie,pa as mt,q as se,qa as pt,r as me,ra as dt,s as pe,sa as ct,t as de,ta as lt,u as ce,ua as ut,v as le,w as ue,x as fe,y as ge,z as ye}from"../chunk-NXXMW2O7.mjs";import{a as R,b as S,c as F}from"../chunk-ENT2OSXT.mjs";import"../chunk-NLVWRMGD.mjs";import{a as q,b as _e,c as qe}from"../chunk-K5L2B4DU.mjs";import"../chunk-NAXAZJJY.mjs";import"../chunk-RJN36GBU.mjs";import"../chunk-ZW2N63FI.mjs";import{a as h,b as u,c as C}from"../chunk-5QAFKFM5.mjs";import{a as l,d as A,l as P,q as w}from"../chunk-JDDRTHFG.mjs";import{d as x}from"../chunk-WLJHFHKF.mjs";import{a as i}from"../chunk-KUQEX7H3.mjs";import"../chunk-PRLVZIKD.mjs";import"../chunk-GXV2JA36.mjs";import{formatEther as D}from"viem";import{metaMorphoV11Abi as T}from"@berachain/abis/bend-metamorpho/metaMorphoV11";async function yt({vaultAddress:e,publicClient:t}){let o=await t.readContract({address:e,abi:T,functionName:"maxDeposit",args:[e]});return D(o)}import{mapPoolType as M}from"@berachain-foundation/berancer-sdk";var xt=e=>({type:M(e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});import{vaultAbi as V}from"@berachain/abis/bex/vault";async function wt({publicClient:e,...t}){let{config:o}=i(t);return(await e.readContract({address:o.bex.vault,abi:V,functionName:"getPausedState"}))[0]}import{formatUnits as g}from"viem";import{honeyFactoryAbi as b}from"@berachain/abis/honey/honeyFactory";async function Rt({client:e,collateralList:t,...o}){let{config:r}=i(o);try{let a={mint:[],redeem:[]};for(let m of t)a.mint.push(e.readContract({address:r.honey.factory,abi:b,functionName:"mintRates",args:[m.address]})),a.redeem.push(e.readContract({address:r.honey.factory,abi:b,functionName:"redeemRates",args:[m.address]}));let[n,d,s]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:r.honey.factory,abi:b,functionName:"getWeights"})]);return t.reduce((m,p)=>{let c=t.indexOf(p);return m.single[p.address]={mintFee:1-+g(n[c],18),redeemFee:1-+g(d[c],18)},m.basket.mintFee+=m.single[p.address].mintFee*+g(s[c],18),m.basket.redeemFee+=m.single[p.address].redeemFee*+g(s[c],18),m},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}import{honeyAbi as I}from"@berachain/abis/honey/honey";async function Tt({client:e,...t}){let{config:o}=i(t),r=o.honey.token;return await e.readContract({address:r,abi:I,functionName:"paused"})}import{rootPriceOracleAbi as O}from"@berachain/abis/extras/rootPriceOracle";async function It({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:O,functionName:"pythOracle"})}import{honeyFactoryAbi as W}from"@berachain/abis/honey/honeyFactory";async function Jt({publicClient:e,factory:t,...o}){let{config:r}=i(o);return e.readContract({address:t??r.honey.factory,abi:W,functionName:"priceOracle"})}async function _t({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){u(t);let{config:a}=i(r),n=e??a.averageBlockTime,d=o??Math.floor(w(1)/n),s=await t?.getBlock({blockTag:"latest"}),m=await t?.getBlock({blockNumber:s.number-BigInt(d)});return(P(Date.now())-Number(m?.timestamp))/(Number(s?.number)-Number(m?.number))}import{lstStakerVaultAbi as U}from"@berachain/abis/pol/lst/lstStakerVault";async function Kt({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){u(t);let{config:a}=i({...r,chainId:t.chain?.id??r.chainId}),n=e.filter(s=>o.includes(s.address));return n.length===0?[]:(await Promise.all(n.map(async s=>({assetTokenAddress:await t.readContract({address:s.address,abi:U,functionName:"asset"}),stakingToken:s})))).reduce((s,{assetTokenAddress:m,stakingToken:p})=>{let c=e.find(y=>x(y,m));return c&&s.push({id:p.address,receiptToken:p,inputTokens:[c]}),s},[])}import{rewardVaultAbi as v}from"@berachain/abis/pol/rewards/rewardVault";import{rewardVaultFactoryAbi as J}from"@berachain/abis/pol/rewards/rewardVaultFactory";var B=[{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 k({publicClient:e,...t}){let{config:o}=i(t),r=o.pol.factory;h(e,"publicClient"),C(o.pol.factory,"factoryAddress");let a=await e.readContract({address:r,abi:J,functionName:"beacon"});return e.readContract({address:a,abi:B,functionName:"implementation"})}async function sr({publicClient:e,...t}){u(e);let o=await k({publicClient:e,...t}),[r,a]=await Promise.all([e.readContract({address:o,abi:v,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:o,abi:v,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(r),maxRewardDuration:Number(a)}}import{zeroAddress as H}from"viem";import{rewardVaultFactoryAbi as L}from"@berachain/abis/pol/rewards/rewardVaultFactory";async function lr({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:a}=i(r),n=await t.readContract({address:o??a.pol.factory,abi:L,functionName:"getVault",args:[e]});return n===H?null:n}import{pythPriceOracleAbi as E}from"@berachain/abis/extras/pythPriceOracle";async function yr({tokenList:e,publicClient:t,...o}){let{config:r}=i(o);try{let a=await Promise.all(e.map(n=>t.readContract({address:r.honey.pythOracle,abi:E,functionName:"feeds",args:[n]})));return e.reduce((n,d,s)=>({...n,[d]:a[s]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function hr({url:e,...t}={}){let{config:o}=i(t);return(await A({url:e??o.lists.tokenList,type:"rest",name:"GitHub"})).tokens??[]}import{bgtAbi as N}from"@berachain/abis/pol/bgt";import{beraChefAbi as f}from"@berachain/abis/pol/rewards/beraChef";async function kr({publicClient:e,ui:t,...o}){let{config:r}=i(o),[a,n,d,s,m,p,c,y]=await Promise.all([e.readContract({address:r.pol.beraChef,abi:f,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"commissionChangeDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"maxWeightPerVault"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:r.tokens.bgt,abi:N,functionName:"dropBoostDelay"}),e.readContract({address:r.tokens.bgt,abi:N,functionName:"activateBoostDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(c),unboostDelay:Number(p),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(d),maxWeightPerVault:Number(s)/1e4,maxNumWeightsPerRewardAllocation:Number(m),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function Rr({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>r?.receivingVault).reduce((r,a)=>{for(let n of a.receivingVault?.activeIncentives??[]){if(t&&n.remainingAmount==="0")continue;let d=new l(n.incentiveRate).times(a.percentage),s=new l(n.incentiveRateUsd).times(a.percentage),m=n.token.address.toLowerCase(),p=r.get(m);p?r.set(m,{...p,incentiveRate:new l(p.incentiveRate).plus(d).toString(),incentiveRateUsd:new l(p.incentiveRateUsd).plus(s).toString(),remainingAmount:new l(p.remainingAmount).plus(n.remainingAmount).toString(),remainingAmountUsd:new l(p.remainingAmountUsd).plus(n.remainingAmountUsd).toString()}):r.set(m,{...n,tokenAddress:n.token.address,token:n.token,incentiveRate:d.toString(),incentiveRateUsd:s.toString(),remainingAmount:n.remainingAmount})}return r},new Map);return Array.from(o.values())}function G(e){return e?.rewardAllocationWeights?.reduce((t,o)=>{if(!o)return t;let r=o.receivingVault?.activeIncentives.filter(a=>Number(a.remainingAmount)>0).reduce((a,n)=>{let d=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*d},0)??0;return t+r*o.percentage},0)}function Fr({validator:e,bgtPrice:t}){let o=Number(e.dynamicData?.activeBoostAmount??0),r=G(e);return!r||!o?0:r*Number(e.dynamicData?.lastDayDistributedBGTAmount??0)*365/(o*t)}export{X as BalancerApi,z as BaseAggregator,R as BeraApolloClient,me as HoneyPreviewMethod,be as RewardVaultDistributionMode,Rr as aggregateValidatorIncentives,Xe as beraWriteContract,Ye as formatValidatorRewardAllocation,kr as getActiveBoostAndCommissionChangeDelay,Z as getAllPools,Ze as getAllValidators,Ge as getAllowances,je as getApiEnrichedAllocation,j as getApiPool,Ke as getApiValidator,S as getApolloClient,_e as getBalanceCall,xe as getBgtAprSimulation,_t as getBlockTime,ye as getBlockTimestamp,te as getChartData,re as getCollateralWeights,_ as getConvertToAssets,Qe as getDailyValidatorBlockStats,rt as getDefaultRewardAllocation,he as getEarnedStakedBeraVault,q as getEnsoClient,ie as getGlobalCapLimit,Pe as getGlobalData,K as getGlobalLiquidityAndSwapVolume,se as getHoney24hVolume,ae as getHoneyCollaterals,Rt as getHoneyFees,Tt as getHoneyPausedState,pe as getHoneyPreview,yr as getHoneyPythFeeds,It as getHoneyPythOracle,Jt as getHoneyRootPriceOracle,de as getHoneyVaultsBalance,we as getIncentiveFeeClaimStats,Kt as getLSTStakeConfig,Be as getMarkets,yt as getMaxDeposit,Y as getOnChainPool,$ as getPoolEvents,ee as getPoolHistoricalData,Q as getPoolPausedState,xt as getPoolState,ce as getPythLatestPrices,ue as getPythUpdateFee,le as getRelativeCapLimit,ke as getRewardProofsByValidator,ve as getRewardTokenToBeraRate,Ne as getRewardVault,sr as getRewardVaultDurationConstants,lr as getRewardVaultFromToken,Re as getRewardVaultIncentives,Ae as getRewardVaultRewards,Se as getRewardVaultStakingToken,Ce as getRewardVaults,Me as getSWBeraVaultMetadata,Ve as getSWBeraWithdrawal,Te as getStakeWithdrawalCooldown,Fe as getStakedBeraAPR,De as getStakedBeraSnapshots,ot as getStakingPoolBatch,fe as getSwapPayload,Ee as getTokenCurrentPrices,oe as getTokenInformation,hr as getTokens,Ie as getTotalStakedAmount,nt as getUserActiveValidators,at as getUserBoostsOnValidator,Oe as getUserClaimableIncentives,it as getUserStakingPositions,Ue as getUserVaultInfo,Je as getUserVaults,We as getUserVaultsReward,st as getValidatorAnalytics,Fr as getValidatorBoostApy,mt as getValidatorCommission,pt as getValidatorEstimatedBgtPerYear,dt as getValidatorOperatorAddress,ct as getValidatorQueuedCommission,lt as getValidatorQueuedOperatorAddress,ut as getValidatorQueuedRewardAllocation,G as getValidatorReturnPerBgt,et as getValidatorRewardAllocation,He as getVaultHistory,wt as getVaultPausedState,Le as getVaultValidators,qe as getWalletBalances,F as gql,ne as isBadCollateralAsset,ge as isBasketModeEnabled,tt as isDefaultRewardAllocation,ze as isImpersonateAccount,$e as isSameRewardAllocation};
|
|
1
|
+
import{$ as ze,A as be,B as Ae,C as xe,D as he,E as Ce,F as Pe,G as we,H as Be,I as ke,J as ve,K as Ne,L as Re,M as Se,N as Fe,O as De,P as Te,Q as Me,R as Ve,S as Ie,T as Oe,U as We,V as Ue,W as Je,X as He,Y as Le,Z as Ee,_ as Ge,a as _,aa as Xe,b as z,ba as Ze,c as X,ca as je,d as Z,da as Ke,e as j,ea as Qe,f as K,fa as Ye,g as Q,ga as $e,h as Y,ha as et,i as $,ia as tt,j as ee,ja as rt,k as te,ka as ot,l as re,la as at,m as oe,ma as nt,n as ae,na as it,o as ne,oa as st,p as ie,pa as mt,q as se,qa as pt,r as me,ra as dt,s as pe,sa as ct,t as de,ta as lt,u as ce,ua as ut,v as le,w as ue,x as fe,y as ge,z as ye}from"../chunk-2A347ZVN.mjs";import{a as l,e as A,m as P,r as w}from"../chunk-5FVW5XU3.mjs";import{a as q,b as _e,c as qe}from"../chunk-XCVDZUEF.mjs";import{d as x}from"../chunk-2VO2D4QO.mjs";import"../chunk-OCAMR6XC.mjs";import"../chunk-A5BNPBXN.mjs";import"../chunk-NLVWRMGD.mjs";import"../chunk-NAXAZJJY.mjs";import{a as R,b as S,c as F}from"../chunk-5XOEJ6XX.mjs";import{a as i}from"../chunk-JHUVLM54.mjs";import"../chunk-PRLVZIKD.mjs";import{a as h,b as u,c as C}from"../chunk-TU63NRNL.mjs";import"../chunk-5SIQ7BKT.mjs";import{formatEther as D}from"viem";import{metaMorphoV11Abi as T}from"@berachain/abis/bend-metamorpho/metaMorphoV11";async function yt({vaultAddress:e,publicClient:t}){let o=await t.readContract({address:e,abi:T,functionName:"maxDeposit",args:[e]});return D(o)}import{mapPoolType as M}from"@berachain-foundation/berancer-sdk";var xt=e=>({type:M(e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});import{vaultAbi as V}from"@berachain/abis/bex/vault";async function wt({publicClient:e,...t}){let{config:o}=i(t);return(await e.readContract({address:o.bex.vault,abi:V,functionName:"getPausedState"}))[0]}import{formatUnits as g}from"viem";import{honeyFactoryAbi as b}from"@berachain/abis/honey/honeyFactory";async function Rt({client:e,collateralList:t,...o}){let{config:r}=i(o);try{let a={mint:[],redeem:[]};for(let m of t)a.mint.push(e.readContract({address:r.honey.factory,abi:b,functionName:"mintRates",args:[m.address]})),a.redeem.push(e.readContract({address:r.honey.factory,abi:b,functionName:"redeemRates",args:[m.address]}));let[n,d,s]=await Promise.all([Promise.all(a.mint),Promise.all(a.redeem),e.readContract({address:r.honey.factory,abi:b,functionName:"getWeights"})]);return t.reduce((m,p)=>{let c=t.indexOf(p);return m.single[p.address]={mintFee:1-+g(n[c],18),redeemFee:1-+g(d[c],18)},m.basket.mintFee+=m.single[p.address].mintFee*+g(s[c],18),m.basket.redeemFee+=m.single[p.address].redeemFee*+g(s[c],18),m},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(a){throw console.log(a),a}}import{honeyAbi as I}from"@berachain/abis/honey/honey";async function Tt({client:e,...t}){let{config:o}=i(t),r=o.honey.token;return await e.readContract({address:r,abi:I,functionName:"paused"})}import{rootPriceOracleAbi as O}from"@berachain/abis/extras/rootPriceOracle";async function It({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:O,functionName:"pythOracle"})}import{honeyFactoryAbi as W}from"@berachain/abis/honey/honeyFactory";async function Jt({publicClient:e,factory:t,...o}){let{config:r}=i(o);return e.readContract({address:t??r.honey.factory,abi:W,functionName:"priceOracle"})}async function _t({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){u(t);let{config:a}=i(r),n=e??a.averageBlockTime,d=o??Math.floor(w(1)/n),s=await t?.getBlock({blockTag:"latest"}),m=await t?.getBlock({blockNumber:s.number-BigInt(d)});return(P(Date.now())-Number(m?.timestamp))/(Number(s?.number)-Number(m?.number))}import{lstStakerVaultAbi as U}from"@berachain/abis/pol/lst/lstStakerVault";async function Kt({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){u(t);let{config:a}=i({...r,chainId:t.chain?.id??r.chainId}),n=e.filter(s=>o.includes(s.address));return n.length===0?[]:(await Promise.all(n.map(async s=>({assetTokenAddress:await t.readContract({address:s.address,abi:U,functionName:"asset"}),stakingToken:s})))).reduce((s,{assetTokenAddress:m,stakingToken:p})=>{let c=e.find(y=>x(y,m));return c&&s.push({id:p.address,receiptToken:p,inputTokens:[c]}),s},[])}import{rewardVaultAbi as v}from"@berachain/abis/pol/rewards/rewardVault";import{rewardVaultFactoryAbi as J}from"@berachain/abis/pol/rewards/rewardVaultFactory";var B=[{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 k({publicClient:e,...t}){let{config:o}=i(t),r=o.pol.factory;h(e,"publicClient"),C(o.pol.factory,"factoryAddress");let a=await e.readContract({address:r,abi:J,functionName:"beacon"});return e.readContract({address:a,abi:B,functionName:"implementation"})}async function sr({publicClient:e,...t}){u(e);let o=await k({publicClient:e,...t}),[r,a]=await Promise.all([e.readContract({address:o,abi:v,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:o,abi:v,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(r),maxRewardDuration:Number(a)}}import{zeroAddress as H}from"viem";import{rewardVaultFactoryAbi as L}from"@berachain/abis/pol/rewards/rewardVaultFactory";async function lr({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:a}=i(r),n=await t.readContract({address:o??a.pol.factory,abi:L,functionName:"getVault",args:[e]});return n===H?null:n}import{pythPriceOracleAbi as E}from"@berachain/abis/extras/pythPriceOracle";async function yr({tokenList:e,publicClient:t,...o}){let{config:r}=i(o);try{let a=await Promise.all(e.map(n=>t.readContract({address:r.honey.pythOracle,abi:E,functionName:"feeds",args:[n]})));return e.reduce((n,d,s)=>({...n,[d]:a[s]}),{})}catch(a){throw console.error("getPythPriceFeedId",a),a}}async function hr({url:e,...t}={}){let{config:o}=i(t);return(await A({url:e??o.lists.tokenList,type:"rest",name:"GitHub"})).tokens??[]}import{bgtAbi as N}from"@berachain/abis/pol/bgt";import{beraChefAbi as f}from"@berachain/abis/pol/rewards/beraChef";async function kr({publicClient:e,ui:t,...o}){let{config:r}=i(o),[a,n,d,s,m,p,c,y]=await Promise.all([e.readContract({address:r.pol.beraChef,abi:f,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"commissionChangeDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"maxWeightPerVault"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:r.tokens.bgt,abi:N,functionName:"dropBoostDelay"}),e.readContract({address:r.tokens.bgt,abi:N,functionName:"activateBoostDelay"}),e.readContract({address:r.pol.beraChef,abi:f,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(a)/1e4,boostDelay:Number(c),unboostDelay:Number(p),commissionChangeDelay:Number(n),rewardAllocationBlockDelay:Number(d),maxWeightPerVault:Number(s)/1e4,maxNumWeightsPerRewardAllocation:Number(m),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function Rr({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>r?.receivingVault).reduce((r,a)=>{for(let n of a.receivingVault?.activeIncentives??[]){if(t&&n.remainingAmount==="0")continue;let d=new l(n.incentiveRate).times(a.percentage),s=new l(n.incentiveRateUsd).times(a.percentage),m=n.token.address.toLowerCase(),p=r.get(m);p?r.set(m,{...p,incentiveRate:new l(p.incentiveRate).plus(d).toString(),incentiveRateUsd:new l(p.incentiveRateUsd).plus(s).toString(),remainingAmount:new l(p.remainingAmount).plus(n.remainingAmount).toString(),remainingAmountUsd:new l(p.remainingAmountUsd).plus(n.remainingAmountUsd).toString()}):r.set(m,{...n,tokenAddress:n.token.address,token:n.token,incentiveRate:d.toString(),incentiveRateUsd:s.toString(),remainingAmount:n.remainingAmount})}return r},new Map);return Array.from(o.values())}function G(e){return e?.rewardAllocationWeights?.reduce((t,o)=>{if(!o)return t;let r=o.receivingVault?.activeIncentives.filter(a=>Number(a.remainingAmount)>0).reduce((a,n)=>{let d=Number(n.remainingAmountUsd)/Number(n.remainingAmount);return a+Number(n.incentiveRate)*d},0)??0;return t+r*o.percentage},0)}function Fr({validator:e,bgtPrice:t}){let o=Number(e.dynamicData?.activeBoostAmount??0),r=G(e);return!r||!o?0:r*Number(e.dynamicData?.lastDayDistributedBGTAmount??0)*365/(o*t)}export{X as BalancerApi,z as BaseAggregator,R as BeraApolloClient,me as HoneyPreviewMethod,be as RewardVaultDistributionMode,Rr as aggregateValidatorIncentives,Xe as beraWriteContract,Ye as formatValidatorRewardAllocation,kr as getActiveBoostAndCommissionChangeDelay,Z as getAllPools,Ze as getAllValidators,Ge as getAllowances,je as getApiEnrichedAllocation,j as getApiPool,Ke as getApiValidator,S as getApolloClient,_e as getBalanceCall,xe as getBgtAprSimulation,_t as getBlockTime,ye as getBlockTimestamp,te as getChartData,re as getCollateralWeights,_ as getConvertToAssets,Qe as getDailyValidatorBlockStats,rt as getDefaultRewardAllocation,he as getEarnedStakedBeraVault,q as getEnsoClient,ie as getGlobalCapLimit,Pe as getGlobalData,K as getGlobalLiquidityAndSwapVolume,se as getHoney24hVolume,ae as getHoneyCollaterals,Rt as getHoneyFees,Tt as getHoneyPausedState,pe as getHoneyPreview,yr as getHoneyPythFeeds,It as getHoneyPythOracle,Jt as getHoneyRootPriceOracle,de as getHoneyVaultsBalance,we as getIncentiveFeeClaimStats,Kt as getLSTStakeConfig,Be as getMarkets,yt as getMaxDeposit,Y as getOnChainPool,$ as getPoolEvents,ee as getPoolHistoricalData,Q as getPoolPausedState,xt as getPoolState,ce as getPythLatestPrices,ue as getPythUpdateFee,le as getRelativeCapLimit,ke as getRewardProofsByValidator,ve as getRewardTokenToBeraRate,Ne as getRewardVault,sr as getRewardVaultDurationConstants,lr as getRewardVaultFromToken,Re as getRewardVaultIncentives,Ae as getRewardVaultRewards,Se as getRewardVaultStakingToken,Ce as getRewardVaults,Me as getSWBeraVaultMetadata,Ve as getSWBeraWithdrawal,Te as getStakeWithdrawalCooldown,Fe as getStakedBeraAPR,De as getStakedBeraSnapshots,ot as getStakingPoolBatch,fe as getSwapPayload,Ee as getTokenCurrentPrices,oe as getTokenInformation,hr as getTokens,Ie as getTotalStakedAmount,nt as getUserActiveValidators,at as getUserBoostsOnValidator,Oe as getUserClaimableIncentives,it as getUserStakingPositions,Ue as getUserVaultInfo,Je as getUserVaults,We as getUserVaultsReward,st as getValidatorAnalytics,Fr as getValidatorBoostApy,mt as getValidatorCommission,pt as getValidatorEstimatedBgtPerYear,dt as getValidatorOperatorAddress,ct as getValidatorQueuedCommission,lt as getValidatorQueuedOperatorAddress,ut as getValidatorQueuedRewardAllocation,G as getValidatorReturnPerBgt,et as getValidatorRewardAllocation,He as getVaultHistory,wt as getVaultPausedState,Le as getVaultValidators,qe as getWalletBalances,F as gql,ne as isBadCollateralAsset,ge as isBasketModeEnabled,tt as isDefaultRewardAllocation,ze as isImpersonateAccount,$e as isSameRewardAllocation};
|
|
2
2
|
//# sourceMappingURL=exports.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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 _chunkS2TNHMSVcjs = require('../../chunk-S2TNHMSV.cjs');require('../../chunk-WRFDB3QJ.cjs');require('../../chunk-QHCLZTCK.cjs');require('../../chunk-FDEUAXET.cjs');require('../../chunk-S4CDSVLK.cjs');require('../../chunk-FQSOUEIJ.cjs');require('../../chunk-DKZGCMH4.cjs');var _viem = require('viem');var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function y(t){return t.some(e=>{let n=e;return n.name==="implementation"||n.name==="proxyType"||n.type==="constructor"&&_optionalChain([n, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation"})}async function m({contractAddress:t,chainId:e,publicClient:n}){let c=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${t}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${e}`,i=await fetch(c);if(!i.ok)throw new Error(`Failed to fetch ABI: ${i.statusText}`);let a=await i.json();if(a.status==="0")throw new Error(a.result);let r=JSON.parse(a.result);if(!y(r))return r;let o=await n.getStorageAt({address:t,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!o||_viem.trim.call(void 0, o)==="0x00")return r;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, o),{size:20});return m({contractAddress:s,chainId:e,publicClient:n})}async function h({address:t,callData:e,knownAbi:n,chainId:c,publicClient:i}){try{if(_viem.decodeFunctionData.call(void 0, {data:e,abi:n}))return n}catch (e2){}return m({contractAddress:t,chainId:c,publicClient:i}).catch(()=>{})}function I(t,e){try{return _viem.decodeFunctionData.call(void 0, {data:t,abi:e})}catch (e3){return}}function w(t,e){return t.find(n=>n.type==="function"&&n.name===e)}function C(t){if(t)try{return _viem.toFunctionSignature.call(void 0, t)}catch(e){console.error(e)}}async function j({address:t,callData:e,chainId:n=_internal.defaultChainId,publicClient:c}){let i=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await h({address:t,callData:e,knownAbi:i,chainId:n,publicClient:c}),r=I(e,a);if(!a||!r)return{args:[]};let o=w(a,r.functionName),s=C(o);return{abiItem:o,functionSignature:s,functionName:r.functionName,args:r.args}}exports.MOCKED_PROPOSAL_STATUSES = _chunkS2TNHMSVcjs.b; exports.checkProposalField = _chunkS2TNHMSVcjs.a; exports.computeActualStatus = _chunkS2TNHMSVcjs.c; exports.getAllProposals = _chunkS2TNHMSVcjs.d; exports.getBodyErrors = _chunkS2TNHMSVcjs.e; exports.getDecodedFunctionData = j; exports.getProposalDetails = _chunkS2TNHMSVcjs.f; exports.getProposalFromTx = _chunkS2TNHMSVcjs.h; exports.getProposalVotes = _chunkS2TNHMSVcjs.i; exports.parseProposalBody = _chunkS2TNHMSVcjs.g;
|
|
2
2
|
//# sourceMappingURL=exports.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/
|
|
1
|
+
{"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/actions/governance/exports.cjs","../../../src/actions/governance/getDecodedFunctionData.ts"],"names":["isProxyABI","abi","item","i","_getAbi","contractAddress","chainId","publicClient","url","appConfig"],"mappings":"AAAA,yoBAAoG,oCAAiC,oCAAiC,oCAAiC,oCAAiC,oCAAiC,oCAAiC,4BCWnS,sDAEmC,gEAEd,sEACG,SAGtBA,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,CAAAC,CACF,CAAA,CAIG,CACD,IAAMC,CAAAA,CAAM,CAAA,sEAAA,EAAyEH,CAAe,CAAA,QAAA,EAAWI,mBAAAA,CAAU,OAAA,CAAQ,OAAA,CAAQ,SAAS,CAAA,SAAA,EAAYH,CAAO,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/actions/governance/exports.cjs","sourcesContent":[null,"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,2 +1,2 @@
|
|
|
1
|
-
import{a as D,b as F,c as $,d as P,e as S,f as _,g as k,h as N,i as v}from"../../chunk-
|
|
1
|
+
import{a as D,b as F,c as $,d as P,e as S,f as _,g as k,h as N,i as v}from"../../chunk-LUNZGZWN.mjs";import"../../chunk-OGJMSGB2.mjs";import"../../chunk-5XOEJ6XX.mjs";import"../../chunk-JHUVLM54.mjs";import"../../chunk-PRLVZIKD.mjs";import"../../chunk-TU63NRNL.mjs";import"../../chunk-5SIQ7BKT.mjs";import{decodeFunctionData as d,erc20Abi as f,pad as p,toFunctionSignature as b,trim as u}from"viem";import{appConfig as l,defaultChainId as A}from"@berachain/config/internal";import{beraChefAbi as g}from"@berachain/abis/pol/rewards/beraChef";import{rewardVaultAbi as x}from"@berachain/abis/pol/rewards/rewardVault";function y(t){return t.some(e=>{let n=e;return n.name==="implementation"||n.name==="proxyType"||n.type==="constructor"&&n.inputs?.[0]?.name==="implementation"})}async function m({contractAddress:t,chainId:e,publicClient:n}){let c=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${t}&apikey=${l.apiKeys.private.etherscan}&chainId=${e}`,i=await fetch(c);if(!i.ok)throw new Error(`Failed to fetch ABI: ${i.statusText}`);let a=await i.json();if(a.status==="0")throw new Error(a.result);let r=JSON.parse(a.result);if(!y(r))return r;let o=await n.getStorageAt({address:t,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!o||u(o)==="0x00")return r;let s=p(u(o),{size:20});return m({contractAddress:s,chainId:e,publicClient:n})}async function h({address:t,callData:e,knownAbi:n,chainId:c,publicClient:i}){try{if(d({data:e,abi:n}))return n}catch{}return m({contractAddress:t,chainId:c,publicClient:i}).catch(()=>{})}function I(t,e){try{return d({data:t,abi:e})}catch{return}}function w(t,e){return t.find(n=>n.type==="function"&&n.name===e)}function C(t){if(t)try{return b(t)}catch(e){console.error(e)}}async function j({address:t,callData:e,chainId:n=A,publicClient:c}){let i=[...g,...x,...f],a=await h({address:t,callData:e,knownAbi:i,chainId:n,publicClient:c}),r=I(e,a);if(!a||!r)return{args:[]};let o=w(a,r.functionName),s=C(o);return{abiItem:o,functionSignature:s,functionName:r.functionName,args:r.args}}export{F as MOCKED_PROPOSAL_STATUSES,D as checkProposalField,$ as computeActualStatus,P as getAllProposals,S as getBodyErrors,j as getDecodedFunctionData,_ as getProposalDetails,N as getProposalFromTx,v as getProposalVotes,k as parseProposalBody};
|
|
2
2
|
//# sourceMappingURL=exports.mjs.map
|