@berachain/berajs 0.2.8-beta.6 → 0.2.8-beta.7
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/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +95 -50
- package/dist/actions/exports.d.ts +95 -50
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/{chunk-G4CNETLS.mjs → chunk-6K252BGM.mjs} +2 -2
- package/dist/{chunk-I7M43BB4.cjs → chunk-D6L7LTA2.cjs} +2 -2
- package/dist/chunk-D6L7LTA2.cjs.map +1 -0
- package/dist/{chunk-T5FSQ3YE.mjs → chunk-JDZGYU5T.mjs} +2 -2
- package/dist/{chunk-T5FSQ3YE.mjs.map → chunk-JDZGYU5T.mjs.map} +1 -1
- package/dist/{chunk-7EAKCNQT.cjs → chunk-JLFBRMOF.cjs} +2 -2
- package/dist/{chunk-7EAKCNQT.cjs.map → chunk-JLFBRMOF.cjs.map} +1 -1
- package/dist/chunk-MASD43N5.mjs +4 -0
- package/dist/chunk-MASD43N5.mjs.map +1 -0
- package/dist/chunk-MGGPHKA2.cjs +4 -0
- package/dist/{chunk-WD4B3SXS.cjs.map → chunk-MGGPHKA2.cjs.map} +1 -1
- package/dist/{chunk-S5VOCVBR.mjs → chunk-UENDEN3M.mjs} +2 -2
- package/dist/{chunk-E32UP4GV.cjs → chunk-UFIM7WQ4.cjs} +2 -2
- package/dist/{chunk-E32UP4GV.cjs.map → chunk-UFIM7WQ4.cjs.map} +1 -1
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts} +2 -2
- package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-Cql_D50j.d.cts} +2 -2
- package/dist/{global.d-SU9Epq0M.d.ts → global.d-5w_lvl2J.d.ts} +1 -1
- package/dist/{global.d-6aSWIkV_.d.cts → global.d-B7IeayVX.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +4 -4
- package/dist/hooks/exports.d.ts +4 -4
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-7_o92X3N.d.cts} +2 -0
- package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-7_o92X3N.d.ts} +2 -0
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/package.json +4 -4
- package/src/actions/clients/getApolloClient.ts +11 -4
- package/src/actions/dex/getOnChainPool.ts +1 -1
- package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
- package/src/actions/enso/util.ts +6 -8
- package/src/actions/governance/checkProposalField.ts +108 -54
- package/src/actions/governance/computeActualStatus.ts +7 -3
- package/src/actions/governance/getAllProposals.ts +15 -8
- package/src/actions/governance/getBodyErrors.ts +13 -5
- package/src/actions/governance/getDecodedFunctionData.ts +27 -19
- package/src/actions/governance/getProposalDetails.ts +8 -4
- package/src/actions/governance/getProposalFromTx.ts +19 -10
- package/src/actions/governance/getProposalParams.ts +17 -17
- package/src/actions/governance/getProposalVotes.ts +7 -3
- package/src/actions/governance/getQuorum.ts +7 -7
- package/src/actions/governance/parseProposalBody.ts +19 -9
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +8 -15
- package/src/enum/txnEnum.ts +2 -0
- package/dist/chunk-5NDYN2IB.mjs +0 -4
- package/dist/chunk-5NDYN2IB.mjs.map +0 -1
- package/dist/chunk-I7M43BB4.cjs.map +0 -1
- package/dist/chunk-WD4B3SXS.cjs +0 -4
- /package/dist/{chunk-G4CNETLS.mjs.map → chunk-6K252BGM.mjs.map} +0 -0
- /package/dist/{chunk-S5VOCVBR.mjs.map → chunk-UENDEN3M.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 _chunkWD4B3SXScjs = require('../chunk-WD4B3SXS.cjs');var _chunkE32UP4GVcjs = require('../chunk-E32UP4GV.cjs');require('../chunk-WRFDB3QJ.cjs');var _chunkKT6L4K4Kcjs = require('../chunk-KT6L4K4K.cjs');var _chunkZYXVUXFQcjs = require('../chunk-ZYXVUXFQ.cjs');require('../chunk-OUD27MU7.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-DTBJO6VT.cjs');var _chunkQFLDL4UVcjs = require('../chunk-QFLDL4UV.cjs');require('../chunk-53TSJM6P.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let 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 $t=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, t);return(await e.readContract({address:o.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function G(e){return e.some(t=>t.name==="implementation"||t.name==="proxyType"||t.type==="constructor"&&_optionalChain([t, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation")}async function N({contractAddress:e,chainId:t,publicClient:o}){let r=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(r);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!G(m))return m;let i=await o.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return N({contractAddress:s,chainId:t,publicClient:o})}async function q({address:e,callData:t,knownAbi:o,chainId:r,publicClient:n}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:o}))return o}catch (e2){}return N({contractAddress:e,chainId:r,publicClient:n}).catch(()=>{})}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e3){return}}function X(e,t){return e.find(o=>o.type==="function"&&o.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:o=_internal.defaultChainId,publicClient:r}){let n=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await q({address:e,callData:t,knownAbi:n,chainId:o,publicClient:r}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function nr({client:e,collateralList:t,...o}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, o);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:r.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, a[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:o}=_chunkZYXVUXFQcjs.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 pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function gr({publicClient:e,factory:t,...o}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, o);return e.readContract({address:_nullishCoalesce(t, () => (r.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:o,...r}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, r),a=_nullishCoalesce(e, () => (n.averageBlockTime)),m=_nullishCoalesce(o, () => (Math.floor(_chunkKT6L4K4Kcjs.q.call(void 0, 1)/a))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunkKT6L4K4Kcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Nr({tokenList:e,publicClient:t,lstStakingVaults:o,...r}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, {...r,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (r.chainId))}),a=e.filter(i=>o.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>_chunkZYXVUXFQcjs.e.call(void 0, y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var S=[{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 v({publicClient:e,...t}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, t),r=o.pol.factory;_chunkQFLDL4UVcjs.b.call(void 0, e,"publicClient"),_chunkQFLDL4UVcjs.d.call(void 0, o.pol.factory,"factoryAddress");let n=await e.readContract({address:r,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:n,abi:S,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunkQFLDL4UVcjs.c.call(void 0, e);let o=await v({publicClient:e,...t}),[r,n]=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(n)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:o,...r}){let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, r),a=await t.readContract({address:_nullishCoalesce(o, () => (n.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return a===_viem.zeroAddress?null:a}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...o}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, o);try{let n=await Promise.all(e.map(a=>t.readContract({address:r.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunkKT6L4K4Kcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (o.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...o}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, o),[n,a,m,i,s,c,p,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(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let o=e.filter(r=>_optionalChain([r, 'optionalAccess', _14 => _14.receivingVault])).reduce((r,n)=>{for(let a of _nullishCoalesce(_optionalChain([n, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&a.remainingAmount==="0")continue;let m=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRate).times(n.percentage),i=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=r.get(s);c?r.set(s,{...c,incentiveRate:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):r.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return r},new Map);return Array.from(o.values())}function ne(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,o)=>{if(!o)return t;let r=_nullishCoalesce(_optionalChain([o, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(n=>Number(n.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)]), () => (0));return t+r*o.percentage},0)])}function io({validator:e,bgtPrice:t}){let o=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),r=ne(e);return!r||!o?0:r*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(o*t)}exports.BalancerApi = _chunkWD4B3SXScjs.f; exports.BaseAggregator = _chunkWD4B3SXScjs.e; exports.BeraApolloClient = _chunkWD4B3SXScjs.b; exports.HoneyPreviewMethod = _chunkWD4B3SXScjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunkWD4B3SXScjs.o; exports.RewardVaultDistributionMode = _chunkWD4B3SXScjs.M; exports.aggregateValidatorIncentives = no; exports.beraWriteContract = _chunkWD4B3SXScjs.ma; exports.checkProposalField = _chunkWD4B3SXScjs.n; exports.computeActualStatus = _chunkWD4B3SXScjs.p; exports.formatValidatorRewardAllocation = _chunkWD4B3SXScjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunkWD4B3SXScjs.g; exports.getAllProposals = _chunkWD4B3SXScjs.q; exports.getAllValidators = _chunkWD4B3SXScjs.na; exports.getAllowances = _chunkWD4B3SXScjs.ka; exports.getApiEnrichedAllocation = _chunkWD4B3SXScjs.oa; exports.getApiPool = _chunkWD4B3SXScjs.h; exports.getApiValidator = _chunkWD4B3SXScjs.pa; exports.getApolloClient = _chunkWD4B3SXScjs.c; exports.getBalanceCall = _chunkE32UP4GVcjs.b; exports.getBgtAprSimulation = _chunkWD4B3SXScjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunkWD4B3SXScjs.L; exports.getBodyErrors = _chunkWD4B3SXScjs.r; exports.getChartData = _chunkWD4B3SXScjs.w; exports.getCollateralWeights = _chunkWD4B3SXScjs.x; exports.getConvertToAssets = _chunkWD4B3SXScjs.a; exports.getDailyValidatorBlockStats = _chunkWD4B3SXScjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunkWD4B3SXScjs.va; exports.getEarnedStakedBeraVault = _chunkWD4B3SXScjs.P; exports.getEnsoClient = _chunkE32UP4GVcjs.a; exports.getGlobalCapLimit = _chunkWD4B3SXScjs.B; exports.getGlobalData = _chunkWD4B3SXScjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunkWD4B3SXScjs.i; exports.getHoneyCollaterals = _chunkWD4B3SXScjs.z; exports.getHoneyFees = nr; exports.getHoneyGlobalData = _chunkWD4B3SXScjs.C; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunkWD4B3SXScjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = gr; exports.getHoneyVaultsBalance = _chunkWD4B3SXScjs.F; exports.getIncentiveFeeClaimStats = _chunkWD4B3SXScjs.S; exports.getLSTStakeConfig = Nr; exports.getMarkets = _chunkWD4B3SXScjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunkWD4B3SXScjs.k; exports.getPoolEvents = _chunkWD4B3SXScjs.l; exports.getPoolHistoricalData = _chunkWD4B3SXScjs.m; exports.getPoolPausedState = _chunkWD4B3SXScjs.j; exports.getPoolState = $t; exports.getProposalDetails = _chunkWD4B3SXScjs.s; exports.getProposalFromTx = _chunkWD4B3SXScjs.u; exports.getProposalVotes = _chunkWD4B3SXScjs.v; exports.getPythLatestPrices = _chunkWD4B3SXScjs.G; exports.getPythUpdateFee = _chunkWD4B3SXScjs.I; exports.getRelativeCapLimit = _chunkWD4B3SXScjs.H; exports.getRewardProofsByValidator = _chunkWD4B3SXScjs.U; exports.getRewardTokenToBeraRate = _chunkWD4B3SXScjs.V; exports.getRewardVault = _chunkWD4B3SXScjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunkWD4B3SXScjs.X; exports.getRewardVaultRewards = _chunkWD4B3SXScjs.N; exports.getRewardVaultStakingToken = _chunkWD4B3SXScjs.Y; exports.getRewardVaults = _chunkWD4B3SXScjs.Q; exports.getSWBeraVaultMetadata = _chunkWD4B3SXScjs.aa; exports.getSWBeraWithdrawal = _chunkWD4B3SXScjs.ba; exports.getStakeWithdrawalCooldown = _chunkWD4B3SXScjs.$; exports.getStakedBeraAPR = _chunkWD4B3SXScjs.Z; exports.getStakedBeraSnapshots = _chunkWD4B3SXScjs._; exports.getStakingPoolBatch = _chunkWD4B3SXScjs.wa; exports.getSwapPayload = _chunkWD4B3SXScjs.J; exports.getTokenCurrentPrices = _chunkWD4B3SXScjs.ja; exports.getTokenInformation = _chunkWD4B3SXScjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunkWD4B3SXScjs.ca; exports.getUserActiveValidators = _chunkWD4B3SXScjs.ya; exports.getUserBoostsOnValidator = _chunkWD4B3SXScjs.xa; exports.getUserClaimableIncentives = _chunkWD4B3SXScjs.da; exports.getUserStakingPositions = _chunkWD4B3SXScjs.za; exports.getUserVaultInfo = _chunkWD4B3SXScjs.fa; exports.getUserVaults = _chunkWD4B3SXScjs.ga; exports.getUserVaultsReward = _chunkWD4B3SXScjs.ea; exports.getValidatorAnalytics = _chunkWD4B3SXScjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunkWD4B3SXScjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunkWD4B3SXScjs.Ca; exports.getValidatorOperatorAddress = _chunkWD4B3SXScjs.Da; exports.getValidatorQueuedCommission = _chunkWD4B3SXScjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunkWD4B3SXScjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunkWD4B3SXScjs.Ga; exports.getValidatorReturnPerBgt = ne; exports.getValidatorRewardAllocation = _chunkWD4B3SXScjs.ta; exports.getVaultHistory = _chunkWD4B3SXScjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunkWD4B3SXScjs.ia; exports.getWalletBalances = _chunkE32UP4GVcjs.c; exports.gql = _chunkWD4B3SXScjs.d; exports.isBadCollateralAsset = _chunkWD4B3SXScjs.A; exports.isBasketModeEnabled = _chunkWD4B3SXScjs.K; exports.isDefaultRewardAllocation = _chunkWD4B3SXScjs.ua; exports.isImpersonateAccount = _chunkWD4B3SXScjs.la; exports.isSameRewardAllocation = _chunkWD4B3SXScjs.sa; exports.parseProposalBody = _chunkWD4B3SXScjs.t;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkMGGPHKA2cjs = require('../chunk-MGGPHKA2.cjs');require('../chunk-OUD27MU7.cjs');var _chunkUFIM7WQ4cjs = require('../chunk-UFIM7WQ4.cjs');require('../chunk-OIYXOKTT.cjs');require('../chunk-WRFDB3QJ.cjs');var _chunkKT6L4K4Kcjs = require('../chunk-KT6L4K4K.cjs');var _chunkZYXVUXFQcjs = require('../chunk-ZYXVUXFQ.cjs');require('../chunk-DTBJO6VT.cjs');var _chunkQFLDL4UVcjs = require('../chunk-QFLDL4UV.cjs');require('../chunk-53TSJM6P.cjs');var _viem = require('viem');var _metaMorphoV11 = require('@berachain/abis/bend-metamorpho/metaMorphoV11');async function _t({vaultAddress:e,publicClient:t}){let r=await t.readContract({address:e,abi:_metaMorphoV11.metaMorphoV11Abi,functionName:"maxDeposit",args:[e]});return _viem.formatEther.call(void 0, r)}var _berancersdk = require('@berachain-foundation/berancer-sdk');var Gt=e=>({type:_berancersdk.mapPoolType.call(void 0, e.type),protocolVersion:e.protocolVersion,tokens:e.tokens.map(t=>({...t,address:t.address})),id:e.id,address:e.address});var _vault = require('@berachain/abis/bex/vault');async function zt({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return(await e.readContract({address:r.bex.vault,abi:_vault.vaultAbi,functionName:"getPausedState"}))[0]}var _internal = require('@berachain/config/internal');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function L(e){return e.some(t=>{let r=t;return r.name==="implementation"||r.name==="proxyType"||r.type==="constructor"&&_optionalChain([r, 'access', _2 => _2.inputs, 'optionalAccess', _3 => _3[0], 'optionalAccess', _4 => _4.name])==="implementation"})}async function F({contractAddress:e,chainId:t,publicClient:r}){let o=`https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${e}&apikey=${_internal.appConfig.apiKeys.private.etherscan}&chainId=${t}`,n=await fetch(o);if(!n.ok)throw new Error(`Failed to fetch ABI: ${n.statusText}`);let a=await n.json();if(a.status==="0")throw new Error(a.result);let m=JSON.parse(a.result);if(!L(m))return m;let i=await r.getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});if(!i||_viem.trim.call(void 0, i)==="0x00")return m;let s=_viem.pad.call(void 0, _viem.trim.call(void 0, i),{size:20});return F({contractAddress:s,chainId:t,publicClient:r})}async function q({address:e,callData:t,knownAbi:r,chainId:o,publicClient:n}){try{if(_viem.decodeFunctionData.call(void 0, {data:t,abi:r}))return r}catch (e2){}return F({contractAddress:e,chainId:o,publicClient:n}).catch(()=>{})}function z(e,t){try{return _viem.decodeFunctionData.call(void 0, {data:e,abi:t})}catch (e3){return}}function X(e,t){return e.find(r=>r.type==="function"&&r.name===t)}function j(e){if(e)try{return _viem.toFunctionSignature.call(void 0, e)}catch(t){console.error(t)}}async function Yt({address:e,callData:t,chainId:r=_internal.defaultChainId,publicClient:o}){let n=[..._beraChef.beraChefAbi,..._rewardVault.rewardVaultAbi,..._viem.erc20Abi],a=await q({address:e,callData:t,knownAbi:n,chainId:r,publicClient:o}),m=z(t,a);if(!a||!m)return{args:[]};let i=X(a,m.functionName),s=j(i);return{abiItem:i,functionSignature:s,functionName:m.functionName,args:m.args}}var _honeyFactory = require('@berachain/abis/honey/honeyFactory');async function nr({client:e,collateralList:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n={mint:[],redeem:[]};for(let s of t)n.mint.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"mintRates",args:[s.address]})),n.redeem.push(e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"redeemRates",args:[s.address]}));let[a,m,i]=await Promise.all([Promise.all(n.mint),Promise.all(n.redeem),e.readContract({address:o.honey.factory,abi:_honeyFactory.honeyFactoryAbi,functionName:"getWeights"})]);return t.reduce((s,c)=>{let p=t.indexOf(c);return s.single[c.address]={mintFee:1-+_viem.formatUnits.call(void 0, a[p],18),redeemFee:1-+_viem.formatUnits.call(void 0, m[p],18)},s.basket.mintFee+=s.single[c.address].mintFee*+_viem.formatUnits.call(void 0, i[p],18),s.basket.redeemFee+=s.single[c.address].redeemFee*+_viem.formatUnits.call(void 0, i[p],18),s},{single:{},basket:{mintFee:0,redeemFee:0}})}catch(n){throw console.log(n),n}}var _honey = require('@berachain/abis/honey/honey');async function mr({client:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.honey.token;return await e.readContract({address:o,abi:_honey.honeyAbi,functionName:"paused"})}var _rootPriceOracle = require('@berachain/abis/extras/rootPriceOracle');async function pr({pythOracle:e,publicClient:t}){return t.readContract({address:e,abi:_rootPriceOracle.rootPriceOracleAbi,functionName:"pythOracle"})}async function gr({publicClient:e,factory:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);return e.readContract({address:_nullishCoalesce(t, () => (o.honey.factory)),abi:_honeyFactory.honeyFactoryAbi,functionName:"priceOracle"})}async function hr({defaultBlockTime:e,publicClient:t,blocksSpan:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=_nullishCoalesce(e, () => (n.averageBlockTime)),m=_nullishCoalesce(r, () => (Math.floor(_chunkKT6L4K4Kcjs.q.call(void 0, 1)/a))),i=await _optionalChain([t, 'optionalAccess', _5 => _5.getBlock, 'call', _6 => _6({blockTag:"latest"})]),s=await _optionalChain([t, 'optionalAccess', _7 => _7.getBlock, 'call', _8 => _8({blockNumber:i.number-BigInt(m)})]);return(_chunkKT6L4K4Kcjs.l.call(void 0, Date.now())-Number(_optionalChain([s, 'optionalAccess', _9 => _9.timestamp])))/(Number(_optionalChain([i, 'optionalAccess', _10 => _10.number]))-Number(_optionalChain([s, 'optionalAccess', _11 => _11.number])))}var _lstStakerVault = require('@berachain/abis/pol/lst/lstStakerVault');async function Fr({tokenList:e,publicClient:t,lstStakingVaults:r,...o}){_chunkQFLDL4UVcjs.c.call(void 0, t);let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, {...o,chainId:_nullishCoalesce(_optionalChain([t, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]), () => (o.chainId))}),a=e.filter(i=>r.includes(i.address));return a.length===0?[]:(await Promise.all(a.map(async i=>({assetTokenAddress:await t.readContract({address:i.address,abi:_lstStakerVault.lstStakerVaultAbi,functionName:"asset"}),stakingToken:i})))).reduce((i,{assetTokenAddress:s,stakingToken:c})=>{let p=e.find(y=>_chunkZYXVUXFQcjs.e.call(void 0, y,s));return p&&i.push({id:c.address,receiptToken:c,inputTokens:[p]}),i},[])}var _rewardVaultFactory = require('@berachain/abis/pol/rewards/rewardVaultFactory');var N=[{inputs:[{internalType:"address",name:"initialOwner",type:"address"},{internalType:"address",name:"initialImplementation",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"NewImplementationHasNoCode",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"}];async function S({publicClient:e,...t}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t),o=r.pol.factory;_chunkQFLDL4UVcjs.b.call(void 0, e,"publicClient"),_chunkQFLDL4UVcjs.d.call(void 0, r.pol.factory,"factoryAddress");let n=await e.readContract({address:o,abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"beacon"});return e.readContract({address:n,abi:N,functionName:"implementation"})}async function Wr({publicClient:e,...t}){_chunkQFLDL4UVcjs.c.call(void 0, e);let r=await S({publicClient:e,...t}),[o,n]=await Promise.all([e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MIN_REWARD_DURATION"}),e.readContract({address:r,abi:_rewardVault.rewardVaultAbi,functionName:"MAX_REWARD_DURATION"})]);return{minRewardDuration:Number(o),maxRewardDuration:Number(n)}}async function Er({tokenAddress:e,publicClient:t,factoryAddress:r,...o}){let{config:n}=_chunkZYXVUXFQcjs.a.call(void 0, o),a=await t.readContract({address:_nullishCoalesce(r, () => (n.pol.factory)),abi:_rewardVaultFactory.rewardVaultFactoryAbi,functionName:"getVault",args:[e]});return a===_viem.zeroAddress?null:a}var _pythPriceOracle = require('@berachain/abis/extras/pythPriceOracle');async function qr({tokenList:e,publicClient:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r);try{let n=await Promise.all(e.map(a=>t.readContract({address:o.honey.pythOracle,abi:_pythPriceOracle.pythPriceOracleAbi,functionName:"feeds",args:[a]})));return e.reduce((a,m,i)=>({...a,[m]:n[i]}),{})}catch(n){throw console.error("getPythPriceFeedId",n),n}}async function Kr({url:e,...t}={}){let{config:r}=_chunkZYXVUXFQcjs.a.call(void 0, t);return await _asyncNullishCoalesce((await _chunkKT6L4K4Kcjs.d.call(void 0, {url:_nullishCoalesce(e, () => (r.lists.tokenList)),type:"rest",name:"GitHub"})).tokens, async () => ([]))}var _bgt = require('@berachain/abis/pol/bgt');async function to({publicClient:e,ui:t,...r}){let{config:o}=_chunkZYXVUXFQcjs.a.call(void 0, r),[n,a,m,i,s,c,p,y]=await Promise.all([e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"MAX_COMMISSION_RATE"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"commissionChangeDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationBlockDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxWeightPerVault"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"maxNumWeightsPerRewardAllocation"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"dropBoostDelay"}),e.readContract({address:o.tokens.bgt,abi:_bgt.bgtAbi,functionName:"activateBoostDelay"}),e.readContract({address:o.pol.beraChef,abi:_beraChef.beraChefAbi,functionName:"rewardAllocationInactivityBlockSpan"})]);return{maxCommissionRate:Number(n)/1e4,boostDelay:Number(p),unboostDelay:Number(c),commissionChangeDelay:Number(a),rewardAllocationBlockDelay:Number(m),maxWeightPerVault:Number(i)/1e4,maxNumWeightsPerRewardAllocation:Number(s),rewardAllocationInactivityBlockSpan:Number(y),ui:t}}function no({rewardAllocationWeights:e,activeOnly:t=!0}){let r=e.filter(o=>_optionalChain([o, 'optionalAccess', _14 => _14.receivingVault])).reduce((o,n)=>{for(let a of _nullishCoalesce(_optionalChain([n, 'access', _15 => _15.receivingVault, 'optionalAccess', _16 => _16.activeIncentives]), () => ([]))){if(t&&a.remainingAmount==="0")continue;let m=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRate).times(n.percentage),i=new (0, _chunkKT6L4K4Kcjs.a)(a.incentiveRateUsd).times(n.percentage),s=a.token.address.toLowerCase(),c=o.get(s);c?o.set(s,{...c,incentiveRate:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRate).plus(m).toString(),incentiveRateUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.incentiveRateUsd).plus(i).toString(),remainingAmount:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmount).plus(a.remainingAmount).toString(),remainingAmountUsd:new (0, _chunkKT6L4K4Kcjs.a)(c.remainingAmountUsd).plus(a.remainingAmountUsd).toString()}):o.set(s,{...a,tokenAddress:a.token.address,token:a.token,incentiveRate:m.toString(),incentiveRateUsd:i.toString(),remainingAmount:a.remainingAmount})}return o},new Map);return Array.from(r.values())}function ne(e){return _optionalChain([e, 'optionalAccess', _17 => _17.rewardAllocationWeights, 'optionalAccess', _18 => _18.reduce, 'call', _19 => _19((t,r)=>{if(!r)return t;let o=_nullishCoalesce(_optionalChain([r, 'access', _20 => _20.receivingVault, 'optionalAccess', _21 => _21.activeIncentives, 'access', _22 => _22.filter, 'call', _23 => _23(n=>Number(n.remainingAmount)>0), 'access', _24 => _24.reduce, 'call', _25 => _25((n,a)=>{let m=Number(a.remainingAmountUsd)/Number(a.remainingAmount);return n+Number(a.incentiveRate)*m},0)]), () => (0));return t+o*r.percentage},0)])}function io({validator:e,bgtPrice:t}){let r=Number(_nullishCoalesce(_optionalChain([e, 'access', _26 => _26.dynamicData, 'optionalAccess', _27 => _27.activeBoostAmount]), () => (0))),o=ne(e);return!o||!r?0:o*Number(_nullishCoalesce(_optionalChain([e, 'access', _28 => _28.dynamicData, 'optionalAccess', _29 => _29.lastDayDistributedBGTAmount]), () => (0)))*365/(r*t)}exports.BalancerApi = _chunkMGGPHKA2cjs.f; exports.BaseAggregator = _chunkMGGPHKA2cjs.e; exports.BeraApolloClient = _chunkMGGPHKA2cjs.b; exports.HoneyPreviewMethod = _chunkMGGPHKA2cjs.D; exports.MOCKED_PROPOSAL_STATUSES = _chunkMGGPHKA2cjs.o; exports.RewardVaultDistributionMode = _chunkMGGPHKA2cjs.M; exports.aggregateValidatorIncentives = no; exports.beraWriteContract = _chunkMGGPHKA2cjs.ma; exports.checkProposalField = _chunkMGGPHKA2cjs.n; exports.computeActualStatus = _chunkMGGPHKA2cjs.p; exports.formatValidatorRewardAllocation = _chunkMGGPHKA2cjs.ra; exports.getActiveBoostAndCommissionChangeDelay = to; exports.getAllPools = _chunkMGGPHKA2cjs.g; exports.getAllProposals = _chunkMGGPHKA2cjs.q; exports.getAllValidators = _chunkMGGPHKA2cjs.na; exports.getAllowances = _chunkMGGPHKA2cjs.ka; exports.getApiEnrichedAllocation = _chunkMGGPHKA2cjs.oa; exports.getApiPool = _chunkMGGPHKA2cjs.h; exports.getApiValidator = _chunkMGGPHKA2cjs.pa; exports.getApolloClient = _chunkMGGPHKA2cjs.c; exports.getBalanceCall = _chunkUFIM7WQ4cjs.b; exports.getBgtAprSimulation = _chunkMGGPHKA2cjs.O; exports.getBlockTime = hr; exports.getBlockTimestamp = _chunkMGGPHKA2cjs.L; exports.getBodyErrors = _chunkMGGPHKA2cjs.r; exports.getChartData = _chunkMGGPHKA2cjs.w; exports.getCollateralWeights = _chunkMGGPHKA2cjs.x; exports.getConvertToAssets = _chunkMGGPHKA2cjs.a; exports.getDailyValidatorBlockStats = _chunkMGGPHKA2cjs.qa; exports.getDecodedFunctionData = Yt; exports.getDefaultRewardAllocation = _chunkMGGPHKA2cjs.va; exports.getEarnedStakedBeraVault = _chunkMGGPHKA2cjs.P; exports.getEnsoClient = _chunkUFIM7WQ4cjs.a; exports.getGlobalCapLimit = _chunkMGGPHKA2cjs.B; exports.getGlobalData = _chunkMGGPHKA2cjs.R; exports.getGlobalLiquidityAndSwapVolume = _chunkMGGPHKA2cjs.i; exports.getHoneyCollaterals = _chunkMGGPHKA2cjs.z; exports.getHoneyFees = nr; exports.getHoneyGlobalData = _chunkMGGPHKA2cjs.C; exports.getHoneyPausedState = mr; exports.getHoneyPreview = _chunkMGGPHKA2cjs.E; exports.getHoneyPythFeeds = qr; exports.getHoneyPythOracle = pr; exports.getHoneyRootPriceOracle = gr; exports.getHoneyVaultsBalance = _chunkMGGPHKA2cjs.F; exports.getIncentiveFeeClaimStats = _chunkMGGPHKA2cjs.S; exports.getLSTStakeConfig = Fr; exports.getMarkets = _chunkMGGPHKA2cjs.T; exports.getMaxDeposit = _t; exports.getOnChainPool = _chunkMGGPHKA2cjs.k; exports.getPoolEvents = _chunkMGGPHKA2cjs.l; exports.getPoolHistoricalData = _chunkMGGPHKA2cjs.m; exports.getPoolPausedState = _chunkMGGPHKA2cjs.j; exports.getPoolState = Gt; exports.getProposalDetails = _chunkMGGPHKA2cjs.s; exports.getProposalFromTx = _chunkMGGPHKA2cjs.u; exports.getProposalVotes = _chunkMGGPHKA2cjs.v; exports.getPythLatestPrices = _chunkMGGPHKA2cjs.G; exports.getPythUpdateFee = _chunkMGGPHKA2cjs.I; exports.getRelativeCapLimit = _chunkMGGPHKA2cjs.H; exports.getRewardProofsByValidator = _chunkMGGPHKA2cjs.U; exports.getRewardTokenToBeraRate = _chunkMGGPHKA2cjs.V; exports.getRewardVault = _chunkMGGPHKA2cjs.W; exports.getRewardVaultDurationConstants = Wr; exports.getRewardVaultFromToken = Er; exports.getRewardVaultIncentives = _chunkMGGPHKA2cjs.X; exports.getRewardVaultRewards = _chunkMGGPHKA2cjs.N; exports.getRewardVaultStakingToken = _chunkMGGPHKA2cjs.Y; exports.getRewardVaults = _chunkMGGPHKA2cjs.Q; exports.getSWBeraVaultMetadata = _chunkMGGPHKA2cjs.aa; exports.getSWBeraWithdrawal = _chunkMGGPHKA2cjs.ba; exports.getStakeWithdrawalCooldown = _chunkMGGPHKA2cjs.$; exports.getStakedBeraAPR = _chunkMGGPHKA2cjs.Z; exports.getStakedBeraSnapshots = _chunkMGGPHKA2cjs._; exports.getStakingPoolBatch = _chunkMGGPHKA2cjs.wa; exports.getSwapPayload = _chunkMGGPHKA2cjs.J; exports.getTokenCurrentPrices = _chunkMGGPHKA2cjs.ja; exports.getTokenInformation = _chunkMGGPHKA2cjs.y; exports.getTokens = Kr; exports.getTotalStakedAmount = _chunkMGGPHKA2cjs.ca; exports.getUserActiveValidators = _chunkMGGPHKA2cjs.ya; exports.getUserBoostsOnValidator = _chunkMGGPHKA2cjs.xa; exports.getUserClaimableIncentives = _chunkMGGPHKA2cjs.da; exports.getUserStakingPositions = _chunkMGGPHKA2cjs.za; exports.getUserVaultInfo = _chunkMGGPHKA2cjs.fa; exports.getUserVaults = _chunkMGGPHKA2cjs.ga; exports.getUserVaultsReward = _chunkMGGPHKA2cjs.ea; exports.getValidatorAnalytics = _chunkMGGPHKA2cjs.Aa; exports.getValidatorBoostApy = io; exports.getValidatorCommission = _chunkMGGPHKA2cjs.Ba; exports.getValidatorEstimatedBgtPerYear = _chunkMGGPHKA2cjs.Ca; exports.getValidatorOperatorAddress = _chunkMGGPHKA2cjs.Da; exports.getValidatorQueuedCommission = _chunkMGGPHKA2cjs.Ea; exports.getValidatorQueuedOperatorAddress = _chunkMGGPHKA2cjs.Fa; exports.getValidatorQueuedRewardAllocation = _chunkMGGPHKA2cjs.Ga; exports.getValidatorReturnPerBgt = ne; exports.getValidatorRewardAllocation = _chunkMGGPHKA2cjs.ta; exports.getVaultHistory = _chunkMGGPHKA2cjs.ha; exports.getVaultPausedState = zt; exports.getVaultValidators = _chunkMGGPHKA2cjs.ia; exports.getWalletBalances = _chunkUFIM7WQ4cjs.c; exports.gql = _chunkMGGPHKA2cjs.d; exports.isBadCollateralAsset = _chunkMGGPHKA2cjs.A; exports.isBasketModeEnabled = _chunkMGGPHKA2cjs.K; exports.isDefaultRewardAllocation = _chunkMGGPHKA2cjs.ua; exports.isImpersonateAccount = _chunkMGGPHKA2cjs.la; exports.isSameRewardAllocation = _chunkMGGPHKA2cjs.sa; exports.parseProposalBody = _chunkMGGPHKA2cjs.t;
|
|
2
2
|
//# sourceMappingURL=exports.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts"],"names":["getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","getPoolState","apiPool","mapPoolType","pt","getVaultPausedState","args","config","parseBaseArgs","balancerVaultAbi","isProxyABI","abi","item","_getAbi","contractAddress","chainId","url","appConfig"],"mappings":"AAAA,+1BAAwvB,yDAA2D,iCAA8B,yDAA+D,yDAAiD,iCAA8B,
|
|
1
|
+
{"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","../../src/actions/bend/getMaxDeposit.ts","../../src/actions/dex/getPoolWithState.ts","../../src/actions/dex/getVaultPausedState.ts","../../src/actions/governance/getDecodedFunctionData.ts"],"names":["getMaxDeposit","vaultAddress","publicClient","maxDeposit","metaMorphoAbi","formatEther","getPoolState","apiPool","mapPoolType","pt","getVaultPausedState","args","config","parseBaseArgs","balancerVaultAbi","isProxyABI","abi","item","i","_getAbi","contractAddress","chainId","url","appConfig"],"mappings":"AAAA,+1BAAwvB,iCAA8B,yDAA2D,iCAA8B,iCAA8B,yDAA+D,yDAAiD,iCAA8B,yDAAwD,iCAA8B,4BCApjC,8EAEX,MAOlD,SAAsBA,EAAAA,CAAc,CAClC,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CACF,CAAA,CAAwC,CACtC,IAAMC,CAAAA,CAAa,MAAMD,CAAAA,CAAa,YAAA,CAAa,CACjD,OAAA,CAASD,CAAAA,CACT,GAAA,CAAKG,+BAAAA,CACL,YAAA,CAAc,YAAA,CACd,IAAA,CAAM,CAACH,CAAY,CACrB,CAAC,CAAA,CACD,OAAOI,+BAAAA,CAAsB,CAC/B,CCpBA,iEAIO,IAKMC,EAAAA,CAAgBC,CAAAA,EAAAA,CACpB,CACL,IAAA,CAAMC,sCAAAA,CAAYD,CAAQ,IAAI,CAAA,CAC9B,eAAA,CAAiBA,CAAAA,CAAQ,eAAA,CACzB,MAAA,CAAQA,CAAAA,CAAQ,MAAA,CAAO,GAAA,CACpBE,CAAAA,EAAAA,CACE,CACC,GAAGA,CAAAA,CACH,OAAA,CAASA,CAAAA,CAAG,OACd,CAAA,CACJ,CAAA,CACA,EAAA,CAAIF,CAAAA,CAAQ,EAAA,CACZ,OAAA,CAASA,CAAAA,CAAQ,OACnB,CAAA,CAAA,CCpBF,kDAA6C,MAI7C,SAAsBG,EAAAA,CAAoB,CACxC,YAAA,CAAAR,CAAAA,CACA,GAAGS,CACL,CAAA,CAEG,CACD,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,iCAAAA,CAAkB,CAAA,CAQrC,MAAA,CANyB,MAAMX,CAAAA,CAAa,YAAA,CAAa,CACvD,OAAA,CAASU,CAAAA,CAAO,GAAA,CAAI,KAAA,CACpB,GAAA,CAAKE,eAAAA,CACL,YAAA,CAAc,gBAChB,CAAC,CAAA,CAAA,CAEuB,CAAC,CAC3B,CCrBA,sDAa0C,gEAEd,sEACG,SAGtBC,CAAAA,CAAWC,CAAAA,CAAmB,CACrC,OAAOA,CAAAA,CAAI,IAAA,CAAMC,CAAAA,EAAkB,CACjC,IAAMC,CAAAA,CAAID,CAAAA,CAKV,OACEC,CAAAA,CAAE,IAAA,GAAS,gBAAA,EACXA,CAAAA,CAAE,IAAA,GAAS,WAAA,EACVA,CAAAA,CAAE,IAAA,GAAS,aAAA,kBAAiBA,CAAAA,qBAAE,MAAA,4BAAA,CAAS,CAAC,CAAA,6BAAG,MAAA,GAAS,gBAEzD,CAAC,CACH,CAKA,MAAA,SAAeC,CAAAA,CAAQ,CACrB,eAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CACA,YAAA,CAAAnB,CACF,CAAA,CAIG,CACD,IAAMoB,CAAAA,CAAM,CAAA,sEAAA,EAAyEF,CAAe,CAAA,QAAA,EAAWG,mBAAAA,CAAU,OAAA,CAAQ,OAAA,CAAQ,SAAS,CAAA,SAAA,EAAYF,CAAO,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/actions/exports.cjs","sourcesContent":[null,"import { type Address, formatEther, type PublicClient } from \"viem\";\n\nimport { metaMorphoV11Abi as metaMorphoAbi } from \"@berachain/abis/bend-metamorpho/metaMorphoV11\";\n\ninterface GetMaxDepositProps {\n vaultAddress: Address;\n publicClient: PublicClient;\n}\n\nexport async function getMaxDeposit({\n vaultAddress,\n publicClient,\n}: GetMaxDepositProps): Promise<string> {\n const maxDeposit = await publicClient.readContract({\n address: vaultAddress,\n abi: metaMorphoAbi,\n functionName: \"maxDeposit\",\n args: [vaultAddress],\n });\n return formatEther(maxDeposit);\n}\n","import {\n type MinimalToken,\n mapPoolType,\n type PoolState,\n} from \"@berachain-foundation/berancer-sdk\";\nimport type { Address } from \"viem\";\n\nimport type { MinimalPoolFragment } from \"@berachain/graphql/dex/api\";\n\nexport const getPoolState = (apiPool: MinimalPoolFragment): PoolState => {\n return {\n type: mapPoolType(apiPool.type),\n protocolVersion: apiPool.protocolVersion as 1 | 2 | 3,\n tokens: apiPool.tokens.map<MinimalToken>(\n (pt) =>\n ({\n ...pt,\n address: pt.address as Address,\n }) satisfies MinimalToken,\n ),\n id: apiPool.id as Address,\n address: apiPool.address as Address,\n } satisfies PoolState;\n};\n","import type { PublicClient } from \"viem\";\n\nimport { vaultAbi as balancerVaultAbi } from \"@berachain/abis/bex/vault\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport async function getVaultPausedState({\n publicClient,\n ...args\n}: BeraJS.BaseFunctionArgs & {\n publicClient: PublicClient;\n}) {\n const { config } = parseBaseArgs(args);\n\n const vaultPausedState = await publicClient.readContract({\n address: config.bex.vault,\n abi: balancerVaultAbi,\n functionName: \"getPausedState\",\n });\n\n return vaultPausedState[0];\n}\n","import {\n type Abi,\n type AbiFunction,\n type AbiItem,\n type Address,\n decodeFunctionData,\n erc20Abi,\n type PublicClient,\n pad,\n toFunctionSignature,\n trim,\n} from \"viem\";\n\nimport { appConfig, defaultChainId } from \"@berachain/config/internal\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\n// Function to check if ABI contains proxy-related functions\nfunction isProxyABI(abi: Abi): boolean {\n return abi.some((item: AbiItem) => {\n const i = item as {\n name?: string;\n type: string;\n inputs?: readonly { name?: string }[];\n };\n return (\n i.name === \"implementation\" ||\n i.name === \"proxyType\" ||\n (i.type === \"constructor\" && i.inputs?.[0]?.name === \"implementation\")\n );\n });\n}\n\n/**\n * {@link https://docs.berascan.com/api-endpoints/contracts}\n */\nasync function _getAbi({\n contractAddress,\n chainId,\n publicClient,\n}: {\n contractAddress: Address;\n chainId: number;\n publicClient: PublicClient;\n}) {\n const url = `https://api.etherscan.io/v2/api?module=contract&action=getabi&address=${contractAddress}&apikey=${appConfig.apiKeys.private.etherscan}&chainId=${chainId}`;\n\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch ABI: ${response.statusText}`);\n }\n\n const data = await response.json();\n if (data.status === \"0\") throw new Error(data.result);\n\n const abi = JSON.parse(data.result);\n if (!isProxyABI(abi)) return abi;\n\n const implementationResult = await publicClient.getStorageAt({\n address: contractAddress,\n // bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)).\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n // if implementation is not set, it might be a beacon proxy\n if (!implementationResult || trim(implementationResult) === \"0x00\")\n return abi;\n // storage slot has 32 byes (64 characters) but an address only has 20 bytes (40 characters)\n const implementationAddress = pad(trim(implementationResult), { size: 20 });\n return _getAbi({\n contractAddress: implementationAddress as `0x${string}`,\n chainId,\n publicClient,\n });\n}\n\nasync function _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n}: {\n address: Address;\n callData: `0x${string}`;\n knownAbi: AbiItem[];\n chainId: number;\n publicClient: PublicClient;\n}) {\n try {\n if (decodeFunctionData({ data: callData, abi: knownAbi })) {\n return knownAbi;\n }\n } catch {}\n\n return _getAbi({ contractAddress: address, chainId, publicClient }).catch(\n () => undefined,\n );\n}\n\nfunction _decodeCallData(callData: `0x${string}`, abi: AbiItem[]) {\n try {\n return decodeFunctionData({ data: callData, abi });\n } catch {\n return undefined;\n }\n}\n\nfunction _findAbiItem(abi: AbiItem[], functionName: string) {\n return abi.find(\n (a: AbiItem) => a.type === \"function\" && a.name === functionName,\n ) as AbiFunction | undefined;\n}\n\nfunction _getFunctionSignature(abiItem: AbiFunction | undefined) {\n if (!abiItem) return;\n try {\n return toFunctionSignature(abiItem);\n } catch (error) {\n console.error(error);\n }\n}\n\nexport interface GetDecodedFunctionDataArgs {\n /** Contract address that emitted the calldata */\n address: Address;\n /** Raw calldata to decode */\n callData: `0x${string}`;\n /** @default defaultChainId */\n chainId?: number;\n publicClient: PublicClient;\n}\n\n/**\n * Decodes the function data from a given contract address and calldata.\n *\n * Attempts to decode using a known set of ABIs first, then falls back to\n * fetching the ABI from the block-explorer API.\n *\n * @returns An object with the decoded ABI item, function signature, function name, and arguments.\n */\nexport async function getDecodedFunctionData({\n address,\n callData,\n chainId = defaultChainId,\n publicClient,\n}: GetDecodedFunctionDataArgs) {\n const knownAbi = [...beraChefAbi, ...rewardVaultAbi, ...erc20Abi];\n\n const abi = await _getAbiForCallData({\n address,\n callData,\n knownAbi,\n chainId,\n publicClient,\n });\n\n const decodedData = _decodeCallData(callData, abi);\n\n if (!abi || !decodedData) {\n return { args: [] };\n }\n\n const abiItem = _findAbiItem(abi, decodedData.functionName);\n\n const functionSignature = _getFunctionSignature(abiItem);\n\n return {\n abiItem,\n functionSignature,\n functionName: decodedData.functionName,\n args: decodedData.args as unknown[],\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
2
|
-
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
1
|
+
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-Cql_D50j.cjs';
|
|
2
|
+
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-Cql_D50j.cjs';
|
|
3
3
|
import { Address, PublicClient, AbiParameter, AbiFunction, TransactionReceipt, Abi, ContractFunctionArgs, ContractFunctionName, WalletCallReceipt } from 'viem';
|
|
4
4
|
import { ApolloClient, OperationVariables, FetchPolicy } from '@apollo/client';
|
|
5
5
|
export { gql } from '@apollo/client';
|
|
@@ -9,9 +9,9 @@ export { BalancerApi } from '@berachain-foundation/berancer-sdk';
|
|
|
9
9
|
import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
|
|
10
10
|
import { GetPoolsQueryVariables, GetGlobalLiquidityAndSwapVolumeQuery, GetPoolEventsQuery, GqlChain, PoolHistoricalDataFragment, MinimalPoolFragment } from '@berachain/graphql/dex/api';
|
|
11
11
|
import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment, ApiValidatorRewardAllocationWeightFragment, ApiMinimalVaultIncentiveFragment } from '@berachain/graphql/pol/api';
|
|
12
|
-
import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-
|
|
12
|
+
import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N.cjs';
|
|
13
13
|
import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
|
|
14
|
-
import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-
|
|
14
|
+
import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-B7IeayVX.cjs';
|
|
15
15
|
import graymatter from 'gray-matter';
|
|
16
16
|
import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
|
|
17
17
|
import { b as Token, P as PythLatestUpdates, a as TokenWithMetadata, T as TokenWithOrder, h as PythPriceFeedMap, i as TokenCurrentPriceMap, A as AllowanceQueryItem, j as AllowanceToken, M as MinimalERC20, B as BalanceToken } from '../HoneyConfigProvider-DfkjmzEf.cjs';
|
|
@@ -20,7 +20,7 @@ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
|
|
|
20
20
|
import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
|
|
21
21
|
import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
|
|
22
22
|
import { I as IHoneySwapState } from '../useHoneySwapState-D6vpv19r.cjs';
|
|
23
|
-
import { Address as Address$1 } from '@berachain/config';
|
|
23
|
+
import { Address as Address$1, ChainId } from '@berachain/config';
|
|
24
24
|
import { Config } from '@wagmi/core';
|
|
25
25
|
import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
|
|
26
26
|
import '@berachain/config/internal';
|
|
@@ -548,58 +548,82 @@ declare function getVaultPausedState({ publicClient, ...args }: BeraJS.BaseFunct
|
|
|
548
548
|
|
|
549
549
|
type CheckProposalFieldResultMinimal = ProposalErrorCodes | null;
|
|
550
550
|
type CheckProposalFieldResult = ProposalErrorCodes | null | CheckProposalFieldResultMinimal[] | Record<string, CheckProposalFieldResultMinimal>;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
551
|
+
/**
|
|
552
|
+
* Validates a single proposal field or ABI-typed value.
|
|
553
|
+
* Returns `null` if valid, or a `ProposalErrorCodes` value describing the problem.
|
|
554
|
+
*/
|
|
555
|
+
declare function checkProposalField(arg: {
|
|
556
|
+
fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
|
|
557
|
+
value: unknown;
|
|
558
|
+
required?: boolean;
|
|
559
|
+
baseUrl?: string;
|
|
560
|
+
components?: readonly (AbiParameter | readonly AbiParameter[])[];
|
|
561
|
+
}): CheckProposalFieldResultMinimal;
|
|
562
|
+
/**
|
|
563
|
+
* For tuple/tuple[] types, may return nested error structures.
|
|
564
|
+
*/
|
|
565
|
+
declare function checkProposalField(arg: {
|
|
566
|
+
fieldOrType: "tuple[]" | "tuple";
|
|
567
|
+
value: unknown;
|
|
568
|
+
required?: boolean;
|
|
569
|
+
baseUrl?: string;
|
|
570
|
+
components?: readonly (AbiParameter | readonly AbiParameter[])[];
|
|
571
|
+
}): CheckProposalFieldResult;
|
|
568
572
|
|
|
569
573
|
declare const MOCKED_PROPOSAL_STATUSES: readonly ProposalStatus[];
|
|
570
|
-
declare function computeActualStatus(proposal: ProposalSelectionFragment,
|
|
571
574
|
/**
|
|
572
|
-
*
|
|
575
|
+
* Derives the effective `ProposalStatus` by reconciling subgraph data with the
|
|
576
|
+
* on-chain contract state. Falls back to subgraph timestamps when the on-chain
|
|
577
|
+
* state is unavailable.
|
|
573
578
|
*/
|
|
579
|
+
declare function computeActualStatus(
|
|
580
|
+
/** Subgraph proposal data */
|
|
581
|
+
proposal: ProposalSelectionFragment,
|
|
582
|
+
/** Value returned by the `state` function of the governance contract */
|
|
574
583
|
proposalOnChainState?: ProposalState): ProposalStatus;
|
|
575
584
|
|
|
576
|
-
|
|
577
|
-
|
|
585
|
+
type GetAllProposalsArgs = BeraJS.BaseFunctionArgs & {
|
|
586
|
+
/** Subgraph filter applied to the proposals query */
|
|
578
587
|
where: Proposal_Filter;
|
|
588
|
+
/** Number of proposals to skip (for pagination) */
|
|
589
|
+
offset?: number;
|
|
590
|
+
/** Maximum proposals per page; must be ≤ 1000 */
|
|
579
591
|
perPage?: number;
|
|
580
592
|
orderBy?: Proposal_OrderBy;
|
|
581
593
|
orderDirection?: OrderDirection;
|
|
594
|
+
/** Full-text search query; switches to the search endpoint when provided */
|
|
582
595
|
text?: string;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
declare
|
|
596
|
+
};
|
|
597
|
+
/** Fetches a paginated list of governance proposals from the subgraph */
|
|
598
|
+
declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: GetAllProposalsArgs): Promise<ProposalSelectionFragment[] | undefined>;
|
|
599
|
+
|
|
600
|
+
interface GetBodyErrorsArgs {
|
|
601
|
+
/** The proposal to validate */
|
|
602
|
+
proposal: CustomProposal;
|
|
603
|
+
/** The current governance topic, used for forum link base URL validation */
|
|
604
|
+
currentTopic: GovernanceTopic;
|
|
605
|
+
}
|
|
606
|
+
/** Validates the body fields (title, description, forum link) of a proposal */
|
|
607
|
+
declare function getBodyErrors({ proposal, currentTopic, }: GetBodyErrorsArgs): CustomProposalErrors;
|
|
586
608
|
|
|
609
|
+
interface GetDecodedFunctionDataArgs {
|
|
610
|
+
/** Contract address that emitted the calldata */
|
|
611
|
+
address: Address;
|
|
612
|
+
/** Raw calldata to decode */
|
|
613
|
+
callData: `0x${string}`;
|
|
614
|
+
/** @default defaultChainId */
|
|
615
|
+
chainId?: number;
|
|
616
|
+
publicClient: PublicClient;
|
|
617
|
+
}
|
|
587
618
|
/**
|
|
588
619
|
* Decodes the function data from a given contract address and calldata.
|
|
589
620
|
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
621
|
+
* Attempts to decode using a known set of ABIs first, then falls back to
|
|
622
|
+
* fetching the ABI from the block-explorer API.
|
|
592
623
|
*
|
|
593
|
-
* @
|
|
594
|
-
* @param callData - The calldata to decode, in hexadecimal format.
|
|
595
|
-
* @returns An object containing the decoded ABI item, function signature, function name, and arguments.
|
|
624
|
+
* @returns An object with the decoded ABI item, function signature, function name, and arguments.
|
|
596
625
|
*/
|
|
597
|
-
declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: {
|
|
598
|
-
address: Address;
|
|
599
|
-
callData: `0x${string}`;
|
|
600
|
-
chainId?: number;
|
|
601
|
-
publicClient: PublicClient;
|
|
602
|
-
}): Promise<{
|
|
626
|
+
declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: GetDecodedFunctionDataArgs): Promise<{
|
|
603
627
|
args: never[];
|
|
604
628
|
abiItem?: undefined;
|
|
605
629
|
functionSignature?: undefined;
|
|
@@ -611,28 +635,49 @@ declare function getDecodedFunctionData({ address, callData, chainId, publicClie
|
|
|
611
635
|
args: unknown[];
|
|
612
636
|
}>;
|
|
613
637
|
|
|
614
|
-
|
|
638
|
+
type GetProposalDetailsArgs = BeraJS.BaseFunctionArgs & {
|
|
639
|
+
/** On-chain proposal ID */
|
|
615
640
|
proposalId: string;
|
|
616
641
|
client?: PublicClient;
|
|
617
|
-
}
|
|
642
|
+
};
|
|
643
|
+
/** Fetches a single proposal with its vote data from the subgraph */
|
|
644
|
+
declare function getProposalDetails({ proposalId, ...args }: GetProposalDetailsArgs): Promise<ProposalWithVotesFragment | undefined>;
|
|
618
645
|
|
|
619
|
-
|
|
646
|
+
type GetProposalFromTxArgs = {
|
|
647
|
+
/** Viem public client used to fetch block and receipt data */
|
|
620
648
|
publicClient: PublicClient | undefined;
|
|
621
649
|
} & ({
|
|
650
|
+
/** Pre-fetched transaction receipt */
|
|
622
651
|
tx: TransactionReceipt;
|
|
623
652
|
} | {
|
|
653
|
+
/** Transaction hash to look up */
|
|
624
654
|
txHash: Address;
|
|
625
|
-
})
|
|
655
|
+
});
|
|
656
|
+
/**
|
|
657
|
+
* Reconstructs a `ProposalWithVotesFragment` from the `ProposalCreated` event
|
|
658
|
+
* emitted in a given transaction. Returns `null` if the event is not found.
|
|
659
|
+
*/
|
|
660
|
+
declare function getProposalFromTx(args: GetProposalFromTxArgs): Promise<ProposalWithVotesFragment | null>;
|
|
626
661
|
|
|
627
|
-
|
|
662
|
+
type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {
|
|
663
|
+
/** GraphQL variables forwarded to the GetProposalVotes query */
|
|
628
664
|
variables: GetProposalVotesQueryVariables;
|
|
629
|
-
}
|
|
665
|
+
};
|
|
666
|
+
/** Fetches the votes for a proposal from the subgraph */
|
|
667
|
+
declare function getProposalVotes({ variables, ...args }: GetProposalVotesArgs): Promise<{
|
|
630
668
|
data: GetProposalVotesQuery;
|
|
631
669
|
}>;
|
|
632
670
|
|
|
633
|
-
|
|
671
|
+
type ParseProposalBodyResult = graymatter.GrayMatterFile<string> & {
|
|
672
|
+
/** Whether the body uses YAML front-matter (true) or legacy heading format (false) */
|
|
634
673
|
isFrontMatter: boolean;
|
|
635
674
|
};
|
|
675
|
+
/**
|
|
676
|
+
* Parses the body of a governance proposal into structured front-matter and content.
|
|
677
|
+
* Supports YAML front-matter format and a legacy heading-based format.
|
|
678
|
+
* Falls back to raw description on parse failure.
|
|
679
|
+
*/
|
|
680
|
+
declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "description">): ParseProposalBodyResult;
|
|
636
681
|
|
|
637
682
|
declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
|
|
638
683
|
days: number;
|
|
@@ -976,9 +1021,9 @@ declare function getAllowances({ items: itemsList, account, config, }: GetAllowa
|
|
|
976
1021
|
interface GetTokenInformation {
|
|
977
1022
|
address: Address;
|
|
978
1023
|
publicClient: PublicClient;
|
|
979
|
-
chainId:
|
|
1024
|
+
chainId: ChainId;
|
|
980
1025
|
}
|
|
981
|
-
type GetTokenInformationResponse = MinimalERC20
|
|
1026
|
+
type GetTokenInformationResponse = MinimalERC20;
|
|
982
1027
|
declare function getTokenInformation({ address, publicClient, chainId, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
|
|
983
1028
|
|
|
984
1029
|
declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
|
|
@@ -1596,4 +1641,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
|
|
|
1596
1641
|
bgtPrice: number;
|
|
1597
1642
|
}): number;
|
|
1598
1643
|
|
|
1599
|
-
export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllowances, type GetAllowancesResponse, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
|
|
1644
|
+
export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllProposalsArgs, type GetAllowances, type GetAllowancesResponse, type GetBodyErrorsArgs, type GetDecodedFunctionDataArgs, type GetLSTStakeConfigArgs, type GetProposalDetailsArgs, type GetProposalFromTxArgs, type GetProposalVotesArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type ParseProposalBodyResult, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
2
|
-
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-
|
|
1
|
+
import { V as ValidatorRewardAllocation } from '../getValidatorQueuedOperatorAddress-BcyxE9uw.js';
|
|
2
|
+
export { B as BaseAggregator, G as GetBgtAprSimulationArgs, a as GetBgtAprSimulationResult, b as GetConvertToAssetsProps, c as GetGaugeData, d as GetHoneyVaultsBalanceResponse, e as GetMarkets, f as GetRewardVaultRewardsReturn, g as GetUserVaultsResponse, h as GetVaultHistoryArgs, i as GlobalData, I as IsBadCollateralArgs, j as IsBadCollateralResponse, O as OnChainPool, P as PoolStatus, R as RewardVaultDistributionMode, k as RewardVaultIncentive, S as StakedBeraWithdrawal, U as UserBoostsOnValidator, l as UserStakingPoolPosition, m as UserVault, n as ValidatorQueuedCommission, o as ValidatorQueuedOperatorAddress, p as ValidatorRewardAllocationRaw, q as ValidatorRewardAllocationUpdate, r as ValidatorRewardAllocationUpdateWithExpiration, s as ValidatorWithUserBoost, t as VaultMetadata, u as formatValidatorRewardAllocation, v as getBgtAprSimulation, w as getConvertToAssets, x as getGlobalData, y as getHoneyVaultsBalance, z as getMarkets, A as getOnChainPool, C as getPoolPausedState, D as getRewardVaultIncentives, E as getRewardVaultRewards, F as getRewardVaults, H as getSWBeraVaultMetadata, J as getSWBeraWithdrawal, K as getUserActiveValidators, L as getUserBoostsOnValidator, M as getUserStakingPositions, N as getUserVaults, Q as getValidatorQueuedCommission, T as getValidatorQueuedOperatorAddress, W as getValidatorRewardAllocation, X as getVaultHistory, Y as isBadCollateralAsset, Z as isSameRewardAllocation } from '../getValidatorQueuedOperatorAddress-BcyxE9uw.js';
|
|
3
3
|
import { Address, PublicClient, AbiParameter, AbiFunction, TransactionReceipt, Abi, ContractFunctionArgs, ContractFunctionName, WalletCallReceipt } from 'viem';
|
|
4
4
|
import { ApolloClient, OperationVariables, FetchPolicy } from '@apollo/client';
|
|
5
5
|
export { gql } from '@apollo/client';
|
|
@@ -9,9 +9,9 @@ export { BalancerApi } from '@berachain-foundation/berancer-sdk';
|
|
|
9
9
|
import * as _berachain_graphql_dex_api from '@berachain/graphql/dex/api';
|
|
10
10
|
import { GetPoolsQueryVariables, GetGlobalLiquidityAndSwapVolumeQuery, GetPoolEventsQuery, GqlChain, PoolHistoricalDataFragment, MinimalPoolFragment } from '@berachain/graphql/dex/api';
|
|
11
11
|
import { GqlPoolEventType, GqlChain as GqlChain$1, ApiVaultFragment, GqlVaultSnapshotDataRange, GetSWberaVaultSnapshotsQuery, ApiValidatorFragment, GetValidatorsQueryVariables, GetValidatorsQuery, ApiRewardAllocationWeightFragment, GetValidatorQuery, ApiValidatorMinimalFragment, ApiValidatorRewardAllocationWeightFragment, ApiMinimalVaultIncentiveFragment } from '@berachain/graphql/pol/api';
|
|
12
|
-
import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-
|
|
12
|
+
import { P as ProposalErrorCodes, a as ProposalState } from '../txnEnum-7_o92X3N.js';
|
|
13
13
|
import { ProposalStatus, ProposalSelectionFragment, Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalWithVotesFragment, GetProposalVotesQueryVariables, GetProposalVotesQuery } from '@berachain/graphql/governance';
|
|
14
|
-
import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-
|
|
14
|
+
import { C as CustomProposal, G as GovernanceTopic, a as CustomProposalErrors, S as StakingConfig, B as BribeBoostRewardProof, b as BribeBoostRewardItem, U as UserVaultInfo, I as IContractWrite } from '../global.d-5w_lvl2J.js';
|
|
15
15
|
import graymatter from 'gray-matter';
|
|
16
16
|
import { GetChartDataQuery, GetGlobalDataQuery } from '@berachain/graphql/honey';
|
|
17
17
|
import { b as Token, P as PythLatestUpdates, a as TokenWithMetadata, T as TokenWithOrder, h as PythPriceFeedMap, i as TokenCurrentPriceMap, A as AllowanceQueryItem, j as AllowanceToken, M as MinimalERC20, B as BalanceToken } from '../HoneyConfigProvider-DVP_9KZn.js';
|
|
@@ -20,7 +20,7 @@ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
|
|
|
20
20
|
import { honeyFactoryAbi } from '@berachain/abis/honey/honeyFactory';
|
|
21
21
|
import { honeyFactoryPythWrapperAbi } from '@berachain/abis/honey/honeyFactoryPythWrapper';
|
|
22
22
|
import { I as IHoneySwapState } from '../useHoneySwapState-B494PQDl.js';
|
|
23
|
-
import { Address as Address$1 } from '@berachain/config';
|
|
23
|
+
import { Address as Address$1, ChainId } from '@berachain/config';
|
|
24
24
|
import { Config } from '@wagmi/core';
|
|
25
25
|
import { GetValidatorBlockStatsQuery, GetValidatorAnalyticsQuery } from '@berachain/graphql/pol/subgraph';
|
|
26
26
|
import '@berachain/config/internal';
|
|
@@ -548,58 +548,82 @@ declare function getVaultPausedState({ publicClient, ...args }: BeraJS.BaseFunct
|
|
|
548
548
|
|
|
549
549
|
type CheckProposalFieldResultMinimal = ProposalErrorCodes | null;
|
|
550
550
|
type CheckProposalFieldResult = ProposalErrorCodes | null | CheckProposalFieldResultMinimal[] | Record<string, CheckProposalFieldResultMinimal>;
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
551
|
+
/**
|
|
552
|
+
* Validates a single proposal field or ABI-typed value.
|
|
553
|
+
* Returns `null` if valid, or a `ProposalErrorCodes` value describing the problem.
|
|
554
|
+
*/
|
|
555
|
+
declare function checkProposalField(arg: {
|
|
556
|
+
fieldOrType: "address" | "hex" | "abi" | "string" | "bool" | `uint${string}` | `int${string}` | "action" | "title" | "forumLink" | "description" | "logoURI" | "url";
|
|
557
|
+
value: unknown;
|
|
558
|
+
required?: boolean;
|
|
559
|
+
baseUrl?: string;
|
|
560
|
+
components?: readonly (AbiParameter | readonly AbiParameter[])[];
|
|
561
|
+
}): CheckProposalFieldResultMinimal;
|
|
562
|
+
/**
|
|
563
|
+
* For tuple/tuple[] types, may return nested error structures.
|
|
564
|
+
*/
|
|
565
|
+
declare function checkProposalField(arg: {
|
|
566
|
+
fieldOrType: "tuple[]" | "tuple";
|
|
567
|
+
value: unknown;
|
|
568
|
+
required?: boolean;
|
|
569
|
+
baseUrl?: string;
|
|
570
|
+
components?: readonly (AbiParameter | readonly AbiParameter[])[];
|
|
571
|
+
}): CheckProposalFieldResult;
|
|
568
572
|
|
|
569
573
|
declare const MOCKED_PROPOSAL_STATUSES: readonly ProposalStatus[];
|
|
570
|
-
declare function computeActualStatus(proposal: ProposalSelectionFragment,
|
|
571
574
|
/**
|
|
572
|
-
*
|
|
575
|
+
* Derives the effective `ProposalStatus` by reconciling subgraph data with the
|
|
576
|
+
* on-chain contract state. Falls back to subgraph timestamps when the on-chain
|
|
577
|
+
* state is unavailable.
|
|
573
578
|
*/
|
|
579
|
+
declare function computeActualStatus(
|
|
580
|
+
/** Subgraph proposal data */
|
|
581
|
+
proposal: ProposalSelectionFragment,
|
|
582
|
+
/** Value returned by the `state` function of the governance contract */
|
|
574
583
|
proposalOnChainState?: ProposalState): ProposalStatus;
|
|
575
584
|
|
|
576
|
-
|
|
577
|
-
|
|
585
|
+
type GetAllProposalsArgs = BeraJS.BaseFunctionArgs & {
|
|
586
|
+
/** Subgraph filter applied to the proposals query */
|
|
578
587
|
where: Proposal_Filter;
|
|
588
|
+
/** Number of proposals to skip (for pagination) */
|
|
589
|
+
offset?: number;
|
|
590
|
+
/** Maximum proposals per page; must be ≤ 1000 */
|
|
579
591
|
perPage?: number;
|
|
580
592
|
orderBy?: Proposal_OrderBy;
|
|
581
593
|
orderDirection?: OrderDirection;
|
|
594
|
+
/** Full-text search query; switches to the search endpoint when provided */
|
|
582
595
|
text?: string;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
declare
|
|
596
|
+
};
|
|
597
|
+
/** Fetches a paginated list of governance proposals from the subgraph */
|
|
598
|
+
declare function getAllProposals({ where, orderBy, orderDirection, offset, perPage, text, ...args }: GetAllProposalsArgs): Promise<ProposalSelectionFragment[] | undefined>;
|
|
599
|
+
|
|
600
|
+
interface GetBodyErrorsArgs {
|
|
601
|
+
/** The proposal to validate */
|
|
602
|
+
proposal: CustomProposal;
|
|
603
|
+
/** The current governance topic, used for forum link base URL validation */
|
|
604
|
+
currentTopic: GovernanceTopic;
|
|
605
|
+
}
|
|
606
|
+
/** Validates the body fields (title, description, forum link) of a proposal */
|
|
607
|
+
declare function getBodyErrors({ proposal, currentTopic, }: GetBodyErrorsArgs): CustomProposalErrors;
|
|
586
608
|
|
|
609
|
+
interface GetDecodedFunctionDataArgs {
|
|
610
|
+
/** Contract address that emitted the calldata */
|
|
611
|
+
address: Address;
|
|
612
|
+
/** Raw calldata to decode */
|
|
613
|
+
callData: `0x${string}`;
|
|
614
|
+
/** @default defaultChainId */
|
|
615
|
+
chainId?: number;
|
|
616
|
+
publicClient: PublicClient;
|
|
617
|
+
}
|
|
587
618
|
/**
|
|
588
619
|
* Decodes the function data from a given contract address and calldata.
|
|
589
620
|
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
621
|
+
* Attempts to decode using a known set of ABIs first, then falls back to
|
|
622
|
+
* fetching the ABI from the block-explorer API.
|
|
592
623
|
*
|
|
593
|
-
* @
|
|
594
|
-
* @param callData - The calldata to decode, in hexadecimal format.
|
|
595
|
-
* @returns An object containing the decoded ABI item, function signature, function name, and arguments.
|
|
624
|
+
* @returns An object with the decoded ABI item, function signature, function name, and arguments.
|
|
596
625
|
*/
|
|
597
|
-
declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: {
|
|
598
|
-
address: Address;
|
|
599
|
-
callData: `0x${string}`;
|
|
600
|
-
chainId?: number;
|
|
601
|
-
publicClient: PublicClient;
|
|
602
|
-
}): Promise<{
|
|
626
|
+
declare function getDecodedFunctionData({ address, callData, chainId, publicClient, }: GetDecodedFunctionDataArgs): Promise<{
|
|
603
627
|
args: never[];
|
|
604
628
|
abiItem?: undefined;
|
|
605
629
|
functionSignature?: undefined;
|
|
@@ -611,28 +635,49 @@ declare function getDecodedFunctionData({ address, callData, chainId, publicClie
|
|
|
611
635
|
args: unknown[];
|
|
612
636
|
}>;
|
|
613
637
|
|
|
614
|
-
|
|
638
|
+
type GetProposalDetailsArgs = BeraJS.BaseFunctionArgs & {
|
|
639
|
+
/** On-chain proposal ID */
|
|
615
640
|
proposalId: string;
|
|
616
641
|
client?: PublicClient;
|
|
617
|
-
}
|
|
642
|
+
};
|
|
643
|
+
/** Fetches a single proposal with its vote data from the subgraph */
|
|
644
|
+
declare function getProposalDetails({ proposalId, ...args }: GetProposalDetailsArgs): Promise<ProposalWithVotesFragment | undefined>;
|
|
618
645
|
|
|
619
|
-
|
|
646
|
+
type GetProposalFromTxArgs = {
|
|
647
|
+
/** Viem public client used to fetch block and receipt data */
|
|
620
648
|
publicClient: PublicClient | undefined;
|
|
621
649
|
} & ({
|
|
650
|
+
/** Pre-fetched transaction receipt */
|
|
622
651
|
tx: TransactionReceipt;
|
|
623
652
|
} | {
|
|
653
|
+
/** Transaction hash to look up */
|
|
624
654
|
txHash: Address;
|
|
625
|
-
})
|
|
655
|
+
});
|
|
656
|
+
/**
|
|
657
|
+
* Reconstructs a `ProposalWithVotesFragment` from the `ProposalCreated` event
|
|
658
|
+
* emitted in a given transaction. Returns `null` if the event is not found.
|
|
659
|
+
*/
|
|
660
|
+
declare function getProposalFromTx(args: GetProposalFromTxArgs): Promise<ProposalWithVotesFragment | null>;
|
|
626
661
|
|
|
627
|
-
|
|
662
|
+
type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {
|
|
663
|
+
/** GraphQL variables forwarded to the GetProposalVotes query */
|
|
628
664
|
variables: GetProposalVotesQueryVariables;
|
|
629
|
-
}
|
|
665
|
+
};
|
|
666
|
+
/** Fetches the votes for a proposal from the subgraph */
|
|
667
|
+
declare function getProposalVotes({ variables, ...args }: GetProposalVotesArgs): Promise<{
|
|
630
668
|
data: GetProposalVotesQuery;
|
|
631
669
|
}>;
|
|
632
670
|
|
|
633
|
-
|
|
671
|
+
type ParseProposalBodyResult = graymatter.GrayMatterFile<string> & {
|
|
672
|
+
/** Whether the body uses YAML front-matter (true) or legacy heading format (false) */
|
|
634
673
|
isFrontMatter: boolean;
|
|
635
674
|
};
|
|
675
|
+
/**
|
|
676
|
+
* Parses the body of a governance proposal into structured front-matter and content.
|
|
677
|
+
* Supports YAML front-matter format and a legacy heading-based format.
|
|
678
|
+
* Falls back to raw description on parse failure.
|
|
679
|
+
*/
|
|
680
|
+
declare function parseProposalBody(proposal?: Pick<ProposalSelectionFragment, "description">): ParseProposalBodyResult;
|
|
636
681
|
|
|
637
682
|
declare function getChartData({ days, ...args }: BeraJS.BaseFunctionArgs & {
|
|
638
683
|
days: number;
|
|
@@ -976,9 +1021,9 @@ declare function getAllowances({ items: itemsList, account, config, }: GetAllowa
|
|
|
976
1021
|
interface GetTokenInformation {
|
|
977
1022
|
address: Address;
|
|
978
1023
|
publicClient: PublicClient;
|
|
979
|
-
chainId:
|
|
1024
|
+
chainId: ChainId;
|
|
980
1025
|
}
|
|
981
|
-
type GetTokenInformationResponse = MinimalERC20
|
|
1026
|
+
type GetTokenInformationResponse = MinimalERC20;
|
|
982
1027
|
declare function getTokenInformation({ address, publicClient, chainId, }: GetTokenInformation): Promise<GetTokenInformationResponse>;
|
|
983
1028
|
|
|
984
1029
|
declare function getTokens({ url, ...args }?: BeraJS.BaseFunctionArgs & {
|
|
@@ -1596,4 +1641,4 @@ declare function getValidatorBoostApy({ validator, bgtPrice, }: {
|
|
|
1596
1641
|
bgtPrice: number;
|
|
1597
1642
|
}): number;
|
|
1598
1643
|
|
|
1599
|
-
export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllowances, type GetAllowancesResponse, type GetLSTStakeConfigArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
|
|
1644
|
+
export { type ActiveBoostAndCommissionChangeDelay, BeraApolloClient, type GetAllProposalsArgs, type GetAllowances, type GetAllowancesResponse, type GetBodyErrorsArgs, type GetDecodedFunctionDataArgs, type GetLSTStakeConfigArgs, type GetProposalDetailsArgs, type GetProposalFromTxArgs, type GetProposalVotesArgs, type GetStakedBeraSnapshotsArgs, type GetTokenInformation, type GetTokenInformationResponse, type GetUserVaultInfoParams, type GetUserVaultsInfo, type GetWalletBalances, MOCKED_PROPOSAL_STATUSES, type ParseProposalBodyResult, type PoolDayData, PythLatestUpdates, type RewardVaultDurationConstants, ValidatorRewardAllocation, aggregateValidatorIncentives, beraWriteContract, checkProposalField, computeActualStatus, getActiveBoostAndCommissionChangeDelay, getAllPools, getAllProposals, getAllValidators, getAllowances, getApiEnrichedAllocation, getApiPool, getApiValidator, getApolloClient, getBalanceCall, getBlockTime, getBlockTimestamp, getBodyErrors, getChartData, getCollateralWeights, getDailyValidatorBlockStats, getDecodedFunctionData, getDefaultRewardAllocation, getEarnedStakedBeraVault, getEnsoClient, getGlobalCapLimit, getGlobalLiquidityAndSwapVolume, getHoneyCollaterals, getHoneyGlobalData, getHoneyPausedState, getHoneyPythFeeds, getHoneyPythOracle, getHoneyRootPriceOracle, getIncentiveFeeClaimStats, getLSTStakeConfig, getMaxDeposit, getPoolEvents, getPoolHistoricalData, getPoolState, getProposalDetails, getProposalFromTx, getProposalVotes, getPythUpdateFee, getRelativeCapLimit, getRewardProofsByValidator, getRewardTokenToBeraRate, getRewardVault, getRewardVaultDurationConstants, getRewardVaultFromToken, getRewardVaultStakingToken, getStakeWithdrawalCooldown, getStakedBeraAPR, getStakedBeraSnapshots, getStakingPoolBatch, getSwapPayload, getTokenCurrentPrices, getTokenInformation, getTokens, getTotalStakedAmount, getUserClaimableIncentives, getUserVaultInfo, getUserVaultsReward, getValidatorAnalytics, getValidatorBoostApy, getValidatorCommission, getValidatorEstimatedBgtPerYear, getValidatorOperatorAddress, getValidatorQueuedRewardAllocation, getValidatorReturnPerBgt, getVaultPausedState, getVaultValidators, getWalletBalances, isBasketModeEnabled, isDefaultRewardAllocation, isImpersonateAccount, parseProposalBody };
|