@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.
Files changed (144) hide show
  1. package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.cts} +31 -2
  2. package/dist/{BeraError-_mQdkanr.d.ts → BeraError-7-A5JYy_.d.ts} +31 -2
  3. package/dist/{RequestError-DSUzJ1Iy.d.cts → RequestError-02juqN-5.d.cts} +1 -1
  4. package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
  5. package/dist/abi/exports.cjs.map +1 -1
  6. package/dist/abi/exports.mjs +1 -1
  7. package/dist/actions/exports.cjs +1 -1
  8. package/dist/actions/exports.cjs.map +1 -1
  9. package/dist/actions/exports.d.cts +2 -2
  10. package/dist/actions/exports.d.ts +2 -2
  11. package/dist/actions/exports.mjs +1 -1
  12. package/dist/actions/governance/exports.cjs +1 -1
  13. package/dist/actions/governance/exports.cjs.map +1 -1
  14. package/dist/actions/governance/exports.mjs +1 -1
  15. package/dist/chunk-2A347ZVN.mjs +2 -0
  16. package/dist/{chunk-NXXMW2O7.mjs.map → chunk-2A347ZVN.mjs.map} +1 -1
  17. package/dist/{chunk-WLJHFHKF.mjs → chunk-2VO2D4QO.mjs} +2 -2
  18. package/dist/chunk-5FVW5XU3.mjs +2 -0
  19. package/dist/chunk-5FVW5XU3.mjs.map +1 -0
  20. package/dist/{chunk-GXV2JA36.mjs → chunk-5SIQ7BKT.mjs} +2 -2
  21. package/dist/chunk-5SIQ7BKT.mjs.map +1 -0
  22. package/dist/{chunk-ENT2OSXT.mjs → chunk-5XOEJ6XX.mjs} +2 -2
  23. package/dist/{chunk-ZW2N63FI.mjs → chunk-A5BNPBXN.mjs} +2 -2
  24. package/dist/{chunk-4TALWNXE.cjs → chunk-COSP3YIF.cjs} +2 -2
  25. package/dist/chunk-COSP3YIF.cjs.map +1 -0
  26. package/dist/chunk-D6L7LTA2.cjs.map +1 -1
  27. package/dist/{chunk-JXM5S4IU.mjs → chunk-DA7GK43B.mjs} +2 -2
  28. package/dist/chunk-DDEQFR3M.cjs.map +1 -1
  29. package/dist/{chunk-6JJIZCVY.cjs → chunk-DKZGCMH4.cjs} +2 -2
  30. package/dist/chunk-DKZGCMH4.cjs.map +1 -0
  31. package/dist/{chunk-Y2FETC6T.cjs → chunk-F4V5B6F7.cjs} +2 -2
  32. package/dist/chunk-F4V5B6F7.cjs.map +1 -0
  33. package/dist/{chunk-QVIAMSZ6.cjs → chunk-FDEUAXET.cjs} +2 -2
  34. package/dist/chunk-FDEUAXET.cjs.map +1 -0
  35. package/dist/{chunk-33XNWMPP.cjs → chunk-FQSOUEIJ.cjs} +2 -2
  36. package/dist/chunk-FQSOUEIJ.cjs.map +1 -0
  37. package/dist/{chunk-XZC34BHM.cjs → chunk-GEIY554A.cjs} +2 -2
  38. package/dist/chunk-GEIY554A.cjs.map +1 -0
  39. package/dist/{chunk-KUQEX7H3.mjs → chunk-JHUVLM54.mjs} +2 -2
  40. package/dist/{chunk-RCWM55DE.cjs → chunk-JZL5JPDJ.cjs} +2 -2
  41. package/dist/chunk-JZL5JPDJ.cjs.map +1 -0
  42. package/dist/{chunk-H6ZO4SLB.mjs → chunk-LUNZGZWN.mjs} +2 -2
  43. package/dist/{chunk-RJN36GBU.mjs → chunk-OCAMR6XC.mjs} +2 -2
  44. package/dist/chunk-OIYXOKTT.cjs.map +1 -1
  45. package/dist/chunk-OUD27MU7.cjs.map +1 -1
  46. package/dist/{chunk-JIPSTWKO.mjs → chunk-OYF32BQQ.mjs} +2 -2
  47. package/dist/{chunk-54BTOQE3.cjs → chunk-PFUVKW6F.cjs} +2 -2
  48. package/dist/chunk-PFUVKW6F.cjs.map +1 -0
  49. package/dist/{chunk-JSTCUTXP.cjs → chunk-QHCLZTCK.cjs} +2 -2
  50. package/dist/chunk-QHCLZTCK.cjs.map +1 -0
  51. package/dist/chunk-RWOICHRW.cjs.map +1 -1
  52. package/dist/{chunk-CHFETMC6.cjs → chunk-S2TNHMSV.cjs} +3 -3
  53. package/dist/chunk-S2TNHMSV.cjs.map +1 -0
  54. package/dist/chunk-S4CDSVLK.cjs.map +1 -1
  55. package/dist/{chunk-5QAFKFM5.mjs → chunk-TU63NRNL.mjs} +2 -2
  56. package/dist/{chunk-REWME3FY.cjs → chunk-W4JE2NIN.cjs} +2 -2
  57. package/dist/chunk-W4JE2NIN.cjs.map +1 -0
  58. package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
  59. package/dist/chunk-XB2SEO4Y.cjs +2 -0
  60. package/dist/chunk-XB2SEO4Y.cjs.map +1 -0
  61. package/dist/chunk-XCVDZUEF.mjs +2 -0
  62. package/dist/{chunk-K5L2B4DU.mjs.map → chunk-XCVDZUEF.mjs.map} +1 -1
  63. package/dist/chunk-XNJLSA6P.cjs.map +1 -1
  64. package/dist/chunk-YYUSCGVI.cjs +2 -0
  65. package/dist/chunk-YYUSCGVI.cjs.map +1 -0
  66. package/dist/contexts/exports.cjs +1 -1
  67. package/dist/contexts/exports.cjs.map +1 -1
  68. package/dist/contexts/exports.mjs +1 -1
  69. package/dist/enum/exports.cjs.map +1 -1
  70. package/dist/enum/governance/exports.cjs.map +1 -1
  71. package/dist/errors/exports.cjs +1 -1
  72. package/dist/errors/exports.cjs.map +1 -1
  73. package/dist/errors/exports.d.cts +4 -3
  74. package/dist/errors/exports.d.ts +4 -3
  75. package/dist/errors/exports.mjs +1 -1
  76. package/dist/{global.d-ylUk_etZ.d.ts → global.d-C4FnE4cz.d.ts} +1 -1
  77. package/dist/{global.d-B9nLZ7ul.d.cts → global.d-CicOIudf.d.cts} +1 -1
  78. package/dist/hooks/exports.cjs +2 -2
  79. package/dist/hooks/exports.cjs.map +1 -1
  80. package/dist/hooks/exports.d.cts +3 -3
  81. package/dist/hooks/exports.d.ts +3 -3
  82. package/dist/hooks/exports.mjs +2 -2
  83. package/dist/hooks/governance/exports.cjs +1 -1
  84. package/dist/hooks/governance/exports.cjs.map +1 -1
  85. package/dist/hooks/governance/exports.d.cts +2 -2
  86. package/dist/hooks/governance/exports.d.ts +2 -2
  87. package/dist/hooks/governance/exports.mjs +1 -1
  88. package/dist/types/exports.cjs.map +1 -1
  89. package/dist/types/exports.d.cts +2 -2
  90. package/dist/types/exports.d.ts +2 -2
  91. package/dist/types/governance/exports.cjs.map +1 -1
  92. package/dist/utils/exports.cjs +1 -1
  93. package/dist/utils/exports.cjs.map +1 -1
  94. package/dist/utils/exports.d.cts +13 -4
  95. package/dist/utils/exports.d.ts +13 -4
  96. package/dist/utils/exports.mjs +1 -1
  97. package/dist/utils/exports.mjs.map +1 -1
  98. package/package.json +46 -40
  99. package/src/actions/__test/transports.ts +61 -0
  100. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  101. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  102. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  103. package/src/data/contracts.ts +5 -0
  104. package/src/errors/BeraError.ts +27 -0
  105. package/src/errors/BeraTracing.unit.test.ts +65 -0
  106. package/src/errors/RequestError.ts +12 -0
  107. package/src/errors/exports.ts +5 -0
  108. package/src/errors/getRevertReason.integration.test.ts +3 -3
  109. package/src/errors/spanStatus.ts +78 -0
  110. package/src/errors/spanStatus.unit.test.ts +62 -0
  111. package/src/utils/beraFetch.ts +9 -3
  112. package/src/utils/exports.ts +1 -0
  113. package/src/utils/getServerSideClient.ts +4 -2
  114. package/src/utils/sanitizeRpcUrl.ts +22 -0
  115. package/src/utils/tracedTransport.ts +35 -0
  116. package/dist/chunk-33XNWMPP.cjs.map +0 -1
  117. package/dist/chunk-4TALWNXE.cjs.map +0 -1
  118. package/dist/chunk-54BTOQE3.cjs.map +0 -1
  119. package/dist/chunk-6DIA6PXV.cjs +0 -2
  120. package/dist/chunk-6DIA6PXV.cjs.map +0 -1
  121. package/dist/chunk-6JJIZCVY.cjs.map +0 -1
  122. package/dist/chunk-BE6B4PQF.cjs +0 -2
  123. package/dist/chunk-BE6B4PQF.cjs.map +0 -1
  124. package/dist/chunk-CHFETMC6.cjs.map +0 -1
  125. package/dist/chunk-GXV2JA36.mjs.map +0 -1
  126. package/dist/chunk-JDDRTHFG.mjs +0 -2
  127. package/dist/chunk-JDDRTHFG.mjs.map +0 -1
  128. package/dist/chunk-JSTCUTXP.cjs.map +0 -1
  129. package/dist/chunk-K5L2B4DU.mjs +0 -2
  130. package/dist/chunk-NXXMW2O7.mjs +0 -2
  131. package/dist/chunk-QVIAMSZ6.cjs.map +0 -1
  132. package/dist/chunk-RCWM55DE.cjs.map +0 -1
  133. package/dist/chunk-REWME3FY.cjs.map +0 -1
  134. package/dist/chunk-XZC34BHM.cjs.map +0 -1
  135. package/dist/chunk-Y2FETC6T.cjs.map +0 -1
  136. /package/dist/{chunk-WLJHFHKF.mjs.map → chunk-2VO2D4QO.mjs.map} +0 -0
  137. /package/dist/{chunk-ENT2OSXT.mjs.map → chunk-5XOEJ6XX.mjs.map} +0 -0
  138. /package/dist/{chunk-ZW2N63FI.mjs.map → chunk-A5BNPBXN.mjs.map} +0 -0
  139. /package/dist/{chunk-JXM5S4IU.mjs.map → chunk-DA7GK43B.mjs.map} +0 -0
  140. /package/dist/{chunk-KUQEX7H3.mjs.map → chunk-JHUVLM54.mjs.map} +0 -0
  141. /package/dist/{chunk-H6ZO4SLB.mjs.map → chunk-LUNZGZWN.mjs.map} +0 -0
  142. /package/dist/{chunk-RJN36GBU.mjs.map → chunk-OCAMR6XC.mjs.map} +0 -0
  143. /package/dist/{chunk-JIPSTWKO.mjs.map → chunk-OYF32BQQ.mjs.map} +0 -0
  144. /package/dist/{chunk-5QAFKFM5.mjs.map → chunk-TU63NRNL.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkCHFETMC6cjs = require('../../chunk-CHFETMC6.cjs');require('../../chunk-WRFDB3QJ.cjs');require('../../chunk-JSTCUTXP.cjs');require('../../chunk-XNJLSA6P.cjs');var _chunk33XNWMPPcjs = require('../../chunk-33XNWMPP.cjs');var _chunkQVIAMSZ6cjs = require('../../chunk-QVIAMSZ6.cjs');require('../../chunk-S4CDSVLK.cjs');require('../../chunk-6JJIZCVY.cjs');var _react = require('react');var _graymatter = require('gray-matter'); var _graymatter2 = _interopRequireDefault(_graymatter);var _viem = require('viem');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function R(t){return Object.values(t).some(r=>Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null?R(o):!!o):typeof r=="object"&&r!==null?R(r):!!r)}function D({proposal:t,currentTopic:r,onError:o}){let s=_chunkCHFETMC6cjs.e.call(void 0, {proposal:t,currentTopic:r}),n=[];if(s.actions=t.actions.map((e,i)=>{let l={};if(l.target=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"address",value:e.target}),e.type==="custom-action")if(e.input==="ABI")if(l.ABI=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"abi",value:e.ABI}),!e.functionSignature)l.functionSignature="Required";else try{let g=_viem.parseAbiItem.call(void 0, e.functionSignature);g.type!=="function"?(console.error("parsedSignatureAbi is not a function",g),l.functionSignature="Invalid ABI"):(l.args=g.inputs.map((y,m)=>{try{return"components"in y?_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:y.type,value:_optionalChain([e, 'access', _2 => _2.args, 'optionalAccess', _3 => _3[m]]),components:y.components}):_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:y.type,value:_optionalChain([e, 'access', _4 => _4.args, 'optionalAccess', _5 => _5[m]])})}catch (e2){return null}}),l.args.some(y=>y)||(n[i]=_viem.encodeFunctionData.call(void 0, {abi:[g],args:e.args})))}catch (e3){l.functionSignature="Invalid ABI"}else if(e.input==="rawCalldata")l.rawCalldata=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"hex",value:e.rawCalldata}),n[i]=e.rawCalldata;else if(e.input==="message")l.message=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"string",value:e.message}),n[i]=_viem.toHex.call(void 0, e.message);else throw new Error("Invalid input type");else if(e.type==="whitelist-reward-vault"||e.type==="blacklist-reward-vault"){if(l.vault=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"address",value:e.vault}),!l.vault){let g=e.type==="whitelist-reward-vault";n[i]=_viem.encodeFunctionData.call(void 0, {abi:_beraChef.beraChefAbi,functionName:"setVaultWhitelistedStatus",args:[e.vault,g,""]})}}else e.type==="whitelist-reward-vault-incentive"?(l.token=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"address",value:e.token}),l.minIncentiveRate=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"uint256",value:e.minIncentiveRate}),l.managerAddress=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"address",value:e.managerAddress}),!l.token&&!l.minIncentiveRate&&!l.managerAddress&&(n[i]=_viem.encodeFunctionData.call(void 0, {abi:_rewardVault.rewardVaultAbi,functionName:"whitelistIncentiveToken",args:[e.token,BigInt(e.minIncentiveRate),e.managerAddress]}))):e.type==="erc20-transfer"&&(l.amount=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"uint256",value:e.amount}),l.to=_chunkCHFETMC6cjs.a.call(void 0, {fieldOrType:"address",value:e.to}),!l.amount&&!l.to&&(n[i]=_viem.encodeFunctionData.call(void 0, {abi:_viem.erc20Abi,functionName:"transfer",args:[e.to,BigInt(e.amount)]})));return R(l)?l:null}),_optionalChain([o, 'optionalCall', _6 => _6(s)]),Object.getOwnPropertyNames(s).map(e=>s[e]).some(e=>Array.isArray(e)?e.filter(i=>i).length>0:e===null?!1:!!e)){console.warn("Proposal has errors",s);return}if(n.length===0)throw new Error("No actions submitted in proposal");let a=new URL(t.forumLink),u=_graymatter2.default.stringify(t.description,{title:t.title,topics:Array.from(t.topic.values()),forumLink:a.toString(),version:"1.0.0","content-encoding":"utf-8","content-type":"text/markdown",actions:t.actions.map(e=>{let i={type:e.type};return e.type==="custom-action"&&(i.inputType=e.input),i})});return[t.actions.map(e=>e.target),t.actions.map(e=>_nullishCoalesce(e.value, () => (0n))),n,u]}var W={type:"custom-action",target:"",ABI:"",value:0n,functionSignature:"",args:[],input:"ABI",rawCalldata:"0x",message:""},Z= exports.useCreateProposal =({initialData:t={},currentTopic:r,onError:o})=>{let[s,n]=_react.useState.call(void 0, {title:"",description:"",forumLink:"",actions:[W],...t,topic:new Set});_react.useEffect.call(void 0, ()=>{n(i=>({...i,topic:new Set([r.id])}))},[r]);let a=_react.useCallback.call(void 0, ()=>{n(i=>({...i,actions:[...i.actions,W]}))},[]),u=_react.useCallback.call(void 0, i=>{n(l=>{let A=[...l.actions];return A.splice(i,1),{...l,actions:A}})},[n]),e=_react.useCallback.call(void 0, ()=>s?D({proposal:s,currentTopic:r,onError:o}):void 0,[s,r]);return{proposal:s,setProposal:n,addProposalAction:a,removeProposalAction:u,computeParamsAndErrors:e}};var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _bgt = require('@berachain/abis/pol/bgt');var _hooks = require('@berachain/wagmi/hooks');var _berachainGovernance = require('@berachain/abis/gov/berachainGovernance');var N=({proposalId:t})=>{let r=_hooks.usePublicClient.call(void 0, );return _immutable2.default.call(void 0, r&&t?["useProposalSnapshot",t]:null,async([,s])=>{_chunk33XNWMPPcjs.b.call(void 0, r);let{config:n}=_chunkQVIAMSZ6cjs.a.call(void 0, {chainId:r.chain.id});return(await r.readContract({abi:_berachainGovernance.berachainGovernanceAbi,address:n.governance.governor,functionName:"proposalSnapshot",args:[BigInt(s)]})).toString()})};var St=t=>{let{address:r}=_hooks.useBeraWallet.call(void 0, ),o=_hooks.usePublicClient.call(void 0, ),s=t.wallet||r,{data:n}=N({proposalId:t.proposalId}),a=t.timepoint||n;return _immutable2.default.call(void 0, a&&o&&s?["useGetPastVotes",a,s]:null,async([,e,i])=>{_chunk33XNWMPPcjs.b.call(void 0, o);let{config:l}=_chunkQVIAMSZ6cjs.a.call(void 0, {chainId:o.chain.id});if(Number(e)>Date.now()/1e3)throw new Error("timepoint is in the future");let A=await o.readContract({abi:_bgt.bgtAbi,address:l.tokens.bgt,functionName:"getPastVotes",args:[i,BigInt(e)]});return _viem.formatUnits.call(void 0, A,18)})};var _swr = require('swr'); var _swr2 = _interopRequireDefault(_swr);var _t=({proposalId:t,wallet:r})=>{let{address:o}=_hooks.useBeraWallet.call(void 0, ),s=_hooks.usePublicClient.call(void 0, ),n=r||o;return _swr2.default.call(void 0, s&&n&&_viem.isAddress.call(void 0, n)?["useHasVoted",t,n]:null,([,a,u])=>{_chunk33XNWMPPcjs.b.call(void 0, s);let{config:e}=_chunkQVIAMSZ6cjs.a.call(void 0, {chainId:s.chain.id});return s.readContract({address:e.governance.governor,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"hasVoted",args:[BigInt(a),u]})})};var _timeLock = require('@berachain/abis/gov/timeLock');var U="0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783";var Bt=({account:t,...r})=>{let o=_hooks.usePublicClient.call(void 0, ),{config:s}=_chunkQVIAMSZ6cjs.a.call(void 0, r);return _swr2.default.call(void 0, t&&o?["useCancellerRole",t]:null,async([,a])=>(_chunk33XNWMPPcjs.b.call(void 0, o),await o.readContract({abi:_timeLock.timeLockAbi,address:s.governance.timelock,functionName:"hasRole",args:[U,a]})),{refreshInterval:18e4,revalidateOnFocus:!1})};var _infinite = require('swr/infinite'); var _infinite2 = _interopRequireDefault(_infinite);var _governance = require('@berachain/graphql/governance');var B=10,he=t=>{switch(t){case _governance.ProposalStatus.QuorumNotReached:return[_governance.ProposalStatus.Active,_governance.ProposalStatus.Pending];case _governance.ProposalStatus.PendingQueue:case _governance.ProposalStatus.Defeated:return[_governance.ProposalStatus.Active];case _governance.ProposalStatus.PendingExecution:return[_governance.ProposalStatus.InQueue];default:return[t]}};function Re(t,r={}){let o=2*(_nullishCoalesce(r.perPage, () => (B)));return(s,n)=>{if(s!==0&&n&&n.length<o)return null;let a=_optionalChain([r, 'access', _7 => _7.status_in, 'optionalAccess', _8 => _8.flatMap, 'call', _9 => _9(he), 'access', _10 => _10.filter, 'call', _11 => _11((u,e,i)=>i.indexOf(u)===e)]);return["usePollAllProposals",s,t,r.where,a,r.orderBy,r.orderDirection,o,r.text]}}function Ht(t,r){let o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _12 => _12.autoRefresh]), () => (!1)),s=_nullishCoalesce(t.perPage, () => (B)),n=2*s,a=Re(t.topic,t);async function u(m){if(!m)return[];let[,b,d,v,h,K,F,w,G]=m;return(await _asyncNullishCoalesce(await _chunkCHFETMC6cjs.d.call(void 0, {where:{topics_contains:[d],status_in:_optionalChain([h, 'optionalAccess', _13 => _13.length])?h:void 0,...v},orderBy:K,orderDirection:F,text:G,perPage:w,offset:b*w}), async () => ([]))).filter(Boolean)}let e=_infinite2.default.call(void 0, a,u,{initialSize:1,refreshInterval:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _14 => _14.opts, 'optionalAccess', _15 => _15.refreshInterval]), () => (18e4)),..._optionalChain([r, 'optionalAccess', _16 => _16.opts])}),i=_react.useMemo.call(void 0, ()=>{if(!e.data)return[];let m=e.data.flat().filter(d=>d?_optionalChain([t, 'access', _17 => _17.status_in, 'optionalAccess', _18 => _18.length])?t.status_in.includes(d.status):!0:!1).sort((d,v)=>{if(!t.text)return 0;if(t.orderBy===_governance.Proposal_OrderBy.CreatedAt){let h=Number(v.createdAt)-Number(d.createdAt);return t.orderDirection==="asc"?h:-h}return 0}),b=[];for(let d=0;d<m.length;d+=s)b.push(m.slice(d,d+s));return b},[e.data,t,s]),l=_optionalChain([e, 'access', _19 => _19.data, 'optionalAccess', _20 => _20[e.data.length-1]]),A=!!l&&l.length===n,[g,y]=_react.useState.call(void 0, Date.now()/1e3);return _react.useEffect.call(void 0, ()=>{if(!o)return;let m=setInterval(()=>{y(Date.now()/1e3)},1e4);return()=>clearInterval(m)},[o]),_react.useEffect.call(void 0, ()=>{if(!e.data)return;let m=!1;for(let b of e.data.flat()){switch(b.status){case _governance.ProposalStatus.Pending:g>=Number(b.voteStartAt)&&(m=!0);break;case _governance.ProposalStatus.Active:g>=Number(b.voteEndAt)&&(m=!0);break;case _governance.ProposalStatus.InQueue:Date.now()/1e3+1>=Number(b.queueEnd)&&(m=!0);break;default:break}if(m)break}m&&e.mutate()},[e.data,g]),{...e,data:i,hasMore:A}}var Zt=(t,r)=>{let o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _21 => _21.autoRefresh]), () => (!1)),s=_hooks.usePublicClient.call(void 0, ),a=_swr2.default.call(void 0, t&&s?["usePollProposal",t]:null,([,i])=>(_chunk33XNWMPPcjs.b.call(void 0, s),_chunkCHFETMC6cjs.f.call(void 0, {proposalId:i,client:s})),{..._optionalChain([r, 'optionalAccess', _22 => _22.opts]),refreshInterval:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _23 => _23.opts, 'optionalAccess', _24 => _24.refreshInterval]), () => (18e4))}),[u,e]=_react.useState.call(void 0, Date.now());return _react.useEffect.call(void 0, ()=>{if(!o)return;let i=setInterval(()=>{e(Date.now()/1e3)},1e4);return()=>clearInterval(i)},[]),_react.useEffect.call(void 0, ()=>{if(a.data!==void 0)switch(a.data.status){case _governance.ProposalStatus.Pending:u>=Number(a.data.voteStartAt)&&a.mutate();break;case _governance.ProposalStatus.Active:u>=Number(a.data.voteEndAt)&&a.mutate();break;case _governance.ProposalStatus.InQueue:Date.now()/1e3+1>=Number(a.data.queueEnd)&&a.mutate();break}},[_optionalChain([a, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.status]),u]),{...a,refresh:()=>_optionalChain([a, 'optionalAccess', _27 => _27.mutate, 'optionalCall', _28 => _28()])}};var ar=t=>{let r=_hooks.usePublicClient.call(void 0, ),s=_swr2.default.call(void 0, r?["usePollProposalThreshold",t]:null,async([,n])=>{_chunk33XNWMPPcjs.b.call(void 0, r);let a=await r.readContract({address:n,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"proposalThreshold"});return{votesThreshold:_viem.formatEther.call(void 0, a)}},{refreshInterval:18e4});return{...s,refresh:s.mutate}};var E=1e3,pr= exports.usePollProposalVotes =(t,r)=>_infinite2.default.call(void 0, _e(t,r),async([o,s])=>_chunkCHFETMC6cjs.i.call(void 0, {variables:{...t,limit:E,offset:E*s}}),{parallel:!0,initialSize:Number.POSITIVE_INFINITY}),_e= exports.usePollProposalVotesQueryKey =({...t},r)=>o=>o>Math.floor(r/E)?null:["usePollProposalVotes",o,E,t.proposalId,t.orderBy,t.orderDirection];var yr=t=>{let{address:r}=_hooks.useBeraWallet.call(void 0, ),o=_hooks.usePublicClient.call(void 0, ),n=_swr2.default.call(void 0, r?["usePollUserDelegates",r]:null,async([,a])=>{_chunk33XNWMPPcjs.b.call(void 0, o);let{config:u}=_chunkQVIAMSZ6cjs.a.call(void 0, {chainId:o.chain.id});if(!o||!a)throw new Error("usePollUserDelegates needs publicClient and account");let[e,i]=await Promise.all([o.readContract({address:u.tokens.bgt,abi:_bgt.bgtAbi,functionName:"delegates",args:[a]}),o.readContract({address:u.tokens.bgt,abi:_bgt.bgtAbi,functionName:"getVotes",args:[a]})]);return{delegate:e,currentVotes:_viem.formatEther.call(void 0, i)}},{..._optionalChain([t, 'optionalAccess', _29 => _29.opts]),refreshInterval:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _30 => _30.opts, 'optionalAccess', _31 => _31.refreshInterval]), () => (18e4))});return{...n,refresh:()=>_optionalChain([n, 'optionalAccess', _32 => _32.mutate, 'optionalCall', _33 => _33()])}};var Er=t=>{let{data:r}=_hooks.useTransactionReceipt.call(void 0, {hash:t}),o=_hooks.usePublicClient.call(void 0, );return _swr2.default.call(void 0, r&&o?["useProposalFromTx",t]:null,async([,a])=>{if(!r)throw new Error("Transaction not found");if(r.transactionHash!==a)throw new Error("Transaction hash mismatch");return _chunkCHFETMC6cjs.h.call(void 0, {tx:r,publicClient:o})})};var Ve={0:"pending",1:"active",2:"canceled",3:"defeated",4:"succeeded",5:"queued",6:"expired",7:"executed"},Or= exports.useProposalState =({proposalId:t,governorAddress:r})=>{let o=_hooks.usePublicClient.call(void 0, );return _immutable2.default.call(void 0, r&&o&&t?["useProposalState",t]:null,async([,n])=>{_chunk33XNWMPPcjs.b.call(void 0, o);let a=await o.readContract({abi:_berachainGovernance.berachainGovernanceAbi,address:r,functionName:"state",args:[BigInt(n)]});return Ve[a]})};var He={0:"unset",1:"waiting",2:"ready",3:"done"};function Wr({proposalTimelockId:t,timelockAddress:r}){let o=_hooks.usePublicClient.call(void 0, );return _swr2.default.call(void 0, r&&o&&t?["useProposalTimelockState",t,r]:null,async([,n,a])=>{_chunk33XNWMPPcjs.b.call(void 0, o);let u=await o.readContract({abi:_timeLock.timeLockAbi,address:a,functionName:"getOperationState",args:[n]});return He[u]},{refreshInterval:18e4})}async function T({at:t,publicClient:r,...o}){let{config:s}=_chunkQVIAMSZ6cjs.a.call(void 0, o);_chunk33XNWMPPcjs.b.call(void 0, r);let n=await r.readContract({address:s.governance.governor,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"quorum",blockTag:"pending",args:[BigInt(_nullishCoalesce(t, () => (Math.floor(Date.now()/1e3))))]});return _viem.formatEther.call(void 0, n)}function Hr({at:t},{isEnabled:r=!0}){let o=Math.floor(Date.now()/1e3),s=_hooks.usePublicClient.call(void 0, ),n=r&&s?["useQuorum",Number(t)>o?"now":t]:null,a=_swr2.default.call(void 0, n,async([,u])=>u==="now"?T({publicClient:s}):T({at:u,publicClient:s}));return{...a,data:a.data?Number(a.data):void 0}}exports.useCreateProposal = Z; exports.useGetPastVotes = St; exports.useHasVoted = _t; exports.useIsCanceller = Bt; exports.usePollAllProposals = Ht; exports.usePollAllProposalsQueryKey = Re; exports.usePollProposal = Zt; exports.usePollProposalThreshold = ar; exports.usePollProposalVotes = pr; exports.usePollProposalVotesQueryKey = _e; exports.usePollUserDelegates = yr; exports.useProposalFromTx = Er; exports.useProposalSnapshot = N; exports.useProposalState = Or; exports.useProposalTimelockState = Wr; exports.useQuorum = Hr;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }require('../../chunk-XNJLSA6P.cjs');var _chunkS2TNHMSVcjs = require('../../chunk-S2TNHMSV.cjs');require('../../chunk-WRFDB3QJ.cjs');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 _react = require('react');var _graymatter = require('gray-matter'); var _graymatter2 = _interopRequireDefault(_graymatter);var _viem = require('viem');var _beraChef = require('@berachain/abis/pol/rewards/beraChef');var _rewardVault = require('@berachain/abis/pol/rewards/rewardVault');function R(t){return Object.values(t).some(r=>Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null?R(o):!!o):typeof r=="object"&&r!==null?R(r):!!r)}function D({proposal:t,currentTopic:r,onError:o}){let s=_chunkS2TNHMSVcjs.e.call(void 0, {proposal:t,currentTopic:r}),n=[];if(s.actions=t.actions.map((e,i)=>{let l={};if(l.target=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"address",value:e.target}),e.type==="custom-action")if(e.input==="ABI")if(l.ABI=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"abi",value:e.ABI}),!e.functionSignature)l.functionSignature="Required";else try{let g=_viem.parseAbiItem.call(void 0, e.functionSignature);g.type!=="function"?(console.error("parsedSignatureAbi is not a function",g),l.functionSignature="Invalid ABI"):(l.args=g.inputs.map((y,m)=>{try{return"components"in y?_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:y.type,value:_optionalChain([e, 'access', _2 => _2.args, 'optionalAccess', _3 => _3[m]]),components:y.components}):_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:y.type,value:_optionalChain([e, 'access', _4 => _4.args, 'optionalAccess', _5 => _5[m]])})}catch (e2){return null}}),l.args.some(y=>y)||(n[i]=_viem.encodeFunctionData.call(void 0, {abi:[g],args:e.args})))}catch (e3){l.functionSignature="Invalid ABI"}else if(e.input==="rawCalldata")l.rawCalldata=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"hex",value:e.rawCalldata}),n[i]=e.rawCalldata;else if(e.input==="message")l.message=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"string",value:e.message}),n[i]=_viem.toHex.call(void 0, e.message);else throw new Error("Invalid input type");else if(e.type==="whitelist-reward-vault"||e.type==="blacklist-reward-vault"){if(l.vault=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"address",value:e.vault}),!l.vault){let g=e.type==="whitelist-reward-vault";n[i]=_viem.encodeFunctionData.call(void 0, {abi:_beraChef.beraChefAbi,functionName:"setVaultWhitelistedStatus",args:[e.vault,g,""]})}}else e.type==="whitelist-reward-vault-incentive"?(l.token=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"address",value:e.token}),l.minIncentiveRate=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"uint256",value:e.minIncentiveRate}),l.managerAddress=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"address",value:e.managerAddress}),!l.token&&!l.minIncentiveRate&&!l.managerAddress&&(n[i]=_viem.encodeFunctionData.call(void 0, {abi:_rewardVault.rewardVaultAbi,functionName:"whitelistIncentiveToken",args:[e.token,BigInt(e.minIncentiveRate),e.managerAddress]}))):e.type==="erc20-transfer"&&(l.amount=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"uint256",value:e.amount}),l.to=_chunkS2TNHMSVcjs.a.call(void 0, {fieldOrType:"address",value:e.to}),!l.amount&&!l.to&&(n[i]=_viem.encodeFunctionData.call(void 0, {abi:_viem.erc20Abi,functionName:"transfer",args:[e.to,BigInt(e.amount)]})));return R(l)?l:null}),_optionalChain([o, 'optionalCall', _6 => _6(s)]),Object.getOwnPropertyNames(s).map(e=>s[e]).some(e=>Array.isArray(e)?e.filter(i=>i).length>0:e===null?!1:!!e)){console.warn("Proposal has errors",s);return}if(n.length===0)throw new Error("No actions submitted in proposal");let a=new URL(t.forumLink),u=_graymatter2.default.stringify(t.description,{title:t.title,topics:Array.from(t.topic.values()),forumLink:a.toString(),version:"1.0.0","content-encoding":"utf-8","content-type":"text/markdown",actions:t.actions.map(e=>{let i={type:e.type};return e.type==="custom-action"&&(i.inputType=e.input),i})});return[t.actions.map(e=>e.target),t.actions.map(e=>_nullishCoalesce(e.value, () => (0n))),n,u]}var W={type:"custom-action",target:"",ABI:"",value:0n,functionSignature:"",args:[],input:"ABI",rawCalldata:"0x",message:""},Z= exports.useCreateProposal =({initialData:t={},currentTopic:r,onError:o})=>{let[s,n]=_react.useState.call(void 0, {title:"",description:"",forumLink:"",actions:[W],...t,topic:new Set});_react.useEffect.call(void 0, ()=>{n(i=>({...i,topic:new Set([r.id])}))},[r]);let a=_react.useCallback.call(void 0, ()=>{n(i=>({...i,actions:[...i.actions,W]}))},[]),u=_react.useCallback.call(void 0, i=>{n(l=>{let A=[...l.actions];return A.splice(i,1),{...l,actions:A}})},[n]),e=_react.useCallback.call(void 0, ()=>s?D({proposal:s,currentTopic:r,onError:o}):void 0,[s,r]);return{proposal:s,setProposal:n,addProposalAction:a,removeProposalAction:u,computeParamsAndErrors:e}};var _immutable = require('swr/immutable'); var _immutable2 = _interopRequireDefault(_immutable);var _bgt = require('@berachain/abis/pol/bgt');var _hooks = require('@berachain/wagmi/hooks');var _berachainGovernance = require('@berachain/abis/gov/berachainGovernance');var N=({proposalId:t})=>{let r=_hooks.usePublicClient.call(void 0, );return _immutable2.default.call(void 0, r&&t?["useProposalSnapshot",t]:null,async([,s])=>{_chunkFQSOUEIJcjs.b.call(void 0, r);let{config:n}=_chunkFDEUAXETcjs.a.call(void 0, {chainId:r.chain.id});return(await r.readContract({abi:_berachainGovernance.berachainGovernanceAbi,address:n.governance.governor,functionName:"proposalSnapshot",args:[BigInt(s)]})).toString()})};var St=t=>{let{address:r}=_hooks.useBeraWallet.call(void 0, ),o=_hooks.usePublicClient.call(void 0, ),s=t.wallet||r,{data:n}=N({proposalId:t.proposalId}),a=t.timepoint||n;return _immutable2.default.call(void 0, a&&o&&s?["useGetPastVotes",a,s]:null,async([,e,i])=>{_chunkFQSOUEIJcjs.b.call(void 0, o);let{config:l}=_chunkFDEUAXETcjs.a.call(void 0, {chainId:o.chain.id});if(Number(e)>Date.now()/1e3)throw new Error("timepoint is in the future");let A=await o.readContract({abi:_bgt.bgtAbi,address:l.tokens.bgt,functionName:"getPastVotes",args:[i,BigInt(e)]});return _viem.formatUnits.call(void 0, A,18)})};var _swr = require('swr'); var _swr2 = _interopRequireDefault(_swr);var _t=({proposalId:t,wallet:r})=>{let{address:o}=_hooks.useBeraWallet.call(void 0, ),s=_hooks.usePublicClient.call(void 0, ),n=r||o;return _swr2.default.call(void 0, s&&n&&_viem.isAddress.call(void 0, n)?["useHasVoted",t,n]:null,([,a,u])=>{_chunkFQSOUEIJcjs.b.call(void 0, s);let{config:e}=_chunkFDEUAXETcjs.a.call(void 0, {chainId:s.chain.id});return s.readContract({address:e.governance.governor,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"hasVoted",args:[BigInt(a),u]})})};var _timeLock = require('@berachain/abis/gov/timeLock');var U="0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783";var Bt=({account:t,...r})=>{let o=_hooks.usePublicClient.call(void 0, ),{config:s}=_chunkFDEUAXETcjs.a.call(void 0, r);return _swr2.default.call(void 0, t&&o?["useCancellerRole",t]:null,async([,a])=>(_chunkFQSOUEIJcjs.b.call(void 0, o),await o.readContract({abi:_timeLock.timeLockAbi,address:s.governance.timelock,functionName:"hasRole",args:[U,a]})),{refreshInterval:18e4,revalidateOnFocus:!1})};var _infinite = require('swr/infinite'); var _infinite2 = _interopRequireDefault(_infinite);var _governance = require('@berachain/graphql/governance');var B=10,he=t=>{switch(t){case _governance.ProposalStatus.QuorumNotReached:return[_governance.ProposalStatus.Active,_governance.ProposalStatus.Pending];case _governance.ProposalStatus.PendingQueue:case _governance.ProposalStatus.Defeated:return[_governance.ProposalStatus.Active];case _governance.ProposalStatus.PendingExecution:return[_governance.ProposalStatus.InQueue];default:return[t]}};function Re(t,r={}){let o=2*(_nullishCoalesce(r.perPage, () => (B)));return(s,n)=>{if(s!==0&&n&&n.length<o)return null;let a=_optionalChain([r, 'access', _7 => _7.status_in, 'optionalAccess', _8 => _8.flatMap, 'call', _9 => _9(he), 'access', _10 => _10.filter, 'call', _11 => _11((u,e,i)=>i.indexOf(u)===e)]);return["usePollAllProposals",s,t,r.where,a,r.orderBy,r.orderDirection,o,r.text]}}function Ht(t,r){let o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _12 => _12.autoRefresh]), () => (!1)),s=_nullishCoalesce(t.perPage, () => (B)),n=2*s,a=Re(t.topic,t);async function u(m){if(!m)return[];let[,b,d,v,h,K,F,w,G]=m;return(await _asyncNullishCoalesce(await _chunkS2TNHMSVcjs.d.call(void 0, {where:{topics_contains:[d],status_in:_optionalChain([h, 'optionalAccess', _13 => _13.length])?h:void 0,...v},orderBy:K,orderDirection:F,text:G,perPage:w,offset:b*w}), async () => ([]))).filter(Boolean)}let e=_infinite2.default.call(void 0, a,u,{initialSize:1,refreshInterval:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _14 => _14.opts, 'optionalAccess', _15 => _15.refreshInterval]), () => (18e4)),..._optionalChain([r, 'optionalAccess', _16 => _16.opts])}),i=_react.useMemo.call(void 0, ()=>{if(!e.data)return[];let m=e.data.flat().filter(d=>d?_optionalChain([t, 'access', _17 => _17.status_in, 'optionalAccess', _18 => _18.length])?t.status_in.includes(d.status):!0:!1).sort((d,v)=>{if(!t.text)return 0;if(t.orderBy===_governance.Proposal_OrderBy.CreatedAt){let h=Number(v.createdAt)-Number(d.createdAt);return t.orderDirection==="asc"?h:-h}return 0}),b=[];for(let d=0;d<m.length;d+=s)b.push(m.slice(d,d+s));return b},[e.data,t,s]),l=_optionalChain([e, 'access', _19 => _19.data, 'optionalAccess', _20 => _20[e.data.length-1]]),A=!!l&&l.length===n,[g,y]=_react.useState.call(void 0, Date.now()/1e3);return _react.useEffect.call(void 0, ()=>{if(!o)return;let m=setInterval(()=>{y(Date.now()/1e3)},1e4);return()=>clearInterval(m)},[o]),_react.useEffect.call(void 0, ()=>{if(!e.data)return;let m=!1;for(let b of e.data.flat()){switch(b.status){case _governance.ProposalStatus.Pending:g>=Number(b.voteStartAt)&&(m=!0);break;case _governance.ProposalStatus.Active:g>=Number(b.voteEndAt)&&(m=!0);break;case _governance.ProposalStatus.InQueue:Date.now()/1e3+1>=Number(b.queueEnd)&&(m=!0);break;default:break}if(m)break}m&&e.mutate()},[e.data,g]),{...e,data:i,hasMore:A}}var Zt=(t,r)=>{let o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _21 => _21.autoRefresh]), () => (!1)),s=_hooks.usePublicClient.call(void 0, ),a=_swr2.default.call(void 0, t&&s?["usePollProposal",t]:null,([,i])=>(_chunkFQSOUEIJcjs.b.call(void 0, s),_chunkS2TNHMSVcjs.f.call(void 0, {proposalId:i,client:s})),{..._optionalChain([r, 'optionalAccess', _22 => _22.opts]),refreshInterval:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _23 => _23.opts, 'optionalAccess', _24 => _24.refreshInterval]), () => (18e4))}),[u,e]=_react.useState.call(void 0, Date.now());return _react.useEffect.call(void 0, ()=>{if(!o)return;let i=setInterval(()=>{e(Date.now()/1e3)},1e4);return()=>clearInterval(i)},[]),_react.useEffect.call(void 0, ()=>{if(a.data!==void 0)switch(a.data.status){case _governance.ProposalStatus.Pending:u>=Number(a.data.voteStartAt)&&a.mutate();break;case _governance.ProposalStatus.Active:u>=Number(a.data.voteEndAt)&&a.mutate();break;case _governance.ProposalStatus.InQueue:Date.now()/1e3+1>=Number(a.data.queueEnd)&&a.mutate();break}},[_optionalChain([a, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.status]),u]),{...a,refresh:()=>_optionalChain([a, 'optionalAccess', _27 => _27.mutate, 'optionalCall', _28 => _28()])}};var ar=t=>{let r=_hooks.usePublicClient.call(void 0, ),s=_swr2.default.call(void 0, r?["usePollProposalThreshold",t]:null,async([,n])=>{_chunkFQSOUEIJcjs.b.call(void 0, r);let a=await r.readContract({address:n,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"proposalThreshold"});return{votesThreshold:_viem.formatEther.call(void 0, a)}},{refreshInterval:18e4});return{...s,refresh:s.mutate}};var E=1e3,pr= exports.usePollProposalVotes =(t,r)=>_infinite2.default.call(void 0, _e(t,r),async([o,s])=>_chunkS2TNHMSVcjs.i.call(void 0, {variables:{...t,limit:E,offset:E*s}}),{parallel:!0,initialSize:Number.POSITIVE_INFINITY}),_e= exports.usePollProposalVotesQueryKey =({...t},r)=>o=>o>Math.floor(r/E)?null:["usePollProposalVotes",o,E,t.proposalId,t.orderBy,t.orderDirection];var yr=t=>{let{address:r}=_hooks.useBeraWallet.call(void 0, ),o=_hooks.usePublicClient.call(void 0, ),n=_swr2.default.call(void 0, r?["usePollUserDelegates",r]:null,async([,a])=>{_chunkFQSOUEIJcjs.b.call(void 0, o);let{config:u}=_chunkFDEUAXETcjs.a.call(void 0, {chainId:o.chain.id});if(!o||!a)throw new Error("usePollUserDelegates needs publicClient and account");let[e,i]=await Promise.all([o.readContract({address:u.tokens.bgt,abi:_bgt.bgtAbi,functionName:"delegates",args:[a]}),o.readContract({address:u.tokens.bgt,abi:_bgt.bgtAbi,functionName:"getVotes",args:[a]})]);return{delegate:e,currentVotes:_viem.formatEther.call(void 0, i)}},{..._optionalChain([t, 'optionalAccess', _29 => _29.opts]),refreshInterval:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _30 => _30.opts, 'optionalAccess', _31 => _31.refreshInterval]), () => (18e4))});return{...n,refresh:()=>_optionalChain([n, 'optionalAccess', _32 => _32.mutate, 'optionalCall', _33 => _33()])}};var Er=t=>{let{data:r}=_hooks.useTransactionReceipt.call(void 0, {hash:t}),o=_hooks.usePublicClient.call(void 0, );return _swr2.default.call(void 0, r&&o?["useProposalFromTx",t]:null,async([,a])=>{if(!r)throw new Error("Transaction not found");if(r.transactionHash!==a)throw new Error("Transaction hash mismatch");return _chunkS2TNHMSVcjs.h.call(void 0, {tx:r,publicClient:o})})};var Ve={0:"pending",1:"active",2:"canceled",3:"defeated",4:"succeeded",5:"queued",6:"expired",7:"executed"},Or= exports.useProposalState =({proposalId:t,governorAddress:r})=>{let o=_hooks.usePublicClient.call(void 0, );return _immutable2.default.call(void 0, r&&o&&t?["useProposalState",t]:null,async([,n])=>{_chunkFQSOUEIJcjs.b.call(void 0, o);let a=await o.readContract({abi:_berachainGovernance.berachainGovernanceAbi,address:r,functionName:"state",args:[BigInt(n)]});return Ve[a]})};var He={0:"unset",1:"waiting",2:"ready",3:"done"};function Wr({proposalTimelockId:t,timelockAddress:r}){let o=_hooks.usePublicClient.call(void 0, );return _swr2.default.call(void 0, r&&o&&t?["useProposalTimelockState",t,r]:null,async([,n,a])=>{_chunkFQSOUEIJcjs.b.call(void 0, o);let u=await o.readContract({abi:_timeLock.timeLockAbi,address:a,functionName:"getOperationState",args:[n]});return He[u]},{refreshInterval:18e4})}async function T({at:t,publicClient:r,...o}){let{config:s}=_chunkFDEUAXETcjs.a.call(void 0, o);_chunkFQSOUEIJcjs.b.call(void 0, r);let n=await r.readContract({address:s.governance.governor,abi:_berachainGovernance.berachainGovernanceAbi,functionName:"quorum",blockTag:"pending",args:[BigInt(_nullishCoalesce(t, () => (Math.floor(Date.now()/1e3))))]});return _viem.formatEther.call(void 0, n)}function Hr({at:t},{isEnabled:r=!0}){let o=Math.floor(Date.now()/1e3),s=_hooks.usePublicClient.call(void 0, ),n=r&&s?["useQuorum",Number(t)>o?"now":t]:null,a=_swr2.default.call(void 0, n,async([,u])=>u==="now"?T({publicClient:s}):T({at:u,publicClient:s}));return{...a,data:a.data?Number(a.data):void 0}}exports.useCreateProposal = Z; exports.useGetPastVotes = St; exports.useHasVoted = _t; exports.useIsCanceller = Bt; exports.usePollAllProposals = Ht; exports.usePollAllProposalsQueryKey = Re; exports.usePollProposal = Zt; exports.usePollProposalThreshold = ar; exports.usePollProposalVotes = pr; exports.usePollProposalVotesQueryKey = _e; exports.usePollUserDelegates = yr; exports.useProposalFromTx = Er; exports.useProposalSnapshot = N; exports.useProposalState = Or; exports.useProposalTimelockState = Wr; exports.useQuorum = Hr;
2
2
  //# sourceMappingURL=exports.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/governance/exports.cjs","../../../src/hooks/governance/useCreateProposal.ts","../../../src/actions/governance/getProposalParams.ts","../../../src/utils/hasAnyTruthyValues.ts","../../../src/hooks/governance/useGetPastVotes.ts","../../../src/hooks/governance/useProposalSnapshot.ts","../../../src/hooks/governance/useHasVoted.ts","../../../src/hooks/governance/useIsCanceller.ts","../../../src/actions/governance/constants.ts","../../../src/hooks/governance/usePollAllProposals.ts","../../../src/hooks/governance/usePollProposal.ts","../../../src/hooks/governance/usePollProposalThreshold.ts","../../../src/hooks/governance/usePollProposalVotes.ts","../../../src/hooks/governance/usePollUserDelegates.ts","../../../src/hooks/governance/useProposalFromTx.ts","../../../src/hooks/governance/useProposalState.ts","../../../src/hooks/governance/useProposalTimelockState.ts","../../../src/hooks/governance/useQuorum.ts","../../../src/actions/governance/getQuorum.ts"],"names":["hasAnyTruthyValues","obj","value","item","getProposalParams","proposal","currentTopic","onError","e","getBodyErrors","actions","action","idx","errors","checkProposalField","parsedSignatureAbi","parseAbiItem","input","index","v","encodeFunctionData","toHex","whiteList","beraChefAbi","rewardVaultAbi","erc20Abi","name","link","description","matter","actionMetadata","defaultAction","useCreateProposal","initialData","setProposal","useState","useEffect","p","addProposalAction","useCallback","removeProposalAction","computeParamsAndErrors","useProposalSnapshot","proposalId","publicClient","usePublicClient","useSWRImmutable","assertPublicClient","config","parseBaseArgs","governanceAbi","useGetPastVotes","args","account","useBeraWallet","wallet","snapshot","ts","votes","bgtAbi","formatUnits","useHasVoted","address","useSWR","isAddress","CANCELLER_ROLE","useIsCanceller","baseArgs","chainConfig","governanceTimelockAbi","DEFAULT_PER_PAGE","fromUiStatusToSubgraphStatuses","status","ProposalStatus","usePollAllProposalsQueryKey","topic","subgraphPageSize","pageIndex","previousPageData","statuses","s","i","arr","usePollAllProposals","options","autoRefreshProposals","perPage","getKey","fetcher","key","where","orderBy","orderDirection","pageSize","text","getAllProposals","swr","useSWRInfinite","data","useMemo","flattened","a","b","Proposal_OrderBy","result","chunked","lastPage","hasMore","timestamp","setTimestamp","interval","shouldMutate","usePollProposal","autoRefreshProposal","swrResponse","getProposalDetails","usePollProposalThreshold","governorAddress","votesThreshold","formatEther","DEFAULT_LIMIT","usePollProposalVotes","total","usePollProposalVotesQueryKey","_key","page","getProposalVotes","usePollUserDelegates","delegate","currentVotes","useProposalFromTx","txHash","tx","useTransactionReceipt","getProposalFromTx","ProposalStateMap","useProposalState","TimelockOperationState","useProposalTimelockState","proposalTimelockId","timelockAddress","getQuorum","at","quorum","useQuorum","isEnabled","now","QUERY_KEY","response"],"mappings":"AAAA,k8BAA+E,oCAAiC,oCAAiC,oCAAiC,4DAA6C,4DAA6C,oCAAiC,oCAAiC,8BCE7R,iGCF9B,4BAOZ,gEAEqB,sEACG,SCVfA,CAAAA,CACdC,CAAAA,CACS,CACT,OAAO,MAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAE,IAAA,CAAMC,CAAAA,EAC1B,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CACdA,CAAAA,CAAM,IAAA,CAAMC,CAAAA,EACjB,OAAOA,CAAAA,EAAS,QAAA,EAAYA,CAAAA,GAAS,IAAA,CACjCH,CAAAA,CAAmBG,CAAI,CAAA,CACvB,CAAC,CAACA,CACR,CAAA,CAEE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,GAAU,IAAA,CAClCF,CAAAA,CAAmBE,CAAK,CAAA,CAE1B,CAAC,CAACA,CACV,CACH,CDoBO,SAASE,CAAAA,CAAkB,CAChC,QAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CACF,CAAA,CAA0B,CACxB,IAAMC,CAAAA,CAA0BC,iCAAAA,CAAgB,QAAA,CAAAJ,CAAAA,CAAU,YAAA,CAAAC,CAAa,CAAC,CAAA,CAElEI,CAAAA,CAAqB,CAAC,CAAA,CAwJ5B,EAAA,CAtJAF,CAAAA,CAAE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A,CACA,IAAMC,CAAAA,CAAM,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,CAAA,CAAI,GAAI,CAAA,CAClCtG,CAAAA,CAAeC,oCAAAA,CAAgB,CAC/BsG,CAAAA,CACJF,CAAAA,EAAarG,CAAAA,CACR,CACC,WAAA,CAEA,MAAA,CAAOkG,CAAE,CAAA,CAAII,CAAAA,CAAM,KAAA,CAAQJ,CAC7B,CAAA,CACA,IAAA,CAEAM,CAAAA,CAAWrF,2BAAAA,CAAOoF,CAAW,KAAA,CAAO,CAAC,CAAEL,CAAE,CAAA,CAAA,EACzCA,CAAAA,GAAO,KAAA,CACFD,CAAAA,CAAU,CAAE,YAAA,CAAAjG,CAAa,CAAC,CAAA,CAE5BiG,CAAAA,CAAU,CAAE,EAAA,CAAAC,CAAAA,CAAI,YAAA,CAAAlG,CAAa,CAAC,CACtC,CAAA,CAED,MAAO,CACL,GAAGwG,CAAAA,CACH,IAAA,CAAMA,CAAAA,CAAS,IAAA,CAAO,MAAA,CAAOA,CAAAA,CAAS,IAAI,CAAA,CAAI,KAAA,CAChD,CACF,CAAA,ohBAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/hooks/governance/exports.cjs","sourcesContent":[null,"\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { getProposalParams } from \"../../actions/governance/getProposalParams\";\nimport { ProposalTypeEnum } from \"../../enum/governance\";\nimport type {\n CustomProposal,\n CustomProposalErrors,\n GovernanceTopic,\n PROPOSAL_GENRE,\n SafeProposalAction,\n} from \"../../types/governance\";\n\nconst defaultAction = {\n type: ProposalTypeEnum.CUSTOM_PROPOSAL,\n target: \"\",\n ABI: \"\",\n value: 0n,\n functionSignature: \"\",\n args: [],\n input: \"ABI\",\n rawCalldata: \"0x\",\n message: \"\",\n} satisfies SafeProposalAction;\n\nexport const useCreateProposal = ({\n initialData = {},\n currentTopic,\n onError,\n}: {\n initialData?: any;\n currentTopic: GovernanceTopic;\n onError: (e: CustomProposalErrors) => void;\n}) => {\n const [proposal, setProposal] = useState<CustomProposal>({\n title: \"\",\n description: \"\",\n forumLink: \"\",\n actions: [defaultAction],\n ...initialData,\n topic: new Set(),\n });\n\n useEffect(() => {\n setProposal((p) => ({\n ...p,\n topic: new Set<PROPOSAL_GENRE>([currentTopic.id]),\n }));\n }, [currentTopic]);\n\n const addProposalAction = useCallback(() => {\n setProposal((p) => ({ ...p, actions: [...p.actions, defaultAction] }));\n }, []);\n\n const removeProposalAction = useCallback(\n (idx: number) => {\n setProposal((p) => {\n const actions = [...p.actions];\n actions.splice(idx, 1);\n return { ...p, actions };\n });\n },\n [setProposal],\n );\n\n const computeParamsAndErrors = useCallback(() => {\n if (!proposal) {\n return;\n }\n\n const computedParams = getProposalParams({\n proposal,\n currentTopic,\n onError,\n });\n\n return computedParams;\n }, [proposal, currentTopic]);\n\n return {\n proposal,\n setProposal,\n addProposalAction,\n removeProposalAction,\n computeParamsAndErrors,\n };\n};\n","import matter from \"gray-matter\";\nimport {\n type Address,\n encodeFunctionData,\n erc20Abi,\n parseAbiItem,\n toHex,\n} from \"viem\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { ProposalErrorCodes, ProposalTypeEnum } from \"../../enum/governance\";\nimport type {\n CustomProposal,\n CustomProposalActionErrors,\n CustomProposalErrors,\n GovernanceTopic,\n} from \"../../types/governance\";\nimport { hasAnyTruthyValues } from \"../../utils/hasAnyTruthyValues\";\nimport { checkProposalField } from \"./checkProposalField\";\nimport { getBodyErrors } from \"./getBodyErrors\";\n\nexport interface GetProposalParamsArgs {\n /** The proposal to encode and validate */\n proposal: CustomProposal;\n /** The current governance topic */\n currentTopic: GovernanceTopic;\n /** Called with validation errors if the proposal is invalid */\n onError?: (e: CustomProposalErrors) => void;\n}\n\n/**\n * Validates a governance proposal and encodes its on-chain call parameters.\n * Returns the encoded targets, values, calldatas, and description, or `undefined` if validation fails.\n */\nexport function getProposalParams({\n proposal,\n currentTopic,\n onError,\n}: GetProposalParamsArgs) {\n const e: CustomProposalErrors = getBodyErrors({ proposal, currentTopic });\n\n const actions: Address[] = [];\n\n e.actions = proposal.actions.map((action, idx) => {\n const errors: CustomProposalActionErrors = {};\n errors.target = checkProposalField({\n fieldOrType: \"address\",\n value: action.target,\n });\n\n if (action.type === ProposalTypeEnum.CUSTOM_PROPOSAL) {\n if (action.input === \"ABI\") {\n errors.ABI = checkProposalField({\n fieldOrType: \"abi\",\n value: action.ABI,\n });\n if (!action.functionSignature) {\n errors.functionSignature = ProposalErrorCodes.REQUIRED;\n } else {\n try {\n const parsedSignatureAbi = parseAbiItem(action.functionSignature);\n if (parsedSignatureAbi.type !== \"function\") {\n console.error(\n \"parsedSignatureAbi is not a function\",\n parsedSignatureAbi,\n );\n\n errors.functionSignature = ProposalErrorCodes.INVALID_ABI;\n } else {\n errors.args = parsedSignatureAbi.inputs.map((input, index) => {\n try {\n if (\"components\" in input) {\n return checkProposalField({\n // @ts-expect-error this is not typed, will throw if not valid\n fieldOrType: input.type,\n value: action.args?.[index],\n components: input.components,\n });\n }\n\n return checkProposalField({\n // @ts-expect-error this is not typed, will throw if not valid\n fieldOrType: input.type,\n value: action.args?.[index],\n });\n } catch {\n return null;\n }\n });\n\n if (!errors.args.some((v) => v)) {\n actions[idx] = encodeFunctionData({\n abi: [parsedSignatureAbi],\n args: action.args,\n });\n }\n }\n } catch {\n errors.functionSignature = ProposalErrorCodes.INVALID_ABI;\n }\n }\n } else if (action.input === \"rawCalldata\") {\n errors.rawCalldata = checkProposalField({\n fieldOrType: \"hex\",\n value: action.rawCalldata,\n });\n actions[idx] = action.rawCalldata!;\n } else if (action.input === \"message\") {\n errors.message = checkProposalField({\n fieldOrType: \"string\",\n value: action.message,\n });\n actions[idx] = toHex(action.message!);\n } else {\n throw new Error(\"Invalid input type\");\n }\n } else if (\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT ||\n action.type === ProposalTypeEnum.BLACKLIST_REWARD_VAULT\n ) {\n errors.vault = checkProposalField({\n fieldOrType: \"address\",\n value: action.vault,\n });\n\n if (!errors.vault) {\n const whiteList =\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT;\n\n actions[idx] = encodeFunctionData({\n abi: beraChefAbi,\n functionName: \"setVaultWhitelistedStatus\",\n args: [action.vault!, whiteList, \"\"],\n });\n }\n } else if (\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT_INCENTIVE\n ) {\n errors.token = checkProposalField({\n fieldOrType: \"address\",\n value: action.token,\n });\n\n errors.minIncentiveRate = checkProposalField({\n fieldOrType: \"uint256\",\n value: action.minIncentiveRate,\n });\n\n errors.managerAddress = checkProposalField({\n fieldOrType: \"address\",\n value: action.managerAddress,\n });\n\n if (!errors.token && !errors.minIncentiveRate && !errors.managerAddress) {\n actions[idx] = encodeFunctionData({\n abi: rewardVaultAbi,\n functionName: \"whitelistIncentiveToken\",\n args: [\n action.token!,\n BigInt(action.minIncentiveRate!),\n action.managerAddress!,\n ],\n });\n }\n } else if (action.type === ProposalTypeEnum.ERC20_TRANSFER) {\n errors.amount = checkProposalField({\n fieldOrType: \"uint256\",\n value: action.amount,\n });\n errors.to = checkProposalField({\n fieldOrType: \"address\",\n value: action.to,\n });\n if (!errors.amount && !errors.to) {\n actions[idx] = encodeFunctionData({\n abi: erc20Abi,\n functionName: \"transfer\",\n args: [action.to!, BigInt(action.amount!)],\n });\n }\n }\n\n const hasErrors = hasAnyTruthyValues(errors);\n\n if (!hasErrors) {\n return null;\n }\n\n return errors;\n });\n\n onError?.(e);\n\n if (\n Object.getOwnPropertyNames(e)\n .map((name) => e[name as keyof typeof e])\n .some((v) => {\n if (Array.isArray(v)) {\n return v.filter((v) => v).length > 0;\n }\n\n if (v === null) {\n return false;\n }\n\n return !!v;\n })\n ) {\n console.warn(\"Proposal has errors\", e);\n return;\n }\n\n if (actions.length === 0) {\n throw new Error(\"No actions submitted in proposal\");\n }\n\n const link = new URL(proposal.forumLink);\n\n const description = matter.stringify(proposal.description, {\n title: proposal.title,\n topics: Array.from(proposal.topic.values()),\n forumLink: link.toString(),\n version: \"1.0.0\",\n \"content-encoding\": \"utf-8\",\n \"content-type\": \"text/markdown\",\n actions: proposal.actions.map((action) => {\n const actionMetadata: Record<string, string> = {\n type: action.type,\n };\n\n if (action.type === ProposalTypeEnum.CUSTOM_PROPOSAL) {\n actionMetadata.inputType = action.input!;\n }\n\n return actionMetadata;\n }),\n });\n\n return [\n proposal.actions.map((action) => action.target as `0x${string}`),\n proposal.actions.map((action) => action.value ?? 0n),\n actions,\n description,\n ] as const;\n}\n","export function hasAnyTruthyValues<T extends Record<string, any>>(\n obj: T,\n): boolean {\n return Object.values(obj).some((value) => {\n if (Array.isArray(value)) {\n return value.some((item) =>\n typeof item === \"object\" && item !== null\n ? hasAnyTruthyValues(item)\n : !!item,\n );\n }\n if (typeof value === \"object\" && value !== null) {\n return hasAnyTruthyValues(value);\n }\n return !!value;\n });\n}\n","import useSWRImmutable from \"swr/immutable\";\nimport { type Address, formatUnits } from \"viem\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { useProposalSnapshot } from \"./useProposalSnapshot\";\n\n/**\n * Returns the amount of voting power that a wallet had when the voting period began.\n * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#Votes-getPastVotes-address-uint256-}\n */\nexport const useGetPastVotes = (\n args: {\n wallet?: Address;\n } & (\n | {\n proposalId?: bigint;\n timepoint: number | bigint;\n }\n | {\n proposalId: bigint;\n timepoint?: number | bigint;\n }\n ),\n) => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n\n const wallet = args.wallet || account;\n\n const { data: snapshot } = useProposalSnapshot({\n proposalId: args.proposalId,\n });\n\n const ts = args.timepoint || snapshot;\n\n const QUERY_KEY =\n ts && publicClient && wallet\n ? ([\"useGetPastVotes\", ts, wallet] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, ts, wallet]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n if (Number(ts) > Date.now() / 1000) {\n throw new Error(\"timepoint is in the future\");\n }\n\n const votes = await publicClient.readContract({\n abi: bgtAbi,\n address: config.tokens.bgt,\n functionName: \"getPastVotes\",\n args: [wallet, BigInt(ts)],\n });\n\n return formatUnits(votes, 18);\n });\n};\n","import type { SWRResponse } from \"swr\";\nimport useSWRImmutable from \"swr/immutable\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Timepoint used to retrieve user’s votes and quorum. If using block\n * number (as per Compound’s Comp), the snapshot is performed at\n * the end of this block. Hence, voting for this proposal starts at the beginning of the following block.\n *\n * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#IGovernor-proposalSnapshot-uint256-}\n */\nexport const useProposalSnapshot = ({\n proposalId,\n}: {\n proposalId: number | bigint | string | undefined;\n}): SWRResponse<string> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n publicClient && proposalId\n ? ([\"useProposalSnapshot\", proposalId] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n const snapshot = await publicClient.readContract({\n abi: governanceAbi,\n address: config.governance.governor,\n functionName: \"proposalSnapshot\",\n args: [BigInt(proposalId)],\n });\n\n return snapshot.toString();\n });\n};\n","import useSWR from \"swr\";\nimport { type Address, isAddress } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const useHasVoted = ({\n proposalId,\n wallet,\n}: {\n proposalId: string;\n wallet?: Address;\n}) => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n\n const address = wallet || account;\n return useSWR(\n publicClient && address && isAddress(address)\n ? ([\"useHasVoted\", proposalId, address] as const)\n : null,\n ([, proposalId, address]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n return publicClient.readContract({\n address: config.governance.governor,\n abi: governanceAbi,\n functionName: \"hasVoted\",\n args: [BigInt(proposalId), address],\n });\n },\n );\n};\n","import useSWR from \"swr\";\nimport type { Address } from \"viem\";\n\nimport { timeLockAbi as governanceTimelockAbi } from \"@berachain/abis/gov/timeLock\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { CANCELLER_ROLE } from \"../../actions/governance/constants\";\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const useIsCanceller = ({\n account,\n ...baseArgs\n}: {\n account: Address | undefined;\n} & BeraJS.BaseFunctionArgs) => {\n const publicClient = usePublicClient();\n const { config: chainConfig } = parseBaseArgs(baseArgs);\n\n const QUERY_KEY =\n account && publicClient ? ([\"useCancellerRole\", account] as const) : null;\n\n return useSWR(\n QUERY_KEY,\n async ([, account]) => {\n assertPublicClient(publicClient);\n\n const canceller = await publicClient.readContract({\n abi: governanceTimelockAbi,\n address: chainConfig.governance.timelock,\n functionName: \"hasRole\",\n args: [CANCELLER_ROLE, account],\n });\n\n return canceller;\n },\n {\n refreshInterval: POLLING.SLOW,\n revalidateOnFocus: false,\n },\n );\n};\n","/**\n * keccak256(\"CANCELLER_ROLE\")\n *\n * @see https://beratrail.io/address/0xD4e9dD9bb5acC31B550b618701c836fAEF6E0eE1/contract/80094/readContract#F1\n */\nexport const CANCELLER_ROLE =\n \"0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783\";\n","import { useEffect, useMemo, useState } from \"react\";\nimport useSWRInfinite, { type SWRInfiniteResponse } from \"swr/infinite\";\n\nimport {\n type OrderDirection,\n type Proposal_Filter,\n Proposal_OrderBy,\n type ProposalSelectionFragment,\n ProposalStatus,\n} from \"@berachain/graphql/governance\";\n\nimport { getAllProposals } from \"../../actions/governance/getAllProposals\";\nimport { POLLING } from \"../../enum/polling\";\nimport type { DefaultHookOptions } from \"../../types/global\";\n\nconst DEFAULT_PER_PAGE = 10;\n\nconst fromUiStatusToSubgraphStatuses = (\n status: ProposalStatus,\n): ProposalStatus[] => {\n switch (status) {\n case ProposalStatus.QuorumNotReached:\n return [ProposalStatus.Active, ProposalStatus.Pending];\n case ProposalStatus.PendingQueue:\n case ProposalStatus.Defeated:\n return [ProposalStatus.Active];\n case ProposalStatus.PendingExecution:\n return [ProposalStatus.InQueue];\n default:\n return [status];\n }\n};\n\ntype UsePollAllProposalsArgs = {\n topic: string;\n where?: Proposal_Filter;\n perPage?: number;\n orderBy?: Proposal_OrderBy;\n orderDirection?: OrderDirection;\n status_in?: ProposalStatus[];\n text?: string;\n autoRefreshProposals?: boolean;\n};\n\ntype ProposalResult = {\n data: ProposalSelectionFragment[][];\n hasMore: boolean;\n} & Omit<SWRInfiniteResponse<ProposalSelectionFragment[]>, \"data\">;\n\ntype PollAllProposalsKey =\n | [\n \"usePollAllProposals\",\n number,\n string,\n Proposal_Filter | undefined,\n ProposalStatus[] | undefined,\n Proposal_OrderBy | undefined,\n OrderDirection | undefined,\n number,\n string | undefined,\n ]\n | null;\n\nexport function usePollAllProposalsQueryKey(\n topic: string,\n args: Partial<UsePollAllProposalsArgs> = {},\n): (\n pageIndex: number,\n previousPageData?: ProposalSelectionFragment[],\n) => PollAllProposalsKey {\n const subgraphPageSize = 2 * (args.perPage ?? DEFAULT_PER_PAGE);\n\n return (pageIndex, previousPageData) => {\n if (\n pageIndex !== 0 &&\n previousPageData &&\n previousPageData.length < subgraphPageSize\n ) {\n return null;\n }\n\n const statuses = args.status_in\n ?.flatMap(fromUiStatusToSubgraphStatuses)\n .filter((s, i, arr) => arr.indexOf(s) === i);\n\n return [\n \"usePollAllProposals\",\n pageIndex,\n topic,\n args.where,\n statuses,\n args.orderBy,\n args.orderDirection,\n subgraphPageSize,\n args.text,\n ];\n };\n}\n\n/**\n * Fetch all proposals for a given topic\n */\nexport function usePollAllProposals(\n args: UsePollAllProposalsArgs,\n options?: DefaultHookOptions & { autoRefresh?: boolean },\n): ProposalResult {\n const autoRefreshProposals = options?.autoRefresh ?? false;\n\n const perPage = args.perPage ?? DEFAULT_PER_PAGE;\n const subgraphPageSize = 2 * perPage;\n\n const getKey = usePollAllProposalsQueryKey(args.topic, args);\n\n async function fetcher(key: PollAllProposalsKey) {\n if (!key) return [];\n const [\n ,\n pageIndex,\n topic,\n where,\n statuses,\n orderBy,\n orderDirection,\n pageSize,\n text,\n ] = key;\n\n const proposals = await getAllProposals({\n where: {\n topics_contains: [topic],\n status_in: statuses?.length ? statuses : undefined,\n ...where,\n },\n orderBy,\n orderDirection,\n text,\n perPage: pageSize,\n offset: pageIndex * pageSize,\n });\n\n return (proposals ?? []).filter(Boolean) as ProposalSelectionFragment[];\n }\n\n const swr = useSWRInfinite<ProposalSelectionFragment[], PollAllProposalsKey>(\n getKey,\n fetcher,\n {\n // Increase initialSize in order to prefetch more proposals at a time.\n initialSize: 1,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n ...options?.opts,\n },\n );\n\n const data = useMemo(() => {\n if (!swr.data) return [];\n\n const flattened = swr.data\n .flat()\n .filter((p) => {\n if (!p) return false;\n if (!args.status_in?.length) return true;\n return args.status_in.includes(p.status);\n })\n .sort((a, b) => {\n if (!args.text) return 0;\n if (args.orderBy === Proposal_OrderBy.CreatedAt) {\n const result = Number(b.createdAt) - Number(a.createdAt);\n return args.orderDirection === \"asc\" ? result : -result;\n }\n return 0;\n });\n\n const chunked: ProposalSelectionFragment[][] = [];\n for (let i = 0; i < flattened.length; i += perPage) {\n chunked.push(flattened.slice(i, i + perPage));\n }\n return chunked;\n }, [swr.data, args, perPage]);\n\n const lastPage = swr.data?.[swr.data.length - 1];\n const hasMore = !!lastPage && lastPage.length === subgraphPageSize;\n\n const [timestamp, setTimestamp] = useState(Date.now() / 1000);\n\n useEffect(() => {\n if (!autoRefreshProposals) return;\n const interval = setInterval(() => {\n setTimestamp(Date.now() / 1000);\n }, POLLING.FAST);\n\n return () => clearInterval(interval);\n }, [autoRefreshProposals]);\n\n useEffect(() => {\n if (!swr.data) return;\n\n let shouldMutate = false;\n for (const proposal of swr.data.flat()) {\n switch (proposal.status) {\n case ProposalStatus.Pending:\n if (timestamp >= Number(proposal.voteStartAt)) {\n shouldMutate = true;\n }\n break;\n case ProposalStatus.Active:\n if (timestamp >= Number(proposal.voteEndAt)) {\n shouldMutate = true;\n }\n break;\n case ProposalStatus.InQueue:\n if (Date.now() / 1000 + 1 >= Number(proposal.queueEnd)) {\n shouldMutate = true;\n }\n break;\n default:\n break;\n }\n if (shouldMutate) break;\n }\n\n if (shouldMutate) {\n swr.mutate();\n }\n }, [swr.data, timestamp]);\n\n return {\n ...swr,\n data,\n hasMore,\n };\n}\n","import { useEffect, useState } from \"react\";\nimport useSWR from \"swr\";\n\nimport {\n ProposalStatus,\n type ProposalWithVotesFragment,\n} from \"@berachain/graphql/governance\";\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { getProposalDetails } from \"../../actions/governance/getProposalDetails\";\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type {\n DefaultHookOptions,\n DefaultHookReturnType,\n} from \"../../types/global\";\n\nexport interface UsePollProposalResponse\n extends DefaultHookReturnType<ProposalWithVotesFragment> {}\n\n/**\n * Polls a proposal and returns the proposal details.\n * Pulls data from the subgraph and onchain.\n *\n * @param proposalId - The ID of the proposal to poll\n * @param options - Optional configuration options\n * @param options.autoRefresh - If true, the data will be refreshed automatically based on the block number and status threshold\n * @returns {UsePollProposalResponse} Object containing:\n * - data: ProposalWithVotesFragment | undefined - The proposal data if successful\n * - error: Error | undefined - Error object if request failed\n * - isLoading: boolean - True while data is being fetched\n * - isValidating: boolean - True while data is being revalidated\n * - mutate: () => Promise<ProposalWithVotesFragment | undefined> - Function to manually refresh the data\n * - refresh: () => Promise<void> - Function to manually refresh the data\n */\nexport const usePollProposal = (\n proposalId: string,\n options?: DefaultHookOptions & { autoRefresh?: boolean },\n): UsePollProposalResponse => {\n const autoRefreshProposal = options?.autoRefresh ?? false;\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n proposalId && publicClient\n ? ([\"usePollProposal\", proposalId] as const)\n : null;\n\n const swrResponse = useSWR(\n QUERY_KEY,\n ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n return getProposalDetails({ proposalId, client: publicClient });\n },\n {\n ...options?.opts,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n },\n );\n\n const [timestamp, setTimestamp] = useState(Date.now());\n\n useEffect(() => {\n if (!autoRefreshProposal) return;\n const interval = setInterval(() => {\n setTimestamp(Date.now() / 1000);\n }, POLLING.FAST);\n\n return () => clearInterval(interval);\n }, []);\n\n useEffect(() => {\n if (swrResponse.data === undefined) return;\n\n switch (swrResponse.data.status) {\n case ProposalStatus.Pending:\n if (timestamp >= Number(swrResponse.data.voteStartAt)) {\n swrResponse.mutate();\n }\n break;\n case ProposalStatus.Active:\n if (timestamp >= Number(swrResponse.data.voteEndAt)) {\n swrResponse.mutate();\n }\n break;\n case ProposalStatus.InQueue:\n if (Date.now() / 1000 + 1 >= Number(swrResponse.data.queueEnd)) {\n swrResponse.mutate();\n }\n break;\n }\n }, [swrResponse.data?.status, timestamp]);\n\n // const votes = swrResponse.data?.votes.nodes ?? [];\n return {\n ...swrResponse,\n refresh: () => swrResponse?.mutate?.(),\n };\n};\n","import useSWR from \"swr\";\nimport { type Address, formatEther } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { DefaultHookReturnType } from \"../../types/global\";\n\nexport const usePollProposalThreshold = (\n governorAddress: Address,\n): DefaultHookReturnType<{ votesThreshold: string }> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY = publicClient\n ? ([\"usePollProposalThreshold\", governorAddress] as const)\n : null;\n\n const swrResponse = useSWR<{ votesThreshold: string }, any, typeof QUERY_KEY>(\n QUERY_KEY,\n async ([, governorAddress]) => {\n assertPublicClient(publicClient);\n\n const votesThreshold = await publicClient.readContract({\n address: governorAddress,\n abi: governanceAbi,\n functionName: \"proposalThreshold\",\n });\n return { votesThreshold: formatEther(votesThreshold) };\n },\n {\n refreshInterval: POLLING.SLOW,\n },\n );\n\n return {\n ...swrResponse,\n refresh: swrResponse.mutate,\n };\n};\n","import useSWRInfinite, { type SWRInfiniteKeyLoader } from \"swr/infinite\";\n\nimport type { GetProposalVotesQueryVariables } from \"@berachain/graphql/governance\";\n\nimport { getProposalVotes } from \"../../actions/governance/getProposalVotes\";\n\ntype UsePollProposalVotesArgs = Omit<\n GetProposalVotesQueryVariables,\n \"offset\" | \"limit\"\n>;\n\n// const ACTUAL_PER_PAGE = 500;\n\nconst DEFAULT_LIMIT = 1000;\n/**\n * Fetches all the votes for a proposal from the Subgraph\n * @param args - The arguments to pass to the query\n * @param total - The total amount of pages of votes to fetch\n */\nexport const usePollProposalVotes = (\n args: UsePollProposalVotesArgs,\n total: number,\n) => {\n return useSWRInfinite(\n usePollProposalVotesQueryKey(args, total),\n async ([_key, page]: [string, number]) => {\n return getProposalVotes({\n variables: {\n ...args,\n limit: DEFAULT_LIMIT,\n offset: DEFAULT_LIMIT * page,\n },\n });\n },\n {\n parallel: true,\n // Fetches all the data at once, we limit the number of pages by providing a total\n initialSize: Number.POSITIVE_INFINITY,\n },\n );\n};\n\nexport const usePollProposalVotesQueryKey =\n (\n { ...args }: UsePollProposalVotesArgs,\n total: number,\n ): SWRInfiniteKeyLoader =>\n (\n pageIndex: number,\n // previousPageData: Awaited<ReturnType<typeof getProposalVotes>>,\n ) => {\n if (pageIndex > Math.floor(total / DEFAULT_LIMIT)) {\n return null;\n }\n\n return [\n \"usePollProposalVotes\",\n pageIndex,\n DEFAULT_LIMIT,\n args.proposalId,\n args.orderBy,\n args.orderDirection,\n ];\n };\n","import useSWR from \"swr\";\nimport { type Address, formatEther } from \"viem\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type {\n DefaultHookOptions,\n DefaultHookReturnType,\n} from \"../../types/global\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const usePollUserDelegates = (\n options?: DefaultHookOptions,\n): DefaultHookReturnType<{\n delegate: Address;\n currentVotes: string | undefined;\n}> => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n const QUERY_KEY = account\n ? ([\"usePollUserDelegates\", account] as const)\n : null;\n\n const swrResponse = useSWR<\n { delegate: Address; currentVotes: string | undefined },\n any,\n typeof QUERY_KEY\n >(\n QUERY_KEY,\n async ([, account]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n if (!publicClient || !account) {\n throw new Error(\"usePollUserDelegates needs publicClient and account\");\n }\n\n // use promise all to better catch errors and have type safety\n const [delegate, currentVotes] = await Promise.all([\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"delegates\",\n args: [account],\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"getVotes\",\n args: [account],\n }),\n ]);\n\n return {\n delegate: delegate,\n currentVotes: formatEther(currentVotes),\n };\n },\n {\n ...options?.opts,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n },\n );\n\n return {\n ...swrResponse,\n refresh: () => swrResponse?.mutate?.(),\n };\n};\n","import useSWR, { type SWRResponse } from \"swr\";\nimport type { Address } from \"viem\";\n\nimport type { ProposalWithVotesFragment } from \"@berachain/graphql/governance\";\nimport { usePublicClient, useTransactionReceipt } from \"@berachain/wagmi/hooks\";\n\nimport { getProposalFromTx } from \"../../actions/governance/getProposalFromTx\";\n\nexport const useProposalFromTx = (\n txHash?: Address,\n): SWRResponse<ProposalWithVotesFragment | null> => {\n const { data: tx } = useTransactionReceipt({\n hash: txHash,\n });\n\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n tx && publicClient ? ([\"useProposalFromTx\", txHash] as const) : null;\n\n const swrResponse = useSWR(QUERY_KEY, async ([, txHash]) => {\n if (!tx) {\n throw new Error(\"Transaction not found\");\n }\n\n // This might happen for some render order issues.\n // Since tx is read by the external scope, it might be outdated.\n // Throwing an error here will cause the hook to re-run with the latest tx object.\n if (tx.transactionHash !== txHash) {\n throw new Error(\"Transaction hash mismatch\");\n }\n\n return getProposalFromTx({ tx, publicClient });\n });\n\n return swrResponse;\n};\n","import type { SWRResponse } from \"swr\";\nimport useSWRImmutable from \"swr/immutable\";\nimport type { Address } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { ProposalState } from \"../../enum/governance\";\nimport { assertPublicClient } from \"../../errors/assert\";\n\nconst ProposalStateMap: Record<ProposalState, string> = {\n [ProposalState.Pending]: \"pending\",\n [ProposalState.Active]: \"active\",\n [ProposalState.Canceled]: \"canceled\",\n [ProposalState.Defeated]: \"defeated\",\n [ProposalState.Succeeded]: \"succeeded\",\n [ProposalState.Queued]: \"queued\",\n [ProposalState.Expired]: \"expired\",\n [ProposalState.Executed]: \"executed\",\n};\n\nexport const useProposalState = ({\n proposalId,\n governorAddress,\n}: {\n proposalId: number | bigint | string | undefined;\n governorAddress: Address;\n}): SWRResponse<string> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n governorAddress && publicClient && proposalId\n ? ([\"useProposalState\", proposalId] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n const snapshot = (await publicClient.readContract({\n abi: governanceAbi,\n address: governorAddress,\n functionName: \"state\",\n args: [BigInt(proposalId)],\n })) as ProposalState;\n\n return ProposalStateMap[snapshot];\n });\n};\n","import useSWR, { type SWRResponse } from \"swr\";\nimport type { Address } from \"viem\";\n\nimport { timeLockAbi as governanceTimelockAbi } from \"@berachain/abis/gov/timeLock\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\n\nconst TimelockOperationState = {\n 0: \"unset\",\n 1: \"waiting\",\n 2: \"ready\",\n 3: \"done\",\n} as const;\n\n/**\n * Fetches the state of a proposal timelock\n * @returns state of the proposal timelock (unset, waiting, ready, done)\n */\nexport function useProposalTimelockState({\n proposalTimelockId,\n timelockAddress,\n}: {\n proposalTimelockId: Address | undefined;\n timelockAddress: Address;\n}): SWRResponse<\n (typeof TimelockOperationState)[keyof typeof TimelockOperationState]\n> {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n timelockAddress && publicClient && proposalTimelockId\n ? ([\n \"useProposalTimelockState\",\n proposalTimelockId,\n timelockAddress,\n ] as const)\n : null;\n\n return useSWR(\n QUERY_KEY,\n async ([, proposalTimelockId, timelockAddress]) => {\n assertPublicClient(publicClient);\n\n const snapshot = await publicClient.readContract({\n abi: governanceTimelockAbi,\n address: timelockAddress,\n functionName: \"getOperationState\",\n args: [proposalTimelockId],\n });\n\n return TimelockOperationState[\n snapshot as keyof typeof TimelockOperationState\n ];\n },\n {\n refreshInterval: POLLING.SLOW,\n },\n );\n}\n","import useSWR from \"swr\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { getQuorum } from \"../../actions/governance/getQuorum\";\n\n/**\n * Queries the quorum for a given timestamp.\n *\n * @returns current quorum if timestamp is in the future.\n */\nexport function useQuorum(\n { at }: { at: number | string },\n {\n isEnabled = true,\n }: {\n isEnabled?: boolean;\n },\n) {\n const now = Math.floor(Date.now() / 1000);\n const publicClient = usePublicClient();\n const QUERY_KEY =\n isEnabled && publicClient\n ? ([\n \"useQuorum\",\n // Using Now because we cannot query quorum in the future, so no need to have different query keys.\n Number(at) > now ? \"now\" : at,\n ] as const)\n : null;\n\n const response = useSWR(QUERY_KEY, async ([, at]) => {\n if (at === \"now\") {\n return getQuorum({ publicClient });\n }\n return getQuorum({ at, publicClient });\n });\n\n return {\n ...response,\n data: response.data ? Number(response.data) : undefined,\n };\n}\n","import { formatEther, type PublicClient } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport type GetQuorumArgs = BeraJS.BaseFunctionArgs & {\n /** Timestamp in seconds; defaults to now. Returns the current quorum when in the future. */\n at?: number | string;\n publicClient: PublicClient | undefined;\n};\n\n/**\n * Queries the quorum for a given timestamp.\n *\n * @returns current quorum if timestamp is in the future.\n */\nexport async function getQuorum({\n at,\n publicClient,\n ...args\n}: GetQuorumArgs): Promise<string> {\n const { config } = parseBaseArgs(args);\n assertPublicClient(publicClient);\n\n const quorum = await publicClient.readContract({\n address: config.governance.governor,\n abi: governanceAbi,\n functionName: \"quorum\",\n // Needs to be pending or you'll get a ERC5805FutureLookup error when reading current quorum\n // this is because now will always be in the future compared to the latest block\n blockTag: \"pending\",\n args: [BigInt(at ?? Math.floor(Date.now() / 1000))],\n });\n\n return formatEther(quorum);\n}\n"]}
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/hooks/governance/exports.cjs","../../../src/hooks/governance/useCreateProposal.ts","../../../src/actions/governance/getProposalParams.ts","../../../src/utils/hasAnyTruthyValues.ts","../../../src/hooks/governance/useGetPastVotes.ts","../../../src/hooks/governance/useProposalSnapshot.ts","../../../src/hooks/governance/useHasVoted.ts","../../../src/hooks/governance/useIsCanceller.ts","../../../src/actions/governance/constants.ts","../../../src/hooks/governance/usePollAllProposals.ts","../../../src/hooks/governance/usePollProposal.ts","../../../src/hooks/governance/usePollProposalThreshold.ts","../../../src/hooks/governance/usePollProposalVotes.ts","../../../src/hooks/governance/usePollUserDelegates.ts","../../../src/hooks/governance/useProposalFromTx.ts","../../../src/hooks/governance/useProposalState.ts","../../../src/hooks/governance/useProposalTimelockState.ts","../../../src/hooks/governance/useQuorum.ts","../../../src/actions/governance/getQuorum.ts"],"names":["hasAnyTruthyValues","obj","value","item","getProposalParams","proposal","currentTopic","onError","e","getBodyErrors","actions","action","idx","errors","checkProposalField","parsedSignatureAbi","parseAbiItem","input","index","v","encodeFunctionData","toHex","whiteList","beraChefAbi","rewardVaultAbi","erc20Abi","name","link","description","matter","actionMetadata","defaultAction","useCreateProposal","initialData","setProposal","useState","useEffect","p","addProposalAction","useCallback","removeProposalAction","computeParamsAndErrors","useProposalSnapshot","proposalId","publicClient","usePublicClient","useSWRImmutable","assertPublicClient","config","parseBaseArgs","governanceAbi","useGetPastVotes","args","account","useBeraWallet","wallet","snapshot","ts","votes","bgtAbi","formatUnits","useHasVoted","address","useSWR","isAddress","CANCELLER_ROLE","useIsCanceller","baseArgs","chainConfig","governanceTimelockAbi","DEFAULT_PER_PAGE","fromUiStatusToSubgraphStatuses","status","ProposalStatus","usePollAllProposalsQueryKey","topic","subgraphPageSize","pageIndex","previousPageData","statuses","s","i","arr","usePollAllProposals","options","autoRefreshProposals","perPage","getKey","fetcher","key","where","orderBy","orderDirection","pageSize","text","getAllProposals","swr","useSWRInfinite","data","useMemo","flattened","a","b","Proposal_OrderBy","result","chunked","lastPage","hasMore","timestamp","setTimestamp","interval","shouldMutate","usePollProposal","autoRefreshProposal","swrResponse","getProposalDetails","usePollProposalThreshold","governorAddress","votesThreshold","formatEther","DEFAULT_LIMIT","usePollProposalVotes","total","usePollProposalVotesQueryKey","_key","page","getProposalVotes","usePollUserDelegates","delegate","currentVotes","useProposalFromTx","txHash","tx","useTransactionReceipt","getProposalFromTx","ProposalStateMap","useProposalState","TimelockOperationState","useProposalTimelockState","proposalTimelockId","timelockAddress","getQuorum","at","quorum","useQuorum","isEnabled","now","QUERY_KEY","response"],"mappings":"AAAA,06BAAgC,4DAAgF,oCAAiC,oCAAiC,4DAA6C,oCAAiC,4DAA6C,oCAAiC,8BCE7R,iGCF9B,4BAOZ,gEAEqB,sEACG,SCVfA,CAAAA,CACdC,CAAAA,CACS,CACT,OAAO,MAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAE,IAAA,CAAMC,CAAAA,EAC1B,KAAA,CAAM,OAAA,CAAQA,CAAK,CAAA,CACdA,CAAAA,CAAM,IAAA,CAAMC,CAAAA,EACjB,OAAOA,CAAAA,EAAS,QAAA,EAAYA,CAAAA,GAAS,IAAA,CACjCH,CAAAA,CAAmBG,CAAI,CAAA,CACvB,CAAC,CAACA,CACR,CAAA,CAEE,OAAOD,CAAAA,EAAU,QAAA,EAAYA,CAAAA,GAAU,IAAA,CAClCF,CAAAA,CAAmBE,CAAK,CAAA,CAE1B,CAAC,CAACA,CACV,CACH,CDoBO,SAASE,CAAAA,CAAkB,CAChC,QAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CACF,CAAA,CAA0B,CACxB,IAAMC,CAAAA,CAA0BC,iCAAAA,CAAgB,QAAA,CAAAJ,CAAAA,CAAU,YAAA,CAAAC,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CAAE,EAAA,CAAAF,CAAG,CAAA,CACL,CACE,SAAA,CAAAG,CAAAA,CAAY,CAAA,CACd,CAAA,CAGA,CACA,IAAMC,CAAAA,CAAM,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,CAAA,CAAI,GAAI,CAAA,CAClCtG,CAAAA,CAAeC,oCAAAA,CAAgB,CAC/BsG,CAAAA,CACJF,CAAAA,EAAarG,CAAAA,CACR,CACC,WAAA,CAEA,MAAA,CAAOkG,CAAE,CAAA,CAAII,CAAAA,CAAM,KAAA,CAAQJ,CAC7B,CAAA,CACA,IAAA,CAEAM,CAAAA,CAAWrF,2BAAAA,CAAOoF,CAAW,KAAA,CAAO,CAAC,CAAEL,CAAE,CAAA,CAAA,EACzCA,CAAAA,GAAO,KAAA,CACFD,CAAAA,CAAU,CAAE,YAAA,CAAAjG,CAAa,CAAC,CAAA,CAE5BiG,CAAAA,CAAU,CAAE,EAAA,CAAAC,CAAAA,CAAI,YAAA,CAAAlG,CAAa,CAAC,CACtC,CAAA,CAED,MAAO,CACL,GAAGwG,CAAAA,CACH,IAAA,CAAMA,CAAAA,CAAS,IAAA,CAAO,MAAA,CAAOA,CAAAA,CAAS,IAAI,CAAA,CAAI,KAAA,CAChD,CACF,CAAA,ohBAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/hooks/governance/exports.cjs","sourcesContent":[null,"\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { getProposalParams } from \"../../actions/governance/getProposalParams\";\nimport { ProposalTypeEnum } from \"../../enum/governance\";\nimport type {\n CustomProposal,\n CustomProposalErrors,\n GovernanceTopic,\n PROPOSAL_GENRE,\n SafeProposalAction,\n} from \"../../types/governance\";\n\nconst defaultAction = {\n type: ProposalTypeEnum.CUSTOM_PROPOSAL,\n target: \"\",\n ABI: \"\",\n value: 0n,\n functionSignature: \"\",\n args: [],\n input: \"ABI\",\n rawCalldata: \"0x\",\n message: \"\",\n} satisfies SafeProposalAction;\n\nexport const useCreateProposal = ({\n initialData = {},\n currentTopic,\n onError,\n}: {\n initialData?: any;\n currentTopic: GovernanceTopic;\n onError: (e: CustomProposalErrors) => void;\n}) => {\n const [proposal, setProposal] = useState<CustomProposal>({\n title: \"\",\n description: \"\",\n forumLink: \"\",\n actions: [defaultAction],\n ...initialData,\n topic: new Set(),\n });\n\n useEffect(() => {\n setProposal((p) => ({\n ...p,\n topic: new Set<PROPOSAL_GENRE>([currentTopic.id]),\n }));\n }, [currentTopic]);\n\n const addProposalAction = useCallback(() => {\n setProposal((p) => ({ ...p, actions: [...p.actions, defaultAction] }));\n }, []);\n\n const removeProposalAction = useCallback(\n (idx: number) => {\n setProposal((p) => {\n const actions = [...p.actions];\n actions.splice(idx, 1);\n return { ...p, actions };\n });\n },\n [setProposal],\n );\n\n const computeParamsAndErrors = useCallback(() => {\n if (!proposal) {\n return;\n }\n\n const computedParams = getProposalParams({\n proposal,\n currentTopic,\n onError,\n });\n\n return computedParams;\n }, [proposal, currentTopic]);\n\n return {\n proposal,\n setProposal,\n addProposalAction,\n removeProposalAction,\n computeParamsAndErrors,\n };\n};\n","import matter from \"gray-matter\";\nimport {\n type Address,\n encodeFunctionData,\n erc20Abi,\n parseAbiItem,\n toHex,\n} from \"viem\";\n\nimport { beraChefAbi } from \"@berachain/abis/pol/rewards/beraChef\";\nimport { rewardVaultAbi } from \"@berachain/abis/pol/rewards/rewardVault\";\n\nimport { ProposalErrorCodes, ProposalTypeEnum } from \"../../enum/governance\";\nimport type {\n CustomProposal,\n CustomProposalActionErrors,\n CustomProposalErrors,\n GovernanceTopic,\n} from \"../../types/governance\";\nimport { hasAnyTruthyValues } from \"../../utils/hasAnyTruthyValues\";\nimport { checkProposalField } from \"./checkProposalField\";\nimport { getBodyErrors } from \"./getBodyErrors\";\n\nexport interface GetProposalParamsArgs {\n /** The proposal to encode and validate */\n proposal: CustomProposal;\n /** The current governance topic */\n currentTopic: GovernanceTopic;\n /** Called with validation errors if the proposal is invalid */\n onError?: (e: CustomProposalErrors) => void;\n}\n\n/**\n * Validates a governance proposal and encodes its on-chain call parameters.\n * Returns the encoded targets, values, calldatas, and description, or `undefined` if validation fails.\n */\nexport function getProposalParams({\n proposal,\n currentTopic,\n onError,\n}: GetProposalParamsArgs) {\n const e: CustomProposalErrors = getBodyErrors({ proposal, currentTopic });\n\n const actions: Address[] = [];\n\n e.actions = proposal.actions.map((action, idx) => {\n const errors: CustomProposalActionErrors = {};\n errors.target = checkProposalField({\n fieldOrType: \"address\",\n value: action.target,\n });\n\n if (action.type === ProposalTypeEnum.CUSTOM_PROPOSAL) {\n if (action.input === \"ABI\") {\n errors.ABI = checkProposalField({\n fieldOrType: \"abi\",\n value: action.ABI,\n });\n if (!action.functionSignature) {\n errors.functionSignature = ProposalErrorCodes.REQUIRED;\n } else {\n try {\n const parsedSignatureAbi = parseAbiItem(action.functionSignature);\n if (parsedSignatureAbi.type !== \"function\") {\n console.error(\n \"parsedSignatureAbi is not a function\",\n parsedSignatureAbi,\n );\n\n errors.functionSignature = ProposalErrorCodes.INVALID_ABI;\n } else {\n errors.args = parsedSignatureAbi.inputs.map((input, index) => {\n try {\n if (\"components\" in input) {\n return checkProposalField({\n // @ts-expect-error this is not typed, will throw if not valid\n fieldOrType: input.type,\n value: action.args?.[index],\n components: input.components,\n });\n }\n\n return checkProposalField({\n // @ts-expect-error this is not typed, will throw if not valid\n fieldOrType: input.type,\n value: action.args?.[index],\n });\n } catch {\n return null;\n }\n });\n\n if (!errors.args.some((v) => v)) {\n actions[idx] = encodeFunctionData({\n abi: [parsedSignatureAbi],\n args: action.args,\n });\n }\n }\n } catch {\n errors.functionSignature = ProposalErrorCodes.INVALID_ABI;\n }\n }\n } else if (action.input === \"rawCalldata\") {\n errors.rawCalldata = checkProposalField({\n fieldOrType: \"hex\",\n value: action.rawCalldata,\n });\n actions[idx] = action.rawCalldata!;\n } else if (action.input === \"message\") {\n errors.message = checkProposalField({\n fieldOrType: \"string\",\n value: action.message,\n });\n actions[idx] = toHex(action.message!);\n } else {\n throw new Error(\"Invalid input type\");\n }\n } else if (\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT ||\n action.type === ProposalTypeEnum.BLACKLIST_REWARD_VAULT\n ) {\n errors.vault = checkProposalField({\n fieldOrType: \"address\",\n value: action.vault,\n });\n\n if (!errors.vault) {\n const whiteList =\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT;\n\n actions[idx] = encodeFunctionData({\n abi: beraChefAbi,\n functionName: \"setVaultWhitelistedStatus\",\n args: [action.vault!, whiteList, \"\"],\n });\n }\n } else if (\n action.type === ProposalTypeEnum.WHITELIST_REWARD_VAULT_INCENTIVE\n ) {\n errors.token = checkProposalField({\n fieldOrType: \"address\",\n value: action.token,\n });\n\n errors.minIncentiveRate = checkProposalField({\n fieldOrType: \"uint256\",\n value: action.minIncentiveRate,\n });\n\n errors.managerAddress = checkProposalField({\n fieldOrType: \"address\",\n value: action.managerAddress,\n });\n\n if (!errors.token && !errors.minIncentiveRate && !errors.managerAddress) {\n actions[idx] = encodeFunctionData({\n abi: rewardVaultAbi,\n functionName: \"whitelistIncentiveToken\",\n args: [\n action.token!,\n BigInt(action.minIncentiveRate!),\n action.managerAddress!,\n ],\n });\n }\n } else if (action.type === ProposalTypeEnum.ERC20_TRANSFER) {\n errors.amount = checkProposalField({\n fieldOrType: \"uint256\",\n value: action.amount,\n });\n errors.to = checkProposalField({\n fieldOrType: \"address\",\n value: action.to,\n });\n if (!errors.amount && !errors.to) {\n actions[idx] = encodeFunctionData({\n abi: erc20Abi,\n functionName: \"transfer\",\n args: [action.to!, BigInt(action.amount!)],\n });\n }\n }\n\n const hasErrors = hasAnyTruthyValues(errors);\n\n if (!hasErrors) {\n return null;\n }\n\n return errors;\n });\n\n onError?.(e);\n\n if (\n Object.getOwnPropertyNames(e)\n .map((name) => e[name as keyof typeof e])\n .some((v) => {\n if (Array.isArray(v)) {\n return v.filter((v) => v).length > 0;\n }\n\n if (v === null) {\n return false;\n }\n\n return !!v;\n })\n ) {\n console.warn(\"Proposal has errors\", e);\n return;\n }\n\n if (actions.length === 0) {\n throw new Error(\"No actions submitted in proposal\");\n }\n\n const link = new URL(proposal.forumLink);\n\n const description = matter.stringify(proposal.description, {\n title: proposal.title,\n topics: Array.from(proposal.topic.values()),\n forumLink: link.toString(),\n version: \"1.0.0\",\n \"content-encoding\": \"utf-8\",\n \"content-type\": \"text/markdown\",\n actions: proposal.actions.map((action) => {\n const actionMetadata: Record<string, string> = {\n type: action.type,\n };\n\n if (action.type === ProposalTypeEnum.CUSTOM_PROPOSAL) {\n actionMetadata.inputType = action.input!;\n }\n\n return actionMetadata;\n }),\n });\n\n return [\n proposal.actions.map((action) => action.target as `0x${string}`),\n proposal.actions.map((action) => action.value ?? 0n),\n actions,\n description,\n ] as const;\n}\n","export function hasAnyTruthyValues<T extends Record<string, any>>(\n obj: T,\n): boolean {\n return Object.values(obj).some((value) => {\n if (Array.isArray(value)) {\n return value.some((item) =>\n typeof item === \"object\" && item !== null\n ? hasAnyTruthyValues(item)\n : !!item,\n );\n }\n if (typeof value === \"object\" && value !== null) {\n return hasAnyTruthyValues(value);\n }\n return !!value;\n });\n}\n","import useSWRImmutable from \"swr/immutable\";\nimport { type Address, formatUnits } from \"viem\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { useProposalSnapshot } from \"./useProposalSnapshot\";\n\n/**\n * Returns the amount of voting power that a wallet had when the voting period began.\n * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#Votes-getPastVotes-address-uint256-}\n */\nexport const useGetPastVotes = (\n args: {\n wallet?: Address;\n } & (\n | {\n proposalId?: bigint;\n timepoint: number | bigint;\n }\n | {\n proposalId: bigint;\n timepoint?: number | bigint;\n }\n ),\n) => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n\n const wallet = args.wallet || account;\n\n const { data: snapshot } = useProposalSnapshot({\n proposalId: args.proposalId,\n });\n\n const ts = args.timepoint || snapshot;\n\n const QUERY_KEY =\n ts && publicClient && wallet\n ? ([\"useGetPastVotes\", ts, wallet] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, ts, wallet]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n if (Number(ts) > Date.now() / 1000) {\n throw new Error(\"timepoint is in the future\");\n }\n\n const votes = await publicClient.readContract({\n abi: bgtAbi,\n address: config.tokens.bgt,\n functionName: \"getPastVotes\",\n args: [wallet, BigInt(ts)],\n });\n\n return formatUnits(votes, 18);\n });\n};\n","import type { SWRResponse } from \"swr\";\nimport useSWRImmutable from \"swr/immutable\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\n/**\n * Timepoint used to retrieve user’s votes and quorum. If using block\n * number (as per Compound’s Comp), the snapshot is performed at\n * the end of this block. Hence, voting for this proposal starts at the beginning of the following block.\n *\n * {@link https://docs.openzeppelin.com/contracts/5.x/api/governance#IGovernor-proposalSnapshot-uint256-}\n */\nexport const useProposalSnapshot = ({\n proposalId,\n}: {\n proposalId: number | bigint | string | undefined;\n}): SWRResponse<string> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n publicClient && proposalId\n ? ([\"useProposalSnapshot\", proposalId] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n const snapshot = await publicClient.readContract({\n abi: governanceAbi,\n address: config.governance.governor,\n functionName: \"proposalSnapshot\",\n args: [BigInt(proposalId)],\n });\n\n return snapshot.toString();\n });\n};\n","import useSWR from \"swr\";\nimport { type Address, isAddress } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const useHasVoted = ({\n proposalId,\n wallet,\n}: {\n proposalId: string;\n wallet?: Address;\n}) => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n\n const address = wallet || account;\n return useSWR(\n publicClient && address && isAddress(address)\n ? ([\"useHasVoted\", proposalId, address] as const)\n : null,\n ([, proposalId, address]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n return publicClient.readContract({\n address: config.governance.governor,\n abi: governanceAbi,\n functionName: \"hasVoted\",\n args: [BigInt(proposalId), address],\n });\n },\n );\n};\n","import useSWR from \"swr\";\nimport type { Address } from \"viem\";\n\nimport { timeLockAbi as governanceTimelockAbi } from \"@berachain/abis/gov/timeLock\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { CANCELLER_ROLE } from \"../../actions/governance/constants\";\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const useIsCanceller = ({\n account,\n ...baseArgs\n}: {\n account: Address | undefined;\n} & BeraJS.BaseFunctionArgs) => {\n const publicClient = usePublicClient();\n const { config: chainConfig } = parseBaseArgs(baseArgs);\n\n const QUERY_KEY =\n account && publicClient ? ([\"useCancellerRole\", account] as const) : null;\n\n return useSWR(\n QUERY_KEY,\n async ([, account]) => {\n assertPublicClient(publicClient);\n\n const canceller = await publicClient.readContract({\n abi: governanceTimelockAbi,\n address: chainConfig.governance.timelock,\n functionName: \"hasRole\",\n args: [CANCELLER_ROLE, account],\n });\n\n return canceller;\n },\n {\n refreshInterval: POLLING.SLOW,\n revalidateOnFocus: false,\n },\n );\n};\n","/**\n * keccak256(\"CANCELLER_ROLE\")\n *\n * @see https://beratrail.io/address/0xD4e9dD9bb5acC31B550b618701c836fAEF6E0eE1/contract/80094/readContract#F1\n */\nexport const CANCELLER_ROLE =\n \"0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783\";\n","import { useEffect, useMemo, useState } from \"react\";\nimport useSWRInfinite, { type SWRInfiniteResponse } from \"swr/infinite\";\n\nimport {\n type OrderDirection,\n type Proposal_Filter,\n Proposal_OrderBy,\n type ProposalSelectionFragment,\n ProposalStatus,\n} from \"@berachain/graphql/governance\";\n\nimport { getAllProposals } from \"../../actions/governance/getAllProposals\";\nimport { POLLING } from \"../../enum/polling\";\nimport type { DefaultHookOptions } from \"../../types/global\";\n\nconst DEFAULT_PER_PAGE = 10;\n\nconst fromUiStatusToSubgraphStatuses = (\n status: ProposalStatus,\n): ProposalStatus[] => {\n switch (status) {\n case ProposalStatus.QuorumNotReached:\n return [ProposalStatus.Active, ProposalStatus.Pending];\n case ProposalStatus.PendingQueue:\n case ProposalStatus.Defeated:\n return [ProposalStatus.Active];\n case ProposalStatus.PendingExecution:\n return [ProposalStatus.InQueue];\n default:\n return [status];\n }\n};\n\ntype UsePollAllProposalsArgs = {\n topic: string;\n where?: Proposal_Filter;\n perPage?: number;\n orderBy?: Proposal_OrderBy;\n orderDirection?: OrderDirection;\n status_in?: ProposalStatus[];\n text?: string;\n autoRefreshProposals?: boolean;\n};\n\ntype ProposalResult = {\n data: ProposalSelectionFragment[][];\n hasMore: boolean;\n} & Omit<SWRInfiniteResponse<ProposalSelectionFragment[]>, \"data\">;\n\ntype PollAllProposalsKey =\n | [\n \"usePollAllProposals\",\n number,\n string,\n Proposal_Filter | undefined,\n ProposalStatus[] | undefined,\n Proposal_OrderBy | undefined,\n OrderDirection | undefined,\n number,\n string | undefined,\n ]\n | null;\n\nexport function usePollAllProposalsQueryKey(\n topic: string,\n args: Partial<UsePollAllProposalsArgs> = {},\n): (\n pageIndex: number,\n previousPageData?: ProposalSelectionFragment[],\n) => PollAllProposalsKey {\n const subgraphPageSize = 2 * (args.perPage ?? DEFAULT_PER_PAGE);\n\n return (pageIndex, previousPageData) => {\n if (\n pageIndex !== 0 &&\n previousPageData &&\n previousPageData.length < subgraphPageSize\n ) {\n return null;\n }\n\n const statuses = args.status_in\n ?.flatMap(fromUiStatusToSubgraphStatuses)\n .filter((s, i, arr) => arr.indexOf(s) === i);\n\n return [\n \"usePollAllProposals\",\n pageIndex,\n topic,\n args.where,\n statuses,\n args.orderBy,\n args.orderDirection,\n subgraphPageSize,\n args.text,\n ];\n };\n}\n\n/**\n * Fetch all proposals for a given topic\n */\nexport function usePollAllProposals(\n args: UsePollAllProposalsArgs,\n options?: DefaultHookOptions & { autoRefresh?: boolean },\n): ProposalResult {\n const autoRefreshProposals = options?.autoRefresh ?? false;\n\n const perPage = args.perPage ?? DEFAULT_PER_PAGE;\n const subgraphPageSize = 2 * perPage;\n\n const getKey = usePollAllProposalsQueryKey(args.topic, args);\n\n async function fetcher(key: PollAllProposalsKey) {\n if (!key) return [];\n const [\n ,\n pageIndex,\n topic,\n where,\n statuses,\n orderBy,\n orderDirection,\n pageSize,\n text,\n ] = key;\n\n const proposals = await getAllProposals({\n where: {\n topics_contains: [topic],\n status_in: statuses?.length ? statuses : undefined,\n ...where,\n },\n orderBy,\n orderDirection,\n text,\n perPage: pageSize,\n offset: pageIndex * pageSize,\n });\n\n return (proposals ?? []).filter(Boolean) as ProposalSelectionFragment[];\n }\n\n const swr = useSWRInfinite<ProposalSelectionFragment[], PollAllProposalsKey>(\n getKey,\n fetcher,\n {\n // Increase initialSize in order to prefetch more proposals at a time.\n initialSize: 1,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n ...options?.opts,\n },\n );\n\n const data = useMemo(() => {\n if (!swr.data) return [];\n\n const flattened = swr.data\n .flat()\n .filter((p) => {\n if (!p) return false;\n if (!args.status_in?.length) return true;\n return args.status_in.includes(p.status);\n })\n .sort((a, b) => {\n if (!args.text) return 0;\n if (args.orderBy === Proposal_OrderBy.CreatedAt) {\n const result = Number(b.createdAt) - Number(a.createdAt);\n return args.orderDirection === \"asc\" ? result : -result;\n }\n return 0;\n });\n\n const chunked: ProposalSelectionFragment[][] = [];\n for (let i = 0; i < flattened.length; i += perPage) {\n chunked.push(flattened.slice(i, i + perPage));\n }\n return chunked;\n }, [swr.data, args, perPage]);\n\n const lastPage = swr.data?.[swr.data.length - 1];\n const hasMore = !!lastPage && lastPage.length === subgraphPageSize;\n\n const [timestamp, setTimestamp] = useState(Date.now() / 1000);\n\n useEffect(() => {\n if (!autoRefreshProposals) return;\n const interval = setInterval(() => {\n setTimestamp(Date.now() / 1000);\n }, POLLING.FAST);\n\n return () => clearInterval(interval);\n }, [autoRefreshProposals]);\n\n useEffect(() => {\n if (!swr.data) return;\n\n let shouldMutate = false;\n for (const proposal of swr.data.flat()) {\n switch (proposal.status) {\n case ProposalStatus.Pending:\n if (timestamp >= Number(proposal.voteStartAt)) {\n shouldMutate = true;\n }\n break;\n case ProposalStatus.Active:\n if (timestamp >= Number(proposal.voteEndAt)) {\n shouldMutate = true;\n }\n break;\n case ProposalStatus.InQueue:\n if (Date.now() / 1000 + 1 >= Number(proposal.queueEnd)) {\n shouldMutate = true;\n }\n break;\n default:\n break;\n }\n if (shouldMutate) break;\n }\n\n if (shouldMutate) {\n swr.mutate();\n }\n }, [swr.data, timestamp]);\n\n return {\n ...swr,\n data,\n hasMore,\n };\n}\n","import { useEffect, useState } from \"react\";\nimport useSWR from \"swr\";\n\nimport {\n ProposalStatus,\n type ProposalWithVotesFragment,\n} from \"@berachain/graphql/governance\";\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { getProposalDetails } from \"../../actions/governance/getProposalDetails\";\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type {\n DefaultHookOptions,\n DefaultHookReturnType,\n} from \"../../types/global\";\n\nexport interface UsePollProposalResponse\n extends DefaultHookReturnType<ProposalWithVotesFragment> {}\n\n/**\n * Polls a proposal and returns the proposal details.\n * Pulls data from the subgraph and onchain.\n *\n * @param proposalId - The ID of the proposal to poll\n * @param options - Optional configuration options\n * @param options.autoRefresh - If true, the data will be refreshed automatically based on the block number and status threshold\n * @returns {UsePollProposalResponse} Object containing:\n * - data: ProposalWithVotesFragment | undefined - The proposal data if successful\n * - error: Error | undefined - Error object if request failed\n * - isLoading: boolean - True while data is being fetched\n * - isValidating: boolean - True while data is being revalidated\n * - mutate: () => Promise<ProposalWithVotesFragment | undefined> - Function to manually refresh the data\n * - refresh: () => Promise<void> - Function to manually refresh the data\n */\nexport const usePollProposal = (\n proposalId: string,\n options?: DefaultHookOptions & { autoRefresh?: boolean },\n): UsePollProposalResponse => {\n const autoRefreshProposal = options?.autoRefresh ?? false;\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n proposalId && publicClient\n ? ([\"usePollProposal\", proposalId] as const)\n : null;\n\n const swrResponse = useSWR(\n QUERY_KEY,\n ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n return getProposalDetails({ proposalId, client: publicClient });\n },\n {\n ...options?.opts,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n },\n );\n\n const [timestamp, setTimestamp] = useState(Date.now());\n\n useEffect(() => {\n if (!autoRefreshProposal) return;\n const interval = setInterval(() => {\n setTimestamp(Date.now() / 1000);\n }, POLLING.FAST);\n\n return () => clearInterval(interval);\n }, []);\n\n useEffect(() => {\n if (swrResponse.data === undefined) return;\n\n switch (swrResponse.data.status) {\n case ProposalStatus.Pending:\n if (timestamp >= Number(swrResponse.data.voteStartAt)) {\n swrResponse.mutate();\n }\n break;\n case ProposalStatus.Active:\n if (timestamp >= Number(swrResponse.data.voteEndAt)) {\n swrResponse.mutate();\n }\n break;\n case ProposalStatus.InQueue:\n if (Date.now() / 1000 + 1 >= Number(swrResponse.data.queueEnd)) {\n swrResponse.mutate();\n }\n break;\n }\n }, [swrResponse.data?.status, timestamp]);\n\n // const votes = swrResponse.data?.votes.nodes ?? [];\n return {\n ...swrResponse,\n refresh: () => swrResponse?.mutate?.(),\n };\n};\n","import useSWR from \"swr\";\nimport { type Address, formatEther } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type { DefaultHookReturnType } from \"../../types/global\";\n\nexport const usePollProposalThreshold = (\n governorAddress: Address,\n): DefaultHookReturnType<{ votesThreshold: string }> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY = publicClient\n ? ([\"usePollProposalThreshold\", governorAddress] as const)\n : null;\n\n const swrResponse = useSWR<{ votesThreshold: string }, any, typeof QUERY_KEY>(\n QUERY_KEY,\n async ([, governorAddress]) => {\n assertPublicClient(publicClient);\n\n const votesThreshold = await publicClient.readContract({\n address: governorAddress,\n abi: governanceAbi,\n functionName: \"proposalThreshold\",\n });\n return { votesThreshold: formatEther(votesThreshold) };\n },\n {\n refreshInterval: POLLING.SLOW,\n },\n );\n\n return {\n ...swrResponse,\n refresh: swrResponse.mutate,\n };\n};\n","import useSWRInfinite, { type SWRInfiniteKeyLoader } from \"swr/infinite\";\n\nimport type { GetProposalVotesQueryVariables } from \"@berachain/graphql/governance\";\n\nimport { getProposalVotes } from \"../../actions/governance/getProposalVotes\";\n\ntype UsePollProposalVotesArgs = Omit<\n GetProposalVotesQueryVariables,\n \"offset\" | \"limit\"\n>;\n\n// const ACTUAL_PER_PAGE = 500;\n\nconst DEFAULT_LIMIT = 1000;\n/**\n * Fetches all the votes for a proposal from the Subgraph\n * @param args - The arguments to pass to the query\n * @param total - The total amount of pages of votes to fetch\n */\nexport const usePollProposalVotes = (\n args: UsePollProposalVotesArgs,\n total: number,\n) => {\n return useSWRInfinite(\n usePollProposalVotesQueryKey(args, total),\n async ([_key, page]: [string, number]) => {\n return getProposalVotes({\n variables: {\n ...args,\n limit: DEFAULT_LIMIT,\n offset: DEFAULT_LIMIT * page,\n },\n });\n },\n {\n parallel: true,\n // Fetches all the data at once, we limit the number of pages by providing a total\n initialSize: Number.POSITIVE_INFINITY,\n },\n );\n};\n\nexport const usePollProposalVotesQueryKey =\n (\n { ...args }: UsePollProposalVotesArgs,\n total: number,\n ): SWRInfiniteKeyLoader =>\n (\n pageIndex: number,\n // previousPageData: Awaited<ReturnType<typeof getProposalVotes>>,\n ) => {\n if (pageIndex > Math.floor(total / DEFAULT_LIMIT)) {\n return null;\n }\n\n return [\n \"usePollProposalVotes\",\n pageIndex,\n DEFAULT_LIMIT,\n args.proposalId,\n args.orderBy,\n args.orderDirection,\n ];\n };\n","import useSWR from \"swr\";\nimport { type Address, formatEther } from \"viem\";\n\nimport { bgtAbi } from \"@berachain/abis/pol/bgt\";\n\nimport { useBeraWallet, usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\nimport type {\n DefaultHookOptions,\n DefaultHookReturnType,\n} from \"../../types/global\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport const usePollUserDelegates = (\n options?: DefaultHookOptions,\n): DefaultHookReturnType<{\n delegate: Address;\n currentVotes: string | undefined;\n}> => {\n const { address: account } = useBeraWallet();\n const publicClient = usePublicClient();\n const QUERY_KEY = account\n ? ([\"usePollUserDelegates\", account] as const)\n : null;\n\n const swrResponse = useSWR<\n { delegate: Address; currentVotes: string | undefined },\n any,\n typeof QUERY_KEY\n >(\n QUERY_KEY,\n async ([, account]) => {\n assertPublicClient(publicClient);\n const { config } = parseBaseArgs({\n chainId: publicClient.chain.id,\n });\n if (!publicClient || !account) {\n throw new Error(\"usePollUserDelegates needs publicClient and account\");\n }\n\n // use promise all to better catch errors and have type safety\n const [delegate, currentVotes] = await Promise.all([\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"delegates\",\n args: [account],\n }),\n publicClient.readContract({\n address: config.tokens.bgt,\n abi: bgtAbi,\n functionName: \"getVotes\",\n args: [account],\n }),\n ]);\n\n return {\n delegate: delegate,\n currentVotes: formatEther(currentVotes),\n };\n },\n {\n ...options?.opts,\n refreshInterval: options?.opts?.refreshInterval ?? POLLING.SLOW,\n },\n );\n\n return {\n ...swrResponse,\n refresh: () => swrResponse?.mutate?.(),\n };\n};\n","import useSWR, { type SWRResponse } from \"swr\";\nimport type { Address } from \"viem\";\n\nimport type { ProposalWithVotesFragment } from \"@berachain/graphql/governance\";\nimport { usePublicClient, useTransactionReceipt } from \"@berachain/wagmi/hooks\";\n\nimport { getProposalFromTx } from \"../../actions/governance/getProposalFromTx\";\n\nexport const useProposalFromTx = (\n txHash?: Address,\n): SWRResponse<ProposalWithVotesFragment | null> => {\n const { data: tx } = useTransactionReceipt({\n hash: txHash,\n });\n\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n tx && publicClient ? ([\"useProposalFromTx\", txHash] as const) : null;\n\n const swrResponse = useSWR(QUERY_KEY, async ([, txHash]) => {\n if (!tx) {\n throw new Error(\"Transaction not found\");\n }\n\n // This might happen for some render order issues.\n // Since tx is read by the external scope, it might be outdated.\n // Throwing an error here will cause the hook to re-run with the latest tx object.\n if (tx.transactionHash !== txHash) {\n throw new Error(\"Transaction hash mismatch\");\n }\n\n return getProposalFromTx({ tx, publicClient });\n });\n\n return swrResponse;\n};\n","import type { SWRResponse } from \"swr\";\nimport useSWRImmutable from \"swr/immutable\";\nimport type { Address } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { ProposalState } from \"../../enum/governance\";\nimport { assertPublicClient } from \"../../errors/assert\";\n\nconst ProposalStateMap: Record<ProposalState, string> = {\n [ProposalState.Pending]: \"pending\",\n [ProposalState.Active]: \"active\",\n [ProposalState.Canceled]: \"canceled\",\n [ProposalState.Defeated]: \"defeated\",\n [ProposalState.Succeeded]: \"succeeded\",\n [ProposalState.Queued]: \"queued\",\n [ProposalState.Expired]: \"expired\",\n [ProposalState.Executed]: \"executed\",\n};\n\nexport const useProposalState = ({\n proposalId,\n governorAddress,\n}: {\n proposalId: number | bigint | string | undefined;\n governorAddress: Address;\n}): SWRResponse<string> => {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n governorAddress && publicClient && proposalId\n ? ([\"useProposalState\", proposalId] as const)\n : null;\n\n return useSWRImmutable(QUERY_KEY, async ([, proposalId]) => {\n assertPublicClient(publicClient);\n\n const snapshot = (await publicClient.readContract({\n abi: governanceAbi,\n address: governorAddress,\n functionName: \"state\",\n args: [BigInt(proposalId)],\n })) as ProposalState;\n\n return ProposalStateMap[snapshot];\n });\n};\n","import useSWR, { type SWRResponse } from \"swr\";\nimport type { Address } from \"viem\";\n\nimport { timeLockAbi as governanceTimelockAbi } from \"@berachain/abis/gov/timeLock\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { POLLING } from \"../../enum/polling\";\nimport { assertPublicClient } from \"../../errors/assert\";\n\nconst TimelockOperationState = {\n 0: \"unset\",\n 1: \"waiting\",\n 2: \"ready\",\n 3: \"done\",\n} as const;\n\n/**\n * Fetches the state of a proposal timelock\n * @returns state of the proposal timelock (unset, waiting, ready, done)\n */\nexport function useProposalTimelockState({\n proposalTimelockId,\n timelockAddress,\n}: {\n proposalTimelockId: Address | undefined;\n timelockAddress: Address;\n}): SWRResponse<\n (typeof TimelockOperationState)[keyof typeof TimelockOperationState]\n> {\n const publicClient = usePublicClient();\n\n const QUERY_KEY =\n timelockAddress && publicClient && proposalTimelockId\n ? ([\n \"useProposalTimelockState\",\n proposalTimelockId,\n timelockAddress,\n ] as const)\n : null;\n\n return useSWR(\n QUERY_KEY,\n async ([, proposalTimelockId, timelockAddress]) => {\n assertPublicClient(publicClient);\n\n const snapshot = await publicClient.readContract({\n abi: governanceTimelockAbi,\n address: timelockAddress,\n functionName: \"getOperationState\",\n args: [proposalTimelockId],\n });\n\n return TimelockOperationState[\n snapshot as keyof typeof TimelockOperationState\n ];\n },\n {\n refreshInterval: POLLING.SLOW,\n },\n );\n}\n","import useSWR from \"swr\";\n\nimport { usePublicClient } from \"@berachain/wagmi/hooks\";\n\nimport { getQuorum } from \"../../actions/governance/getQuorum\";\n\n/**\n * Queries the quorum for a given timestamp.\n *\n * @returns current quorum if timestamp is in the future.\n */\nexport function useQuorum(\n { at }: { at: number | string },\n {\n isEnabled = true,\n }: {\n isEnabled?: boolean;\n },\n) {\n const now = Math.floor(Date.now() / 1000);\n const publicClient = usePublicClient();\n const QUERY_KEY =\n isEnabled && publicClient\n ? ([\n \"useQuorum\",\n // Using Now because we cannot query quorum in the future, so no need to have different query keys.\n Number(at) > now ? \"now\" : at,\n ] as const)\n : null;\n\n const response = useSWR(QUERY_KEY, async ([, at]) => {\n if (at === \"now\") {\n return getQuorum({ publicClient });\n }\n return getQuorum({ at, publicClient });\n });\n\n return {\n ...response,\n data: response.data ? Number(response.data) : undefined,\n };\n}\n","import { formatEther, type PublicClient } from \"viem\";\n\nimport { berachainGovernanceAbi as governanceAbi } from \"@berachain/abis/gov/berachainGovernance\";\n\nimport { assertPublicClient } from \"../../errors/assert\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nexport type GetQuorumArgs = BeraJS.BaseFunctionArgs & {\n /** Timestamp in seconds; defaults to now. Returns the current quorum when in the future. */\n at?: number | string;\n publicClient: PublicClient | undefined;\n};\n\n/**\n * Queries the quorum for a given timestamp.\n *\n * @returns current quorum if timestamp is in the future.\n */\nexport async function getQuorum({\n at,\n publicClient,\n ...args\n}: GetQuorumArgs): Promise<string> {\n const { config } = parseBaseArgs(args);\n assertPublicClient(publicClient);\n\n const quorum = await publicClient.readContract({\n address: config.governance.governor,\n abi: governanceAbi,\n functionName: \"quorum\",\n // Needs to be pending or you'll get a ERC5805FutureLookup error when reading current quorum\n // this is because now will always be in the future compared to the latest block\n blockTag: \"pending\",\n args: [BigInt(at ?? Math.floor(Date.now() / 1000))],\n });\n\n return formatEther(quorum);\n}\n"]}
@@ -8,13 +8,13 @@ import * as swr_infinite from 'swr/infinite';
8
8
  import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from 'swr/infinite';
9
9
  import * as _berachain_graphql_governance from '@berachain/graphql/governance';
10
10
  import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
11
- import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-B9nLZ7ul.cjs';
11
+ import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-CicOIudf.cjs';
12
12
  import * as swr__internal from 'swr/_internal';
13
13
  import '../../enum/governance/exports.cjs';
14
14
  import '@wagmi/core';
15
15
  import '@berachain/config';
16
16
  import '../../txnEnum-CwAJN4zV.cjs';
17
- import '../../BeraError-_mQdkanr.cjs';
17
+ import '../../BeraError-7-A5JYy_.cjs';
18
18
 
19
19
  declare const useCreateProposal: ({ initialData, currentTopic, onError, }: {
20
20
  initialData?: any;
@@ -8,13 +8,13 @@ import * as swr_infinite from 'swr/infinite';
8
8
  import { SWRInfiniteResponse, SWRInfiniteKeyLoader } from 'swr/infinite';
9
9
  import * as _berachain_graphql_governance from '@berachain/graphql/governance';
10
10
  import { Proposal_Filter, Proposal_OrderBy, OrderDirection, ProposalStatus, ProposalSelectionFragment, ProposalWithVotesFragment, GetProposalVotesQueryVariables } from '@berachain/graphql/governance';
11
- import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-ylUk_etZ.js';
11
+ import { D as DefaultHookOptions, a as DefaultHookReturnType } from '../../global.d-C4FnE4cz.js';
12
12
  import * as swr__internal from 'swr/_internal';
13
13
  import '../../enum/governance/exports.js';
14
14
  import '@wagmi/core';
15
15
  import '@berachain/config';
16
16
  import '../../txnEnum-CwAJN4zV.js';
17
- import '../../BeraError-_mQdkanr.js';
17
+ import '../../BeraError-7-A5JYy_.js';
18
18
 
19
19
  declare const useCreateProposal: ({ initialData, currentTopic, onError, }: {
20
20
  initialData?: any;
@@ -1,2 +1,2 @@
1
- import{a as c,d as O,e as _,f as x,h as L,i as k}from"../../chunk-H6ZO4SLB.mjs";import"../../chunk-OGJMSGB2.mjs";import"../../chunk-ENT2OSXT.mjs";import"../../chunk-575OK77P.mjs";import{b as p}from"../../chunk-5QAFKFM5.mjs";import{a as f}from"../../chunk-KUQEX7H3.mjs";import"../../chunk-PRLVZIKD.mjs";import"../../chunk-GXV2JA36.mjs";import{useCallback as I,useEffect as $,useState as X}from"react";import H from"gray-matter";import{encodeFunctionData as S,erc20Abi as M,parseAbiItem as q,toHex as z}from"viem";import{beraChefAbi as j}from"@berachain/abis/pol/rewards/beraChef";import{rewardVaultAbi as J}from"@berachain/abis/pol/rewards/rewardVault";function R(t){return Object.values(t).some(r=>Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null?R(o):!!o):typeof r=="object"&&r!==null?R(r):!!r)}function D({proposal:t,currentTopic:r,onError:o}){let s=_({proposal:t,currentTopic:r}),n=[];if(s.actions=t.actions.map((e,i)=>{let l={};if(l.target=c({fieldOrType:"address",value:e.target}),e.type==="custom-action")if(e.input==="ABI")if(l.ABI=c({fieldOrType:"abi",value:e.ABI}),!e.functionSignature)l.functionSignature="Required";else try{let g=q(e.functionSignature);g.type!=="function"?(console.error("parsedSignatureAbi is not a function",g),l.functionSignature="Invalid ABI"):(l.args=g.inputs.map((y,m)=>{try{return"components"in y?c({fieldOrType:y.type,value:e.args?.[m],components:y.components}):c({fieldOrType:y.type,value:e.args?.[m]})}catch{return null}}),l.args.some(y=>y)||(n[i]=S({abi:[g],args:e.args})))}catch{l.functionSignature="Invalid ABI"}else if(e.input==="rawCalldata")l.rawCalldata=c({fieldOrType:"hex",value:e.rawCalldata}),n[i]=e.rawCalldata;else if(e.input==="message")l.message=c({fieldOrType:"string",value:e.message}),n[i]=z(e.message);else throw new Error("Invalid input type");else if(e.type==="whitelist-reward-vault"||e.type==="blacklist-reward-vault"){if(l.vault=c({fieldOrType:"address",value:e.vault}),!l.vault){let g=e.type==="whitelist-reward-vault";n[i]=S({abi:j,functionName:"setVaultWhitelistedStatus",args:[e.vault,g,""]})}}else e.type==="whitelist-reward-vault-incentive"?(l.token=c({fieldOrType:"address",value:e.token}),l.minIncentiveRate=c({fieldOrType:"uint256",value:e.minIncentiveRate}),l.managerAddress=c({fieldOrType:"address",value:e.managerAddress}),!l.token&&!l.minIncentiveRate&&!l.managerAddress&&(n[i]=S({abi:J,functionName:"whitelistIncentiveToken",args:[e.token,BigInt(e.minIncentiveRate),e.managerAddress]}))):e.type==="erc20-transfer"&&(l.amount=c({fieldOrType:"uint256",value:e.amount}),l.to=c({fieldOrType:"address",value:e.to}),!l.amount&&!l.to&&(n[i]=S({abi:M,functionName:"transfer",args:[e.to,BigInt(e.amount)]})));return R(l)?l:null}),o?.(s),Object.getOwnPropertyNames(s).map(e=>s[e]).some(e=>Array.isArray(e)?e.filter(i=>i).length>0:e===null?!1:!!e)){console.warn("Proposal has errors",s);return}if(n.length===0)throw new Error("No actions submitted in proposal");let a=new URL(t.forumLink),u=H.stringify(t.description,{title:t.title,topics:Array.from(t.topic.values()),forumLink:a.toString(),version:"1.0.0","content-encoding":"utf-8","content-type":"text/markdown",actions:t.actions.map(e=>{let i={type:e.type};return e.type==="custom-action"&&(i.inputType=e.input),i})});return[t.actions.map(e=>e.target),t.actions.map(e=>e.value??0n),n,u]}var W={type:"custom-action",target:"",ABI:"",value:0n,functionSignature:"",args:[],input:"ABI",rawCalldata:"0x",message:""},Z=({initialData:t={},currentTopic:r,onError:o})=>{let[s,n]=X({title:"",description:"",forumLink:"",actions:[W],...t,topic:new Set});$(()=>{n(i=>({...i,topic:new Set([r.id])}))},[r]);let a=I(()=>{n(i=>({...i,actions:[...i.actions,W]}))},[]),u=I(i=>{n(l=>{let A=[...l.actions];return A.splice(i,1),{...l,actions:A}})},[n]),e=I(()=>s?D({proposal:s,currentTopic:r,onError:o}):void 0,[s,r]);return{proposal:s,setProposal:n,addProposalAction:a,removeProposalAction:u,computeParamsAndErrors:e}};import oe from"swr/immutable";import{formatUnits as se}from"viem";import{bgtAbi as ne}from"@berachain/abis/pol/bgt";import{useBeraWallet as ae,usePublicClient as ie}from"@berachain/wagmi/hooks";import ee from"swr/immutable";import{berachainGovernanceAbi as te}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as re}from"@berachain/wagmi/hooks";var N=({proposalId:t})=>{let r=re();return ee(r&&t?["useProposalSnapshot",t]:null,async([,s])=>{p(r);let{config:n}=f({chainId:r.chain.id});return(await r.readContract({abi:te,address:n.governance.governor,functionName:"proposalSnapshot",args:[BigInt(s)]})).toString()})};var St=t=>{let{address:r}=ae(),o=ie(),s=t.wallet||r,{data:n}=N({proposalId:t.proposalId}),a=t.timepoint||n;return oe(a&&o&&s?["useGetPastVotes",a,s]:null,async([,e,i])=>{p(o);let{config:l}=f({chainId:o.chain.id});if(Number(e)>Date.now()/1e3)throw new Error("timepoint is in the future");let A=await o.readContract({abi:ne,address:l.tokens.bgt,functionName:"getPastVotes",args:[i,BigInt(e)]});return se(A,18)})};import le from"swr";import{isAddress as ue}from"viem";import{berachainGovernanceAbi as pe}from"@berachain/abis/gov/berachainGovernance";import{useBeraWallet as me,usePublicClient as ce}from"@berachain/wagmi/hooks";var _t=({proposalId:t,wallet:r})=>{let{address:o}=me(),s=ce(),n=r||o;return le(s&&n&&ue(n)?["useHasVoted",t,n]:null,([,a,u])=>{p(s);let{config:e}=f({chainId:s.chain.id});return s.readContract({address:e.governance.governor,abi:pe,functionName:"hasVoted",args:[BigInt(a),u]})})};import fe from"swr";import{timeLockAbi as de}from"@berachain/abis/gov/timeLock";import{usePublicClient as Pe}from"@berachain/wagmi/hooks";var U="0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783";var Bt=({account:t,...r})=>{let o=Pe(),{config:s}=f(r);return fe(t&&o?["useCancellerRole",t]:null,async([,a])=>(p(o),await o.readContract({abi:de,address:s.governance.timelock,functionName:"hasRole",args:[U,a]})),{refreshInterval:18e4,revalidateOnFocus:!1})};import{useEffect as Y,useMemo as ge,useState as be}from"react";import ye from"swr/infinite";import{Proposal_OrderBy as Ae,ProposalStatus as P}from"@berachain/graphql/governance";var B=10,he=t=>{switch(t){case P.QuorumNotReached:return[P.Active,P.Pending];case P.PendingQueue:case P.Defeated:return[P.Active];case P.PendingExecution:return[P.InQueue];default:return[t]}};function Re(t,r={}){let o=2*(r.perPage??B);return(s,n)=>{if(s!==0&&n&&n.length<o)return null;let a=r.status_in?.flatMap(he).filter((u,e,i)=>i.indexOf(u)===e);return["usePollAllProposals",s,t,r.where,a,r.orderBy,r.orderDirection,o,r.text]}}function Ht(t,r){let o=r?.autoRefresh??!1,s=t.perPage??B,n=2*s,a=Re(t.topic,t);async function u(m){if(!m)return[];let[,b,d,v,h,K,F,w,G]=m;return(await O({where:{topics_contains:[d],status_in:h?.length?h:void 0,...v},orderBy:K,orderDirection:F,text:G,perPage:w,offset:b*w})??[]).filter(Boolean)}let e=ye(a,u,{initialSize:1,refreshInterval:r?.opts?.refreshInterval??18e4,...r?.opts}),i=ge(()=>{if(!e.data)return[];let m=e.data.flat().filter(d=>d?t.status_in?.length?t.status_in.includes(d.status):!0:!1).sort((d,v)=>{if(!t.text)return 0;if(t.orderBy===Ae.CreatedAt){let h=Number(v.createdAt)-Number(d.createdAt);return t.orderDirection==="asc"?h:-h}return 0}),b=[];for(let d=0;d<m.length;d+=s)b.push(m.slice(d,d+s));return b},[e.data,t,s]),l=e.data?.[e.data.length-1],A=!!l&&l.length===n,[g,y]=be(Date.now()/1e3);return Y(()=>{if(!o)return;let m=setInterval(()=>{y(Date.now()/1e3)},1e4);return()=>clearInterval(m)},[o]),Y(()=>{if(!e.data)return;let m=!1;for(let b of e.data.flat()){switch(b.status){case P.Pending:g>=Number(b.voteStartAt)&&(m=!0);break;case P.Active:g>=Number(b.voteEndAt)&&(m=!0);break;case P.InQueue:Date.now()/1e3+1>=Number(b.queueEnd)&&(m=!0);break;default:break}if(m)break}m&&e.mutate()},[e.data,g]),{...e,data:i,hasMore:A}}import{useEffect as Q,useState as Se}from"react";import Ee from"swr";import{ProposalStatus as C}from"@berachain/graphql/governance";import{usePublicClient as ve}from"@berachain/wagmi/hooks";var Zt=(t,r)=>{let o=r?.autoRefresh??!1,s=ve(),a=Ee(t&&s?["usePollProposal",t]:null,([,i])=>(p(s),x({proposalId:i,client:s})),{...r?.opts,refreshInterval:r?.opts?.refreshInterval??18e4}),[u,e]=Se(Date.now());return Q(()=>{if(!o)return;let i=setInterval(()=>{e(Date.now()/1e3)},1e4);return()=>clearInterval(i)},[]),Q(()=>{if(a.data!==void 0)switch(a.data.status){case C.Pending:u>=Number(a.data.voteStartAt)&&a.mutate();break;case C.Active:u>=Number(a.data.voteEndAt)&&a.mutate();break;case C.InQueue:Date.now()/1e3+1>=Number(a.data.queueEnd)&&a.mutate();break}},[a.data?.status,u]),{...a,refresh:()=>a?.mutate?.()}};import Ie from"swr";import{formatEther as Ce}from"viem";import{berachainGovernanceAbi as Te}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as we}from"@berachain/wagmi/hooks";var ar=t=>{let r=we(),s=Ie(r?["usePollProposalThreshold",t]:null,async([,n])=>{p(r);let a=await r.readContract({address:n,abi:Te,functionName:"proposalThreshold"});return{votesThreshold:Ce(a)}},{refreshInterval:18e4});return{...s,refresh:s.mutate}};import Oe from"swr/infinite";var E=1e3,pr=(t,r)=>Oe(_e(t,r),async([o,s])=>k({variables:{...t,limit:E,offset:E*s}}),{parallel:!0,initialSize:Number.POSITIVE_INFINITY}),_e=({...t},r)=>o=>o>Math.floor(r/E)?null:["usePollProposalVotes",o,E,t.proposalId,t.orderBy,t.orderDirection];import xe from"swr";import{formatEther as Le}from"viem";import{bgtAbi as V}from"@berachain/abis/pol/bgt";import{useBeraWallet as ke,usePublicClient as De}from"@berachain/wagmi/hooks";var yr=t=>{let{address:r}=ke(),o=De(),n=xe(r?["usePollUserDelegates",r]:null,async([,a])=>{p(o);let{config:u}=f({chainId:o.chain.id});if(!o||!a)throw new Error("usePollUserDelegates needs publicClient and account");let[e,i]=await Promise.all([o.readContract({address:u.tokens.bgt,abi:V,functionName:"delegates",args:[a]}),o.readContract({address:u.tokens.bgt,abi:V,functionName:"getVotes",args:[a]})]);return{delegate:e,currentVotes:Le(i)}},{...t?.opts,refreshInterval:t?.opts?.refreshInterval??18e4});return{...n,refresh:()=>n?.mutate?.()}};import We from"swr";import{usePublicClient as Ne,useTransactionReceipt as Ue}from"@berachain/wagmi/hooks";var Er=t=>{let{data:r}=Ue({hash:t}),o=Ne();return We(r&&o?["useProposalFromTx",t]:null,async([,a])=>{if(!r)throw new Error("Transaction not found");if(r.transactionHash!==a)throw new Error("Transaction hash mismatch");return L({tx:r,publicClient:o})})};import Ye from"swr/immutable";import{berachainGovernanceAbi as Be}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as Qe}from"@berachain/wagmi/hooks";var Ve={0:"pending",1:"active",2:"canceled",3:"defeated",4:"succeeded",5:"queued",6:"expired",7:"executed"},Or=({proposalId:t,governorAddress:r})=>{let o=Qe();return Ye(r&&o&&t?["useProposalState",t]:null,async([,n])=>{p(o);let a=await o.readContract({abi:Be,address:r,functionName:"state",args:[BigInt(n)]});return Ve[a]})};import Ke from"swr";import{timeLockAbi as Fe}from"@berachain/abis/gov/timeLock";import{usePublicClient as Ge}from"@berachain/wagmi/hooks";var He={0:"unset",1:"waiting",2:"ready",3:"done"};function Wr({proposalTimelockId:t,timelockAddress:r}){let o=Ge();return Ke(r&&o&&t?["useProposalTimelockState",t,r]:null,async([,n,a])=>{p(o);let u=await o.readContract({abi:Fe,address:a,functionName:"getOperationState",args:[n]});return He[u]},{refreshInterval:18e4})}import ze from"swr";import{usePublicClient as je}from"@berachain/wagmi/hooks";import{formatEther as Me}from"viem";import{berachainGovernanceAbi as qe}from"@berachain/abis/gov/berachainGovernance";async function T({at:t,publicClient:r,...o}){let{config:s}=f(o);p(r);let n=await r.readContract({address:s.governance.governor,abi:qe,functionName:"quorum",blockTag:"pending",args:[BigInt(t??Math.floor(Date.now()/1e3))]});return Me(n)}function Hr({at:t},{isEnabled:r=!0}){let o=Math.floor(Date.now()/1e3),s=je(),n=r&&s?["useQuorum",Number(t)>o?"now":t]:null,a=ze(n,async([,u])=>u==="now"?T({publicClient:s}):T({at:u,publicClient:s}));return{...a,data:a.data?Number(a.data):void 0}}export{Z as useCreateProposal,St as useGetPastVotes,_t as useHasVoted,Bt as useIsCanceller,Ht as usePollAllProposals,Re as usePollAllProposalsQueryKey,Zt as usePollProposal,ar as usePollProposalThreshold,pr as usePollProposalVotes,_e as usePollProposalVotesQueryKey,yr as usePollUserDelegates,Er as useProposalFromTx,N as useProposalSnapshot,Or as useProposalState,Wr as useProposalTimelockState,Hr as useQuorum};
1
+ import"../../chunk-575OK77P.mjs";import{a as c,d as O,e as _,f as x,h as L,i as k}from"../../chunk-LUNZGZWN.mjs";import"../../chunk-OGJMSGB2.mjs";import"../../chunk-5XOEJ6XX.mjs";import{a as f}from"../../chunk-JHUVLM54.mjs";import"../../chunk-PRLVZIKD.mjs";import{b as p}from"../../chunk-TU63NRNL.mjs";import"../../chunk-5SIQ7BKT.mjs";import{useCallback as I,useEffect as $,useState as X}from"react";import H from"gray-matter";import{encodeFunctionData as S,erc20Abi as M,parseAbiItem as q,toHex as z}from"viem";import{beraChefAbi as j}from"@berachain/abis/pol/rewards/beraChef";import{rewardVaultAbi as J}from"@berachain/abis/pol/rewards/rewardVault";function R(t){return Object.values(t).some(r=>Array.isArray(r)?r.some(o=>typeof o=="object"&&o!==null?R(o):!!o):typeof r=="object"&&r!==null?R(r):!!r)}function D({proposal:t,currentTopic:r,onError:o}){let s=_({proposal:t,currentTopic:r}),n=[];if(s.actions=t.actions.map((e,i)=>{let l={};if(l.target=c({fieldOrType:"address",value:e.target}),e.type==="custom-action")if(e.input==="ABI")if(l.ABI=c({fieldOrType:"abi",value:e.ABI}),!e.functionSignature)l.functionSignature="Required";else try{let g=q(e.functionSignature);g.type!=="function"?(console.error("parsedSignatureAbi is not a function",g),l.functionSignature="Invalid ABI"):(l.args=g.inputs.map((y,m)=>{try{return"components"in y?c({fieldOrType:y.type,value:e.args?.[m],components:y.components}):c({fieldOrType:y.type,value:e.args?.[m]})}catch{return null}}),l.args.some(y=>y)||(n[i]=S({abi:[g],args:e.args})))}catch{l.functionSignature="Invalid ABI"}else if(e.input==="rawCalldata")l.rawCalldata=c({fieldOrType:"hex",value:e.rawCalldata}),n[i]=e.rawCalldata;else if(e.input==="message")l.message=c({fieldOrType:"string",value:e.message}),n[i]=z(e.message);else throw new Error("Invalid input type");else if(e.type==="whitelist-reward-vault"||e.type==="blacklist-reward-vault"){if(l.vault=c({fieldOrType:"address",value:e.vault}),!l.vault){let g=e.type==="whitelist-reward-vault";n[i]=S({abi:j,functionName:"setVaultWhitelistedStatus",args:[e.vault,g,""]})}}else e.type==="whitelist-reward-vault-incentive"?(l.token=c({fieldOrType:"address",value:e.token}),l.minIncentiveRate=c({fieldOrType:"uint256",value:e.minIncentiveRate}),l.managerAddress=c({fieldOrType:"address",value:e.managerAddress}),!l.token&&!l.minIncentiveRate&&!l.managerAddress&&(n[i]=S({abi:J,functionName:"whitelistIncentiveToken",args:[e.token,BigInt(e.minIncentiveRate),e.managerAddress]}))):e.type==="erc20-transfer"&&(l.amount=c({fieldOrType:"uint256",value:e.amount}),l.to=c({fieldOrType:"address",value:e.to}),!l.amount&&!l.to&&(n[i]=S({abi:M,functionName:"transfer",args:[e.to,BigInt(e.amount)]})));return R(l)?l:null}),o?.(s),Object.getOwnPropertyNames(s).map(e=>s[e]).some(e=>Array.isArray(e)?e.filter(i=>i).length>0:e===null?!1:!!e)){console.warn("Proposal has errors",s);return}if(n.length===0)throw new Error("No actions submitted in proposal");let a=new URL(t.forumLink),u=H.stringify(t.description,{title:t.title,topics:Array.from(t.topic.values()),forumLink:a.toString(),version:"1.0.0","content-encoding":"utf-8","content-type":"text/markdown",actions:t.actions.map(e=>{let i={type:e.type};return e.type==="custom-action"&&(i.inputType=e.input),i})});return[t.actions.map(e=>e.target),t.actions.map(e=>e.value??0n),n,u]}var W={type:"custom-action",target:"",ABI:"",value:0n,functionSignature:"",args:[],input:"ABI",rawCalldata:"0x",message:""},Z=({initialData:t={},currentTopic:r,onError:o})=>{let[s,n]=X({title:"",description:"",forumLink:"",actions:[W],...t,topic:new Set});$(()=>{n(i=>({...i,topic:new Set([r.id])}))},[r]);let a=I(()=>{n(i=>({...i,actions:[...i.actions,W]}))},[]),u=I(i=>{n(l=>{let A=[...l.actions];return A.splice(i,1),{...l,actions:A}})},[n]),e=I(()=>s?D({proposal:s,currentTopic:r,onError:o}):void 0,[s,r]);return{proposal:s,setProposal:n,addProposalAction:a,removeProposalAction:u,computeParamsAndErrors:e}};import oe from"swr/immutable";import{formatUnits as se}from"viem";import{bgtAbi as ne}from"@berachain/abis/pol/bgt";import{useBeraWallet as ae,usePublicClient as ie}from"@berachain/wagmi/hooks";import ee from"swr/immutable";import{berachainGovernanceAbi as te}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as re}from"@berachain/wagmi/hooks";var N=({proposalId:t})=>{let r=re();return ee(r&&t?["useProposalSnapshot",t]:null,async([,s])=>{p(r);let{config:n}=f({chainId:r.chain.id});return(await r.readContract({abi:te,address:n.governance.governor,functionName:"proposalSnapshot",args:[BigInt(s)]})).toString()})};var St=t=>{let{address:r}=ae(),o=ie(),s=t.wallet||r,{data:n}=N({proposalId:t.proposalId}),a=t.timepoint||n;return oe(a&&o&&s?["useGetPastVotes",a,s]:null,async([,e,i])=>{p(o);let{config:l}=f({chainId:o.chain.id});if(Number(e)>Date.now()/1e3)throw new Error("timepoint is in the future");let A=await o.readContract({abi:ne,address:l.tokens.bgt,functionName:"getPastVotes",args:[i,BigInt(e)]});return se(A,18)})};import le from"swr";import{isAddress as ue}from"viem";import{berachainGovernanceAbi as pe}from"@berachain/abis/gov/berachainGovernance";import{useBeraWallet as me,usePublicClient as ce}from"@berachain/wagmi/hooks";var _t=({proposalId:t,wallet:r})=>{let{address:o}=me(),s=ce(),n=r||o;return le(s&&n&&ue(n)?["useHasVoted",t,n]:null,([,a,u])=>{p(s);let{config:e}=f({chainId:s.chain.id});return s.readContract({address:e.governance.governor,abi:pe,functionName:"hasVoted",args:[BigInt(a),u]})})};import fe from"swr";import{timeLockAbi as de}from"@berachain/abis/gov/timeLock";import{usePublicClient as Pe}from"@berachain/wagmi/hooks";var U="0xfd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783";var Bt=({account:t,...r})=>{let o=Pe(),{config:s}=f(r);return fe(t&&o?["useCancellerRole",t]:null,async([,a])=>(p(o),await o.readContract({abi:de,address:s.governance.timelock,functionName:"hasRole",args:[U,a]})),{refreshInterval:18e4,revalidateOnFocus:!1})};import{useEffect as Y,useMemo as ge,useState as be}from"react";import ye from"swr/infinite";import{Proposal_OrderBy as Ae,ProposalStatus as P}from"@berachain/graphql/governance";var B=10,he=t=>{switch(t){case P.QuorumNotReached:return[P.Active,P.Pending];case P.PendingQueue:case P.Defeated:return[P.Active];case P.PendingExecution:return[P.InQueue];default:return[t]}};function Re(t,r={}){let o=2*(r.perPage??B);return(s,n)=>{if(s!==0&&n&&n.length<o)return null;let a=r.status_in?.flatMap(he).filter((u,e,i)=>i.indexOf(u)===e);return["usePollAllProposals",s,t,r.where,a,r.orderBy,r.orderDirection,o,r.text]}}function Ht(t,r){let o=r?.autoRefresh??!1,s=t.perPage??B,n=2*s,a=Re(t.topic,t);async function u(m){if(!m)return[];let[,b,d,v,h,K,F,w,G]=m;return(await O({where:{topics_contains:[d],status_in:h?.length?h:void 0,...v},orderBy:K,orderDirection:F,text:G,perPage:w,offset:b*w})??[]).filter(Boolean)}let e=ye(a,u,{initialSize:1,refreshInterval:r?.opts?.refreshInterval??18e4,...r?.opts}),i=ge(()=>{if(!e.data)return[];let m=e.data.flat().filter(d=>d?t.status_in?.length?t.status_in.includes(d.status):!0:!1).sort((d,v)=>{if(!t.text)return 0;if(t.orderBy===Ae.CreatedAt){let h=Number(v.createdAt)-Number(d.createdAt);return t.orderDirection==="asc"?h:-h}return 0}),b=[];for(let d=0;d<m.length;d+=s)b.push(m.slice(d,d+s));return b},[e.data,t,s]),l=e.data?.[e.data.length-1],A=!!l&&l.length===n,[g,y]=be(Date.now()/1e3);return Y(()=>{if(!o)return;let m=setInterval(()=>{y(Date.now()/1e3)},1e4);return()=>clearInterval(m)},[o]),Y(()=>{if(!e.data)return;let m=!1;for(let b of e.data.flat()){switch(b.status){case P.Pending:g>=Number(b.voteStartAt)&&(m=!0);break;case P.Active:g>=Number(b.voteEndAt)&&(m=!0);break;case P.InQueue:Date.now()/1e3+1>=Number(b.queueEnd)&&(m=!0);break;default:break}if(m)break}m&&e.mutate()},[e.data,g]),{...e,data:i,hasMore:A}}import{useEffect as Q,useState as Se}from"react";import Ee from"swr";import{ProposalStatus as C}from"@berachain/graphql/governance";import{usePublicClient as ve}from"@berachain/wagmi/hooks";var Zt=(t,r)=>{let o=r?.autoRefresh??!1,s=ve(),a=Ee(t&&s?["usePollProposal",t]:null,([,i])=>(p(s),x({proposalId:i,client:s})),{...r?.opts,refreshInterval:r?.opts?.refreshInterval??18e4}),[u,e]=Se(Date.now());return Q(()=>{if(!o)return;let i=setInterval(()=>{e(Date.now()/1e3)},1e4);return()=>clearInterval(i)},[]),Q(()=>{if(a.data!==void 0)switch(a.data.status){case C.Pending:u>=Number(a.data.voteStartAt)&&a.mutate();break;case C.Active:u>=Number(a.data.voteEndAt)&&a.mutate();break;case C.InQueue:Date.now()/1e3+1>=Number(a.data.queueEnd)&&a.mutate();break}},[a.data?.status,u]),{...a,refresh:()=>a?.mutate?.()}};import Ie from"swr";import{formatEther as Ce}from"viem";import{berachainGovernanceAbi as Te}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as we}from"@berachain/wagmi/hooks";var ar=t=>{let r=we(),s=Ie(r?["usePollProposalThreshold",t]:null,async([,n])=>{p(r);let a=await r.readContract({address:n,abi:Te,functionName:"proposalThreshold"});return{votesThreshold:Ce(a)}},{refreshInterval:18e4});return{...s,refresh:s.mutate}};import Oe from"swr/infinite";var E=1e3,pr=(t,r)=>Oe(_e(t,r),async([o,s])=>k({variables:{...t,limit:E,offset:E*s}}),{parallel:!0,initialSize:Number.POSITIVE_INFINITY}),_e=({...t},r)=>o=>o>Math.floor(r/E)?null:["usePollProposalVotes",o,E,t.proposalId,t.orderBy,t.orderDirection];import xe from"swr";import{formatEther as Le}from"viem";import{bgtAbi as V}from"@berachain/abis/pol/bgt";import{useBeraWallet as ke,usePublicClient as De}from"@berachain/wagmi/hooks";var yr=t=>{let{address:r}=ke(),o=De(),n=xe(r?["usePollUserDelegates",r]:null,async([,a])=>{p(o);let{config:u}=f({chainId:o.chain.id});if(!o||!a)throw new Error("usePollUserDelegates needs publicClient and account");let[e,i]=await Promise.all([o.readContract({address:u.tokens.bgt,abi:V,functionName:"delegates",args:[a]}),o.readContract({address:u.tokens.bgt,abi:V,functionName:"getVotes",args:[a]})]);return{delegate:e,currentVotes:Le(i)}},{...t?.opts,refreshInterval:t?.opts?.refreshInterval??18e4});return{...n,refresh:()=>n?.mutate?.()}};import We from"swr";import{usePublicClient as Ne,useTransactionReceipt as Ue}from"@berachain/wagmi/hooks";var Er=t=>{let{data:r}=Ue({hash:t}),o=Ne();return We(r&&o?["useProposalFromTx",t]:null,async([,a])=>{if(!r)throw new Error("Transaction not found");if(r.transactionHash!==a)throw new Error("Transaction hash mismatch");return L({tx:r,publicClient:o})})};import Ye from"swr/immutable";import{berachainGovernanceAbi as Be}from"@berachain/abis/gov/berachainGovernance";import{usePublicClient as Qe}from"@berachain/wagmi/hooks";var Ve={0:"pending",1:"active",2:"canceled",3:"defeated",4:"succeeded",5:"queued",6:"expired",7:"executed"},Or=({proposalId:t,governorAddress:r})=>{let o=Qe();return Ye(r&&o&&t?["useProposalState",t]:null,async([,n])=>{p(o);let a=await o.readContract({abi:Be,address:r,functionName:"state",args:[BigInt(n)]});return Ve[a]})};import Ke from"swr";import{timeLockAbi as Fe}from"@berachain/abis/gov/timeLock";import{usePublicClient as Ge}from"@berachain/wagmi/hooks";var He={0:"unset",1:"waiting",2:"ready",3:"done"};function Wr({proposalTimelockId:t,timelockAddress:r}){let o=Ge();return Ke(r&&o&&t?["useProposalTimelockState",t,r]:null,async([,n,a])=>{p(o);let u=await o.readContract({abi:Fe,address:a,functionName:"getOperationState",args:[n]});return He[u]},{refreshInterval:18e4})}import ze from"swr";import{usePublicClient as je}from"@berachain/wagmi/hooks";import{formatEther as Me}from"viem";import{berachainGovernanceAbi as qe}from"@berachain/abis/gov/berachainGovernance";async function T({at:t,publicClient:r,...o}){let{config:s}=f(o);p(r);let n=await r.readContract({address:s.governance.governor,abi:qe,functionName:"quorum",blockTag:"pending",args:[BigInt(t??Math.floor(Date.now()/1e3))]});return Me(n)}function Hr({at:t},{isEnabled:r=!0}){let o=Math.floor(Date.now()/1e3),s=je(),n=r&&s?["useQuorum",Number(t)>o?"now":t]:null,a=ze(n,async([,u])=>u==="now"?T({publicClient:s}):T({at:u,publicClient:s}));return{...a,data:a.data?Number(a.data):void 0}}export{Z as useCreateProposal,St as useGetPastVotes,_t as useHasVoted,Bt as useIsCanceller,Ht as usePollAllProposals,Re as usePollAllProposalsQueryKey,Zt as usePollProposal,ar as usePollProposalThreshold,pr as usePollProposalVotes,_e as usePollProposalVotesQueryKey,yr as usePollUserDelegates,Er as useProposalFromTx,N as useProposalSnapshot,Or as useProposalState,Wr as useProposalTimelockState,Hr as useQuorum};
2
2
  //# sourceMappingURL=exports.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/types/exports.cjs"],"names":[],"mappings":"AAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/types/exports.cjs"}
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/types/exports.cjs"],"names":[],"mappings":"AAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/types/exports.cjs"}
@@ -3,7 +3,7 @@ import { M as MinimalERC20 } from '../HoneyConfigProvider-DfkjmzEf.cjs';
3
3
  export { A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, y as BexStatus, w as Calldata, H as HoneySwapActions, I as IAggregatorArgs, z as IAggregatorQuote, g as IRawAggregatorQuote, v as IUserPosition, h as PythPriceFeedMap, S as SwapRequest, b as Token, i as TokenCurrentPriceMap, x as TokenPriceInfo, t as TokenWithAmount, a as TokenWithMetadata, D as TokenWithPrice } from '../HoneyConfigProvider-DfkjmzEf.cjs';
4
4
  import { BundleData, EnsoClient } from '@ensofinance/sdk';
5
5
  import { TransactionRequest, Address, Hex, PublicClient } from 'viem';
6
- export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-B9nLZ7ul.cjs';
6
+ export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-CicOIudf.cjs';
7
7
  import '@berachain/graphql/pol/api';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
@@ -13,7 +13,7 @@ import '@wagmi/core';
13
13
  import 'swr';
14
14
  import '@berachain/config';
15
15
  import '../txnEnum-CwAJN4zV.cjs';
16
- import '../BeraError-_mQdkanr.cjs';
16
+ import '../BeraError-7-A5JYy_.cjs';
17
17
 
18
18
  type Quantity = string | number;
19
19
  type ActionOutputReference<T> = T | StrictOutputReference<T>;
@@ -3,7 +3,7 @@ import { M as MinimalERC20 } from '../HoneyConfigProvider-DVP_9KZn.js';
3
3
  export { A as AllowanceQueryItem, j as AllowanceToken, B as BalanceToken, y as BexStatus, w as Calldata, H as HoneySwapActions, I as IAggregatorArgs, z as IAggregatorQuote, g as IRawAggregatorQuote, v as IUserPosition, h as PythPriceFeedMap, S as SwapRequest, b as Token, i as TokenCurrentPriceMap, x as TokenPriceInfo, t as TokenWithAmount, a as TokenWithMetadata, D as TokenWithPrice } from '../HoneyConfigProvider-DVP_9KZn.js';
4
4
  import { BundleData, EnsoClient } from '@ensofinance/sdk';
5
5
  import { TransactionRequest, Address, Hex, PublicClient } from 'viem';
6
- export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-ylUk_etZ.js';
6
+ export { D as DefaultHookOptions, a as DefaultHookReturnType, I as IContractWrite, c as IContractWriteFn } from '../global.d-C4FnE4cz.js';
7
7
  import '@berachain/graphql/pol/api';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
@@ -13,7 +13,7 @@ import '@wagmi/core';
13
13
  import 'swr';
14
14
  import '@berachain/config';
15
15
  import '../txnEnum-CwAJN4zV.js';
16
- import '../BeraError-_mQdkanr.js';
16
+ import '../BeraError-7-A5JYy_.js';
17
17
 
18
18
  type Quantity = string | number;
19
19
  type ActionOutputReference<T> = T | StrictOutputReference<T>;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/types/governance/exports.cjs"],"names":[],"mappings":"AAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/types/governance/exports.cjs"}
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/types/governance/exports.cjs"],"names":[],"mappings":"AAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/types/governance/exports.cjs"}