@berachain/berajs 0.2.8-beta.11 → 0.2.8-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.cts} +31 -2
- package/dist/{BeraError-_mQdkanr.d.ts → BeraError-7-A5JYy_.d.ts} +31 -2
- package/dist/{RequestError-DSUzJ1Iy.d.cts → RequestError-02juqN-5.d.cts} +1 -1
- package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +2 -2
- package/dist/actions/exports.d.ts +2 -2
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/governance/exports.cjs +1 -1
- package/dist/actions/governance/exports.cjs.map +1 -1
- package/dist/actions/governance/exports.mjs +1 -1
- package/dist/chunk-2A347ZVN.mjs +2 -0
- package/dist/{chunk-NXXMW2O7.mjs.map → chunk-2A347ZVN.mjs.map} +1 -1
- package/dist/{chunk-WLJHFHKF.mjs → chunk-2VO2D4QO.mjs} +2 -2
- package/dist/chunk-5FVW5XU3.mjs +2 -0
- package/dist/chunk-5FVW5XU3.mjs.map +1 -0
- package/dist/{chunk-GXV2JA36.mjs → chunk-5SIQ7BKT.mjs} +2 -2
- package/dist/chunk-5SIQ7BKT.mjs.map +1 -0
- package/dist/{chunk-ENT2OSXT.mjs → chunk-5XOEJ6XX.mjs} +2 -2
- package/dist/{chunk-ZW2N63FI.mjs → chunk-A5BNPBXN.mjs} +2 -2
- package/dist/{chunk-4TALWNXE.cjs → chunk-COSP3YIF.cjs} +2 -2
- package/dist/chunk-COSP3YIF.cjs.map +1 -0
- package/dist/chunk-D6L7LTA2.cjs.map +1 -1
- package/dist/{chunk-JXM5S4IU.mjs → chunk-DA7GK43B.mjs} +2 -2
- package/dist/chunk-DDEQFR3M.cjs.map +1 -1
- package/dist/{chunk-6JJIZCVY.cjs → chunk-DKZGCMH4.cjs} +2 -2
- package/dist/chunk-DKZGCMH4.cjs.map +1 -0
- package/dist/{chunk-Y2FETC6T.cjs → chunk-F4V5B6F7.cjs} +2 -2
- package/dist/chunk-F4V5B6F7.cjs.map +1 -0
- package/dist/{chunk-QVIAMSZ6.cjs → chunk-FDEUAXET.cjs} +2 -2
- package/dist/chunk-FDEUAXET.cjs.map +1 -0
- package/dist/{chunk-33XNWMPP.cjs → chunk-FQSOUEIJ.cjs} +2 -2
- package/dist/chunk-FQSOUEIJ.cjs.map +1 -0
- package/dist/{chunk-XZC34BHM.cjs → chunk-GEIY554A.cjs} +2 -2
- package/dist/chunk-GEIY554A.cjs.map +1 -0
- package/dist/{chunk-KUQEX7H3.mjs → chunk-JHUVLM54.mjs} +2 -2
- package/dist/{chunk-RCWM55DE.cjs → chunk-JZL5JPDJ.cjs} +2 -2
- package/dist/chunk-JZL5JPDJ.cjs.map +1 -0
- package/dist/{chunk-H6ZO4SLB.mjs → chunk-LUNZGZWN.mjs} +2 -2
- package/dist/{chunk-RJN36GBU.mjs → chunk-OCAMR6XC.mjs} +2 -2
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/{chunk-JIPSTWKO.mjs → chunk-OYF32BQQ.mjs} +2 -2
- package/dist/{chunk-54BTOQE3.cjs → chunk-PFUVKW6F.cjs} +2 -2
- package/dist/chunk-PFUVKW6F.cjs.map +1 -0
- package/dist/{chunk-JSTCUTXP.cjs → chunk-QHCLZTCK.cjs} +2 -2
- package/dist/chunk-QHCLZTCK.cjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -1
- package/dist/{chunk-CHFETMC6.cjs → chunk-S2TNHMSV.cjs} +3 -3
- package/dist/chunk-S2TNHMSV.cjs.map +1 -0
- package/dist/chunk-S4CDSVLK.cjs.map +1 -1
- package/dist/{chunk-5QAFKFM5.mjs → chunk-TU63NRNL.mjs} +2 -2
- package/dist/{chunk-REWME3FY.cjs → chunk-W4JE2NIN.cjs} +2 -2
- package/dist/chunk-W4JE2NIN.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XB2SEO4Y.cjs +2 -0
- package/dist/chunk-XB2SEO4Y.cjs.map +1 -0
- package/dist/chunk-XCVDZUEF.mjs +2 -0
- package/dist/{chunk-K5L2B4DU.mjs.map → chunk-XCVDZUEF.mjs.map} +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/chunk-YYUSCGVI.cjs +2 -0
- package/dist/chunk-YYUSCGVI.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/governance/exports.cjs.map +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +4 -3
- package/dist/errors/exports.d.ts +4 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{global.d-ylUk_etZ.d.ts → global.d-C4FnE4cz.d.ts} +1 -1
- package/dist/{global.d-B9nLZ7ul.d.cts → global.d-CicOIudf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +2 -2
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +3 -3
- package/dist/hooks/exports.d.ts +3 -3
- package/dist/hooks/exports.mjs +2 -2
- package/dist/hooks/governance/exports.cjs +1 -1
- package/dist/hooks/governance/exports.cjs.map +1 -1
- package/dist/hooks/governance/exports.d.cts +2 -2
- package/dist/hooks/governance/exports.d.ts +2 -2
- package/dist/hooks/governance/exports.mjs +1 -1
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/dist/types/governance/exports.cjs.map +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +13 -4
- package/dist/utils/exports.d.ts +13 -4
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +46 -40
- package/src/actions/__test/transports.ts +61 -0
- package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
- package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
- package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
- package/src/data/contracts.ts +5 -0
- package/src/errors/BeraError.ts +27 -0
- package/src/errors/BeraTracing.unit.test.ts +65 -0
- package/src/errors/RequestError.ts +12 -0
- package/src/errors/exports.ts +5 -0
- package/src/errors/getRevertReason.integration.test.ts +3 -3
- package/src/errors/spanStatus.ts +78 -0
- package/src/errors/spanStatus.unit.test.ts +62 -0
- package/src/utils/beraFetch.ts +9 -3
- package/src/utils/exports.ts +1 -0
- package/src/utils/getServerSideClient.ts +4 -2
- package/src/utils/sanitizeRpcUrl.ts +22 -0
- package/src/utils/tracedTransport.ts +35 -0
- package/dist/chunk-33XNWMPP.cjs.map +0 -1
- package/dist/chunk-4TALWNXE.cjs.map +0 -1
- package/dist/chunk-54BTOQE3.cjs.map +0 -1
- package/dist/chunk-6DIA6PXV.cjs +0 -2
- package/dist/chunk-6DIA6PXV.cjs.map +0 -1
- package/dist/chunk-6JJIZCVY.cjs.map +0 -1
- package/dist/chunk-BE6B4PQF.cjs +0 -2
- package/dist/chunk-BE6B4PQF.cjs.map +0 -1
- package/dist/chunk-CHFETMC6.cjs.map +0 -1
- package/dist/chunk-GXV2JA36.mjs.map +0 -1
- package/dist/chunk-JDDRTHFG.mjs +0 -2
- package/dist/chunk-JDDRTHFG.mjs.map +0 -1
- package/dist/chunk-JSTCUTXP.cjs.map +0 -1
- package/dist/chunk-K5L2B4DU.mjs +0 -2
- package/dist/chunk-NXXMW2O7.mjs +0 -2
- package/dist/chunk-QVIAMSZ6.cjs.map +0 -1
- package/dist/chunk-RCWM55DE.cjs.map +0 -1
- package/dist/chunk-REWME3FY.cjs.map +0 -1
- package/dist/chunk-XZC34BHM.cjs.map +0 -1
- package/dist/chunk-Y2FETC6T.cjs.map +0 -1
- /package/dist/{chunk-WLJHFHKF.mjs.map → chunk-2VO2D4QO.mjs.map} +0 -0
- /package/dist/{chunk-ENT2OSXT.mjs.map → chunk-5XOEJ6XX.mjs.map} +0 -0
- /package/dist/{chunk-ZW2N63FI.mjs.map → chunk-A5BNPBXN.mjs.map} +0 -0
- /package/dist/{chunk-JXM5S4IU.mjs.map → chunk-DA7GK43B.mjs.map} +0 -0
- /package/dist/{chunk-KUQEX7H3.mjs.map → chunk-JHUVLM54.mjs.map} +0 -0
- /package/dist/{chunk-H6ZO4SLB.mjs.map → chunk-LUNZGZWN.mjs.map} +0 -0
- /package/dist/{chunk-RJN36GBU.mjs.map → chunk-OCAMR6XC.mjs.map} +0 -0
- /package/dist/{chunk-JIPSTWKO.mjs.map → chunk-OYF32BQQ.mjs.map} +0 -0
- /package/dist/{chunk-5QAFKFM5.mjs.map → chunk-TU63NRNL.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a}from"./chunk-JHUVLM54.mjs";import{j as k}from"./chunk-5SIQ7BKT.mjs";import{ethAddress as c,isAddress as m,zeroAddress as p}from"viem";import{mainnet as d}from"@berachain/config/mainnet";var u={address:p,decimals:18,name:"Bera",symbol:"BERA",logoURI:"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public"},g={address:d.tokens.wbera,decimals:18,name:"WBera",symbol:"WBERA"};function w(n){let{config:s,chainId:e}=a(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"&&!m(e)&&!e.startsWith("0x")){if(e==="BERA")return o.toLowerCase()===p;if(e==="WBERA")return o.toLowerCase()===d.tokens.wbera;if(e==="ETH")return o.toLowerCase()===c;if(e==="SWBERA")return o.toLowerCase()===d.tokens.swbera.toLowerCase();if(t===void 0)throw new k({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}=a(t),i={BGT:r.tokens.bgt,HONEY:r.honey.token,SWBERA:r.tokens.swbera,ETH:c};if(e in i)return o.toLowerCase()===i[e].toLowerCase()}let A=typeof e=="object"?e.address:e;return o.toLowerCase()===A.toLowerCase()}export{u as a,g as b,w as c,y as d};
|
|
2
|
+
//# sourceMappingURL=chunk-2VO2D4QO.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as E}from"./chunk-PRLVZIKD.mjs";import{i as x}from"./chunk-5SIQ7BKT.mjs";async function $(e){if(e.headers.get("content-type")?.includes("application/json"))return e.json();{let t=await e.text();try{return JSON.parse(t)}catch{return{message:"Unknown error, can't decode response into JSON",cause:t}}}}function R(e){if(!e)return"";try{let n=new URL(e);return n.hostname.endsWith(".quiknode.pro")?(n.pathname="/",n.search="",n.toString()):e}catch{return e}}async function V(e,n,t){try{let r=R(typeof e=="string"||e instanceof URL?e.toString():e.url.toString()).replace(/0x[a-fA-F0-9]{40}/g,":address");if(t?.keepQueryParams!==!0&&URL.canParse(r)){let i=new URL(r).searchParams;if(Array.isArray(t?.keepQueryParams)){let a=new URLSearchParams;for(let m of t.keepQueryParams)a.set(m,i.get(m)??"");let c=new URL(r);c.search=a.toString(),r=c.toString()}else{let a=new URL(r);a.search="",r=a.toString()}}let s=typeof e=="string"||e instanceof URL?void 0:e.name;return await E.startSpan({op:"beraFetch",name:s?`beraFetch ${s}`:"beraFetch",attributes:typeof e=="string"||e instanceof URL?{"operation.source.url":r,...t?.attributes}:{"operation.source.url":r,"operation.source.type":e.type,"operation.source.name":e.name,...t?.attributes}},async()=>{let i=await fetch(typeof e=="string"||e instanceof URL?e:e.url,{...n});if(!i.ok){let a=await $(i);throw new x({cause:a,response:i,endpoint:e})}return i})}catch(r){throw r instanceof x?r:new x({cause:r,endpoint:e,response:void 0})}}async function ae(e,n){return(await V(e,{...n,headers:{Accept:"application/json",...n?.headers}})).json()}import{parseEther as j}from"viem";var ce=j("0.005"),me=1e5,fe=1,le=.1,be=50,pe=7920027n;var de=e=>2n*BigInt(e);function ye(e){return Math.floor(e/1e3)}function k(e){return e*1e3}function q(e){return e*k(60)}function J(e){return e*60}function G(e){return e*q(60)}function X(e){return e*J(60)}function I(e){return e*G(24)}function w(e){return e*X(24)}function Ne(e){return e*I(7)}function xe(e){return e*w(7)}function Se(e){return e*I(30)}function Me(e){return e*w(30)}function Te(e){return e*I(365)}function Ie(e){return e*w(365)}function Ue(e){let n=new Date;return n.setDate(n.getDate()-e)*1e3}var Q=["January","February","March","April","May","June","July","August","September","October","November","December"],Y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function De(e,n){let t=new Date(e*1e3),r=t.getDate(),s="th";return r===1||r===21||r===31?s="st":r===2||r===22?s="nd":(r===3||r===23)&&(s="rd"),n?`${Y[t.getMonth()]} ${r}`:`${Q[t.getMonth()]} ${r}${s}, ${t.getFullYear()}`}function Fe(...e){let n=e[0],t,r,s,i;if(typeof e[1]!="object")t=e[1]??!1,r=e[2]??!1,i=e[3]??!1,s=!0;else{let u=e[1];t=u.condensed??!1;let o=u.greaterUnit??"hours";o==="days"?(r=!0,s=!0):o==="hours"?(r=!1,s=!0,i=!1):(r=!1,s=!0),i=u.showSeconds??!1}let a=Math.floor(n/(3600*24)),c=Math.floor(n%(3600*24)/3600),m=Math.floor(n%3600/60),f=n%60;if(r||(c+=a*24,a=0),a===0&&c===0&&m===0)return t?"< 1 M":"less than a minute";let g=a>0?`${a}${t?"D":" day"}${!t&&a!==1?"s":""}`:"",y=c>0?`${c}${t?"H":" hour"}${!t&&c!==1?"s":""}`:"",S=m>0&&s||!a&&!c?`${m}${t?"M":" minute"}${!t&&m!==1?"s":""}`:"",M=f>0&&i?`${f}${t?"S":" second"}${!t&&f!==1?"s":""}`:"";return[g,y,S,M].filter(Boolean).join(t?" ":", ")}import L from"bignumber.js";L.set({EXPONENTIAL_AT:1e9});var U=L;var P=["","K","M","B","T","P","E","Z","Y"];function _(e){return e instanceof U?e:new U(e)}function z(e,n){return _(e).shiftedBy(n*-1)}function Le(e,n={}){if(typeof n=="number"){let h=n;if(e==null)return"";if(typeof e=="object")throw new Error("Value must be a number if using deprecated version");let b=Number(e).toFixed(h);return b=b.replace(/(\.\d*?[1-9])0+$|\.0*$/,"$1"),b}let{visibleDecimals:t,compact:r=!0,percent:s=!1,roundDown:i=!1,roundUp:a=!1,compactThreshold:c,maxValue:m,symbol:f,prefixText:g="",suffixText:y="",showIsSmallerThanMin:S=!0,ifNullish:M=""}=n||{};if(e==null)return M;let u=s?Number(e)*100:Number(e);if(Number.isNaN(u))return"NaN";if(u===Number.POSITIVE_INFINITY)return"Infinity";if(u===Number.NEGATIVE_INFINITY)return"-Infinity";let o=t??0;u===0?o=0:t===void 0&&(Math.abs(u)>1||s||f==="USD"?o=2:o=7);let D=10**-o,F=u!==0&&Math.abs(u)<Math.abs(D),B=u<0,O=m?Math.abs(u)>m:!1,p=F?D:u,T=r&&(!c||Math.abs(u)>c);i&&!T?p=Math.trunc(Number(p)*10**o)/10**o:a&&!T&&(p=Math.ceil(Number(p)*10**o)/10**o);let N;if(O)N=u>m?"\u221E":"-\u221E";else if(T){let h=_(p),b=h.abs().toFixed(0).length;c&&Math.abs(u)<=c&&(b=0);let A=Math.min(Math.floor(b?(b-1)/3:0),P.length-1),C=P[A],d=z(h,3*A).toNumber();i?d=Math.trunc(Number(d)*10**o)/10**o:a&&(d=Math.ceil(Number(d)*10**o)/10**o),N=`${new Intl.NumberFormat("en-US",{maximumFractionDigits:o,minimumFractionDigits:o}).format(d)}${C}`}else{let h=new Intl.NumberFormat("en-US",{maximumFractionDigits:o,minimumFractionDigits:o}).format(Math.abs(p));N=`${B?"-":""}${h}`}let l=[];return g&&l.push(g),F&&S&&l.push(u<0?">":"<"),f?.toLowerCase()==="usd"&&!s&&l.push("$"),l.push(N),s&&l.push("%"),f?.toLowerCase()!=="usd"&&typeof f<"u"&&l.push(" ",f),y&&l.push(y),l.join("")}var Pe=e=>e?Number(e)>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Number(e)??0:0,_e=(e,n)=>{if(!e)return"0";let[t="0",r="0"]=`${e}`.split(".");return`${t}.${r.substring(0,n)}`};import{createTestClient as K,http as H}from"viem";import{defaultChainId as W,getRpcUrls as Z}from"@berachain/config/internal";function Ve(e=W){let n=Z(e);if(!n.isAnvil)throw new Error("No anvil RPC URL found");return K({mode:"anvil",transport:H(n.jsonRpcUrl)})}export{U as a,$ as b,R as c,V as d,ae as e,ce as f,me as g,fe as h,le as i,be as j,pe as k,de as l,ye as m,k as n,q as o,J as p,G as q,X as r,I as s,w as t,Ne as u,xe as v,Se as w,Me as x,Te as y,Ie as z,Ue as A,De as B,Fe as C,Le as D,Pe as E,_e as F,Ve as G};
|
|
2
|
+
//# sourceMappingURL=chunk-5FVW5XU3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/getErrorResponse.ts","../src/utils/sanitizeRpcUrl.ts","../src/utils/beraFetch.ts","../src/utils/constants.ts","../src/utils/pythHoneyUtils.ts","../src/utils/time.ts","../src/utils/formatTimestamps.ts","../../utils/src/pkg/bignumber.js.ts","../src/utils/formatNumber.ts","../src/utils/getTestClient.ts"],"sourcesContent":["/**\n * @deprecated use beraFetch instead\n */\nexport async function getErrorResponse(response: Response) {\n const contentType = response.headers.get(\"content-type\");\n\n if (contentType?.includes(\"application/json\")) {\n return response.json();\n } else {\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return {\n message: \"Unknown error, can't decode response into JSON\",\n cause: text,\n };\n }\n }\n}\n","/**\n * Strips secret tokens from RPC URLs for safe use in span attributes and logs.\n *\n * QuickNode URLs embed API keys as path segments, e.g.:\n * https://polished-morning-sun.bera-mainnet.quiknode.pro/abc123def/\n * This function trims the subpath, producing:\n * https://polished-morning-sun.bera-mainnet.quiknode.pro/\n */\nexport function sanitizeRpcUrl(url: string | undefined): string {\n if (!url) return \"\";\n try {\n const parsed = new URL(url);\n if (parsed.hostname.endsWith(\".quiknode.pro\")) {\n parsed.pathname = \"/\";\n parsed.search = \"\";\n return parsed.toString();\n }\n return url;\n } catch {\n return url;\n }\n}\n","import { BeraTracing, type SpanContext } from \"../errors/BeraTracing\";\nimport { RequestError } from \"../errors/RequestError\";\nimport { getErrorResponse } from \"./getErrorResponse\";\nimport { sanitizeRpcUrl } from \"./sanitizeRpcUrl\";\n\ntype RequestOptions = RequestInit;\n\nexport async function beraFetch(\n endpoint: ConstructorParameters<typeof RequestError>[0][\"endpoint\"],\n options?: RequestOptions,\n spanContext?: SpanContext & {\n /**\n * If true, keep all query params in the span URL.\n * If an array of strings, keep only the query params in the array.\n * If false, remove all query params from the span URL.\n * If not provided, remove all query params from the span URL.\n */\n keepQueryParams?: boolean | string[];\n },\n) {\n try {\n let spanUrl = sanitizeRpcUrl(\n typeof endpoint === \"string\" || endpoint instanceof URL\n ? endpoint.toString()\n : endpoint.url.toString(),\n ).replace(/0x[a-fA-F0-9]{40}/g, \":address\");\n\n if (spanContext?.keepQueryParams !== true && URL.canParse(spanUrl)) {\n const queryParams = new URL(spanUrl).searchParams;\n if (Array.isArray(spanContext?.keepQueryParams)) {\n const searchParams = new URLSearchParams();\n\n for (const param of spanContext.keepQueryParams) {\n searchParams.set(param, queryParams.get(param) ?? \"\");\n }\n\n const newUrl = new URL(spanUrl);\n newUrl.search = searchParams.toString();\n spanUrl = newUrl.toString();\n } else {\n const newUrl = new URL(spanUrl);\n newUrl.search = \"\";\n spanUrl = newUrl.toString();\n }\n }\n\n const endpointName =\n typeof endpoint === \"string\" || endpoint instanceof URL\n ? undefined\n : endpoint.name;\n\n return await BeraTracing.startSpan(\n {\n op: \"beraFetch\",\n name: endpointName ? `beraFetch ${endpointName}` : \"beraFetch\",\n attributes:\n typeof endpoint === \"string\" || endpoint instanceof URL\n ? {\n \"operation.source.url\": spanUrl,\n ...spanContext?.attributes,\n }\n : ({\n \"operation.source.url\": spanUrl,\n \"operation.source.type\": endpoint.type,\n \"operation.source.name\": endpoint.name,\n ...spanContext?.attributes,\n } satisfies SpanContext[\"attributes\"]),\n },\n async () => {\n const response = await fetch(\n typeof endpoint === \"string\" || endpoint instanceof URL\n ? endpoint\n : endpoint.url,\n {\n ...options,\n },\n );\n if (!response.ok) {\n const error = await getErrorResponse(response);\n throw new RequestError({\n cause: error,\n // @to-do import getErrorResponse logic in this function\n // when it's removed from other places\n response: response,\n endpoint,\n });\n }\n return response;\n },\n );\n } catch (error) {\n if (error instanceof RequestError) {\n throw error;\n }\n\n throw new RequestError({\n cause: error,\n endpoint,\n response: undefined,\n });\n }\n}\n\nexport async function beraFetchJson<T>(\n endpoint: ConstructorParameters<typeof RequestError>[0][\"endpoint\"],\n options?: RequestOptions,\n) {\n const response = await beraFetch(endpoint, {\n ...options,\n headers: {\n Accept: \"application/json\",\n ...options?.headers,\n },\n });\n return response.json() as Promise<T>;\n}\n","import { parseEther } from \"viem\";\n\n// the buffer of the cap limit, if the user gets close to 10% of the cap limit\n// they should be warned\nexport const CAP_LIMIT_BUFFER = parseEther(\"0.005\");\n\n/**\n * Maximum allowed input for a custom deadline in seconds.\n * @type {number}\n */\nexport const MAX_CUSTOM_DEADLINE = 100000;\n\n/**\n * Minimum allowed input for a custom deadline in seconds.\n * @type {number}\n */\nexport const MIN_CUSTOM_DEADLINE = 1;\n\n/**\n * Minimum allowed input for a custom slippage tolerance percentage.\n * @type {number}\n */\nexport const MIN_CUSTOM_SLIPPAGE = 0.1;\n\n/**\n * Maximum allowed input for a custom slippage tolerance percentage.\n * @type {number}\n */\nexport const MAX_CUSTOM_SLIPPAGE = 50;\n\n/**\n * Default gas limit used by MetaMask\n * @see {@link https://github.com/MetaMask/metamask-extension/blob/06cf7459b963e26d0ae60312d4f9a342d07ab89d/ui/pages/confirmations/send/send.constants.js#L8}\n */\nexport const DEFAULT_METAMASK_GAS_LIMIT = 7920027n;\n","export const getPythDefaultUpdateFee = (tokenListLength: number) => {\n return 2n * BigInt(tokenListLength);\n};\n","/**\n * Convert milliseconds to seconds\n */\nexport function msToSeconds(ms: number): number {\n return Math.floor(ms / 1000);\n}\n\n/**\n * Time utility functions for converting between different time units.\n *\n * This utility file provides functions to convert between seconds, minutes, hours, and days.\n * Note on naming conventions: We use \"seconds\" instead of \"secondsToMs\" because JavaScript\n * is typically based in milliseconds, so the conversion to milliseconds is the more common\n * and expected operation. We use \"xxxInSeconds\" when converting to second-based units.\n */\n\n/**\n * Convert seconds to milliseconds\n */\nexport function seconds(seconds: number): number {\n return seconds * 1000;\n}\n\n/**\n * Convert minutes to milliseconds\n */\nexport function minutes(minutes: number): number {\n return minutes * seconds(60);\n}\n\n/**\n * Convert minutes to seconds\n */\nexport function minutesInSeconds(minutes: number): number {\n return minutes * 60;\n}\n\n/**\n * Convert hours to milliseconds\n */\nexport function hours(hours: number): number {\n return hours * minutes(60);\n}\n\n/**\n * Convert hours to seconds\n */\nexport function hoursInSeconds(hours: number): number {\n return hours * minutesInSeconds(60);\n}\n\n/**\n * Convert days to milliseconds\n */\nexport function days(days: number): number {\n return days * hours(24);\n}\n\n/**\n * Convert days to seconds\n */\nexport function daysInSeconds(days: number): number {\n return days * hoursInSeconds(24);\n}\n\n/**\n * Convert weeks to milliseconds\n */\nexport function weeks(weeks: number): number {\n return weeks * days(7);\n}\n\n/**\n * Convert weeks to seconds\n */\nexport function weeksInSeconds(weeks: number): number {\n return weeks * daysInSeconds(7);\n}\n\n/**\n * Convert months to milliseconds using 30 days per month\n */\nexport function months(months: number): number {\n return months * days(30);\n}\n\n/**\n * Convert months to seconds using 30 days per month\n */\nexport function monthsInSeconds(months: number): number {\n return months * daysInSeconds(30);\n}\n\n/**\n * Convert years to milliseconds using 365 days per year\n */\nexport function years(years: number): number {\n return years * days(365);\n}\n\n/**\n * Convert years to seconds using 365 days per year\n */\nexport function yearsInSeconds(years: number): number {\n return years * daysInSeconds(365);\n}\n","export function calculateTimestampFromDays(daysRange: number): number {\n const currentDate = new Date();\n return currentDate.setDate(currentDate.getDate() - daysRange) * 1000;\n}\n\nconst monthNames = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n];\n\nconst shortMonthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n];\n\nexport function formatUnixTimestamp(unixTimestamp: number, isShort?: boolean) {\n const date = new Date(unixTimestamp * 1000);\n\n const day = date.getDate();\n let daySuffix = \"th\";\n\n if (day === 1 || day === 21 || day === 31) {\n daySuffix = \"st\";\n } else if (day === 2 || day === 22) {\n daySuffix = \"nd\";\n } else if (day === 3 || day === 23) {\n daySuffix = \"rd\";\n }\n\n if (isShort) {\n return `${shortMonthNames[date.getMonth()]} ${day}`;\n }\n\n return `${\n monthNames[date.getMonth()]\n } ${day}${daySuffix}, ${date.getFullYear()}`;\n}\n\ntype LegacyArgs = [number, boolean?, boolean?, boolean?];\ntype FormatTimeLeftArgs = [\n number,\n {\n condensed?: boolean;\n greaterUnit?: \"days\" | \"hours\" | \"minutes\";\n showSeconds?: boolean;\n },\n];\n\n/**\n * Formats the time left into a string like \"8 hours, 23 minutes\".\n *\n * @param timeLeftInSeconds - The time left in seconds.\n * @returns A formatted string representing the time left.\n */\nexport function formatTimeLeft(\n ...args: FormatTimeLeftArgs | LegacyArgs\n): string {\n const timeLeftInSeconds = args[0];\n let condensed: boolean;\n\n let showDays: boolean;\n\n let showMinutes: boolean;\n let showSeconds: boolean;\n\n if (typeof args[1] !== \"object\") {\n condensed = args[1] ?? false;\n showDays = args[2] ?? false;\n showSeconds = args[3] ?? false;\n showMinutes = true;\n } else {\n const opts = args[1];\n condensed = opts.condensed ?? false;\n const greaterUnit = opts.greaterUnit ?? \"hours\";\n\n if (greaterUnit === \"days\") {\n showDays = true;\n showMinutes = true;\n } else if (greaterUnit === \"hours\") {\n showDays = false;\n showMinutes = true;\n showSeconds = false;\n } else {\n // minutes is the default\n showDays = false;\n showMinutes = true;\n }\n showSeconds = opts.showSeconds ?? false;\n }\n\n let days = Math.floor(timeLeftInSeconds / (3600 * 24));\n let hours = Math.floor((timeLeftInSeconds % (3600 * 24)) / 3600);\n const minutes = Math.floor((timeLeftInSeconds % 3600) / 60);\n const seconds = timeLeftInSeconds % 60;\n\n // If showDays=false, roll days into hours\n if (!showDays) {\n hours += days * 24;\n days = 0;\n }\n\n if (days === 0 && hours === 0 && minutes === 0) {\n return condensed ? \"< 1 M\" : \"less than a minute\";\n }\n\n const daysDisplay =\n days > 0\n ? `${days}${condensed ? \"D\" : \" day\"}${\n !condensed && days !== 1 ? \"s\" : \"\"\n }`\n : \"\";\n\n const hoursDisplay =\n hours > 0\n ? `${hours}${condensed ? \"H\" : \" hour\"}${\n !condensed && hours !== 1 ? \"s\" : \"\"\n }`\n : \"\";\n\n const minutesDisplay =\n (minutes > 0 && showMinutes) || (!days && !hours)\n ? `${minutes}${condensed ? \"M\" : \" minute\"}${\n !condensed && minutes !== 1 ? \"s\" : \"\"\n }`\n : \"\";\n const secondsDisplay =\n seconds > 0 && showSeconds\n ? `${seconds}${condensed ? \"S\" : \" second\"}${\n !condensed && seconds !== 1 ? \"s\" : \"\"\n }`\n : \"\";\n return [daysDisplay, hoursDisplay, minutesDisplay, secondsDisplay]\n .filter(Boolean)\n .join(condensed ? \" \" : \", \");\n}\n","// biome-ignore lint/style/noRestrictedImports: the only import of bignumber.js is allowed here\nimport BigNumber from \"bignumber.js\";\n\nBigNumber.set({\n // The EXPONENTIAL_AT option defines the exponent value(s) at which toString returns exponential notation.\n // - Single number: the exponent magnitude at and above which exponential notation is used (e.g., `1e9` here disables it for almost all values).\n // - 1e9 is the maximum value supported by BigNumber.js.\n // See: https://mikemcl.github.io/bignumber.js/#exponential-at\n EXPONENTIAL_AT: 1e9,\n});\n\nexport default BigNumber;\n","import BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\nexport type BigNumberValue = string | number | BigNumber;\n\nexport interface FormatNumberOptions {\n /** Number of visible decimal places */\n visibleDecimals?: number;\n /** Whether to use compact notation (K, M, B, etc.) */\n compact?: boolean;\n /** Show as percentage */\n percent?: boolean;\n /** Round down instead of normal rounding */\n roundDown?: boolean;\n /** Round up instead of normal rounding */\n roundUp?: boolean;\n /** Threshold above which compact notation is used */\n compactThreshold?: number;\n /** Maximum value to display (shows ∞ if exceeded) */\n maxValue?: number;\n /** Currency symbol (e.g., \"USD\" for $) */\n symbol?: string;\n /** Prefix text */\n prefixText?: string;\n /** Suffix text */\n suffixText?: string;\n /** Show \"< min\" or \"> min\" indicators for very small values */\n showIsSmallerThanMin?: boolean;\n /** Text to show if value is null/undefined */\n ifNullish?: string;\n}\n\nconst POSTFIXES = [\"\", \"K\", \"M\", \"B\", \"T\", \"P\", \"E\", \"Z\", \"Y\"];\n\nfunction valueToBigNumber(amount: BigNumberValue): BigNumber {\n if (amount instanceof BigNumber) return amount;\n return new BigNumber(amount);\n}\n\nfunction normalizeBN(n: BigNumberValue, decimals: number): BigNumber {\n return valueToBigNumber(n).shiftedBy(decimals * -1);\n}\n\nexport function formatNumber(\n value: BigNumberValue | undefined | null,\n options: FormatNumberOptions | number = {},\n): string {\n if (typeof options === \"number\") {\n const decimals = options;\n if (value === undefined || value === null) {\n return \"\";\n }\n\n if (typeof value === \"object\") {\n throw new Error(\"Value must be a number if using deprecated version\");\n }\n\n // Convert to string with up to 8 decimal places\n let formatted = Number(value).toFixed(decimals);\n // Remove trailing zeros and decimal point if not needed\n formatted = formatted.replace(/(\\.\\d*?[1-9])0+$|\\.0*$/, \"$1\");\n return formatted;\n }\n\n const {\n visibleDecimals,\n compact = true,\n percent = false,\n roundDown = false,\n roundUp = false,\n compactThreshold,\n maxValue,\n symbol,\n prefixText = \"\",\n suffixText = \"\",\n showIsSmallerThanMin = true,\n ifNullish = \"\",\n } = options || {};\n\n // Handle null/undefined values\n if (value === undefined || value === null) {\n return ifNullish;\n }\n\n const number = percent ? Number(value) * 100 : Number(value);\n\n // Handle special numeric values\n if (Number.isNaN(number)) {\n return \"NaN\";\n }\n if (number === Number.POSITIVE_INFINITY) {\n return \"Infinity\";\n }\n if (number === Number.NEGATIVE_INFINITY) {\n return \"-Infinity\";\n }\n\n // Determine decimal places\n let decimals: number = visibleDecimals ?? 0;\n if (number === 0) {\n decimals = 0;\n } else if (visibleDecimals === undefined) {\n if (Math.abs(number) > 1 || percent || symbol === \"USD\") {\n decimals = 2;\n } else {\n decimals = 7;\n }\n }\n\n const minValue = 10 ** -(decimals as number);\n const isSmallerThanMin =\n number !== 0 && Math.abs(number) < Math.abs(minValue);\n const isNegative = number < 0;\n const isBiggerThanMax = maxValue ? Math.abs(number) > maxValue : false;\n\n let formattedNumber = isSmallerThanMin ? minValue : number;\n const forceCompact =\n compact && (!compactThreshold || Math.abs(number) > compactThreshold);\n\n // Apply rounding for non-compact numbers\n if (roundDown && !forceCompact) {\n formattedNumber =\n Math.trunc(Number(formattedNumber) * 10 ** decimals) / 10 ** decimals;\n } else if (roundUp && !forceCompact) {\n formattedNumber =\n Math.ceil(Number(formattedNumber) * 10 ** decimals) / 10 ** decimals;\n }\n\n let formattedValue: string;\n\n if (isBiggerThanMax) {\n formattedValue = number > maxValue! ? \"∞\" : \"-∞\";\n } else if (!forceCompact) {\n const absFormatted = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: decimals,\n minimumFractionDigits: decimals,\n }).format(Math.abs(formattedNumber));\n formattedValue = `${isNegative ? \"-\" : \"\"}${absFormatted}`;\n } else {\n // Compact number formatting\n const bnValue = valueToBigNumber(formattedNumber);\n let integerPlaces = bnValue.abs().toFixed(0).length;\n if (compactThreshold && Math.abs(number) <= compactThreshold) {\n integerPlaces = 0;\n }\n\n const significantDigitsGroup = Math.min(\n Math.floor(integerPlaces ? (integerPlaces - 1) / 3 : 0),\n POSTFIXES.length - 1,\n );\n\n const postfix = POSTFIXES[significantDigitsGroup];\n let compactValue = normalizeBN(\n bnValue,\n 3 * significantDigitsGroup,\n ).toNumber();\n\n if (roundDown) {\n compactValue =\n Math.trunc(Number(compactValue) * 10 ** decimals) / 10 ** decimals;\n } else if (roundUp) {\n compactValue =\n Math.ceil(Number(compactValue) * 10 ** decimals) / 10 ** decimals;\n }\n\n const prefix = new Intl.NumberFormat(\"en-US\", {\n maximumFractionDigits: decimals,\n minimumFractionDigits: decimals,\n }).format(compactValue);\n\n formattedValue = `${prefix}${postfix}`;\n }\n\n // Build the final formatted string\n const parts: string[] = [];\n\n // Add prefix text\n if (prefixText) {\n parts.push(prefixText);\n }\n\n // Add smaller than indicator\n if (isSmallerThanMin && showIsSmallerThanMin) {\n parts.push(number < 0 ? \">\" : \"<\");\n }\n\n // Add USD symbol\n if (symbol?.toLowerCase() === \"usd\" && !percent) {\n parts.push(\"$\");\n }\n\n // Add the formatted number\n parts.push(formattedValue);\n\n // Add percentage symbol\n if (percent) {\n parts.push(\"%\");\n }\n\n // Add other symbols\n if (symbol?.toLowerCase() !== \"usd\" && typeof symbol !== \"undefined\") {\n parts.push(\" \", symbol);\n }\n\n // Add suffix text\n if (suffixText) {\n parts.push(suffixText);\n }\n\n return parts.join(\"\");\n}\nexport const getSafeNumber = (value: string | undefined): number => {\n if (!value) return 0;\n return Number(value) > Number.MAX_SAFE_INTEGER\n ? Number.MAX_SAFE_INTEGER\n : (Number(value) ?? 0);\n};\n\nexport const truncateDecimal = (\n value: string | number | undefined,\n maxDecimal: number,\n): string => {\n if (!value) return \"0\";\n const [integerPart = \"0\", decimalPart = \"0\"] = `${value}`.split(\".\");\n return `${integerPart}.${decimalPart.substring(0, maxDecimal)}`;\n};\n","import { createTestClient, http } from \"viem\";\n\nimport {\n type ChainId,\n defaultChainId,\n getRpcUrls,\n} from \"@berachain/config/internal\";\n\nexport function getTestClient(chainId: ChainId = defaultChainId) {\n const rpc = getRpcUrls(chainId);\n\n if (!rpc.isAnvil) {\n throw new Error(\"No anvil RPC URL found\");\n }\n return createTestClient({\n mode: \"anvil\",\n transport: http(rpc.jsonRpcUrl),\n });\n}\n"],"mappings":"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","names":["getErrorResponse","response","text","sanitizeRpcUrl","url","parsed","beraFetch","endpoint","options","spanContext","spanUrl","sanitizeRpcUrl","queryParams","searchParams","param","newUrl","endpointName","BeraTracing","response","error","getErrorResponse","RequestError","beraFetchJson","parseEther","CAP_LIMIT_BUFFER","MAX_CUSTOM_DEADLINE","MIN_CUSTOM_DEADLINE","MIN_CUSTOM_SLIPPAGE","MAX_CUSTOM_SLIPPAGE","DEFAULT_METAMASK_GAS_LIMIT","getPythDefaultUpdateFee","tokenListLength","msToSeconds","ms","seconds","minutes","minutesInSeconds","hours","hoursInSeconds","days","daysInSeconds","weeks","weeksInSeconds","months","monthsInSeconds","years","yearsInSeconds","calculateTimestampFromDays","daysRange","currentDate","monthNames","shortMonthNames","formatUnixTimestamp","unixTimestamp","isShort","date","day","daySuffix","formatTimeLeft","args","timeLeftInSeconds","condensed","showDays","showMinutes","showSeconds","opts","greaterUnit","days","hours","minutes","seconds","daysDisplay","hoursDisplay","minutesDisplay","secondsDisplay","BigNumber","bignumber_js_default","POSTFIXES","valueToBigNumber","amount","bignumber_js_default","normalizeBN","n","decimals","formatNumber","value","options","formatted","visibleDecimals","compact","percent","roundDown","roundUp","compactThreshold","maxValue","symbol","prefixText","suffixText","showIsSmallerThanMin","ifNullish","number","minValue","isSmallerThanMin","isNegative","isBiggerThanMax","formattedNumber","forceCompact","formattedValue","bnValue","integerPlaces","significantDigitsGroup","postfix","compactValue","absFormatted","parts","getSafeNumber","truncateDecimal","maxDecimal","integerPart","decimalPart","createTestClient","http","defaultChainId","getRpcUrls","getTestClient","chainId","rpc"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var p="Something went wrong. Please try again later.",B={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{NOT_ENOUGH_GAS_TOKEN:{reasons:["InsufficientFundsError"],keywords:["insufficient funds for gas * price + value:","The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},NONCE_TOO_LOW:{keywords:["nonce too low: next nonce"],errorMSG:"Nonce is too low. Your wallet might have unconfirmed transactions."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"Pool initialization failed: a small amount of BPT is minted to the zero address to maintain mathematical consistency. If initial balances are too low, the initialization process may fail. (BEX#204)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function E({reason:o,message:r}){for(let n in B){let a=B[n];for(let s in a){let t=a[s];if(o&&t?.reasons?.some(u=>u===o))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!0};if(t?.keywords?.some(u=>r?.toLowerCase().includes(u.toLowerCase().trim())))return{key:s,category:n,errorMSG:t.errorMSG,matchedByReason:!1}}}return null}function j({reason:o,message:r}){return E({reason:o,message:r})?.errorMSG??p}import{BaseError as _}from"viem";import{appConfig as D,currentDapp as U}from"@berachain/config/internal";import{AtomicReadyWalletRejectedUpgradeError as I,BaseError as M,ContractFunctionExecutionError as x,ContractFunctionRevertedError as X,decodeErrorResult as T,HttpRequestError as b,RpcRequestError as N,TransactionExecutionError as k,UserRejectedRequestError as O}from"viem";var m=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var h=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var L=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var S=[...h,...m,...L];function g(o){return o instanceof M||o instanceof Error&&"shortMessage"in o&&"message"in o&&"details"in o}function l(o,r,n){return o instanceof n||o.name===r}function P(o){return o.errorName==="Error"&&Array.isArray(o.args)&&o.args?.at(0)?o.args?.at(0):o.errorName}function f({error:o,abi:r,revertIfUnknown:n=!0}){if(!g(o)){if(n)throw o;return o instanceof M?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;g(e);){if(l(e,"ContractFunctionExecutionError",x)){e=e.cause;continue}if(l(e,"TransactionExecutionError",k)&&e.cause instanceof I)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",N)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=T({data:e.data,abi:[...S,...r??[]]});return{reason:P(a)??e.shortMessage,rootCause:e}}if(l(e,"ContractFunctionRevertedError",X))return{reason:e.reason??e.signature??e.data?.errorName??e.shortMessage,rootCause:e};if(l(e,"UserRejectedRequestError",O))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",b))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function y(o){switch(o){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${o}`}}var d=class o extends Error{displayMessage;cause;chainId;reason=null;fingerprint;_tags={};set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}level="error";extra={};constructor({message:r,displayMessage:n,cause:e,reason:a,level:s,abi:t,tags:u,chainId:v,fingerprint:C}){let c=r;if(c||(e instanceof _?c=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(c=e.message)),super(c,{cause:e}),this.name="BeraError",this.fingerprint=C,this.cause=e,this.chainId=v,a)this.reason=a;else if(e instanceof Error)try{let i=f({error:e,revertIfUnknown:!0,abi:t});this.reason=i?.reason??null}catch{}s?this.level=s:this.reason===y("UserRejectedRequestError")?this.level="info":this.level="error";let A=n;if(this.cause instanceof o&&this.cause.displayMessage!==p&&(A=this.cause.displayMessage),!A){let i=E(this);A=i?.errorMSG,i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=A??p,this.tags={...this.tags,...u},!D.env.isProduction&&(process.env.NEXT_PUBLIC_IS_MONOBERA==="true"||U)&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}};import{getUriFromLink as q}from"@berachain/config";import{mainnet as G}from"@berachain/config/mainnet";var R=class o extends d{response;static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}endpoint;queryRichfulDomains=[G.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",G.staking];statusCode;payload;static REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"};constructor(r){if(super(r),this.name="RequestError",this.response=r.response,this.payload=r.payload,this.endpoint=this.setEndpoint(r.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),r.statusCode?this.statusCode=r.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=o.REASON_MAP[429],this.displayMessage=B.HTTP.RATE_LIMITED_429.errorMSG,this.level=r.level??"warning";else{let a=this.tryMatchNetworkError();a&&(this.reason=this.reason??a.reason,this.level=r.level??"warning",this.endpoint.url=this.endpoint.url??a.url)}this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...r.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `);let e=this.endpoint.type?`${this.endpoint.type}(${this.endpoint.url})`:this.endpoint.url;this.message=`${n}${e}: ${this.message}`}setEndpoint(r){if(typeof r=="string"||r instanceof URL?this.endpoint={url:typeof r=="string"?r:r.toString()}:this.endpoint={...this.endpoint,...r,url:r.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(q(n))))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch{}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let r=this.cause.message;if(r.startsWith("Network Error"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url};let n=r.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:n[1]}}if(typeof this.cause=="object"&&this.cause!==null&&"message"in this.cause&&typeof this.cause.message=="string"){let r=this.cause.message;if(r.startsWith("error: canceling statement due to lock timeout occurred in"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url}}return!1}};var w=class extends d{property;value;expected;constructor(r){super(r),this.level=r.level??"warning",this.name="InvalidArgumentError",this.property=r.property,this.value=r.value,this.expected=r.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,r.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};export{E as a,j as b,S as c,P as d,f as e,d as f,R as g,w as h};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var p="Something went wrong. Please try again later.",B={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{NOT_ENOUGH_GAS_TOKEN:{reasons:["InsufficientFundsError"],keywords:["insufficient funds for gas * price + value:","The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},NONCE_TOO_LOW:{keywords:["nonce too low: next nonce"],errorMSG:"Nonce is too low. Your wallet might have unconfirmed transactions."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"Pool initialization failed: a small amount of BPT is minted to the zero address to maintain mathematical consistency. If initial balances are too low, the initialization process may fail. (BEX#204)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function h({reason:r,message:o}){for(let n in B){let a=B[n];for(let t in a){let s=a[t];if(r&&s?.reasons?.some(u=>u===r))return{key:t,category:n,errorMSG:s.errorMSG,matchedByReason:!0};if(s?.keywords?.some(u=>o?.toLowerCase().includes(u.toLowerCase().trim())))return{key:t,category:n,errorMSG:s.errorMSG,matchedByReason:!1}}}return null}function H({reason:r,message:o}){return h({reason:r,message:o})?.errorMSG??p}function m(r){if(r>=200&&r<300)return"ok";switch(r){case 400:return"invalid_argument";case 401:return"unauthenticated";case 403:return"permission_denied";case 404:return"not_found";case 409:return"already_exists";case 429:return"resource_exhausted";case 499:return"cancelled";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline_exceeded";default:return r>=500?"internal_error":"unknown_error"}}function E(r){switch(r){case"UserRejectedRequestError":case"AtomicReadyWalletRejectedUpgradeError":return"cancelled";case"NO_SWAP_PATHS":return"not_found";case"RATE_LIMITED_429":return"resource_exhausted";case"NETWORK_ERROR":return"unavailable";default:return}}import{BaseError as q}from"viem";import{appConfig as F,currentDapp as z}from"@berachain/config/internal";import{AtomicReadyWalletRejectedUpgradeError as X,BaseError as G,ContractFunctionExecutionError as b,ContractFunctionRevertedError as N,decodeErrorResult as k,HttpRequestError as O,RpcRequestError as _,TransactionExecutionError as P,UserRejectedRequestError as U}from"viem";var L=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var g=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var f=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var M=[...g,...L,...f];function y(r){return r instanceof G||r instanceof Error&&"shortMessage"in r&&"message"in r&&"details"in r}function l(r,o,n){return r instanceof n||r.name===o}function D(r){return r.errorName==="Error"&&Array.isArray(r.args)&&r.args?.at(0)?r.args?.at(0):r.errorName}function R({error:r,abi:o,revertIfUnknown:n=!0}){if(!y(r)){if(n)throw r;return r instanceof G?{reason:r.shortMessage,rootCause:r}:{reason:r.message,rootCause:r}}let e=r;for(;y(e);){if(l(e,"ContractFunctionExecutionError",b)){e=e.cause;continue}if(l(e,"TransactionExecutionError",P)&&e.cause instanceof X)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(l(e,"RpcRequestError",_)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=k({data:e.data,abi:[...M,...o??[]]});return{reason:D(a)??e.shortMessage,rootCause:e}}if(l(e,"ContractFunctionRevertedError",N))return{reason:e.reason??e.signature??e.data?.errorName??e.shortMessage,rootCause:e};if(l(e,"UserRejectedRequestError",U))return{reason:"UserRejectedRequestError",rootCause:e};if(l(e,"HttpRequestError",O))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function v(r){switch(r){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${r}`}}var d=class r extends Error{displayMessage;cause;chainId;reason=null;fingerprint;_tags={};set tags(o){this._tags=o}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}level="error";spanStatus;extra={};constructor({message:o,displayMessage:n,cause:e,reason:a,level:t,abi:s,tags:u,chainId:x,fingerprint:T,spanStatus:S}){let c=o;if(c||(e instanceof q?c=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(c=e.message)),super(c,{cause:e}),this.name="BeraError",this.fingerprint=T,this.cause=e,this.chainId=x,a)this.reason=a;else if(e instanceof Error)try{let i=R({error:e,revertIfUnknown:!0,abi:s});this.reason=i?.reason??null}catch{}t?this.level=t:this.reason===v("UserRejectedRequestError")?this.level="info":this.level="error",S?this.spanStatus=S:this.cause instanceof r&&this.cause.spanStatus?this.spanStatus=this.cause.spanStatus:this.spanStatus=E(this.reason);let A=n;if(this.cause instanceof r&&this.cause.displayMessage!==p&&(A=this.cause.displayMessage),!A){let i=h(this);A=i?.errorMSG,i&&!i.matchedByReason&&this.reason&&(this.reason=i.key)}this.displayMessage=A??p,this.tags={...this.tags,...u},!F.env.isProduction&&(process.env.NEXT_PUBLIC_IS_MONOBERA==="true"||z)&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}};import{getUriFromLink as W}from"@berachain/config";import{mainnet as w}from"@berachain/config/mainnet";var C=class r extends d{response;static isCorsError(o){return o.cause instanceof Response&&o.cause.type==="cors"}endpoint;queryRichfulDomains=[w.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator",w.staking];statusCode;payload;static REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"};constructor(o){if(super(o),this.name="RequestError",this.response=o.response,this.payload=o.payload,this.endpoint=this.setEndpoint(o.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),o.statusCode?this.statusCode=o.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=r.REASON_MAP[429],this.displayMessage=B.HTTP.RATE_LIMITED_429.errorMSG,this.level=o.level??"warning";else{let a=this.tryMatchNetworkError();a&&(this.reason=this.reason??a.reason,this.level=o.level??"warning",this.endpoint.url=this.endpoint.url??a.url)}!this.spanStatus&&this.reason&&(this.spanStatus=E(this.reason)),!this.spanStatus&&this.statusCode&&(this.spanStatus=m(this.statusCode)),this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...o.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `);let e=this.endpoint.type?`${this.endpoint.type}(${this.endpoint.url})`:this.endpoint.url;this.message=`${n}${e}: ${this.message}`}setEndpoint(o){if(typeof o=="string"||o instanceof URL?this.endpoint={url:typeof o=="string"?o:o.toString()}:this.endpoint={...this.endpoint,...o,url:o.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(W(n))))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch{}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let o=this.cause.message;if(o.startsWith("Network Error"))return{reason:r.REASON_MAP.NETWORK_ERROR,message:o,url:this.endpoint.url};let n=o.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:r.REASON_MAP.NETWORK_ERROR,message:o,url:n[1]}}if(typeof this.cause=="object"&&this.cause!==null&&"message"in this.cause&&typeof this.cause.message=="string"){let o=this.cause.message;if(o.startsWith("error: canceling statement due to lock timeout occurred in"))return{reason:r.REASON_MAP.NETWORK_ERROR,message:o,url:this.endpoint.url}}return!1}};var I=class extends d{property;value;expected;constructor(o){super(o),this.level=o.level??"warning",this.name="InvalidArgumentError",this.property=o.property,this.value=o.value,this.expected=o.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,o.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};export{h as a,H as b,M as c,D as d,R as e,m as f,E as g,d as h,C as i,I as j};
|
|
2
|
+
//# sourceMappingURL=chunk-5SIQ7BKT.mjs.map
|