@berachain/berajs 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/{transactionStore-BvStaXf3.d.ts → BexStatusProvider-nS3NcdxI.d.cts} +1 -41
  2. package/dist/{transactionStore-CQrGYSY2.d.cts → BexStatusProvider-nS3NcdxI.d.ts} +1 -41
  3. package/dist/abi/exports.cjs.map +1 -1
  4. package/dist/actions/exports.cjs +1 -1
  5. package/dist/actions/exports.cjs.map +1 -1
  6. package/dist/actions/exports.d.cts +4 -5
  7. package/dist/actions/exports.d.ts +4 -5
  8. package/dist/actions/exports.mjs +1 -1
  9. package/dist/{chunk-OS5AJMYJ.cjs → chunk-22J3YJDN.cjs} +2 -2
  10. package/dist/chunk-22J3YJDN.cjs.map +1 -0
  11. package/dist/{chunk-MTS5SZLA.mjs → chunk-2LL3P5PN.mjs} +2 -2
  12. package/dist/chunk-3YXSUBA5.mjs +2 -0
  13. package/dist/{chunk-H2QSRMVS.mjs.map → chunk-3YXSUBA5.mjs.map} +1 -1
  14. package/dist/chunk-55L7STYD.mjs +2 -0
  15. package/dist/chunk-55L7STYD.mjs.map +1 -0
  16. package/dist/{chunk-BOYZVULX.cjs → chunk-6LDOG5RL.cjs} +2 -2
  17. package/dist/chunk-6LDOG5RL.cjs.map +1 -0
  18. package/dist/{chunk-UQUWMHVF.cjs → chunk-7LNBSOVV.cjs} +2 -2
  19. package/dist/chunk-7LNBSOVV.cjs.map +1 -0
  20. package/dist/{chunk-ZQRACIGR.mjs → chunk-7SMWQ6SN.mjs} +2 -2
  21. package/dist/{chunk-7GWTHOLO.mjs → chunk-7WRTK7RJ.mjs} +2 -2
  22. package/dist/chunk-A4UDYSB6.mjs +4 -0
  23. package/dist/chunk-A4UDYSB6.mjs.map +1 -0
  24. package/dist/chunk-AX2YQQFQ.mjs +2 -0
  25. package/dist/chunk-AX2YQQFQ.mjs.map +1 -0
  26. package/dist/chunk-C6ZGUO4H.cjs +2 -0
  27. package/dist/chunk-C6ZGUO4H.cjs.map +1 -0
  28. package/dist/chunk-CYKCYPFR.cjs.map +1 -1
  29. package/dist/chunk-ECRMUMTA.mjs +2 -0
  30. package/dist/chunk-ECRMUMTA.mjs.map +1 -0
  31. package/dist/{chunk-ZAKA4TGK.cjs → chunk-FCWDGE62.cjs} +2 -2
  32. package/dist/chunk-FCWDGE62.cjs.map +1 -0
  33. package/dist/chunk-FL2N3XHK.cjs.map +1 -1
  34. package/dist/chunk-MUCEYO3E.cjs +4 -0
  35. package/dist/chunk-MUCEYO3E.cjs.map +1 -0
  36. package/dist/chunk-OIYXOKTT.cjs.map +1 -1
  37. package/dist/chunk-P2Q7CMUD.cjs +2 -0
  38. package/dist/chunk-P2Q7CMUD.cjs.map +1 -0
  39. package/dist/chunk-PKXAW6MO.cjs +2 -0
  40. package/dist/chunk-PKXAW6MO.cjs.map +1 -0
  41. package/dist/chunk-SWMJQOH6.cjs.map +1 -1
  42. package/dist/{chunk-YQGZMWDT.mjs → chunk-THATXCJK.mjs} +2 -2
  43. package/dist/chunk-VP7XUOSI.cjs.map +1 -1
  44. package/dist/chunk-VXL2ZZ4X.cjs.map +1 -1
  45. package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
  46. package/dist/chunk-XNJLSA6P.cjs.map +1 -1
  47. package/dist/chunk-YZV5LKIP.cjs +2 -0
  48. package/dist/chunk-YZV5LKIP.cjs.map +1 -0
  49. package/dist/contexts/exports.cjs +1 -1
  50. package/dist/contexts/exports.cjs.map +1 -1
  51. package/dist/contexts/exports.d.cts +2 -10
  52. package/dist/contexts/exports.d.ts +2 -10
  53. package/dist/contexts/exports.mjs +1 -1
  54. package/dist/contexts/exports.mjs.map +1 -1
  55. package/dist/enum/exports.cjs.map +1 -1
  56. package/dist/enum/exports.d.cts +1 -2
  57. package/dist/enum/exports.d.ts +1 -2
  58. package/dist/errors/exports.cjs +1 -1
  59. package/dist/errors/exports.cjs.map +1 -1
  60. package/dist/errors/exports.d.cts +25 -2
  61. package/dist/errors/exports.d.ts +25 -2
  62. package/dist/errors/exports.mjs +1 -1
  63. package/dist/{getValidatorQueuedOperatorAddress-It0GsdvQ.d.cts → getValidatorQueuedOperatorAddress-Dstyaomr.d.cts} +1 -1
  64. package/dist/{getValidatorQueuedOperatorAddress-BX35p2Lv.d.ts → getValidatorQueuedOperatorAddress-RW4OMcD1.d.ts} +1 -1
  65. package/dist/{global.d-Ba-NIojH.d.cts → global.d-CN6l2b9E.d.cts} +1 -2
  66. package/dist/{global.d-By70bEv2.d.ts → global.d-wYu8G8IQ.d.ts} +1 -2
  67. package/dist/hooks/exports.cjs +2 -2
  68. package/dist/hooks/exports.cjs.map +1 -1
  69. package/dist/hooks/exports.d.cts +7 -15
  70. package/dist/hooks/exports.d.ts +7 -15
  71. package/dist/hooks/exports.mjs +3 -3
  72. package/dist/hooks/exports.mjs.map +1 -1
  73. package/dist/{txnEnum-BYNbCxla.d.ts → txnEnum-BlBYhNRl.d.cts} +74 -1
  74. package/dist/{txnEnum-BYNbCxla.d.cts → txnEnum-BlBYhNRl.d.ts} +74 -1
  75. package/dist/types/exports.cjs.map +1 -1
  76. package/dist/types/exports.d.cts +2 -3
  77. package/dist/types/exports.d.ts +2 -3
  78. package/dist/utils/exports.cjs +1 -1
  79. package/dist/utils/exports.cjs.map +1 -1
  80. package/dist/utils/exports.mjs +1 -1
  81. package/dist/utils/exports.mjs.map +1 -1
  82. package/package.json +6 -6
  83. package/src/actions/dex/aggregators/haiku.ts +1 -1
  84. package/src/actions/dex/aggregators/oogabooga.ts +1 -1
  85. package/src/actions/pol/getEarnedStakedBeraVault.ts +1 -1
  86. package/src/actions/pol/getStakingDailyAssets.ts +4 -1
  87. package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
  88. package/src/contexts/exports.ts +0 -1
  89. package/src/data/contracts.ts +1 -1
  90. package/src/errors/BeraError.ts +11 -2
  91. package/src/errors/RequestError.ts +27 -1
  92. package/src/errors/errorMap.ts +7 -6
  93. package/src/errors/getErrorMessage.ts +59 -20
  94. package/src/errors/getRevertReason.integration.test.ts +1 -1
  95. package/src/hooks/exports.ts +0 -4
  96. package/src/hooks/pol/useStakedData.ts +1 -1
  97. package/dist/chunk-7SC4VD3U.cjs +0 -2
  98. package/dist/chunk-7SC4VD3U.cjs.map +0 -1
  99. package/dist/chunk-BHNQX4XC.mjs +0 -2
  100. package/dist/chunk-BHNQX4XC.mjs.map +0 -1
  101. package/dist/chunk-BOYZVULX.cjs.map +0 -1
  102. package/dist/chunk-C3G5KXCH.mjs +0 -2
  103. package/dist/chunk-C3G5KXCH.mjs.map +0 -1
  104. package/dist/chunk-G6NA6NSM.mjs +0 -4
  105. package/dist/chunk-G6NA6NSM.mjs.map +0 -1
  106. package/dist/chunk-H2QSRMVS.mjs +0 -2
  107. package/dist/chunk-IJM76AWK.cjs +0 -4
  108. package/dist/chunk-IJM76AWK.cjs.map +0 -1
  109. package/dist/chunk-MUNAP5TM.cjs +0 -2
  110. package/dist/chunk-MUNAP5TM.cjs.map +0 -1
  111. package/dist/chunk-OS5AJMYJ.cjs.map +0 -1
  112. package/dist/chunk-TJWKS54T.mjs +0 -2
  113. package/dist/chunk-TJWKS54T.mjs.map +0 -1
  114. package/dist/chunk-UQUWMHVF.cjs.map +0 -1
  115. package/dist/chunk-UXUWSRVV.cjs +0 -2
  116. package/dist/chunk-UXUWSRVV.cjs.map +0 -1
  117. package/dist/chunk-WTCBORPB.cjs +0 -2
  118. package/dist/chunk-WTCBORPB.cjs.map +0 -1
  119. package/dist/chunk-ZAKA4TGK.cjs.map +0 -1
  120. package/dist/contracts-CQIPk0Jc.d.cts +0 -74
  121. package/dist/contracts-CQIPk0Jc.d.ts +0 -74
  122. package/src/contexts/TransactionStoreContext.tsx +0 -87
  123. package/src/hooks/transactions/transactionStore.ts +0 -296
  124. package/src/hooks/transactions/transactionStore.unit.test.ts +0 -561
  125. package/src/hooks/transactions/useAddRecentTransaction.ts +0 -29
  126. package/src/hooks/transactions/useRecentTransactions.ts +0 -27
  127. package/src/hooks/transactions/useSetTransactionStatus.ts +0 -31
  128. /package/dist/{chunk-MTS5SZLA.mjs.map → chunk-2LL3P5PN.mjs.map} +0 -0
  129. /package/dist/{chunk-ZQRACIGR.mjs.map → chunk-7SMWQ6SN.mjs.map} +0 -0
  130. /package/dist/{chunk-7GWTHOLO.mjs.map → chunk-7WRTK7RJ.mjs.map} +0 -0
  131. /package/dist/{chunk-YQGZMWDT.mjs.map → chunk-THATXCJK.mjs.map} +0 -0
@@ -1 +0,0 @@
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","getErrorMessage","reason","message","category","errors","type","errorType","r","keyword","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,CAC/B,QAAA,CAAU,4BACZ,CAAA,CACA,sBAAA,CAAwB,CACtB,OAAA,CAAS,CACP,YAAA,CACA,uBAAA,CACA,4BACF,CAAA,CACA,QAAA,CAAU,0DACZ,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,MAAM,CAAA,CAAA,CAAA,CAC/C,SAAA,CAAWA,CAAAA,CACX,cAAA,CAAgB,CAAA,CAClB,CAAA,CAIF,EAAA,CAAI,CAACA,CAAAA,CAAM,KAAA,CACT,MAAO,CAAE,MAAA,CAAQA,CAAAA,CAAM,IAAA,CAAM,SAAA,CAAWA,CAAM,CAAA,CAIhDA,CAAAA,CAAQA,CAAAA,CAAM,KAChB,CAEA,EAAA,CAAI,CAACD,CAAAA,CACH,MAAO,CAAE,MAAA,CAAQ,KAAA,CAAA,CAAW,SAAA,CAAWC,CAAM,CAAA,CAI/C,MAAM,IAAI,KAAA,CAAM,+BAAA,CAAiC,CAC/C,KAAA,CAAOA,CACT,CAAC,CACH,CASO,SAASU,CAAAA,CACdC,CAAAA,CAKQ,CACR,MAAA,CAAQA,CAAAA,CAAS,CAEf,IAAK,0BAAA,CACL,KAAK,IAAA,CACH,MAAO,0BAAA,CACT,OAAA,CACE,MAAO,CAAA,UAAA,EAAaA,CAAO,CAAA,CAAA","file":"/Users/pong/coding/monobera/packages/berajs/dist/chunk-7SC4VD3U.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 INSUFFICIENT_FUNDS: {\n reasons: [\"InsufficientFundsError\"],\n keywords: [\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 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 NOT_ENOUGH_GAS: {\n keywords: [\"insufficient funds for gas * price + value:\"],\n errorMSG: \"Gas balance is insufficient to cover the transaction cost.\",\n },\n HASH: {\n keywords: [\"hash\"],\n\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\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 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 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 errorType.errorMSG;\n }\n }\n\n // Priority 2: Keyword substring match on message (fallback, use carefully)\n if (\n errorType?.keywords?.some((keyword) => {\n return message?.includes(keyword.toLowerCase().trim());\n })\n ) {\n return errorType.errorMSG;\n }\n }\n }\n\n // Priority 3: No match found — return generic fallback\n return GENERAL_ERROR;\n}\n","import { type Abi, BaseError } from \"viem\";\n\nimport { appConfig } from \"@berachain/config/internal\";\n\nimport { GENERAL_ERROR } from \"./errorMap\";\nimport { getErrorMessage } 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 displayMessage = getErrorMessage(this);\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 (!appConfig.env.isProduction && process.env.NODE_ENV !== \"test\") {\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,2 +0,0 @@
1
- import{a as R,b as A}from"./chunk-ZQRACIGR.mjs";import{a as k,f as T}from"./chunk-MTS5SZLA.mjs";import{a as F}from"./chunk-C3FHGFLK.mjs";import{a as L,b as W,e as C}from"./chunk-YQGZMWDT.mjs";import{e as E,g as x}from"./chunk-C3G5KXCH.mjs";import{createContext as j,useContext as z}from"react";import{isFlagEnabled as G}from"@berachain/config/internal/edge-config";import{jsx as Z}from"react/jsx-runtime";var I=j(void 0);function De({children:e,flags:t,aggregators:o,swberaAprWindow:n="DAY"}){return Z(I.Provider,{value:{...F,...t,aggregators:o?Object.entries(o).filter(([,r])=>G(r)).map(([r])=>r):void 0,swberaAprWindow:n},children:e})}function $(){let e=z(I);if(!e)throw new Error("BeraFlagsProvider not found");return e}function Me(e){return $()[e]}import{createContext as ee,useContext as te,useState as oe}from"react";import{jsx as ne}from"react/jsx-runtime";var N=ee({protocol:{isPaused:!1,factories:{composableStable:"enabled",weighted:"enabled",allPaused:!1}},onPoolChange:()=>{},pool:void 0});function Ye(){let e=te(N);if(!e)throw new E({level:"fatal",message:"BexStateContext is not defined"});return e}function _e({children:e,isVaultPaused:t,labels:o,factories:n}){let[r,p]=oe(),s=(r?.isPaused&&!r?.isInRecoveryMode)??!1,d=t||r?.isPaused;return ne(N.Provider,{value:{protocol:{isPaused:t,factories:{...n,allPaused:n.composableStable==="paused"&&n.weighted==="paused"}},labels:o,onPoolChange:p,pool:r?{...r,disablePoolWithdrawals:!!s,disablePoolDeposits:!!d}:void 0},children:e})}import{createContext as re,useContext as ae}from"react";import{mainnet as ie}from"@berachain/config/mainnet";import{jsx as se}from"react/jsx-runtime";function je(){return ae(D)}var D=re(ie.averageBlockTime);function ze({children:e,blockTime:t,...o}){let{config:n}=L(o);return se(D.Provider,{value:t??n.averageBlockTime,children:e})}import{createContext as ce,useContext as de}from"react";import{jsx as le}from"react/jsx-runtime";var M=ce(void 0);function et({children:e,...t}){return le(M.Provider,{value:t,children:e})}function tt(){let e=de(M);if(!e)throw new Error("useHoneyConfig must be used within a HoneyConfigProvider");return e}import{createContext as Te,useMemo as he}from"react";import{isFlagEnabled as ye}from"@berachain/config/internal/edge-config";import fe from"swr";import{useBeraWallet as me,useConfig as ge}from"@berachain/wagmi/hooks";import{getChains as ue,multicall as pe}from"@wagmi/core";import{formatUnits as H}from"viem";async function O({account:e,wagmiConfig:t,chainId:o,ensoClient:n}){let p=(await n.getBalances({useEoa:!0,chainId:o??"all",eoaAddress:e})).map(a=>({name:a.name,symbol:a.symbol,decimals:a.decimals,address:C(a.token,"ETH")?W.address:a.token,logoURI:a.logoUri,balance:{raw:a.amount.toString(),formatted:H(BigInt(a.amount),a.decimals)},chainId:Number(a.chainId),price:Number(a.price)})),s=Object.groupBy(p,a=>a.chainId??0),d=await Promise.allSettled(Object.entries(s).map(async([a,u])=>{if(!u)return;let h=ue(t).find(c=>c.id===Number(a));if(!h)return;let i=h.contracts?.multicall3?.address;if(!i)return T.captureException(new x({property:"multicallAddress",value:i,expected:"Address",chainId:Number(a)})),u;let g=await pe(t,{chainId:Number(a),contracts:u.map(c=>A({token:c,account:e,multicallAddress:i})),allowFailure:!0}),f=[];for(let c=0;c<u.length;c++){let l=u[c];if(g[c].status==="success"){let y=g[c].result;f.push({...l,balance:{raw:y?.toString()??"0",formatted:H(y??0n,l.decimals)}})}else console.error("error getting balance",g[c].error),T.captureException(k({cause:g[c].error})),f.push(l)}return f})),m=[];for(let a of d)a.status==="fulfilled"?m.push(...a.value??[]):T.captureException(k({cause:a.reason}));return m.sort((a,u)=>{let h=Number(a.balance.formatted)*(a.price??0);return Number(u.balance.formatted)*(u.price??0)-h})}function U({chainId:e}={},t){let{address:o}=me(),n=ge(),r=!!o&&(t?.opts?.isEnabled??!0),s=fe(r&&n?["useEnsoUserTokensWithBalances",o,e]:null,async([,d,m])=>O({account:d,wagmiConfig:n,chainId:m??"all",ensoClient:R()}),{refreshInterval:1e5,isEnabled:r,...t?.opts});return{...s,refresh:()=>s.mutate()}}function q({defaultTokenList:e=[],externalList:t=[]}){if(e.length===0)return{tokenList:t,customTokenList:t,featuredTokenList:[]};let o=e.map(s=>({...s,default:!0})),n=o.filter(s=>s.tags?.some(d=>d==="featured")),r=[...o,...t];return{tokenList:r.filter((s,d)=>r.findIndex(m=>C(m,s))===d),customTokenList:t,featuredTokenList:n}}import{jsx as ke}from"react/jsx-runtime";var xe=Te(void 0);function Ct({children:e,defaultTokens:t,edgeConfigTokenList:o,userTokens:n,onAddToken:r,onRemoveToken:p}){let{data:s,refresh:d}=U(),{tokenList:m=[],featuredTokenList:a=[]}=he(()=>q({defaultTokenList:[...t,...o?.filter(u=>ye(u.enabled))],externalList:[...n,...(s??[]).map(u=>({...u,balance:void 0,price:void 0}))]}),[t,n,o,s]);return ke(xe.Provider,{value:{tokenList:m,userTokens:n,featuredTokens:a,ensoTokens:s,onAddToken(u){r(u,{defaultTokens:t,userTokens:n,tokenList:m})},onRemoveToken:p,refresh:()=>{d()}},children:e})}import{getPublicClient as be}from"@wagmi/core";var J="rk-transactions",K="transactions";function Y(e){try{let t=e?JSON.parse(e):{};return typeof t=="object"?t:{}}catch{return{}}}function ve(e){return Object.entries(e).reduce((t,[o,n])=>({...t,[o]:Object.entries(n).reduce((r,[p,s])=>{if(!s)return r;let d=s.map(m=>({...m,chainId:Number(p)}));return r.push(...d),r},[])}),{})}var S=(e,t,o)=>o.findIndex(n=>n.hash===e.hash)===t;function Ce(e,t){let o=ve(e);for(let[n,r]of Object.entries(t))o[n]&&r?o[n]=[...r,...o[n]].filter(S):o[n]=r?.filter(S);return o}function _(){let e=Y(typeof localStorage<"u"?localStorage.getItem(J):null),t=Y(typeof localStorage<"u"?localStorage.getItem(K):null);return Ce(e,t)}var Pe=/^0x([A-Fa-f0-9]{64})$/;function Se(e){if(!Pe.test(e.hash))throw new x({property:"hash",value:e.hash,expected:"TransactionHash"});if(typeof e.description!="string")throw new x({property:"description",value:e.description,expected:"string"});if(typeof e.confirmations<"u"&&(!Number.isInteger(e.confirmations)||e.confirmations<1))throw new x({property:"confirmations",value:e.confirmations,expected:"positive integer"})}function V({config:e}){let t=_(),o=new Set,n=new Map;function r(i){return t[i]??[]}function p(i,g){let f={...g,status:"pending"};try{Se(f),a(i,c=>[f,...c.filter(({hash:l})=>l!==f.hash)])}catch(c){T.captureException(k({cause:c}))}}function s(i){a(i,()=>[])}function d(i,g,f){a(i,c=>c.map(l=>l.hash===g?{...l,status:f}:l))}async function m(i){let g=r(i).filter(f=>f.status==="pending");await Promise.allSettled(g.map(async f=>{let{confirmations:c,hash:l,chainId:y}=f,b=n.get(l);if(b)return await b;let B=be(e,{chainId:y});if(!B)return;let w=B.waitForTransactionReceipt({confirmations:c,hash:l}).then(({status:v})=>{v!==void 0&&d(i,l,Number(v)===0?"failed":"confirmed")}).catch(v=>{T.captureException(k({cause:v}))}).finally(()=>{n.delete(l)});return n.set(l,w),await w}))}function a(i,g){t=_(),t[i]=t[i]??[];let l=g(t?.[i]??[]).sort((y,b)=>b.timestamp-y.timestamp).slice(0,10);t[i]=l.length>0?l.filter(S):void 0,u(),h()}function u(){typeof localStorage>"u"||(localStorage.setItem(K,JSON.stringify(t)),localStorage.removeItem(J))}function h(){for(let i of o)i()}function P(i){return o.add(i),()=>{o.delete(i)}}return{addTransaction:p,clearTransactions:s,getTransactions:r,onChange:P,refreshPendingTransactions:m,setTransactionStatus:d}}import{createContext as Be,useContext as we,useEffect as Ee,useState as Le}from"react";import{useBeraWagmi as Re,useConfig as We}from"@berachain/wagmi/hooks";import{jsx as Ae}from"react/jsx-runtime";var Q,X=Be(null);function It({children:e}){let{account:t}=Re(),o=t?.wallet?.address,n=We(),[r]=Le(()=>Q??(Q=V({config:n})));return Ee(()=>{if(!o)return;let p=()=>{r.refreshPendingTransactions(o)};p();let s=setInterval(p,12e4),d=()=>{document.visibilityState==="visible"&&p()};return typeof document<"u"&&document.addEventListener("visibilitychange",d),()=>{clearInterval(s),typeof document<"u"&&document.removeEventListener("visibilitychange",d)}},[r,o]),Ae(X.Provider,{value:r,children:e})}function Nt(){let e=we(X);if(!e)throw new Error("Transaction hooks must be used within ");return e}export{De as a,$ as b,Me as c,N as d,Ye as e,_e as f,je as g,D as h,ze as i,M as j,et as k,tt as l,xe as m,Ct as n,Y as o,ve as p,S as q,Ce as r,V as s,It as t,Nt as u};
2
- //# sourceMappingURL=chunk-BHNQX4XC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/contexts/BeraFlags/BeraFlags.tsx","../src/contexts/BexStatusProvider.tsx","../src/contexts/block-time-provider.tsx","../src/contexts/HoneyConfigProvider.tsx","../src/contexts/TokensProvider.tsx","../src/hooks/enso/useEnsoUserTokensWithBalances.ts","../src/actions/enso/getEnsoUserTokensWithBalances.ts","../src/utils/formatTokenList.ts","../src/hooks/transactions/transactionStore.ts","../src/contexts/TransactionStoreContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { type BeraFlags, defaultFlags } from \"./defaultFlags\";\n\nexport type { BeraFlags };\n\nexport type BeraFlagsContextReturn = BeraFlags & {\n /**\n * A list of aggregators that are enabled. If not provided, all aggregators are enabled.\n */\n aggregators: string[] | undefined;\n swberaAprWindow: Exclude<\n EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"],\n undefined\n >;\n};\n\nconst BeraFlagContext = createContext<BeraFlagsContextReturn | undefined>(\n undefined,\n);\n\nexport function BeraFlagsProvider({\n children,\n flags,\n aggregators,\n swberaAprWindow = \"DAY\",\n}: {\n children: React.ReactNode;\n flags: BeraFlags;\n aggregators?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"aggregators\"];\n swberaAprWindow?: EdgeConfigSchema[\"pol\"][\"swberaAprWindow\"];\n}) {\n return (\n <BeraFlagContext.Provider\n value={{\n ...defaultFlags,\n ...flags,\n aggregators: aggregators\n ? Object.entries(aggregators)\n .filter(([, value]) => isFlagEnabled(value))\n .map(([key]) => key)\n : undefined,\n swberaAprWindow,\n }}\n >\n {children}\n </BeraFlagContext.Provider>\n );\n}\n\nexport function useBeraFlags() {\n const context = useContext(BeraFlagContext);\n if (!context) {\n throw new Error(\"BeraFlagsProvider not found\");\n }\n return context;\n}\n\nexport function useBeraFlag<T extends keyof BeraFlagsContextReturn>(\n key: T,\n): BeraFlagsContextReturn[T] {\n const flags = useBeraFlags();\n return flags[key];\n}\n","import {\n createContext,\n type Dispatch,\n type PropsWithChildren,\n type SetStateAction,\n useContext,\n useState,\n} from \"react\";\nimport type { Hex } from \"viem\";\n\nimport type { EdgeConfigSchema } from \"@berachain/config/internal/edge-config\";\n\nimport { BeraError } from \"~/errors/BeraError\";\n\ntype FactoryStatus = {\n /**\n * If the composable stable factory is enabled\n */\n composableStable: \"paused\" | \"enabled\";\n /**\n * If the weighted factory is enabled\n */\n weighted: \"paused\" | \"enabled\";\n};\nexport interface BexStatusProviderProps {\n isVaultPaused: boolean;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n };\n factories: FactoryStatus;\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}\n\nexport const BexStateContext = createContext<{\n protocol: {\n isPaused: boolean;\n factories: FactoryStatus & { allPaused: boolean };\n };\n onPoolChange: Dispatch<SetStateAction<BexStatusProviderProps[\"pool\"]>>;\n pool?: {\n id: Hex;\n isInRecoveryMode: boolean;\n isPaused: boolean;\n disablePoolWithdrawals: boolean;\n disablePoolDeposits: boolean;\n };\n labels?: NonNullable<EdgeConfigSchema[\"bex\"]>[\"emergencyLabels\"];\n}>({\n protocol: {\n isPaused: false,\n factories: {\n composableStable: \"enabled\",\n weighted: \"enabled\",\n allPaused: false,\n },\n },\n onPoolChange: () => {},\n pool: undefined,\n});\n\n/**\n * @description Determines the status of a pool or vault and returns the appropriate messages and flags to disable functionality.\n * More information here https://www.notion.so/berachain/BEX-RecoveryMode-and-Pause-explained-17c6120abced80e0985dd589b57ff018\n *\n * @returns status flags to enable/disable/notify users across the BEX\n *\n **/\nexport function useBexStatus() {\n const context = useContext(BexStateContext);\n\n if (!context) {\n throw new BeraError({\n level: \"fatal\",\n message: \"BexStateContext is not defined\",\n });\n }\n\n return context;\n}\n\nexport function BexStatusProvider({\n children,\n isVaultPaused,\n labels,\n factories,\n}: PropsWithChildren<BexStatusProviderProps>) {\n const [poolState, setPoolState] = useState<BexStatusProviderProps[\"pool\"]>();\n // Determine whether to disable withdrawals for a pool (vault pause does not impact this)\n const disablePoolWithdrawals =\n (poolState?.isPaused && !poolState?.isInRecoveryMode) ?? false;\n\n // Determine whether to disable deposits for a pool (vault pause does not impact this)\n const disablePoolDeposits = isVaultPaused || poolState?.isPaused;\n\n // TODO: we dont yet support anything to disable staking/unstaking within reward vaults if they get paused\n\n return (\n <BexStateContext.Provider\n value={{\n protocol: {\n isPaused: isVaultPaused,\n factories: {\n ...factories,\n allPaused:\n factories.composableStable === \"paused\" &&\n factories.weighted === \"paused\",\n },\n },\n labels,\n onPoolChange: setPoolState,\n pool: poolState\n ? {\n ...poolState,\n disablePoolWithdrawals: !!disablePoolWithdrawals,\n disablePoolDeposits: !!disablePoolDeposits,\n }\n : undefined,\n }}\n >\n {children}\n </BexStateContext.Provider>\n );\n}\n","import { createContext, type PropsWithChildren, useContext } from \"react\";\n\nimport { mainnet } from \"@berachain/config/mainnet\";\n\nimport { parseBaseArgs } from \"~/utils/parseBaseArgs\";\n\n/**\n * Average berachain block time in seconds\n */\nexport function useBlockTime(): number {\n return useContext(BlockTimeContext);\n}\n\nexport const BlockTimeContext = createContext<number>(\n // this is the default block time for berachain, but actually overridden by the block time provider\n mainnet.averageBlockTime,\n);\n\nexport function BlockTimeProvider({\n children,\n blockTime,\n ...args\n}: PropsWithChildren<{\n blockTime?: number;\n}> &\n BeraJS.BaseFunctionArgs) {\n const { config } = parseBaseArgs(args);\n\n return (\n <BlockTimeContext.Provider value={blockTime ?? config.averageBlockTime}>\n {children}\n </BlockTimeContext.Provider>\n );\n}\n","import { createContext, useContext } from \"react\";\n\nimport type { HoneyFeeMap } from \"~/actions/honey/getHoneyFees\";\nimport type { TokenWithMetadata } from \"~/types/dex\";\nimport type { PythPriceFeedMap } from \"~/types/honeySwap\";\n\nexport const HoneyConfigContext = createContext<\n HoneyConfigContextReturn | undefined\n>(undefined);\n\nexport type TokenWithOrder = TokenWithMetadata & {\n order: number;\n};\nexport interface HoneyConfigContextReturn {\n /**\n * Map of the Pyth price feed ids for each collateral\n */\n priceFeedMap: PythPriceFeedMap;\n /**\n * This is the list of all the collaterals that are supported by the Honey protocol\n */\n collateralList: TokenWithOrder[];\n /**\n * This is the main collateral that is used to calculate the relative cap limit\n */\n referenceCollateral: TokenWithOrder;\n /**\n * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode\n */\n feeMap: HoneyFeeMap;\n flags: {\n /**\n * If true, mint/redeem will also update pyth prices\n */\n isPythWrapperEnabled: boolean;\n };\n /**\n * Honey protocol configs\n */\n protocol: {\n /**\n * Honey protocol paused state\n */\n isPaused: boolean;\n /**\n * The label for the Honey protocol paused message\n */\n pausedBannerLabel?: string;\n };\n}\n\nexport interface HoneyConfigProviderProps extends HoneyConfigContextReturn {\n children: React.ReactNode;\n}\n\nexport function HoneyConfigProvider({\n children,\n ...props\n}: HoneyConfigProviderProps) {\n return (\n <HoneyConfigContext.Provider value={props}>\n {children}\n </HoneyConfigContext.Provider>\n );\n}\n\nexport function useHoneyConfig() {\n const context = useContext(HoneyConfigContext);\n if (!context) {\n throw new Error(\"useHoneyConfig must be used within a HoneyConfigProvider\");\n }\n return context;\n}\n","import { createContext, type PropsWithChildren, useMemo } from \"react\";\n\nimport {\n type EdgeConfigSchema,\n isFlagEnabled,\n} from \"@berachain/config/internal/edge-config\";\n\nimport { useEnsoUserTokensWithBalances } from \"~/hooks/enso/useEnsoUserTokensWithBalances\";\nimport type { BalanceToken, Token, TokenWithMetadata } from \"~/types/dex\";\nimport { formatTokenList } from \"~/utils/formatTokenList\";\n\nexport interface TokensProviderContext {\n tokenList: TokenWithMetadata[];\n userTokens: Token[];\n featuredTokens: TokenWithMetadata[];\n onRemoveToken: (token: Token) => void;\n onAddToken: (token: Token) => void;\n refresh: () => void;\n ensoTokens: BalanceToken[] | undefined;\n}\n\nexport const TokenContext = createContext<TokensProviderContext | undefined>(\n undefined,\n);\n\nexport interface TokensProviderProps\n extends Omit<\n TokensProviderContext,\n \"tokenList\" | \"onAddToken\" | \"featuredTokens\" | \"ensoTokens\"\n > {\n onAddToken: (\n token: Token,\n context: {\n defaultTokens: TokenWithMetadata[];\n userTokens: Token[];\n tokenList: TokenWithMetadata[];\n },\n ) => void;\n defaultTokens: TokenWithMetadata[];\n edgeConfigTokenList: EdgeConfigSchema[\"tokens\"];\n}\n\nexport function TokensProvider({\n children,\n defaultTokens,\n edgeConfigTokenList,\n userTokens,\n onAddToken,\n onRemoveToken,\n}: PropsWithChildren<Omit<TokensProviderProps, \"refresh\">>) {\n const { data: ensoTokens, refresh } = useEnsoUserTokensWithBalances();\n\n const { tokenList = [], featuredTokenList = [] } = useMemo(\n () =>\n formatTokenList({\n defaultTokenList: [\n ...defaultTokens,\n ...(edgeConfigTokenList?.filter((token) =>\n isFlagEnabled(token.enabled),\n ) as TokenWithMetadata[]),\n ],\n externalList: [\n ...userTokens,\n ...(ensoTokens ?? []).map((t) => ({\n ...t,\n balance: undefined,\n price: undefined,\n })),\n ],\n }),\n [defaultTokens, userTokens, edgeConfigTokenList, ensoTokens],\n );\n\n return (\n <TokenContext.Provider\n value={{\n tokenList,\n userTokens,\n featuredTokens: featuredTokenList,\n ensoTokens,\n onAddToken(tk) {\n onAddToken(tk, { defaultTokens, userTokens, tokenList });\n },\n onRemoveToken,\n refresh: () => {\n refresh();\n },\n }}\n >\n {children}\n </TokenContext.Provider>\n );\n}\n","import useSWR from \"swr\";\n\nimport { useBeraWallet, useConfig } from \"@berachain/wagmi/hooks\";\n\nimport { getEnsoClient } from \"~/actions/clients/getEnsoClient\";\nimport { getEnsoUserTokensWithBalances } from \"~/actions/enso/getEnsoUserTokensWithBalances\";\nimport { POLLING } from \"~/enum/polling\";\nimport type { BalanceToken } from \"~/types/dex\";\nimport type { DefaultHookOptions } from \"~/types/global\";\n\nexport function useEnsoUserTokensWithBalances(\n { chainId }: { chainId?: number } = {},\n options?: DefaultHookOptions,\n) {\n const { address: fromAddress } = useBeraWallet();\n const wagmiConfig = useConfig();\n const isEnabled = !!fromAddress && (options?.opts?.isEnabled ?? true);\n\n const QUERY_KEY =\n isEnabled && wagmiConfig\n ? ([\"useEnsoUserTokensWithBalances\", fromAddress, chainId] as const)\n : null;\n\n const swrResponse = useSWR(\n QUERY_KEY,\n async ([, fromAddress, chainId]): Promise<BalanceToken[]> =>\n getEnsoUserTokensWithBalances({\n account: fromAddress,\n wagmiConfig,\n chainId: chainId ?? \"all\",\n ensoClient: getEnsoClient(),\n }),\n {\n refreshInterval: POLLING.NORMAL,\n isEnabled,\n ...options?.opts,\n },\n );\n return {\n ...swrResponse,\n refresh: () => swrResponse.mutate(),\n };\n}\n","import type { EnsoClient } from \"@ensofinance/sdk\";\nimport { type Config, getChains, multicall } from \"@wagmi/core\";\nimport { type Address, formatUnits } from \"viem\";\n\nimport { BeraMonitoring } from \"~/errors/BeraMonitoring\";\nimport { InvalidArgumentError } from \"~/errors/InvalidArgumentError\";\nimport { initBeraError } from \"~/errors/initBeraError\";\nimport type { BalanceToken } from \"~/types/dex\";\nimport { beraToken, isToken } from \"~/utils/tokens\";\nimport { getBalanceCall } from \"../tokens/getWalletBalances\";\n\n/**\n * Get user balances for each supported chain.\n *\n * This uses enso's balance endpoint to get the balances and RPC to get fresh balances.\n */\nexport async function getEnsoUserTokensWithBalances({\n account,\n wagmiConfig,\n chainId,\n ensoClient,\n}: {\n account: Address;\n wagmiConfig: Config;\n chainId: number | \"all\";\n ensoClient: EnsoClient;\n}): Promise<BalanceToken[]> {\n const ensoBalances = await ensoClient.getBalances({\n useEoa: true,\n chainId: chainId ?? \"all\",\n eoaAddress: account,\n });\n\n const tokens: BalanceToken[] = ensoBalances.map(\n (balance) =>\n ({\n name: balance.name,\n symbol: balance.symbol,\n decimals: balance.decimals,\n address: isToken(balance.token, \"ETH\")\n ? beraToken.address\n : balance.token,\n logoURI: balance.logoUri,\n balance: {\n raw: balance.amount.toString(),\n formatted: formatUnits(BigInt(balance.amount), balance.decimals),\n },\n\n chainId: Number(\n // @ts-expect-error - balance.chainId is defined just not typed by enso\n balance.chainId,\n ),\n price: Number(balance.price),\n }) as const satisfies BalanceToken,\n );\n\n const tokenByChainId = Object.groupBy(tokens, (a) => a.chainId ?? 0);\n\n const balances = await Promise.allSettled(\n Object.entries(tokenByChainId).map(async ([chainId, chainTokens]) => {\n if (!chainTokens) return undefined;\n const chainConfig = getChains(wagmiConfig).find(\n (chain) => chain.id === Number(chainId),\n );\n\n if (!chainConfig) {\n // if we've queried a chain that is not supported, we need to return undefined\n return undefined;\n }\n\n const multicall3 = chainConfig.contracts?.multicall3;\n\n const multicallAddress = multicall3?.address;\n\n if (!multicallAddress) {\n // if multicall is not supported on this chain, we need to use the enso balance\n // first let's report the error, as this is likely unexpected\n BeraMonitoring.captureException(\n new InvalidArgumentError({\n property: \"multicallAddress\",\n value: multicallAddress,\n expected: \"Address\",\n chainId: Number(chainId),\n }),\n );\n\n // we can return the tokens as is, as the balance is already set from the enso client\n return chainTokens;\n }\n\n const balances = await multicall(wagmiConfig, {\n chainId: Number(chainId),\n contracts: chainTokens.map((token) =>\n getBalanceCall({\n token,\n account,\n multicallAddress,\n }),\n ),\n allowFailure: true,\n });\n\n const tokensWithBalances: BalanceToken[] = [];\n\n for (let index = 0; index < chainTokens.length; index++) {\n const token = chainTokens[index];\n if (balances[index].status === \"success\") {\n const balance = balances[index].result;\n\n tokensWithBalances.push({\n ...token,\n balance: {\n raw: balance?.toString() ?? \"0\",\n formatted: formatUnits(balance ?? 0n, token.decimals),\n },\n });\n } else {\n console.error(\"error getting balance\", balances[index].error);\n BeraMonitoring.captureException(\n initBeraError({ cause: balances[index].error }),\n );\n // uses enso balance as fallback\n tokensWithBalances.push(token);\n }\n }\n\n return tokensWithBalances;\n }),\n );\n\n const flattenedBalances: BalanceToken[] = [];\n for (const result of balances) {\n if (result.status === \"fulfilled\") {\n flattenedBalances.push(...(result.value ?? []));\n } else {\n BeraMonitoring.captureException(initBeraError({ cause: result.reason }));\n }\n }\n\n return flattenedBalances.sort((a, b) => {\n const aValue = Number(a.balance.formatted) * (a.price ?? 0);\n const bValue = Number(b.balance.formatted) * (b.price ?? 0);\n return bValue - aValue;\n });\n}\n","import type { Token, TokenWithMetadata } from \"../types/dex\";\nimport { isToken } from \"./tokens\";\n\nexport interface FormatTokenListReturnType {\n /**\n * Token list including custom tokens\n */\n tokenList: Token[];\n /**\n * Custom token list (added by the user)\n */\n customTokenList?: Token[];\n /**\n * Featured token list\n */\n featuredTokenList?: Token[];\n}\n\nfunction formatTokenList({\n defaultTokenList = [],\n externalList = [],\n}: {\n defaultTokenList: TokenWithMetadata[];\n externalList?: Token[];\n}): FormatTokenListReturnType {\n if (defaultTokenList.length === 0) {\n return {\n tokenList: externalList,\n customTokenList: externalList,\n featuredTokenList: [],\n };\n }\n\n const defaultList = defaultTokenList.map((token) => {\n return { ...token, default: true };\n });\n\n const featuredTokenList = defaultList.filter((token) => {\n return token.tags?.some((tag) => tag === \"featured\");\n });\n\n const mergedList = [...defaultList, ...externalList];\n\n const uniqueList = mergedList.filter(\n (item, index) => mergedList.findIndex((i) => isToken(i, item)) === index,\n );\n\n return {\n tokenList: uniqueList,\n customTokenList: externalList,\n featuredTokenList,\n };\n}\n\nexport { formatTokenList };\n","import { type Config, getPublicClient } from \"@wagmi/core\";\nimport type { Address } from \"viem\";\n\nimport type { TransactionActionType } from \"~/enum/txnEnum\";\nimport { BeraMonitoring } from \"~/errors/BeraMonitoring\";\nimport { InvalidArgumentError } from \"~/errors/InvalidArgumentError\";\nimport { initBeraError } from \"~/errors/initBeraError\";\n\nconst storageKeyLegacy = \"rk-transactions\";\nconst storageKey = \"transactions\";\n\nexport type TransactionStatus = \"pending\" | \"confirmed\" | \"failed\";\n\nexport interface Transaction {\n hash: string;\n description: string;\n actionType?: TransactionActionType;\n timestamp: number;\n status: TransactionStatus;\n confirmations?: number;\n chainId: number;\n}\n\nexport type NewTransaction = Omit<Transaction, \"status\">;\n\nexport type DataLegacy = Record<\n string,\n Record<number, Transaction[] | undefined>\n>;\nexport type Data = Record<string, Transaction[] | undefined>;\n\nexport function safeParseJsonData<T = DataLegacy | Data>(\n string: string | null,\n): T {\n try {\n const value = string ? JSON.parse(string) : {};\n return typeof value === \"object\" ? value : {};\n } catch {\n return {} as T;\n }\n}\n/**\n *\n * @param legacyData - The legacy data to convert to the new data format.\n * removes the nested chains and converts the data to a flat array.\n * @returns Data in the new format with the chainId added to each transaction.\n */\nexport function convertLegacyDataToNewData(legacyData: DataLegacy): Data {\n return Object.entries(legacyData).reduce((acc, [account, chains]) => {\n return {\n ...acc,\n [account]: Object.entries(chains).reduce(\n (acc, [chainId, transactions]) => {\n if (!transactions) {\n return acc;\n }\n const transactionsArray = transactions.map(\n (transaction): Transaction => ({\n ...transaction,\n chainId: Number(chainId),\n }),\n );\n acc.push(...transactionsArray);\n return acc;\n },\n [] as NewTransaction[],\n ),\n };\n }, {});\n}\n\n/**\n * Filter out duplicate transactions by hash\n */\nexport const filterDuplicatefn = (\n tx: Transaction,\n idx: number,\n arr: Transaction[],\n) => arr.findIndex((otherTx) => otherTx.hash === tx.hash) === idx;\n\nexport function mergeData(legacyData: DataLegacy, newData: Data): Data {\n const mergedData = convertLegacyDataToNewData(legacyData);\n for (const [account, transactions] of Object.entries(newData)) {\n if (mergedData[account] && transactions) {\n // Merge and filter out duplicates by transaction hash\n mergedData[account] = [...transactions, ...mergedData[account]].filter(\n filterDuplicatefn,\n );\n } else {\n mergedData[account] = transactions?.filter(filterDuplicatefn);\n }\n }\n return mergedData;\n}\nfunction loadData(): Data {\n const legacyData = safeParseJsonData<DataLegacy>(\n typeof localStorage !== \"undefined\"\n ? localStorage.getItem(storageKeyLegacy)\n : null,\n );\n const data = safeParseJsonData<Data>(\n typeof localStorage !== \"undefined\"\n ? localStorage.getItem(storageKey)\n : null,\n );\n return mergeData(legacyData, data);\n}\n\nconst transactionHashRegex = /^0x([A-Fa-f0-9]{64})$/;\n\nfunction validateTransaction(transaction: Transaction | NewTransaction): void {\n if (!transactionHashRegex.test(transaction.hash)) {\n throw new InvalidArgumentError({\n property: \"hash\",\n value: transaction.hash,\n expected: \"TransactionHash\",\n });\n }\n\n if (typeof transaction.description !== \"string\") {\n throw new InvalidArgumentError({\n property: \"description\",\n value: transaction.description,\n expected: \"string\",\n });\n }\n\n if (\n typeof transaction.confirmations !== \"undefined\" &&\n (!Number.isInteger(transaction.confirmations) ||\n transaction.confirmations < 1)\n ) {\n throw new InvalidArgumentError({\n property: \"confirmations\",\n value: transaction.confirmations,\n expected: \"positive integer\",\n });\n }\n}\n\nexport function createTransactionStore({ config }: { config: Config }) {\n let data: Data = loadData();\n const listeners: Set<() => void> = new Set();\n const transactionRequestCache: Map<string, Promise<void>> = new Map();\n\n function getTransactions(account: string): Transaction[] {\n return data[account] ?? [];\n }\n\n function addTransaction(account: string, transaction: NewTransaction): void {\n const normalized: Transaction = { ...transaction, status: \"pending\" };\n\n try {\n validateTransaction(normalized);\n\n updateTransactions(account, (transactions) => {\n return [\n normalized,\n ...transactions.filter(({ hash }) => {\n // Omit any duplicate transactions\n return hash !== normalized.hash;\n }),\n ];\n });\n } catch (error) {\n BeraMonitoring.captureException(initBeraError({ cause: error }));\n }\n }\n\n function clearTransactions(account: string): void {\n updateTransactions(account, () => {\n return [];\n });\n }\n\n function setTransactionStatus(\n account: string,\n hash: string,\n status: TransactionStatus,\n ): void {\n updateTransactions(account, (transactions) => {\n return transactions.map((transaction) =>\n transaction.hash === hash ? { ...transaction, status } : transaction,\n );\n });\n }\n\n async function refreshPendingTransactions(account: string): Promise<void> {\n const pendingTransactions = getTransactions(account).filter(\n (transaction) => transaction.status === \"pending\",\n );\n\n await Promise.allSettled(\n pendingTransactions.map(async (transaction) => {\n const { confirmations, hash, chainId } = transaction;\n const existingRequest = transactionRequestCache.get(hash);\n\n if (existingRequest) {\n return await existingRequest;\n }\n\n const provider = getPublicClient(config, { chainId });\n if (!provider) {\n return;\n }\n\n const requestPromise = provider\n .waitForTransactionReceipt({ confirmations, hash: hash as Address })\n .then(({ status }) => {\n if (status === undefined) {\n return;\n }\n\n setTransactionStatus(\n account,\n hash,\n Number(status) === 0 ? \"failed\" : \"confirmed\",\n );\n })\n .catch((error) => {\n BeraMonitoring.captureException(initBeraError({ cause: error }));\n })\n .finally(() => {\n transactionRequestCache.delete(hash);\n });\n\n transactionRequestCache.set(hash, requestPromise);\n\n return await requestPromise;\n }),\n );\n }\n\n function updateTransactions(\n account: string,\n updateFn: (transactions: Transaction[]) => Transaction[],\n ): void {\n // Ensure we’re always operating on the latest data in case we have\n // multiple instances/tabs/etc. since we write all data back to\n // local storage after updating\n data = loadData();\n\n data[account] = data[account] ?? [];\n\n const MAX_TRANSACTIONS = 10;\n const updatedTransactions = updateFn(data?.[account] ?? []);\n\n const transactions = updatedTransactions\n // Sort by timestamp (latest first) and keep only the latest 10\n .sort((a, b) => b.timestamp - a.timestamp)\n .slice(0, MAX_TRANSACTIONS);\n\n data[account] =\n transactions.length > 0\n ? transactions.filter(filterDuplicatefn)\n : undefined;\n\n persistData();\n notifyListeners();\n }\n\n function persistData(): void {\n if (typeof localStorage === \"undefined\") {\n return;\n }\n\n localStorage.setItem(storageKey, JSON.stringify(data));\n // remove legacy data now that it has been converted to the new data format and saved to the new key\n localStorage.removeItem(storageKeyLegacy);\n }\n\n function notifyListeners(): void {\n for (const listener of listeners) {\n listener();\n }\n }\n\n function onChange(fn: () => void): () => void {\n listeners.add(fn);\n\n return () => {\n listeners.delete(fn);\n };\n }\n\n return {\n addTransaction,\n clearTransactions,\n getTransactions,\n onChange,\n refreshPendingTransactions,\n setTransactionStatus,\n };\n}\n\nexport type TransactionStore = ReturnType<typeof createTransactionStore>;\n","import type React from \"react\";\nimport { createContext, useContext, useEffect, useState } from \"react\";\n\nimport { useBeraWagmi, useConfig } from \"@berachain/wagmi/hooks\";\n\nimport {\n createTransactionStore,\n type TransactionStore,\n} from \"../hooks/transactions/transactionStore\";\n\n// Only allow a single instance of the store to exist at once\n// so that multiple RainbowKitProvider instances can share the same store.\n// We delay the creation of the store until the first time it is used\n// so that it always has access to a provider.\nlet storeSingleton: ReturnType<typeof createTransactionStore> | undefined;\n\nconst TransactionStoreContext = createContext<TransactionStore | null>(null);\n\nexport function TransactionStoreProvider({\n children,\n}: {\n children: React.ReactNode;\n}) {\n const { account } = useBeraWagmi();\n const address = account?.wallet?.address;\n const config = useConfig();\n\n // Use existing store if it exists, or lazily create one\n const [store] = useState(\n () =>\n storeSingleton ??\n (storeSingleton = createTransactionStore({\n config,\n })),\n );\n\n // Refresh pending transactions when address changes and periodically after.\n useEffect(() => {\n if (!address) {\n return;\n }\n\n const refresh = () => {\n void store.refreshPendingTransactions(address);\n };\n\n refresh();\n\n // periodic refresh catches pending txs loaded from storage when no useTxn callbacks will fire.\n // and are also not caught by the visibilitychange event when still pending.\n const intervalId = setInterval(refresh, 120_000);\n\n // refresh txs when the tab becomes visible again to catch txs confirmed while hidden.\n const onVisibilityChange = () => {\n if (document.visibilityState === \"visible\") {\n refresh();\n }\n };\n\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n }\n\n return () => {\n clearInterval(intervalId);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n };\n }, [store, address]);\n\n return (\n <TransactionStoreContext.Provider value={store}>\n {children}\n </TransactionStoreContext.Provider>\n );\n}\n\nexport function useTransactionStore(): TransactionStore {\n const store = useContext(TransactionStoreContext);\n\n if (!store) {\n throw new Error(\"Transaction hooks must be used within \");\n }\n\n return store;\n}\n"],"mappings":"gPAAA,OAAS,iBAAAA,EAAe,cAAAC,MAAkB,QAE1C,OAEE,iBAAAC,MACK,yCAiCH,cAAAC,MAAA,oBAhBJ,IAAMC,EAAkBC,EACtB,MACF,EAEO,SAASC,GAAkB,CAChC,SAAAC,EACA,MAAAC,EACA,YAAAC,EACA,gBAAAC,EAAkB,KACpB,EAKG,CACD,OACEP,EAACC,EAAgB,SAAhB,CACC,MAAO,CACL,GAAGO,EACH,GAAGH,EACH,YAAaC,EACT,OAAO,QAAQA,CAAW,EACvB,OAAO,CAAC,CAAC,CAAEG,CAAK,IAAMC,EAAcD,CAAK,CAAC,EAC1C,IAAI,CAAC,CAACE,CAAG,IAAMA,CAAG,EACrB,OACJ,gBAAAJ,CACF,EAEC,SAAAH,EACH,CAEJ,CAEO,SAASQ,GAAe,CAC7B,IAAMC,EAAUC,EAAWb,CAAe,EAC1C,GAAI,CAACY,EACH,MAAM,IAAI,MAAM,6BAA6B,EAE/C,OAAOA,CACT,CAEO,SAASE,GACdJ,EAC2B,CAE3B,OADcC,EAAa,EACdD,CAAG,CAClB,CCpEA,OACE,iBAAAK,GAIA,cAAAC,GACA,YAAAC,OACK,QA4FH,cAAAC,OAAA,oBAhEG,IAAMC,EAAkBC,GAc5B,CACD,SAAU,CACR,SAAU,GACV,UAAW,CACT,iBAAkB,UAClB,SAAU,UACV,UAAW,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AAS,gBAAAC,GAAc,aAAAC,OAAiB,yBAqEpC,cAAAC,OAAA,oBA1DJ,IAAIC,EAEEC,EAA0BC,GAAuC,IAAI,EAEpE,SAASC,GAAyB,CACvC,SAAAC,CACF,EAEG,CACD,GAAM,CAAE,QAAAC,CAAQ,EAAIC,GAAa,EAC3BC,EAAUF,GAAS,QAAQ,QAC3BG,EAASC,GAAU,EAGnB,CAACC,CAAK,EAAIC,GACd,IACEX,IACCA,EAAiBY,EAAuB,CACvC,OAAAJ,CACF,CAAC,EACL,EAGA,OAAAK,GAAU,IAAM,CACd,GAAI,CAACN,EACH,OAGF,IAAMO,EAAU,IAAM,CACfJ,EAAM,2BAA2BH,CAAO,CAC/C,EAEAO,EAAQ,EAIR,IAAMC,EAAa,YAAYD,EAAS,IAAO,EAGzCE,EAAqB,IAAM,CAC3B,SAAS,kBAAoB,WAC/BF,EAAQ,CAEZ,EAEA,OAAI,OAAO,SAAa,KACtB,SAAS,iBAAiB,mBAAoBE,CAAkB,EAG3D,IAAM,CACX,cAAcD,CAAU,EACpB,OAAO,SAAa,KACtB,SAAS,oBAAoB,mBAAoBC,CAAkB,CAEvE,CACF,EAAG,CAACN,EAAOH,CAAO,CAAC,EAGjBR,GAACE,EAAwB,SAAxB,CAAiC,MAAOS,EACtC,SAAAN,EACH,CAEJ,CAEO,SAASa,IAAwC,CACtD,IAAMP,EAAQQ,GAAWjB,CAAuB,EAEhD,GAAI,CAACS,EACH,MAAM,IAAI,MAAM,wCAAwC,EAG1D,OAAOA,CACT","names":["createContext","useContext","isFlagEnabled","jsx","BeraFlagContext","createContext","BeraFlagsProvider","children","flags","aggregators","swberaAprWindow","defaultFlags","value","isFlagEnabled","key","useBeraFlags","context","useContext","useBeraFlag","createContext","useContext","useState","jsx","BexStateContext","createContext","useBexStatus","context","useContext","BeraError","BexStatusProvider","children","isVaultPaused","labels","factories","poolState","setPoolState","useState","disablePoolWithdrawals","disablePoolDeposits","createContext","useContext","mainnet","jsx","useBlockTime","useContext","BlockTimeContext","createContext","mainnet","BlockTimeProvider","children","blockTime","args","config","parseBaseArgs","createContext","useContext","jsx","HoneyConfigContext","HoneyConfigProvider","children","props","useHoneyConfig","context","createContext","useMemo","isFlagEnabled","useSWR","useBeraWallet","useConfig","getChains","multicall","formatUnits","getEnsoUserTokensWithBalances","account","wagmiConfig","chainId","ensoClient","tokens","balance","isToken","beraToken","formatUnits","tokenByChainId","balances","chainTokens","chainConfig","getChains","chain","multicallAddress","BeraMonitoring","InvalidArgumentError","multicall","token","getBalanceCall","tokensWithBalances","index","initBeraError","flattenedBalances","result","b","aValue","useEnsoUserTokensWithBalances","chainId","options","fromAddress","useBeraWallet","wagmiConfig","useConfig","isEnabled","swrResponse","useSWR","getEnsoUserTokensWithBalances","getEnsoClient","formatTokenList","defaultTokenList","externalList","defaultList","token","featuredTokenList","tag","mergedList","item","index","i","isToken","jsx","TokenContext","createContext","TokensProvider","children","defaultTokens","edgeConfigTokenList","userTokens","onAddToken","onRemoveToken","ensoTokens","refresh","useEnsoUserTokensWithBalances","tokenList","featuredTokenList","useMemo","formatTokenList","token","isFlagEnabled","t","tk","getPublicClient","storageKeyLegacy","storageKey","safeParseJsonData","string","value","convertLegacyDataToNewData","legacyData","acc","account","chains","chainId","transactions","transactionsArray","transaction","filterDuplicatefn","tx","idx","arr","otherTx","mergeData","newData","mergedData","loadData","data","transactionHashRegex","validateTransaction","InvalidArgumentError","createTransactionStore","config","listeners","transactionRequestCache","getTransactions","addTransaction","normalized","updateTransactions","hash","error","BeraMonitoring","initBeraError","clearTransactions","setTransactionStatus","status","refreshPendingTransactions","pendingTransactions","confirmations","existingRequest","provider","getPublicClient","requestPromise","updateFn","a","persistData","notifyListeners","listener","onChange","fn","createContext","useContext","useEffect","useState","useBeraWagmi","useConfig","jsx","storeSingleton","TransactionStoreContext","createContext","TransactionStoreProvider","children","account","useBeraWagmi","address","config","useConfig","store","useState","createTransactionStore","useEffect","refresh","intervalId","onVisibilityChange","useTransactionStore","useContext"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/pong/coding/monobera/packages/berajs/dist/chunk-BOYZVULX.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-BOYZVULX.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 \"~/errors/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"]}
@@ -1,2 +0,0 @@
1
- var u="Something went wrong. Please try again later.",p={ERC20:{NOT_ENOUGH_BALANCE:{reasons:["NotEnoughBalance"],errorMSG:"You do not have enough balance to perform this action."},InsufficientBalance:{reasons:["InsufficientBalance"],errorMSG:"Insufficient token balance"},INSUFFICIENT_ALLOWANCE:{reasons:["0x13be252b","InsufficientAllowance","ERC20InsufficientAllowance"],errorMSG:"You do not have enough allowance to perform this action."},SIGNATURE_EXPIRED:{reasons:["SignatureExpired"],errorMSG:"Transaction took too long to complete. Please try again."}},HTTP:{RATE_LIMITED_429:{reasons:["429"],errorMSG:"Too many requests. Please try again later."}},ENSO:{COULD_NOT_BUILD_SHORTCUT:{keywords:["Could not build shortcuts for route","Could not quote shortcuts for route"],errorMSG:"There was an error building the zap route. Try with lower amounts."},NOT_ENOUGH_LIQUIDITY:{keywords:["Swap not found for a required underlying of defi route, please make sure your amountIn is within an acceptable range"],errorMSG:"The amount you\u2019re trying to swap might be too high. Please make sure that your amount is within an acceptable range."},NO_ROUTE_FOUND:{keywords:["No route found from"],errorMSG:"No swap route found for the given tokens."}},RPC:{INSUFFICIENT_FUNDS:{reasons:["InsufficientFundsError"],keywords:["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."],errorMSG:"Insufficient BERA balance to perform this action."},GAS_PRICE:{keywords:["gasLimit"],errorMSG:"It seems an RPC error has occurred while estimating gas. Please try your request later."},JSON_RPC:{keywords:["JSON-RPC"],errorMSG:"It seems an RPC error has occurred. Please try your request one more later."},NOT_ENOUGH_GAS:{keywords:["insufficient funds for gas * price + value:"],errorMSG:"Gas balance is insufficient to cover the transaction cost."},HASH:{keywords:["hash"],errorMSG:"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again."},USER_REJECTION:{reasons:["UserRejectedRequestError"],keywords:["User denied transaction signature"],errorMSG:"You rejected the transaction."},SMART_UPGRADE_REJECTION:{reasons:["AtomicReadyWalletRejectedUpgradeError"],errorMSG:"You've declined to upgrade to batch transactions for now, try again for the traditional method."},CHAIN_MISMATCH:{reasons:["ChainMismatchError"],errorMSG:"Wallet seems to be on the wrong chain, please refresh the page and try again."}},EIP7702:{SESSION_KEY_EXPIRED:{reasons:["SessionKeyExpired"],errorMSG:"Session key has expired. Please create a new one."},CALL_POLICY_VIOLATED:{reasons:["CallPolicyViolated"],errorMSG:"Call policy violated. Please check your call policies."}},HONEY:{BLACKLISTED_WALLET:{reasons:["BlacklistedWallet","0x265693b4"],errorMSG:"Your wallet is blacklisted from minting or redeeming HONEY."},LIQUIDITY_ERROR:{reasons:["0x4656425a"],errorMSG:"You are trying to redeem more than the liquidity available in the vault."}},BEX:{SLIPPAGE_EXCEEDED:{reasons:["SlippageExceeded","TooMuchSlippage"],errorMSG:"Price changed while executing the transaction and exceeded the allowed slippage."},BAL000:{reasons:["BAL#000"],errorMSG:"Addition overflow occurred during calculation. (BEX#000)"},BAL001:{reasons:["BAL#001"],errorMSG:"Subtraction overflow occurred during calculation. (BEX#001)"},BAL002:{reasons:["BAL#002"],errorMSG:"Subtraction underflow occurred during calculation. (BEX#002)"},BAL003:{reasons:["BAL#003"],errorMSG:"Multiplication overflow occurred during calculation. (BEX#003)"},BAL004:{reasons:["BAL#004"],errorMSG:"Attempted division by zero. (BEX#004)"},BAL005:{reasons:["BAL#005"],errorMSG:"Multiplication overflow during FixedPoint Division. (BEX#005)"},BAL006:{reasons:["BAL#006"],errorMSG:"Invalid x in ExpMath.pow(x, y). (BEX#006)"},BAL007:{reasons:["BAL#007"],errorMSG:"Invalid y in ExpMath.pow(x, y). (BEX#007)"},BAL008:{reasons:["BAL#008"],errorMSG:"In LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x)). (BEX#008)"},BAL009:{reasons:["BAL#009"],errorMSG:"In LogExpMath.exp(x) = e^x; x out of bounds. (BEX#009)"},BAL100:{reasons:["BAL#100"],errorMSG:"Value is out of acceptable bounds. (BEX#100)"},BAL101:{reasons:["BAL#101"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#101)"},BAL102:{reasons:["BAL#102"],errorMSG:"Tokens must be sorted in address order on pool registration. (BEX#102)"},BAL103:{reasons:["BAL#103"],errorMSG:"Parallel array inputs must have the same length. (BEX#103)"},BAL104:{reasons:["BAL#104"],errorMSG:"Address to be interpreted as a token cannot be 0. (BEX#104)"},BAL105:{reasons:["BAL#105"],errorMSG:"Insufficient byte length. (BEX#105)"},BAL200:{reasons:["BAL#200"],errorMSG:"All pools must contain at least two tokens. (BEX#200)"},BAL201:{reasons:["BAL#201"],errorMSG:"Token count exceeds the maximum for a given pool type. (BEX#201)"},BAL202:{reasons:["BAL#202"],errorMSG:"Swap fee percentage exceeds the maximum allowed. (BEX#202)"},BAL203:{reasons:["BAL#203"],errorMSG:"Swap fee percentage is below the minimum allowed. (BEX#203)"},BAL204:{reasons:["BAL#204"],errorMSG:"Pool initialization failed: a small amount of BPT is minted to the zero address to maintain mathematical consistency. If initial balances are too low, the initialization process may fail. (BEX#204)"},BAL205:{reasons:["BAL#205"],errorMSG:"User attempted to execute a callback intended for the vault contract. (BEX#205)"},BAL206:{reasons:["BAL#206"],errorMSG:"Pools must be initialized with a special 'Init' join, before they can be joined by LPs. (BEX#206)"},BAL207:{reasons:["BAL#207"],errorMSG:"Slippage/front-running protection check failed on a pool exit. (BEX#207)"},BAL208:{reasons:["BAL#208"],errorMSG:"Minimum BPT output amount not met. (BEX#208)"},BAL209:{reasons:["BAL#209"],errorMSG:"Slippage/front-running protection check failed on a pool join. (BEX#209)"},BAL210:{reasons:["BAL#210"],errorMSG:"Pools with oracles are limited to two tokens. A pool with the TWO_TOKEN specialization must have exactly two tokens. (BEX#210)"},BAL211:{reasons:["BAL#211"],errorMSG:"The pool factory is disabled and new pools cannot be created at this time. (BEX#211)"},BAL300:{reasons:["BAL#300"],errorMSG:"The amplification parameter is below the minimum allowed. (BEX#300)"},BAL301:{reasons:["BAL#301"],errorMSG:"The amplification parameter exceeds the maximum allowed. (BEX#301)"},BAL302:{reasons:["BAL#302"],errorMSG:"The weight parameter is below the minimum allowed. (BEX#302)"},BAL303:{reasons:["BAL#303"],errorMSG:"The number of stable tokens exceeds the maximum allowed. (BEX#303)"},BAL304:{reasons:["BAL#304"],errorMSG:"The amount of tokens in would unbalance the pool. (BEX#304)"},BAL305:{reasons:["BAL#305"],errorMSG:"The amount of tokens out would unbalance the pool. (BEX#305)"},BAL306:{reasons:["BAL#306"],errorMSG:"Disproportionate pool exit would unbalance the pool. (BEX#306)"},BAL307:{reasons:["BAL#307"],errorMSG:"Disproportionate pool join would unbalance the pool. (BEX#307)"},BAL308:{reasons:["BAL#308"],errorMSG:"Normalized weights do not add to 1.0 exactly. (BEX#308)"},BAL309:{reasons:["BAL#309"],errorMSG:"Invalid token provided for operation. (BEX#309)"},BAL310:{reasons:["BAL#310"],errorMSG:"Unhandled pool join operation for this pool type. (BEX#310)"},BAL311:{reasons:["BAL#311"],errorMSG:"Pool balances must be > 0. (BEX#311)"},BAL312:{reasons:["BAL#312"],errorMSG:"Invalid query for oracle data ('ago' timestamp was not in the past). (BEX#312)"},BAL313:{reasons:["BAL#313"],errorMSG:"Oracle has no data to query. (BEX#313)"},BAL314:{reasons:["BAL#314"],errorMSG:"Oracle query data is before its earliest data sample. (BEX#314)"},BAL315:{reasons:["BAL#315"],errorMSG:"Cannot query an oracle sample outside the buffer of 1024. (BEX#315)"},BAL316:{reasons:["BAL#316"],errorMSG:"Oracle query window must have non-zero duration. (BEX#316)"},BAL317:{reasons:["BAL#317"],errorMSG:"Amplification parameter change has less than the minimum duration. (BEX#317)"},BAL318:{reasons:["BAL#318"],errorMSG:"Cannot start an amplification parameter update if one is already ongoing. (BEX#318)"},BAL319:{reasons:["BAL#319"],errorMSG:"The requested amplification parameter change is too fast (cannot halve or double over less than a day). (BEX#319)"},BAL320:{reasons:["BAL#320"],errorMSG:"Cannot cancel an update if there isn't one already ongoing. (BEX#320)"},BAL321:{reasons:["BAL#321"],errorMSG:"Stable pool invariant calculation did not converge. (BEX#321)"},BAL322:{reasons:["BAL#322"],errorMSG:"Stable pool balance calculation did not converge. (BEX#322)"},BAL323:{reasons:["BAL#323"],errorMSG:"Relayer must be a valid contract. (BEX#323)"},BAL324:{reasons:["BAL#324"],errorMSG:"Base pool relayer was not called correctly. (BEX#324)"},BAL325:{reasons:["BAL#325"],errorMSG:"Rebalancing relayer operation re-entered unexpectedly. (BEX#325)"},BAL326:{reasons:["BAL#326"],errorMSG:"Detected time travel in gradual updates (start > end time in a gradual weights update). (BEX#326)"},BAL327:{reasons:["BAL#327"],errorMSG:"Swaps are disabled for this pool. (BEX#327)"},BAL328:{reasons:["BAL#328"],errorMSG:"Caller is not the owner of the LBP. (BEX#328)"},BAL329:{reasons:["BAL#329"],errorMSG:"Rate returned from a rateProvider must fit within 128 bits. (BEX#329)"},BAL330:{reasons:["BAL#330"],errorMSG:"Investment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool). (BEX#330)"},BAL331:{reasons:["BAL#331"],errorMSG:"Gradual weight update duration too short (minimum 1 day). (BEX#331)"},BAL332:{reasons:["BAL#332"],errorMSG:"Invalid Linear Pool operating range. (BEX#332)"},BAL333:{reasons:["BAL#333"],errorMSG:"Linear Pool max balance must fit in 112 bits. (BEX#333)"},BAL334:{reasons:["BAL#334"],errorMSG:"Unhandled pool join/exit operation for linear pool type. (BEX#334)"},BAL335:{reasons:["BAL#335"],errorMSG:"Cannot reset Linear Pool targets if pool is unbalanced. (BEX#335)"},BAL336:{reasons:["BAL#336"],errorMSG:"Unhandled pool exit operation for this pool type. (BEX#336)"},BAL337:{reasons:["BAL#337"],errorMSG:"Management fees can only be collected by the pool owner. (BEX#337)"},BAL338:{reasons:["BAL#338"],errorMSG:"Management swap fee percentage exceeded the maximum. (BEX#338)"},BAL339:{reasons:["BAL#339"],errorMSG:"Unhandled pool join/exit operation for managed pool type. (BEX#339)"},BAL340:{reasons:["BAL#340"],errorMSG:"Unhandled pool join/exit operation for phantom pool type. (BEX#340)"},BAL341:{reasons:["BAL#341"],errorMSG:"Token does not have a valid rate provider. (BEX#341)"},BAL342:{reasons:["BAL#342"],errorMSG:"Invalid pool initialization parameters provided. (BEX#342)"},BAL343:{reasons:["BAL#343"],errorMSG:"Value is out of the new target range for the operation. (BEX#343)"},BAL344:{reasons:["BAL#344"],errorMSG:"This feature is currently disabled. (BEX#344)"},BAL345:{reasons:["BAL#345"],errorMSG:"The pool controller is uninitialized. (BEX#345)"},BAL346:{reasons:["BAL#346"],errorMSG:"Cannot set swap fee during an ongoing fee change. (BEX#346)"},BAL347:{reasons:["BAL#347"],errorMSG:"Cannot set swap fee during pending fee changes. (BEX#347)"},BAL348:{reasons:["BAL#348"],errorMSG:"Cannot change tokens during a weight change. (BEX#348)"},BAL349:{reasons:["BAL#349"],errorMSG:"Cannot change tokens during pending weight changes. (BEX#349)"},BAL350:{reasons:["BAL#350"],errorMSG:"Weight parameter exceeds the maximum allowed. (BEX#350)"},BAL351:{reasons:["BAL#351"],errorMSG:"Unauthorized join operation. (BEX#351)"},BAL352:{reasons:["BAL#352"],errorMSG:"Management AUM fee percentage exceeded the maximum allowed. (BEX#352)"},BAL353:{reasons:["BAL#353"],errorMSG:"Fractional target values are not supported. (BEX#353)"},BAL354:{reasons:["BAL#354"],errorMSG:"Adding or removing BPT is not allowed in this context. (BEX#354)"},BAL355:{reasons:["BAL#355"],errorMSG:"Invalid circuit breaker bounds configuration. (BEX#355)"},BAL356:{reasons:["BAL#356"],errorMSG:"The circuit breaker has been triggered. (BEX#356)"},BAL357:{reasons:["BAL#357"],errorMSG:"Malicious query detected and reverted. (BEX#357)"},BAL358:{reasons:["BAL#358"],errorMSG:"Joins and exits are currently disabled for this pool. (BEX#358)"},BAL400:{reasons:["BAL#400"],errorMSG:"Reentrancy detected. (BEX#400)"},BAL401:{reasons:["BAL#401"],errorMSG:"The sender is not allowed to perform this action. (BEX#401)"},BAL402:{reasons:["BAL#402"],errorMSG:"The contract is currently paused. (BEX#402)"},BAL403:{reasons:["BAL#403"],errorMSG:"The pause window has expired. (BEX#403)"},BAL404:{reasons:["BAL#404"],errorMSG:"The maximum pause window duration has been exceeded. (BEX#404)"},BAL405:{reasons:["BAL#405"],errorMSG:"The maximum buffer period duration has been exceeded. (BEX#405)"},BAL406:{reasons:["BAL#406"],errorMSG:"The account has insufficient balance. (BEX#406)"},BAL407:{reasons:["BAL#407"],errorMSG:"The account has insufficient allowance. (BEX#407)"},BAL408:{reasons:["BAL#408"],errorMSG:"ERC20: Transfer from zero address. (BEX#408)"},BAL409:{reasons:["BAL#409"],errorMSG:"ERC20: Transfer to zero address. (BEX#409)"},BAL410:{reasons:["BAL#410"],errorMSG:"ERC20: Mint to zero address. (BEX#410)"},BAL411:{reasons:["BAL#411"],errorMSG:"ERC20: Burn from zero address. (BEX#411)"},BAL412:{reasons:["BAL#412"],errorMSG:"ERC20: Approve from zero address. (BEX#412)"},BAL413:{reasons:["BAL#413"],errorMSG:"ERC20: Approve to zero address. (BEX#413)"},BAL414:{reasons:["BAL#414"],errorMSG:"ERC20: Transfer exceeds allowance. (BEX#414)"},BAL415:{reasons:["BAL#415"],errorMSG:"ERC20: Decreased allowance below zero. (BEX#415)"},BAL416:{reasons:["BAL#416"],errorMSG:"ERC20: Transfer exceeds balance. (BEX#416)"},BAL417:{reasons:["BAL#417"],errorMSG:"ERC20: Burn exceeds allowance. (BEX#417)"},BAL418:{reasons:["BAL#418"],errorMSG:"SafeERC20: Call failed. (BEX#418)"},BAL419:{reasons:["BAL#419"],errorMSG:"Address has insufficient balance. (BEX#419)"},BAL420:{reasons:["BAL#420"],errorMSG:"Address cannot send value. (BEX#420)"},BAL421:{reasons:["BAL#421"],errorMSG:"SafeCast: Value cannot fit into int256. (BEX#421)"},BAL422:{reasons:["BAL#422"],errorMSG:"AccessControl: Grant sender is not an admin. (BEX#422)"},BAL423:{reasons:["BAL#423"],errorMSG:"AccessControl: Revoke sender is not an admin. (BEX#423)"},BAL424:{reasons:["BAL#424"],errorMSG:"AccessControl: Renounce sender not allowed for accounts other than self. (BEX#424)"},BAL425:{reasons:["BAL#425"],errorMSG:"Buffer period has expired. (BEX#425)"},BAL426:{reasons:["BAL#426"],errorMSG:"Caller is not the owner. (BEX#426)"},BAL427:{reasons:["BAL#427"],errorMSG:"New owner cannot be zero address. (BEX#427)"},BAL428:{reasons:["BAL#428"],errorMSG:"Code deployment failed. (BEX#428)"},BAL429:{reasons:["BAL#429"],errorMSG:"Call to non-contract address. (BEX#429)"},BAL430:{reasons:["BAL#430"],errorMSG:"Low-level call failed. (BEX#430)"},BAL431:{reasons:["BAL#431"],errorMSG:"The contract is not paused. (BEX#431)"},BAL432:{reasons:["BAL#432"],errorMSG:"Address is already allowlisted. (BEX#432)"},BAL433:{reasons:["BAL#433"],errorMSG:"Address is not allowlisted. (BEX#433)"},BAL434:{reasons:["BAL#434"],errorMSG:"ERC20: Burn exceeds balance. (BEX#434)"},BAL435:{reasons:["BAL#435"],errorMSG:"Invalid operation. (BEX#435)"},BAL436:{reasons:["BAL#436"],errorMSG:"Codec overflow detected. (BEX#436)"},BAL437:{reasons:["BAL#437"],errorMSG:"The system is in recovery mode. (BEX#437)"},BAL438:{reasons:["BAL#438"],errorMSG:"The system is not in recovery mode. (BEX#438)"},BAL439:{reasons:["BAL#439"],errorMSG:"Induced failure. (BEX#439)"},BAL440:{reasons:["BAL#440"],errorMSG:"Expired signature. (BEX#440)"},BAL441:{reasons:["BAL#441"],errorMSG:"Malformed signature. (BEX#441)"},BAL442:{reasons:["BAL#442"],errorMSG:"SafeCast: Value cannot fit into uint64. (BEX#442)"},BAL443:{reasons:["BAL#443"],errorMSG:"Unhandled fee type. (BEX#443)"},BAL444:{reasons:["BAL#444"],errorMSG:"ERC20: Burn from zero address. (BEX#444)"},BAL500:{reasons:["BAL#500"],errorMSG:"Invalid pool ID. (BEX#500)"},BAL501:{reasons:["BAL#501"],errorMSG:"Caller is not the pool. (BEX#501)"},BAL502:{reasons:["BAL#502"],errorMSG:"Sender is not the asset manager. (BEX#502)"},BAL503:{reasons:["BAL#503"],errorMSG:"User does not allow the relayer. (BEX#503)"},BAL504:{reasons:["BAL#504"],errorMSG:"Invalid signature. (BEX#504)"},BAL505:{reasons:["BAL#505"],errorMSG:"Exit would yield fewer than the minimum tokens out. (BEX#505)"},BAL506:{reasons:["BAL#506"],errorMSG:"Join would cost more than the maximum tokens in. (BEX#506)"},BAL507:{reasons:["BAL#507"],errorMSG:"Swap violates user-supplied limits. (BEX#507)"},BAL508:{reasons:["BAL#508"],errorMSG:"Swap transaction not mined within the deadline. (BEX#508)"},BAL509:{reasons:["BAL#509"],errorMSG:"Cannot swap the same token. (BEX#509)"},BAL510:{reasons:["BAL#510"],errorMSG:"Unknown amount in the first swap of a batch. (BEX#510)"},BAL511:{reasons:["BAL#511"],errorMSG:"Malconstructed multihop swap. (BEX#511)"},BAL512:{reasons:["BAL#512"],errorMSG:"Internal balance overflow. (BEX#512)"},BAL513:{reasons:["BAL#513"],errorMSG:"Insufficient internal balance. (BEX#513)"},BAL514:{reasons:["BAL#514"],errorMSG:"Invalid BERA internal balance. (BEX#514)"},BAL515:{reasons:["BAL#515"],errorMSG:"Flashloan must repay the loan in the same transaction. (BEX#515)"},BAL516:{reasons:["BAL#516"],errorMSG:"Insufficient BERA balance. (BEX#516)"},BAL517:{reasons:["BAL#517"],errorMSG:"Unallocated BERA. (BEX#517)"},BAL518:{reasons:["BAL#518"],errorMSG:"Relayers cannot receive BERA directly (only through the Vault). (BEX#518)"},BAL519:{reasons:["BAL#519"],errorMSG:"Cannot use BERA sentinel for internal balance. (BEX#519)"},BAL520:{reasons:["BAL#520"],errorMSG:"Tokens mismatch. (BEX#520)"},BAL521:{reasons:["BAL#521"],errorMSG:"Token is not registered. (BEX#521)"},BAL522:{reasons:["BAL#522"],errorMSG:"Token is already registered. (BEX#522)"},BAL523:{reasons:["BAL#523"],errorMSG:"Tokens are already set. (BEX#523)"},BAL524:{reasons:["BAL#524"],errorMSG:"Tokens length must be 2. (BEX#524)"},BAL525:{reasons:["BAL#525"],errorMSG:"Nonzero token balance detected. (BEX#525)"},BAL526:{reasons:["BAL#526"],errorMSG:"Balance total overflow detected. (BEX#526)"},BAL527:{reasons:["BAL#527"],errorMSG:"Pool has no tokens. (BEX#527)"},BAL528:{reasons:["BAL#528"],errorMSG:"Insufficient flash loan balance. (BEX#528)"},BAL600:{reasons:["BAL#600"],errorMSG:"Swap fee percentage is too high. (BEX#600)"},BAL601:{reasons:["BAL#601"],errorMSG:"Flash loan fee percentage is too high. (BEX#601)"},BAL602:{reasons:["BAL#602"],errorMSG:"Insufficient flash loan fee amount. (BEX#602)"},BAL700:{reasons:["BAL#700"],errorMSG:"Splitter fee percentage is too high. (BEX#700)"},BAL998:{reasons:["BAL#998"],errorMSG:"Unimplemented functionality. (BEX#998)"},BAL999:{reasons:["BAL#999"],errorMSG:"An unexpected error occurred. (BEX#999)"},NO_SWAP_PATHS:{keywords:["No swap paths returned"],errorMSG:"No swap paths were found."}},AGGREGATOR:{NOT_ENOUGH_LIQUIDITY:{keywords:["Not enough liquidity"],errorMSG:"Not enough liquidity. Try a lower amount."}},POL:{REWARD_VAULT_FACTORY:{reasons:["VaultAlreadyExists"],errorMSG:"Failed to create action. An action already exists with this staking token."},NOT_REWARD_VAULT_MANAGER:{reasons:["NotRewardVaultManager"],errorMSG:"You are not the manager of this action."},NOT_INCENTIVE_MANAGER:{reasons:["NotIncentiveManager"],errorMSG:"You are not the incentive manager of this token."},DURATION_CHANGE_NOT_ALLOWED:{reasons:["DurationChangeNotAllowed"],errorMSG:"You cannot change the duration of this action."},INVALID_PROOF:{reasons:["InvalidProof"],errorMSG:"Tokens already claimed or invalid proof."},CONTRACT_PAUSED:{reasons:["EnforcedPause"],errorMSG:"The contract you're interacting with is temporarily paused."},DISTRIBUTION_PAUSED:{reasons:["DistributionEnforcedPause"],errorMSG:"Distribution is temporarily paused."},INVALID_VALIDATOR_COMMISSION:{reasons:["InvalidCommissionValue"],errorMSG:"Invalid commission percentage."},NOT_REWARD_ALLOCATOR:{reasons:["NotRewardAllocator"],errorMSG:"You are not the reward allocator of this validator."},NOT_OPERATOR:{reasons:["NotOperator"],errorMSG:"You are not the operator of this validator."},INVALID_REWARD_ALLOCATION:{reasons:["InvalidRewardAllocationWeights"],errorMSG:"Invalid reward allocation weights."},NOT_REWARD_DURATION_MANAGER:{reasons:["NotRewardDurationManager"],errorMSG:"You are not the reward duration manager of this validator."}},BEND:{INSUFFICIENT_POSITION:{keywords:["insufficient position"],errorMSG:"Insufficient position"},INSUFFICIENT_LIQUIDITY:{keywords:["insufficient liquidity on market"],errorMSG:"Insufficient liquidity on market."},ALL_CAPS_REACHED:{reasons:["AllCapsReached"],errorMSG:"All caps reached on vault."},AboveMaxTimelock:{reasons:["AboveMaxTimelock"],errorMSG:"Above max timelock"},AddressEmptyCode:{reasons:["AddressEmptyCode"],errorMSG:"Address empty code"},AddressInsufficientBalance:{reasons:["AddressInsufficientBalance"],errorMSG:"Address insufficient balance"},AllCapsReached:{reasons:["AllCapsReached"],errorMSG:"All caps reached"},AlreadyPending:{reasons:["AlreadyPending"],errorMSG:"Already pending"},AlreadySet:{reasons:["AlreadySet"],errorMSG:"Already set"},BelowMinTimelock:{reasons:["BelowMinTimelock"],errorMSG:"Below min timelock"},DuplicateMarket:{reasons:["DuplicateMarket"],errorMSG:"Duplicate market"},ECDSAInvalidSignature:{reasons:["ECDSAInvalidSignature"],errorMSG:"Invalid ECDSA signature"},ECDSAInvalidSignatureLength:{reasons:["ECDSAInvalidSignatureLength"],errorMSG:"Invalid ECDSA signature length"},ECDSAInvalidSignatureS:{reasons:["ECDSAInvalidSignatureS"],errorMSG:"Invalid ECDSA signature S value"},ERC20InsufficientBalance:{reasons:["ERC20InsufficientBalance"],errorMSG:"ERC20 insufficient balance"},ERC20InvalidApprover:{reasons:["ERC20InvalidApprover"],errorMSG:"ERC20 invalid approver"},ERC20InvalidReceiver:{reasons:["ERC20InvalidReceiver"],errorMSG:"ERC20 invalid receiver"},ERC20InvalidSender:{reasons:["ERC20InvalidSender"],errorMSG:"ERC20 invalid sender"},ERC20InvalidSpender:{reasons:["ERC20InvalidSpender"],errorMSG:"ERC20 invalid spender"},ERC2612ExpiredSignature:{reasons:["ERC2612ExpiredSignature"],errorMSG:"ERC2612 expired signature"},ERC2612InvalidSigner:{reasons:["ERC2612InvalidSigner"],errorMSG:"ERC2612 invalid signer"},ERC4626ExceededMaxDeposit:{reasons:["ERC4626ExceededMaxDeposit"],errorMSG:"ERC4626 exceeded max deposit"},ERC4626ExceededMaxMint:{reasons:["ERC4626ExceededMaxMint"],errorMSG:"ERC4626 exceeded max mint"},ERC4626ExceededMaxRedeem:{reasons:["ERC4626ExceededMaxRedeem"],errorMSG:"ERC4626 exceeded max redeem"},ERC4626ExceededMaxWithdraw:{reasons:["ERC4626ExceededMaxWithdraw"],errorMSG:"ERC4626 exceeded max withdraw"},FailedInnerCall:{reasons:["FailedInnerCall"],errorMSG:"Failed inner call"},InconsistentAsset:{reasons:["InconsistentAsset"],errorMSG:"Inconsistent asset"},InconsistentReallocation:{reasons:["InconsistentReallocation"],errorMSG:"Inconsistent reallocation"},InvalidAccountNonce:{reasons:["InvalidAccountNonce"],errorMSG:"Invalid account nonce"},InvalidMarketRemovalNonZeroCap:{reasons:["InvalidMarketRemovalNonZeroCap"],errorMSG:"Invalid market removal (non-zero cap)"},InvalidMarketRemovalNonZeroSupply:{reasons:["InvalidMarketRemovalNonZeroSupply"],errorMSG:"Invalid market removal (non-zero supply)"},InvalidMarketRemovalTimelockNotElapsed:{reasons:["InvalidMarketRemovalTimelockNotElapsed"],errorMSG:"Invalid market removal (timelock not elapsed)"},InvalidShortString:{reasons:["InvalidShortString"],errorMSG:"Invalid short string"},MarketNotCreated:{reasons:["MarketNotCreated"],errorMSG:"Market not created"},MarketNotEnabled:{reasons:["MarketNotEnabled"],errorMSG:"Market not enabled"},MathOverflowedMulDiv:{reasons:["MathOverflowedMulDiv"],errorMSG:"Math overflow"},MaxFeeExceeded:{reasons:["MaxFeeExceeded"],errorMSG:"Max fee exceeded"},MaxQueueLengthExceeded:{reasons:["MaxQueueLengthExceeded"],errorMSG:"Max queue length exceeded"},NoPendingValue:{reasons:["NoPendingValue"],errorMSG:"No pending value"},NonZeroCap:{reasons:["NonZeroCap"],errorMSG:"Non-zero cap"},NotAllocatorRole:{reasons:["NotAllocatorRole"],errorMSG:"Not allocator role"},NotCuratorNorGuardianRole:{reasons:["NotCuratorNorGuardianRole"],errorMSG:"Not curator or guardian role"},NotCuratorRole:{reasons:["NotCuratorRole"],errorMSG:"Not curator role"},NotEnoughLiquidity:{reasons:["NotEnoughLiquidity"],errorMSG:"Not enough liquidity"},NotGuardianRole:{reasons:["NotGuardianRole"],errorMSG:"Not guardian role"},OwnableInvalidOwner:{reasons:["OwnableInvalidOwner"],errorMSG:"Invalid owner"},OwnableUnauthorizedAccount:{reasons:["OwnableUnauthorizedAccount"],errorMSG:"Unauthorized account"},PendingCap:{reasons:["PendingCap"],errorMSG:"Pending cap"},PendingRemoval:{reasons:["PendingRemoval"],errorMSG:"Pending removal"},SafeCastOverflowedUintDowncast:{reasons:["SafeCastOverflowedUintDowncast"],errorMSG:"SafeCast overflow"},SafeERC20FailedOperation:{reasons:["SafeERC20FailedOperation"],errorMSG:"SafeERC20 failed operation"},StringTooLong:{reasons:["StringTooLong"],errorMSG:"String too long"},SupplyCapExceeded:{reasons:["SupplyCapExceeded"],errorMSG:"Supply cap exceeded"},TimelockNotElapsed:{reasons:["TimelockNotElapsed"],errorMSG:"Timelock not elapsed"},UnauthorizedMarket:{reasons:["UnauthorizedMarket"],errorMSG:"Unauthorized market"},ZeroAddress:{reasons:["ZeroAddress"],errorMSG:"Zero address"},ZeroFeeRecipient:{reasons:["ZeroFeeRecipient"],errorMSG:"Zero fee recipient"}}};function A({reason:o,message:r}){for(let n in p){let a=p[n];for(let c in a){let s=a[c];if(o&&s?.reasons?.some(l=>l===o)||s?.keywords?.some(l=>r?.includes(l.toLowerCase().trim())))return s.errorMSG}}return u}import{BaseError as P}from"viem";import{appConfig as _}from"@berachain/config/internal";import{AtomicReadyWalletRejectedUpgradeError as C,BaseError as g,ContractFunctionExecutionError as I,ContractFunctionRevertedError as x,decodeErrorResult as X,HttpRequestError as T,RpcRequestError as b,TransactionExecutionError as N,UserRejectedRequestError as k}from"viem";var E=[{inputs:[],name:"AlreadyInitiated",type:"error"},{inputs:[],name:"EmptyBundle",type:"error"},{inputs:[],name:"IncorrectReenterHash",type:"error"},{inputs:[],name:"MissingExpectedReenter",type:"error"}];var L=[{inputs:[],name:"AllowanceOverflow",type:"error"},{inputs:[],name:"AllowanceUnderflow",type:"error"},{inputs:[],name:"ETHTransferFailed",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidPermit",type:"error"},{inputs:[],name:"Permit2AllowanceIsFixedAtInfinity",type:"error"},{inputs:[],name:"PermitExpired",type:"error"},{inputs:[],name:"TotalSupplyOverflow",type:"error"},{name:"AllowanceOverflow",type:"error",inputs:[]},{name:"AllowanceUnderflow",type:"error",inputs:[]},{name:"InsufficientAllowance",type:"error",inputs:[]},{name:"InsufficientBalance",type:"error",inputs:[]},{name:"InvalidPermit",type:"error",inputs:[]},{name:"Permit2AllowanceIsFixedAtInfinity",type:"error",inputs:[]},{name:"PermitExpired",type:"error",inputs:[]},{name:"TotalSupplyOverflow",type:"error",inputs:[]},{name:"ECDSAInvalidSignature",type:"error",inputs:[]},{name:"ECDSAInvalidSignatureLength",type:"error",inputs:[{type:"uint256"}]},{name:"ECDSAInvalidSignatureS",type:"error",inputs:[{type:"bytes32"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InsufficientBalance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC20InvalidApprover",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidReceiver",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSender",type:"error",inputs:[{type:"address"}]},{name:"ERC20InvalidSpender",type:"error",inputs:[{type:"address"}]},{name:"ERC2612ExpiredSignature",type:"error",inputs:[{type:"uint256"}]},{name:"ERC2612InvalidSigner",type:"error",inputs:[{type:"address"},{type:"address"}]},{name:"InvalidAccountNonce",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"InvalidShortString",type:"error",inputs:[]},{name:"StringTooLong",type:"error",inputs:[{type:"string"}]}];var m=[{name:"AllowanceExpired",type:"error",inputs:[{type:"uint256"}]},{name:"AssetNotRegistered",type:"error",inputs:[{type:"address"}]},{name:"ERC20InsufficientAllowance",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC4626ExceededMaxWithdraw",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"ERC721NonexistentToken",type:"error",inputs:[{type:"uint256"}]},{name:"ExecutionFailed",type:"error",inputs:[{type:"uint256"},{type:"address"},{type:"string"}]},{name:"ExpiredTransaction",type:"error",inputs:[]},{name:"FailedToCallFunction",type:"error",inputs:[{type:"bytes"}]},{name:"InsufficientAmountOut",type:"error",inputs:[]},{name:"MinimalOutputBalanceViolation",type:"error",inputs:[{type:"address"},{type:"uint256"}]},{name:"NotPegged",type:"error",inputs:[{type:"address"}]},{name:"RedeemMoreThanMax",type:"error",inputs:[]},{name:"SignatureExpired",type:"error",inputs:[{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[{type:"uint256"},{type:"uint256"}]},{name:"SlippageExceeded",type:"error",inputs:[]},{name:"StalePrice",type:"error",inputs:[]},{name:"TooMuchSlippage",type:"error",inputs:[{type:"address"},{type:"uint256"},{type:"uint256"}]},{name:"TransferFromFailed",type:"error",inputs:[]},{name:"UnexpectedBasketModeStatus",type:"error",inputs:[]},{name:"zeroAmountRequired",type:"error",inputs:[]}];var S=[...L,...E,...m];function h(o){return o instanceof g||o instanceof Error&&"shortMessage"in o&&"message"in o&&"details"in o}function t(o,r,n){return o instanceof n||o.name===r}function O(o){return o.errorName==="Error"&&Array.isArray(o.args)&&o.args?.at(0)?o.args?.at(0):o.errorName}function M({error:o,abi:r,revertIfUnknown:n=!0}){if(!h(o)){if(n)throw o;return o instanceof g?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;h(e);){if(t(e,"ContractFunctionExecutionError",I)){e=e.cause;continue}if(t(e,"TransactionExecutionError",N)&&e.cause instanceof C)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(t(e,"RpcRequestError",b)){if(!e.data){if(typeof e.cause=="object"&&e.cause&&"message"in e.cause&&typeof e.cause.message=="string")return{reason:e.cause.message,rootCause:e.cause};throw new Error("No data",{cause:e})}let a=X({data:e.data,abi:[...S,...r??[]]});return{reason:O(a)??e.shortMessage,rootCause:e}}if(t(e,"ContractFunctionRevertedError",x))return{reason:e.reason??e.signature??e.data?.errorName??e.shortMessage,rootCause:e};if(t(e,"UserRejectedRequestError",k))return{reason:"UserRejectedRequestError",rootCause:e};if(t(e,"HttpRequestError",T))return{reason:`HttpRequestError(status:${e.status})`,rootCause:e,isRequestError:!0};if(!e.cause)return{reason:e.name,rootCause:e};e=e.cause}if(!n)return{reason:void 0,rootCause:e};throw new Error("UnknownErrorInGetRevertReason",{cause:e})}function f(o){switch(o){case"UserRejectedRequestError":case 4001:return"UserRejectedRequestError";default:return`RPC_ERROR_${o}`}}var i=class o extends Error{displayMessage;cause;chainId;reason=null;fingerprint;_tags={};set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}level="error";extra={};constructor({message:r,displayMessage:n,cause:e,reason:a,level:c,abi:s,tags:l,chainId:R,fingerprint:v}){let d=r;if(d||(e instanceof P?d=e.shortMessage:(e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string")&&(d=e.message)),super(d,{cause:e}),this.name="BeraError",this.fingerprint=v,this.cause=e,this.chainId=R,a)this.reason=a;else if(e instanceof Error)try{let w=M({error:e,revertIfUnknown:!0,abi:s});this.reason=w?.reason??null}catch{}c?this.level=c:this.reason===f("UserRejectedRequestError")?this.level="info":this.level="error";let B=n;this.cause instanceof o&&this.cause.displayMessage!==u&&(B=this.cause.displayMessage),B||(B=A(this)),this.displayMessage=B??u,this.tags={...this.tags,...l},!_.env.isProduction&&process.env.NODE_ENV!=="test"&&(console.group("BeraError thrown"),console.debug("Level",this.level),console.debug("Reason",this.reason),console.debug("Message",this.message),console.debug("Display Message",this.displayMessage),console.debug("Cause",this.cause),console.groupEnd())}};import{mainnet as D}from"@berachain/config/mainnet";var y=class o extends i{response;static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}endpoint;queryRichfulDomains=[D.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator"];statusCode;payload;static REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"};constructor(r){if(super(r),this.name="RequestError",this.response=r.response,this.payload=r.payload,this.endpoint=this.setEndpoint(r.endpoint),!this.message&&typeof this.cause=="object"&&this.cause!==null&&"error"in this.cause&&typeof this.cause.error=="string"&&(this.message=this.cause.error),r.statusCode?this.statusCode=r.statusCode:this.response instanceof Response&&(this.statusCode=this.response.status),this.statusCode===429)this.reason=o.REASON_MAP[429],this.displayMessage=p.HTTP.RATE_LIMITED_429.errorMSG,this.level=r.level??"warning";else{let e=this.tryMatchNetworkError();e&&(this.reason=this.reason??e.reason,this.level=r.level??"warning",this.endpoint.url=this.endpoint.url??e.url)}this.tags={...this.tags,"error.statusCode":this.statusCode,"operation.type":"query",...r.tags};let n="";this.reason?n+=`${this.reason} \u2013 `:this.statusCode&&this.statusCode>=400&&(n+=`HTTP ${this.statusCode} \u2013 `),this.message=`${n}${this.endpoint.type}(${this.endpoint.url}): ${this.message}`}setEndpoint(r){if(typeof r=="string"||r instanceof URL?this.endpoint={url:typeof r=="string"?r:r.toString()}:this.endpoint={...this.endpoint,...r,url:r.url.toString()},this.queryRichfulDomains.some(n=>this.endpoint.url.includes(n)))try{let n=new URL(this.endpoint.url);n.search="",this.endpoint.url=n.toString()}catch{}return this.tags={...this.tags,"operation.source.url":this.endpoint.url,"operation.source.name":this.endpoint.name,"operation.source.type":this.endpoint.type},this.endpoint}tryMatchNetworkError(){if(this.cause instanceof Error&&"message"in this.cause&&typeof this.cause.message=="string"||this.cause instanceof TypeError){let r=this.cause.message;if(r.startsWith("Network Error"))return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:this.endpoint.url};let n=r.match(/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/);if(n)return{reason:o.REASON_MAP.NETWORK_ERROR,message:r,url:n[1]}}return!1}};var G=class extends i{property;value;expected;constructor(r){super(r),this.level=r.level??"warning",this.name="InvalidArgumentError",this.property=r.property,this.value=r.value,this.expected=r.expected,this.message=`Invalid argument: ${this.property} ${this.isMissing?"is missing":`is invalid, expected ${this.expected}`}`,r.reason||(this.reason=`${this.name}.${this.property}.${this.isInvalid?"invalid":"missing"}`)}get isMissing(){return this.value===void 0}get isInvalid(){return this.value!==void 0}};export{A as a,S as b,O as c,M as d,i as e,y as f,G as g};
2
- //# sourceMappingURL=chunk-C3G5KXCH.mjs.map