@berachain/berajs 0.2.8-beta.10 → 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-D8byjWYx.d.ts → global.d-C4FnE4cz.d.ts} +2 -2
  77. package/dist/{global.d-B2WavzCY.d.cts → global.d-CicOIudf.d.cts} +2 -2
  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 +57 -19
  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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-GEIY554A.cjs","../src/actions/clients/getEnsoClient.ts"],"names":["isProduction","getEnsoClient","useProxy","args","config","parseBaseArgs","EnsoClient"],"mappings":"AAAA,yuBAAmC,wDAAyC,wDAAyC,wDAAuD,uCCAjJ,sDAED,IAIpBA,CAAAA,CACJ,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,aAAA,EAAiB,OAAA,CAAQ,GAAA,CAAI,QAAA,GAAa,MAAA,CAE9D,SAASC,CAAAA,CAAc,CAC5B,QAAA,CAAAC,CAAAA,CAAWF,CAAAA,CACX,GAAGG,CACL,CAAA,CAAsD,CAAC,CAAA,CAAG,CACxD,GAAM,CAAE,MAAA,CAAAC,CAAO,CAAA,CAAIC,iCAAAA,CAAkB,CAAA,CACrC,OAAO,IAAIC,oBAAAA,CAAW,CACpB,OAAA,CAASJ,CAAAA,CACL,CAAA,EAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-GEIY554A.cjs","sourcesContent":[null,"import { EnsoClient } from \"@ensofinance/sdk\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nconst isProduction =\n process.env.NODE_ENV !== \"development\" && process.env.NODE_ENV !== \"test\";\n\nexport function getEnsoClient({\n useProxy = isProduction,\n ...args\n}: BeraJS.BaseFunctionArgs & { useProxy?: boolean } = {}) {\n const { config } = parseBaseArgs(args);\n return new EnsoClient({\n baseURL: useProxy\n ? `${config.bex.aggregatorsProxyUrl}/enso/api/v1/`\n : undefined,\n apiKey: useProxy\n ? // no API key since proxy has CORS for .berachain.com domains\n \"\"\n : appConfig.apiKeys.public.enso,\n });\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{h as a}from"./chunk-GXV2JA36.mjs";import{chainConfigs as o,defaultChainId as e}from"@berachain/config/internal";function t(n){let c=n.chainId??e,i=n.config??o[c];if(n.chainId&&n.chainId!==i.chainId)throw new a({property:"chainId",value:c,expected:`config.chainId: ${i.chainId}`});return{config:i,chainId:i.chainId}}export{t as a};
2
- //# sourceMappingURL=chunk-KUQEX7H3.mjs.map
1
+ import{j as a}from"./chunk-5SIQ7BKT.mjs";import{chainConfigs as o,defaultChainId as e}from"@berachain/config/internal";function t(n){let c=n.chainId??e,i=n.config??o[c];if(n.chainId&&n.chainId!==i.chainId)throw new a({property:"chainId",value:c,expected:`config.chainId: ${i.chainId}`});return{config:i,chainId:i.chainId}}export{t as a};
2
+ //# sourceMappingURL=chunk-JHUVLM54.mjs.map
@@ -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(); } } 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 _chunkXZC34BHMcjs = require('./chunk-XZC34BHM.cjs');var _chunkY2FETC6Tcjs = require('./chunk-Y2FETC6T.cjs');var _chunkDDEQFR3Mcjs = require('./chunk-DDEQFR3M.cjs');var _chunk54BTOQE3cjs = require('./chunk-54BTOQE3.cjs');var _chunkQVIAMSZ6cjs = require('./chunk-QVIAMSZ6.cjs');var _chunk6JJIZCVYcjs = require('./chunk-6JJIZCVY.cjs');var _react = require('react');var _edgeconfig = require('@berachain/config/internal/edge-config');var _jsxruntime = require('react/jsx-runtime');var W=_react.createContext.call(void 0, void 0);function pe({children:e,flags:t,aggregators:a,swberaAprWindow:n="DAY"}){return _jsxruntime.jsx.call(void 0, W.Provider,{value:{..._chunkDDEQFR3Mcjs.a,...t,aggregators:a?Object.entries(a).filter(([,r])=>_edgeconfig.isFlagEnabled.call(void 0, r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function D(){let e=_react.useContext.call(void 0, W);if(!e)throw new Error("BeraFlagsProvider not found");return e}function fe(e){return D()[e]}var w=_react.createContext.call(void 0, {protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Te(){let e=_react.useContext.call(void 0, w);if(!e)throw new (0, _chunk6JJIZCVYcjs.f)({level:"fatal",message:"BexStateContext is not defined"});return e}function he({children:e,isVaultPaused:t,labels:a,factories:n}){let[r,u]=_react.useState.call(void 0, ),s=_nullishCoalesce((_optionalChain([r, 'optionalAccess', _2 => _2.isPaused])&&!_optionalChain([r, 'optionalAccess', _3 => _3.isInRecoveryMode])), () => (!1)),l=t||_optionalChain([r, 'optionalAccess', _4 => _4.isPaused]);return _jsxruntime.jsx.call(void 0, w.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:a,onPoolChange:u,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!l}:void 0},children:e})}var _mainnet = require('@berachain/config/mainnet');function ve(){return _react.useContext.call(void 0, F)}var F=_react.createContext.call(void 0, _mainnet.mainnet.averageBlockTime);function Ee({children:e,blockTime:t,...a}){let{config:n}=_chunkQVIAMSZ6cjs.a.call(void 0, a);return _jsxruntime.jsx.call(void 0, F.Provider,{value:_nullishCoalesce(t, () => (n.averageBlockTime)),children:e})}var L=_react.createContext.call(void 0, void 0);function Fe({children:e,...t}){return _jsxruntime.jsx.call(void 0, L.Provider,{value:t,children:e})}function Le(){let e=_react.useContext.call(void 0, L);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}var _swr = require('swr'); var _swr2 = _interopRequireDefault(_swr);var _hooks = require('@berachain/wagmi/hooks');var _core = require('@wagmi/core');var _viem = require('viem');async function R({account:e,wagmiConfig:t,chainId:a,ensoClient:n}){let u=(await n.getBalances({useEoa:!0,chainId:_nullishCoalesce(a, () => ("all")),eoaAddress:e})).map(o=>({name:o.name,symbol:o.symbol,decimals:o.decimals,address:_chunk54BTOQE3cjs.d.call(void 0, o.token,"ETH")?_chunk54BTOQE3cjs.a.address:o.token,logoURI:o.logoUri,balance:{raw:o.amount.toString(),formatted:_viem.formatUnits.call(void 0, BigInt(o.amount),o.decimals)},chainId:Number(o.chainId),price:Number(o.price)})),s=Object.groupBy(u,o=>_nullishCoalesce(o.chainId, () => (0))),l=await Promise.allSettled(Object.entries(s).map(async([o,i])=>{if(!i)return;let p=_core.getChains.call(void 0, t).find(d=>d.id===Number(o));if(!p)return;let k=_optionalChain([p, 'access', _5 => _5.contracts, 'optionalAccess', _6 => _6.multicall3, 'optionalAccess', _7 => _7.address]);if(!k)return _chunkY2FETC6Tcjs.b.captureException(new (0, _chunk6JJIZCVYcjs.h)({property:"multicallAddress",value:k,expected:"Address",chainId:Number(o)})),i;let f=await _core.multicall.call(void 0, t,{chainId:Number(o),contracts:i.map(d=>_chunkXZC34BHMcjs.b.call(void 0, {token:d,account:e,multicallAddress:k})),allowFailure:!0}),x=[];for(let d=0;d<i.length;d++){let T=i[d];if(f[d].status==="success"){let C=f[d].result;x.push({...T,balance:{raw:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ("0")),formatted:_viem.formatUnits.call(void 0, _nullishCoalesce(C, () => (0n)),T.decimals)}})}else console.error("error getting balance",f[d].error),_chunkY2FETC6Tcjs.b.captureException(_chunkY2FETC6Tcjs.a.call(void 0, {cause:f[d].error})),x.push(T)}return x})),c=[];for(let o of l)o.status==="fulfilled"?c.push(..._nullishCoalesce(o.value, () => ([]))):_chunkY2FETC6Tcjs.b.captureException(_chunkY2FETC6Tcjs.a.call(void 0, {cause:o.reason}));return c.sort((o,i)=>{let p=Number(o.balance.formatted)*(_nullishCoalesce(o.price, () => (0)));return Number(i.balance.formatted)*(_nullishCoalesce(i.price, () => (0)))-p})}function A({chainId:e}={},t){let{address:a}=_hooks.useBeraWallet.call(void 0, ),n=_hooks.useConfig.call(void 0, ),r=!!a&&(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.opts, 'optionalAccess', _11 => _11.isEnabled]), () => (!0))),s=_swr2.default.call(void 0, r&&n?["useEnsoUserTokensWithBalances",a,e]:null,async([,l,c])=>R({account:l,wagmiConfig:n,chainId:_nullishCoalesce(c, () => ("all")),ensoClient:_chunkXZC34BHMcjs.a.call(void 0, )}),{refreshInterval:1e5,isEnabled:r,..._optionalChain([t, 'optionalAccess', _12 => _12.opts])});return{...s,refresh:()=>s.mutate()}}function H({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let a=e.map(s=>({...s,default:!0})),n=a.filter(s=>_optionalChain([s, 'access', _13 => _13.tags, 'optionalAccess', _14 => _14.some, 'call', _15 => _15(l=>l==="featured")])),r=[...a,...t];return{tokenList:r.filter((s,l)=>r.findIndex(c=>_chunk54BTOQE3cjs.d.call(void 0, c,s))===l),customTokenList:t,featuredTokenList:n}}var ie=_react.createContext.call(void 0, void 0);function je({children:e,defaultTokens:t,edgeConfigTokenList:a,userTokens:n,onAddToken:r,onRemoveToken:u}){let{data:s,refresh:l}=A(),{tokenList:c=[],featuredTokenList:o=[]}=_react.useMemo.call(void 0, ()=>H({defaultTokenList:[...t,..._optionalChain([a, 'optionalAccess', _16 => _16.filter, 'call', _17 => _17(i=>_edgeconfig.isFlagEnabled.call(void 0, i.enabled))])],externalList:[...n,...(_nullishCoalesce(s, () => ([]))).map(i=>({...i,balance:void 0,price:void 0}))]}),[t,n,a,s]);return _jsxruntime.jsx.call(void 0, ie.Provider,{value:{tokenList:c,userTokens:n,featuredTokens:o,ensoTokens:s,onAddToken(i){r(i,{defaultTokens:t,userTokens:n,tokenList:c})},onRemoveToken:u,refresh:()=>{l()}},children:e})}exports.a = pe; exports.b = D; exports.c = fe; exports.d = w; exports.e = Te; exports.f = he; exports.g = ve; exports.h = F; exports.i = Ee; exports.j = L; exports.k = Fe; exports.l = Le; exports.m = A; exports.n = ie; exports.o = je;
2
- //# sourceMappingURL=chunk-RCWM55DE.cjs.map
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(); } } 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 _chunkDDEQFR3Mcjs = require('./chunk-DDEQFR3M.cjs');var _chunkGEIY554Acjs = require('./chunk-GEIY554A.cjs');var _chunkPFUVKW6Fcjs = require('./chunk-PFUVKW6F.cjs');var _chunkF4V5B6F7cjs = require('./chunk-F4V5B6F7.cjs');var _chunkFDEUAXETcjs = require('./chunk-FDEUAXET.cjs');var _chunkDKZGCMH4cjs = require('./chunk-DKZGCMH4.cjs');var _react = require('react');var _edgeconfig = require('@berachain/config/internal/edge-config');var _jsxruntime = require('react/jsx-runtime');var W=_react.createContext.call(void 0, void 0);function pe({children:e,flags:t,aggregators:a,swberaAprWindow:n="DAY"}){return _jsxruntime.jsx.call(void 0, W.Provider,{value:{..._chunkDDEQFR3Mcjs.a,...t,aggregators:a?Object.entries(a).filter(([,r])=>_edgeconfig.isFlagEnabled.call(void 0, r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function D(){let e=_react.useContext.call(void 0, W);if(!e)throw new Error("BeraFlagsProvider not found");return e}function fe(e){return D()[e]}var w=_react.createContext.call(void 0, {protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Te(){let e=_react.useContext.call(void 0, w);if(!e)throw new (0, _chunkDKZGCMH4cjs.h)({level:"fatal",message:"BexStateContext is not defined"});return e}function he({children:e,isVaultPaused:t,labels:a,factories:n}){let[r,u]=_react.useState.call(void 0, ),s=_nullishCoalesce((_optionalChain([r, 'optionalAccess', _2 => _2.isPaused])&&!_optionalChain([r, 'optionalAccess', _3 => _3.isInRecoveryMode])), () => (!1)),l=t||_optionalChain([r, 'optionalAccess', _4 => _4.isPaused]);return _jsxruntime.jsx.call(void 0, w.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:a,onPoolChange:u,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!l}:void 0},children:e})}var _mainnet = require('@berachain/config/mainnet');function ve(){return _react.useContext.call(void 0, F)}var F=_react.createContext.call(void 0, _mainnet.mainnet.averageBlockTime);function Ee({children:e,blockTime:t,...a}){let{config:n}=_chunkFDEUAXETcjs.a.call(void 0, a);return _jsxruntime.jsx.call(void 0, F.Provider,{value:_nullishCoalesce(t, () => (n.averageBlockTime)),children:e})}var L=_react.createContext.call(void 0, void 0);function Fe({children:e,...t}){return _jsxruntime.jsx.call(void 0, L.Provider,{value:t,children:e})}function Le(){let e=_react.useContext.call(void 0, L);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}var _swr = require('swr'); var _swr2 = _interopRequireDefault(_swr);var _hooks = require('@berachain/wagmi/hooks');var _core = require('@wagmi/core');var _viem = require('viem');async function R({account:e,wagmiConfig:t,chainId:a,ensoClient:n}){let u=(await n.getBalances({useEoa:!0,chainId:_nullishCoalesce(a, () => ("all")),eoaAddress:e})).map(o=>({name:o.name,symbol:o.symbol,decimals:o.decimals,address:_chunkPFUVKW6Fcjs.d.call(void 0, o.token,"ETH")?_chunkPFUVKW6Fcjs.a.address:o.token,logoURI:o.logoUri,balance:{raw:o.amount.toString(),formatted:_viem.formatUnits.call(void 0, BigInt(o.amount),o.decimals)},chainId:Number(o.chainId),price:Number(o.price)})),s=Object.groupBy(u,o=>_nullishCoalesce(o.chainId, () => (0))),l=await Promise.allSettled(Object.entries(s).map(async([o,i])=>{if(!i)return;let p=_core.getChains.call(void 0, t).find(d=>d.id===Number(o));if(!p)return;let k=_optionalChain([p, 'access', _5 => _5.contracts, 'optionalAccess', _6 => _6.multicall3, 'optionalAccess', _7 => _7.address]);if(!k)return _chunkF4V5B6F7cjs.b.captureException(new (0, _chunkDKZGCMH4cjs.j)({property:"multicallAddress",value:k,expected:"Address",chainId:Number(o)})),i;let f=await _core.multicall.call(void 0, t,{chainId:Number(o),contracts:i.map(d=>_chunkGEIY554Acjs.b.call(void 0, {token:d,account:e,multicallAddress:k})),allowFailure:!0}),x=[];for(let d=0;d<i.length;d++){let T=i[d];if(f[d].status==="success"){let C=f[d].result;x.push({...T,balance:{raw:_nullishCoalesce(_optionalChain([C, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ("0")),formatted:_viem.formatUnits.call(void 0, _nullishCoalesce(C, () => (0n)),T.decimals)}})}else console.error("error getting balance",f[d].error),_chunkF4V5B6F7cjs.b.captureException(_chunkF4V5B6F7cjs.a.call(void 0, {cause:f[d].error})),x.push(T)}return x})),c=[];for(let o of l)o.status==="fulfilled"?c.push(..._nullishCoalesce(o.value, () => ([]))):_chunkF4V5B6F7cjs.b.captureException(_chunkF4V5B6F7cjs.a.call(void 0, {cause:o.reason}));return c.sort((o,i)=>{let p=Number(o.balance.formatted)*(_nullishCoalesce(o.price, () => (0)));return Number(i.balance.formatted)*(_nullishCoalesce(i.price, () => (0)))-p})}function A({chainId:e}={},t){let{address:a}=_hooks.useBeraWallet.call(void 0, ),n=_hooks.useConfig.call(void 0, ),r=!!a&&(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.opts, 'optionalAccess', _11 => _11.isEnabled]), () => (!0))),s=_swr2.default.call(void 0, r&&n?["useEnsoUserTokensWithBalances",a,e]:null,async([,l,c])=>R({account:l,wagmiConfig:n,chainId:_nullishCoalesce(c, () => ("all")),ensoClient:_chunkGEIY554Acjs.a.call(void 0, )}),{refreshInterval:1e5,isEnabled:r,..._optionalChain([t, 'optionalAccess', _12 => _12.opts])});return{...s,refresh:()=>s.mutate()}}function H({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let a=e.map(s=>({...s,default:!0})),n=a.filter(s=>_optionalChain([s, 'access', _13 => _13.tags, 'optionalAccess', _14 => _14.some, 'call', _15 => _15(l=>l==="featured")])),r=[...a,...t];return{tokenList:r.filter((s,l)=>r.findIndex(c=>_chunkPFUVKW6Fcjs.d.call(void 0, c,s))===l),customTokenList:t,featuredTokenList:n}}var ie=_react.createContext.call(void 0, void 0);function je({children:e,defaultTokens:t,edgeConfigTokenList:a,userTokens:n,onAddToken:r,onRemoveToken:u}){let{data:s,refresh:l}=A(),{tokenList:c=[],featuredTokenList:o=[]}=_react.useMemo.call(void 0, ()=>H({defaultTokenList:[...t,..._optionalChain([a, 'optionalAccess', _16 => _16.filter, 'call', _17 => _17(i=>_edgeconfig.isFlagEnabled.call(void 0, i.enabled))])],externalList:[...n,...(_nullishCoalesce(s, () => ([]))).map(i=>({...i,balance:void 0,price:void 0}))]}),[t,n,a,s]);return _jsxruntime.jsx.call(void 0, ie.Provider,{value:{tokenList:c,userTokens:n,featuredTokens:o,ensoTokens:s,onAddToken(i){r(i,{defaultTokens:t,userTokens:n,tokenList:c})},onRemoveToken:u,refresh:()=>{l()}},children:e})}exports.a = pe; exports.b = D; exports.c = fe; exports.d = w; exports.e = Te; exports.f = he; exports.g = ve; exports.h = F; exports.i = Ee; exports.j = L; exports.k = Fe; exports.l = Le; exports.m = A; exports.n = ie; exports.o = je;
2
+ //# sourceMappingURL=chunk-JZL5JPDJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-JZL5JPDJ.cjs","../src/contexts/BeraFlags/BeraFlags.tsx","../src/contexts/BexStatusProvider.tsx","../src/contexts/block-time-provider.tsx","../src/contexts/HoneyConfigProvider.tsx","../src/hooks/enso/useEnsoUserTokensWithBalances.ts","../src/actions/enso/getEnsoUserTokensWithBalances.ts","../src/contexts/TokensProvider.tsx","../src/utils/formatTokenList.ts"],"names":["BeraFlagContext","createContext","BeraFlagsProvider","children","flags","aggregators","swberaAprWindow","jsx","defaultFlags","value","isFlagEnabled","key","useBeraFlags","context","useContext","useBeraFlag","BexStateContext","useBexStatus","BeraError","BexStatusProvider","isVaultPaused","labels","factories","poolState","setPoolState","useState","disablePoolWithdrawals","disablePoolDeposits","useBlockTime","BlockTimeContext","mainnet","BlockTimeProvider","blockTime","args","config","parseBaseArgs","HoneyConfigContext","HoneyConfigProvider","props","useHoneyConfig","getEnsoUserTokensWithBalances","account","wagmiConfig","chainId","ensoClient","tokens","balance","isToken","beraToken","formatUnits","tokenByChainId","a","balances","chainTokens","chainConfig","getChains","chain","multicallAddress","BeraMonitoring","InvalidArgumentError","multicall","token","getBalanceCall","tokensWithBalances","index","initBeraError","flattenedBalances","result","b","aValue","useEnsoUserTokensWithBalances","options","fromAddress","useBeraWallet","useConfig","isEnabled","swrResponse","useSWR","getEnsoClient","formatTokenList","defaultTokenList","externalList","defaultList","featuredTokenList","tag","mergedList","item","i","TokenContext","TokensProvider","defaultTokens","edgeConfigTokenList","userTokens","onAddToken","onRemoveToken","ensoTokens","refresh","tokenList","useMemo","t","tk"],"mappings":"AAAA,y0BAAwC,wDAAgD,wDAAgD,wDAAgD,wDAAyC,wDAAgD,8BCAvO,oEAKnC,+CAiCH,IAhBEA,CAAAA,CAAkBC,kCAAAA,KACtB,CACF,CAAA,CAEO,SAASC,EAAAA,CAAkB,CAChC,QAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CAAAA,CACA,eAAA,CAAAC,CAAAA,CAAkB,KACpB,CAAA,CAKG,CACD,OACEC,6BAAAA,CAACP,CAAgB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J,CAAA,0OAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-JZL5JPDJ.cjs","sourcesContent":[null,"import { createContext, useContext } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { type BeraFlags, defaultFlags } from \"./defaultFlags\";\n\nexport type { BeraFlags };\n\nexport type BeraFlagsContextReturn = BeraFlags & {\n /**\n * A list of aggregators that are enabled. If not provided, all aggregators are enabled.\n */\n aggregators: string[] | undefined;\n swberaAprWindow: Exclude<\n EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"],\n undefined\n >;\n};\n\nconst BeraFlagContext = createContext<BeraFlagsContextReturn | undefined>(\n undefined,\n);\n\nexport function BeraFlagsProvider({\n children,\n flags,\n aggregators,\n swberaAprWindow = \"DAY\",\n}: {\n children: React.ReactNode;\n flags: BeraFlags;\n aggregators?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"aggregators\"];\n swberaAprWindow?: EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"];\n}) {\n return (\n <BeraFlagContext.Provider\n value={{\n ...defaultFlags,\n ...flags,\n aggregators: aggregators\n ? Object.entries(aggregators)\n .filter(([, value]) => isFlagEnabled(value))\n .map(([key]) => key)\n : undefined,\n swberaAprWindow,\n }}\n >\n {children}\n </BeraFlagContext.Provider>\n );\n}\n\nexport function useBeraFlags() {\n const context = useContext(BeraFlagContext);\n if (!context) {\n throw new Error(\"BeraFlagsProvider not found\");\n }\n return context;\n}\n\nexport function useBeraFlag<T extends keyof BeraFlagsContextReturn>(\n key: T,\n): BeraFlagsContextReturn[T] {\n const flags = useBeraFlags();\n return flags[key];\n}\n","import {\n createContext,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n useContext,\n useState,\n} from \"react\";\nimport type { Hex } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { BeraError } from \"../errors/BeraError\";\n\ntype FactoryStatus = {\n /**\n * If the composable stable factory is enabled\n */\n composableStable: \"paused\" | \"enabled\";\n /**\n * If the weighted factory is enabled\n */\n weighted: \"paused\" | \"enabled\";\n};\nexport interface BexStatusProviderProps {\n isVaultPaused: boolean;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n };\n factories: FactoryStatus;\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}\n\nexport const BexStateContext = createContext<{\n protocol: {\n isPaused: boolean;\n factories: FactoryStatus & { allPaused: boolean };\n };\n onPoolChange: Dispatch<SetStateAction<BexStatusProviderProps[\"pool\"]>>;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n disablePoolWithdrawals: boolean;\n disablePoolDeposits: boolean;\n };\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}>({\n protocol: {\n isPaused: false,\n factories: {\n composableStable: \"enabled\",\n weighted: \"enabled\",\n allPaused: false,\n },\n },\n onPoolChange: () => {},\n pool: undefined,\n});\n\n/**\n * @description Determines the status of a pool or vault and returns the appropriate messages and flags to disable functionality.\n * More information here https://www.notion.so/berachain/BEX-RecoveryMode-and-Pause-explained-17c6120abced80e0985dd589b57ff018\n *\n * @returns status flags to enable/disable/notify users across the BEX\n *\n **/\nexport function useBexStatus() {\n const context = useContext(BexStateContext);\n\n if (!context) {\n throw new BeraError({\n level: \"fatal\",\n message: \"BexStateContext is not defined\",\n });\n }\n\n return context;\n}\n\nexport function BexStatusProvider({\n children,\n isVaultPaused,\n labels,\n factories,\n}: PropsWithChildren<BexStatusProviderProps>) {\n const [poolState, setPoolState] = useState<BexStatusProviderProps[\"pool\"]>();\n // Determine whether to disable withdrawals for a pool (vault pause does not impact this)\n const disablePoolWithdrawals =\n (poolState?.isPaused && !poolState?.isInRecoveryMode) ?? false;\n\n // Determine whether to disable deposits for a pool (vault pause does not impact this)\n const disablePoolDeposits = isVaultPaused || poolState?.isPaused;\n\n // TODO: we dont yet support anything to disable staking/unstaking within reward vaults if they get paused\n\n return (\n <BexStateContext.Provider\n value={{\n protocol: {\n isPaused: isVaultPaused,\n factories: {\n ...factories,\n allPaused:\n factories.composableStable === \"paused\" &&\n factories.weighted === \"paused\",\n },\n },\n labels,\n onPoolChange: setPoolState,\n pool: poolState\n ? {\n ...poolState,\n disablePoolWithdrawals: !!disablePoolWithdrawals,\n disablePoolDeposits: !!disablePoolDeposits,\n }\n : undefined,\n }}\n >\n {children}\n </BexStateContext.Provider>\n );\n}\n","import { createContext, type PropsWithChildren, useContext } from \"react\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { parseBaseArgs } from \"../utils/parseBaseArgs\";\n\n/**\n * Average berachain block time in seconds\n */\nexport function useBlockTime(): number {\n return useContext(BlockTimeContext);\n}\n\nexport const BlockTimeContext = createContext<number>(\n // this is the default block time for berachain, but actually overridden by the block time provider\n mainnet.averageBlockTime,\n);\n\nexport function BlockTimeProvider({\n children,\n blockTime,\n ...args\n}: PropsWithChildren<{\n blockTime?: number;\n}> &\n BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n return (\n <BlockTimeContext.Provider value={blockTime ?? config.averageBlockTime}>\n {children}\n </BlockTimeContext.Provider>\n );\n}\n","import { createContext, useContext } from \"react\";\n\nimport type { HoneyFeeMap } from \"../actions/honey/getHoneyFees\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport type { PythPriceFeedMap } from \"../types/honeySwap\";\n\nexport const HoneyConfigContext = createContext<\n HoneyConfigContextReturn | undefined\n>(undefined);\n\nexport type TokenWithOrder = TokenWithMetadata & {\n order: number;\n};\nexport interface HoneyConfigContextReturn {\n /**\n * Map of the Pyth price feed ids for each collateral\n */\n priceFeedMap: PythPriceFeedMap;\n /**\n * This is the list of all the collaterals that are supported by the Honey protocol\n */\n collateralList: TokenWithOrder[];\n /**\n * This is the main collateral that is used to calculate the relative cap limit\n */\n referenceCollateral: TokenWithOrder;\n /**\n * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode\n */\n feeMap: HoneyFeeMap;\n flags: {\n /**\n * If true, mint/redeem will also update pyth prices\n */\n isPythWrapperEnabled: boolean;\n };\n /**\n * Honey protocol configs\n */\n protocol: {\n /**\n * Honey protocol paused state\n */\n isPaused: boolean;\n /**\n * The label for the Honey protocol paused message\n */\n pausedBannerLabel?: string;\n };\n}\n\nexport interface HoneyConfigProviderProps extends HoneyConfigContextReturn {\n children: React.ReactNode;\n}\n\nexport function HoneyConfigProvider({\n children,\n ...props\n}: HoneyConfigProviderProps) {\n return (\n <HoneyConfigContext.Provider value={props}>\n {children}\n </HoneyConfigContext.Provider>\n );\n}\n\nexport function useHoneyConfig() {\n const context = useContext(HoneyConfigContext);\n if (!context) {\n throw new Error(\"useHoneyConfig must be used within a HoneyConfigProvider\");\n }\n return context;\n}\n","import useSWR from \"swr\";\n\nimport { useBeraWallet, useConfig } from \"@berachain/wagmi/hooks\";\n\nimport { getEnsoClient } from \"../../actions/clients/getEnsoClient\";\nimport { getEnsoUserTokensWithBalances } from \"../../actions/enso/getEnsoUserTokensWithBalances\";\nimport { POLLING } from \"../../enum/polling\";\nimport type { BalanceToken } from \"../../types/dex\";\nimport type { DefaultHookOptions } from \"../../types/global\";\n\nexport function useEnsoUserTokensWithBalances(\n { chainId }: { chainId?: number } = {},\n options?: DefaultHookOptions,\n) {\n const { address: fromAddress } = useBeraWallet();\n const wagmiConfig = useConfig();\n const isEnabled = !!fromAddress && (options?.opts?.isEnabled ?? true);\n\n const QUERY_KEY =\n isEnabled && wagmiConfig\n ? ([\"useEnsoUserTokensWithBalances\", fromAddress, chainId] as const)\n : null;\n\n const swrResponse = useSWR(\n QUERY_KEY,\n async ([, fromAddress, chainId]): Promise<BalanceToken[]> =>\n getEnsoUserTokensWithBalances({\n account: fromAddress,\n wagmiConfig,\n chainId: chainId ?? \"all\",\n ensoClient: getEnsoClient(),\n }),\n {\n refreshInterval: POLLING.NORMAL,\n isEnabled,\n ...options?.opts,\n },\n );\n return {\n ...swrResponse,\n refresh: () => swrResponse.mutate(),\n };\n}\n","import type { EnsoClient } from \"@ensofinance/sdk\";\nimport { type Config, getChains, multicall } from \"@wagmi/core\";\nimport { type Address, formatUnits } from \"viem\";\n\nimport { BeraMonitoring } from \"../../errors/BeraMonitoring\";\nimport { InvalidArgumentError } from \"../../errors/InvalidArgumentError\";\nimport { initBeraError } from \"../../errors/initBeraError\";\nimport type { BalanceToken } from \"../../types/dex\";\nimport { beraToken, isToken } from \"../../utils/tokens\";\nimport { getBalanceCall } from \"../tokens/getWalletBalances\";\n\n/**\n * Get user balances for each supported chain.\n *\n * This uses enso's balance endpoint to get the balances and RPC to get fresh balances.\n */\nexport async function getEnsoUserTokensWithBalances({\n account,\n wagmiConfig,\n chainId,\n ensoClient,\n}: {\n account: Address;\n wagmiConfig: Config;\n chainId: number | \"all\";\n ensoClient: EnsoClient;\n}): Promise<BalanceToken[]> {\n const ensoBalances = await ensoClient.getBalances({\n useEoa: true,\n chainId: chainId ?? \"all\",\n eoaAddress: account,\n });\n\n const tokens: BalanceToken[] = ensoBalances.map(\n (balance) =>\n ({\n name: balance.name,\n symbol: balance.symbol,\n decimals: balance.decimals,\n address: isToken(balance.token, \"ETH\")\n ? beraToken.address\n : balance.token,\n logoURI: balance.logoUri,\n balance: {\n raw: balance.amount.toString(),\n formatted: formatUnits(BigInt(balance.amount), balance.decimals),\n },\n\n chainId: Number(\n // @ts-expect-error - balance.chainId is defined just not typed by enso\n balance.chainId,\n ),\n price: Number(balance.price),\n }) as const satisfies BalanceToken,\n );\n\n const tokenByChainId = Object.groupBy(tokens, (a) => a.chainId ?? 0);\n\n const balances = await Promise.allSettled(\n Object.entries(tokenByChainId).map(async ([chainId, chainTokens]) => {\n if (!chainTokens) return undefined;\n const chainConfig = getChains(wagmiConfig).find(\n (chain) => chain.id === Number(chainId),\n );\n\n if (!chainConfig) {\n // if we've queried a chain that is not supported, we need to return undefined\n return undefined;\n }\n\n const multicall3 = chainConfig.contracts?.multicall3;\n\n const multicallAddress = multicall3?.address;\n\n if (!multicallAddress) {\n // if multicall is not supported on this chain, we need to use the enso balance\n // first let's report the error, as this is likely unexpected\n BeraMonitoring.captureException(\n new InvalidArgumentError({\n property: \"multicallAddress\",\n value: multicallAddress,\n expected: \"Address\",\n chainId: Number(chainId),\n }),\n );\n\n // we can return the tokens as is, as the balance is already set from the enso client\n return chainTokens;\n }\n\n const balances = await multicall(wagmiConfig, {\n chainId: Number(chainId),\n contracts: chainTokens.map((token) =>\n getBalanceCall({\n token,\n account,\n multicallAddress,\n }),\n ),\n allowFailure: true,\n });\n\n const tokensWithBalances: BalanceToken[] = [];\n\n for (let index = 0; index < chainTokens.length; index++) {\n const token = chainTokens[index];\n if (balances[index].status === \"success\") {\n const balance = balances[index].result;\n\n tokensWithBalances.push({\n ...token,\n balance: {\n raw: balance?.toString() ?? \"0\",\n formatted: formatUnits(balance ?? 0n, token.decimals),\n },\n });\n } else {\n console.error(\"error getting balance\", balances[index].error);\n BeraMonitoring.captureException(\n initBeraError({ cause: balances[index].error }),\n );\n // uses enso balance as fallback\n tokensWithBalances.push(token);\n }\n }\n\n return tokensWithBalances;\n }),\n );\n\n const flattenedBalances: BalanceToken[] = [];\n for (const result of balances) {\n if (result.status === \"fulfilled\") {\n flattenedBalances.push(...(result.value ?? []));\n } else {\n BeraMonitoring.captureException(initBeraError({ cause: result.reason }));\n }\n }\n\n return flattenedBalances.sort((a, b) => {\n const aValue = Number(a.balance.formatted) * (a.price ?? 0);\n const bValue = Number(b.balance.formatted) * (b.price ?? 0);\n return bValue - aValue;\n });\n}\n","import { createContext, type PropsWithChildren, useMemo } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { useEnsoUserTokensWithBalances } from \"../hooks/enso/useEnsoUserTokensWithBalances\";\nimport type { BalanceToken, Token, TokenWithMetadata } from \"../types/dex\";\nimport { formatTokenList } from \"../utils/formatTokenList\";\n\nexport interface TokensProviderContext {\n tokenList: TokenWithMetadata[];\n userTokens: Token[];\n featuredTokens: TokenWithMetadata[];\n onRemoveToken: (token: Token) => void;\n onAddToken: (token: Token) => void;\n refresh: () => void;\n ensoTokens: BalanceToken[] | undefined;\n}\n\nexport const TokenContext = createContext<TokensProviderContext | undefined>(\n undefined,\n);\n\nexport interface TokensProviderProps\n extends Omit<\n TokensProviderContext,\n \"tokenList\" | \"onAddToken\" | \"featuredTokens\" | \"ensoTokens\"\n > {\n onAddToken: (\n token: Token,\n context: {\n defaultTokens: TokenWithMetadata[];\n userTokens: Token[];\n tokenList: TokenWithMetadata[];\n },\n ) => void;\n defaultTokens: TokenWithMetadata[];\n edgeConfigTokenList: EdgeConfigSchema[\"tokens\"];\n}\n\nexport function TokensProvider({\n children,\n defaultTokens,\n edgeConfigTokenList,\n userTokens,\n onAddToken,\n onRemoveToken,\n}: PropsWithChildren<Omit<TokensProviderProps, \"refresh\">>) {\n const { data: ensoTokens, refresh } = useEnsoUserTokensWithBalances();\n\n const { tokenList = [], featuredTokenList = [] } = useMemo(\n () =>\n formatTokenList({\n defaultTokenList: [\n ...defaultTokens,\n ...(edgeConfigTokenList?.filter((token) =>\n isFlagEnabled(token.enabled),\n ) as TokenWithMetadata[]),\n ],\n externalList: [\n ...userTokens,\n ...(ensoTokens ?? []).map((t) => ({\n ...t,\n balance: undefined,\n price: undefined,\n })),\n ],\n }),\n [defaultTokens, userTokens, edgeConfigTokenList, ensoTokens],\n );\n\n return (\n <TokenContext.Provider\n value={{\n tokenList,\n userTokens,\n featuredTokens: featuredTokenList,\n ensoTokens,\n onAddToken(tk) {\n onAddToken(tk, { defaultTokens, userTokens, tokenList });\n },\n onRemoveToken,\n refresh: () => {\n refresh();\n },\n }}\n >\n {children}\n </TokenContext.Provider>\n );\n}\n","import type { Token, TokenWithMetadata } from \"../types/dex\";\nimport { isToken } from \"./tokens\";\n\nexport interface FormatTokenListReturnType {\n /**\n * Token list including custom tokens\n */\n tokenList: Token[];\n /**\n * Custom token list (added by the user)\n */\n customTokenList?: Token[];\n /**\n * Featured token list\n */\n featuredTokenList?: Token[];\n}\n\nfunction formatTokenList({\n defaultTokenList = [],\n externalList = [],\n}: {\n defaultTokenList: TokenWithMetadata[];\n externalList?: Token[];\n}): FormatTokenListReturnType {\n if (defaultTokenList.length === 0) {\n return {\n tokenList: externalList,\n customTokenList: externalList,\n featuredTokenList: [],\n };\n }\n\n const defaultList = defaultTokenList.map((token) => {\n return { ...token, default: true };\n });\n\n const featuredTokenList = defaultList.filter((token) => {\n return token.tags?.some((tag) => tag === \"featured\");\n });\n\n const mergedList = [...defaultList, ...externalList];\n\n const uniqueList = mergedList.filter(\n (item, index) => mergedList.findIndex((i) => isToken(i, item)) === index,\n );\n\n return {\n tokenList: uniqueList,\n customTokenList: externalList,\n featuredTokenList,\n };\n}\n\nexport { formatTokenList };\n"]}
@@ -1,4 +1,4 @@
1
- import{b as u}from"./chunk-ENT2OSXT.mjs";import{b as m}from"./chunk-5QAFKFM5.mjs";import{isAddress as f,isHex as b}from"viem";function c({fieldOrType:t,value:e,required:r=!0,baseUrl:s,components:i}){if(!["bool","string"].includes(t)&&r&&(e==null||e===""))return"Required";if(t.startsWith("uint")||t.startsWith("int")){if(typeof e!="string")return"Invalid amount";try{let n=BigInt(e);if(t.startsWith("uint")&&n<0n)return"Negative amount"}catch{return"Invalid amount"}return null}switch(t){case"string":return e!==void 0&&typeof e!="string"?"Invalid amount":null;case"bool":return typeof e!="boolean"?"Invalid amount":null;case"title":return typeof e!="string"||e.length===0?"Required":null;case"description":return typeof e!="string"||e.length===0?"Required":null;case"forumLink":{if(typeof e!="string"||e.length===0)return"Required";if(!URL.canParse(e))return"Invalid address";let n=new URL(s);return e.startsWith(n.toString())?null:"Must be a berachain forum link"}case"address":return typeof e!="string"||!f(e,{strict:!0})?"Invalid address":null;case"hex":return typeof e!="string"||!b(e,{strict:!0})?"Invalid address":null;case"abi":if(typeof e!="string")return"Invalid ABI";try{JSON.parse(e)}catch{return"Invalid ABI"}return null;case"action":return typeof e!="string"||!f(e,{strict:!0})?"Invalid address":null;case"tuple":if(typeof e=="object"&&Array.isArray(i)){let n={};for(let a of i){let p=a,d=p.name;n[d]=c({fieldOrType:p.type,value:e[d],components:p.components})}return Object.values(n).every(a=>a===null)?null:n}return null;case"tuple[]":if(Array.isArray(e)){let n=e.map(a=>c({fieldOrType:"tuple",value:a,components:i}));return n.every(a=>a===null)?null:n}return null;case"logoURI":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS or IPFS":null;case"url":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS":null;default:return console.error(`Invalid field or type: ${t}`),null}}import{ProposalStatus as o}from"@berachain/graphql/governance";var A=!1,x=[o.Active,o.PendingQueue,o.PendingExecution,o.Defeated,o.QuorumNotReached];function g(t,e){let r=Date.now()/1e3;if(e!==void 0){if(t.status===o.CanceledByGuardian)return o.CanceledByGuardian;if(e===2)return Number(t.voteStartAt)<r?o.CanceledByUser:o.CanceledByGuardian;if(e===3)return t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:o.Defeated:o.QuorumNotReached;if(e===4)return o.PendingQueue;if(e===5)return Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:o.InQueue;if(e===6)return console.warn("Unexpected expired state on proposal id: ",t.id),o.Defeated}return t.status===o.InQueue&&Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:A&&e===1&&t.quorum&&BigInt(t.quorum)<BigInt(t.pollResult.totalTowardsQuorum)&&Number(t.pollResult.forPercentage)>Number(t.pollResult.againstPercentage)?o.PendingQueue:t.status===o.Pending?Number(t.voteStartAt)<r&&Number(t.voteEndAt)>r?o.Active:Number(t.voteEndAt)<r?t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:t.pollResult?.against>t.pollResult?.for?o.Defeated:o.PendingQueue:o.QuorumNotReached:o.Pending:t.status===o.Active&&Number(t.voteEndAt)<r?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:BigInt(t.pollResult?.against??0n)>BigInt(t.pollResult?.for??0n)?o.Defeated:o.PendingQueue:t.status===o.InQueue&&Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:t.status}import{GetProposals as R,SearchProposals as h}from"@berachain/graphql/governance";async function L({where:t,orderBy:e,orderDirection:r,offset:s=0,perPage:i=20,text:l,...n}){try{if(i>1e3)throw new Error("perPage must be less than 1000");let a=u("governance.subgraph",n),[p]=await Promise.all([l?a.query({query:h,variables:{offset:s,limit:i,where:t,text:l}}):a.query({query:R,variables:{offset:s,limit:i,where:t,orderBy:e,orderDirection:r}})]);return p.data.proposals.map(d=>({...d,status:g(d)}))}catch(a){throw console.error("getAllProposals:",a),a}}function U({proposal:t,currentTopic:e}){let r={};return r.title=c({fieldOrType:"title",value:t.title}),r.description=c({fieldOrType:"description",value:t.description}),r.forumLink=c({fieldOrType:"forumLink",value:t.forumLink,baseUrl:e.forumLink}),r}import{GetProposal as I}from"@berachain/graphql/governance";async function W({proposalId:t,...e}){let s=await u("governance.subgraph",e).query({query:I,variables:{id:t}});if(s.data.proposal)return{...s.data.proposal,status:g(s.data.proposal)}}import P from"gray-matter";function S(t){let e=/#(?:([\w-]+)# )?(.+)\n([\s\S]*)/,r=t.match(e);if(r){let s=r[1]||null,i=r[2],l=r[3].replace(`
1
+ import{b as u}from"./chunk-5XOEJ6XX.mjs";import{b as m}from"./chunk-TU63NRNL.mjs";import{isAddress as f,isHex as b}from"viem";function c({fieldOrType:t,value:e,required:r=!0,baseUrl:s,components:i}){if(!["bool","string"].includes(t)&&r&&(e==null||e===""))return"Required";if(t.startsWith("uint")||t.startsWith("int")){if(typeof e!="string")return"Invalid amount";try{let n=BigInt(e);if(t.startsWith("uint")&&n<0n)return"Negative amount"}catch{return"Invalid amount"}return null}switch(t){case"string":return e!==void 0&&typeof e!="string"?"Invalid amount":null;case"bool":return typeof e!="boolean"?"Invalid amount":null;case"title":return typeof e!="string"||e.length===0?"Required":null;case"description":return typeof e!="string"||e.length===0?"Required":null;case"forumLink":{if(typeof e!="string"||e.length===0)return"Required";if(!URL.canParse(e))return"Invalid address";let n=new URL(s);return e.startsWith(n.toString())?null:"Must be a berachain forum link"}case"address":return typeof e!="string"||!f(e,{strict:!0})?"Invalid address":null;case"hex":return typeof e!="string"||!b(e,{strict:!0})?"Invalid address":null;case"abi":if(typeof e!="string")return"Invalid ABI";try{JSON.parse(e)}catch{return"Invalid ABI"}return null;case"action":return typeof e!="string"||!f(e,{strict:!0})?"Invalid address":null;case"tuple":if(typeof e=="object"&&Array.isArray(i)){let n={};for(let a of i){let p=a,d=p.name;n[d]=c({fieldOrType:p.type,value:e[d],components:p.components})}return Object.values(n).every(a=>a===null)?null:n}return null;case"tuple[]":if(Array.isArray(e)){let n=e.map(a=>c({fieldOrType:"tuple",value:a,components:i}));return n.every(a=>a===null)?null:n}return null;case"logoURI":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS or IPFS":null;case"url":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS":null;default:return console.error(`Invalid field or type: ${t}`),null}}import{ProposalStatus as o}from"@berachain/graphql/governance";var A=!1,x=[o.Active,o.PendingQueue,o.PendingExecution,o.Defeated,o.QuorumNotReached];function g(t,e){let r=Date.now()/1e3;if(e!==void 0){if(t.status===o.CanceledByGuardian)return o.CanceledByGuardian;if(e===2)return Number(t.voteStartAt)<r?o.CanceledByUser:o.CanceledByGuardian;if(e===3)return t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:o.Defeated:o.QuorumNotReached;if(e===4)return o.PendingQueue;if(e===5)return Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:o.InQueue;if(e===6)return console.warn("Unexpected expired state on proposal id: ",t.id),o.Defeated}return t.status===o.InQueue&&Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:A&&e===1&&t.quorum&&BigInt(t.quorum)<BigInt(t.pollResult.totalTowardsQuorum)&&Number(t.pollResult.forPercentage)>Number(t.pollResult.againstPercentage)?o.PendingQueue:t.status===o.Pending?Number(t.voteStartAt)<r&&Number(t.voteEndAt)>r?o.Active:Number(t.voteEndAt)<r?t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:t.pollResult?.against>t.pollResult?.for?o.Defeated:o.PendingQueue:o.QuorumNotReached:o.Pending:t.status===o.Active&&Number(t.voteEndAt)<r?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?o.QuorumNotReached:BigInt(t.pollResult?.against??0n)>BigInt(t.pollResult?.for??0n)?o.Defeated:o.PendingQueue:t.status===o.InQueue&&Number(t.queueEnd)<Date.now()/1e3?o.PendingExecution:t.status}import{GetProposals as R,SearchProposals as h}from"@berachain/graphql/governance";async function L({where:t,orderBy:e,orderDirection:r,offset:s=0,perPage:i=20,text:l,...n}){try{if(i>1e3)throw new Error("perPage must be less than 1000");let a=u("governance.subgraph",n),[p]=await Promise.all([l?a.query({query:h,variables:{offset:s,limit:i,where:t,text:l}}):a.query({query:R,variables:{offset:s,limit:i,where:t,orderBy:e,orderDirection:r}})]);return p.data.proposals.map(d=>({...d,status:g(d)}))}catch(a){throw console.error("getAllProposals:",a),a}}function U({proposal:t,currentTopic:e}){let r={};return r.title=c({fieldOrType:"title",value:t.title}),r.description=c({fieldOrType:"description",value:t.description}),r.forumLink=c({fieldOrType:"forumLink",value:t.forumLink,baseUrl:e.forumLink}),r}import{GetProposal as I}from"@berachain/graphql/governance";async function W({proposalId:t,...e}){let s=await u("governance.subgraph",e).query({query:I,variables:{id:t}});if(s.data.proposal)return{...s.data.proposal,status:g(s.data.proposal)}}import P from"gray-matter";function S(t){let e=/#(?:([\w-]+)# )?(.+)\n([\s\S]*)/,r=t.match(e);if(r){let s=r[1]||null,i=r[2],l=r[3].replace(`
2
2
  `,"<br />");return{type:s,title:i,content:l}}throw new Error("Invalid proposal body")}function y(t){if(!t)return{isFrontMatter:!1,data:{title:"Loading..."},content:"",matter:"",language:"",orig:"",stringify:()=>""};let e=t?.description??"";if(P.test(e))return{...P(e),isFrontMatter:!0};try{let r=S(e);return{isFrontMatter:!1,data:{title:r.title},content:r.content,matter:"",language:"",orig:e,stringify:()=>e}}catch{return{isFrontMatter:!1,data:{title:t?.description?.split(`
3
3
  `)[0].slice(0,100)},content:e,matter:"",language:"",orig:e,stringify:()=>e}}}import{parseEventLogs as E}from"viem";import{berachainGovernanceAbi as C}from"@berachain/abis/gov/berachainGovernance";import{ProposalStatus as F}from"@berachain/graphql/governance";async function Z(t){m(t.publicClient);let e;"tx"in t?e=t.tx:e=await t.publicClient.getTransactionReceipt({hash:t.txHash});let r=e?.logs?E({abi:C,logs:e.logs,eventName:"ProposalCreated"})?.at(0):void 0;if(!e||!r)return null;let s=await t.publicClient.getBlock({blockNumber:e.blockNumber}),i=y({description:r?.args.description});return{id:String(r.args.proposalId),proposalId:String(r?.args.proposalId),createdAt:s.timestamp.toString(),title:i.data.title,createdAtBlock:s.timestamp.toString(),voteStartAt:String(r?.args.voteStart),voteEndAt:String(r?.args.voteEnd),proposer:r?.args.proposer,description:i.content,unverifiedForumLink:i.data.forumLink,pollResult:{for:"0",forVotersCount:0,forPercentage:"0",against:"0",againstVotersCount:0,againstPercentage:"0",abstain:"0",abstainVotersCount:0,abstainPercentage:"0",total:"0",totalVotersCount:0,totalTowardsQuorum:"0"},status:F.Pending,quorum:null,topics:i.data.topics,votes:[],executableCalls:r?.args.targets.map((l,n)=>({__typename:"ExecutableCall",id:`${e.transactionHash}-${n}`,target:l,value:String(r?.args.values[n]),calldata:r?.args.calldatas[n]})),timelock:void 0}}import{GetProposalVotes as B}from"@berachain/graphql/governance";async function oe({variables:t,...e}){return u("governance.subgraph",e).query({query:B,variables:t})}export{c as a,x as b,g as c,L as d,U as e,W as f,y as g,Z as h,oe as i};
4
- //# sourceMappingURL=chunk-H6ZO4SLB.mjs.map
4
+ //# sourceMappingURL=chunk-LUNZGZWN.mjs.map
@@ -1,2 +1,2 @@
1
- import{f as e}from"./chunk-GXV2JA36.mjs";var i=class extends e{resource;id;constructor(t){super(t),this.name="NotFoundError",this.level=t.level??"info",this.message=`Resource ${t.resource} with id ${t.id} not found`,this.resource=t.resource,this.id=t.id}};var r=class extends e{txHash;receipt;to;callData;blockNumber=null;input;functionName;constructor(t){super(t),this.name="TransactionFailedError",this.txHash=t.txHash||null,this.receipt=t.receipt||null,this.to=t.to,this.functionName=t.functionName,this.blockNumber=t.blockNumber??null,this.input=t.input,this.receipt?this.message=`Transaction reverted on chain for reason: ${this.reason}`:this.txHash?this.message=`Transaction reverted after being broadcasted for reason: ${this.reason}`:this.message=`${this.reason}: ${this.message}`,this.tags={...this.tags,"operation.txn.status":t.txHash?"execution":"simulation",...t.tags},this.to&&(this.tags["operation.txn.to"]=this.to),this.functionName&&(this.tags["operation.txn.functionName"]=this.functionName)}};export{i as a,r as b};
2
- //# sourceMappingURL=chunk-RJN36GBU.mjs.map
1
+ import{h as e}from"./chunk-5SIQ7BKT.mjs";var i=class extends e{resource;id;constructor(t){super(t),this.name="NotFoundError",this.level=t.level??"info",this.message=`Resource ${t.resource} with id ${t.id} not found`,this.resource=t.resource,this.id=t.id}};var r=class extends e{txHash;receipt;to;callData;blockNumber=null;input;functionName;constructor(t){super(t),this.name="TransactionFailedError",this.txHash=t.txHash||null,this.receipt=t.receipt||null,this.to=t.to,this.functionName=t.functionName,this.blockNumber=t.blockNumber??null,this.input=t.input,this.receipt?this.message=`Transaction reverted on chain for reason: ${this.reason}`:this.txHash?this.message=`Transaction reverted after being broadcasted for reason: ${this.reason}`:this.message=`${this.reason}: ${this.message}`,this.tags={...this.tags,"operation.txn.status":t.txHash?"execution":"simulation",...t.tags},this.to&&(this.tags["operation.txn.to"]=this.to),this.functionName&&(this.tags["operation.txn.functionName"]=this.functionName)}};export{i as a,r as b};
2
+ //# sourceMappingURL=chunk-OCAMR6XC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/abi/utils/multicall3.ts"],"names":["multicall3Abi"],"mappings":"AAIO,6EAAMA,CAAAA,CAAgB,CAC3B,CACE,MAAA,CAAQ,CACN,CACE,UAAA,CAAY,CACV,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,QAAA,CAAU,IAAA,CAAM,SAAU,CAAA,CAC3D,CAAE,YAAA,CAAc,OAAA,CAAS,IAAA,CAAM,UAAA,CAAY,IAAA,CAAM,OAAQ,CAC3D,CAAA,CACA,YAAA,CAAc,0BAAA,CACd,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,SACR,CACF,CAAA,CACA,IAAA,CAAM,WAAA,CACN,OAAA,CAAS,CACP,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,aAAA,CAAe,IAAA,CAAM,SAAU,CAAA,CAChE,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,YAAA,CAAc,IAAA,CAAM,SAAU,CACjE,CAAA,CACA,eAAA,CAAiB,SAAA,CACjB,IAAA,CAAM,UACR,CAAA,CACA,CACE,MAAA,CAAQ,CACN,CACE,UAAA,CAAY,CACV,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,QAAA,CAAU,IAAA,CAAM,SAAU,CAAA,CAC3D,CAAE,YAAA,CAAc,MAAA,CAAQ,IAAA,CAAM,cAAA,CAAgB,IAAA,CAAM,MAAO,CAAA,CAC3D,CAAE,YAAA,CAAc,OAAA,CAAS,IAAA,CAAM,UAAA,CAAY,IAAA,CAAM,OAAQ,CAC3D,CAAA,CACA,YAAA,CAAc,2BAAA,CACd,IAAA,CAAM,OAAA,CACN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/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-OIYXOKTT.cjs","sourcesContent":["/**\n * This ABI is needed because viem exports a reduced version of this ABI.\n * For instance\n */\nexport const multicall3Abi = [\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes[]\", name: \"returnData\", type: \"bytes[]\" },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bool\", name: \"allowFailure\", type: \"bool\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call3[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate3\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bool\", name: \"allowFailure\", type: \"bool\" },\n { internalType: \"uint256\", name: \"value\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call3Value[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate3Value\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"blockAndAggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getBasefee\",\n outputs: [{ internalType: \"uint256\", name: \"basefee\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" }],\n name: \"getBlockHash\",\n outputs: [{ internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getBlockNumber\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getChainId\",\n outputs: [{ internalType: \"uint256\", name: \"chainid\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockCoinbase\",\n outputs: [{ internalType: \"address\", name: \"coinbase\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockDifficulty\",\n outputs: [{ internalType: \"uint256\", name: \"difficulty\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockGasLimit\",\n outputs: [{ internalType: \"uint256\", name: \"gaslimit\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockTimestamp\",\n outputs: [{ internalType: \"uint256\", name: \"timestamp\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"addr\", type: \"address\" }],\n name: \"getEthBalance\",\n outputs: [{ internalType: \"uint256\", name: \"balance\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getLastBlockHash\",\n outputs: [{ internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bool\", name: \"requireSuccess\", type: \"bool\" },\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"tryAggregate\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bool\", name: \"requireSuccess\", type: \"bool\" },\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"tryBlockAndAggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n] as const;\n"]}
1
+ {"version":3,"sources":["../src/abi/utils/multicall3.ts"],"names":["multicall3Abi"],"mappings":"AAIO,6EAAMA,CAAAA,CAAgB,CAC3B,CACE,MAAA,CAAQ,CACN,CACE,UAAA,CAAY,CACV,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,QAAA,CAAU,IAAA,CAAM,SAAU,CAAA,CAC3D,CAAE,YAAA,CAAc,OAAA,CAAS,IAAA,CAAM,UAAA,CAAY,IAAA,CAAM,OAAQ,CAC3D,CAAA,CACA,YAAA,CAAc,0BAAA,CACd,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,SACR,CACF,CAAA,CACA,IAAA,CAAM,WAAA,CACN,OAAA,CAAS,CACP,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,aAAA,CAAe,IAAA,CAAM,SAAU,CAAA,CAChE,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,YAAA,CAAc,IAAA,CAAM,SAAU,CACjE,CAAA,CACA,eAAA,CAAiB,SAAA,CACjB,IAAA,CAAM,UACR,CAAA,CACA,CACE,MAAA,CAAQ,CACN,CACE,UAAA,CAAY,CACV,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,QAAA,CAAU,IAAA,CAAM,SAAU,CAAA,CAC3D,CAAE,YAAA,CAAc,MAAA,CAAQ,IAAA,CAAM,cAAA,CAAgB,IAAA,CAAM,MAAO,CAAA,CAC3D,CAAE,YAAA,CAAc,OAAA,CAAS,IAAA,CAAM,UAAA,CAAY,IAAA,CAAM,OAAQ,CAC3D,CAAA,CACA,YAAA,CAAc,2BAAA,CACd,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,SACR,CACF,CAAA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k-OIYXOKTT.cjs","sourcesContent":["/**\n * This ABI is needed because viem exports a reduced version of this ABI.\n * For instance\n */\nexport const multicall3Abi = [\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes[]\", name: \"returnData\", type: \"bytes[]\" },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bool\", name: \"allowFailure\", type: \"bool\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call3[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate3\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bool\", name: \"allowFailure\", type: \"bool\" },\n { internalType: \"uint256\", name: \"value\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call3Value[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"aggregate3Value\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"blockAndAggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getBasefee\",\n outputs: [{ internalType: \"uint256\", name: \"basefee\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" }],\n name: \"getBlockHash\",\n outputs: [{ internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getBlockNumber\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getChainId\",\n outputs: [{ internalType: \"uint256\", name: \"chainid\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockCoinbase\",\n outputs: [{ internalType: \"address\", name: \"coinbase\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockDifficulty\",\n outputs: [{ internalType: \"uint256\", name: \"difficulty\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockGasLimit\",\n outputs: [{ internalType: \"uint256\", name: \"gaslimit\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getCurrentBlockTimestamp\",\n outputs: [{ internalType: \"uint256\", name: \"timestamp\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"addr\", type: \"address\" }],\n name: \"getEthBalance\",\n outputs: [{ internalType: \"uint256\", name: \"balance\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getLastBlockHash\",\n outputs: [{ internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bool\", name: \"requireSuccess\", type: \"bool\" },\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"tryAggregate\",\n outputs: [\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bool\", name: \"requireSuccess\", type: \"bool\" },\n {\n components: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Call[]\",\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"tryBlockAndAggregate\",\n outputs: [\n { internalType: \"uint256\", name: \"blockNumber\", type: \"uint256\" },\n { internalType: \"bytes32\", name: \"blockHash\", type: \"bytes32\" },\n {\n components: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n internalType: \"struct Multicall3.Result[]\",\n name: \"returnData\",\n type: \"tuple[]\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n] as const;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/abi/pyth/pyth.ts"],"names":["pythAbi"],"mappings":"AAAO,6EAAMA,CAAAA,CAAU,CACrB,CACE,IAAA,CAAM,UAAA,CACN,IAAA,CAAM,aAAA,CACN,MAAA,CAAQ,CACN,CACE,IAAA,CAAM,IAAA,CACN,IAAA,CAAM,SAAA,CACN,YAAA,CAAc,SAChB,CACF,CAAA,CACA,OAAA,CAAS,CACP,CACE,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,OAAA,CACN,YAAA,CAAc,0BAAA,CACd,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,OAAA,CACN,YAAA,CAAc,OAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,IAAA,CAAM,QAAA,CACN,YAAA,CAAc,QAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,IAAA,CAAM,OAAA,CACN,YAAA,CAAc,OAChB,CAAA,CACA,CACE,IAAA,CAAM,aAAA,CACN,IAAA,CAAM,SAAA,CACN,YAAA,CAAc,SAChB,CACF,CACF,CACF,CAAA,CACA,eAAA,CAAiB,MACnB,CAAA,CACA,CACE,IAAA,CAAM,UAAA,CACN,IAAA,CAAM,wBAAA,CACN,MAAA,CAAQ,CACN,CACE,IAAA,CAAM,IAAA,CACN,IAAA,CAAM,SAAA,CACN,YAAA,CAAc,SAChB,CAAA,CACA,CACE,IAAA,CAAM,KAAA,CACN,IAAA,CAAM,SAAA,CACN,YAAA,CAAc,SAChB,CACF,CAAA,CACA,OAAA,CAAS,CACP,CACE,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,OAAA,CACN,YAAA,CAAc,0BAAA,CACd,UAAA,CAAY,CACV,CACE,IAAA,CA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S,CAAA,CAAA,CACT,YAAA,CAAc,SAChB,CAAA,CACA,CACE,IAAA,CAAM,aAAA,CACN,IAAA,CAAM,QAAA,CACN,OAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAc,QAChB,CAAA,CACA,CACE,IAAA,CAAM,OAAA,CACN,IAAA,CAAM,OAAA,CACN,OAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAc,OAChB,CAAA,CACA,CACE,IAAA,CAAM,MAAA,CACN,IAAA,CAAM,QAAA,CACN,OAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAc,QAChB,CACF,CAAA,CACA,SAAA,CAAW,CAAA,CACb,CACF,CAAA,CAAA,cAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-OUD27MU7.cjs","sourcesContent":["export const pythAbi = [\n {\n type: \"function\",\n name: \"getEmaPrice\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getEmaPriceNoOlderThan\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"age\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getEmaPriceUnsafe\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPrice\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPriceNoOlderThan\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"age\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPriceUnsafe\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getUpdateFee\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n ],\n outputs: [\n {\n name: \"feeAmount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getValidTimePeriod\",\n inputs: [],\n outputs: [\n {\n name: \"validTimePeriod\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"parsePriceFeedUpdates\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"minPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n ],\n outputs: [\n {\n name: \"priceFeeds\",\n type: \"tuple[]\",\n internalType: \"struct PythStructs.PriceFeed[]\",\n components: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"emaPrice\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n },\n ],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"parsePriceFeedUpdatesUnique\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"minPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n ],\n outputs: [\n {\n name: \"priceFeeds\",\n type: \"tuple[]\",\n internalType: \"struct PythStructs.PriceFeed[]\",\n components: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"emaPrice\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n },\n ],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"updatePriceFeeds\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"updatePriceFeedsIfNecessary\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"publishTimes\",\n type: \"uint64[]\",\n internalType: \"uint64[]\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"event\",\n name: \"BatchPriceFeedUpdate\",\n inputs: [\n {\n name: \"chainId\",\n type: \"uint16\",\n indexed: false,\n internalType: \"uint16\",\n },\n {\n name: \"sequenceNumber\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PriceFeedUpdate\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"publishTime\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n {\n name: \"price\",\n type: \"int64\",\n indexed: false,\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n] as const;\n"]}
1
+ {"version":3,"sources":["../src/abi/pyth/pyth.ts"],"names":["pythAbi"],"mappings":"AAAO,6EAAMA,CAAAA,CAAU,CACrB,CACE,IAAA,CAAM,UAAA,CACN,IAAA,CAAM,aAAA,C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AM,QAAA,CACN,OAAA,CAAS,CAAA,CAAA,CACT,YAAA,CAAc,QAChB,CACF,CAAA,CACA,SAAA,CAAW,CAAA,CACb,CACF,CAAA,CAAA,cAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-OUD27MU7.cjs","sourcesContent":["export const pythAbi = [\n {\n type: \"function\",\n name: \"getEmaPrice\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getEmaPriceNoOlderThan\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"age\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getEmaPriceUnsafe\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPrice\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPriceNoOlderThan\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"age\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getPriceUnsafe\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n ],\n outputs: [\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getUpdateFee\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n ],\n outputs: [\n {\n name: \"feeAmount\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getValidTimePeriod\",\n inputs: [],\n outputs: [\n {\n name: \"validTimePeriod\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"parsePriceFeedUpdates\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"minPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n ],\n outputs: [\n {\n name: \"priceFeeds\",\n type: \"tuple[]\",\n internalType: \"struct PythStructs.PriceFeed[]\",\n components: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"emaPrice\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n },\n ],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"parsePriceFeedUpdatesUnique\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"minPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"maxPublishTime\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n ],\n outputs: [\n {\n name: \"priceFeeds\",\n type: \"tuple[]\",\n internalType: \"struct PythStructs.PriceFeed[]\",\n components: [\n {\n name: \"id\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"price\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n {\n name: \"emaPrice\",\n type: \"tuple\",\n internalType: \"struct PythStructs.Price\",\n components: [\n {\n name: \"price\",\n type: \"int64\",\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n internalType: \"uint64\",\n },\n {\n name: \"expo\",\n type: \"int32\",\n internalType: \"int32\",\n },\n {\n name: \"publishTime\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n },\n ],\n },\n ],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"updatePriceFeeds\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"updatePriceFeedsIfNecessary\",\n inputs: [\n {\n name: \"updateData\",\n type: \"bytes[]\",\n internalType: \"bytes[]\",\n },\n {\n name: \"priceIds\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n {\n name: \"publishTimes\",\n type: \"uint64[]\",\n internalType: \"uint64[]\",\n },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"event\",\n name: \"BatchPriceFeedUpdate\",\n inputs: [\n {\n name: \"chainId\",\n type: \"uint16\",\n indexed: false,\n internalType: \"uint16\",\n },\n {\n name: \"sequenceNumber\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PriceFeedUpdate\",\n inputs: [\n {\n name: \"id\",\n type: \"bytes32\",\n indexed: true,\n internalType: \"bytes32\",\n },\n {\n name: \"publishTime\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n {\n name: \"price\",\n type: \"int64\",\n indexed: false,\n internalType: \"int64\",\n },\n {\n name: \"conf\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n] as const;\n"]}
@@ -1,2 +1,2 @@
1
- import{a as B,b as E}from"./chunk-K5L2B4DU.mjs";import{a as h,b as g}from"./chunk-ZW2N63FI.mjs";import{a as S}from"./chunk-MK5NS5B5.mjs";import{a as v,d as m}from"./chunk-WLJHFHKF.mjs";import{a as y}from"./chunk-KUQEX7H3.mjs";import{f as P,h as b}from"./chunk-GXV2JA36.mjs";import{createContext as N,useContext as O}from"react";import{isFlagEnabled as U}from"@berachain/config/internal/edge-config";import{jsx as Y}from"react/jsx-runtime";var W=N(void 0);function pe({children:e,flags:t,aggregators:a,swberaAprWindow:n="DAY"}){return Y(W.Provider,{value:{...S,...t,aggregators:a?Object.entries(a).filter(([,r])=>U(r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function D(){let e=O(W);if(!e)throw new Error("BeraFlagsProvider not found");return e}function fe(e){return D()[e]}import{createContext as V,useContext as q,useState as K}from"react";import{jsx as Q}from"react/jsx-runtime";var w=V({protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Te(){let e=q(w);if(!e)throw new P({level:"fatal",message:"BexStateContext is not defined"});return e}function he({children:e,isVaultPaused:t,labels:a,factories:n}){let[r,u]=K(),s=(r?.isPaused&&!r?.isInRecoveryMode)??!1,l=t||r?.isPaused;return Q(w.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:a,onPoolChange:u,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!l}:void 0},children:e})}import{createContext as _,useContext as G}from"react";import{mainnet as J}from"@berachain/config/mainnet";import{jsx as z}from"react/jsx-runtime";function ve(){return G(F)}var F=_(J.averageBlockTime);function Ee({children:e,blockTime:t,...a}){let{config:n}=y(a);return z(F.Provider,{value:t??n.averageBlockTime,children:e})}import{createContext as X,useContext as Z}from"react";import{jsx as $}from"react/jsx-runtime";var L=X(void 0);function Fe({children:e,...t}){return $(L.Provider,{value:t,children:e})}function Le(){let e=Z(L);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}import oe from"swr";import{useBeraWallet as te,useConfig as ne}from"@berachain/wagmi/hooks";import{getChains as j,multicall as ee}from"@wagmi/core";import{formatUnits as M}from"viem";async function R({account:e,wagmiConfig:t,chainId:a,ensoClient:n}){let u=(await n.getBalances({useEoa:!0,chainId:a??"all",eoaAddress:e})).map(o=>({name:o.name,symbol:o.symbol,decimals:o.decimals,address:m(o.token,"ETH")?v.address:o.token,logoURI:o.logoUri,balance:{raw:o.amount.toString(),formatted:M(BigInt(o.amount),o.decimals)},chainId:Number(o.chainId),price:Number(o.price)})),s=Object.groupBy(u,o=>o.chainId??0),l=await Promise.allSettled(Object.entries(s).map(async([o,i])=>{if(!i)return;let p=j(t).find(d=>d.id===Number(o));if(!p)return;let k=p.contracts?.multicall3?.address;if(!k)return g.captureException(new b({property:"multicallAddress",value:k,expected:"Address",chainId:Number(o)})),i;let f=await ee(t,{chainId:Number(o),contracts:i.map(d=>E({token:d,account:e,multicallAddress:k})),allowFailure:!0}),x=[];for(let d=0;d<i.length;d++){let T=i[d];if(f[d].status==="success"){let C=f[d].result;x.push({...T,balance:{raw:C?.toString()??"0",formatted:M(C??0n,T.decimals)}})}else console.error("error getting balance",f[d].error),g.captureException(h({cause:f[d].error})),x.push(T)}return x})),c=[];for(let o of l)o.status==="fulfilled"?c.push(...o.value??[]):g.captureException(h({cause:o.reason}));return c.sort((o,i)=>{let p=Number(o.balance.formatted)*(o.price??0);return Number(i.balance.formatted)*(i.price??0)-p})}function A({chainId:e}={},t){let{address:a}=te(),n=ne(),r=!!a&&(t?.opts?.isEnabled??!0),s=oe(r&&n?["useEnsoUserTokensWithBalances",a,e]:null,async([,l,c])=>R({account:l,wagmiConfig:n,chainId:c??"all",ensoClient:B()}),{refreshInterval:1e5,isEnabled:r,...t?.opts});return{...s,refresh:()=>s.mutate()}}import{createContext as re,useMemo as ae}from"react";import{isFlagEnabled as se}from"@berachain/config/internal/edge-config";function H({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let a=e.map(s=>({...s,default:!0})),n=a.filter(s=>s.tags?.some(l=>l==="featured")),r=[...a,...t];return{tokenList:r.filter((s,l)=>r.findIndex(c=>m(c,s))===l),customTokenList:t,featuredTokenList:n}}import{jsx as le}from"react/jsx-runtime";var ie=re(void 0);function je({children:e,defaultTokens:t,edgeConfigTokenList:a,userTokens:n,onAddToken:r,onRemoveToken:u}){let{data:s,refresh:l}=A(),{tokenList:c=[],featuredTokenList:o=[]}=ae(()=>H({defaultTokenList:[...t,...a?.filter(i=>se(i.enabled))],externalList:[...n,...(s??[]).map(i=>({...i,balance:void 0,price:void 0}))]}),[t,n,a,s]);return le(ie.Provider,{value:{tokenList:c,userTokens:n,featuredTokens:o,ensoTokens:s,onAddToken(i){r(i,{defaultTokens:t,userTokens:n,tokenList:c})},onRemoveToken:u,refresh:()=>{l()}},children:e})}export{pe as a,D as b,fe as c,w as d,Te as e,he as f,ve as g,F as h,Ee as i,L as j,Fe as k,Le as l,A as m,ie as n,je as o};
2
- //# sourceMappingURL=chunk-JIPSTWKO.mjs.map
1
+ import{a as S}from"./chunk-MK5NS5B5.mjs";import{a as B,b as E}from"./chunk-XCVDZUEF.mjs";import{a as v,d as m}from"./chunk-2VO2D4QO.mjs";import{a as h,b as g}from"./chunk-A5BNPBXN.mjs";import{a as y}from"./chunk-JHUVLM54.mjs";import{h as P,j as b}from"./chunk-5SIQ7BKT.mjs";import{createContext as N,useContext as O}from"react";import{isFlagEnabled as U}from"@berachain/config/internal/edge-config";import{jsx as Y}from"react/jsx-runtime";var W=N(void 0);function pe({children:e,flags:t,aggregators:a,swberaAprWindow:n="DAY"}){return Y(W.Provider,{value:{...S,...t,aggregators:a?Object.entries(a).filter(([,r])=>U(r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function D(){let e=O(W);if(!e)throw new Error("BeraFlagsProvider not found");return e}function fe(e){return D()[e]}import{createContext as V,useContext as q,useState as K}from"react";import{jsx as Q}from"react/jsx-runtime";var w=V({protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Te(){let e=q(w);if(!e)throw new P({level:"fatal",message:"BexStateContext is not defined"});return e}function he({children:e,isVaultPaused:t,labels:a,factories:n}){let[r,u]=K(),s=(r?.isPaused&&!r?.isInRecoveryMode)??!1,l=t||r?.isPaused;return Q(w.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:a,onPoolChange:u,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!l}:void 0},children:e})}import{createContext as _,useContext as G}from"react";import{mainnet as J}from"@berachain/config/mainnet";import{jsx as z}from"react/jsx-runtime";function ve(){return G(F)}var F=_(J.averageBlockTime);function Ee({children:e,blockTime:t,...a}){let{config:n}=y(a);return z(F.Provider,{value:t??n.averageBlockTime,children:e})}import{createContext as X,useContext as Z}from"react";import{jsx as $}from"react/jsx-runtime";var L=X(void 0);function Fe({children:e,...t}){return $(L.Provider,{value:t,children:e})}function Le(){let e=Z(L);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}import oe from"swr";import{useBeraWallet as te,useConfig as ne}from"@berachain/wagmi/hooks";import{getChains as j,multicall as ee}from"@wagmi/core";import{formatUnits as M}from"viem";async function R({account:e,wagmiConfig:t,chainId:a,ensoClient:n}){let u=(await n.getBalances({useEoa:!0,chainId:a??"all",eoaAddress:e})).map(o=>({name:o.name,symbol:o.symbol,decimals:o.decimals,address:m(o.token,"ETH")?v.address:o.token,logoURI:o.logoUri,balance:{raw:o.amount.toString(),formatted:M(BigInt(o.amount),o.decimals)},chainId:Number(o.chainId),price:Number(o.price)})),s=Object.groupBy(u,o=>o.chainId??0),l=await Promise.allSettled(Object.entries(s).map(async([o,i])=>{if(!i)return;let p=j(t).find(d=>d.id===Number(o));if(!p)return;let k=p.contracts?.multicall3?.address;if(!k)return g.captureException(new b({property:"multicallAddress",value:k,expected:"Address",chainId:Number(o)})),i;let f=await ee(t,{chainId:Number(o),contracts:i.map(d=>E({token:d,account:e,multicallAddress:k})),allowFailure:!0}),x=[];for(let d=0;d<i.length;d++){let T=i[d];if(f[d].status==="success"){let C=f[d].result;x.push({...T,balance:{raw:C?.toString()??"0",formatted:M(C??0n,T.decimals)}})}else console.error("error getting balance",f[d].error),g.captureException(h({cause:f[d].error})),x.push(T)}return x})),c=[];for(let o of l)o.status==="fulfilled"?c.push(...o.value??[]):g.captureException(h({cause:o.reason}));return c.sort((o,i)=>{let p=Number(o.balance.formatted)*(o.price??0);return Number(i.balance.formatted)*(i.price??0)-p})}function A({chainId:e}={},t){let{address:a}=te(),n=ne(),r=!!a&&(t?.opts?.isEnabled??!0),s=oe(r&&n?["useEnsoUserTokensWithBalances",a,e]:null,async([,l,c])=>R({account:l,wagmiConfig:n,chainId:c??"all",ensoClient:B()}),{refreshInterval:1e5,isEnabled:r,...t?.opts});return{...s,refresh:()=>s.mutate()}}import{createContext as re,useMemo as ae}from"react";import{isFlagEnabled as se}from"@berachain/config/internal/edge-config";function H({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let a=e.map(s=>({...s,default:!0})),n=a.filter(s=>s.tags?.some(l=>l==="featured")),r=[...a,...t];return{tokenList:r.filter((s,l)=>r.findIndex(c=>m(c,s))===l),customTokenList:t,featuredTokenList:n}}import{jsx as le}from"react/jsx-runtime";var ie=re(void 0);function je({children:e,defaultTokens:t,edgeConfigTokenList:a,userTokens:n,onAddToken:r,onRemoveToken:u}){let{data:s,refresh:l}=A(),{tokenList:c=[],featuredTokenList:o=[]}=ae(()=>H({defaultTokenList:[...t,...a?.filter(i=>se(i.enabled))],externalList:[...n,...(s??[]).map(i=>({...i,balance:void 0,price:void 0}))]}),[t,n,a,s]);return le(ie.Provider,{value:{tokenList:c,userTokens:n,featuredTokens:o,ensoTokens:s,onAddToken(i){r(i,{defaultTokens:t,userTokens:n,tokenList:c})},onRemoveToken:u,refresh:()=>{l()}},children:e})}export{pe as a,D as b,fe as c,w as d,Te as e,he as f,ve as g,F as h,Ee as i,L as j,Fe as k,Le as l,A as m,ie as n,je as o};
2
+ //# sourceMappingURL=chunk-OYF32BQQ.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQVIAMSZ6cjs = require('./chunk-QVIAMSZ6.cjs');var _chunk6JJIZCVYcjs = require('./chunk-6JJIZCVY.cjs');var _viem = require('viem');var _mainnet = require('@berachain/config/mainnet');var u={address:_viem.zeroAddress,decimals:18,name:"Bera",symbol:"BERA",logoURI:"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public"},g= exports.b ={address:_mainnet.mainnet.tokens.wbera,decimals:18,name:"WBera",symbol:"WBERA"};function w(n){let{config:s,chainId:e}=_chunkQVIAMSZ6cjs.a.call(void 0, n);return{address:s.honey.token,symbol:"HONEY",name:"Honey",decimals:18,chainId:e}}function y(...n){let[s,e,t]=n;if(s===void 0)return!1;let o=typeof s=="string"?s:s.address;if(typeof e=="string"&&!_viem.isAddress.call(void 0, e)&&!e.startsWith("0x")){if(e==="BERA")return o.toLowerCase()===_viem.zeroAddress;if(e==="WBERA")return o.toLowerCase()===_mainnet.mainnet.tokens.wbera;if(e==="ETH")return o.toLowerCase()===_viem.ethAddress;if(e==="SWBERA")return o.toLowerCase()===_mainnet.mainnet.tokens.swbera.toLowerCase();if(t===void 0)throw new (0, _chunk6JJIZCVYcjs.h)({property:"baseArgs",value:t,expected:"BeraJS.BaseFunctionArgs",message:"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: "+e+" and token address: "+o});let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, t),i={BGT:r.tokens.bgt,HONEY:r.honey.token,SWBERA:r.tokens.swbera,ETH:_viem.ethAddress};if(e in i)return o.toLowerCase()===i[e].toLowerCase()}let A=typeof e=="object"?e.address:e;return o.toLowerCase()===A.toLowerCase()}exports.a = u; exports.b = g; exports.c = w; exports.d = y;
2
- //# sourceMappingURL=chunk-54BTOQE3.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFDEUAXETcjs = require('./chunk-FDEUAXET.cjs');var _chunkDKZGCMH4cjs = require('./chunk-DKZGCMH4.cjs');var _viem = require('viem');var _mainnet = require('@berachain/config/mainnet');var u={address:_viem.zeroAddress,decimals:18,name:"Bera",symbol:"BERA",logoURI:"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public"},g= exports.b ={address:_mainnet.mainnet.tokens.wbera,decimals:18,name:"WBera",symbol:"WBERA"};function w(n){let{config:s,chainId:e}=_chunkFDEUAXETcjs.a.call(void 0, n);return{address:s.honey.token,symbol:"HONEY",name:"Honey",decimals:18,chainId:e}}function y(...n){let[s,e,t]=n;if(s===void 0)return!1;let o=typeof s=="string"?s:s.address;if(typeof e=="string"&&!_viem.isAddress.call(void 0, e)&&!e.startsWith("0x")){if(e==="BERA")return o.toLowerCase()===_viem.zeroAddress;if(e==="WBERA")return o.toLowerCase()===_mainnet.mainnet.tokens.wbera;if(e==="ETH")return o.toLowerCase()===_viem.ethAddress;if(e==="SWBERA")return o.toLowerCase()===_mainnet.mainnet.tokens.swbera.toLowerCase();if(t===void 0)throw new (0, _chunkDKZGCMH4cjs.j)({property:"baseArgs",value:t,expected:"BeraJS.BaseFunctionArgs",message:"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: "+e+" and token address: "+o});let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, t),i={BGT:r.tokens.bgt,HONEY:r.honey.token,SWBERA:r.tokens.swbera,ETH:_viem.ethAddress};if(e in i)return o.toLowerCase()===i[e].toLowerCase()}let A=typeof e=="object"?e.address:e;return o.toLowerCase()===A.toLowerCase()}exports.a = u; exports.b = g; exports.c = w; exports.d = y;
2
+ //# sourceMappingURL=chunk-PFUVKW6F.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-PFUVKW6F.cjs","../src/utils/tokens.ts"],"names":["beraToken","zeroAddress","wBeraToken","mainnet","getHoneyToken","baseArgs","config","chainId","parseBaseArgs","isToken","args","token","compareTo","tokenAddress","isAddress","ethAddress","InvalidArgumentError","tokenMap","compareToAddress"],"mappings":"AAAA,iIAAmC,wDAAyC,4BCAX,oDAEzC,IAMXA,CAAAA,CAAY,CACvB,OAAA,CAASC,iBAAAA,CACT,QAAA,CAAU,EAAA,CACV,IAAA,CAAM,MAA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AA,GAAME,gBAAAA,CAGxC,EAAA,CAAIH,CAAAA,GAAc,QAAA,CAEhB,OAAOC,CAAAA,CAAa,WAAA,CAAY,CAAA,GAAMV,gBAAAA,CAAQ,MAAA,CAAO,MAAA,CAAO,WAAA,CAAY,CAAA,CAG1E,EAAA,CAAIE,CAAAA,GAAa,KAAA,CAAA,CACf,MAAM,IAAIW,wBAAAA,CAAqB,CAC7B,QAAA,CAAU,UAAA,CACV,KAAA,CAAOX,CAAAA,CACP,QAAA,CAAU,yBAAA,CACV,OAAA,CACE,4GAAA,CACAO,CAAAA,CACA,sBAAA,CACAC,CACJ,CAAC,CAAA,CAEH,GAAM,CAAE,MAAA,CAAAP,CAAO,CAAA,CAAIE,iCAAAA,CAAsB,CAAA,CAEnCS,CAAAA,CAAoE,CACxE,GAAA,CAAKX,CAAAA,CAAO,MAAA,CAAO,GAAA,CACnB,KAAA,CAAOA,CAAAA,CAAO,KAAA,CAAM,KAAA,CACpB,MAAA,CAAQA,CAAAA,CAAO,MAAA,CAAO,MAAA,CACtB,GAAA,CAAKS,gBACP,CAAA,CACA,EAAA,CAAIH,EAAAA,GAAaK,CAAAA,CACf,OACEJ,CAAAA,CAAa,WAAA,CAAY,CAAA,GACzBI,CAAAA,CAASL,CAAkC,CAAA,CAAE,WAAA,CAAY,CAG/D,CAEA,IAAMM,CAAAA,CACJ,OAAON,CAAAA,EAAc,QAAA,CAAWA,CAAAA,CAAU,OAAA,CAAUA,CAAAA,CAEtD,OAAOC,CAAAA,CAAa,WAAA,CAAY,CAAA,GAAMK,CAAAA,CAAiB,WAAA,CAAY,CACrE,CAAA,2DAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-PFUVKW6F.cjs","sourcesContent":[null,"import { type Address, ethAddress, isAddress, zeroAddress } from \"viem\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport { parseBaseArgs } from \"./parseBaseArgs\";\n\nexport const beraToken = {\n address: zeroAddress,\n decimals: 18,\n name: \"Bera\",\n symbol: \"BERA\",\n logoURI:\n \"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport const wBeraToken = {\n address: mainnet.tokens.wbera,\n decimals: 18,\n name: \"WBera\",\n symbol: \"WBERA\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport function getHoneyToken(baseArgs: BeraJS.BaseFunctionArgs) {\n const { config, chainId } = parseBaseArgs(baseArgs);\n\n return {\n address: config.honey.token,\n symbol: \"HONEY\",\n name: \"Honey\",\n decimals: 18,\n chainId,\n } as const satisfies TokenWithMetadata;\n}\n\ntype KnownTokens = \"BERA\" | \"WBERA\" | \"BGT\" | \"HONEY\" | \"SWBERA\" | \"ETH\";\n\ntype BaseToken =\n | {\n address: Address | string;\n }\n | Address;\n\ntype InputToken = BaseToken | string | undefined;\n\ntype IsTokenParams =\n | [\n token: InputToken,\n compareTo:\n | BaseToken\n | Extract<KnownTokens, \"BERA\" | \"WBERA\" | \"ETH\" | \"SWBERA\">,\n ]\n | [\n token: InputToken,\n compareTo: BaseToken | KnownTokens,\n baseArgs: BeraJS.BaseFunctionArgs,\n ];\n\nexport function isToken(...args: IsTokenParams): boolean {\n const [token, compareTo, baseArgs] = args;\n\n if (token === undefined) return false;\n\n const tokenAddress = typeof token === \"string\" ? token : token.address;\n\n if (\n typeof compareTo === \"string\" &&\n !isAddress(compareTo) &&\n // this is a safeguard against weird inputs from enso. `0x00`\n !compareTo.startsWith(\"0x\")\n ) {\n if (compareTo === \"BERA\") {\n return tokenAddress.toLowerCase() === zeroAddress;\n }\n if (compareTo === \"WBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.wbera;\n }\n\n if (compareTo === \"ETH\") {\n return tokenAddress.toLowerCase() === ethAddress;\n }\n\n if (compareTo === \"SWBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.swbera.toLowerCase();\n }\n\n if (baseArgs === undefined) {\n throw new InvalidArgumentError({\n property: \"baseArgs\",\n value: baseArgs,\n expected: \"BeraJS.BaseFunctionArgs\",\n message:\n \"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: \" +\n compareTo +\n \" and token address: \" +\n tokenAddress,\n });\n }\n const { config } = parseBaseArgs(baseArgs);\n\n const tokenMap: Record<Exclude<KnownTokens, \"BERA\" | \"WBERA\">, Address> = {\n BGT: config.tokens.bgt,\n HONEY: config.honey.token,\n SWBERA: config.tokens.swbera,\n ETH: ethAddress as Address,\n } as const;\n if (compareTo in tokenMap) {\n return (\n tokenAddress.toLowerCase() ===\n tokenMap[compareTo as keyof typeof tokenMap].toLowerCase()\n );\n }\n }\n\n const compareToAddress =\n typeof compareTo === \"object\" ? compareTo.address : compareTo;\n\n return tokenAddress.toLowerCase() === compareToAddress.toLowerCase();\n}\n"]}
@@ -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(); } } 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 _chunkQVIAMSZ6cjs = require('./chunk-QVIAMSZ6.cjs');var _chunkS4CDSVLKcjs = require('./chunk-S4CDSVLK.cjs');var _chunk6JJIZCVYcjs = require('./chunk-6JJIZCVY.cjs');var _client = require('@apollo/client');var _internal = require('@berachain/config/internal');var l=class extends _client.ApolloClient{constructor(n){super(n),this.url=n.url,this.serviceName=n.name}async query(n){let r=b(n.query),t={url:this.url,type:"graphql",name:this.serviceName},a={"operation.type":"query","operation.source.name":t.name,"operation.source.url":t.url,"operation.source.type":t.type,"operation.source.queryName":r};try{let e=()=>super.query(n),c=await _chunkS4CDSVLKcjs.a.startSpan({name:`GraphQL ${r}`,op:"BeraApolloClient.query",attributes:a},e);if(c.error||c.data===void 0)throw new (0, _chunk6JJIZCVYcjs.f)({level:"fatal",tags:a,message:"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none"});return{data:c.data}}catch(e){throw!_internal.appConfig.env.isProduction&&console.error("BeraApolloClient error",e),_client.ServerError.is(e)?new (0, _chunk6JJIZCVYcjs.g)({response:e.response,cause:e,statusCode:e.statusCode,endpoint:t,tags:a}):e instanceof TypeError?new (0, _chunk6JJIZCVYcjs.g)({level:"fatal",reason:"TypeError",response:e,cause:e,endpoint:t,tags:a}):new (0, _chunk6JJIZCVYcjs.g)({response:e,tags:a,cause:e,endpoint:t})}}};function b(o){return _optionalChain([o, 'access', _ => _.definitions, 'access', _2 => _2.find, 'call', _3 => _3(r=>r.kind==="OperationDefinition"), 'optionalAccess', _4 => _4.name, 'optionalAccess', _5 => _5.value])}var _http = require('@apollo/client/link/http');var _config = require('@berachain/config');var _api = require('@berachain/graphql/dex/api'); var _api2 = _interopRequireDefault(_api);function E(o){let n=typeof o=="string"?void 0:o.headers,r=!!_internal.currentDapp,t=process.env.VERCEL_ENV==="test",a=_config.getUriFromLink.call(void 0, o),e=typeof o=="string"?"unknown":o.name;return{uri:a,name:e,headers:{...n,"x-graphql-client-name":`berachain.${r?"dapps":t?"test":"berajs"}`,"x-graphql-client-version":`${process.env.VERCEL_TARGET_ENV}.${process.env.VERCEL_GIT_COMMIT_SHA}`}}}function s(o,{ssrMode:n,inMemoryCacheOptions:r}={}){let t=_config.getUriFromLink.call(void 0, o),a=typeof o=="string"?void 0:o.headers,e=typeof o=="string"?void 0:o.name;return!e&&t.includes(_internal.goldskyBaseUrl)&&(e=t.replace(_internal.goldskyBaseUrl,"").replace("/gn","")),new l({url:t,name:_nullishCoalesce(e, () => ("unknown")),link:new (0, _http.HttpLink)({uri:t,headers:a}),defaultOptions:{query:{errorPolicy:"none",fetchPolicy:"no-cache"}},cache:new (0, _client.InMemoryCache)(r),ssrMode:n})}function R(o,{...n}){let{config:r}=_chunkQVIAMSZ6cjs.a.call(void 0, n);switch(o){case"api":return s(E(r.api),{inMemoryCacheOptions:{possibleTypes:_api2.default.possibleTypes}});case"bend.whisk":if(!r.bend.whiskApi)throw new (0, _chunk6JJIZCVYcjs.f)({message:"Bend whisk API is not configured on this chain",level:"error"});return s(r.bend.whiskApi);case"honey.subgraph":return s(r.honey.subgraph);case"pol.subgraph":return s(r.pol.subgraph);case"pol.fees":return s(r.pol.feesSubgraph);case"governance.subgraph":return s(r.governance.subgraph);case"bex.subgraph":return s(r.bex.subgraph)}}exports.a = l; exports.b = R; exports.c = _client.gql;
2
- //# sourceMappingURL=chunk-JSTCUTXP.cjs.map
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(); } } 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 _chunkFDEUAXETcjs = require('./chunk-FDEUAXET.cjs');var _chunkS4CDSVLKcjs = require('./chunk-S4CDSVLK.cjs');var _chunkDKZGCMH4cjs = require('./chunk-DKZGCMH4.cjs');var _client = require('@apollo/client');var _internal = require('@berachain/config/internal');var l=class extends _client.ApolloClient{constructor(n){super(n),this.url=n.url,this.serviceName=n.name}async query(n){let r=b(n.query),t={url:this.url,type:"graphql",name:this.serviceName},a={"operation.type":"query","operation.source.name":t.name,"operation.source.url":t.url,"operation.source.type":t.type,"operation.source.queryName":r};try{let e=()=>super.query(n),c=await _chunkS4CDSVLKcjs.a.startSpan({name:`GraphQL ${r}`,op:"BeraApolloClient.query",attributes:a},e);if(c.error||c.data===void 0)throw new (0, _chunkDKZGCMH4cjs.h)({level:"fatal",tags:a,message:"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none"});return{data:c.data}}catch(e){throw!_internal.appConfig.env.isProduction&&console.error("BeraApolloClient error",e),_client.ServerError.is(e)?new (0, _chunkDKZGCMH4cjs.i)({response:e.response,cause:e,statusCode:e.statusCode,endpoint:t,tags:a}):e instanceof TypeError?new (0, _chunkDKZGCMH4cjs.i)({level:"fatal",reason:"TypeError",response:e,cause:e,endpoint:t,tags:a}):new (0, _chunkDKZGCMH4cjs.i)({response:e,tags:a,cause:e,endpoint:t})}}};function b(o){return _optionalChain([o, 'access', _ => _.definitions, 'access', _2 => _2.find, 'call', _3 => _3(r=>r.kind==="OperationDefinition"), 'optionalAccess', _4 => _4.name, 'optionalAccess', _5 => _5.value])}var _http = require('@apollo/client/link/http');var _config = require('@berachain/config');var _api = require('@berachain/graphql/dex/api'); var _api2 = _interopRequireDefault(_api);function E(o){let n=typeof o=="string"?void 0:o.headers,r=!!_internal.currentDapp,t=process.env.VERCEL_ENV==="test",a=_config.getUriFromLink.call(void 0, o),e=typeof o=="string"?"unknown":o.name;return{uri:a,name:e,headers:{...n,"x-graphql-client-name":`berachain.${r?"dapps":t?"test":"berajs"}`,"x-graphql-client-version":`${process.env.VERCEL_TARGET_ENV}.${process.env.VERCEL_GIT_COMMIT_SHA}`}}}function s(o,{ssrMode:n,inMemoryCacheOptions:r}={}){let t=_config.getUriFromLink.call(void 0, o),a=typeof o=="string"?void 0:o.headers,e=typeof o=="string"?void 0:o.name;return!e&&t.includes(_internal.goldskyBaseUrl)&&(e=t.replace(_internal.goldskyBaseUrl,"").replace("/gn","")),new l({url:t,name:_nullishCoalesce(e, () => ("unknown")),link:new (0, _http.HttpLink)({uri:t,headers:a}),defaultOptions:{query:{errorPolicy:"none",fetchPolicy:"no-cache"}},cache:new (0, _client.InMemoryCache)(r),ssrMode:n})}function R(o,{...n}){let{config:r}=_chunkFDEUAXETcjs.a.call(void 0, n);switch(o){case"api":return s(E(r.api),{inMemoryCacheOptions:{possibleTypes:_api2.default.possibleTypes}});case"bend.whisk":if(!r.bend.whiskApi)throw new (0, _chunkDKZGCMH4cjs.h)({message:"Bend whisk API is not configured on this chain",level:"error"});return s(r.bend.whiskApi);case"honey.subgraph":return s(r.honey.subgraph);case"pol.subgraph":return s(r.pol.subgraph);case"pol.fees":return s(r.pol.feesSubgraph);case"governance.subgraph":return s(r.governance.subgraph);case"bex.subgraph":return s(r.bex.subgraph)}}exports.a = l; exports.b = R; exports.c = _client.gql;
2
+ //# sourceMappingURL=chunk-QHCLZTCK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-QHCLZTCK.cjs","../src/actions/clients/BeraApolloClient.ts"],"names":["BeraApolloClient","ApolloClient","options","queryName","getQueryName","endpoint","tags","executeQuery","res","BeraTracing"],"mappings":"AAAA,y0BAAwC,wDAAyC,wDAAgD,wCCM1H,sDAEmB,IAYbA,CAAAA,CAAN,MAAA,QAA+BC,oBAAa,CAIvC,WAGV,CACEC,CAAAA,CAUA,CACA,KAAA,CAAMA,CAAO,CAAA,CACb,IAAA,CAAK,GAAA,CAAMA,CAAAA,CAAQ,GAAA,CACnB,IAAA,CAAK,WAAA,CAAcA,CAAAA,CAAQ,IAC7B,CAEA,MAAM,KAAA,CAKJA,CAAAA,CAIC,CACD,IAAMC,CAAAA,CAAYC,CAAAA,CAAaF,CAAAA,CAAQ,KAAK,CAAA,CAEtCG,CAAAA,CAAW,CACf,GAAA,CAAK,IAAA,CAAK,GAAA,CACV,IAAA,CAAM,SAAA,CACN,IAAA,CAAM,IAAA,CAAK,WACb,CAAA,CAEMC,CAAAA,CAAO,CACX,gBAAA,CAAkB,OAAA,CAClB,uBAAA,CAAyBD,CAAAA,CAAS,IAAA,CAClC,sBAAA,CAAwBA,CAAAA,CAAS,GAAA,CACjC,uBAAA,CAAyBA,CAAAA,CAAS,IAAA,CAClC,4BAAA,CAA8BF,CAChC,CAAA,CAEA,GAAI,CACF,IAAMI,CAAAA,CAAe,CAAA,CAAA,EACnB,KAAA,CAAM,KAAA,CACJL,CACF,CAAA,CAEIM,CAAAA,CAAM,MAAMC,mBAAAA,CAAY,SAAA,CAC5B,CACE,IAAA,CAAM,CAAA,QAAA,EAAWN,CAAS,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-QHCLZTCK.cjs","sourcesContent":[null,"import {\n ApolloClient,\n type DocumentNode,\n type ErrorLike,\n type OperationVariables,\n ServerError,\n} from \"@apollo/client\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { BeraError } from \"../../errors/BeraError\";\nimport { BeraTracing } from \"../../errors/BeraTracing\";\nimport { RequestError } from \"../../errors/RequestError\";\n\n/**\n * This is a wrapper around the ApolloClient that throws a BeraError if the query returns an error or no data.\n *\n * It's mostly a typescript helper that keeps data always defined since we use errorPolicy: \"none\" by default.\n * Such setting will throw an error if the query returns an error, rather than returning an object with undefined data and an error property.\n */\nexport class BeraApolloClient extends ApolloClient {\n /**\n * The URL of the endpoint. Used for error reporting only.\n */\n protected url: string;\n\n protected serviceName: string;\n constructor(\n options: ApolloClient.Options & {\n /**\n * The URL of the endpoint. Used for error reporting only.\n */\n url: string;\n /**\n * The name of the graphql service. Used for error reporting only.\n */\n name: string;\n },\n ) {\n super(options);\n this.url = options.url;\n this.serviceName = options.name;\n }\n\n async query<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n // We handle errors in our custom logic so we don't need to pass errorPolicy here\n options: Omit<ApolloClient.QueryOptions<TData, TVariables>, \"errorPolicy\">,\n ): Promise<{\n // Only data is returned and we're sure it's not undefined due to errorPolicy\n data: TData;\n }> {\n const queryName = getQueryName(options.query);\n\n const endpoint = {\n url: this.url,\n type: \"graphql\",\n name: this.serviceName,\n } as const;\n\n const tags = {\n \"operation.type\": \"query\",\n \"operation.source.name\": endpoint.name,\n \"operation.source.url\": endpoint.url,\n \"operation.source.type\": endpoint.type,\n \"operation.source.queryName\": queryName,\n };\n\n try {\n const executeQuery = () =>\n super.query<TData, TVariables>(\n options as ApolloClient.QueryOptions<TData, TVariables>,\n );\n\n const res = await BeraTracing.startSpan(\n {\n name: `GraphQL ${queryName}`,\n op: \"BeraApolloClient.query\",\n attributes: tags,\n },\n executeQuery,\n );\n\n if (res.error || res.data === undefined) {\n throw new BeraError({\n level: \"fatal\",\n tags,\n message:\n \"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none\",\n });\n }\n\n return { data: res.data } as const;\n } catch (error) {\n !appConfig.env.isProduction &&\n console.error(\"BeraApolloClient error\", error);\n\n if (ServerError.is(error)) {\n throw new RequestError({\n // reason: error,\n response: error.response,\n cause: error,\n statusCode: error.statusCode,\n endpoint,\n tags,\n });\n }\n if (error instanceof TypeError) {\n throw new RequestError({\n level: \"fatal\",\n reason: \"TypeError\",\n response: error,\n cause: error,\n endpoint,\n tags,\n });\n }\n throw new RequestError({\n response: error as ErrorLike,\n tags,\n cause: error,\n endpoint,\n });\n }\n }\n}\n\nfunction getQueryName(queryDefinition: DocumentNode) {\n const likelyNode = queryDefinition.definitions.find(\n (def) => def.kind === (\"OperationDefinition\" as const),\n );\n\n return likelyNode?.name?.value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/abi/enso/ensoWalletV2Factory.ts"],"names":["ensoWalletV2FactoryAbi"],"mappings":"AAAO,6EAAMA,CAAAA,CAAyB,CACpC,CACE,MAAA,CAAQ,CAAC,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,MAAA,CAAQ,IAAA,CAAM,SAAU,CAAC,CAAA,CACnE,IAAA,CAAM,YAAA,CACN,OAAA,CAAS,CAAC,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,EAAA,CAAI,IAAA,CAAM,SAAU,CAAC,CAAA,CAChE,eAAA,CAAiB,MAAA,CACjB,IAAA,CAAM,UACR,CACF,CAAA,CAAA,cAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-RWOICHRW.cjs","sourcesContent":["export const ensoWalletV2FactoryAbi = [\n {\n inputs: [{ internalType: \"address\", name: \"user\", type: \"address\" }],\n name: \"getAddress\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n"]}
1
+ {"version":3,"sources":["../src/abi/enso/ensoWalletV2Factory.ts"],"names":["ensoWalletV2FactoryAbi"],"mappings":"AAAO,6EAAMA,CAAAA,CAAyB,CACpC,CACE,MAAA,CAAQ,CAAC,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,MAAA,CAAQ,IAAA,CAAM,SAAU,CAAC,CAAA,CACnE,IAAA,CAAM,YAAA,CACN,OAAA,CAAS,CAAC,CAAE,YAAA,CAAc,SAAA,CAAW,IAAA,CAAM,EAAA,CAAI,IAAA,CAAM,SAAU,CAAC,CAAA,CAChE,eAAA,CAAiB,MAAA,CACjB,IAAA,CAAM,UACR,CACF,CAAA,CAAA,cAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-RWOICHRW.cjs","sourcesContent":["export const ensoWalletV2FactoryAbi = [\n {\n inputs: [{ internalType: \"address\", name: \"user\", type: \"address\" }],\n name: \"getAddress\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n"]}
@@ -1,4 +1,4 @@
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(); } } 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 _chunkJSTCUTXPcjs = require('./chunk-JSTCUTXP.cjs');var _chunk33XNWMPPcjs = require('./chunk-33XNWMPP.cjs');var _viem = require('viem');function c({fieldOrType:t,value:e,required:r=!0,baseUrl:s,components:i}){if(!["bool","string"].includes(t)&&r&&(e==null||e===""))return"Required";if(t.startsWith("uint")||t.startsWith("int")){if(typeof e!="string")return"Invalid amount";try{let n=BigInt(e);if(t.startsWith("uint")&&n<0n)return"Negative amount"}catch (e2){return"Invalid amount"}return null}switch(t){case"string":return e!==void 0&&typeof e!="string"?"Invalid amount":null;case"bool":return typeof e!="boolean"?"Invalid amount":null;case"title":return typeof e!="string"||e.length===0?"Required":null;case"description":return typeof e!="string"||e.length===0?"Required":null;case"forumLink":{if(typeof e!="string"||e.length===0)return"Required";if(!URL.canParse(e))return"Invalid address";let n=new URL(s);return e.startsWith(n.toString())?null:"Must be a berachain forum link"}case"address":return typeof e!="string"||!_viem.isAddress.call(void 0, e,{strict:!0})?"Invalid address":null;case"hex":return typeof e!="string"||!_viem.isHex.call(void 0, e,{strict:!0})?"Invalid address":null;case"abi":if(typeof e!="string")return"Invalid ABI";try{JSON.parse(e)}catch (e3){return"Invalid ABI"}return null;case"action":return typeof e!="string"||!_viem.isAddress.call(void 0, e,{strict:!0})?"Invalid address":null;case"tuple":if(typeof e=="object"&&Array.isArray(i)){let n={};for(let a of i){let p=a,d=p.name;n[d]=c({fieldOrType:p.type,value:e[d],components:p.components})}return Object.values(n).every(a=>a===null)?null:n}return null;case"tuple[]":if(Array.isArray(e)){let n=e.map(a=>c({fieldOrType:"tuple",value:a,components:i}));return n.every(a=>a===null)?null:n}return null;case"logoURI":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS or IPFS":null;case"url":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS":null;default:return console.error(`Invalid field or type: ${t}`),null}}var _governance = require('@berachain/graphql/governance');var A=!1,x= exports.b =[_governance.ProposalStatus.Active,_governance.ProposalStatus.PendingQueue,_governance.ProposalStatus.PendingExecution,_governance.ProposalStatus.Defeated,_governance.ProposalStatus.QuorumNotReached];function g(t,e){let r=Date.now()/1e3;if(e!==void 0){if(t.status===_governance.ProposalStatus.CanceledByGuardian)return _governance.ProposalStatus.CanceledByGuardian;if(e===2)return Number(t.voteStartAt)<r?_governance.ProposalStatus.CanceledByUser:_governance.ProposalStatus.CanceledByGuardian;if(e===3)return t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:_governance.ProposalStatus.Defeated:_governance.ProposalStatus.QuorumNotReached;if(e===4)return _governance.ProposalStatus.PendingQueue;if(e===5)return Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:_governance.ProposalStatus.InQueue;if(e===6)return console.warn("Unexpected expired state on proposal id: ",t.id),_governance.ProposalStatus.Defeated}return t.status===_governance.ProposalStatus.InQueue&&Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:A&&e===1&&t.quorum&&BigInt(t.quorum)<BigInt(t.pollResult.totalTowardsQuorum)&&Number(t.pollResult.forPercentage)>Number(t.pollResult.againstPercentage)?_governance.ProposalStatus.PendingQueue:t.status===_governance.ProposalStatus.Pending?Number(t.voteStartAt)<r&&Number(t.voteEndAt)>r?_governance.ProposalStatus.Active:Number(t.voteEndAt)<r?t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:_optionalChain([t, 'access', _ => _.pollResult, 'optionalAccess', _2 => _2.against])>_optionalChain([t, 'access', _3 => _3.pollResult, 'optionalAccess', _4 => _4.for])?_governance.ProposalStatus.Defeated:_governance.ProposalStatus.PendingQueue:_governance.ProposalStatus.QuorumNotReached:_governance.ProposalStatus.Pending:t.status===_governance.ProposalStatus.Active&&Number(t.voteEndAt)<r?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:BigInt(_nullishCoalesce(_optionalChain([t, 'access', _5 => _5.pollResult, 'optionalAccess', _6 => _6.against]), () => (0n)))>BigInt(_nullishCoalesce(_optionalChain([t, 'access', _7 => _7.pollResult, 'optionalAccess', _8 => _8.for]), () => (0n)))?_governance.ProposalStatus.Defeated:_governance.ProposalStatus.PendingQueue:t.status===_governance.ProposalStatus.InQueue&&Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:t.status}async function L({where:t,orderBy:e,orderDirection:r,offset:s=0,perPage:i=20,text:l,...n}){try{if(i>1e3)throw new Error("perPage must be less than 1000");let a=_chunkJSTCUTXPcjs.b.call(void 0, "governance.subgraph",n),[p]=await Promise.all([l?a.query({query:_governance.SearchProposals,variables:{offset:s,limit:i,where:t,text:l}}):a.query({query:_governance.GetProposals,variables:{offset:s,limit:i,where:t,orderBy:e,orderDirection:r}})]);return p.data.proposals.map(d=>({...d,status:g(d)}))}catch(a){throw console.error("getAllProposals:",a),a}}function U({proposal:t,currentTopic:e}){let r={};return r.title=c({fieldOrType:"title",value:t.title}),r.description=c({fieldOrType:"description",value:t.description}),r.forumLink=c({fieldOrType:"forumLink",value:t.forumLink,baseUrl:e.forumLink}),r}async function W({proposalId:t,...e}){let s=await _chunkJSTCUTXPcjs.b.call(void 0, "governance.subgraph",e).query({query:_governance.GetProposal,variables:{id:t}});if(s.data.proposal)return{...s.data.proposal,status:g(s.data.proposal)}}var _graymatter = require('gray-matter'); var _graymatter2 = _interopRequireDefault(_graymatter);function S(t){let e=/#(?:([\w-]+)# )?(.+)\n([\s\S]*)/,r=t.match(e);if(r){let s=r[1]||null,i=r[2],l=r[3].replace(`
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(); } } 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 _chunkQHCLZTCKcjs = require('./chunk-QHCLZTCK.cjs');var _chunkFQSOUEIJcjs = require('./chunk-FQSOUEIJ.cjs');var _viem = require('viem');function c({fieldOrType:t,value:e,required:r=!0,baseUrl:s,components:i}){if(!["bool","string"].includes(t)&&r&&(e==null||e===""))return"Required";if(t.startsWith("uint")||t.startsWith("int")){if(typeof e!="string")return"Invalid amount";try{let n=BigInt(e);if(t.startsWith("uint")&&n<0n)return"Negative amount"}catch (e2){return"Invalid amount"}return null}switch(t){case"string":return e!==void 0&&typeof e!="string"?"Invalid amount":null;case"bool":return typeof e!="boolean"?"Invalid amount":null;case"title":return typeof e!="string"||e.length===0?"Required":null;case"description":return typeof e!="string"||e.length===0?"Required":null;case"forumLink":{if(typeof e!="string"||e.length===0)return"Required";if(!URL.canParse(e))return"Invalid address";let n=new URL(s);return e.startsWith(n.toString())?null:"Must be a berachain forum link"}case"address":return typeof e!="string"||!_viem.isAddress.call(void 0, e,{strict:!0})?"Invalid address":null;case"hex":return typeof e!="string"||!_viem.isHex.call(void 0, e,{strict:!0})?"Invalid address":null;case"abi":if(typeof e!="string")return"Invalid ABI";try{JSON.parse(e)}catch (e3){return"Invalid ABI"}return null;case"action":return typeof e!="string"||!_viem.isAddress.call(void 0, e,{strict:!0})?"Invalid address":null;case"tuple":if(typeof e=="object"&&Array.isArray(i)){let n={};for(let a of i){let p=a,d=p.name;n[d]=c({fieldOrType:p.type,value:e[d],components:p.components})}return Object.values(n).every(a=>a===null)?null:n}return null;case"tuple[]":if(Array.isArray(e)){let n=e.map(a=>c({fieldOrType:"tuple",value:a,components:i}));return n.every(a=>a===null)?null:n}return null;case"logoURI":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS or IPFS":null;case"url":return e===void 0||e===""?null:typeof e!="string"||!URL.canParse(e)||new URL(e).protocol!=="https:"?"Must be HTTPS":null;default:return console.error(`Invalid field or type: ${t}`),null}}var _governance = require('@berachain/graphql/governance');var A=!1,x= exports.b =[_governance.ProposalStatus.Active,_governance.ProposalStatus.PendingQueue,_governance.ProposalStatus.PendingExecution,_governance.ProposalStatus.Defeated,_governance.ProposalStatus.QuorumNotReached];function g(t,e){let r=Date.now()/1e3;if(e!==void 0){if(t.status===_governance.ProposalStatus.CanceledByGuardian)return _governance.ProposalStatus.CanceledByGuardian;if(e===2)return Number(t.voteStartAt)<r?_governance.ProposalStatus.CanceledByUser:_governance.ProposalStatus.CanceledByGuardian;if(e===3)return t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:_governance.ProposalStatus.Defeated:_governance.ProposalStatus.QuorumNotReached;if(e===4)return _governance.ProposalStatus.PendingQueue;if(e===5)return Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:_governance.ProposalStatus.InQueue;if(e===6)return console.warn("Unexpected expired state on proposal id: ",t.id),_governance.ProposalStatus.Defeated}return t.status===_governance.ProposalStatus.InQueue&&Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:A&&e===1&&t.quorum&&BigInt(t.quorum)<BigInt(t.pollResult.totalTowardsQuorum)&&Number(t.pollResult.forPercentage)>Number(t.pollResult.againstPercentage)?_governance.ProposalStatus.PendingQueue:t.status===_governance.ProposalStatus.Pending?Number(t.voteStartAt)<r&&Number(t.voteEndAt)>r?_governance.ProposalStatus.Active:Number(t.voteEndAt)<r?t.pollResult?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:_optionalChain([t, 'access', _ => _.pollResult, 'optionalAccess', _2 => _2.against])>_optionalChain([t, 'access', _3 => _3.pollResult, 'optionalAccess', _4 => _4.for])?_governance.ProposalStatus.Defeated:_governance.ProposalStatus.PendingQueue:_governance.ProposalStatus.QuorumNotReached:_governance.ProposalStatus.Pending:t.status===_governance.ProposalStatus.Active&&Number(t.voteEndAt)<r?!t.quorum||BigInt(t.quorum)>BigInt(t.pollResult.totalTowardsQuorum)?_governance.ProposalStatus.QuorumNotReached:BigInt(_nullishCoalesce(_optionalChain([t, 'access', _5 => _5.pollResult, 'optionalAccess', _6 => _6.against]), () => (0n)))>BigInt(_nullishCoalesce(_optionalChain([t, 'access', _7 => _7.pollResult, 'optionalAccess', _8 => _8.for]), () => (0n)))?_governance.ProposalStatus.Defeated:_governance.ProposalStatus.PendingQueue:t.status===_governance.ProposalStatus.InQueue&&Number(t.queueEnd)<Date.now()/1e3?_governance.ProposalStatus.PendingExecution:t.status}async function L({where:t,orderBy:e,orderDirection:r,offset:s=0,perPage:i=20,text:l,...n}){try{if(i>1e3)throw new Error("perPage must be less than 1000");let a=_chunkQHCLZTCKcjs.b.call(void 0, "governance.subgraph",n),[p]=await Promise.all([l?a.query({query:_governance.SearchProposals,variables:{offset:s,limit:i,where:t,text:l}}):a.query({query:_governance.GetProposals,variables:{offset:s,limit:i,where:t,orderBy:e,orderDirection:r}})]);return p.data.proposals.map(d=>({...d,status:g(d)}))}catch(a){throw console.error("getAllProposals:",a),a}}function U({proposal:t,currentTopic:e}){let r={};return r.title=c({fieldOrType:"title",value:t.title}),r.description=c({fieldOrType:"description",value:t.description}),r.forumLink=c({fieldOrType:"forumLink",value:t.forumLink,baseUrl:e.forumLink}),r}async function W({proposalId:t,...e}){let s=await _chunkQHCLZTCKcjs.b.call(void 0, "governance.subgraph",e).query({query:_governance.GetProposal,variables:{id:t}});if(s.data.proposal)return{...s.data.proposal,status:g(s.data.proposal)}}var _graymatter = require('gray-matter'); var _graymatter2 = _interopRequireDefault(_graymatter);function S(t){let e=/#(?:([\w-]+)# )?(.+)\n([\s\S]*)/,r=t.match(e);if(r){let s=r[1]||null,i=r[2],l=r[3].replace(`
2
2
  `,"<br />");return{type:s,title:i,content:l}}throw new Error("Invalid proposal body")}function y(t){if(!t)return{isFrontMatter:!1,data:{title:"Loading..."},content:"",matter:"",language:"",orig:"",stringify:()=>""};let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _9 => _9.description]), () => (""));if(_graymatter2.default.test(e))return{..._graymatter2.default.call(void 0, e),isFrontMatter:!0};try{let r=S(e);return{isFrontMatter:!1,data:{title:r.title},content:r.content,matter:"",language:"",orig:e,stringify:()=>e}}catch (e4){return{isFrontMatter:!1,data:{title:_optionalChain([t, 'optionalAccess', _10 => _10.description, 'optionalAccess', _11 => _11.split, 'call', _12 => _12(`
3
- `), 'access', _13 => _13[0], 'access', _14 => _14.slice, 'call', _15 => _15(0,100)])},content:e,matter:"",language:"",orig:e,stringify:()=>e}}}var _berachainGovernance = require('@berachain/abis/gov/berachainGovernance');async function Z(t){_chunk33XNWMPPcjs.b.call(void 0, t.publicClient);let e;"tx"in t?e=t.tx:e=await t.publicClient.getTransactionReceipt({hash:t.txHash});let r=_optionalChain([e, 'optionalAccess', _16 => _16.logs])?_optionalChain([_viem.parseEventLogs.call(void 0, {abi:_berachainGovernance.berachainGovernanceAbi,logs:e.logs,eventName:"ProposalCreated"}), 'optionalAccess', _17 => _17.at, 'call', _18 => _18(0)]):void 0;if(!e||!r)return null;let s=await t.publicClient.getBlock({blockNumber:e.blockNumber}),i=y({description:_optionalChain([r, 'optionalAccess', _19 => _19.args, 'access', _20 => _20.description])});return{id:String(r.args.proposalId),proposalId:String(_optionalChain([r, 'optionalAccess', _21 => _21.args, 'access', _22 => _22.proposalId])),createdAt:s.timestamp.toString(),title:i.data.title,createdAtBlock:s.timestamp.toString(),voteStartAt:String(_optionalChain([r, 'optionalAccess', _23 => _23.args, 'access', _24 => _24.voteStart])),voteEndAt:String(_optionalChain([r, 'optionalAccess', _25 => _25.args, 'access', _26 => _26.voteEnd])),proposer:_optionalChain([r, 'optionalAccess', _27 => _27.args, 'access', _28 => _28.proposer]),description:i.content,unverifiedForumLink:i.data.forumLink,pollResult:{for:"0",forVotersCount:0,forPercentage:"0",against:"0",againstVotersCount:0,againstPercentage:"0",abstain:"0",abstainVotersCount:0,abstainPercentage:"0",total:"0",totalVotersCount:0,totalTowardsQuorum:"0"},status:_governance.ProposalStatus.Pending,quorum:null,topics:i.data.topics,votes:[],executableCalls:_optionalChain([r, 'optionalAccess', _29 => _29.args, 'access', _30 => _30.targets, 'access', _31 => _31.map, 'call', _32 => _32((l,n)=>({__typename:"ExecutableCall",id:`${e.transactionHash}-${n}`,target:l,value:String(_optionalChain([r, 'optionalAccess', _33 => _33.args, 'access', _34 => _34.values, 'access', _35 => _35[n]])),calldata:_optionalChain([r, 'optionalAccess', _36 => _36.args, 'access', _37 => _37.calldatas, 'access', _38 => _38[n]])}))]),timelock:void 0}}async function oe({variables:t,...e}){return _chunkJSTCUTXPcjs.b.call(void 0, "governance.subgraph",e).query({query:_governance.GetProposalVotes,variables:t})}exports.a = c; exports.b = x; exports.c = g; exports.d = L; exports.e = U; exports.f = W; exports.g = y; exports.h = Z; exports.i = oe;
4
- //# sourceMappingURL=chunk-CHFETMC6.cjs.map
3
+ `), 'access', _13 => _13[0], 'access', _14 => _14.slice, 'call', _15 => _15(0,100)])},content:e,matter:"",language:"",orig:e,stringify:()=>e}}}var _berachainGovernance = require('@berachain/abis/gov/berachainGovernance');async function Z(t){_chunkFQSOUEIJcjs.b.call(void 0, t.publicClient);let e;"tx"in t?e=t.tx:e=await t.publicClient.getTransactionReceipt({hash:t.txHash});let r=_optionalChain([e, 'optionalAccess', _16 => _16.logs])?_optionalChain([_viem.parseEventLogs.call(void 0, {abi:_berachainGovernance.berachainGovernanceAbi,logs:e.logs,eventName:"ProposalCreated"}), 'optionalAccess', _17 => _17.at, 'call', _18 => _18(0)]):void 0;if(!e||!r)return null;let s=await t.publicClient.getBlock({blockNumber:e.blockNumber}),i=y({description:_optionalChain([r, 'optionalAccess', _19 => _19.args, 'access', _20 => _20.description])});return{id:String(r.args.proposalId),proposalId:String(_optionalChain([r, 'optionalAccess', _21 => _21.args, 'access', _22 => _22.proposalId])),createdAt:s.timestamp.toString(),title:i.data.title,createdAtBlock:s.timestamp.toString(),voteStartAt:String(_optionalChain([r, 'optionalAccess', _23 => _23.args, 'access', _24 => _24.voteStart])),voteEndAt:String(_optionalChain([r, 'optionalAccess', _25 => _25.args, 'access', _26 => _26.voteEnd])),proposer:_optionalChain([r, 'optionalAccess', _27 => _27.args, 'access', _28 => _28.proposer]),description:i.content,unverifiedForumLink:i.data.forumLink,pollResult:{for:"0",forVotersCount:0,forPercentage:"0",against:"0",againstVotersCount:0,againstPercentage:"0",abstain:"0",abstainVotersCount:0,abstainPercentage:"0",total:"0",totalVotersCount:0,totalTowardsQuorum:"0"},status:_governance.ProposalStatus.Pending,quorum:null,topics:i.data.topics,votes:[],executableCalls:_optionalChain([r, 'optionalAccess', _29 => _29.args, 'access', _30 => _30.targets, 'access', _31 => _31.map, 'call', _32 => _32((l,n)=>({__typename:"ExecutableCall",id:`${e.transactionHash}-${n}`,target:l,value:String(_optionalChain([r, 'optionalAccess', _33 => _33.args, 'access', _34 => _34.values, 'access', _35 => _35[n]])),calldata:_optionalChain([r, 'optionalAccess', _36 => _36.args, 'access', _37 => _37.calldatas, 'access', _38 => _38[n]])}))]),timelock:void 0}}async function oe({variables:t,...e}){return _chunkQHCLZTCKcjs.b.call(void 0, "governance.subgraph",e).query({query:_governance.GetProposalVotes,variables:t})}exports.a = c; exports.b = x; exports.c = g; exports.d = L; exports.e = U; exports.f = W; exports.g = y; exports.h = Z; exports.i = oe;
4
+ //# sourceMappingURL=chunk-S2TNHMSV.cjs.map