@berachain/berajs 0.2.8-beta.4 → 0.2.8-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abi/exports.cjs +1 -4452
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +1 -4452
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -918
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +95 -50
- package/dist/actions/exports.d.ts +95 -50
- package/dist/actions/exports.mjs +1 -918
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-3MZ7MLKF.mjs +2 -0
- package/dist/{chunk-PBCE7JTE.mjs.map → chunk-3MZ7MLKF.mjs.map} +1 -1
- package/dist/chunk-53TSJM6P.cjs +2 -0
- package/dist/chunk-53TSJM6P.cjs.map +1 -0
- package/dist/chunk-575OK77P.mjs +2 -0
- package/dist/{chunk-GLWPRM33.mjs.map → chunk-575OK77P.mjs.map} +1 -1
- package/dist/chunk-5W7UKRHX.mjs +2 -0
- package/dist/{chunk-J6EHBYSV.mjs.map → chunk-5W7UKRHX.mjs.map} +1 -1
- package/dist/chunk-6K252BGM.mjs +2 -0
- package/dist/{chunk-CYBZH6U3.mjs.map → chunk-6K252BGM.mjs.map} +1 -1
- package/dist/chunk-CWKDFUFR.mjs +2 -0
- package/dist/{chunk-OWUI3VPI.mjs.map → chunk-CWKDFUFR.mjs.map} +1 -1
- package/dist/chunk-D6L7LTA2.cjs +2 -0
- package/dist/chunk-D6L7LTA2.cjs.map +1 -0
- package/dist/chunk-DDEQFR3M.cjs +2 -0
- package/dist/chunk-DDEQFR3M.cjs.map +1 -0
- package/dist/chunk-DKY4QPWU.cjs +2 -0
- package/dist/chunk-DKY4QPWU.cjs.map +1 -0
- package/dist/chunk-DTBJO6VT.cjs +2 -0
- package/dist/chunk-DTBJO6VT.cjs.map +1 -0
- package/dist/chunk-ESAVA5OD.mjs +2 -0
- package/dist/{chunk-ALPEMPZI.mjs.map → chunk-ESAVA5OD.mjs.map} +1 -1
- package/dist/chunk-JDZGYU5T.mjs +2 -0
- package/dist/{chunk-WEULAXBE.mjs.map → chunk-JDZGYU5T.mjs.map} +1 -1
- package/dist/chunk-JLFBRMOF.cjs +2 -0
- package/dist/chunk-JLFBRMOF.cjs.map +1 -0
- package/dist/chunk-KT6L4K4K.cjs +2 -0
- package/dist/chunk-KT6L4K4K.cjs.map +1 -0
- package/dist/chunk-MASD43N5.mjs +4 -0
- package/dist/chunk-MASD43N5.mjs.map +1 -0
- package/dist/chunk-MGGPHKA2.cjs +4 -0
- package/dist/chunk-MGGPHKA2.cjs.map +1 -0
- package/dist/chunk-MK5NS5B5.mjs +2 -0
- package/dist/{chunk-7TFV6UKF.mjs.map → chunk-MK5NS5B5.mjs.map} +1 -1
- package/dist/chunk-NAXAZJJY.mjs +2 -0
- package/dist/{chunk-ZCEFC2TK.mjs.map → chunk-NAXAZJJY.mjs.map} +1 -1
- package/dist/chunk-NLVWRMGD.mjs +2 -0
- package/dist/{chunk-GWSTVITN.mjs.map → chunk-NLVWRMGD.mjs.map} +1 -1
- package/dist/chunk-OGBD5YOG.mjs +2 -0
- package/dist/{chunk-JA4DHMTG.mjs.map → chunk-OGBD5YOG.mjs.map} +1 -1
- package/dist/chunk-OGJMSGB2.mjs +2 -0
- package/dist/{chunk-KL6YZ5VR.mjs.map → chunk-OGJMSGB2.mjs.map} +1 -1
- package/dist/chunk-OIYXOKTT.cjs +2 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -0
- package/dist/chunk-OUD27MU7.cjs +2 -0
- package/dist/chunk-OUD27MU7.cjs.map +1 -0
- package/dist/chunk-QFLDL4UV.cjs +2 -0
- package/dist/chunk-QFLDL4UV.cjs.map +1 -0
- package/dist/chunk-RSDCKN4Q.mjs +2 -0
- package/dist/chunk-RSDCKN4Q.mjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs +2 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -0
- package/dist/chunk-SSPFPAWX.mjs +2 -0
- package/dist/{chunk-WAFQFAI7.mjs.map → chunk-SSPFPAWX.mjs.map} +1 -1
- package/dist/chunk-UENDEN3M.mjs +2 -0
- package/dist/{chunk-MKS6W5NI.mjs.map → chunk-UENDEN3M.mjs.map} +1 -1
- package/dist/chunk-UFIM7WQ4.cjs +2 -0
- package/dist/chunk-UFIM7WQ4.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs +2 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -0
- package/dist/chunk-XNJLSA6P.cjs +2 -0
- package/dist/chunk-XNJLSA6P.cjs.map +1 -0
- package/dist/chunk-ZYXVUXFQ.cjs +2 -0
- package/dist/chunk-ZYXVUXFQ.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -82
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +1 -82
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/enum/exports.cjs +1 -58
- 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 -58
- package/dist/enum/exports.mjs.map +1 -1
- package/dist/errors/exports.cjs +1 -38
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.mjs +1 -38
- package/dist/{getValidatorQueuedOperatorAddress-DUZOmxLV.d.ts → getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts} +2 -2
- package/dist/{getValidatorQueuedOperatorAddress-BQXkSFd9.d.cts → getValidatorQueuedOperatorAddress-Cql_D50j.d.cts} +2 -2
- package/dist/{global.d-SU9Epq0M.d.ts → global.d-5w_lvl2J.d.ts} +1 -1
- package/dist/{global.d-6aSWIkV_.d.cts → global.d-B7IeayVX.d.cts} +1 -1
- package/dist/hooks/exports.cjs +3 -8327
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +4 -4
- package/dist/hooks/exports.d.ts +4 -4
- package/dist/hooks/exports.mjs +3 -8327
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-CCuQUFlh.d.cts → txnEnum-7_o92X3N.d.cts} +2 -0
- package/dist/{txnEnum-CCuQUFlh.d.ts → txnEnum-7_o92X3N.d.ts} +2 -0
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/dist/utils/exports.cjs +1 -786
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.mjs +1 -786
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +5 -5
- package/src/actions/clients/getApolloClient.ts +11 -4
- package/src/actions/dex/aggregators/base.ts +1 -3
- package/src/actions/dex/getOnChainPool.ts +1 -1
- package/src/actions/enso/getBendMultiplyBundle.ts +9 -2
- package/src/actions/enso/util.ts +6 -8
- package/src/actions/governance/checkProposalField.ts +108 -54
- package/src/actions/governance/computeActualStatus.ts +7 -3
- package/src/actions/governance/getAllProposals.ts +15 -8
- package/src/actions/governance/getBodyErrors.ts +13 -5
- package/src/actions/governance/getDecodedFunctionData.ts +31 -27
- package/src/actions/governance/getProposalDetails.ts +8 -4
- package/src/actions/governance/getProposalFromTx.ts +19 -10
- package/src/actions/governance/getProposalParams.ts +17 -17
- package/src/actions/governance/getProposalVotes.ts +7 -3
- package/src/actions/governance/getQuorum.ts +7 -7
- package/src/actions/governance/parseProposalBody.ts +19 -9
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -2
- package/src/actions/tokens/getTokenInformation.ts +8 -15
- package/src/actions/tokens/getUnderlyingToken.ts +1 -3
- package/src/enum/txnEnum.ts +2 -0
- package/src/errors/BeraError.ts +7 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +1 -1
- package/src/hooks/enso/useBendZapSupply.ts +1 -1
- package/src/hooks/perps/usePythUpdateFee.ts +1 -1
- package/src/hooks/validators/useValidatorRewardAllocation.ts +1 -1
- package/dist/chunk-24HMIYTN.cjs +0 -36
- package/dist/chunk-24HMIYTN.cjs.map +0 -1
- package/dist/chunk-2LL77B3T.cjs +0 -135
- package/dist/chunk-2LL77B3T.cjs.map +0 -1
- package/dist/chunk-3LXVARBJ.cjs +0 -417
- package/dist/chunk-3LXVARBJ.cjs.map +0 -1
- package/dist/chunk-4HDIUUSV.cjs +0 -130
- package/dist/chunk-4HDIUUSV.cjs.map +0 -1
- package/dist/chunk-7ONKBHXY.cjs +0 -169
- package/dist/chunk-7ONKBHXY.cjs.map +0 -1
- package/dist/chunk-7TFV6UKF.mjs +0 -24
- package/dist/chunk-A4FPM7U3.cjs +0 -63
- package/dist/chunk-A4FPM7U3.cjs.map +0 -1
- package/dist/chunk-A7P3JVU7.cjs +0 -4694
- package/dist/chunk-A7P3JVU7.cjs.map +0 -1
- package/dist/chunk-ALPEMPZI.mjs +0 -417
- package/dist/chunk-BEHP54S3.cjs +0 -24
- package/dist/chunk-BEHP54S3.cjs.map +0 -1
- package/dist/chunk-CYBZH6U3.mjs +0 -135
- package/dist/chunk-EWBKSMPG.cjs +0 -13
- package/dist/chunk-EWBKSMPG.cjs.map +0 -1
- package/dist/chunk-GLWPRM33.mjs +0 -13
- package/dist/chunk-GWSTVITN.mjs +0 -572
- package/dist/chunk-H3Z37RYU.cjs +0 -15
- package/dist/chunk-H3Z37RYU.cjs.map +0 -1
- package/dist/chunk-HCC4FJTD.cjs +0 -97
- package/dist/chunk-HCC4FJTD.cjs.map +0 -1
- package/dist/chunk-J6EHBYSV.mjs +0 -97
- package/dist/chunk-JA4DHMTG.mjs +0 -15
- package/dist/chunk-KL6YZ5VR.mjs +0 -63
- package/dist/chunk-MILSHCKW.cjs +0 -168
- package/dist/chunk-MILSHCKW.cjs.map +0 -1
- package/dist/chunk-MKS6W5NI.mjs +0 -403
- package/dist/chunk-MXWPP6MS.cjs +0 -572
- package/dist/chunk-MXWPP6MS.cjs.map +0 -1
- package/dist/chunk-OWUI3VPI.mjs +0 -169
- package/dist/chunk-PBCE7JTE.mjs +0 -36
- package/dist/chunk-QISQSMCV.cjs +0 -1843
- package/dist/chunk-QISQSMCV.cjs.map +0 -1
- package/dist/chunk-SYWYIMY7.mjs +0 -4694
- package/dist/chunk-SYWYIMY7.mjs.map +0 -1
- package/dist/chunk-TDW5SPXR.cjs +0 -244
- package/dist/chunk-TDW5SPXR.cjs.map +0 -1
- package/dist/chunk-TGHG6Q3C.cjs +0 -403
- package/dist/chunk-TGHG6Q3C.cjs.map +0 -1
- package/dist/chunk-WAFQFAI7.mjs +0 -130
- package/dist/chunk-WEULAXBE.mjs +0 -168
- package/dist/chunk-ZCEFC2TK.mjs +0 -244
- package/dist/chunk-ZV7DCQQY.mjs +0 -1843
- package/dist/chunk-ZV7DCQQY.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/errorMap.ts","../src/errors/getErrorMessage.ts","../src/errors/BeraError.ts","../src/abi/utils/bundler3errors.ts","../src/abi/utils/erc20errors.ts","../src/abi/utils/openChainErrors.ts","../src/abi/utils/commonAbiErrors.ts","../src/errors/parseViemError.ts"],"names":["GENERAL_ERROR","errorMsgMap","findMatchingError","reason","message","category","errors","type","errorType","r","keyword","getErrorMessage","bundler3errorsAbi","erc20errorsAbi","openChainErrorsAbi","commonAbiErrors","isBaseError","error","BaseError","isViemError","name","shouldBeInstanceOf","parseDecodedError","parseViemError","abi","revertIfUnknown","cause","ContractFunctionExecutionError","TransactionExecutionError","AtomicReadyWalletRejectedUpgradeError","RpcRequestError","decodedError","decodeErrorResult","ContractFunctionRevertedError","UserRejectedRequestError","HttpRequestError","rpcErrorToReason","errCode"],"mappings":"AAuBO,8sBAAMA,CAAAA,CAAgB,+CAAA,CAEhBC,CAAAA,CAAc,CACzB,KAAA,CAAO,CACL,kBAAA,CAAoB,CAClB,OAAA,CAAS,CAAC,kBAAkB,CAAA,CAC5B,QAAA,CAAU,wDACZ,CAAA,CACA,mBAAA,CAAqB,CACnB,OAAA,CAAS,CAAC,qBAAqB,CAAA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AAA,EAAaA,CAAO,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-53TSJM6P.cjs","sourcesContent":["export interface ErrorType {\n /**\n * Keywords to match in the error message. Use carefully. Do not use this for contract revert reasons\n * as they might match to other error messages.\n *\n * For instance InsufficientBalance might match to InsufficientBalanceToPayPythFee if used as keyword.\n */\n keywords?: string[];\n /**\n * The exact error code or contract revert reason.\n */\n reasons?: string[];\n errorMSG: string;\n}\n\nexport interface ErrorCategory {\n [key: string]: ErrorType;\n}\n\ninterface ErrorMessages {\n [key: string]: ErrorCategory | string;\n}\n\nexport const GENERAL_ERROR = \"Something went wrong. Please try again later.\";\n\nexport const errorMsgMap = {\n ERC20: {\n NOT_ENOUGH_BALANCE: {\n reasons: [\"NotEnoughBalance\"],\n errorMSG: \"You do not have enough balance to perform this action.\",\n },\n InsufficientBalance: {\n reasons: [\"InsufficientBalance\"],\n errorMSG: \"Insufficient token balance\",\n },\n INSUFFICIENT_ALLOWANCE: {\n reasons: [\n \"0x13be252b\",\n \"InsufficientAllowance\",\n \"ERC20InsufficientAllowance\",\n ],\n errorMSG: \"You do not have enough allowance to perform this action.\",\n },\n SIGNATURE_EXPIRED: {\n reasons: [\"SignatureExpired\"],\n errorMSG: \"Transaction took too long to complete. Please try again.\",\n },\n },\n HTTP: {\n RATE_LIMITED_429: {\n reasons: [\"429\"],\n errorMSG: \"Too many requests. Please try again later.\",\n },\n },\n ENSO: {\n COULD_NOT_BUILD_SHORTCUT: {\n keywords: [\n \"Could not build shortcuts for route\",\n \"Could not quote shortcuts for route\",\n ],\n\n errorMSG:\n \"There was an error building the zap route. Try with lower amounts.\",\n },\n NOT_ENOUGH_LIQUIDITY: {\n keywords: [\n \"Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range\",\n ],\n\n errorMSG:\n \"The amount you’re trying to swap might be too high. Please make sure that your amount is within an acceptable range.\",\n },\n NO_ROUTE_FOUND: {\n keywords: [\"No route found from\"],\n errorMSG: \"No swap route found for the given tokens.\",\n },\n },\n RPC: {\n NOT_ENOUGH_GAS_TOKEN: {\n reasons: [\"InsufficientFundsError\"],\n keywords: [\n \"insufficient funds for gas * price + value:\",\n \"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.\",\n ],\n errorMSG: \"Insufficient BERA balance to perform this action.\",\n },\n NONCE_TOO_LOW: {\n keywords: [\"nonce too low: next nonce\"],\n errorMSG:\n \"Nonce is too low. Your wallet might have unconfirmed transactions.\",\n },\n GAS_PRICE: {\n keywords: [\"gasLimit\"],\n errorMSG:\n \"It seems an RPC error has occurred while estimating gas. Please try your request later.\",\n },\n JSON_RPC: {\n keywords: [\"JSON-RPC\"],\n\n errorMSG:\n \"It seems an RPC error has occurred. Please try your request one more later.\",\n },\n HASH: {\n keywords: [\"hash\"],\n errorMSG:\n \"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again.\",\n },\n USER_REJECTION: {\n reasons: [\"UserRejectedRequestError\"],\n keywords: [\"User denied transaction signature\"],\n errorMSG: \"You rejected the transaction.\",\n },\n SMART_UPGRADE_REJECTION: {\n reasons: [\"AtomicReadyWalletRejectedUpgradeError\"],\n errorMSG:\n \"You've declined to upgrade to batch transactions for now, try again for the traditional method.\",\n },\n CHAIN_MISMATCH: {\n reasons: [\"ChainMismatchError\"],\n errorMSG:\n \"Wallet seems to be on the wrong chain, please refresh the page and try again.\",\n },\n },\n EIP7702: {\n SESSION_KEY_EXPIRED: {\n reasons: [\"SessionKeyExpired\"],\n errorMSG: \"Session key has expired. Please create a new one.\",\n },\n CALL_POLICY_VIOLATED: {\n reasons: [\"CallPolicyViolated\"],\n errorMSG: \"Call policy violated. Please check your call policies.\",\n },\n },\n HONEY: {\n BLACKLISTED_WALLET: {\n reasons: [\"BlacklistedWallet\", \"0x265693b4\"],\n errorMSG: \"Your wallet is blacklisted from minting or redeeming HONEY.\",\n },\n LIQUIDITY_ERROR: {\n reasons: [\"0x4656425a\"],\n errorMSG:\n \"You are trying to redeem more than the liquidity available in the vault.\",\n },\n },\n // NOTE: these codes are from https://github.com/balancer/balancer-v2-monorepo/blob/master/pkg/balancer-js/src/utils/errors.ts\n // ... and additionally from https://docs.balancer.fi/reference/contracts/error-codes.html\n // NOTE: descriptions are generated by GPT where not available.\n BEX: {\n SLIPPAGE_EXCEEDED: {\n reasons: [\"SlippageExceeded\", \"TooMuchSlippage\"],\n errorMSG:\n \"Price changed while executing the transaction and exceeded the allowed slippage.\",\n },\n // math\n BAL000: {\n reasons: [\"BAL#000\"],\n errorMSG: \"Addition overflow occurred during calculation. (BEX#000)\",\n },\n BAL001: {\n reasons: [\"BAL#001\"],\n errorMSG: \"Subtraction overflow occurred during calculation. (BEX#001)\",\n },\n BAL002: {\n reasons: [\"BAL#002\"],\n errorMSG: \"Subtraction underflow occurred during calculation. (BEX#002)\",\n },\n BAL003: {\n reasons: [\"BAL#003\"],\n errorMSG:\n \"Multiplication overflow occurred during calculation. (BEX#003)\",\n },\n BAL004: {\n reasons: [\"BAL#004\"],\n errorMSG: \"Attempted division by zero. (BEX#004)\",\n },\n BAL005: {\n reasons: [\"BAL#005\"],\n errorMSG: \"Multiplication overflow during FixedPoint Division. (BEX#005)\",\n },\n BAL006: {\n reasons: [\"BAL#006\"],\n errorMSG: \"Invalid x in ExpMath.pow(x, y). (BEX#006)\",\n },\n BAL007: {\n reasons: [\"BAL#007\"],\n errorMSG: \"Invalid y in ExpMath.pow(x, y). (BEX#007)\",\n },\n BAL008: {\n reasons: [\"BAL#008\"],\n errorMSG:\n \"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)\",\n },\n BAL009: {\n reasons: [\"BAL#009\"],\n errorMSG: \"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)\",\n },\n // Input\n BAL100: {\n reasons: [\"BAL#100\"],\n errorMSG: \"Value is out of acceptable bounds. (BEX#100)\",\n },\n BAL101: {\n reasons: [\"BAL#101\"],\n errorMSG:\n \"Tokens must be sorted in address order on pool registration. (BEX#101)\",\n },\n BAL102: {\n reasons: [\"BAL#102\"],\n errorMSG:\n \"Tokens must be sorted in address order on pool registration. (BEX#102)\",\n },\n BAL103: {\n reasons: [\"BAL#103\"],\n errorMSG: \"Parallel array inputs must have the same length. (BEX#103)\",\n },\n BAL104: {\n reasons: [\"BAL#104\"],\n errorMSG: \"Address to be interpreted as a token cannot be 0. (BEX#104)\",\n },\n BAL105: {\n reasons: [\"BAL#105\"],\n errorMSG: \"Insufficient byte length. (BEX#105)\",\n },\n // Shared Pools\n BAL200: {\n reasons: [\"BAL#200\"],\n errorMSG: \"All pools must contain at least two tokens. (BEX#200)\",\n },\n BAL201: {\n reasons: [\"BAL#201\"],\n errorMSG:\n \"Token count exceeds the maximum for a given pool type. (BEX#201)\",\n },\n BAL202: {\n reasons: [\"BAL#202\"],\n errorMSG: \"Swap fee percentage exceeds the maximum allowed. (BEX#202)\",\n },\n BAL203: {\n reasons: [\"BAL#203\"],\n errorMSG: \"Swap fee percentage is below the minimum allowed. (BEX#203)\",\n },\n BAL204: {\n reasons: [\"BAL#204\"],\n errorMSG:\n \"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)\",\n },\n BAL205: {\n reasons: [\"BAL#205\"],\n errorMSG:\n \"User attempted to execute a callback intended for the vault contract. (BEX#205)\",\n },\n BAL206: {\n reasons: [\"BAL#206\"],\n errorMSG:\n \"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)\",\n },\n BAL207: {\n reasons: [\"BAL#207\"],\n errorMSG:\n \"Slippage/front-running protection check failed on a pool exit. (BEX#207)\",\n },\n BAL208: {\n reasons: [\"BAL#208\"],\n errorMSG: \"Minimum BPT output amount not met. (BEX#208)\",\n },\n BAL209: {\n reasons: [\"BAL#209\"],\n errorMSG:\n \"Slippage/front-running protection check failed on a pool join. (BEX#209)\",\n },\n BAL210: {\n reasons: [\"BAL#210\"],\n errorMSG:\n \"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)\",\n },\n BAL211: {\n reasons: [\"BAL#211\"],\n errorMSG:\n \"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)\",\n },\n // Pools\n BAL300: {\n reasons: [\"BAL#300\"],\n errorMSG:\n \"The amplification parameter is below the minimum allowed. (BEX#300)\",\n },\n BAL301: {\n reasons: [\"BAL#301\"],\n errorMSG:\n \"The amplification parameter exceeds the maximum allowed. (BEX#301)\",\n },\n BAL302: {\n reasons: [\"BAL#302\"],\n errorMSG: \"The weight parameter is below the minimum allowed. (BEX#302)\",\n },\n BAL303: {\n reasons: [\"BAL#303\"],\n errorMSG:\n \"The number of stable tokens exceeds the maximum allowed. (BEX#303)\",\n },\n BAL304: {\n reasons: [\"BAL#304\"],\n errorMSG: \"The amount of tokens in would unbalance the pool. (BEX#304)\",\n },\n BAL305: {\n reasons: [\"BAL#305\"],\n errorMSG: \"The amount of tokens out would unbalance the pool. (BEX#305)\",\n },\n BAL306: {\n reasons: [\"BAL#306\"],\n errorMSG:\n \"Disproportionate pool exit would unbalance the pool. (BEX#306)\",\n },\n BAL307: {\n reasons: [\"BAL#307\"],\n errorMSG:\n \"Disproportionate pool join would unbalance the pool. (BEX#307)\",\n },\n BAL308: {\n reasons: [\"BAL#308\"],\n errorMSG: \"Normalized weights do not add to 1.0 exactly. (BEX#308)\",\n },\n BAL309: {\n reasons: [\"BAL#309\"],\n errorMSG: \"Invalid token provided for operation. (BEX#309)\",\n },\n BAL310: {\n reasons: [\"BAL#310\"],\n errorMSG: \"Unhandled pool join operation for this pool type. (BEX#310)\",\n },\n BAL311: {\n reasons: [\"BAL#311\"],\n errorMSG: \"Pool balances must be > 0. (BEX#311)\",\n },\n BAL312: {\n reasons: [\"BAL#312\"],\n errorMSG:\n \"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)\",\n },\n BAL313: {\n reasons: [\"BAL#313\"],\n errorMSG: \"Oracle has no data to query. (BEX#313)\",\n },\n BAL314: {\n reasons: [\"BAL#314\"],\n errorMSG:\n \"Oracle query data is before its earliest data sample. (BEX#314)\",\n },\n BAL315: {\n reasons: [\"BAL#315\"],\n errorMSG:\n \"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)\",\n },\n BAL316: {\n reasons: [\"BAL#316\"],\n errorMSG: \"Oracle query window must have non-zero duration. (BEX#316)\",\n },\n BAL317: {\n reasons: [\"BAL#317\"],\n errorMSG:\n \"Amplification parameter change has less than the minimum duration. (BEX#317)\",\n },\n BAL318: {\n reasons: [\"BAL#318\"],\n errorMSG:\n \"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)\",\n },\n BAL319: {\n reasons: [\"BAL#319\"],\n errorMSG:\n \"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)\",\n },\n BAL320: {\n reasons: [\"BAL#320\"],\n errorMSG:\n \"Cannot cancel an update if there isn't one already ongoing. (BEX#320)\",\n },\n BAL321: {\n reasons: [\"BAL#321\"],\n errorMSG: \"Stable pool invariant calculation did not converge. (BEX#321)\",\n },\n BAL322: {\n reasons: [\"BAL#322\"],\n errorMSG: \"Stable pool balance calculation did not converge. (BEX#322)\",\n },\n BAL323: {\n reasons: [\"BAL#323\"],\n errorMSG: \"Relayer must be a valid contract. (BEX#323)\",\n },\n BAL324: {\n reasons: [\"BAL#324\"],\n errorMSG: \"Base pool relayer was not called correctly. (BEX#324)\",\n },\n BAL325: {\n reasons: [\"BAL#325\"],\n errorMSG:\n \"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)\",\n },\n BAL326: {\n reasons: [\"BAL#326\"],\n errorMSG:\n \"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)\",\n },\n BAL327: {\n reasons: [\"BAL#327\"],\n errorMSG: \"Swaps are disabled for this pool. (BEX#327)\",\n },\n BAL328: {\n reasons: [\"BAL#328\"],\n errorMSG: \"Caller is not the owner of the LBP. (BEX#328)\",\n },\n BAL329: {\n reasons: [\"BAL#329\"],\n errorMSG:\n \"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)\",\n },\n BAL330: {\n reasons: [\"BAL#330\"],\n errorMSG:\n \"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)\",\n },\n BAL331: {\n reasons: [\"BAL#331\"],\n errorMSG:\n \"Gradual weight update duration too short (minimum 1 day). (BEX#331)\",\n },\n BAL332: {\n reasons: [\"BAL#332\"],\n errorMSG: \"Invalid Linear Pool operating range. (BEX#332)\",\n },\n BAL333: {\n reasons: [\"BAL#333\"],\n errorMSG: \"Linear Pool max balance must fit in 112 bits. (BEX#333)\",\n },\n BAL334: {\n reasons: [\"BAL#334\"],\n errorMSG:\n \"Unhandled pool join/exit operation for linear pool type. (BEX#334)\",\n },\n BAL335: {\n reasons: [\"BAL#335\"],\n errorMSG:\n \"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)\",\n },\n BAL336: {\n reasons: [\"BAL#336\"],\n errorMSG: \"Unhandled pool exit operation for this pool type. (BEX#336)\",\n },\n BAL337: {\n reasons: [\"BAL#337\"],\n errorMSG:\n \"Management fees can only be collected by the pool owner. (BEX#337)\",\n },\n BAL338: {\n reasons: [\"BAL#338\"],\n errorMSG:\n \"Management swap fee percentage exceeded the maximum. (BEX#338)\",\n },\n BAL339: {\n reasons: [\"BAL#339\"],\n errorMSG:\n \"Unhandled pool join/exit operation for managed pool type. (BEX#339)\",\n },\n BAL340: {\n reasons: [\"BAL#340\"],\n errorMSG:\n \"Unhandled pool join/exit operation for phantom pool type. (BEX#340)\",\n },\n BAL341: {\n reasons: [\"BAL#341\"],\n errorMSG: \"Token does not have a valid rate provider. (BEX#341)\",\n },\n BAL342: {\n reasons: [\"BAL#342\"],\n errorMSG: \"Invalid pool initialization parameters provided. (BEX#342)\",\n },\n BAL343: {\n reasons: [\"BAL#343\"],\n errorMSG:\n \"Value is out of the new target range for the operation. (BEX#343)\",\n },\n BAL344: {\n reasons: [\"BAL#344\"],\n errorMSG: \"This feature is currently disabled. (BEX#344)\",\n },\n BAL345: {\n reasons: [\"BAL#345\"],\n errorMSG: \"The pool controller is uninitialized. (BEX#345)\",\n },\n BAL346: {\n reasons: [\"BAL#346\"],\n errorMSG: \"Cannot set swap fee during an ongoing fee change. (BEX#346)\",\n },\n BAL347: {\n reasons: [\"BAL#347\"],\n errorMSG: \"Cannot set swap fee during pending fee changes. (BEX#347)\",\n },\n BAL348: {\n reasons: [\"BAL#348\"],\n errorMSG: \"Cannot change tokens during a weight change. (BEX#348)\",\n },\n BAL349: {\n reasons: [\"BAL#349\"],\n errorMSG: \"Cannot change tokens during pending weight changes. (BEX#349)\",\n },\n BAL350: {\n reasons: [\"BAL#350\"],\n errorMSG: \"Weight parameter exceeds the maximum allowed. (BEX#350)\",\n },\n BAL351: {\n reasons: [\"BAL#351\"],\n errorMSG: \"Unauthorized join operation. (BEX#351)\",\n },\n BAL352: {\n reasons: [\"BAL#352\"],\n errorMSG:\n \"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)\",\n },\n BAL353: {\n reasons: [\"BAL#353\"],\n errorMSG: \"Fractional target values are not supported. (BEX#353)\",\n },\n BAL354: {\n reasons: [\"BAL#354\"],\n errorMSG:\n \"Adding or removing BPT is not allowed in this context. (BEX#354)\",\n },\n BAL355: {\n reasons: [\"BAL#355\"],\n errorMSG: \"Invalid circuit breaker bounds configuration. (BEX#355)\",\n },\n BAL356: {\n reasons: [\"BAL#356\"],\n errorMSG: \"The circuit breaker has been triggered. (BEX#356)\",\n },\n BAL357: {\n reasons: [\"BAL#357\"],\n errorMSG: \"Malicious query detected and reverted. (BEX#357)\",\n },\n BAL358: {\n reasons: [\"BAL#358\"],\n errorMSG:\n \"Joins and exits are currently disabled for this pool. (BEX#358)\",\n },\n // Lib\n BAL400: {\n reasons: [\"BAL#400\"],\n errorMSG: \"Reentrancy detected. (BEX#400)\",\n },\n BAL401: {\n reasons: [\"BAL#401\"],\n errorMSG: \"The sender is not allowed to perform this action. (BEX#401)\",\n },\n BAL402: {\n reasons: [\"BAL#402\"],\n errorMSG: \"The contract is currently paused. (BEX#402)\",\n },\n BAL403: {\n reasons: [\"BAL#403\"],\n errorMSG: \"The pause window has expired. (BEX#403)\",\n },\n BAL404: {\n reasons: [\"BAL#404\"],\n errorMSG:\n \"The maximum pause window duration has been exceeded. (BEX#404)\",\n },\n BAL405: {\n reasons: [\"BAL#405\"],\n errorMSG:\n \"The maximum buffer period duration has been exceeded. (BEX#405)\",\n },\n BAL406: {\n reasons: [\"BAL#406\"],\n errorMSG: \"The account has insufficient balance. (BEX#406)\",\n },\n BAL407: {\n reasons: [\"BAL#407\"],\n errorMSG: \"The account has insufficient allowance. (BEX#407)\",\n },\n BAL408: {\n reasons: [\"BAL#408\"],\n errorMSG: \"ERC20: Transfer from zero address. (BEX#408)\",\n },\n BAL409: {\n reasons: [\"BAL#409\"],\n errorMSG: \"ERC20: Transfer to zero address. (BEX#409)\",\n },\n BAL410: {\n reasons: [\"BAL#410\"],\n errorMSG: \"ERC20: Mint to zero address. (BEX#410)\",\n },\n BAL411: {\n reasons: [\"BAL#411\"],\n errorMSG: \"ERC20: Burn from zero address. (BEX#411)\",\n },\n BAL412: {\n reasons: [\"BAL#412\"],\n errorMSG: \"ERC20: Approve from zero address. (BEX#412)\",\n },\n BAL413: {\n reasons: [\"BAL#413\"],\n errorMSG: \"ERC20: Approve to zero address. (BEX#413)\",\n },\n BAL414: {\n reasons: [\"BAL#414\"],\n errorMSG: \"ERC20: Transfer exceeds allowance. (BEX#414)\",\n },\n BAL415: {\n reasons: [\"BAL#415\"],\n errorMSG: \"ERC20: Decreased allowance below zero. (BEX#415)\",\n },\n BAL416: {\n reasons: [\"BAL#416\"],\n errorMSG: \"ERC20: Transfer exceeds balance. (BEX#416)\",\n },\n BAL417: {\n reasons: [\"BAL#417\"],\n errorMSG: \"ERC20: Burn exceeds allowance. (BEX#417)\",\n },\n BAL418: {\n reasons: [\"BAL#418\"],\n errorMSG: \"SafeERC20: Call failed. (BEX#418)\",\n },\n BAL419: {\n reasons: [\"BAL#419\"],\n errorMSG: \"Address has insufficient balance. (BEX#419)\",\n },\n BAL420: {\n reasons: [\"BAL#420\"],\n errorMSG: \"Address cannot send value. (BEX#420)\",\n },\n BAL421: {\n reasons: [\"BAL#421\"],\n errorMSG: \"SafeCast: Value cannot fit into int256. (BEX#421)\",\n },\n BAL422: {\n reasons: [\"BAL#422\"],\n errorMSG: \"AccessControl: Grant sender is not an admin. (BEX#422)\",\n },\n BAL423: {\n reasons: [\"BAL#423\"],\n errorMSG: \"AccessControl: Revoke sender is not an admin. (BEX#423)\",\n },\n BAL424: {\n reasons: [\"BAL#424\"],\n errorMSG:\n \"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)\",\n },\n BAL425: {\n reasons: [\"BAL#425\"],\n errorMSG: \"Buffer period has expired. (BEX#425)\",\n },\n BAL426: {\n reasons: [\"BAL#426\"],\n errorMSG: \"Caller is not the owner. (BEX#426)\",\n },\n BAL427: {\n reasons: [\"BAL#427\"],\n errorMSG: \"New owner cannot be zero address. (BEX#427)\",\n },\n BAL428: {\n reasons: [\"BAL#428\"],\n errorMSG: \"Code deployment failed. (BEX#428)\",\n },\n BAL429: {\n reasons: [\"BAL#429\"],\n errorMSG: \"Call to non-contract address. (BEX#429)\",\n },\n BAL430: {\n reasons: [\"BAL#430\"],\n errorMSG: \"Low-level call failed. (BEX#430)\",\n },\n BAL431: {\n reasons: [\"BAL#431\"],\n errorMSG: \"The contract is not paused. (BEX#431)\",\n },\n BAL432: {\n reasons: [\"BAL#432\"],\n errorMSG: \"Address is already allowlisted. (BEX#432)\",\n },\n BAL433: {\n reasons: [\"BAL#433\"],\n errorMSG: \"Address is not allowlisted. (BEX#433)\",\n },\n BAL434: {\n reasons: [\"BAL#434\"],\n errorMSG: \"ERC20: Burn exceeds balance. (BEX#434)\",\n },\n BAL435: {\n reasons: [\"BAL#435\"],\n errorMSG: \"Invalid operation. (BEX#435)\",\n },\n BAL436: {\n reasons: [\"BAL#436\"],\n errorMSG: \"Codec overflow detected. (BEX#436)\",\n },\n BAL437: {\n reasons: [\"BAL#437\"],\n errorMSG: \"The system is in recovery mode. (BEX#437)\",\n },\n BAL438: {\n reasons: [\"BAL#438\"],\n errorMSG: \"The system is not in recovery mode. (BEX#438)\",\n },\n BAL439: {\n reasons: [\"BAL#439\"],\n errorMSG: \"Induced failure. (BEX#439)\",\n },\n BAL440: {\n reasons: [\"BAL#440\"],\n errorMSG: \"Expired signature. (BEX#440)\",\n },\n BAL441: {\n reasons: [\"BAL#441\"],\n errorMSG: \"Malformed signature. (BEX#441)\",\n },\n BAL442: {\n reasons: [\"BAL#442\"],\n errorMSG: \"SafeCast: Value cannot fit into uint64. (BEX#442)\",\n },\n BAL443: {\n reasons: [\"BAL#443\"],\n errorMSG: \"Unhandled fee type. (BEX#443)\",\n },\n BAL444: {\n reasons: [\"BAL#444\"],\n errorMSG: \"ERC20: Burn from zero address. (BEX#444)\",\n },\n // Vault\n BAL500: {\n reasons: [\"BAL#500\"],\n errorMSG: \"Invalid pool ID. (BEX#500)\",\n },\n BAL501: {\n reasons: [\"BAL#501\"],\n errorMSG: \"Caller is not the pool. (BEX#501)\",\n },\n BAL502: {\n reasons: [\"BAL#502\"],\n errorMSG: \"Sender is not the asset manager. (BEX#502)\",\n },\n BAL503: {\n reasons: [\"BAL#503\"],\n errorMSG: \"User does not allow the relayer. (BEX#503)\",\n },\n BAL504: {\n reasons: [\"BAL#504\"],\n errorMSG: \"Invalid signature. (BEX#504)\",\n },\n BAL505: {\n reasons: [\"BAL#505\"],\n errorMSG: \"Exit would yield fewer than the minimum tokens out. (BEX#505)\",\n },\n BAL506: {\n reasons: [\"BAL#506\"],\n errorMSG: \"Join would cost more than the maximum tokens in. (BEX#506)\",\n },\n BAL507: {\n reasons: [\"BAL#507\"],\n errorMSG: \"Swap violates user-supplied limits. (BEX#507)\",\n },\n BAL508: {\n reasons: [\"BAL#508\"],\n errorMSG: \"Swap transaction not mined within the deadline. (BEX#508)\",\n },\n BAL509: {\n reasons: [\"BAL#509\"],\n errorMSG: \"Cannot swap the same token. (BEX#509)\",\n },\n BAL510: {\n reasons: [\"BAL#510\"],\n errorMSG: \"Unknown amount in the first swap of a batch. (BEX#510)\",\n },\n BAL511: {\n reasons: [\"BAL#511\"],\n errorMSG: \"Malconstructed multihop swap. (BEX#511)\",\n },\n BAL512: {\n reasons: [\"BAL#512\"],\n errorMSG: \"Internal balance overflow. (BEX#512)\",\n },\n BAL513: {\n reasons: [\"BAL#513\"],\n errorMSG: \"Insufficient internal balance. (BEX#513)\",\n },\n BAL514: {\n reasons: [\"BAL#514\"],\n errorMSG: \"Invalid BERA internal balance. (BEX#514)\",\n },\n BAL515: {\n reasons: [\"BAL#515\"],\n errorMSG:\n \"Flashloan must repay the loan in the same transaction. (BEX#515)\",\n },\n BAL516: {\n reasons: [\"BAL#516\"],\n errorMSG: \"Insufficient BERA balance. (BEX#516)\",\n },\n BAL517: {\n reasons: [\"BAL#517\"],\n errorMSG: \"Unallocated BERA. (BEX#517)\",\n },\n BAL518: {\n reasons: [\"BAL#518\"],\n errorMSG:\n \"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)\",\n },\n BAL519: {\n reasons: [\"BAL#519\"],\n errorMSG: \"Cannot use BERA sentinel for internal balance. (BEX#519)\",\n },\n BAL520: {\n reasons: [\"BAL#520\"],\n errorMSG: \"Tokens mismatch. (BEX#520)\",\n },\n BAL521: {\n reasons: [\"BAL#521\"],\n errorMSG: \"Token is not registered. (BEX#521)\",\n },\n BAL522: {\n reasons: [\"BAL#522\"],\n errorMSG: \"Token is already registered. (BEX#522)\",\n },\n BAL523: {\n reasons: [\"BAL#523\"],\n errorMSG: \"Tokens are already set. (BEX#523)\",\n },\n BAL524: {\n reasons: [\"BAL#524\"],\n errorMSG: \"Tokens length must be 2. (BEX#524)\",\n },\n BAL525: {\n reasons: [\"BAL#525\"],\n errorMSG: \"Nonzero token balance detected. (BEX#525)\",\n },\n BAL526: {\n reasons: [\"BAL#526\"],\n errorMSG: \"Balance total overflow detected. (BEX#526)\",\n },\n BAL527: {\n reasons: [\"BAL#527\"],\n errorMSG: \"Pool has no tokens. (BEX#527)\",\n },\n BAL528: {\n reasons: [\"BAL#528\"],\n errorMSG: \"Insufficient flash loan balance. (BEX#528)\",\n },\n // Fees\n BAL600: {\n reasons: [\"BAL#600\"],\n errorMSG: \"Swap fee percentage is too high. (BEX#600)\",\n },\n BAL601: {\n reasons: [\"BAL#601\"],\n errorMSG: \"Flash loan fee percentage is too high. (BEX#601)\",\n },\n BAL602: {\n reasons: [\"BAL#602\"],\n errorMSG: \"Insufficient flash loan fee amount. (BEX#602)\",\n },\n // FeeSplitter\n BAL700: {\n reasons: [\"BAL#700\"],\n errorMSG: \"Splitter fee percentage is too high. (BEX#700)\",\n },\n // Misc\n BAL998: {\n reasons: [\"BAL#998\"],\n errorMSG: \"Unimplemented functionality. (BEX#998)\",\n },\n BAL999: {\n reasons: [\"BAL#999\"],\n errorMSG: \"An unexpected error occurred. (BEX#999)\",\n },\n // SoR swap paths\n NO_SWAP_PATHS: {\n keywords: [\"No swap paths returned\"],\n errorMSG: \"No swap paths were found.\",\n },\n },\n AGGREGATOR: {\n NOT_ENOUGH_LIQUIDITY: {\n keywords: [\"Not enough liquidity\"],\n errorMSG: \"Not enough liquidity. Try a lower amount.\",\n },\n },\n POL: {\n REWARD_VAULT_FACTORY: {\n reasons: [\"VaultAlreadyExists\"],\n errorMSG:\n \"Failed to create action. An action already exists with this staking token.\",\n },\n NOT_REWARD_VAULT_MANAGER: {\n reasons: [\"NotRewardVaultManager\"],\n errorMSG: \"You are not the manager of this action.\",\n },\n NOT_INCENTIVE_MANAGER: {\n reasons: [\"NotIncentiveManager\"],\n errorMSG: \"You are not the incentive manager of this token.\",\n },\n DURATION_CHANGE_NOT_ALLOWED: {\n reasons: [\"DurationChangeNotAllowed\"],\n errorMSG: \"You cannot change the duration of this action.\",\n },\n INVALID_PROOF: {\n reasons: [\"InvalidProof\"],\n errorMSG: \"Tokens already claimed or invalid proof.\",\n },\n CONTRACT_PAUSED: {\n reasons: [\"EnforcedPause\"],\n errorMSG: \"The contract you're interacting with is temporarily paused.\",\n },\n DISTRIBUTION_PAUSED: {\n reasons: [\"DistributionEnforcedPause\"],\n errorMSG: \"Distribution is temporarily paused.\",\n },\n INVALID_VALIDATOR_COMMISSION: {\n reasons: [\"InvalidCommissionValue\"],\n errorMSG: \"Invalid commission percentage.\",\n },\n NOT_REWARD_ALLOCATOR: {\n reasons: [\"NotRewardAllocator\"],\n errorMSG: \"You are not the reward allocator of this validator.\",\n },\n NOT_OPERATOR: {\n reasons: [\"NotOperator\"],\n errorMSG: \"You are not the operator of this validator.\",\n },\n INVALID_REWARD_ALLOCATION: {\n reasons: [\"InvalidRewardAllocationWeights\"],\n errorMSG: \"Invalid reward allocation weights.\",\n },\n NOT_REWARD_DURATION_MANAGER: {\n reasons: [\"NotRewardDurationManager\"],\n errorMSG: \"You are not the reward duration manager of this validator.\",\n },\n },\n BEND: {\n INSUFFICIENT_POSITION: {\n keywords: [\"insufficient position\"],\n errorMSG: \"Insufficient position\",\n },\n INSUFFICIENT_LIQUIDITY: {\n keywords: [\"insufficient liquidity on market\"],\n errorMSG: \"Insufficient liquidity on market.\",\n },\n ALL_CAPS_REACHED: {\n reasons: [\"AllCapsReached\"],\n errorMSG: \"All caps reached on vault.\",\n },\n AboveMaxTimelock: {\n reasons: [\"AboveMaxTimelock\"],\n errorMSG: \"Above max timelock\",\n },\n AddressEmptyCode: {\n reasons: [\"AddressEmptyCode\"],\n errorMSG: \"Address empty code\",\n },\n AddressInsufficientBalance: {\n reasons: [\"AddressInsufficientBalance\"],\n errorMSG: \"Address insufficient balance\",\n },\n AllCapsReached: {\n reasons: [\"AllCapsReached\"],\n errorMSG: \"All caps reached\",\n },\n AlreadyPending: {\n reasons: [\"AlreadyPending\"],\n errorMSG: \"Already pending\",\n },\n AlreadySet: {\n reasons: [\"AlreadySet\"],\n errorMSG: \"Already set\",\n },\n BelowMinTimelock: {\n reasons: [\"BelowMinTimelock\"],\n errorMSG: \"Below min timelock\",\n },\n DuplicateMarket: {\n reasons: [\"DuplicateMarket\"],\n errorMSG: \"Duplicate market\",\n },\n ECDSAInvalidSignature: {\n reasons: [\"ECDSAInvalidSignature\"],\n errorMSG: \"Invalid ECDSA signature\",\n },\n ECDSAInvalidSignatureLength: {\n reasons: [\"ECDSAInvalidSignatureLength\"],\n errorMSG: \"Invalid ECDSA signature length\",\n },\n ECDSAInvalidSignatureS: {\n reasons: [\"ECDSAInvalidSignatureS\"],\n errorMSG: \"Invalid ECDSA signature S value\",\n },\n ERC20InsufficientBalance: {\n reasons: [\"ERC20InsufficientBalance\"],\n errorMSG: \"ERC20 insufficient balance\",\n },\n ERC20InvalidApprover: {\n reasons: [\"ERC20InvalidApprover\"],\n errorMSG: \"ERC20 invalid approver\",\n },\n ERC20InvalidReceiver: {\n reasons: [\"ERC20InvalidReceiver\"],\n errorMSG: \"ERC20 invalid receiver\",\n },\n ERC20InvalidSender: {\n reasons: [\"ERC20InvalidSender\"],\n errorMSG: \"ERC20 invalid sender\",\n },\n ERC20InvalidSpender: {\n reasons: [\"ERC20InvalidSpender\"],\n errorMSG: \"ERC20 invalid spender\",\n },\n ERC2612ExpiredSignature: {\n reasons: [\"ERC2612ExpiredSignature\"],\n errorMSG: \"ERC2612 expired signature\",\n },\n ERC2612InvalidSigner: {\n reasons: [\"ERC2612InvalidSigner\"],\n errorMSG: \"ERC2612 invalid signer\",\n },\n ERC4626ExceededMaxDeposit: {\n reasons: [\"ERC4626ExceededMaxDeposit\"],\n errorMSG: \"ERC4626 exceeded max deposit\",\n },\n ERC4626ExceededMaxMint: {\n reasons: [\"ERC4626ExceededMaxMint\"],\n errorMSG: \"ERC4626 exceeded max mint\",\n },\n ERC4626ExceededMaxRedeem: {\n reasons: [\"ERC4626ExceededMaxRedeem\"],\n errorMSG: \"ERC4626 exceeded max redeem\",\n },\n ERC4626ExceededMaxWithdraw: {\n reasons: [\"ERC4626ExceededMaxWithdraw\"],\n errorMSG: \"ERC4626 exceeded max withdraw\",\n },\n FailedInnerCall: {\n reasons: [\"FailedInnerCall\"],\n errorMSG: \"Failed inner call\",\n },\n InconsistentAsset: {\n reasons: [\"InconsistentAsset\"],\n errorMSG: \"Inconsistent asset\",\n },\n InconsistentReallocation: {\n reasons: [\"InconsistentReallocation\"],\n errorMSG: \"Inconsistent reallocation\",\n },\n InvalidAccountNonce: {\n reasons: [\"InvalidAccountNonce\"],\n errorMSG: \"Invalid account nonce\",\n },\n InvalidMarketRemovalNonZeroCap: {\n reasons: [\"InvalidMarketRemovalNonZeroCap\"],\n errorMSG: \"Invalid market removal (non-zero cap)\",\n },\n InvalidMarketRemovalNonZeroSupply: {\n reasons: [\"InvalidMarketRemovalNonZeroSupply\"],\n errorMSG: \"Invalid market removal (non-zero supply)\",\n },\n InvalidMarketRemovalTimelockNotElapsed: {\n reasons: [\"InvalidMarketRemovalTimelockNotElapsed\"],\n errorMSG: \"Invalid market removal (timelock not elapsed)\",\n },\n InvalidShortString: {\n reasons: [\"InvalidShortString\"],\n errorMSG: \"Invalid short string\",\n },\n MarketNotCreated: {\n reasons: [\"MarketNotCreated\"],\n errorMSG: \"Market not created\",\n },\n MarketNotEnabled: {\n reasons: [\"MarketNotEnabled\"],\n errorMSG: \"Market not enabled\",\n },\n MathOverflowedMulDiv: {\n reasons: [\"MathOverflowedMulDiv\"],\n errorMSG: \"Math overflow\",\n },\n MaxFeeExceeded: {\n reasons: [\"MaxFeeExceeded\"],\n errorMSG: \"Max fee exceeded\",\n },\n MaxQueueLengthExceeded: {\n reasons: [\"MaxQueueLengthExceeded\"],\n errorMSG: \"Max queue length exceeded\",\n },\n NoPendingValue: {\n reasons: [\"NoPendingValue\"],\n errorMSG: \"No pending value\",\n },\n NonZeroCap: {\n reasons: [\"NonZeroCap\"],\n errorMSG: \"Non-zero cap\",\n },\n NotAllocatorRole: {\n reasons: [\"NotAllocatorRole\"],\n errorMSG: \"Not allocator role\",\n },\n NotCuratorNorGuardianRole: {\n reasons: [\"NotCuratorNorGuardianRole\"],\n errorMSG: \"Not curator or guardian role\",\n },\n NotCuratorRole: {\n reasons: [\"NotCuratorRole\"],\n errorMSG: \"Not curator role\",\n },\n NotEnoughLiquidity: {\n reasons: [\"NotEnoughLiquidity\"],\n errorMSG: \"Not enough liquidity\",\n },\n NotGuardianRole: {\n reasons: [\"NotGuardianRole\"],\n errorMSG: \"Not guardian role\",\n },\n OwnableInvalidOwner: {\n reasons: [\"OwnableInvalidOwner\"],\n errorMSG: \"Invalid owner\",\n },\n OwnableUnauthorizedAccount: {\n reasons: [\"OwnableUnauthorizedAccount\"],\n errorMSG: \"Unauthorized account\",\n },\n PendingCap: {\n reasons: [\"PendingCap\"],\n errorMSG: \"Pending cap\",\n },\n PendingRemoval: {\n reasons: [\"PendingRemoval\"],\n errorMSG: \"Pending removal\",\n },\n SafeCastOverflowedUintDowncast: {\n reasons: [\"SafeCastOverflowedUintDowncast\"],\n errorMSG: \"SafeCast overflow\",\n },\n SafeERC20FailedOperation: {\n reasons: [\"SafeERC20FailedOperation\"],\n errorMSG: \"SafeERC20 failed operation\",\n },\n StringTooLong: {\n reasons: [\"StringTooLong\"],\n errorMSG: \"String too long\",\n },\n SupplyCapExceeded: {\n reasons: [\"SupplyCapExceeded\"],\n errorMSG: \"Supply cap exceeded\",\n },\n TimelockNotElapsed: {\n reasons: [\"TimelockNotElapsed\"],\n errorMSG: \"Timelock not elapsed\",\n },\n UnauthorizedMarket: {\n reasons: [\"UnauthorizedMarket\"],\n errorMSG: \"Unauthorized market\",\n },\n ZeroAddress: {\n reasons: [\"ZeroAddress\"],\n errorMSG: \"Zero address\",\n },\n ZeroFeeRecipient: {\n reasons: [\"ZeroFeeRecipient\"],\n errorMSG: \"Zero fee recipient\",\n },\n },\n} as const satisfies ErrorMessages;\n","import { type ErrorCategory, errorMsgMap, GENERAL_ERROR } from \"./errorMap\";\n\nexport interface MatchedError {\n /** The error key in the errorMap (e.g. \"NOT_ENOUGH_GAS_TOKEN\") */\n key: string;\n /** The category in the errorMap (e.g. \"RPC\", \"BEX\") */\n category: string;\n /** The user-friendly display message */\n errorMSG: string;\n /** Whether the match was by exact reason (true) or keyword (false) */\n matchedByReason: boolean;\n}\n\n/**\n * Finds the matching error entry in errorMap by reason or message.\n *\n * ## Matching priority:\n * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.\n * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.\n *\n * @returns The matched error entry with key and category, or null if no match found.\n */\nexport function findMatchingError({\n reason,\n message,\n}: {\n reason?: string | null;\n message?: string;\n}): MatchedError | null {\n for (const category in errorMsgMap) {\n const categoryKey = category as keyof typeof errorMsgMap;\n const errors = errorMsgMap[categoryKey] as ErrorCategory;\n\n for (const type in errors) {\n const errorType = errors[type];\n\n // Priority 1: Exact reason match (deterministic, preferred for contract revert reasons)\n if (reason) {\n if (\n errorType?.reasons?.some((r) => {\n return r === reason;\n })\n ) {\n return {\n key: type,\n category,\n errorMSG: errorType.errorMSG,\n matchedByReason: true,\n };\n }\n }\n\n // Priority 2: Keyword substring match on message (case-insensitive fallback, use carefully)\n if (\n errorType?.keywords?.some((keyword) => {\n return message?.toLowerCase().includes(keyword.toLowerCase().trim());\n })\n ) {\n return {\n key: type,\n category,\n errorMSG: errorType.errorMSG,\n matchedByReason: false,\n };\n }\n }\n }\n\n return null;\n}\n\n/**\n * Resolves a user-friendly displayMessage by matching `reason` and `message` against `errorMap.ts`.\n *\n * This is the bridge between the automatic reason detection pipeline (parseViemError) and\n * the user-facing error messages. Called by the BeraError constructor.\n *\n * ## Matching priority:\n * 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.\n * This is the most reliable path — contract revert reasons like \"NotEnoughBalance\" or \"BAL#508\"\n * are matched deterministically.\n * 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.\n * Use sparingly — keyword matching can cause false positives (e.g. \"InsufficientBalance\"\n * keyword would also match \"InsufficientBalanceToPayPythFee\").\n * 3. **GENERAL_ERROR fallback**: \"Something went wrong. Please try again later.\"\n *\n * To ensure new contract errors get good displayMessages, add their reason to `errorMap.ts`.\n * The reason is auto-detected by parseViemError — you only need to map it to a message here.\n */\nexport function getErrorMessage({\n reason,\n message,\n}: {\n reason?: string | null;\n message?: string;\n}): string {\n return findMatchingError({ reason, message })?.errorMSG ?? GENERAL_ERROR;\n}\n","import { type Abi, BaseError } from \"viem\";\n\nimport { appConfig, currentDapp } from \"@berachain/config/internal\";\n\nimport { GENERAL_ERROR } from \"./errorMap\";\nimport { findMatchingError } from \"./getErrorMessage\";\nimport { parseViemError, rpcErrorToReason } from \"./parseViemError\";\nimport type { SeverityLevel } from \"./severity\";\n\nexport interface IBeraErrorArgs {\n message?: string;\n displayMessage?: string;\n cause?: unknown;\n reason?: string;\n chainId?: number;\n fingerprint?: string[];\n /**\n * The level of the error to be used for error reporting.\n */\n level?: SeverityLevel;\n tags?: {\n [key in TagsKey]?: Primitive;\n };\n extra?: Record<string, unknown>;\n /**\n * Optional ABI to be used to parse the error.\n */\n abi?: Abi;\n}\n\ntype Primitive = number | string | boolean | bigint | symbol | null | undefined;\n\n/**\n * An helper type to make sure we only use the allowed tags. Sync this with docs/errors.md\n */\ntype TagsKey =\n | \"wallet.chain\"\n | \"wallet.connector\"\n | \"wallet.address\"\n | \"error.reason\"\n | \"operation.type\"\n | \"operation.key\"\n | \"operation.txn.functionName\"\n | \"operation.txn.to\"\n | \"operation.txn.status\"\n | \"operation.source.url\"\n | \"operation.source.name\"\n | \"operation.source.queryName\"\n | \"operation.source.type\";\n\n/**\n * Base error class for the entire berajs SDK.\n *\n * All errors should be a BeraError or one of its subclasses. Unknown errors should be\n * normalized via `initBeraError({ cause })`.\n *\n * Key design: the constructor runs an **automatic reason detection pipeline** when `reason`\n * is not explicitly provided. It calls `parseViemError` on the `cause` to extract a\n * machine-readable reason code (e.g. \"NotEnoughBalance\", \"BAL#508\", \"UserRejectedRequestError\").\n * That reason is then matched against `errorMap.ts` to resolve a user-friendly `displayMessage`.\n *\n * This means: for most viem errors, you only need to pass `cause` and everything else\n * (reason, displayMessage, level) is derived automatically.\n *\n * @see parseViemError — the reason extraction engine\n * @see errorMap.ts — reason → displayMessage mapping\n * @see initBeraError — normalizes any error into a BeraError (preferred entry point)\n */\nexport class BeraError extends Error {\n /**\n * A human-readable message that can be displayed to end user.\n *\n * In berachain dapps, this is shown in the error pop-up.\n */\n displayMessage: string;\n\n /**\n * The cause of the error.\n *\n * This is typically the error that was thrown.\n */\n cause: unknown;\n\n /**\n * The chain id of the error.\n */\n chainId?: number;\n\n /**\n * The code for the reason for the error.\n *\n * This is typically the error code can be found in the errorMap.ts file. I.e. NotEnoughBalance or BAL#508\n */\n reason: string | null = null;\n\n /**\n * The fingerprint for the error.\n *\n * This is typically used to group errors in Sentry.\n */\n fingerprint: string[] | undefined;\n\n private _tags: {\n [key: string | TagsKey]: Primitive;\n } = {};\n\n set tags(tags: {\n [key: string | TagsKey]: Primitive;\n }) {\n this._tags = tags;\n }\n\n get tags(): {\n [key: string | TagsKey]: Primitive;\n } {\n return {\n ...this._tags,\n \"error.displayMessage\": this.displayMessage,\n \"error.reason\": this.reason,\n \"error.level\": this.level,\n };\n }\n\n level: SeverityLevel = \"error\";\n\n extra: Record<string, unknown> = {};\n\n constructor({\n message: m,\n displayMessage: dm,\n cause,\n reason,\n level,\n abi,\n tags,\n chainId,\n fingerprint,\n }: IBeraErrorArgs) {\n let message = m;\n\n if (!message) {\n if (cause instanceof BaseError) {\n // Using shortMesage as it doesn't include the payload.\n message = cause.shortMessage;\n } else if (cause instanceof Error) {\n message = cause.message;\n } else if (\n typeof cause === \"object\" &&\n cause !== null &&\n \"message\" in cause &&\n typeof cause.message === \"string\"\n ) {\n // this covers responses from HTTP requests\n message = cause.message;\n }\n }\n super(message, {\n cause,\n });\n\n this.name = \"BeraError\";\n\n this.fingerprint = fingerprint;\n\n this.cause = cause;\n\n this.chainId = chainId;\n\n // ── Automatic reason detection ──────────────────────────────────────\n // If `reason` was provided explicitly, use it directly.\n // Otherwise, attempt to extract it from the `cause` by unwrapping the viem error chain.\n // parseViemError walks nested errors (ContractFunctionExecutionError →\n // ContractFunctionRevertedError → RpcRequestError) and decodes revert data using ABI.\n // The extracted reason (e.g. \"NotEnoughBalance\", \"BAL#508\") is the key that drives\n // displayMessage resolution and Sentry fingerprinting.\n if (reason) {\n this.reason = reason;\n } else if (cause instanceof Error) {\n try {\n const parsed = parseViemError({\n error: cause,\n revertIfUnknown: true,\n abi,\n });\n\n this.reason = parsed?.reason ?? null;\n } catch {\n // parseViemError throws when it can't identify the error type and revertIfUnknown=true.\n // In that case, reason stays null and displayMessage falls back to GENERAL_ERROR.\n }\n }\n\n // ── Level inference ─────────────────────────────────────────────────\n // User rejections are \"info\" (not actionable by devs), everything else defaults to \"error\".\n if (level) {\n this.level = level;\n } else if (this.reason === rpcErrorToReason(\"UserRejectedRequestError\")) {\n this.level = \"info\";\n } else {\n this.level = \"error\";\n }\n\n // ── displayMessage resolution ─────────────────────────────────────────\n // Priority:\n // 1. Explicit `displayMessage` passed by caller\n // 2. Cascaded from a BeraError cause (if it has a non-generic message)\n // 3. Looked up from errorMap.ts using the detected `reason` and `message`\n // 4. GENERAL_ERROR fallback: \"Something went wrong. Please try again later.\"\n let displayMessage = dm;\n\n if (\n this.cause instanceof BeraError &&\n this.cause.displayMessage !== GENERAL_ERROR\n ) {\n // Cascade: inner BeraError already resolved a good displayMessage, reuse it\n displayMessage = this.cause.displayMessage;\n }\n\n if (!displayMessage) {\n // Match reason (exact) or message (keyword) against errorMap.ts\n const matched = findMatchingError(this);\n displayMessage = matched?.errorMSG;\n\n // ── Reason normalization ──────────────────────────────────────────\n // If the reason was resolved from a raw error message (e.g. \"insufficient funds for\n // gas * price + value: have X want Y\") rather than a stable key (e.g. \"InsufficientFundsError\"),\n // normalize it to the matched errorMap key (e.g. \"NOT_ENOUGH_GAS\") for stable Sentry fingerprinting.\n if (matched && !matched.matchedByReason && this.reason) {\n this.reason = matched.key;\n }\n }\n\n this.displayMessage = displayMessage ?? GENERAL_ERROR;\n\n this.tags = {\n ...this.tags,\n ...tags,\n };\n // Useful for debugging in development or on vercel preview links\n if (\n !appConfig.env.isProduction &&\n // skip debug logs on consumer of the berajs package\n (process.env.NEXT_PUBLIC_IS_MONOBERA === \"true\" || currentDapp) &&\n process.env.NODE_ENV !== \"test\"\n ) {\n console.group(\"BeraError thrown\");\n console.debug(\"Level\", this.level);\n console.debug(\"Reason\", this.reason);\n console.debug(\"Message\", this.message);\n console.debug(\"Display Message\", this.displayMessage);\n console.debug(\"Cause\", this.cause);\n console.groupEnd();\n }\n }\n}\n","export const bundler3errorsAbi = [\n { inputs: [], name: \"AlreadyInitiated\", type: \"error\" },\n { inputs: [], name: \"EmptyBundle\", type: \"error\" },\n { inputs: [], name: \"IncorrectReenterHash\", type: \"error\" },\n { inputs: [], name: \"MissingExpectedReenter\", type: \"error\" },\n] as const;\n","/**\n * A list of ERC20 error codes according to eip-6093 and solady.\n *\n * This is needed since viem erc20Abi does not include error codes.\n */\nexport const erc20errorsAbi = [\n { inputs: [], name: \"AllowanceOverflow\", type: \"error\" },\n { inputs: [], name: \"AllowanceUnderflow\", type: \"error\" },\n { inputs: [], name: \"ETHTransferFailed\", type: \"error\" },\n { inputs: [], name: \"InsufficientAllowance\", type: \"error\" },\n { inputs: [], name: \"InsufficientBalance\", type: \"error\" },\n { inputs: [], name: \"InvalidPermit\", type: \"error\" },\n { inputs: [], name: \"Permit2AllowanceIsFixedAtInfinity\", type: \"error\" },\n { inputs: [], name: \"PermitExpired\", type: \"error\" },\n { inputs: [], name: \"TotalSupplyOverflow\", type: \"error\" },\n { name: \"AllowanceOverflow\", type: \"error\", inputs: [] },\n { name: \"AllowanceUnderflow\", type: \"error\", inputs: [] },\n { name: \"InsufficientAllowance\", type: \"error\", inputs: [] },\n { name: \"InsufficientBalance\", type: \"error\", inputs: [] },\n { name: \"InvalidPermit\", type: \"error\", inputs: [] },\n { name: \"Permit2AllowanceIsFixedAtInfinity\", type: \"error\", inputs: [] },\n { name: \"PermitExpired\", type: \"error\", inputs: [] },\n { name: \"TotalSupplyOverflow\", type: \"error\", inputs: [] },\n { name: \"ECDSAInvalidSignature\", type: \"error\", inputs: [] },\n {\n name: \"ECDSAInvalidSignatureLength\",\n type: \"error\",\n inputs: [{ type: \"uint256\" }],\n },\n {\n name: \"ECDSAInvalidSignatureS\",\n type: \"error\",\n inputs: [{ type: \"bytes32\" }],\n },\n {\n name: \"ERC20InsufficientAllowance\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }, { type: \"uint256\" }],\n },\n {\n name: \"ERC20InsufficientBalance\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }, { type: \"uint256\" }],\n },\n {\n name: \"ERC20InvalidApprover\",\n type: \"error\",\n inputs: [{ type: \"address\" }],\n },\n {\n name: \"ERC20InvalidReceiver\",\n type: \"error\",\n inputs: [{ type: \"address\" }],\n },\n { name: \"ERC20InvalidSender\", type: \"error\", inputs: [{ type: \"address\" }] },\n { name: \"ERC20InvalidSpender\", type: \"error\", inputs: [{ type: \"address\" }] },\n {\n name: \"ERC2612ExpiredSignature\",\n type: \"error\",\n inputs: [{ type: \"uint256\" }],\n },\n {\n name: \"ERC2612InvalidSigner\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"address\" }],\n },\n {\n name: \"InvalidAccountNonce\",\n type: \"error\",\n inputs: [{ type: \"address\" }, { type: \"uint256\" }],\n },\n { name: \"InvalidShortString\", type: \"error\", inputs: [] },\n { name: \"StringTooLong\", type: \"error\", inputs: [{ type: \"string\" }] },\n] as const;\n","export const openChainErrorsAbi = [\n {\n name: \"AllowanceExpired\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"AssetNotRegistered\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n ],\n },\n {\n name: \"ERC20InsufficientAllowance\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ERC4626ExceededMaxWithdraw\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ERC721NonexistentToken\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"ExecutionFailed\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n {\n type: \"address\",\n },\n {\n type: \"string\",\n },\n ],\n },\n {\n name: \"ExpiredTransaction\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"FailedToCallFunction\",\n type: \"error\",\n inputs: [\n {\n type: \"bytes\",\n },\n ],\n },\n {\n name: \"InsufficientAmountOut\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"MinimalOutputBalanceViolation\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"NotPegged\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n ],\n },\n {\n name: \"RedeemMoreThanMax\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"SignatureExpired\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"SlippageExceeded\",\n type: \"error\",\n inputs: [\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"SlippageExceeded\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"StalePrice\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"TooMuchSlippage\",\n type: \"error\",\n inputs: [\n {\n type: \"address\",\n },\n {\n type: \"uint256\",\n },\n {\n type: \"uint256\",\n },\n ],\n },\n {\n name: \"TransferFromFailed\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"UnexpectedBasketModeStatus\",\n type: \"error\",\n inputs: [],\n },\n {\n name: \"zeroAmountRequired\",\n type: \"error\",\n inputs: [],\n },\n] as const;\n","import { bundler3errorsAbi } from \"./bundler3errors\";\nimport { erc20errorsAbi } from \"./erc20errors\";\nimport { openChainErrorsAbi } from \"./openChainErrors\";\n\nexport const commonAbiErrors = [\n ...erc20errorsAbi,\n ...bundler3errorsAbi,\n ...openChainErrorsAbi,\n] as const;\n","import {\n type Abi,\n AtomicReadyWalletRejectedUpgradeError,\n BaseError,\n ContractFunctionExecutionError,\n ContractFunctionRevertedError,\n type DecodeErrorResultReturnType,\n decodeErrorResult,\n HttpRequestError,\n type ProviderRpcErrorCode,\n RpcRequestError,\n TransactionExecutionError,\n UserRejectedRequestError,\n} from \"viem\";\n\nimport { commonAbiErrors } from \"../abi/utils/commonAbiErrors\";\n\n/**\n * Duck-type check for viem's BaseError.\n *\n * We can't always rely on `instanceof BaseError` because viem errors may originate\n * from a different version of the `viem` package (e.g. in dependency tree mismatches).\n * The duck-type fallback checks for the structural shape that all viem errors share:\n * `shortMessage`, `message`, and `details`.\n */\nfunction isBaseError(error: unknown): error is BaseError {\n if (error instanceof BaseError) {\n return true;\n }\n\n if (\n error instanceof Error &&\n \"shortMessage\" in error &&\n \"message\" in error &&\n \"details\" in error\n ) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Type-guard for specific viem error types.\n *\n * Uses both `instanceof` and `error.name` to handle cases where the error\n * was created by a different viem version (name-based fallback).\n */\nfunction isViemError<T extends Error>(\n error: Error,\n name: T[\"name\"],\n shouldBeInstanceOf: new (...args: any[]) => T,\n): error is T {\n if (error instanceof shouldBeInstanceOf) {\n return true;\n }\n\n if (error.name === name) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Extracts a human-readable reason string from a decoded Solidity error.\n *\n * Solidity has two kinds of revert errors:\n * - `revert(\"some message\")` → decoded as `Error(string)` where the message is in `args[0]`.\n * In this case we return the string argument (e.g. `\"BAL#508\"`).\n * - `revert CustomError(...)` → decoded as `CustomError(...)` where `errorName` is the\n * custom error name. In this case we return `errorName` (e.g. `\"NotEnoughBalance\"`).\n *\n * The returned string is used as the `reason` field in BeraError and is matched against\n * `errorMap.ts` to resolve a user-friendly `displayMessage`.\n */\nexport function parseDecodedError<const abi extends Abi | readonly unknown[]>(\n error: DecodeErrorResultReturnType<abi>,\n): string | undefined {\n if (\n error.errorName === \"Error\" &&\n Array.isArray(error.args) &&\n error.args?.at(0)\n ) {\n // Solidity `revert(\"message\")` — the message string is the reason\n return error.args?.at(0) as string;\n }\n\n // Custom error `revert CustomError(...)` — the error name is the reason\n return error.errorName;\n}\n\n/**\n * The reason extraction engine — recursively unwraps viem error chains to extract\n * a machine-readable `reason` string.\n *\n * This function is the core of the automatic reason detection system. It is called by:\n * - `BeraError` constructor (when `reason` is not manually provided)\n * - `initBeraError` (to detect if the error is a RequestError)\n * - `getRevertReason` (after replaying a failed on-chain transaction)\n *\n * ## Viem error chain structure\n *\n * Viem errors are deeply nested. The typical chains look like:\n *\n * **From `simulateContract`:**\n * ```\n * ContractFunctionExecutionError ← wrapper, skipped\n * └── ContractFunctionRevertedError ← reason extracted here (cause.reason / cause.signature)\n * ```\n *\n * **From `publicClient.call` (raw call):**\n * ```\n * CallExecutionError ← wrapper, skipped\n * └── ExecutionRevertedError ← wrapper, skipped\n * └── RpcRequestError ← reason decoded from cause.data using ABI\n * ```\n *\n * **From `writeContract` / `sendTransaction`:**\n * ```\n * TransactionExecutionError ← checked for special wallet errors\n * └── UserRejectedRequestError ← \"UserRejectedRequestError\"\n * └── AtomicReadyWalletRejectedUpgradeError ← \"AtomicReadyWalletRejectedUpgradeError\"\n * ```\n *\n * **From RPC transport failures:**\n * ```\n * ContractFunctionExecutionError ← wrapper, skipped\n * └── HttpRequestError ← \"HttpRequestError(status:<code>)\", isRequestError=true\n * ```\n *\n * The function walks `cause.cause` in a while loop until it finds an error type it can\n * extract a reason from, or runs out of nested causes.\n *\n * ## Parameters\n *\n * @param error - Any Error instance (typically a viem BaseError).\n * @param abi - Optional contract ABI. Merged with `commonAbiErrors` to decode revert data.\n * Passing the correct ABI enables decoding custom error names (e.g. \"SlippageExceeded\")\n * instead of falling back to hex selectors (e.g. \"0xa3b1e29f\").\n * @param revertIfUnknown - If true, throws when the error doesn't match any known pattern.\n * The BeraError constructor calls with `true`; `initBeraError` calls with `false`.\n *\n * @returns `{ reason, rootCause, isRequestError? }` where:\n * - `reason` is the extracted error code/name (matched against errorMap.ts for displayMessage)\n * - `rootCause` is the deepest error in the chain that was identified\n * - `isRequestError` is true if the error is an HTTP/RPC transport failure\n */\nexport function parseViemError({\n error,\n abi,\n revertIfUnknown = true,\n}: {\n error: Error;\n abi?: Abi;\n revertIfUnknown: boolean;\n}): {\n reason: string | undefined;\n rootCause: unknown;\n isRequestError?: boolean;\n} {\n // If it's not a viem-shaped error, either rethrow or return the message as-is\n if (!isBaseError(error)) {\n if (revertIfUnknown) {\n throw error;\n }\n\n if (error instanceof BaseError) {\n return { reason: error.shortMessage, rootCause: error };\n }\n\n return { reason: error.message, rootCause: error };\n }\n\n // Begin unwrapping the nested error chain\n let cause: unknown = error;\n\n // Walk the nested viem error chain from outermost to innermost.\n // Each iteration checks for known error types and either extracts the reason or\n // skips the wrapper to go deeper into `cause.cause`.\n while (isBaseError(cause)) {\n // ── Step 1: Skip wrapper errors that don't carry reason data ────────────\n // ContractFunctionExecutionError is a top-level wrapper from simulateContract/writeContract.\n // The actual revert info is in its nested cause.\n if (\n isViemError(\n cause,\n \"ContractFunctionExecutionError\",\n ContractFunctionExecutionError,\n )\n ) {\n cause = cause.cause;\n continue;\n }\n\n // ── Step 2: Check for wallet-level errors ──────────────────────────────\n // TransactionExecutionError wraps errors from wallet interactions (sendTransaction).\n // Check for EIP-7702 smart wallet upgrade rejection specifically.\n if (\n isViemError(cause, \"TransactionExecutionError\", TransactionExecutionError)\n ) {\n if (cause.cause instanceof AtomicReadyWalletRejectedUpgradeError) {\n return {\n reason: \"AtomicReadyWalletRejectedUpgradeError\",\n rootCause: cause.cause,\n };\n }\n }\n\n // ── Step 3: RpcRequestError — from raw `publicClient.call` ─────────────\n // Error chain: CallExecutionError → ExecutionRevertedError → RpcRequestError\n // The revert data is in `cause.data` as raw hex bytes.\n // We decode it using the provided ABI + commonAbiErrors to get the error name.\n if (isViemError(cause, \"RpcRequestError\", RpcRequestError)) {\n if (!cause.data) {\n // No revert data available — check if there's a nested message (special RPC cases)\n if (\n typeof cause.cause === \"object\" &&\n cause.cause &&\n \"message\" in cause.cause &&\n typeof cause.cause.message === \"string\"\n ) {\n return { reason: cause.cause.message, rootCause: cause.cause };\n }\n\n throw new Error(\"No data\", { cause });\n }\n\n // Decode the raw revert bytes into a structured error using ABI.\n // commonAbiErrors includes Error(string) and Panic(uint256) so standard reverts\n // are always decodable even without a user-provided ABI.\n const decodedError = decodeErrorResult({\n data: cause.data as `0x${string}`,\n abi: [...commonAbiErrors, ...(abi ?? [])],\n });\n\n return {\n reason: parseDecodedError(decodedError) ?? cause.shortMessage,\n rootCause: cause,\n };\n }\n\n // ── Step 4: ContractFunctionRevertedError — from `simulateContract` ────\n // Error chain: ContractFunctionExecutionError → ContractFunctionRevertedError\n // Viem already decoded the revert using the ABI passed to simulateContract.\n // `cause.reason` is the decoded error name (e.g. \"NotEnoughBalance\").\n // `cause.signature` is the 4-byte selector fallback (e.g. \"0x13be252b\").\n // `cause.data?.errorName` is another fallback from the decoded data.\n if (\n isViemError(\n cause,\n \"ContractFunctionRevertedError\",\n ContractFunctionRevertedError,\n )\n ) {\n return {\n reason:\n cause.reason ??\n cause.signature ??\n cause.data?.errorName ??\n cause.shortMessage,\n rootCause: cause,\n };\n }\n\n // ── Step 5: UserRejectedRequestError — wallet popup dismissed ──────────\n // The user clicked \"Reject\" in their wallet. Level is set to \"info\" by BeraError constructor.\n if (\n isViemError(cause, \"UserRejectedRequestError\", UserRejectedRequestError)\n ) {\n return { reason: \"UserRejectedRequestError\", rootCause: cause };\n }\n\n // ── Step 6: HttpRequestError — RPC transport failure ───────────────────\n // The RPC endpoint returned an HTTP error (e.g. 502, 503).\n // Flagged as isRequestError so initBeraError can wrap it in a RequestError.\n if (isViemError(cause, \"HttpRequestError\", HttpRequestError)) {\n return {\n reason: `HttpRequestError(status:${cause.status})`,\n rootCause: cause,\n isRequestError: true,\n };\n }\n\n // ── Step 7: End of chain — no deeper cause to unwrap ───────────────────\n if (!cause.cause) {\n return { reason: cause.name, rootCause: cause };\n }\n\n // Keep unwrapping\n cause = cause.cause;\n }\n\n if (!revertIfUnknown) {\n return { reason: undefined, rootCause: cause };\n }\n\n // Cannot use BeraError here because of circular dependency\n throw new Error(\"UnknownErrorInGetRevertReason\", {\n cause: cause,\n });\n}\n\n/**\n * Returns the error code thrown by RpcError.\n *\n * @see {@link RpcError}\n * @param errCode - The error code to get the name for.\n * @returns The name of the error code.\n */\nexport function rpcErrorToReason(\n errCode:\n | number\n | ProviderRpcErrorCode\n // Here we add errors for which we know the code\n | \"UserRejectedRequestError\",\n): string {\n switch (errCode) {\n // Actually this should not get here if UserRejectedRequestError is thrown\n case \"UserRejectedRequestError\":\n case 4001:\n return \"UserRejectedRequestError\";\n default:\n return `RPC_ERROR_${errCode}`;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/enum/polling.ts"],"sourcesContent":["enum POLLING {\n FAST = 10000, // 10 sec\n NORMAL = 100000, // 100 sec\n SLOW = 180000, // 3 min\n REFRESH_BLOCK_INTERVAL = 10000, // 10 sec\n}\n\nexport { POLLING };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/enum/polling.ts"],"sourcesContent":["enum POLLING {\n FAST = 10000, // 10 sec\n NORMAL = 100000, // 100 sec\n SLOW = 180000, // 3 min\n REFRESH_BLOCK_INTERVAL = 10000, // 10 sec\n}\n\nexport { POLLING };\n"],"mappings":"AAAA,IAAKA,OACHA,IAAA,KAAO,KAAP,OACAA,IAAA,OAAS,KAAT,SACAA,IAAA,KAAO,MAAP,OACAA,IAAA,uBAAyB,KAAzB,yBAJGA,OAAA","names":["POLLING"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as t}from"./chunk-RSDCKN4Q.mjs";import{chainConfigs as A,defaultChainId as m}from"@berachain/config/internal";function i(o){let n=o.chainId??m,e=o.config??A[n];if(o.chainId&&o.chainId!==e.chainId)throw new t({property:"chainId",value:n,expected:`config.chainId: ${e.chainId}`});return{config:e,chainId:e.chainId}}import{ethAddress as p,isAddress as B,zeroAddress as f}from"viem";import{mainnet as d}from"@berachain/config/mainnet";var I={address:f,decimals:18,name:"Bera",symbol:"BERA",logoURI:"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public"},R={address:d.tokens.wbera,decimals:18,name:"WBera",symbol:"WBERA"};function l(o){let{config:n,chainId:e}=i(o);return{address:n.honey.token,symbol:"HONEY",name:"Honey",decimals:18,chainId:e}}function b(...o){let[n,e,r]=o;if(n===void 0)return!1;let s=typeof n=="string"?n:n.address;if(typeof e=="string"&&!B(e)&&!e.startsWith("0x")){if(e==="BERA")return s.toLowerCase()===f;if(e==="WBERA")return s.toLowerCase()===d.tokens.wbera;if(e==="ETH")return s.toLowerCase()===p;if(e==="SWBERA")return s.toLowerCase()===d.tokens.swbera.toLowerCase();if(r===void 0)throw new t({property:"baseArgs",value:r,expected:"BeraJS.BaseFunctionArgs",message:"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: "+e+" and token address: "+s});let{config:a}=i(r),c={BGT:a.tokens.bgt,HONEY:a.honey.token,SWBERA:a.tokens.swbera,ETH:p};if(e in c)return s.toLowerCase()===c[e].toLowerCase()}let k=typeof e=="object"?e.address:e;return s.toLowerCase()===k.toLowerCase()}export{i as a,I as b,R as c,l as d,b as e};
|
|
2
|
+
//# sourceMappingURL=chunk-5W7UKRHX.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/parseBaseArgs.ts","../src/utils/tokens.ts"],"sourcesContent":["import {\n type BeraConfig,\n chainConfigs,\n defaultChainId,\n} from \"@berachain/config/internal\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\n\nexport function parseBaseArgs(args: BeraJS.BaseFunctionArgs) {\n const chainId = args.chainId ?? defaultChainId;\n const config: BeraConfig = args.config ?? chainConfigs[chainId];\n\n if (args.chainId && args.chainId !== config.chainId) {\n // this matches unless the config is explicitly provided\n throw new InvalidArgumentError({\n property: \"chainId\",\n value: chainId,\n expected: `config.chainId: ${config.chainId}`,\n });\n }\n\n return { config, chainId: config.chainId };\n}\n","import { type Address, ethAddress, isAddress, zeroAddress } from \"viem\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport { parseBaseArgs } from \"./parseBaseArgs\";\n\nexport const beraToken = {\n address: zeroAddress,\n decimals: 18,\n name: \"Bera\",\n symbol: \"BERA\",\n logoURI:\n \"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport const wBeraToken = {\n address: mainnet.tokens.wbera,\n decimals: 18,\n name: \"WBera\",\n symbol: \"WBERA\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport function getHoneyToken(baseArgs: BeraJS.BaseFunctionArgs) {\n const { config, chainId } = parseBaseArgs(baseArgs);\n\n return {\n address: config.honey.token,\n symbol: \"HONEY\",\n name: \"Honey\",\n decimals: 18,\n chainId,\n } as const satisfies TokenWithMetadata;\n}\n\ntype KnownTokens = \"BERA\" | \"WBERA\" | \"BGT\" | \"HONEY\" | \"SWBERA\" | \"ETH\";\n\ntype BaseToken =\n | {\n address: Address | string;\n }\n | Address;\n\ntype InputToken = BaseToken | string | undefined;\n\ntype IsTokenParams =\n | [\n token: InputToken,\n compareTo:\n | BaseToken\n | Extract<KnownTokens, \"BERA\" | \"WBERA\" | \"ETH\" | \"SWBERA\">,\n ]\n | [\n token: InputToken,\n compareTo: BaseToken | KnownTokens,\n baseArgs: BeraJS.BaseFunctionArgs,\n ];\n\nexport function isToken(...args: IsTokenParams): boolean {\n const [token, compareTo, baseArgs] = args;\n\n if (token === undefined) return false;\n\n const tokenAddress = typeof token === \"string\" ? token : token.address;\n\n if (\n typeof compareTo === \"string\" &&\n !isAddress(compareTo) &&\n // this is a safeguard against weird inputs from enso. `0x00`\n !compareTo.startsWith(\"0x\")\n ) {\n if (compareTo === \"BERA\") {\n return tokenAddress.toLowerCase() === zeroAddress;\n }\n if (compareTo === \"WBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.wbera;\n }\n\n if (compareTo === \"ETH\") {\n return tokenAddress.toLowerCase() === ethAddress;\n }\n\n if (compareTo === \"SWBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.swbera.toLowerCase();\n }\n\n if (baseArgs === undefined) {\n throw new InvalidArgumentError({\n property: \"baseArgs\",\n value: baseArgs,\n expected: \"BeraJS.BaseFunctionArgs\",\n message:\n \"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: \" +\n compareTo +\n \" and token address: \" +\n tokenAddress,\n });\n }\n const { config } = parseBaseArgs(baseArgs);\n\n const tokenMap: Record<Exclude<KnownTokens, \"BERA\" | \"WBERA\">, Address> = {\n BGT: config.tokens.bgt,\n HONEY: config.honey.token,\n SWBERA: config.tokens.swbera,\n ETH: ethAddress as Address,\n } as const;\n if (compareTo in tokenMap) {\n return (\n tokenAddress.toLowerCase() ===\n tokenMap[compareTo as keyof typeof tokenMap].toLowerCase()\n );\n }\n }\n\n const compareToAddress =\n typeof compareTo === \"object\" ? compareTo.address : compareTo;\n\n return tokenAddress.toLowerCase() === compareToAddress.toLowerCase();\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/utils/parseBaseArgs.ts","../src/utils/tokens.ts"],"sourcesContent":["import {\n type BeraConfig,\n chainConfigs,\n defaultChainId,\n} from \"@berachain/config/internal\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\n\nexport function parseBaseArgs(args: BeraJS.BaseFunctionArgs) {\n const chainId = args.chainId ?? defaultChainId;\n const config: BeraConfig = args.config ?? chainConfigs[chainId];\n\n if (args.chainId && args.chainId !== config.chainId) {\n // this matches unless the config is explicitly provided\n throw new InvalidArgumentError({\n property: \"chainId\",\n value: chainId,\n expected: `config.chainId: ${config.chainId}`,\n });\n }\n\n return { config, chainId: config.chainId };\n}\n","import { type Address, ethAddress, isAddress, zeroAddress } from \"viem\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { InvalidArgumentError } from \"../errors/InvalidArgumentError\";\nimport type { TokenWithMetadata } from \"../types/dex\";\nimport { parseBaseArgs } from \"./parseBaseArgs\";\n\nexport const beraToken = {\n address: zeroAddress,\n decimals: 18,\n name: \"Bera\",\n symbol: \"BERA\",\n logoURI:\n \"https://imagedelivery.net/qNj7Q3MCke89zoKzav7eDQ/tokens/0x0000000000000000000000000000000000000000.png/public\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport const wBeraToken = {\n address: mainnet.tokens.wbera,\n decimals: 18,\n name: \"WBera\",\n symbol: \"WBERA\",\n} as const satisfies Omit<TokenWithMetadata, \"chainId\">;\n\nexport function getHoneyToken(baseArgs: BeraJS.BaseFunctionArgs) {\n const { config, chainId } = parseBaseArgs(baseArgs);\n\n return {\n address: config.honey.token,\n symbol: \"HONEY\",\n name: \"Honey\",\n decimals: 18,\n chainId,\n } as const satisfies TokenWithMetadata;\n}\n\ntype KnownTokens = \"BERA\" | \"WBERA\" | \"BGT\" | \"HONEY\" | \"SWBERA\" | \"ETH\";\n\ntype BaseToken =\n | {\n address: Address | string;\n }\n | Address;\n\ntype InputToken = BaseToken | string | undefined;\n\ntype IsTokenParams =\n | [\n token: InputToken,\n compareTo:\n | BaseToken\n | Extract<KnownTokens, \"BERA\" | \"WBERA\" | \"ETH\" | \"SWBERA\">,\n ]\n | [\n token: InputToken,\n compareTo: BaseToken | KnownTokens,\n baseArgs: BeraJS.BaseFunctionArgs,\n ];\n\nexport function isToken(...args: IsTokenParams): boolean {\n const [token, compareTo, baseArgs] = args;\n\n if (token === undefined) return false;\n\n const tokenAddress = typeof token === \"string\" ? token : token.address;\n\n if (\n typeof compareTo === \"string\" &&\n !isAddress(compareTo) &&\n // this is a safeguard against weird inputs from enso. `0x00`\n !compareTo.startsWith(\"0x\")\n ) {\n if (compareTo === \"BERA\") {\n return tokenAddress.toLowerCase() === zeroAddress;\n }\n if (compareTo === \"WBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.wbera;\n }\n\n if (compareTo === \"ETH\") {\n return tokenAddress.toLowerCase() === ethAddress;\n }\n\n if (compareTo === \"SWBERA\") {\n // we are sure that wbera token is the same on all chains because it's checked on the config and forced as types\n return tokenAddress.toLowerCase() === mainnet.tokens.swbera.toLowerCase();\n }\n\n if (baseArgs === undefined) {\n throw new InvalidArgumentError({\n property: \"baseArgs\",\n value: baseArgs,\n expected: \"BeraJS.BaseFunctionArgs\",\n message:\n \"baseArgs is required when compared to a known token different than BERA or WBERA. Checking against token: \" +\n compareTo +\n \" and token address: \" +\n tokenAddress,\n });\n }\n const { config } = parseBaseArgs(baseArgs);\n\n const tokenMap: Record<Exclude<KnownTokens, \"BERA\" | \"WBERA\">, Address> = {\n BGT: config.tokens.bgt,\n HONEY: config.honey.token,\n SWBERA: config.tokens.swbera,\n ETH: ethAddress as Address,\n } as const;\n if (compareTo in tokenMap) {\n return (\n tokenAddress.toLowerCase() ===\n tokenMap[compareTo as keyof typeof tokenMap].toLowerCase()\n );\n }\n }\n\n const compareToAddress =\n typeof compareTo === \"object\" ? compareTo.address : compareTo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OAAOC,EAAa,YAAY,IAAME,EAGxC,GAAIH,IAAc,SAEhB,OAAOC,EAAa,YAAY,IAAMV,EAAQ,OAAO,OAAO,YAAY,EAG1E,GAAIE,IAAa,OACf,MAAM,IAAIW,EAAqB,CAC7B,SAAU,WACV,MAAOX,EACP,SAAU,0BACV,QACE,6GACAO,EACA,uBACAC,CACJ,CAAC,EAEH,GAAM,CAAE,OAAAP,CAAO,EAAIE,EAAcH,CAAQ,EAEnCY,EAAoE,CACxE,IAAKX,EAAO,OAAO,IACnB,MAAOA,EAAO,MAAM,MACpB,OAAQA,EAAO,OAAO,OACtB,IAAKS,CACP,EACA,GAAIH,KAAaK,EACf,OACEJ,EAAa,YAAY,IACzBI,EAASL,CAAkC,EAAE,YAAY,CAG/D,CAEA,IAAMM,EACJ,OAAON,GAAc,SAAWA,EAAU,QAAUA,EAEtD,OAAOC,EAAa,YAAY,IAAMK,EAAiB,YAAY,CACrE","names":["chainConfigs","defaultChainId","parseBaseArgs","args","chainId","defaultChainId","config","chainConfigs","InvalidArgumentError","ethAddress","isAddress","zeroAddress","mainnet","beraToken","zeroAddress","wBeraToken","mainnet","getHoneyToken","baseArgs","config","chainId","parseBaseArgs","isToken","args","token","compareTo","tokenAddress","isAddress","ethAddress","InvalidArgumentError","tokenMap","compareToAddress"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b}from"./chunk-NAXAZJJY.mjs";import{a as p,e as d}from"./chunk-5W7UKRHX.mjs";import{b as r,c as g,d as u}from"./chunk-CWKDFUFR.mjs";import{EnsoClient as h}from"@ensofinance/sdk";import{appConfig as k}from"@berachain/config/internal";var T=process.env.NODE_ENV!=="development"&&process.env.NODE_ENV!=="test";function U({useProxy:e=T,...n}={}){let{config:a}=p(n);return new h({baseURL:e?`${a.bex.aggregatorsProxyUrl}/enso/api/v1/`:void 0,apiKey:e?"":k.apiKeys.public.enso})}import{getChainId as w,getPublicClient as E}from"@wagmi/core";import{erc20Abi as P,formatUnits as v,isAddress as x}from"viem";function N({token:e,account:n,multicallAddress:a}){return d(e,"BERA")||d(e,"ETH")?{address:a,abi:b,functionName:"getEthBalance",args:[n]}:{address:e.address,abi:P,functionName:"balanceOf",args:[n]}}async function _({account:e,tokenList:n,wagmiConfig:a}){if(r(a,"config"),!e||!n)throw new Error("account or tokenList is not defined");u(e,"account");let C=n.filter(t=>x(t.address)),B=Object.groupBy(C,t=>t.chainId??w(a));return(await Promise.allSettled(Object.entries(B).map(async([t,o])=>{r(o,"tokens");let s=E(a,{chainId:Number(t)});g(s,`publicClient ${t}`),r(s.chain,"publicClient.chain"),r(s.chain.contracts,"publicClient.chain.contracts"),r(s.chain.contracts.multicall3,"publicClient.chain.contracts.multicall3");let{multicall3:c}=s.chain.contracts,f=typeof c=="string"?c:c.address;u(f,"multicall3Address");let A=o.map(i=>N({token:i,account:e,multicallAddress:f}));return(await s.multicall({contracts:A})).map((i,y)=>{let l=o[y];if(i.error)return{...l,balance:{raw:"0",formatted:"0"}};let m=v(i.result,l?.decimals||18);return{...l,balance:{raw:i.result.toString(),formatted:m.includes("e")?"0":m}}})}))).flatMap(t=>t.status==="fulfilled"?t.value:[])}export{U as a,N as b,_ as c};
|
|
2
|
+
//# sourceMappingURL=chunk-6K252BGM.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/actions/clients/getEnsoClient.ts","../src/actions/tokens/getWalletBalances.ts"],"sourcesContent":["import { EnsoClient } from \"@ensofinance/sdk\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nconst isProduction =\n process.env.NODE_ENV !== \"development\" && process.env.NODE_ENV !== \"test\";\n\nexport function getEnsoClient({\n useProxy = isProduction,\n ...args\n}: BeraJS.BaseFunctionArgs & { useProxy?: boolean } = {}) {\n const { config } = parseBaseArgs(args);\n return new EnsoClient({\n baseURL: useProxy\n ? `${config.bex.aggregatorsProxyUrl}/enso/api/v1/`\n : undefined,\n apiKey: useProxy\n ? // no API key since proxy has CORS for .berachain.com domains\n \"\"\n : appConfig.apiKeys.public.enso,\n });\n}\n","import { type Config, getChainId, getPublicClient } from \"@wagmi/core\";\nimport {\n type Address,\n type ContractFunctionParameters,\n erc20Abi,\n formatUnits,\n isAddress,\n} from \"viem\";\n\nimport { multicall3Abi } from \"../../abi/utils/multicall3\";\nimport {\n assertAddress,\n assertDefined,\n assertPublicClient,\n} from \"../../errors/assert\";\nimport type { BalanceToken, Token } from \"../../types/dex\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport interface GetWalletBalances {\n account: string | undefined;\n tokenList: Token[] | undefined;\n wagmiConfig: Config | undefined;\n}\n\n/**\n * Returns the payload for the balanceOf call for a given token and account.\n *\n * @internal\n * @returns\n */\nexport function getBalanceCall({\n token,\n account,\n multicallAddress,\n}: {\n token: Token;\n account: Address;\n multicallAddress: Address;\n}) {\n if (isToken(token, \"BERA\") || isToken(token, \"ETH\")) {\n return {\n address: multicallAddress,\n abi: multicall3Abi,\n functionName: \"getEthBalance\",\n args: [account],\n } as const satisfies ContractFunctionParameters<\n typeof multicall3Abi,\n \"view\",\n \"getEthBalance\"\n >;\n }\n return {\n address: token.address as Address,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n } as const satisfies ContractFunctionParameters<\n typeof erc20Abi,\n \"view\",\n \"balanceOf\"\n >;\n}\n\n/**\n * fetch the balances of a given wallet address\n */\nexport async function getWalletBalances({\n account,\n tokenList,\n wagmiConfig: config,\n}: GetWalletBalances): Promise<BalanceToken[] | undefined> {\n assertDefined(config, \"config\");\n if (!account || !tokenList)\n throw new Error(\"account or tokenList is not defined\");\n\n assertAddress(account, \"account\");\n\n const filteredTokenList = tokenList.filter((token) =>\n isAddress(token.address),\n );\n\n const tokensByChainId = Object.groupBy(\n filteredTokenList,\n (token) => token.chainId ?? getChainId(config),\n );\n\n const res = await Promise.allSettled(\n Object.entries(tokensByChainId).map(async ([chainId, tokens]) => {\n assertDefined(tokens, \"tokens\");\n const publicClient = getPublicClient(config, {\n chainId: Number(chainId),\n });\n assertPublicClient(publicClient, `publicClient ${chainId}`);\n assertDefined(publicClient.chain, \"publicClient.chain\");\n assertDefined(\n publicClient.chain.contracts,\n \"publicClient.chain.contracts\",\n );\n assertDefined(\n publicClient.chain.contracts.multicall3,\n \"publicClient.chain.contracts.multicall3\",\n );\n\n const { multicall3 } = publicClient.chain.contracts;\n\n const multicall3Address =\n typeof multicall3 === \"string\" ? multicall3 : multicall3.address;\n\n assertAddress(multicall3Address, \"multicall3Address\");\n\n const call = tokens.map((token: Token) =>\n getBalanceCall({\n token,\n account,\n multicallAddress: multicall3Address,\n }),\n );\n\n const result = await publicClient.multicall({\n contracts: call,\n });\n\n return result.map((item, index) => {\n const token = tokens[index];\n if (item.error) {\n return { ...token, balance: { raw: \"0\", formatted: \"0\" } };\n }\n const formattedBalance = formatUnits(\n item.result,\n token?.decimals || 18,\n );\n\n const resultBalanceToken: BalanceToken = {\n ...token,\n balance: {\n raw: item.result.toString(),\n // TODO: this was done 10 months ago, i'm not sure it's a good solution.\n formatted: formattedBalance.includes(\"e\") ? \"0\" : formattedBalance,\n },\n } satisfies BalanceToken;\n return resultBalanceToken;\n });\n }),\n );\n\n return res.flatMap((result) =>\n result.status === \"fulfilled\" ? result.value : [],\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/actions/clients/getEnsoClient.ts","../src/actions/tokens/getWalletBalances.ts"],"sourcesContent":["import { EnsoClient } from \"@ensofinance/sdk\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { parseBaseArgs } from \"../../utils/parseBaseArgs\";\n\nconst isProduction =\n process.env.NODE_ENV !== \"development\" && process.env.NODE_ENV !== \"test\";\n\nexport function getEnsoClient({\n useProxy = isProduction,\n ...args\n}: BeraJS.BaseFunctionArgs & { useProxy?: boolean } = {}) {\n const { config } = parseBaseArgs(args);\n return new EnsoClient({\n baseURL: useProxy\n ? `${config.bex.aggregatorsProxyUrl}/enso/api/v1/`\n : undefined,\n apiKey: useProxy\n ? // no API key since proxy has CORS for .berachain.com domains\n \"\"\n : appConfig.apiKeys.public.enso,\n });\n}\n","import { type Config, getChainId, getPublicClient } from \"@wagmi/core\";\nimport {\n type Address,\n type ContractFunctionParameters,\n erc20Abi,\n formatUnits,\n isAddress,\n} from \"viem\";\n\nimport { multicall3Abi } from \"../../abi/utils/multicall3\";\nimport {\n assertAddress,\n assertDefined,\n assertPublicClient,\n} from \"../../errors/assert\";\nimport type { BalanceToken, Token } from \"../../types/dex\";\nimport { isToken } from \"../../utils/tokens\";\n\nexport interface GetWalletBalances {\n account: string | undefined;\n tokenList: Token[] | undefined;\n wagmiConfig: Config | undefined;\n}\n\n/**\n * Returns the payload for the balanceOf call for a given token and account.\n *\n * @internal\n * @returns\n */\nexport function getBalanceCall({\n token,\n account,\n multicallAddress,\n}: {\n token: Token;\n account: Address;\n multicallAddress: Address;\n}) {\n if (isToken(token, \"BERA\") || isToken(token, \"ETH\")) {\n return {\n address: multicallAddress,\n abi: multicall3Abi,\n functionName: \"getEthBalance\",\n args: [account],\n } as const satisfies ContractFunctionParameters<\n typeof multicall3Abi,\n \"view\",\n \"getEthBalance\"\n >;\n }\n return {\n address: token.address as Address,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n } as const satisfies ContractFunctionParameters<\n typeof erc20Abi,\n \"view\",\n \"balanceOf\"\n >;\n}\n\n/**\n * fetch the balances of a given wallet address\n */\nexport async function getWalletBalances({\n account,\n tokenList,\n wagmiConfig: config,\n}: GetWalletBalances): Promise<BalanceToken[] | undefined> {\n assertDefined(config, \"config\");\n if (!account || !tokenList)\n throw new Error(\"account or tokenList is not defined\");\n\n assertAddress(account, \"account\");\n\n const filteredTokenList = tokenList.filter((token) =>\n isAddress(token.address),\n );\n\n const tokensByChainId = Object.groupBy(\n filteredTokenList,\n (token) => token.chainId ?? getChainId(config),\n );\n\n const res = await Promise.allSettled(\n Object.entries(tokensByChainId).map(async ([chainId, tokens]) => {\n assertDefined(tokens, \"tokens\");\n const publicClient = getPublicClient(config, {\n chainId: Number(chainId),\n });\n assertPublicClient(publicClient, `publicClient ${chainId}`);\n assertDefined(publicClient.chain, \"publicClient.chain\");\n assertDefined(\n publicClient.chain.contracts,\n \"publicClient.chain.contracts\",\n );\n assertDefined(\n publicClient.chain.contracts.multicall3,\n \"publicClient.chain.contracts.multicall3\",\n );\n\n const { multicall3 } = publicClient.chain.contracts;\n\n const multicall3Address =\n typeof multicall3 === \"string\" ? multicall3 : multicall3.address;\n\n assertAddress(multicall3Address, \"multicall3Address\");\n\n const call = tokens.map((token: Token) =>\n getBalanceCall({\n token,\n account,\n multicallAddress: multicall3Address,\n }),\n );\n\n const result = await publicClient.multicall({\n contracts: call,\n });\n\n return result.map((item, index) => {\n const token = tokens[index];\n if (item.error) {\n return { ...token, balance: { raw: \"0\", formatted: \"0\" } };\n }\n const formattedBalance = formatUnits(\n item.result,\n token?.decimals || 18,\n );\n\n const resultBalanceToken: BalanceToken = {\n ...token,\n balance: {\n raw: item.result.toString(),\n // TODO: this was done 10 months ago, i'm not sure it's a good solution.\n formatted: formattedBalance.includes(\"e\") ? \"0\" : formattedBalance,\n },\n } satisfies BalanceToken;\n return resultBalanceToken;\n });\n }),\n );\n\n return res.flatMap((result) =>\n result.status === \"fulfilled\" ? result.value : [],\n );\n}\n"],"mappings":"gJAAA,OAAS,cAAAA,MAAkB,mBAE3B,OAAS,aAAAC,MAAiB,6BAI1B,IAAMC,EACJ,QAAQ,IAAI,WAAa,eAAiB,QAAQ,IAAI,WAAa,OAE9D,SAASC,EAAc,CAC5B,SAAAC,EAAWF,EACX,GAAGG,CACL,EAAsD,CAAC,EAAG,CACxD,GAAM,CAAE,OAAAC,CAAO,EAAIC,EAAcF,CAAI,EACrC,OAAO,IAAIG,EAAW,CACpB,QAASJ,EACL,GAAGE,EAAO,IAAI,mBAAmB,gBACjC,OACJ,OAAQF,EAEJ,GACAK,EAAU,QAAQ,OAAO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MC,EAAON,EAAO,IAAKhB,GACvBD,EAAe,CACb,MAAAC,EACA,QAAAC,EACA,iBAAkBoB,CACpB,CAAC,CACH,EAMA,OAJe,MAAMJ,EAAa,UAAU,CAC1C,UAAWK,CACb,CAAC,GAEa,IAAI,CAACC,EAAMC,IAAU,CACjC,IAAMxB,EAAQgB,EAAOQ,CAAK,EAC1B,GAAID,EAAK,MACP,MAAO,CAAE,GAAGvB,EAAO,QAAS,CAAE,IAAK,IAAK,UAAW,GAAI,CAAE,EAE3D,IAAMyB,EAAmBC,EACvBH,EAAK,OACLvB,GAAO,UAAY,EACrB,EAUA,MARyC,CACvC,GAAGA,EACH,QAAS,CACP,IAAKuB,EAAK,OAAO,SAAS,EAE1B,UAAWE,EAAiB,SAAS,GAAG,EAAI,IAAMA,CACpD,CACF,CAEF,CAAC,CACH,CAAC,CACH,GAEW,QAASE,GAClBA,EAAO,SAAW,YAAcA,EAAO,MAAQ,CAAC,CAClD,CACF","names":["EnsoClient","appConfig","isProduction","getEnsoClient","useProxy","args","config","parseBaseArgs","EnsoClient","appConfig","getChainId","getPublicClient","erc20Abi","formatUnits","isAddress","getBalanceCall","token","account","multicallAddress","isToken","multicall3Abi","erc20Abi","getWalletBalances","tokenList","config","assertDefined","assertAddress","filteredTokenList","isAddress","tokensByChainId","getChainId","chainId","tokens","publicClient","getPublicClient","assertPublicClient","multicall3","multicall3Address","call","item","index","formattedBalance","formatUnits","result"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as a,f as i,g as p,h as s}from"./chunk-RSDCKN4Q.mjs";import{BaseError as u}from"viem";function w({cause:e,level:t}){if(e instanceof u){let n=a({error:e,revertIfUnknown:!1});if(n.isRequestError&&n.rootCause instanceof u&&"url"in n.rootCause&&typeof n.rootCause.url=="string")return new p({cause:n.rootCause,response:void 0,endpoint:{url:n.rootCause.url,type:"rpc"},level:t})}return e instanceof i?e:new i({cause:e,level:t})}import{isAddress as m}from"viem";function c(e){return e!=null}function x({value:e,property:t,fn:r}){let n=r(e);if(!n.isValid)throw new s({property:t,value:e,expected:n.expectedType})}function o({value:e,property:t,fn:r}){x({value:e,property:t,fn:n=>{let l=c(n),{isValid:v,expectedType:E}=r(n);return{expectedType:E,isValid:l&&v}}})}function y(e,t){o({value:e,property:t,fn:r=>({expectedType:"defined",isValid:c(r)})})}function A(e,t="publicClient"){y(e,t)}function D(e,t){o({value:e,property:t,fn:r=>({expectedType:"Address",isValid:typeof r=="string"&&m(r)})})}function K(e,t){if(!(typeof e=="bigint"?e>0n:Number(e)>0))throw new s({property:t,value:e,expected:"positive amount"})}function M(e,t){o({value:e,property:t,fn:r=>({expectedType:"number",isValid:(typeof r=="string"||typeof r=="number")&&Number(r)>0})})}function f(){let e={};return{emit(t,...r){for(let n of e[t]||[])n(...r)},events:e,on(t,r){return e[t]||(e[t]=[]),e[t].push(r),()=>{e[t]=e[t]?.filter(n=>r!==n)}}}}var d=f(),_={captureException(e){let t={exception:e,timestamp:Date.now()};d.emit("exception",t)},on(...e){return d.on(...e)}};export{w as a,y as b,A as c,D as d,K as e,M as f,_ as g};
|
|
2
|
+
//# sourceMappingURL=chunk-CWKDFUFR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors/initBeraError.ts","../src/errors/assert.ts","../src/utils/createEmitter.ts","../src/errors/BeraMonitoring.ts"],"sourcesContent":["import { BaseError } from \"viem\";\n\nimport { BeraError } from \"./BeraError\";\nimport { parseViemError } from \"./parseViemError\";\nimport { RequestError } from \"./RequestError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * The preferred way to normalize any unknown error into a BeraError.\n *\n * This function acts as a smart factory that picks the correct BeraError subclass:\n *\n * 1. If `cause` is already a `BeraError`, returns it as-is (no double-wrapping).\n * 2. If `cause` is a viem `BaseError`, runs `parseViemError` to classify it:\n * - If the root cause is an `HttpRequestError` (RPC transport failure), wraps it\n * in a `RequestError` with the endpoint URL extracted from the error.\n * 3. Otherwise, wraps in a new `BeraError` — which triggers the automatic reason\n * detection pipeline in the BeraError constructor (parseViemError → errorMap → displayMessage).\n *\n * **Use this instead of `new BeraError({ cause })` when you don't know the error type.**\n * It ensures RequestErrors are correctly classified (important for Sentry filtering\n * and fingerprinting — RequestErrors are skipped from transaction error grouping).\n *\n * @example\n * ```ts\n * try {\n * await someOperation();\n * } catch (error) {\n * // Normalizes to the right subclass, reason auto-detected\n * throw initBeraError({ cause: error });\n * }\n * ```\n *\n * @example\n * ```ts\n * // Reporting to Sentry without rethrowing\n * catch (error) {\n * captureException(initBeraError({ cause: error }));\n * }\n * ```\n */\nexport function initBeraError({\n cause: error,\n level,\n}: {\n cause: unknown;\n /**\n * The severity level of the error, only used if the error is not a BeraError.\n */\n level?: SeverityLevel;\n}): BeraError {\n // ── Step 1: Check if it's a viem BaseError that wraps an RPC transport failure ──\n // parseViemError with revertIfUnknown=false won't throw — it returns { reason: undefined }\n // if the error chain doesn't match any known type.\n if (error instanceof BaseError) {\n const parsed = parseViemError({\n error,\n revertIfUnknown: false,\n });\n if (\n parsed.isRequestError &&\n parsed.rootCause instanceof BaseError &&\n \"url\" in parsed.rootCause &&\n typeof parsed.rootCause.url === \"string\"\n ) {\n // RPC transport failure (e.g. HTTP 502 from the RPC endpoint).\n // Wrapping in RequestError gives it proper endpoint tagging and level=\"warning\".\n return new RequestError({\n cause: parsed.rootCause,\n response: undefined,\n endpoint: {\n url: parsed.rootCause.url as string,\n type: \"rpc\",\n },\n level,\n });\n }\n }\n\n // ── Step 2: Return as-is if already a BeraError, otherwise wrap ──────────\n // The BeraError constructor will run automatic reason detection on the cause.\n const err =\n error instanceof BeraError\n ? error\n : new BeraError({\n cause: error,\n level,\n });\n\n return err;\n}\n","import type { GetPublicClientReturnType } from \"@wagmi/core\";\nimport { type Address, isAddress, type PublicClient } from \"viem\";\n\nimport { InvalidArgumentError } from \"./InvalidArgumentError\";\n\nfunction _isDefined<T>(value: T): value is NonNullable<T> {\n return value !== undefined && value !== null;\n}\n\ntype _AssertFn<T> = (value: T) => { expectedType: string; isValid: boolean };\n\n/**\n * Internal assertion function.\n * @throws An InvalidArgumentError if the value is not valid.\n */\nfunction _assert<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: _AssertFn<T>;\n}) {\n const result = fn(value);\n if (!result.isValid) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: result.expectedType,\n });\n }\n}\n\nfunction _assertDefined<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: (value: T) => { expectedType: string; isValid: boolean };\n}) {\n _assert({\n value,\n property,\n fn: (value) => {\n const isDefined = _isDefined(value);\n const { isValid, expectedType } = fn(value);\n return {\n expectedType,\n isValid: isDefined && isValid,\n };\n },\n });\n}\n\n/**\n * Asserts that a value is defined.\n * @throws An InvalidArgumentError if the value is undefined or null.\n */\nexport function assertDefined<T>(\n /**\n * The value to assert.\n */\n value: T,\n /**\n * The property name.\n */\n property: string,\n): asserts value is NonNullable<T> {\n _assertDefined({\n value,\n property,\n fn: (value) => ({ expectedType: \"defined\", isValid: _isDefined(value) }),\n });\n}\n\n/**\n * Asserts that a value is a PublicClient.\n * @throws An InvalidArgumentError if the value is undefined or not a PublicClient.\n */\nexport function assertPublicClient(\n /**\n * The value to assert.\n */\n value: // it's important to have both types here because it helps with typescript build performance\n PublicClient | GetPublicClientReturnType | undefined,\n /**\n * The property name.\n */\n property: string = \"publicClient\",\n): asserts value is PublicClient {\n // there's no current way to check if a value is a PublicClient, so we just assert it's defined and `value: PublicClient` will do the rest\n assertDefined(value, property);\n}\n\n/**\n * Asserts that a value is an address (20 bytes).\n * @throws An InvalidArgumentError if the value is undefined, null, not a string, or not an address.\n */\nexport function assertAddress(\n /**\n * The value to assert.\n */\n value: string | undefined | null,\n /**\n * The property name.\n */\n property: string,\n): asserts value is Address {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"Address\",\n isValid: typeof value === \"string\" && isAddress(value),\n }),\n });\n}\n\n/**\n * Asserts that a value is positive (> 0).\n * @throws An InvalidArgumentError if the value is not positive.\n */\nexport function assertPositive(\n value: string | bigint | number,\n property: string,\n): void {\n const isPositive = typeof value === \"bigint\" ? value > 0n : Number(value) > 0;\n if (!isPositive) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: \"positive amount\",\n });\n }\n}\n\n/**\n * Asserts that a value is a number greater than 0.\n * @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.\n */\nexport function assertAmount(\n /**\n * The value to assert.\n */\n value: unknown,\n /**\n * The property name.\n */\n property: string,\n): asserts value is string | number {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"number\",\n isValid:\n (typeof value === \"string\" || typeof value === \"number\") &&\n Number(value) > 0,\n }),\n });\n}\n","interface EventsMap {\n [event: string]: any;\n}\n\ninterface DefaultEvents extends EventsMap {\n [event: string]: (...args: any) => void;\n}\n\nexport type Unsubscribe = () => void;\n\nexport interface Emitter<Events extends EventsMap = DefaultEvents> {\n /**\n * Calls each of the listeners registered for a given event.\n *\n * ```js\n * ee.emit('tick', tickType, tickDuration)\n * ```\n *\n * @param event The event name.\n * @param args The arguments for listeners.\n */\n emit<K extends keyof Events>(event: K, ...args: Parameters<Events[K]>): void;\n\n /**\n * Add a listener for a given event.\n *\n * ```js\n * const unbind = ee.on('tick', (tickType, tickDuration) => {\n * count += 1\n * })\n *\n * disable () {\n * unbind()\n * }\n * ```\n *\n * @param event The event name.\n * @param cb The listener function.\n * @returns Unbind listener from event.\n */\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n events: Partial<{ [E in keyof Events]: Events[E][] }>;\n}\n\n/**\n * An interface for mixins that expose the `on` function (without the emitter\n * bound to `this`)\n *\n * ```js\n * import { createEmitter } from '~utils/createEmitter'\n *\n * class Ticker implements EmitterMixin<Events> {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n */\nexport interface EmitterMixin<Events extends EventsMap = DefaultEvents> {\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n}\n\n/**\n * Create event emitter.\n *\n * ```js\n * import { createEmitter } from './createEmitter'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n *\n * Inspired by {@link https://github.com/ai/nanoevents}\n */\nexport function createEmitter<\n Events extends EventsMap = DefaultEvents,\n>(): Emitter<Events> {\n /**\n * Event names in keys and arrays with listeners in values.\n *\n * ```js\n * emitter1.events = emitter2.events\n * emitter2.events = { }\n * ```\n */\n const events: Partial<{ [E in keyof Events]: Events[E][] }> = {};\n\n return {\n emit(event, ...args) {\n for (const callback of events[event] || []) {\n callback(...args);\n }\n },\n events,\n on(event, cb) {\n if (!events[event]) {\n events[event] = [];\n }\n\n events[event].push(cb);\n\n return () => {\n events[event] = events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createEmitter, type EmitterMixin } from \"../utils/createEmitter\";\nimport type { BeraError } from \"./BeraError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * Context passed alongside captured exceptions.\n * Mirrors the subset of Sentry's CaptureContext that berajs actually uses.\n */\nexport interface CaptureContext {\n level: SeverityLevel;\n extra?: Record<string, unknown>;\n tags?: Record<string, string | number | boolean | null | undefined>;\n fingerprint?: string[];\n data?: Record<string, unknown>;\n}\n\nexport interface ErrorEvent {\n exception: BeraError;\n timestamp: number;\n}\n\nconst _emitter = createEmitter<{ exception: (event: ErrorEvent) => void }>();\n\n/**\n * A generic error reporter for berajs.\n *\n * Instead of calling Sentry.captureException directly, berajs calls\n * `BeraMonitoring.captureException()`. Consumer apps subscribe via `.on()` and\n * forward events to their monitoring provider (Sentry, Datadog, etc.).\n *\n * @example\n * ```ts\n * // In berajs code:\n * import { BeraMonitoring } from \"./BeraMonitoring\";\n * BeraMonitoring.captureExceptionException(error);\n *\n * // In app instrumentation:\n * import { BeraMonitoring } from \"@berachain/berajs/errors\";\n * BeraMonitoring.on((event) => {\n * if (event.type === \"exception\") {\n * Sentry.captureException(event.exception);\n * }\n * });\n * ```\n */\nexport const BeraMonitoring: {\n captureException: (exception: BeraError) => void;\n} & EmitterMixin<{ exception: (event: ErrorEvent) => void }> = {\n /**\n * Capture an exception. Notifies all subscribers.\n */\n captureException(exception: BeraError): void {\n const event: ErrorEvent = {\n exception,\n timestamp: Date.now(),\n };\n _emitter.emit(\"exception\", event);\n },\n /**\n * Subscribe to error events.\n * @returns An unsubscribe function.\n */\n on(...args) {\n return _emitter.on(...args);\n },\n};\n"],"mappings":";;;;;;;;AAAA,SAAS,iBAAiB;AAyCnB,SAAS,cAAc;AAAA,EAC5B,OAAO;AAAA,EACP;AACF,GAMc;AAIZ,MAAI,iBAAiB,WAAW;AAC9B,UAAM,SAAS,eAAe;AAAA,MAC5B;AAAA,MACA,iBAAiB;AAAA,IACnB,CAAC;AACD,QACE,OAAO,kBACP,OAAO,qBAAqB,aAC5B,SAAS,OAAO,aAChB,OAAO,OAAO,UAAU,QAAQ,UAChC;AAGA,aAAO,IAAI,aAAa;AAAA,QACtB,OAAO,OAAO;AAAA,QACd,UAAU;AAAA,QACV,UAAU;AAAA,UACR,KAAK,OAAO,UAAU;AAAA,UACtB,MAAM;AAAA,QACR;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAIA,QAAM,MACJ,iBAAiB,YACb,QACA,IAAI,UAAU;AAAA,IACZ,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AAEP,SAAO;AACT;;;ACzFA,SAAuB,iBAAoC;AAI3D,SAAS,WAAc,OAAmC;AACxD,SAAO,UAAU,UAAa,UAAU;AAC1C;AAQA,SAAS,QAAW;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,SAAS,GAAG,KAAK;AACvB,MAAI,CAAC,OAAO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,IAAI;AAAA,IACpB;AAAA,EACF,CAAC;AACH;;;AC1EO,SAAS,gBAEK;AASnB,QAAM,SAAwD,CAAC;AAE/D,SAAO;AAAA,IACL,KAAK,UAAU,MAAM;AACnB,iBAAW,YAAY,OAAO,KAAK,KAAK,CAAC,GAAG;AAC1C,iBAAS,GAAG,IAAI;AAAA,MAClB;AAAA,IACF;AAAA,IACA;AAAA,IACA,GAAG,OAAO,IAAI;AACZ,UAAI,CAAC,OAAO,KAAK,GAAG;AAClB,eAAO,KAAK,IAAI,CAAC;AAAA,MACnB;AAEA,aAAO,KAAK,EAAE,KAAK,EAAE;AAErB,aAAO,MAAM;AACX,eAAO,KAAK,IAAI,OAAO,KAAK,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC;AAAA,MACvD;AAAA,IACF;AAAA,EACF;AACF;;;ACpGA,IAAM,WAAW,cAA0D;AAwBpE,IAAM,iBAEkD;AAAA;AAAA;AAAA;AAAA,EAI7D,iBAAiB,WAA4B;AAC3C,UAAM,QAAoB;AAAA,MACxB;AAAA,MACA,WAAW,KAAK,IAAI;AAAA,IACtB;AACA,aAAS,KAAK,aAAa,KAAK;AAAA,EAClC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MAAM;AACV,WAAO,SAAS,GAAG,GAAG,IAAI;AAAA,EAC5B;AACF;","names":["value"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors/initBeraError.ts","../src/errors/assert.ts","../src/utils/createEmitter.ts","../src/errors/BeraMonitoring.ts"],"sourcesContent":["import { BaseError } from \"viem\";\n\nimport { BeraError } from \"./BeraError\";\nimport { parseViemError } from \"./parseViemError\";\nimport { RequestError } from \"./RequestError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * The preferred way to normalize any unknown error into a BeraError.\n *\n * This function acts as a smart factory that picks the correct BeraError subclass:\n *\n * 1. If `cause` is already a `BeraError`, returns it as-is (no double-wrapping).\n * 2. If `cause` is a viem `BaseError`, runs `parseViemError` to classify it:\n * - If the root cause is an `HttpRequestError` (RPC transport failure), wraps it\n * in a `RequestError` with the endpoint URL extracted from the error.\n * 3. Otherwise, wraps in a new `BeraError` — which triggers the automatic reason\n * detection pipeline in the BeraError constructor (parseViemError → errorMap → displayMessage).\n *\n * **Use this instead of `new BeraError({ cause })` when you don't know the error type.**\n * It ensures RequestErrors are correctly classified (important for Sentry filtering\n * and fingerprinting — RequestErrors are skipped from transaction error grouping).\n *\n * @example\n * ```ts\n * try {\n * await someOperation();\n * } catch (error) {\n * // Normalizes to the right subclass, reason auto-detected\n * throw initBeraError({ cause: error });\n * }\n * ```\n *\n * @example\n * ```ts\n * // Reporting to Sentry without rethrowing\n * catch (error) {\n * captureException(initBeraError({ cause: error }));\n * }\n * ```\n */\nexport function initBeraError({\n cause: error,\n level,\n}: {\n cause: unknown;\n /**\n * The severity level of the error, only used if the error is not a BeraError.\n */\n level?: SeverityLevel;\n}): BeraError {\n // ── Step 1: Check if it's a viem BaseError that wraps an RPC transport failure ──\n // parseViemError with revertIfUnknown=false won't throw — it returns { reason: undefined }\n // if the error chain doesn't match any known type.\n if (error instanceof BaseError) {\n const parsed = parseViemError({\n error,\n revertIfUnknown: false,\n });\n if (\n parsed.isRequestError &&\n parsed.rootCause instanceof BaseError &&\n \"url\" in parsed.rootCause &&\n typeof parsed.rootCause.url === \"string\"\n ) {\n // RPC transport failure (e.g. HTTP 502 from the RPC endpoint).\n // Wrapping in RequestError gives it proper endpoint tagging and level=\"warning\".\n return new RequestError({\n cause: parsed.rootCause,\n response: undefined,\n endpoint: {\n url: parsed.rootCause.url as string,\n type: \"rpc\",\n },\n level,\n });\n }\n }\n\n // ── Step 2: Return as-is if already a BeraError, otherwise wrap ──────────\n // The BeraError constructor will run automatic reason detection on the cause.\n const err =\n error instanceof BeraError\n ? error\n : new BeraError({\n cause: error,\n level,\n });\n\n return err;\n}\n","import type { GetPublicClientReturnType } from \"@wagmi/core\";\nimport { type Address, isAddress, type PublicClient } from \"viem\";\n\nimport { InvalidArgumentError } from \"./InvalidArgumentError\";\n\nfunction _isDefined<T>(value: T): value is NonNullable<T> {\n return value !== undefined && value !== null;\n}\n\ntype _AssertFn<T> = (value: T) => { expectedType: string; isValid: boolean };\n\n/**\n * Internal assertion function.\n * @throws An InvalidArgumentError if the value is not valid.\n */\nfunction _assert<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: _AssertFn<T>;\n}) {\n const result = fn(value);\n if (!result.isValid) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: result.expectedType,\n });\n }\n}\n\nfunction _assertDefined<T>({\n value,\n property,\n fn,\n}: {\n value: T;\n property: string;\n fn: (value: T) => { expectedType: string; isValid: boolean };\n}) {\n _assert({\n value,\n property,\n fn: (value) => {\n const isDefined = _isDefined(value);\n const { isValid, expectedType } = fn(value);\n return {\n expectedType,\n isValid: isDefined && isValid,\n };\n },\n });\n}\n\n/**\n * Asserts that a value is defined.\n * @throws An InvalidArgumentError if the value is undefined or null.\n */\nexport function assertDefined<T>(\n /**\n * The value to assert.\n */\n value: T,\n /**\n * The property name.\n */\n property: string,\n): asserts value is NonNullable<T> {\n _assertDefined({\n value,\n property,\n fn: (value) => ({ expectedType: \"defined\", isValid: _isDefined(value) }),\n });\n}\n\n/**\n * Asserts that a value is a PublicClient.\n * @throws An InvalidArgumentError if the value is undefined or not a PublicClient.\n */\nexport function assertPublicClient(\n /**\n * The value to assert.\n */\n value: // it's important to have both types here because it helps with typescript build performance\n PublicClient | GetPublicClientReturnType | undefined,\n /**\n * The property name.\n */\n property: string = \"publicClient\",\n): asserts value is PublicClient {\n // there's no current way to check if a value is a PublicClient, so we just assert it's defined and `value: PublicClient` will do the rest\n assertDefined(value, property);\n}\n\n/**\n * Asserts that a value is an address (20 bytes).\n * @throws An InvalidArgumentError if the value is undefined, null, not a string, or not an address.\n */\nexport function assertAddress(\n /**\n * The value to assert.\n */\n value: string | undefined | null,\n /**\n * The property name.\n */\n property: string,\n): asserts value is Address {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"Address\",\n isValid: typeof value === \"string\" && isAddress(value),\n }),\n });\n}\n\n/**\n * Asserts that a value is positive (> 0).\n * @throws An InvalidArgumentError if the value is not positive.\n */\nexport function assertPositive(\n value: string | bigint | number,\n property: string,\n): void {\n const isPositive = typeof value === \"bigint\" ? value > 0n : Number(value) > 0;\n if (!isPositive) {\n throw new InvalidArgumentError({\n property,\n value,\n expected: \"positive amount\",\n });\n }\n}\n\n/**\n * Asserts that a value is a number greater than 0.\n * @throws An InvalidArgumentError if the value is undefined, null, not a string or number, or not a number greater than 0.\n */\nexport function assertAmount(\n /**\n * The value to assert.\n */\n value: unknown,\n /**\n * The property name.\n */\n property: string,\n): asserts value is string | number {\n _assertDefined({\n value,\n property,\n fn: (value) => ({\n expectedType: \"number\",\n isValid:\n (typeof value === \"string\" || typeof value === \"number\") &&\n Number(value) > 0,\n }),\n });\n}\n","interface EventsMap {\n [event: string]: any;\n}\n\ninterface DefaultEvents extends EventsMap {\n [event: string]: (...args: any) => void;\n}\n\nexport type Unsubscribe = () => void;\n\nexport interface Emitter<Events extends EventsMap = DefaultEvents> {\n /**\n * Calls each of the listeners registered for a given event.\n *\n * ```js\n * ee.emit('tick', tickType, tickDuration)\n * ```\n *\n * @param event The event name.\n * @param args The arguments for listeners.\n */\n emit<K extends keyof Events>(event: K, ...args: Parameters<Events[K]>): void;\n\n /**\n * Add a listener for a given event.\n *\n * ```js\n * const unbind = ee.on('tick', (tickType, tickDuration) => {\n * count += 1\n * })\n *\n * disable () {\n * unbind()\n * }\n * ```\n *\n * @param event The event name.\n * @param cb The listener function.\n * @returns Unbind listener from event.\n */\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n events: Partial<{ [E in keyof Events]: Events[E][] }>;\n}\n\n/**\n * An interface for mixins that expose the `on` function (without the emitter\n * bound to `this`)\n *\n * ```js\n * import { createEmitter } from '~utils/createEmitter'\n *\n * class Ticker implements EmitterMixin<Events> {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n */\nexport interface EmitterMixin<Events extends EventsMap = DefaultEvents> {\n on<K extends keyof Events>(event: K, cb: Events[K]): Unsubscribe;\n}\n\n/**\n * Create event emitter.\n *\n * ```js\n * import { createEmitter } from './createEmitter'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createEmitter()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n *\n * Inspired by {@link https://github.com/ai/nanoevents}\n */\nexport function createEmitter<\n Events extends EventsMap = DefaultEvents,\n>(): Emitter<Events> {\n /**\n * Event names in keys and arrays with listeners in values.\n *\n * ```js\n * emitter1.events = emitter2.events\n * emitter2.events = { }\n * ```\n */\n const events: Partial<{ [E in keyof Events]: Events[E][] }> = {};\n\n return {\n emit(event, ...args) {\n for (const callback of events[event] || []) {\n callback(...args);\n }\n },\n events,\n on(event, cb) {\n if (!events[event]) {\n events[event] = [];\n }\n\n events[event].push(cb);\n\n return () => {\n events[event] = events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { createEmitter, type EmitterMixin } from \"../utils/createEmitter\";\nimport type { BeraError } from \"./BeraError\";\nimport type { SeverityLevel } from \"./severity\";\n\n/**\n * Context passed alongside captured exceptions.\n * Mirrors the subset of Sentry's CaptureContext that berajs actually uses.\n */\nexport interface CaptureContext {\n level: SeverityLevel;\n extra?: Record<string, unknown>;\n tags?: Record<string, string | number | boolean | null | undefined>;\n fingerprint?: string[];\n data?: Record<string, unknown>;\n}\n\nexport interface ErrorEvent {\n exception: BeraError;\n timestamp: number;\n}\n\nconst _emitter = createEmitter<{ exception: (event: ErrorEvent) => void }>();\n\n/**\n * A generic error reporter for berajs.\n *\n * Instead of calling Sentry.captureException directly, berajs calls\n * `BeraMonitoring.captureException()`. Consumer apps subscribe via `.on()` and\n * forward events to their monitoring provider (Sentry, Datadog, etc.).\n *\n * @example\n * ```ts\n * // In berajs code:\n * import { BeraMonitoring } from \"./BeraMonitoring\";\n * BeraMonitoring.captureExceptionException(error);\n *\n * // In app instrumentation:\n * import { BeraMonitoring } from \"@berachain/berajs/errors\";\n * BeraMonitoring.on((event) => {\n * if (event.type === \"exception\") {\n * Sentry.captureException(event.exception);\n * }\n * });\n * ```\n */\nexport const BeraMonitoring: {\n captureException: (exception: BeraError) => void;\n} & EmitterMixin<{ exception: (event: ErrorEvent) => void }> = {\n /**\n * Capture an exception. Notifies all subscribers.\n */\n captureException(exception: BeraError): void {\n const event: ErrorEvent = {\n exception,\n timestamp: Date.now(),\n };\n _emitter.emit(\"exception\", event);\n },\n /**\n * Subscribe to error events.\n * @returns An unsubscribe function.\n */\n on(...args) {\n return _emitter.on(...args);\n },\n};\n"],"mappings":"8DAAA,OAAS,aAAAA,MAAiB,OAyCnB,SAASC,EAAc,CAC5B,MAAOC,EACP,MAAAC,CACF,EAMc,CAIZ,GAAID,aAAiBE,EAAW,CAC9B,IAAMC,EAASC,EAAe,CAC5B,MAAAJ,EACA,gBAAiB,EACnB,CAAC,EACD,GACEG,EAAO,gBACPA,EAAO,qBAAqBD,GAC5B,QAASC,EAAO,WAChB,OAAOA,EAAO,UAAU,KAAQ,SAIhC,OAAO,IAAIE,EAAa,CACtB,MAAOF,EAAO,UACd,SAAU,OACV,SAAU,CACR,IAAKA,EAAO,UAAU,IACtB,KAAM,KACR,EACA,MAAAF,CACF,CAAC,CAEL,CAYA,OAPED,aAAiBM,EACbN,EACA,IAAIM,EAAU,CACZ,MAAON,EACP,MAAAC,CACF,CAAC,CAGT,CCzFA,OAAuB,aAAAM,MAAoC,OAI3D,SAASC,EAAcC,EAAmC,CACxD,OAA8BA,GAAU,IAC1C,CAQA,SAASC,EAAW,CAClB,MAAAD,EACA,SAAAE,EACA,GAAAC,CACF,EAIG,CACD,IAAMC,EAASD,EAAGH,CAAK,EACvB,GAAI,CAACI,EAAO,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AAWC,KAAYH,EAAOC,CAAK,GAAK,CAAC,EACvCE,EAAS,GAAGD,CAAI,CAEpB,EACA,OAAAF,EACA,GAAGC,EAAOG,EAAI,CACZ,OAAKJ,EAAOC,CAAK,IACfD,EAAOC,CAAK,EAAI,CAAC,GAGnBD,EAAOC,CAAK,EAAE,KAAKG,CAAE,EAEd,IAAM,CACXJ,EAAOC,CAAK,EAAID,EAAOC,CAAK,GAAG,OAAQI,GAAMD,IAAOC,CAAC,CACvD,CACF,CACF,CACF,CCpGA,IAAMC,EAAWC,EAA0D,EAwB9DC,EAEkD,CAI7D,iBAAiBC,EAA4B,CAC3C,IAAMC,EAAoB,CACxB,UAAAD,EACA,UAAW,KAAK,IAAI,CACtB,EACAH,EAAS,KAAK,YAAaI,CAAK,CAClC,EAKA,MAAMC,EAAM,CACV,OAAOL,EAAS,GAAG,GAAGK,CAAI,CAC5B,CACF","names":["BaseError","initBeraError","error","level","BaseError","parsed","parseViemError","RequestError","BeraError","isAddress","_isDefined","value","_assert","property","fn","result","InvalidArgumentError","_assertDefined","isDefined","isValid","expectedType","assertDefined","assertPublicClient","assertAddress","isAddress","assertPositive","assertAmount","createEmitter","events","event","args","callback","cb","i","_emitter","createEmitter","BeraMonitoring","exception","event","args"]}
|
|
@@ -0,0 +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||{}),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","Ho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AC3BA,CAAAA,CAAA,yBAAA,CAA4B,wBAAA,CAC5BA,CAAAA,CAAA,uBAAA,CAA0B,yBAAA,CAC1BA,CAAAA,CAAA,gCAAA,CAAmC,+BAAA,CACnCA,CAAAA,CAAA,0BAAA,CAA6B,yBAAA,CAE7BA,CAAAA,CAAA,YAAA,CAAe,YAAA,CACfA,CAAAA,CAAA,cAAA,CAAiB,gBAAA,CACjBA,CAAAA,CAAA,cAAA,CAAiB,cAAA,CACjBA,CAAAA,CAAA,oBAAA,CAAuB,oBAAA,CAGvBA,CAAAA,CAAA,yCAAA,CAA4C,2CAAA,CAC5CA,CAAAA,CAAA,wCAAA,CAA2C,0CAAA,CAC3CA,CAAAA,CAAA,oBAAA,CAAuB,sBAAA,CACvBA,CAAAA,CAAA,sBAAA,CAAyB,wBAAA,CACzBA,CAAAA,CAAA,iBAAA,CAAoB,mBAAA,CACpBA,CAAAA,CAAA,mBAAA,CAAsB,qBAAA,CAGtBA,CAAAA,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/pong/coding/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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var e={isGovernanceEnabled:!0,enableEip5792:!1,proxyAggregatorsThroughVercel:!1,isEmbeddedWalletsEnabled:!0,sponsorGas:!1,enableSimulateCalls:!1,isBendVaultDataHourly:!0,isBendLoopingEnabled:!1,isMultiChainZapBendEnabled:!1,isZapStakeBeraEnabled:!1,mockValidatorOperator:!1,mockValidatorRewardAllocator:!1,isBgtPolRewardToken:!0,mockRewardDurationManager:!1,mockIncentiveManager:!1,isHoneyPythWrapperEnabled:!0};exports.a = e;
|
|
2
|
+
//# sourceMappingURL=chunk-DDEQFR3M.cjs.map
|
|
@@ -0,0 +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/pong/coding/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
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKT6L4K4Kcjs = require('./chunk-KT6L4K4K.cjs');var _chunkZYXVUXFQcjs = require('./chunk-ZYXVUXFQ.cjs');function m(e){return{...e,..._chunkZYXVUXFQcjs.e.call(void 0, e,"BERA")&&_chunkZYXVUXFQcjs.c}}function d(e){return e.map(r=>m(r))}var g=(e,r,i,o)=>{if(!e||!r||!i||!o)return 0;let n=new (0, _chunkKT6L4K4Kcjs.a)(e).times(i),s=new (0, _chunkKT6L4K4Kcjs.a)(r).times(o);if(n.lt(.01)||s.lt(.01)||n.isZero()||s.isZero())return 0;let u=s.div(n);return Number(new (0, _chunkKT6L4K4Kcjs.a)(1).minus(u).toFixed())};exports.a = m; exports.b = d; exports.c = g;
|
|
2
|
+
//# sourceMappingURL=chunk-DKY4QPWU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-DKY4QPWU.cjs","../src/utils/tokenWrapping.ts","../src/utils/math.ts"],"names":["wrapNativeToken","token","isToken","wBeraToken","wrapNativeTokens","tokens","computePriceImpact","tokenInPrice","tokenOutPrice","inAmount","outAmount","usdIn","bignumber_js_default","usdOut","ratio"],"mappings":"AAAA,iIAAwC,wDAAgD,SCMxEA,CAAAA,CAAqCC,CAAAA,CAAa,CAChE,MAAO,CACL,GAAGA,CAAAA,CACH,GAAIC,iCAAAA,CAAQD,CAAO,MAAM,CAAA,EAAKE,mBAChC,CACF,CAEO,SAASC,CAAAA,CAAsCC,CAAAA,CAAkB,CACtE,OAAOA,CAAAA,CAAO,GAAA,CAAKJ,CAAAA,EAAUD,CAAAA,CAAgBC,CAAK,CAAC,CACrD,CCLO,IAAMK,CAAAA,CAAqB,CAChCC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAAAA,EACW,CACX,EAAA,CAAI,CAACH,CAAAA,EAAgB,CAACC,CAAAA,EAAiB,CAACC,CAAAA,EAAY,CAACC,CAAAA,CAAW,OAAO,CAAA,CAEvE,IAAMC,CAAAA,CAAQ,IAAIC,wBAAAA,CAAUL,CAAY,CAAA,CAAE,KAAA,CAAME,CAAQ,CAAA,CAClDI,CAAAA,CAAS,IAAID,wBAAAA,CAAUJ,CAAa,CAAA,CAAE,KAAA,CAAME,CAAS,CAAA,CAI3D,EAAA,CADIC,CAAAA,CAAM,EAAA,CAAG,GAAI,CAAA,EAAKE,CAAAA,CAAO,EAAA,CAAG,GAAI,CAAA,EAChCF,CAAAA,CAAM,MAAA,CAAO,CAAA,EAAKE,CAAAA,CAAO,MAAA,CAAO,CAAA,CAAG,OAAO,CAAA,CAE9C,IAAMC,CAAAA,CAAQD,CAAAA,CAAO,GAAA,CAAIF,CAAK,CAAA,CAC9B,OAAO,MAAA,CAAO,IAAIC,wBAAAA,CAAU,CAAC,CAAA,CAAE,KAAA,CAAME,CAAK,CAAA,CAAE,OAAA,CAAQ,CAAC,CACvD,CAAA,CAAA,4CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-DKY4QPWU.cjs","sourcesContent":[null,"import { isToken, wBeraToken } from \"./tokens\";\n\ntype BaseToken = {\n address: string;\n};\n\nexport function wrapNativeToken<T extends BaseToken>(token: T): T {\n return {\n ...token,\n ...(isToken(token, \"BERA\") && wBeraToken),\n };\n}\n\nexport function wrapNativeTokens<T extends BaseToken>(tokens: T[]): T[] {\n return tokens.map((token) => wrapNativeToken(token));\n}\n","import BigNumber from \"@berachain/utils/pkg/bignumber.js\";\n\n/**\n * Compute the price impact of a swap\n * @param {string} tokenInPrice - The price of the input token\n * @param {string} tokenOutPrice - The price of the output token\n * @param {string} inAmount - The amount of the input token\n * @param {string} outAmount - The amount of the output token\n * @returns {number} The price impact of the swap\n */\nexport const computePriceImpact = (\n tokenInPrice: string,\n tokenOutPrice: string,\n inAmount: string,\n outAmount: string,\n): number => {\n if (!tokenInPrice || !tokenOutPrice || !inAmount || !outAmount) return 0;\n\n const usdIn = new BigNumber(tokenInPrice).times(inAmount);\n const usdOut = new BigNumber(tokenOutPrice).times(outAmount);\n\n // is the amount is close to 0, return 0\n if (usdIn.lt(0.01) || usdOut.lt(0.01)) return 0;\n if (usdIn.isZero() || usdOut.isZero()) return 0;\n\n const ratio = usdOut.div(usdIn);\n return Number(new BigNumber(1).minus(ratio).toFixed());\n};\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;var _chunk53TSJM6Pcjs = require('./chunk-53TSJM6P.cjs');var r=[],c= exports.a ={startSpan(e,t){return r.length===0?t():r.reduceRight((o,a)=>()=>a(e,o),t)()},addSpanHandler(e){return r.push(e),()=>{let t=r.indexOf(e);t!==-1&&r.splice(t,1)}}};var i=class extends _chunk53TSJM6Pcjs.f{constructor(t){super(t),this.name="NotFoundError",this.level=_nullishCoalesce(t.level, () => ("info")),this.message=`Resource ${t.resource} with id ${t.id} not found`,this.resource=t.resource,this.id=t.id}};var s= (_class =class extends _chunk53TSJM6Pcjs.f{__init() {this.blockNumber=null}constructor(t){super(t);_class.prototype.__init.call(this);,this.name="TransactionFailedError",this.txHash=t.txHash||null,this.receipt=t.receipt||null,this.to=t.to,this.functionName=t.functionName,this.blockNumber=_nullishCoalesce(t.blockNumber, () => (null)),this.input=t.input,this.receipt?this.message=`Transaction reverted on chain for reason: ${this.reason}`:this.txHash?this.message=`Transaction reverted after being broadcasted for reason: ${this.reason}`:this.message=`${this.reason}: ${this.message}`,this.tags={...this.tags,"operation.txn.status":t.txHash?"execution":"simulation",...t.tags},this.to&&(this.tags["operation.txn.to"]=this.to),this.functionName&&(this.tags["operation.txn.functionName"]=this.functionName)}}, _class);exports.a = c; exports.b = i; exports.c = s;
|
|
2
|
+
//# sourceMappingURL=chunk-DTBJO6VT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-DTBJO6VT.cjs","../src/errors/BeraTracing.ts","../src/errors/NotFoundError.ts","../src/errors/TransactionFailedError.ts"],"names":["_handlers","BeraTracing","context","callback","next","handler","idx","NotFoundError","BeraError","args","TransactionFailedError"],"mappings":"AAAA,iPAAwC,ICqBlCA,CAAAA,CAA2B,CAAC,CAAA,CA0BrBC,CAAAA,aAAc,CAOzB,SAAA,CAAaC,CAAAA,CAAsBC,CAAAA,CAAwC,CACzE,OAAIH,CAAAA,CAAU,MAAA,GAAW,CAAA,CAAUG,CAAAA,CAAS,CAAA,CAGrCH,CAAAA,CAAU,WAAA,CACf,CAACI,CAAAA,CAAMC,CAAAA,CAAAA,EAAY,CAAA,CAAA,EAAMA,CAAAA,CAAQH,CAAAA,CAASE,CAAI,CAAA,CAC9CD,CACF,CAAA,CAAE,CACJ,CAAA,CASA,cAAA,CAAeE,CAAAA,CAAmC,CAChD,OAAAL,CAAAA,CAAU,IAAA,CAAKK,CAAO,CAAA,CACf,CAAA,CAAA,EAAM,CACX,IAAMC,CAAAA,CAAMN,CAAAA,CAAU,OAAA,CAAQK,CAAO,CAAA,CACjCC,CAAAA,GAAQ,CAAA,CAAA,EAAIN,CAAAA,CAAU,MAAA,CAAOM,CAAAA,CAAK,CAAC,CACzC,CACF,CACF,CAAA,CCnEO,IAAMC,CAAAA,CAAN,MAAA,QAA4BC,mBAAU,CAM3C,WAQA,CAAYC,CAAAA,CAA0B,CACpC,KAAA,CAAMA,CAAI,CAAA,CACV,IAAA,CAAK,IAAA,CAAO,eAAA,CACZ,IAAA,CAAK,KAAA,kBAAQA,CAAAA,CAAK,KAAA,SAAS,QAAA,CAC3B,IAAA,CAAK,OAAA,CAAU,CAAA,SAAA,EAAYA,CAAAA,CAAK,QAAQ,CAAA,SAAA,EAAYA,CAAAA,CAAK,EAAE,CAAA,UAAA,CAAA,CAC3D,IAAA,CAAK,QAAA,CAAWA,CAAAA,CAAK,QAAA,CACrB,IAAA,CAAK,EAAA,CAAKA,CAAAA,CAAK,EACjB,CACF,CAAA,CCzBO,IAAMC,CAAAA,WAAN,MAAA,QAAqCF,mBAAU,CAMpD,eAsBA,WAAA,CAA6B,KAAA,WAY7B,CACEC,CAAAA,CAQA,CACA,KAAA,CAAMA,CAAI,qCAAA,CACV,IAAA,CAAK,IAAA,CAAO,wBAAA,CACZ,IAAA,CAAK,MAAA,CAASA,CAAAA,CAAK,MAAA,EAAU,IAAA,CAC7B,IAAA,CAAK,OAAA,CAAUA,CAAAA,CAAK,OAAA,EAAW,IAAA,CAC/B,IAAA,CAAK,EAAA,CAAKA,CAAAA,CAAK,EAAA,CACf,IAAA,CAAK,YAAA,CAAeA,CAAAA,CAAK,YAAA,CACzB,IAAA,CAAK,WAAA,kBAAcA,CAAAA,CAAK,WAAA,SAAe,MAAA,CACvC,IAAA,CAAK,KAAA,CAAQA,CAAAA,CAAK,KAAA,CAEd,IAAA,CAAK,OAAA,CAEP,IAAA,CAAK,OAAA,CAAU,CAAA,0CAAA,EAA6C,IAAA,CAAK,MAAM,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-DTBJO6VT.cjs","sourcesContent":[null,"import type { Unsubscribe } from \"../utils/createEmitter\";\n\n/**\n * Span context passed to tracing handlers.\n * Compatible with Sentry's StartSpanOptions (name, op, attributes).\n */\nexport type SpanContext = {\n name: string;\n op: string;\n attributes: Record<string, string | number | boolean | undefined>;\n};\n\n/**\n * A function that wraps a callback in a tracing span.\n * Compatible with Sentry.startSpan's signature.\n */\ntype StartSpanFn = <T>(\n context: SpanContext,\n callback: () => Promise<T>,\n) => Promise<T>;\n\nconst _handlers: StartSpanFn[] = [];\n\n/**\n * A generic span-tracing module for berajs.\n *\n * Instead of calling Sentry.startSpan directly, berajs calls\n * `BeraTracing.startSpan()`. Consumer apps subscribe via `.on(\"span\", handler)`\n * and forward spans to their tracing provider (Sentry, Datadog, etc.).\n *\n * Multiple handlers are supported and chain in registration order:\n * the first registered handler is the outermost wrapper.\n *\n * @example\n * ```ts\n * // In berajs code:\n * import { BeraTracing } from \"./BeraTracing\";\n * const result = await BeraTracing.startSpan(\n * { name: \"GraphQL query\", op: \"graphql.query\", attributes: {} },\n * () => executeQuery(),\n * );\n *\n * // In app instrumentation:\n * import { BeraTracing } from \"@berachain/berajs/errors\";\n * BeraTracing.addSpanHandler(Sentry.startSpan);\n * ```\n */\nexport const BeraTracing = {\n /**\n * Execute a callback, wrapping it in all registered span handlers.\n *\n * Handlers chain so each wraps the next. First registered = outermost wrapper.\n * If no handlers are registered, the callback is executed directly.\n */\n startSpan<T>(context: SpanContext, callback: () => Promise<T>): Promise<T> {\n if (_handlers.length === 0) return callback();\n\n // Chain: h1(ctx, () => h2(ctx, () => h3(ctx, () => callback())))\n return _handlers.reduceRight<() => Promise<T>>(\n (next, handler) => () => handler(context, next),\n callback,\n )();\n },\n\n /**\n * Register a span tracing handler.\n *\n * @param _event - Must be \"span\". Exists for API consistency with BeraMonitoring.\n * @param handler - A StartSpanFn, e.g. Sentry.startSpan.\n * @returns An unsubscribe function to remove the handler.\n */\n addSpanHandler(handler: StartSpanFn): Unsubscribe {\n _handlers.push(handler);\n return () => {\n const idx = _handlers.indexOf(handler);\n if (idx !== -1) _handlers.splice(idx, 1);\n };\n },\n};\n","import { BeraError, type IBeraErrorArgs } from \"./BeraError\";\n\nexport interface INotFoundErrorArgs extends IBeraErrorArgs {\n resource: string;\n id: string;\n chainId: number;\n}\n\n/**\n * Error thrown when a resource is not found.\n */\nexport class NotFoundError extends BeraError {\n /**\n * The name of the resource that was not found.\n *\n * @example \"Reward vault\"\n */\n resource: string;\n /**\n * The id of the resource that was not found.\n *\n * @example \"0x1234567890123456789012345678901234567890\"\n */\n id: string;\n\n constructor(args: INotFoundErrorArgs) {\n super(args);\n this.name = \"NotFoundError\";\n this.level = args.level ?? \"info\";\n this.message = `Resource ${args.resource} with id ${args.id} not found`;\n this.resource = args.resource;\n this.id = args.id;\n }\n}\n","import type { Hex } from \"@berachain-foundation/berancer-sdk\";\nimport type { Address, TransactionReceipt } from \"viem\";\n\nimport { BeraError, type IBeraErrorArgs } from \"./BeraError\";\n\n/**\n * This error is generally thrown by beraWriteContract when a transaction or simulation fails.\n */\nexport class TransactionFailedError extends BeraError {\n /**\n * The hash of the transaction that failed.\n *\n * Null if the error is due to a simulation failure.\n */\n txHash: string | null;\n\n /**\n * The receipt of the transaction that failed.\n *\n * Null if the error is due to a simulation failure.\n */\n receipt: TransactionReceipt | null;\n\n /**\n * The address of the contract that was called.\n */\n to: Address | undefined;\n\n /**\n * The data of the transaction that failed.\n */\n callData: Hex | undefined;\n\n /**\n * The block number of the transaction that failed.\n */\n blockNumber: bigint | null = null;\n\n /**\n * The input of the transaction that failed.\n */\n input: object;\n\n /**\n * The function name of the transaction that failed.\n */\n functionName: string | undefined;\n\n constructor(\n args: IBeraErrorArgs & {\n txHash?: string;\n receipt?: TransactionReceipt;\n to?: Address;\n blockNumber?: bigint;\n functionName?: string;\n input: object;\n },\n ) {\n super(args);\n this.name = \"TransactionFailedError\";\n this.txHash = args.txHash || null;\n this.receipt = args.receipt || null;\n this.to = args.to;\n this.functionName = args.functionName;\n this.blockNumber = args.blockNumber ?? null;\n this.input = args.input;\n\n if (this.receipt) {\n // If we have a receipt, transaction reverted on chain\n this.message = `Transaction reverted on chain for reason: ${this.reason}`;\n } else if (this.txHash) {\n // If we have a tx hash, transaction reverted after being broadcasted but we never got a receipt\n // Might happen for network reasons\n this.message = `Transaction reverted after being broadcasted for reason: ${this.reason}`;\n } else {\n this.message = `${this.reason}: ${this.message}`;\n }\n\n this.tags = {\n ...this.tags,\n \"operation.txn.status\": args.txHash ? \"execution\" : \"simulation\",\n ...args.tags,\n };\n\n if (this.to) {\n this.tags[\"operation.txn.to\"] = this.to;\n }\n\n if (this.functionName) {\n this.tags[\"operation.txn.functionName\"] = this.functionName;\n }\n }\n}\n"]}
|