@berachain/berajs 0.2.8-beta.1 → 0.2.8-beta.10
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/RequestError-BRIiJgHk.d.ts +144 -0
- package/dist/RequestError-DSUzJ1Iy.d.cts +144 -0
- 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 +22 -105
- package/dist/actions/exports.d.ts +22 -105
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/actions/governance/exports.cjs +2 -0
- package/dist/actions/governance/exports.cjs.map +1 -0
- package/dist/actions/governance/exports.d.cts +140 -0
- package/dist/actions/governance/exports.d.ts +140 -0
- package/dist/actions/governance/exports.mjs +2 -0
- package/dist/actions/governance/exports.mjs.map +1 -0
- package/dist/chunk-33XNWMPP.cjs +2 -0
- package/dist/chunk-33XNWMPP.cjs.map +1 -0
- package/dist/chunk-4TALWNXE.cjs +2 -0
- package/dist/chunk-4TALWNXE.cjs.map +1 -0
- package/dist/chunk-54BTOQE3.cjs +2 -0
- package/dist/chunk-54BTOQE3.cjs.map +1 -0
- package/dist/chunk-5QAFKFM5.mjs +2 -0
- package/dist/chunk-5QAFKFM5.mjs.map +1 -0
- package/dist/chunk-6DIA6PXV.cjs +2 -0
- package/dist/chunk-6DIA6PXV.cjs.map +1 -0
- package/dist/{chunk-NMH7LHPW.cjs → chunk-6JJIZCVY.cjs} +2 -2
- package/dist/chunk-6JJIZCVY.cjs.map +1 -0
- package/dist/chunk-BE6B4PQF.cjs +2 -0
- package/dist/chunk-BE6B4PQF.cjs.map +1 -0
- package/dist/chunk-CHFETMC6.cjs +4 -0
- package/dist/chunk-CHFETMC6.cjs.map +1 -0
- package/dist/{chunk-I7M43BB4.cjs → chunk-D6L7LTA2.cjs} +2 -2
- package/dist/chunk-D6L7LTA2.cjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -1
- package/dist/chunk-ENT2OSXT.mjs +2 -0
- package/dist/chunk-ENT2OSXT.mjs.map +1 -0
- package/dist/{chunk-74QD4JAH.mjs → chunk-GXV2JA36.mjs} +2 -2
- package/dist/chunk-GXV2JA36.mjs.map +1 -0
- package/dist/chunk-H6ZO4SLB.mjs +4 -0
- package/dist/chunk-H6ZO4SLB.mjs.map +1 -0
- package/dist/chunk-JDDRTHFG.mjs +2 -0
- package/dist/chunk-JDDRTHFG.mjs.map +1 -0
- package/dist/{chunk-T5FSQ3YE.mjs → chunk-JDZGYU5T.mjs} +2 -2
- package/dist/{chunk-T5FSQ3YE.mjs.map → chunk-JDZGYU5T.mjs.map} +1 -1
- package/dist/chunk-JIPSTWKO.mjs +2 -0
- package/dist/{chunk-KI66MQ43.mjs.map → chunk-JIPSTWKO.mjs.map} +1 -1
- package/dist/chunk-JSTCUTXP.cjs +2 -0
- package/dist/chunk-JSTCUTXP.cjs.map +1 -0
- package/dist/{chunk-MJZHJFZO.mjs → chunk-JXM5S4IU.mjs} +2 -2
- package/dist/chunk-K5L2B4DU.mjs +2 -0
- package/dist/{chunk-EFG3OYYQ.mjs.map → chunk-K5L2B4DU.mjs.map} +1 -1
- package/dist/chunk-KUQEX7H3.mjs +2 -0
- package/dist/chunk-KUQEX7H3.mjs.map +1 -0
- package/dist/chunk-NXXMW2O7.mjs +2 -0
- package/dist/chunk-NXXMW2O7.mjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/chunk-PRLVZIKD.mjs +2 -0
- package/dist/chunk-PRLVZIKD.mjs.map +1 -0
- package/dist/chunk-QVIAMSZ6.cjs +2 -0
- package/dist/chunk-QVIAMSZ6.cjs.map +1 -0
- package/dist/chunk-RCWM55DE.cjs +2 -0
- package/dist/chunk-RCWM55DE.cjs.map +1 -0
- package/dist/chunk-REWME3FY.cjs +2 -0
- package/dist/chunk-REWME3FY.cjs.map +1 -0
- package/dist/chunk-RJN36GBU.mjs +2 -0
- package/dist/chunk-RJN36GBU.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -1
- package/dist/chunk-S4CDSVLK.cjs +2 -0
- package/dist/chunk-S4CDSVLK.cjs.map +1 -0
- package/dist/chunk-WLJHFHKF.mjs +2 -0
- package/dist/chunk-WLJHFHKF.mjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/chunk-XZC34BHM.cjs +2 -0
- package/dist/chunk-XZC34BHM.cjs.map +1 -0
- package/dist/chunk-Y2FETC6T.cjs +2 -0
- package/dist/chunk-Y2FETC6T.cjs.map +1 -0
- package/dist/chunk-ZW2N63FI.mjs +2 -0
- package/dist/chunk-ZW2N63FI.mjs.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/contexts/exports.mjs.map +1 -1
- package/dist/enum/exports.cjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/enum/exports.mjs.map +1 -1
- package/dist/enum/governance/exports.cjs +2 -0
- package/dist/enum/governance/exports.cjs.map +1 -0
- package/dist/enum/governance/exports.d.cts +60 -0
- package/dist/enum/governance/exports.d.ts +60 -0
- package/dist/enum/governance/exports.mjs +2 -0
- package/dist/enum/governance/exports.mjs.map +1 -0
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +3 -89
- package/dist/errors/exports.d.ts +3 -89
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-CPuIw7n5.d.cts} +2 -2
- package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-CbZQ0kv2.d.ts} +2 -2
- package/dist/{global.d-6aSWIkV_.d.cts → global.d-B2WavzCY.d.cts} +4 -240
- package/dist/{global.d-SU9Epq0M.d.ts → global.d-D8byjWYx.d.ts} +4 -240
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +19 -198
- package/dist/hooks/exports.d.ts +19 -198
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/hooks/governance/exports.cjs +2 -0
- package/dist/hooks/governance/exports.cjs.map +1 -0
- package/dist/hooks/governance/exports.d.cts +181 -0
- package/dist/hooks/governance/exports.d.ts +181 -0
- package/dist/hooks/governance/exports.mjs +2 -0
- package/dist/hooks/governance/exports.mjs.map +1 -0
- package/dist/pol.d-o6Iw75bK.d.cts +134 -0
- package/dist/pol.d-qR8bGEP5.d.ts +134 -0
- package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-CwAJN4zV.d.cts} +3 -60
- package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-CwAJN4zV.d.ts} +3 -60
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +7 -7
- package/dist/types/exports.d.ts +7 -7
- package/dist/types/governance/exports.cjs +1 -0
- package/dist/types/governance/exports.cjs.map +1 -0
- package/dist/types/governance/exports.d.cts +109 -0
- package/dist/types/governance/exports.d.ts +109 -0
- package/dist/types/governance/exports.mjs +1 -0
- package/dist/types/governance/exports.mjs.map +1 -0
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +10 -2
- package/dist/utils/exports.d.ts +10 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +16 -7
- package/src/actions/clients/BeraApolloClient.ts +9 -0
- package/src/actions/clients/getApolloClient.ts +23 -6
- package/src/actions/dex/getOnChainPool.ts +1 -1
- package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
- package/src/actions/enso/util.ts +6 -8
- package/src/actions/exports.ts +1 -10
- package/src/actions/governance/checkProposalField.ts +108 -54
- package/src/actions/governance/computeActualStatus.ts +7 -3
- package/src/actions/governance/exports.ts +9 -0
- package/src/actions/governance/getAllProposals.ts +15 -8
- package/src/actions/governance/getBodyErrors.ts +13 -5
- package/src/actions/governance/getDecodedFunctionData.ts +31 -22
- package/src/actions/governance/getProposalDetails.ts +8 -4
- package/src/actions/governance/getProposalFromTx.ts +19 -10
- package/src/actions/governance/getProposalParams.ts +17 -17
- package/src/actions/governance/getProposalVotes.ts +7 -3
- package/src/actions/governance/getQuorum.ts +7 -7
- package/src/actions/governance/parseProposalBody.ts +19 -9
- package/src/actions/honey/getChartData.ts +5 -5
- package/src/actions/honey/getHoney24hVolume.ts +30 -0
- package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyRootPriceOracle.ts +1 -1
- package/src/actions/pol/getEarnedStakedBeraVault.ts +12 -2
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +1 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/pol/getStakingDailyAssets.ts +7 -1
- package/src/actions/pol/getTotalStakedAmount.ts +1 -1
- package/src/actions/pol/getUserClaimableIncentives.ts +1 -1
- package/src/actions/pol/getUserVaultsReward.ts +1 -1
- package/src/actions/tokens/getTokenInformation.ts +8 -15
- package/src/actions/tokens/getUnderlyingToken.ts +1 -1
- package/src/actions/validators/getUserBoosts.ts +1 -1
- package/src/enum/exports.ts +0 -1
- package/src/enum/governance/exports.ts +1 -0
- package/src/enum/txnEnum.ts +2 -0
- package/src/errors/BeraError.ts +7 -2
- package/src/errors/RequestError.ts +2 -1
- package/src/hooks/dex/usePoolHistoricalData.ts +1 -1
- package/src/hooks/enso/useBendZapSupply.ts +1 -1
- package/src/hooks/exports.ts +1 -15
- package/src/hooks/governance/exports.ts +14 -0
- package/src/hooks/honey/useHoney24hVolume.ts +16 -0
- package/src/hooks/perps/usePythUpdateFee.ts +1 -1
- package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
- package/src/types/exports.ts +0 -1
- package/src/types/governance/exports.ts +1 -0
- package/src/utils/beraFetch.ts +70 -15
- package/src/utils/getErrorResponse.ts +1 -1
- package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
- package/dist/RequestError-Dk97z8rm.d.ts +0 -57
- package/dist/chunk-2EN6PPAW.cjs +0 -2
- package/dist/chunk-2EN6PPAW.cjs.map +0 -1
- package/dist/chunk-2YBHAMDV.cjs +0 -2
- package/dist/chunk-2YBHAMDV.cjs.map +0 -1
- package/dist/chunk-57RINXU6.cjs +0 -2
- package/dist/chunk-57RINXU6.cjs.map +0 -1
- package/dist/chunk-74QD4JAH.mjs.map +0 -1
- package/dist/chunk-74WA35RI.cjs +0 -2
- package/dist/chunk-74WA35RI.cjs.map +0 -1
- package/dist/chunk-7ITWLMO7.cjs +0 -4
- package/dist/chunk-7ITWLMO7.cjs.map +0 -1
- package/dist/chunk-BEKH5EYT.mjs +0 -2
- package/dist/chunk-BEKH5EYT.mjs.map +0 -1
- package/dist/chunk-DK42F2ZM.cjs +0 -2
- package/dist/chunk-DK42F2ZM.cjs.map +0 -1
- package/dist/chunk-EFG3OYYQ.mjs +0 -2
- package/dist/chunk-GO5E7UUD.cjs +0 -2
- package/dist/chunk-GO5E7UUD.cjs.map +0 -1
- package/dist/chunk-I7M43BB4.cjs.map +0 -1
- package/dist/chunk-IDFMLLDY.mjs +0 -2
- package/dist/chunk-IDFMLLDY.mjs.map +0 -1
- package/dist/chunk-JE5GI2OC.mjs +0 -4
- package/dist/chunk-JE5GI2OC.mjs.map +0 -1
- package/dist/chunk-KI66MQ43.mjs +0 -2
- package/dist/chunk-NMH7LHPW.cjs.map +0 -1
- package/dist/chunk-NVHV2LDK.cjs +0 -2
- package/dist/chunk-NVHV2LDK.cjs.map +0 -1
- package/dist/chunk-PLIH6KQM.mjs +0 -2
- package/dist/chunk-PLIH6KQM.mjs.map +0 -1
- package/dist/chunk-QRAIGQF2.mjs +0 -2
- package/dist/chunk-QRAIGQF2.mjs.map +0 -1
- package/src/actions/honey/getHoneyGlobalData.ts +0 -21
- package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
- /package/dist/{chunk-MJZHJFZO.mjs.map → chunk-JXM5S4IU.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-CHFETMC6.cjs","../src/actions/governance/checkProposalField.ts","../src/actions/governance/parseProposalBody.ts","../src/actions/governance/getProposalVotes.ts"],"names":["checkProposalField","fieldOrType","value","required","baseUrl","components","valueBN","base","isAddress","isHex","errors","component","abiParam","name","v"],"mappings":"AAAA,y0BAAwC,wDAAyC,4BCA7B,SAyEpCA,CAAAA,CAAmB,CACjC,WAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,CAAA,CAAA,CACX,OAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,CACF,CAAA,CAAwD,CAGtD,EAAA,CACE,CAH0B,CAAC,MAAA,CAAQ,QAAQ,CAAA,CAGtB,QAAA,CAASJ,CAAW,CAAA,EACzCE,CAAAA,EAAAA,CACwBD,CAAAA,EAAU,IAAA,EAAQA,CAAAA,GAAU,EAAA,CAAA,CAEpD,MAAA,UAAA,CAGF,EAAA,CAAID,CAAAA,CAAY,UAAA,CAAW,MAAM,CAAA,EAAKA,CAAAA,CAAY,UAAA,CAAW,KAAK,CAAA,CAAG,CACnE,EAAA,CAAI,OAAOC,CAAAA,EAAU,QAAA,CACnB,MAAA,gBAAA,CAGF,GAAI,CACF,IAAMI,CAAAA,CAAU,MAAA,CAAOJ,CAAK,CAAA,CAC5B,EAAA,CAAID,CAA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AAC,CACH,CAAA,CAEA,OAAIK,CAAAA,CAAO,KAAA,CAAOI,CAAAA,EAAMA,CAAAA,GAAM,IAAI,CAAA,CACzB,IAAA,CAKFJ,CACT,CAEA,OAAO,IAAA,CAET,IAAK,SAAA,CACH,OAAIR,CAAAA,GAAU,KAAA,CAAA,EAAaA,CAAAA,GAAU,EAAA,CAC5B,IAAA,CAGP,OAAOA,CAAAA,EAAU,QAAA,EACjB,CAAC,GAAA,CAAI,QAAA,CAASA,CAAK,CAAA,EACnB,IAAI,GAAA,CAAIA,CAAK,CAAA,CAAE,QAAA,GAAa,QAAA,CAAA,uBAAA,CAIvB,IAAA,CAET,IAAK,KAAA,CACH,OAAIA,CAAAA,GAAU,KAAA,CAAA,EAAaA,CAAAA,GAAU,EAAA,CAC5B,IAAA,CAGP,OAAOA,CAAAA,EAAU,QAAA,EACjB,CAAC,GAAA,CAAI,QAAA,CAASA,CAAK,CAAA,EACnB,IAAI,GAAA,CAAIA,CAAK,CAAA,CAAE,QAAA,GAAa,QAAA,CAAA,eAAA,CAIvB,IAAA,CAET,OAAA,CACE,OAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,uBAAA,EAA0BD,CAAW,CAAA,CAAA;AC5Lb;AClD5C","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-CHFETMC6.cjs","sourcesContent":[null,"import { type AbiParameter, isAddress, isHex } from \"viem\";\n\nimport { ProposalErrorCodes } from \"../../enum/governance\";\n\ntype CheckProposalFieldResultMinimal = ProposalErrorCodes | null;\n\ntype CheckProposalFieldResult =\n | ProposalErrorCodes\n | null\n | CheckProposalFieldResultMinimal[]\n | Record<string, CheckProposalFieldResultMinimal>;\n\n/**\n * Internal implementation arg covering the full union of all valid fieldOrType\n * values. The public overloads below provide the narrowed return types.\n */\ninterface CheckProposalFieldImplArg {\n fieldOrType:\n | \"address\"\n | \"hex\"\n | \"abi\"\n | \"string\"\n | \"bool\"\n | `uint${string}`\n | `int${string}`\n | \"action\"\n | \"title\"\n | \"forumLink\"\n | \"description\"\n | \"logoURI\"\n | \"url\"\n | \"tuple[]\"\n | \"tuple\";\n value: unknown;\n required?: boolean;\n baseUrl?: string;\n components?: readonly (AbiParameter | readonly AbiParameter[])[];\n}\n\n/**\n * Validates a single proposal field or ABI-typed value.\n * Returns `null` if valid, or a `ProposalErrorCodes` value describing the problem.\n */\nexport function checkProposalField(arg: {\n fieldOrType:\n | \"address\"\n | \"hex\"\n | \"abi\"\n | \"string\"\n | \"bool\"\n | `uint${string}`\n | `int${string}`\n | \"action\"\n | \"title\"\n | \"forumLink\"\n | \"description\"\n | \"logoURI\"\n | \"url\";\n value: unknown;\n required?: boolean;\n baseUrl?: string;\n components?: readonly (AbiParameter | readonly AbiParameter[])[];\n}): CheckProposalFieldResultMinimal;\n/**\n * For tuple/tuple[] types, may return nested error structures.\n */\nexport function checkProposalField(arg: {\n fieldOrType: \"tuple[]\" | \"tuple\";\n value: unknown;\n required?: boolean;\n baseUrl?: string;\n components?: readonly (AbiParameter | readonly AbiParameter[])[];\n}): CheckProposalFieldResult;\nexport function checkProposalField({\n fieldOrType,\n value,\n required = true,\n baseUrl,\n components,\n}: CheckProposalFieldImplArg): CheckProposalFieldResult {\n const notRequiredAbiTypes = [\"bool\", \"string\"];\n\n if (\n !notRequiredAbiTypes.includes(fieldOrType) &&\n required &&\n (value === undefined || value === null || value === \"\")\n ) {\n return ProposalErrorCodes.REQUIRED;\n }\n\n if (fieldOrType.startsWith(\"uint\") || fieldOrType.startsWith(\"int\")) {\n if (typeof value !== \"string\") {\n return ProposalErrorCodes.INVALID_AMOUNT;\n }\n\n try {\n const valueBN = BigInt(value);\n if (fieldOrType.startsWith(\"uint\")) {\n if (valueBN < 0n) {\n return ProposalErrorCodes.NEGATIVE_AMOUNT;\n }\n }\n } catch {\n return ProposalErrorCodes.INVALID_AMOUNT;\n }\n return null;\n }\n\n switch (fieldOrType) {\n case \"string\":\n if (value !== undefined && typeof value !== \"string\") {\n return ProposalErrorCodes.INVALID_AMOUNT;\n }\n return null;\n\n case \"bool\":\n if (typeof value !== \"boolean\") {\n return ProposalErrorCodes.INVALID_AMOUNT;\n }\n return null;\n\n case \"title\":\n if (typeof value !== \"string\" || value.length === 0) {\n return ProposalErrorCodes.REQUIRED;\n }\n return null;\n\n case \"description\":\n if (typeof value !== \"string\" || value.length === 0) {\n return ProposalErrorCodes.REQUIRED;\n }\n return null;\n\n case \"forumLink\": {\n if (typeof value !== \"string\" || value.length === 0) {\n return ProposalErrorCodes.REQUIRED;\n }\n\n if (!URL.canParse(value)) {\n return ProposalErrorCodes.INVALID_ADDRESS;\n }\n\n const base = new URL(baseUrl!);\n\n // base.pathname = \"/c/\";\n\n if (!value.startsWith(base.toString())) {\n return ProposalErrorCodes.INVALID_BASEPATH;\n }\n\n return null;\n }\n\n case \"address\":\n if (typeof value !== \"string\" || !isAddress(value, { strict: true })) {\n return ProposalErrorCodes.INVALID_ADDRESS;\n }\n\n return null;\n\n case \"hex\":\n if (typeof value !== \"string\" || !isHex(value, { strict: true })) {\n return ProposalErrorCodes.INVALID_ADDRESS;\n }\n return null;\n\n case \"abi\":\n if (typeof value !== \"string\") {\n return ProposalErrorCodes.INVALID_ABI;\n }\n try {\n JSON.parse(value);\n } catch {\n return ProposalErrorCodes.INVALID_ABI;\n }\n return null;\n\n case \"action\":\n if (typeof value !== \"string\" || !isAddress(value, { strict: true })) {\n return ProposalErrorCodes.INVALID_ADDRESS;\n }\n return null;\n\n case \"tuple\":\n if (typeof value === \"object\" && Array.isArray(components)) {\n const errors: Record<string, CheckProposalFieldResult> = {};\n\n for (const component of components) {\n // Intersect with components? to access the field safely;\n // it only exists on tuple AbiParameter variants\n const abiParam = component as AbiParameter & {\n components?: readonly AbiParameter[];\n };\n const name = abiParam.name!;\n // fieldOrType is cast to \"tuple\" | \"tuple[]\" to satisfy overload 2\n // (returns CheckProposalFieldResult). The actual runtime type dispatches\n // to the correct branch.\n errors[name] = checkProposalField({\n fieldOrType: abiParam.type as \"tuple\" | \"tuple[]\",\n value: (value as Record<string, unknown>)[name],\n components: abiParam.components,\n });\n }\n\n if (Object.values(errors).every((v) => v === null)) {\n return null;\n }\n\n return errors as Record<string, CheckProposalFieldResultMinimal>;\n }\n\n return null;\n\n case \"tuple[]\":\n if (Array.isArray(value)) {\n const errors = value.map((v) =>\n checkProposalField({\n fieldOrType: \"tuple\",\n value: v,\n components,\n }),\n );\n\n if (errors.every((v) => v === null)) {\n return null;\n }\n\n // errors contains tuple results (null | Record<string, ...>);\n // cast is intentional — the type definition predates nested support\n return errors as unknown as CheckProposalFieldResultMinimal[];\n }\n\n return null;\n\n case \"logoURI\": {\n if (value === undefined || value === \"\") {\n return null;\n }\n if (\n typeof value !== \"string\" ||\n !URL.canParse(value) ||\n new URL(value).protocol !== \"https:\"\n ) {\n return ProposalErrorCodes.MUST_BE_HTTPS_OR_IPFS;\n }\n return null;\n }\n case \"url\": {\n if (value === undefined || value === \"\") {\n return null;\n }\n if (\n typeof value !== \"string\" ||\n !URL.canParse(value) ||\n new URL(value).protocol !== \"https:\"\n ) {\n return ProposalErrorCodes.MUST_BE_HTTPS;\n }\n return null;\n }\n default:\n console.error(`Invalid field or type: ${fieldOrType}`);\n return null;\n }\n}\n","import graymatter from \"gray-matter\";\n\nimport type { ProposalSelectionFragment } from \"@berachain/graphql/governance\";\n\nexport type ParseProposalBodyResult = graymatter.GrayMatterFile<string> & {\n /** Whether the body uses YAML front-matter (true) or legacy heading format (false) */\n isFrontMatter: boolean;\n};\n\nfunction parseLegacyBody(s: string): {\n type: string | null;\n title: string;\n content: string;\n} {\n const pattern = /#(?:([\\w-]+)# )?(.+)\\n([\\s\\S]*)/;\n const match = s.match(pattern);\n\n if (match) {\n const type = match[1] || null;\n const title = match[2];\n const content = match[3].replace(\"\\n\", \"<br />\");\n return {\n type,\n title,\n content,\n };\n }\n\n throw new Error(\"Invalid proposal body\");\n}\n\n/**\n * Parses the body of a governance proposal into structured front-matter and content.\n * Supports YAML front-matter format and a legacy heading-based format.\n * Falls back to raw description on parse failure.\n */\nexport function parseProposalBody(\n proposal?: Pick<ProposalSelectionFragment, \"description\">,\n): ParseProposalBodyResult {\n if (!proposal) {\n return {\n isFrontMatter: false,\n data: { title: \"Loading...\" },\n content: \"\",\n matter: \"\",\n language: \"\",\n orig: \"\",\n stringify: () => \"\",\n };\n }\n\n const body = proposal?.description ?? \"\";\n\n if (graymatter.test(body)) {\n return { ...graymatter(body), isFrontMatter: true };\n }\n\n try {\n const legacyBody = parseLegacyBody(body);\n\n return {\n isFrontMatter: false,\n data: { title: legacyBody.title },\n content: legacyBody.content,\n matter: \"\",\n language: \"\",\n orig: body,\n stringify: () => body,\n };\n } catch {\n return {\n isFrontMatter: false,\n data: {\n title: proposal?.description?.split(\"\\n\")[0].slice(0, 100),\n },\n content: body,\n matter: \"\",\n language: \"\",\n orig: body,\n stringify: () => body,\n };\n }\n}\n","import {\n GetProposalVotes,\n type GetProposalVotesQuery,\n type GetProposalVotesQueryVariables,\n} from \"@berachain/graphql/governance\";\n\nimport { getApolloClient } from \"../clients/getApolloClient\";\n\nexport type GetProposalVotesArgs = BeraJS.BaseFunctionArgs & {\n /** GraphQL variables forwarded to the GetProposalVotes query */\n variables: GetProposalVotesQueryVariables;\n};\n\n/** Fetches the votes for a proposal from the subgraph */\nexport async function getProposalVotes({\n variables,\n ...args\n}: GetProposalVotesArgs) {\n const governanceClient = getApolloClient(\"governance.subgraph\", args);\n return governanceClient.query<GetProposalVotesQuery>({\n query: GetProposalVotes,\n variables,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var L=(O=>(O.ENSO_ROUTER="enso.router",O.POL_REWARD_VAULT="pol.rewardVault",O.BEX_POOL="bex.pool",O.ERC20="others.erc20",O.ERC4626="others.erc4626",O.POL_STAKE_VAULT="pol.stakeVault",O.BEX_EXPLOITED_FUND_DISTRIBUTOR="bex.exploitedFundDistributor",O.TW_MINIMAL_ACCOUNT="thirdweb.minimalAccount",O))(L||{});var U=(D=>(D.Governance="Governance",D.Fixed="Fixed",D.Custom="Custom",D))(U||{}),I= exports.c =(C=>(C.USDBACKED="USD-Backed Stablecoin",C.ALGORITHMIC="Algorithmic Stablecoin",C))(I||{}),
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var L=(O=>(O.ENSO_ROUTER="enso.router",O.POL_REWARD_VAULT="pol.rewardVault",O.BEX_POOL="bex.pool",O.ERC20="others.erc20",O.ERC4626="others.erc4626",O.POL_STAKE_VAULT="pol.stakeVault",O.BEX_EXPLOITED_FUND_DISTRIBUTOR="bex.exploitedFundDistributor",O.TW_MINIMAL_ACCOUNT="thirdweb.minimalAccount",O))(L||{});var U=(D=>(D.Governance="Governance",D.Fixed="Fixed",D.Custom="Custom",D))(U||{}),I= exports.c =(C=>(C.USDBACKED="USD-Backed Stablecoin",C.ALGORITHMIC="Algorithmic Stablecoin",C))(I||{}),B= exports.d =(N=>(N.POOL_TYPE="Pool Type",N.SELECT_TOKENS="Select Tokens",N.DEPOSIT_LIQUIDITY="Deposit Liquidity",N.SET_PARAMETERS="Set Parameters",N.SET_INFO="Set Info",N))(B||{}),S= exports.e =(_=>(_.ERC4626="Mint",_.Oogabooga="Oogabooga",_.Fly="Fly",_.HubPools="Hub Pools",_.Wrap="Wrap",_.Unwrap="Unwrap",_.KyberSwap="KyberSwap",_.OpenOcean="OpenOcean",_.Haiku="Haiku",_.Enso="Enso",_.EnsoErc4626="Enso (Mint)",_.RedeemBgt="RedeemBgt",_.Honey="Honey",_))(S||{}),A= exports.f =(C=>(C.SWAP="SWAP",C.ZAP="ZAP",C))(A||{});var P=(R=>(R.RESET_AMOUNTS="RESET_AMOUNTS",R.ACTION_TYPE_CHANGE="ACTION_TYPE_CHANGE",R.COLLATERALS_CHANGE="COLLATERALS_CHANGE",R.FROM_AMOUNT_CHANGE="FROM_AMOUNT_CHANGE",R.TO_AMOUNT_CHANGE="TO_AMOUNT_CHANGE",R.PREVIEW_CHANGE="PREVIEW_CHANGE",R.IS_BASKET_MODE_ENABLED_CHANGE="IS_BASKET_MODE_ENABLED_CHANGE",R.IS_TYPING_CHANGE="IS_TYPING_CHANGE",R.IS_SUBMITTING_CHANGE="IS_SUBMITTING_CHANGE",R.IS_LOADING_CHANGE="IS_LOADING_CHANGE",R))(P||{});var l=(E=>(E.TEST="Test",E.SEND="Send tokens",E.APPROVAL="Approval",E.SWAP="Swap",E.WRAP="Wrap",E.UNWRAP="Unwrap",E.CREATE_POOL="Create Pool",E.ADD_LIQUIDITY="Add Liquidity",E.WITHDRAW_LIQUIDITY="Withdraw Liquidity",E.DELEGATE="Delegate",E.REDELEGATE="Redelegate",E.QUEUE_BOOST="Queue Boost",E.ACTIVATE_BOOST="Activate Boost",E.QUEUE_UNBOOSTING_ALL="Queue Drop Boost All",E.UNBOOST="Drop Boost",E.QUEUE_UNBOOST="Queue Drop Boost",E.CANCEL_UNBOOST="Cancel Drop Boost",E.CANCEL_BOOST="Cancel Boost",E.UNBONDING="Unbonding",E.CANCEL_UNBONDING="Cancel Unbonding",E.SUBMIT_PROPOSAL="Submit Proposal",E.CANCEL_PROPOSAL="Cancel Proposal",E.EXECUTE_PROPOSAL="Execute Proposal",E.QUEUE_PROPOSAL="Queue Proposal",E.VOTE="Vote",E.MODIFY_REWARD_DURATION="Change Reward Duration",E.MODIFY_REWARD_RATE="Change Reward Rate",E.RESET_REWARD_MODE="Reset Reward Mode",E.CREATE_BRIBE="Add Incentives",E.CLAIMING_BRIBES="Claiming Incentives",E.CLAIMING_REWARDS="Claiming BGT",E.CLAIM_ALL_REWARDS="Claim All Rewards",E.RECOVER_FUNDS="Recover Bex Funds",E.REDEEM_BGT="Redeem BGT",E.MINT_HONEY="Mint Honey",E.REDEEM_HONEY="Redeem Honey",E.SUPPLY="Supply",E.WITHDRAW="Withdraw",E.BORROW="Borrow",E.REPAY="Repay",E.STAKE="Stake",E.UNSTAKE="Unstake",E.ENSO_ROUTE="Enso Route",E.MARKET_LONG="Market Long",E.MARKET_SHORT="Market Short",E.LIMIT_LONG="Limit Long",E.LIMIT_SHORT="Limit Short",E.CANCEL_ORDER="Cancel Order",E.CANCEL_ALL_ORDERS="Cancel All Orders",E.EDIT_PERPS_ORDER="Edit Perps Order",E.DEPOSIT_HONEY="Deposit Honey",E.START_WITHDRAW_REQUEST="Start Withdraw Request",E.CANCEL_WITHDRAW_REQUEST="Cancel Withdraw Request",E.WITHDRAW_HONEY="Withdraw Honey",E.DELEGATE_OCT="Delegate",E.REVOKE_OCT="Revoke",E.REFER="Refer",E.CREATE_REWARDS_VAULT="Create Reward Vault",E.APPLYING_REWARD_ALLOCATION="Apply Reward Allocation",E.APPLYING_OPERATOR_CHANGE="Apply Operator Change",E.CANCELING_OPERATOR_CHANGE="Cancel Operator Change",E.REQUEST_OPERATOR_CHANGE="Request Operator Change",E.APPLYING_REWARD_ALLOCATOR_CHANGE="Apply Reward Allocator Change",E.APPLYING_COMMISSION_CHANGE="Apply Commission Change",E.BONDING_BERA="Stake BERA",E.ZAP_STAKE_BERA="Zap Stake BERA",E.UNBONDING_BERA="Unstake BERA",E.QUEUE_UNBONDING_BERA="Queue Unstake BERA",E.BEND_MARKET_REPAY_AND_WITHDRAW_COLLATERAL="Bend Market Repay and Withdraw Collateral",E.BEND_MARKET_SUPPLY_COLLATERAL_AND_BORROW="Bend Market Supply Collateral and Borrow",E.BEND_MARKET_MULTIPLY="Bend Market Multiply",E.BEND_MARKET_DEMULTIPLY="Bend Market Demultiply",E.BEND_VAULT_SUPPLY="Bend Vault Supply",E.BEND_VAULT_WITHDRAW="Bend Vault Withdraw",E.BEND_CURATOR_REALLOCATE="Bend Curator Reallocate",E.BEND_CURATOR_UPDATE_MARKET_SUPPLY_CAP="Bend Curator Update Market Supply Cap",E.BEND_CURATOR_REVOKE_PENDING_SUPPLY_CAP="Bend Curator Revoke Pending Supply Cap",E.BEND_CURATOR_ACCEPT_PENDING_SUPPLY_CAP="Bend Curator Accept Pending Supply Cap",E.BEND_CURATOR_UPDATE_SUPPLY_QUEUE="Bend Curator Update Supply Queue",E.BEND_CURATOR_UPDATE_WITHDRAW_QUEUE="Bend Curator Update Withdraw Queue",E.BEND_CURATOR_TRANSFER_OWNER="Bend Curator Transfer Owner",E.BEND_CURATOR_CHANGE_GUARDIAN="Bend Curator Change Guardian",E.BEND_CURATOR_SET_CURATOR="Bend Curator Set Curator",E.BEND_CURATOR_SET_ALLOCATOR="Bend Curator Set Allocator",E))(l||{});exports.a = L; exports.b = U; exports.c = I; exports.d = B; exports.e = S; exports.f = A; exports.g = P; exports.h = l;
|
|
2
|
+
//# sourceMappingURL=chunk-D6L7LTA2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/enum/contracts.ts","../src/enum/dex.ts","../src/enum/honey.ts","../src/enum/txnEnum.ts"],"names":["ContractName","OwnershipType","ParameterPreset","PoolCreationStep","Aggregators","SwapReferrer","HoneySwapAction","TransactionActionType"],"mappings":"AAGO,6EAAKA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,WAAA,CAAc,aAAA,CACdA,CAAAA,CAAA,gBAAA,CAAmB,iBAAA,CACnBA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,KAAA,CAAQ,cAAA,CACRA,CAAAA,CAAA,OAAA,CAAU,gBAAA,CACVA,CAAAA,CAAA,eAAA,CAAkB,gBAAA,CAClBA,CAAAA,CAAA,8BAAA,CAAiC,8BAAA,CACjCA,CAAAA,CAAA,kBAAA,CAAqB,yBAAA,CARXA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CCHL,IAAKC,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CACVA,CAAAA,CAAA,UAAA,CAAa,YAAA,CACbA,CAAAA,CAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA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AAAA,CAAA,uBAAA,CAA0B,yBAAA,CAC1BA,CAAAA,CAAA,qCAAA,CAAwC,uCAAA,CACxCA,CAAAA,CAAA,sCAAA,CAAyC,wCAAA,CACzCA,CAAAA,CAAA,sCAAA,CAAyC,wCAAA,CACzCA,CAAAA,CAAA,gCAAA,CAAmC,kCAAA,CACnCA,CAAAA,CAAA,kCAAA,CAAqC,oCAAA,CACrCA,CAAAA,CAAA,2BAAA,CAA8B,6BAAA,CAC9BA,CAAAA,CAAA,4BAAA,CAA+B,8BAAA,CAC/BA,CAAAA,CAAA,wBAAA,CAA2B,0BAAA,CAC3BA,CAAAA,CAAA,0BAAA,CAA6B,4BAAA,CA/GnBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAA,CAAA,CAAA,CAAA,CAAA,uHAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-D6L7LTA2.cjs","sourcesContent":["/**\n * A list of contract names that are not mapped in the devrel's contract mapping or that are generated by factories (e.g. RewardVault).\n */\nexport enum ContractName {\n ENSO_ROUTER = \"enso.router\",\n POL_REWARD_VAULT = \"pol.rewardVault\",\n BEX_POOL = \"bex.pool\",\n ERC20 = \"others.erc20\",\n ERC4626 = \"others.erc4626\",\n POL_STAKE_VAULT = \"pol.stakeVault\",\n BEX_EXPLOITED_FUND_DISTRIBUTOR = \"bex.exploitedFundDistributor\",\n TW_MINIMAL_ACCOUNT = \"thirdweb.minimalAccount\",\n}\n","export enum OwnershipType {\n Governance = \"Governance\",\n Fixed = \"Fixed\",\n Custom = \"Custom\",\n}\n\nexport enum ParameterPreset {\n USDBACKED = \"USD-Backed Stablecoin\",\n ALGORITHMIC = \"Algorithmic Stablecoin\",\n}\n\nexport enum PoolCreationStep {\n POOL_TYPE = \"Pool Type\",\n SELECT_TOKENS = \"Select Tokens\",\n DEPOSIT_LIQUIDITY = \"Deposit Liquidity\",\n SET_PARAMETERS = \"Set Parameters\",\n SET_INFO = \"Set Info\",\n}\n\nexport enum Aggregators {\n ERC4626 = \"Mint\",\n Oogabooga = \"Oogabooga\",\n Fly = \"Fly\",\n HubPools = \"Hub Pools\",\n Wrap = \"Wrap\",\n Unwrap = \"Unwrap\",\n KyberSwap = \"KyberSwap\",\n OpenOcean = \"OpenOcean\",\n Haiku = \"Haiku\",\n Enso = \"Enso\",\n EnsoErc4626 = \"Enso (Mint)\",\n RedeemBgt = \"RedeemBgt\",\n Honey = \"Honey\",\n}\n\nexport enum SwapReferrer {\n SWAP = \"SWAP\",\n ZAP = \"ZAP\",\n}\n","export enum HoneySwapAction {\n RESET_AMOUNTS = \"RESET_AMOUNTS\",\n ACTION_TYPE_CHANGE = \"ACTION_TYPE_CHANGE\",\n COLLATERALS_CHANGE = \"COLLATERALS_CHANGE\",\n FROM_AMOUNT_CHANGE = \"FROM_AMOUNT_CHANGE\",\n TO_AMOUNT_CHANGE = \"TO_AMOUNT_CHANGE\",\n PREVIEW_CHANGE = \"PREVIEW_CHANGE\",\n IS_BASKET_MODE_ENABLED_CHANGE = \"IS_BASKET_MODE_ENABLED_CHANGE\",\n IS_TYPING_CHANGE = \"IS_TYPING_CHANGE\",\n IS_SUBMITTING_CHANGE = \"IS_SUBMITTING_CHANGE\",\n IS_LOADING_CHANGE = \"IS_LOADING_CHANGE\",\n}\n","export enum TransactionActionType {\n /**\n * Used for testing purposes.\n */\n TEST = \"Test\",\n\n // used to send gas token on ERC20\n SEND = \"Send tokens\",\n\n APPROVAL = \"Approval\",\n SWAP = \"Swap\",\n WRAP = \"Wrap\",\n UNWRAP = \"Unwrap\",\n\n CREATE_POOL = \"Create Pool\",\n ADD_LIQUIDITY = \"Add Liquidity\",\n WITHDRAW_LIQUIDITY = \"Withdraw Liquidity\",\n\n DELEGATE = \"Delegate\",\n REDELEGATE = \"Redelegate\",\n\n QUEUE_BOOST = \"Queue Boost\",\n ACTIVATE_BOOST = \"Activate Boost\",\n QUEUE_UNBOOSTING_ALL = \"Queue Drop Boost All\",\n UNBOOST = \"Drop Boost\",\n QUEUE_UNBOOST = \"Queue Drop Boost\",\n CANCEL_UNBOOST = \"Cancel Drop Boost\",\n CANCEL_BOOST = \"Cancel Boost\",\n\n UNBONDING = \"Unbonding\",\n CANCEL_UNBONDING = \"Cancel Unbonding\",\n\n SUBMIT_PROPOSAL = \"Submit Proposal\",\n CANCEL_PROPOSAL = \"Cancel Proposal\",\n EXECUTE_PROPOSAL = \"Execute Proposal\",\n QUEUE_PROPOSAL = \"Queue Proposal\",\n VOTE = \"Vote\",\n\n MODIFY_REWARD_DURATION = \"Change Reward Duration\",\n MODIFY_REWARD_RATE = \"Change Reward Rate\",\n RESET_REWARD_MODE = \"Reset Reward Mode\",\n CREATE_BRIBE = \"Add Incentives\",\n CLAIMING_BRIBES = \"Claiming Incentives\", // claiming others\n CLAIMING_REWARDS = \"Claiming BGT\",\n CLAIM_ALL_REWARDS = \"Claim All Rewards\",\n\n RECOVER_FUNDS = \"Recover Bex Funds\",\n\n REDEEM_BGT = \"Redeem BGT\",\n\n MINT_HONEY = \"Mint Honey\",\n REDEEM_HONEY = \"Redeem Honey\",\n\n SUPPLY = \"Supply\",\n WITHDRAW = \"Withdraw\",\n BORROW = \"Borrow\",\n REPAY = \"Repay\",\n\n STAKE = \"Stake\",\n UNSTAKE = \"Unstake\",\n\n ENSO_ROUTE = \"Enso Route\",\n // PERPS\n\n MARKET_LONG = \"Market Long\",\n MARKET_SHORT = \"Market Short\",\n LIMIT_LONG = \"Limit Long\",\n LIMIT_SHORT = \"Limit Short\",\n CANCEL_ORDER = \"Cancel Order\",\n CANCEL_ALL_ORDERS = \"Cancel All Orders\",\n EDIT_PERPS_ORDER = \"Edit Perps Order\",\n DEPOSIT_HONEY = \"Deposit Honey\",\n START_WITHDRAW_REQUEST = \"Start Withdraw Request\",\n CANCEL_WITHDRAW_REQUEST = \"Cancel Withdraw Request\",\n WITHDRAW_HONEY = \"Withdraw Honey\",\n DELEGATE_OCT = \"Delegate\",\n REVOKE_OCT = \"Revoke\",\n REFER = \"Refer\",\n\n // POL\n CREATE_REWARDS_VAULT = \"Create Reward Vault\",\n APPLYING_REWARD_ALLOCATION = \"Apply Reward Allocation\",\n APPLYING_OPERATOR_CHANGE = \"Apply Operator Change\",\n CANCELING_OPERATOR_CHANGE = \"Cancel Operator Change\",\n REQUEST_OPERATOR_CHANGE = \"Request Operator Change\",\n APPLYING_REWARD_ALLOCATOR_CHANGE = \"Apply Reward Allocator Change\",\n APPLYING_COMMISSION_CHANGE = \"Apply Commission Change\",\n\n BONDING_BERA = \"Stake BERA\",\n ZAP_STAKE_BERA = \"Zap Stake BERA\",\n UNBONDING_BERA = \"Unstake BERA\",\n QUEUE_UNBONDING_BERA = \"Queue Unstake BERA\",\n\n // BEND\n BEND_MARKET_REPAY_AND_WITHDRAW_COLLATERAL = \"Bend Market Repay and Withdraw Collateral\",\n BEND_MARKET_SUPPLY_COLLATERAL_AND_BORROW = \"Bend Market Supply Collateral and Borrow\",\n BEND_MARKET_MULTIPLY = \"Bend Market Multiply\",\n BEND_MARKET_DEMULTIPLY = \"Bend Market Demultiply\",\n BEND_VAULT_SUPPLY = \"Bend Vault Supply\",\n BEND_VAULT_WITHDRAW = \"Bend Vault Withdraw\",\n\n // BEND CURATOR\n BEND_CURATOR_REALLOCATE = \"Bend Curator Reallocate\",\n BEND_CURATOR_UPDATE_MARKET_SUPPLY_CAP = \"Bend Curator Update Market Supply Cap\",\n BEND_CURATOR_REVOKE_PENDING_SUPPLY_CAP = \"Bend Curator Revoke Pending Supply Cap\",\n BEND_CURATOR_ACCEPT_PENDING_SUPPLY_CAP = \"Bend Curator Accept Pending Supply Cap\",\n BEND_CURATOR_UPDATE_SUPPLY_QUEUE = \"Bend Curator Update Supply Queue\",\n BEND_CURATOR_UPDATE_WITHDRAW_QUEUE = \"Bend Curator Update Withdraw Queue\",\n BEND_CURATOR_TRANSFER_OWNER = \"Bend Curator Transfer Owner\",\n BEND_CURATOR_CHANGE_GUARDIAN = \"Bend Curator Change Guardian\",\n BEND_CURATOR_SET_CURATOR = \"Bend Curator Set Curator\",\n BEND_CURATOR_SET_ALLOCATOR = \"Bend Curator Set Allocator\",\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/BeraFlags/defaultFlags.ts"],"names":["defaultFlags"],"mappings":"AAgCO,6EAAMA,CAAAA,CAA0B,CACrC,mBAAA,CAAqB,CAAA,CAAA,CACrB,aAAA,CAAe,CAAA,CAAA,CACf,6BAAA,CAA+B,CAAA,CAAA,CAC/B,wBAAA,CAA0B,CAAA,CAAA,CAC1B,UAAA,CAAY,CAAA,CAAA,CACZ,mBAAA,CAAqB,CAAA,CAAA,CACrB,qBAAA,CAAuB,CAAA,CAAA,CACvB,oBAAA,CAAsB,CAAA,CAAA,CACtB,0BAAA,CAA4B,CAAA,CAAA,CAC5B,qBAAA,CAAuB,CAAA,CAAA,CACvB,qBAAA,CAAuB,CAAA,CAAA,CACvB,4BAAA,CAA8B,CAAA,CAAA,CAC9B,mBAAA,CAAqB,CAAA,CAAA,CACrB,yBAAA,CAA2B,CAAA,CAAA,CAC3B,oBAAA,CAAsB,CAAA,CAAA,CACtB,yBAAA,CAA2B,CAAA,CAC7B,CAAA,CAAA,cAAA","file":"/Users/
|
|
1
|
+
{"version":3,"sources":["../src/contexts/BeraFlags/defaultFlags.ts"],"names":["defaultFlags"],"mappings":"AAgCO,6EAAMA,CAAAA,CAA0B,CACrC,mBAAA,CAAqB,CAAA,CAAA,CACrB,aAAA,CAAe,CAAA,CAAA,CACf,6BAAA,CAA+B,CAAA,CAAA,CAC/B,wBAAA,CAA0B,CAAA,CAAA,CAC1B,UAAA,CAAY,CAAA,CAAA,CACZ,mBAAA,CAAqB,CAAA,CAAA,CACrB,qBAAA,CAAuB,CAAA,CAAA,CACvB,oBAAA,CAAsB,CAAA,CAAA,CACtB,0BAAA,CAA4B,CAAA,CAAA,CAC5B,qBAAA,CAAuB,CAAA,CAAA,CACvB,qBAAA,CAAuB,CAAA,CAAA,CACvB,4BAAA,CAA8B,CAAA,CAAA,CAC9B,mBAAA,CAAqB,CAAA,CAAA,CACrB,yBAAA,CAA2B,CAAA,CAAA,CAC3B,oBAAA,CAAsB,CAAA,CAAA,CACtB,yBAAA,CAA2B,CAAA,CAC7B,CAAA,CAAA,cAAA","file":"/Users/liammcaweeney/Work/bera/monobera/packages/berajs/dist/chunk-DDEQFR3M.cjs","sourcesContent":["import type { flags } from \"@berachain/config/internal/flags\";\n\ntype ClientSideFlags = keyof typeof flags;\n\nexport type BeraFlags = Record<\n Extract<\n ClientSideFlags,\n // We don't want to have all flags on the context. Just the ones that cannot be used server side only\n // this is because we generally should prefer server side flags, also according to flag-sdk docs\n | \"isGovernanceEnabled\"\n | \"enableEip5792\"\n | \"proxyAggregatorsThroughVercel\"\n | \"isEmbeddedWalletsEnabled\"\n | \"sponsorGas\"\n | \"enableSimulateCalls\"\n | \"isBendVaultDataHourly\"\n | \"isBendLoopingEnabled\"\n | \"isMultiChainZapBendEnabled\"\n | \"isZapStakeBeraEnabled\"\n | \"mockValidatorOperator\"\n | \"mockValidatorRewardAllocator\"\n | \"isBgtPolRewardToken\"\n | \"mockRewardDurationManager\"\n | \"mockIncentiveManager\"\n | \"isHoneyPythWrapperEnabled\"\n >,\n boolean | undefined\n>;\n\n/**\n * @private\n */\nexport const defaultFlags: BeraFlags = {\n isGovernanceEnabled: true,\n enableEip5792: false,\n proxyAggregatorsThroughVercel: false,\n isEmbeddedWalletsEnabled: true,\n sponsorGas: false,\n enableSimulateCalls: false,\n isBendVaultDataHourly: true,\n isBendLoopingEnabled: false,\n isMultiChainZapBendEnabled: false,\n isZapStakeBeraEnabled: false,\n mockValidatorOperator: false,\n mockValidatorRewardAllocator: false,\n isBgtPolRewardToken: true,\n mockRewardDurationManager: false,\n mockIncentiveManager: false,\n isHoneyPythWrapperEnabled: true,\n};\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m}from"./chunk-KUQEX7H3.mjs";import{a as u}from"./chunk-PRLVZIKD.mjs";import{f as i,g as p}from"./chunk-GXV2JA36.mjs";import{ApolloClient as g,ServerError as y}from"@apollo/client";import{appConfig as d}from"@berachain/config/internal";var l=class extends g{url;serviceName;constructor(n){super(n),this.url=n.url,this.serviceName=n.name}async query(n){let r=b(n.query),t={url:this.url,type:"graphql",name:this.serviceName},a={"operation.type":"query","operation.source.name":t.name,"operation.source.url":t.url,"operation.source.type":t.type,"operation.source.queryName":r};try{let e=()=>super.query(n),c=await u.startSpan({name:`GraphQL ${r}`,op:"BeraApolloClient.query",attributes:a},e);if(c.error||c.data===void 0)throw new i({level:"fatal",tags:a,message:"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none"});return{data:c.data}}catch(e){throw!d.env.isProduction&&console.error("BeraApolloClient error",e),y.is(e)?new p({response:e.response,cause:e,statusCode:e.statusCode,endpoint:t,tags:a}):e instanceof TypeError?new p({level:"fatal",reason:"TypeError",response:e,cause:e,endpoint:t,tags:a}):new p({response:e,tags:a,cause:e,endpoint:t})}}};function b(o){return o.definitions.find(r=>r.kind==="OperationDefinition")?.name?.value}import{InMemoryCache as C}from"@apollo/client";import{HttpLink as w}from"@apollo/client/link/http";import{getUriFromLink as f}from"@berachain/config";import{currentDapp as k,goldskyBaseUrl as h}from"@berachain/config/internal";import T from"@berachain/graphql/dex/api";import{gql as G}from"@apollo/client";function E(o){let n=typeof o=="string"?void 0:o.headers,r=!!k,t=process.env.VERCEL_ENV==="test",a=f(o),e=typeof o=="string"?"unknown":o.name;return{uri:a,name:e,headers:{...n,"x-graphql-client-name":`berachain.${r?"dapps":t?"test":"berajs"}`,"x-graphql-client-version":`${process.env.VERCEL_TARGET_ENV}.${process.env.VERCEL_GIT_COMMIT_SHA}`}}}function s(o,{ssrMode:n,inMemoryCacheOptions:r}={}){let t=f(o),a=typeof o=="string"?void 0:o.headers,e=typeof o=="string"?void 0:o.name;return!e&&t.includes(h)&&(e=t.replace(h,"").replace("/gn","")),new l({url:t,name:e??"unknown",link:new w({uri:t,headers:a}),defaultOptions:{query:{errorPolicy:"none",fetchPolicy:"no-cache"}},cache:new C(r),ssrMode:n})}function R(o,{...n}){let{config:r}=m(n);switch(o){case"api":return s(E(r.api),{inMemoryCacheOptions:{possibleTypes:T.possibleTypes}});case"bend.whisk":if(!r.bend.whiskApi)throw new i({message:"Bend whisk API is not configured on this chain",level:"error"});return s(r.bend.whiskApi);case"honey.subgraph":return s(r.honey.subgraph);case"pol.subgraph":return s(r.pol.subgraph);case"pol.fees":return s(r.pol.feesSubgraph);case"governance.subgraph":return s(r.governance.subgraph);case"bex.subgraph":return s(r.bex.subgraph)}}export{l as a,R as b,G as c};
|
|
2
|
+
//# sourceMappingURL=chunk-ENT2OSXT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/actions/clients/BeraApolloClient.ts","../src/actions/clients/getApolloClient.ts"],"sourcesContent":["import {\n ApolloClient,\n type DocumentNode,\n type ErrorLike,\n type OperationVariables,\n ServerError,\n} from \"@apollo/client\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { BeraError } from \"../../errors/BeraError\";\nimport { BeraTracing } from \"../../errors/BeraTracing\";\nimport { RequestError } from \"../../errors/RequestError\";\n\n/**\n * This is a wrapper around the ApolloClient that throws a BeraError if the query returns an error or no data.\n *\n * It's mostly a typescript helper that keeps data always defined since we use errorPolicy: \"none\" by default.\n * Such setting will throw an error if the query returns an error, rather than returning an object with undefined data and an error property.\n */\nexport class BeraApolloClient extends ApolloClient {\n /**\n * The URL of the endpoint. Used for error reporting only.\n */\n protected url: string;\n\n protected serviceName: string;\n constructor(\n options: ApolloClient.Options & {\n /**\n * The URL of the endpoint. Used for error reporting only.\n */\n url: string;\n /**\n * The name of the graphql service. Used for error reporting only.\n */\n name: string;\n },\n ) {\n super(options);\n this.url = options.url;\n this.serviceName = options.name;\n }\n\n async query<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n >(\n // We handle errors in our custom logic so we don't need to pass errorPolicy here\n options: Omit<ApolloClient.QueryOptions<TData, TVariables>, \"errorPolicy\">,\n ): Promise<{\n // Only data is returned and we're sure it's not undefined due to errorPolicy\n data: TData;\n }> {\n const queryName = getQueryName(options.query);\n\n const endpoint = {\n url: this.url,\n type: \"graphql\",\n name: this.serviceName,\n } as const;\n\n const tags = {\n \"operation.type\": \"query\",\n \"operation.source.name\": endpoint.name,\n \"operation.source.url\": endpoint.url,\n \"operation.source.type\": endpoint.type,\n \"operation.source.queryName\": queryName,\n };\n\n try {\n const executeQuery = () =>\n super.query<TData, TVariables>(\n options as ApolloClient.QueryOptions<TData, TVariables>,\n );\n\n const res = await BeraTracing.startSpan(\n {\n name: `GraphQL ${queryName}`,\n op: \"BeraApolloClient.query\",\n attributes: tags,\n },\n executeQuery,\n );\n\n if (res.error || res.data === undefined) {\n throw new BeraError({\n level: \"fatal\",\n tags,\n message:\n \"Bera Apollo Client: No data returned from query, but error should be thrown since errorPolicy is none\",\n });\n }\n\n return { data: res.data } as const;\n } catch (error) {\n !appConfig.env.isProduction &&\n console.error(\"BeraApolloClient error\", error);\n\n if (ServerError.is(error)) {\n throw new RequestError({\n // reason: error,\n response: error.response,\n cause: error,\n statusCode: error.statusCode,\n endpoint,\n tags,\n });\n }\n if (error instanceof TypeError) {\n throw new RequestError({\n level: \"fatal\",\n reason: \"TypeError\",\n response: error,\n cause: error,\n endpoint,\n tags,\n });\n }\n throw new RequestError({\n response: error as ErrorLike,\n tags,\n cause: error,\n endpoint,\n });\n }\n }\n}\n\nfunction getQueryName(queryDefinition: DocumentNode) {\n const likelyNode = queryDefinition.definitions.find(\n (def) => def.kind === (\"OperationDefinition\" as const),\n );\n\n return likelyNode?.name?.value;\n}\n","import { InMemoryCache, type InMemoryCacheConfig } from \"@apollo/client\";\nimport { HttpLink } from \"@apollo/client/link/http\";\n\nimport type { HttpLink as BeraConfigHttpLink } from \"@berachain/config\";\nimport { getUriFromLink } from \"@berachain/config\";\nimport { currentDapp, goldskyBaseUrl } from \"@berachain/config/internal\";\n\nimport apiResults from \"@berachain/graphql/dex/api\";\n\nimport { BeraError } from \"../../errors/BeraError\";\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\nimport { BeraApolloClient } from \"./BeraApolloClient\";\n\n/**\n * If currentDapp is set, it will add the stellate client name and version to the headers.\n * @see {@link https://stellate.co/docs/graphql-metrics/tracking/clients}\n */\nfunction applyStellateClientName(url: BeraConfigHttpLink): BeraConfigHttpLink {\n const headers = typeof url === \"string\" ? undefined : url.headers;\n const isDapp = !!currentDapp;\n const isTest = process.env.VERCEL_ENV === \"test\";\n\n const uri = getUriFromLink(url);\n const name = typeof url === \"string\" ? \"unknown\" : url.name;\n\n return {\n uri,\n name,\n headers: {\n ...headers,\n \"x-graphql-client-name\": `berachain.${\n isDapp\n ? \"dapps\"\n : isTest\n ? \"test\"\n : // this tracks usage of the berajs package in other packages\n \"berajs\"\n }`,\n \"x-graphql-client-version\": `${process.env.VERCEL_TARGET_ENV}.${process.env.VERCEL_GIT_COMMIT_SHA}`,\n },\n };\n}\n\nexport { gql } from \"@apollo/client\";\n\nfunction getClient(\n endpoint: BeraConfigHttpLink,\n {\n ssrMode,\n inMemoryCacheOptions,\n }: {\n ssrMode?: boolean;\n inMemoryCacheOptions?: InMemoryCacheConfig;\n } = {},\n) {\n const url = getUriFromLink(endpoint);\n const headers = typeof endpoint === \"string\" ? undefined : endpoint.headers;\n let name = typeof endpoint === \"string\" ? undefined : endpoint.name;\n\n if (!name && url.includes(goldskyBaseUrl)) {\n name = url.replace(goldskyBaseUrl, \"\").replace(\"/gn\", \"\");\n }\n\n return new BeraApolloClient({\n url,\n name: name ?? \"unknown\",\n link: new HttpLink({\n uri: url,\n headers,\n }),\n defaultOptions: {\n query: {\n // With the default none error policy, an error causes the promise to reject.\n errorPolicy: \"none\",\n fetchPolicy: \"no-cache\",\n },\n },\n cache: new InMemoryCache(inMemoryCacheOptions),\n ssrMode,\n });\n}\n\ntype GraphqlClient =\n | \"honey.subgraph\"\n | \"pol.subgraph\"\n | \"pol.fees\"\n | \"governance.subgraph\"\n | \"bex.subgraph\"\n | \"api\"\n | \"bend.whisk\";\n\nexport function getApolloClient(\n clientName: GraphqlClient,\n { ...args }: BeraJS.BaseFunctionArgs,\n): BeraApolloClient {\n const { config } = parseBaseArgs(args);\n\n switch (clientName) {\n case \"api\":\n return getClient(applyStellateClientName(config.api), {\n inMemoryCacheOptions: {\n possibleTypes: apiResults.possibleTypes,\n },\n });\n\n case \"bend.whisk\":\n if (!config.bend.whiskApi) {\n throw new BeraError({\n message: \"Bend whisk API is not configured on this chain\",\n level: \"error\",\n });\n }\n return getClient(config.bend.whiskApi);\n\n case \"honey.subgraph\":\n return getClient(config.honey.subgraph);\n case \"pol.subgraph\":\n return getClient(config.pol.subgraph);\n case \"pol.fees\":\n return getClient(config.pol.feesSubgraph);\n case \"governance.subgraph\":\n return getClient(config.governance.subgraph);\n case \"bex.subgraph\":\n return getClient(config.bex.subgraph);\n }\n}\n"],"mappings":"kIAAA,OACE,gBAAAA,EAIA,eAAAC,MACK,iBAEP,OAAS,aAAAC,MAAiB,6BAYnB,IAAMC,EAAN,cAA+BC,CAAa,CAIvC,IAEA,YACV,YACEC,EAUA,CACA,MAAMA,CAAO,EACb,KAAK,IAAMA,EAAQ,IACnB,KAAK,YAAcA,EAAQ,IAC7B,CAEA,MAAM,MAKJA,EAIC,CACD,IAAMC,EAAYC,EAAaF,EAAQ,KAAK,EAEtCG,EAAW,CACf,IAAK,KAAK,IACV,KAAM,UACN,KAAM,KAAK,WACb,EAEMC,EAAO,CACX,iBAAkB,QAClB,wBAAyBD,EAAS,KAClC,uBAAwBA,EAAS,IACjC,wBAAyBA,EAAS,KAClC,6BAA8BF,CAChC,EAEA,GAAI,CACF,IAAMI,EAAe,IACnB,MAAM,MACJL,CACF,EAEIM,EAAM,MAAMC,EAAY,UAC5B,CACE,KAAM,WAAWN,CAAS,GAC1B,GAAI,yBACJ,WAAYG,CACd,EACAC,C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olloClient","ServerError","appConfig","BeraApolloClient","ApolloClient","options","queryName","getQueryName","endpoint","tags","executeQuery","res","BeraTracing","BeraError","error","appConfig","ServerError","RequestError","queryDefinition","def","InMemoryCache","HttpLink","getUriFromLink","currentDapp","goldskyBaseUrl","apiResults","gql","applyStellateClientName","url","headers","isDapp","currentDapp","isTest","uri","getUriFromLink","name","getClient","endpoint","ssrMode","inMemoryCacheOptions","goldskyBaseUrl","BeraApolloClient","HttpLink","InMemoryCache","getApolloClient","clientName","args","config","parseBaseArgs","apiResults","BeraError"]}
|
|
@@ -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 F({reason:o,message:r}){return E({reason:o,message:r})?.errorMSG??p}import{BaseError as _}from"viem";import{appConfig as D}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 h=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var m=[{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=[...m,...h,...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.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{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(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,F 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 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-GXV2JA36.mjs.map
|