@berachain/berajs 0.2.8-beta.8 → 0.2.9

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 (225) hide show
  1. package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.ts} +31 -2
  2. package/dist/{HoneyConfigProvider-DVP_9KZn.d.ts → HoneyConfigProvider-Dkj-_a5x.d.ts} +1 -1
  3. package/dist/RequestError-DBOIV65x.d.ts +144 -0
  4. package/dist/abi/exports.mjs +3 -4
  5. package/dist/actions/clients/exports.d.ts +2 -0
  6. package/dist/actions/clients/exports.mjs +12 -0
  7. package/dist/actions/exports.d.ts +108 -187
  8. package/dist/actions/exports.mjs +97 -158
  9. package/dist/actions/governance/exports.d.ts +140 -0
  10. package/dist/actions/governance/exports.mjs +226 -0
  11. package/dist/actions/server/exports.d.ts +13 -0
  12. package/dist/actions/server/exports.mjs +27 -0
  13. package/dist/{chunk-VA3BQ34H.mjs → chunk-3EARVV7K.mjs} +20 -9
  14. package/dist/chunk-4Z4AK6SH.mjs +211 -0
  15. package/dist/chunk-75M6TF7M.mjs +25 -0
  16. package/dist/chunk-AFN4CVD3.mjs +326 -0
  17. package/dist/{chunk-7TFV6UKF.mjs → chunk-BGMRHTBQ.mjs} +0 -1
  18. package/dist/{chunk-3M47ZRXT.mjs → chunk-CDFWPU2R.mjs} +73 -17
  19. package/dist/{chunk-GWSTVITN.mjs → chunk-CDK4YV3D.mjs} +0 -1
  20. package/dist/{chunk-KL6YZ5VR.mjs → chunk-DKMAIU74.mjs} +0 -1
  21. package/dist/chunk-EXIUPSFN.mjs +86 -0
  22. package/dist/{chunk-VA5L5FDG.mjs → chunk-FFB5LFDW.mjs} +2 -3
  23. package/dist/{chunk-ZCEFC2TK.mjs → chunk-HQCOU6GY.mjs} +0 -1
  24. package/dist/{chunk-SGZP4O6R.mjs → chunk-HSSJKHZ4.mjs} +11 -11
  25. package/dist/{chunk-7QKRRIHI.mjs → chunk-J5I45WGQ.mjs} +77 -152
  26. package/dist/chunk-KQUMKB66.mjs +89 -0
  27. package/dist/{chunk-JA4DHMTG.mjs → chunk-NBYLMO2L.mjs} +0 -1
  28. package/dist/{chunk-4GFN4LEP.mjs → chunk-NPBQLVL3.mjs} +4 -21
  29. package/dist/{chunk-I3FTWD6I.mjs → chunk-O2NQFKJK.mjs} +1 -1
  30. package/dist/{chunk-2R73G2PO.mjs → chunk-QJIXTYTZ.mjs} +121 -765
  31. package/dist/{chunk-GLWPRM33.mjs → chunk-SGIJVHZO.mjs} +0 -1
  32. package/dist/chunk-SZ5C44L5.mjs +35 -0
  33. package/dist/{chunk-5NMATIH4.mjs → chunk-WXXOISTU.mjs} +1 -35
  34. package/dist/chunk-XIYN6AL6.mjs +160 -0
  35. package/dist/contexts/exports.d.ts +2 -2
  36. package/dist/contexts/exports.mjs +11 -9
  37. package/dist/enum/exports.d.ts +1 -1
  38. package/dist/enum/exports.mjs +3 -16
  39. package/dist/enum/governance/exports.d.ts +60 -0
  40. package/dist/enum/governance/exports.mjs +14 -0
  41. package/dist/errors/exports.d.ts +5 -90
  42. package/dist/errors/exports.mjs +19 -10
  43. package/dist/exports-BcUTGFUb.d.ts +40 -0
  44. package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts} +2 -2
  45. package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
  46. package/dist/hooks/exports.d.ts +80 -236
  47. package/dist/hooks/exports.mjs +609 -1508
  48. package/dist/hooks/governance/exports.d.ts +181 -0
  49. package/dist/hooks/governance/exports.mjs +888 -0
  50. package/dist/pol.d-CqPA9K6m.d.ts +142 -0
  51. package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
  52. package/dist/types/exports.d.ts +9 -9
  53. package/dist/types/exports.mjs +0 -1
  54. package/dist/types/governance/exports.d.ts +109 -0
  55. package/dist/types/governance/exports.mjs +0 -0
  56. package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
  57. package/dist/utils/exports.d.ts +24 -7
  58. package/dist/utils/exports.mjs +49 -11
  59. package/package.json +60 -13
  60. package/src/actions/__test/transports.ts +61 -0
  61. package/src/actions/clients/BeraApolloClient.ts +9 -0
  62. package/src/actions/clients/exports.ts +4 -0
  63. package/src/actions/clients/getApolloClient.ts +70 -25
  64. package/src/actions/clients/getEnsoClient.ts +20 -9
  65. package/src/actions/dex/aggregators/base.ts +1 -1
  66. package/src/actions/dex/aggregators/enso/enso.ts +27 -17
  67. package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
  68. package/src/actions/dex/aggregators/kyberswap.ts +18 -23
  69. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  70. package/src/actions/exports.ts +5 -10
  71. package/src/actions/governance/exports.ts +9 -0
  72. package/src/actions/governance/getAllProposals.ts +10 -65
  73. package/src/actions/governance/getProposalDetails.ts +6 -33
  74. package/src/actions/governance/getProposalVotes.ts +8 -15
  75. package/src/actions/honey/getChartData.ts +27 -21
  76. package/src/actions/honey/getHoney24hVolume.ts +27 -0
  77. package/src/actions/pol/getAutoclaimedIncentives.ts +30 -0
  78. package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
  79. package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +35 -0
  80. package/src/actions/pol/getEarnedStakedBeraVault.ts +15 -9
  81. package/src/actions/pol/getGlobalData.ts +1 -0
  82. package/src/actions/pol/getHeroEarnVaults.ts +62 -0
  83. package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
  84. package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
  85. package/src/actions/pol/getStakingDailyAssets.ts +11 -8
  86. package/src/actions/server/exports.ts +1 -0
  87. package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
  88. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  89. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  90. package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
  91. package/src/actions/validators/getValidatorAnalytics.ts +20 -21
  92. package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
  93. package/src/data/contracts.ts +5 -0
  94. package/src/enum/contracts.ts +1 -0
  95. package/src/enum/exports.ts +0 -1
  96. package/src/enum/governance/exports.ts +1 -0
  97. package/src/errors/BeraError.ts +47 -7
  98. package/src/errors/BeraTracing.unit.test.ts +65 -0
  99. package/src/errors/RequestError.ts +15 -2
  100. package/src/errors/exports.ts +5 -0
  101. package/src/errors/getRevertReason.integration.test.ts +3 -3
  102. package/src/errors/spanStatus.ts +78 -0
  103. package/src/errors/spanStatus.unit.test.ts +62 -0
  104. package/src/hooks/dex/useCreatePool.ts +1 -88
  105. package/src/hooks/dex/useOnChainPoolData.ts +27 -2
  106. package/src/hooks/dex/usePriceImpact.ts +12 -5
  107. package/src/hooks/enso/useBendDemultiply.ts +9 -1
  108. package/src/hooks/enso/useBendMultiply.ts +9 -1
  109. package/src/hooks/enso/useBendZapSupply.ts +26 -7
  110. package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
  111. package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
  112. package/src/hooks/exports.ts +3 -16
  113. package/src/hooks/governance/exports.ts +14 -0
  114. package/src/hooks/honey/useHoney24hVolume.ts +16 -0
  115. package/src/hooks/pol/useAutoclaimedIncentives.ts +49 -0
  116. package/src/hooks/pol/useStakedAPR.ts +2 -2
  117. package/src/hooks/pol/useStakedSnapshots.ts +5 -9
  118. package/src/hooks/validators/useValidator.ts +2 -0
  119. package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
  120. package/src/types/bribe-boost.d.ts +8 -0
  121. package/src/types/exports.ts +0 -1
  122. package/src/types/governance/exports.ts +1 -0
  123. package/src/utils/beraFetch.ts +76 -15
  124. package/src/utils/exports.ts +1 -0
  125. package/src/utils/getServerSideClient.ts +4 -2
  126. package/src/utils/sanitizeRpcUrl.ts +22 -0
  127. package/src/utils/tracedTransport.ts +35 -0
  128. package/dist/BeraError-_mQdkanr.d.ts +0 -94
  129. package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
  130. package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
  131. package/dist/RequestError-A8XJ6QR9.d.cts +0 -57
  132. package/dist/RequestError-Dk97z8rm.d.ts +0 -57
  133. package/dist/abi/exports.cjs +0 -4453
  134. package/dist/abi/exports.cjs.map +0 -1
  135. package/dist/abi/exports.d.cts +0 -6574
  136. package/dist/abi/exports.mjs.map +0 -1
  137. package/dist/actions/exports.cjs +0 -914
  138. package/dist/actions/exports.cjs.map +0 -1
  139. package/dist/actions/exports.d.cts +0 -1644
  140. package/dist/actions/exports.mjs.map +0 -1
  141. package/dist/chunk-2R73G2PO.mjs.map +0 -1
  142. package/dist/chunk-3M47ZRXT.mjs.map +0 -1
  143. package/dist/chunk-4GFN4LEP.mjs.map +0 -1
  144. package/dist/chunk-5N7QQS55.cjs +0 -130
  145. package/dist/chunk-5N7QQS55.cjs.map +0 -1
  146. package/dist/chunk-5NMATIH4.mjs.map +0 -1
  147. package/dist/chunk-7QKRRIHI.mjs.map +0 -1
  148. package/dist/chunk-7TFV6UKF.mjs.map +0 -1
  149. package/dist/chunk-A4FPM7U3.cjs +0 -63
  150. package/dist/chunk-A4FPM7U3.cjs.map +0 -1
  151. package/dist/chunk-BDHINMWQ.cjs +0 -417
  152. package/dist/chunk-BDHINMWQ.cjs.map +0 -1
  153. package/dist/chunk-BEHP54S3.cjs +0 -24
  154. package/dist/chunk-BEHP54S3.cjs.map +0 -1
  155. package/dist/chunk-EGDXV2PT.cjs +0 -36
  156. package/dist/chunk-EGDXV2PT.cjs.map +0 -1
  157. package/dist/chunk-EWBKSMPG.cjs +0 -13
  158. package/dist/chunk-EWBKSMPG.cjs.map +0 -1
  159. package/dist/chunk-F6ZW7ZDD.cjs +0 -403
  160. package/dist/chunk-F6ZW7ZDD.cjs.map +0 -1
  161. package/dist/chunk-FTXTRUYT.cjs +0 -170
  162. package/dist/chunk-FTXTRUYT.cjs.map +0 -1
  163. package/dist/chunk-GLWPRM33.mjs.map +0 -1
  164. package/dist/chunk-GWSTVITN.mjs.map +0 -1
  165. package/dist/chunk-H3Z37RYU.cjs +0 -15
  166. package/dist/chunk-H3Z37RYU.cjs.map +0 -1
  167. package/dist/chunk-I3FTWD6I.mjs.map +0 -1
  168. package/dist/chunk-JA4DHMTG.mjs.map +0 -1
  169. package/dist/chunk-KL6YZ5VR.mjs.map +0 -1
  170. package/dist/chunk-MXWPP6MS.cjs +0 -572
  171. package/dist/chunk-MXWPP6MS.cjs.map +0 -1
  172. package/dist/chunk-SGZP4O6R.mjs.map +0 -1
  173. package/dist/chunk-TDW5SPXR.cjs +0 -244
  174. package/dist/chunk-TDW5SPXR.cjs.map +0 -1
  175. package/dist/chunk-TGK3IXDN.cjs +0 -169
  176. package/dist/chunk-TGK3IXDN.cjs.map +0 -1
  177. package/dist/chunk-TJEW6YCJ.cjs +0 -97
  178. package/dist/chunk-TJEW6YCJ.cjs.map +0 -1
  179. package/dist/chunk-VA3BQ34H.mjs.map +0 -1
  180. package/dist/chunk-VA5L5FDG.mjs.map +0 -1
  181. package/dist/chunk-XSGCRLSD.cjs +0 -1844
  182. package/dist/chunk-XSGCRLSD.cjs.map +0 -1
  183. package/dist/chunk-XV3GG3HC.cjs +0 -135
  184. package/dist/chunk-XV3GG3HC.cjs.map +0 -1
  185. package/dist/chunk-Y5B224UX.cjs +0 -4698
  186. package/dist/chunk-Y5B224UX.cjs.map +0 -1
  187. package/dist/chunk-ZBTRKBSI.mjs +0 -169
  188. package/dist/chunk-ZBTRKBSI.mjs.map +0 -1
  189. package/dist/chunk-ZCEFC2TK.mjs.map +0 -1
  190. package/dist/contexts/exports.cjs +0 -83
  191. package/dist/contexts/exports.cjs.map +0 -1
  192. package/dist/contexts/exports.d.cts +0 -66
  193. package/dist/contexts/exports.mjs.map +0 -1
  194. package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
  195. package/dist/dex-C_BB0b0O.d.cts +0 -37
  196. package/dist/enum/exports.cjs +0 -59
  197. package/dist/enum/exports.cjs.map +0 -1
  198. package/dist/enum/exports.d.cts +0 -23
  199. package/dist/enum/exports.mjs.map +0 -1
  200. package/dist/errors/exports.cjs +0 -39
  201. package/dist/errors/exports.cjs.map +0 -1
  202. package/dist/errors/exports.d.cts +0 -413
  203. package/dist/errors/exports.mjs.map +0 -1
  204. package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
  205. package/dist/global.d-B7IeayVX.d.cts +0 -474
  206. package/dist/honey-CYm0RWf4.d.cts +0 -14
  207. package/dist/hooks/exports.cjs +0 -8333
  208. package/dist/hooks/exports.cjs.map +0 -1
  209. package/dist/hooks/exports.d.cts +0 -1748
  210. package/dist/hooks/exports.mjs.map +0 -1
  211. package/dist/polling-BKnyavLI.d.cts +0 -8
  212. package/dist/txnEnum-7_o92X3N.d.ts +0 -164
  213. package/dist/types/exports.cjs +0 -1
  214. package/dist/types/exports.cjs.map +0 -1
  215. package/dist/types/exports.d.cts +0 -90
  216. package/dist/types/exports.mjs.map +0 -1
  217. package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
  218. package/dist/utils/exports.cjs +0 -787
  219. package/dist/utils/exports.cjs.map +0 -1
  220. package/dist/utils/exports.d.cts +0 -412
  221. package/dist/utils/exports.mjs.map +0 -1
  222. package/src/actions/dex/getIsTokenExploited.ts +0 -63
  223. package/src/actions/honey/getHoneyGlobalData.ts +0 -21
  224. package/src/hooks/dex/useExploitedTokens.ts +0 -57
  225. package/src/hooks/honey/useHoneyGlobalData.ts +0 -23
@@ -1129,6 +1129,50 @@ function getErrorMessage({
1129
1129
  return findMatchingError({ reason, message })?.errorMSG ?? GENERAL_ERROR;
1130
1130
  }
1131
1131
 
1132
+ // src/errors/spanStatus.ts
1133
+ function httpStatusToSpanStatus(code) {
1134
+ if (code >= 200 && code < 300) return "ok";
1135
+ switch (code) {
1136
+ case 400:
1137
+ return "invalid_argument";
1138
+ case 401:
1139
+ return "unauthenticated";
1140
+ case 403:
1141
+ return "permission_denied";
1142
+ case 404:
1143
+ return "not_found";
1144
+ case 409:
1145
+ return "already_exists";
1146
+ case 429:
1147
+ return "resource_exhausted";
1148
+ case 499:
1149
+ return "cancelled";
1150
+ case 501:
1151
+ return "unimplemented";
1152
+ case 503:
1153
+ return "unavailable";
1154
+ case 504:
1155
+ return "deadline_exceeded";
1156
+ default:
1157
+ return code >= 500 ? "internal_error" : "unknown_error";
1158
+ }
1159
+ }
1160
+ function reasonToSpanStatus(reason) {
1161
+ switch (reason) {
1162
+ case "UserRejectedRequestError":
1163
+ case "AtomicReadyWalletRejectedUpgradeError":
1164
+ return "cancelled";
1165
+ case "NO_SWAP_PATHS":
1166
+ return "not_found";
1167
+ case "RATE_LIMITED_429":
1168
+ return "resource_exhausted";
1169
+ case "NETWORK_ERROR":
1170
+ return "unavailable";
1171
+ default:
1172
+ return void 0;
1173
+ }
1174
+ }
1175
+
1132
1176
  // src/errors/BeraError.ts
1133
1177
  import { BaseError as BaseError2 } from "viem";
1134
1178
  import { appConfig, currentDapp } from "@berachain/config/internal";
@@ -1573,6 +1617,11 @@ var BeraError = class _BeraError extends Error {
1573
1617
  };
1574
1618
  }
1575
1619
  level = "error";
1620
+ /**
1621
+ * Span status for tracing providers.
1622
+ * Auto-inferred from `reason` when not explicitly provided.
1623
+ */
1624
+ spanStatus;
1576
1625
  extra = {};
1577
1626
  constructor({
1578
1627
  message: m,
@@ -1583,7 +1632,8 @@ var BeraError = class _BeraError extends Error {
1583
1632
  abi,
1584
1633
  tags,
1585
1634
  chainId,
1586
- fingerprint
1635
+ fingerprint,
1636
+ spanStatus
1587
1637
  }) {
1588
1638
  let message = m;
1589
1639
  if (!message) {
@@ -1622,6 +1672,13 @@ var BeraError = class _BeraError extends Error {
1622
1672
  } else {
1623
1673
  this.level = "error";
1624
1674
  }
1675
+ if (spanStatus) {
1676
+ this.spanStatus = spanStatus;
1677
+ } else if (this.cause instanceof _BeraError && this.cause.spanStatus) {
1678
+ this.spanStatus = this.cause.spanStatus;
1679
+ } else {
1680
+ this.spanStatus = reasonToSpanStatus(this.reason);
1681
+ }
1625
1682
  let displayMessage = dm;
1626
1683
  if (this.cause instanceof _BeraError && this.cause.displayMessage !== GENERAL_ERROR) {
1627
1684
  displayMessage = this.cause.displayMessage;
@@ -1640,157 +1697,24 @@ var BeraError = class _BeraError extends Error {
1640
1697
  };
1641
1698
  if (!appConfig.env.isProduction && // skip debug logs on consumer of the berajs package
1642
1699
  (process.env.NEXT_PUBLIC_IS_MONOBERA === "true" || currentDapp) && process.env.NODE_ENV !== "test") {
1643
- console.group("BeraError thrown");
1644
- console.debug("Level", this.level);
1645
- console.debug("Reason", this.reason);
1646
- console.debug("Message", this.message);
1647
- console.debug("Display Message", this.displayMessage);
1648
- console.debug("Cause", this.cause);
1649
- console.groupEnd();
1650
- }
1651
- }
1652
- };
1653
-
1654
- // src/errors/RequestError.ts
1655
- import { mainnet } from "@berachain/config/mainnet";
1656
- var RequestError = class _RequestError extends BeraError {
1657
- /**
1658
- * The error response from the request.
1659
- */
1660
- response;
1661
- static isCorsError(error) {
1662
- return error.cause instanceof Response && error.cause.type === "cors";
1663
- }
1664
- /**
1665
- * The endpoint that was requested.
1666
- */
1667
- endpoint;
1668
- /**
1669
- * A list of domains that should have their query params removed.
1670
- */
1671
- queryRichfulDomains = [
1672
- mainnet.bex.aggregatorsProxyUrl,
1673
- "https://api.fly.trade/aggregator/quote",
1674
- "https://open-api.openocean.finance/v4/bera/swap",
1675
- // vercel internal proxy
1676
- "/api/aggregators?aggregator",
1677
- // bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
1678
- mainnet.staking
1679
- ];
1680
- statusCode;
1681
- payload;
1682
- static REASON_MAP = {
1683
- 429: "RATE_LIMITED_429",
1684
- NETWORK_ERROR: "NETWORK_ERROR",
1685
- CORS_ERROR: "CORS"
1686
- };
1687
- constructor(args) {
1688
- super(args);
1689
- this.name = "RequestError";
1690
- this.response = args.response;
1691
- this.payload = args.payload;
1692
- this.endpoint = this.setEndpoint(args.endpoint);
1693
- if (!this.message && typeof this.cause === "object" && this.cause !== null) {
1694
- if ("error" in this.cause && typeof this.cause.error === "string") {
1695
- this.message = this.cause.error;
1696
- }
1697
- }
1698
- if (args.statusCode) {
1699
- this.statusCode = args.statusCode;
1700
- } else if (this.response instanceof Response) {
1701
- this.statusCode = this.response.status;
1702
- }
1703
- if (this.statusCode === 429) {
1704
- this.reason = _RequestError.REASON_MAP[429];
1705
- this.displayMessage = errorMsgMap.HTTP.RATE_LIMITED_429.errorMSG;
1706
- this.level = args.level ?? "warning";
1707
- } else {
1708
- const networkError = this.tryMatchNetworkError();
1709
- if (networkError) {
1710
- this.reason = this.reason ?? networkError.reason;
1711
- this.level = args.level ?? "warning";
1712
- this.endpoint.url = this.endpoint.url ?? networkError.url;
1713
- }
1714
- }
1715
- this.tags = {
1716
- ...this.tags,
1717
- "error.statusCode": this.statusCode,
1718
- "operation.type": "query",
1719
- ...args.tags
1720
- };
1721
- let message = "";
1722
- if (this.reason) {
1723
- message += `${this.reason} \u2013 `;
1724
- } else if (this.statusCode && this.statusCode >= 400) {
1725
- message += `HTTP ${this.statusCode} \u2013 `;
1726
- }
1727
- const endpointLabel = this.endpoint.type ? `${this.endpoint.type}(${this.endpoint.url})` : this.endpoint.url;
1728
- this.message = `${message}${endpointLabel}: ${this.message}`;
1729
- }
1730
- setEndpoint(endpoint) {
1731
- if (typeof endpoint === "string" || endpoint instanceof URL) {
1732
- this.endpoint = {
1733
- url: typeof endpoint === "string" ? endpoint : endpoint.toString()
1734
- };
1735
- } else {
1736
- this.endpoint = {
1737
- ...this.endpoint,
1738
- ...endpoint,
1739
- url: endpoint.url.toString()
1740
- };
1741
- }
1742
- if (this.queryRichfulDomains.some(
1743
- (domain) => this.endpoint.url.includes(domain)
1744
- )) {
1745
- try {
1746
- const url = new URL(this.endpoint.url);
1747
- url.search = "";
1748
- this.endpoint.url = url.toString();
1749
- } catch {
1750
- }
1751
- }
1752
- this.tags = {
1753
- ...this.tags,
1754
- "operation.source.url": this.endpoint.url,
1755
- "operation.source.name": this.endpoint.name,
1756
- "operation.source.type": this.endpoint.type
1757
- };
1758
- return this.endpoint;
1759
- }
1760
- tryMatchNetworkError() {
1761
- if (this.cause instanceof Error && "message" in this.cause && typeof this.cause.message === "string" || this.cause instanceof TypeError) {
1762
- const message = this.cause.message;
1763
- if (message.startsWith("Network Error")) {
1764
- return {
1765
- reason: _RequestError.REASON_MAP.NETWORK_ERROR,
1766
- message,
1767
- url: this.endpoint.url
1768
- };
1769
- }
1770
- const failedToFetchMatch = message.match(
1771
- /^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed) \(([a-z0-9-.]+)\)$/
1772
- );
1773
- if (failedToFetchMatch) {
1774
- return {
1775
- reason: _RequestError.REASON_MAP.NETWORK_ERROR,
1776
- message,
1777
- url: failedToFetchMatch[1]
1778
- };
1779
- }
1780
- }
1781
- if (typeof this.cause === "object" && this.cause !== null && "message" in this.cause && typeof this.cause.message === "string") {
1782
- const message = this.cause.message;
1783
- if (message.startsWith(
1784
- "error: canceling statement due to lock timeout occurred in"
1785
- )) {
1786
- return {
1787
- reason: _RequestError.REASON_MAP.NETWORK_ERROR,
1788
- message,
1789
- url: this.endpoint.url
1790
- };
1700
+ if (typeof console.group === "function") {
1701
+ console.group("BeraError thrown");
1702
+ console.debug("Level", this.level);
1703
+ console.debug("Reason", this.reason);
1704
+ console.debug("Message", this.message);
1705
+ console.debug("Display Message", this.displayMessage);
1706
+ console.debug("Cause", this.cause);
1707
+ console.groupEnd();
1708
+ } else {
1709
+ console.debug("BeraError thrown", {
1710
+ level: this.level,
1711
+ reason: this.reason,
1712
+ message: this.message,
1713
+ displayMessage: this.displayMessage,
1714
+ cause: this.cause
1715
+ });
1791
1716
  }
1792
1717
  }
1793
- return false;
1794
1718
  }
1795
1719
  };
1796
1720
 
@@ -1832,13 +1756,14 @@ var InvalidArgumentError = class extends BeraError {
1832
1756
  };
1833
1757
 
1834
1758
  export {
1759
+ errorMsgMap,
1835
1760
  findMatchingError,
1836
1761
  getErrorMessage,
1837
1762
  commonAbiErrors,
1838
1763
  parseDecodedError,
1839
1764
  parseViemError,
1765
+ httpStatusToSpanStatus,
1766
+ reasonToSpanStatus,
1840
1767
  BeraError,
1841
- RequestError,
1842
1768
  InvalidArgumentError
1843
1769
  };
1844
- //# sourceMappingURL=chunk-7QKRRIHI.mjs.map
@@ -0,0 +1,89 @@
1
+ import {
2
+ InvalidArgumentError
3
+ } from "./chunk-J5I45WGQ.mjs";
4
+
5
+ // src/errors/assert.ts
6
+ import { isAddress } from "viem";
7
+ function _isDefined(value) {
8
+ return value !== void 0 && value !== null;
9
+ }
10
+ function _assert({
11
+ value,
12
+ property,
13
+ fn
14
+ }) {
15
+ const result = fn(value);
16
+ if (!result.isValid) {
17
+ throw new InvalidArgumentError({
18
+ property,
19
+ value,
20
+ expected: result.expectedType
21
+ });
22
+ }
23
+ }
24
+ function _assertDefined({
25
+ value,
26
+ property,
27
+ fn
28
+ }) {
29
+ _assert({
30
+ value,
31
+ property,
32
+ fn: (value2) => {
33
+ const isDefined = _isDefined(value2);
34
+ const { isValid, expectedType } = fn(value2);
35
+ return {
36
+ expectedType,
37
+ isValid: isDefined && isValid
38
+ };
39
+ }
40
+ });
41
+ }
42
+ function assertDefined(value, property) {
43
+ _assertDefined({
44
+ value,
45
+ property,
46
+ fn: (value2) => ({ expectedType: "defined", isValid: _isDefined(value2) })
47
+ });
48
+ }
49
+ function assertPublicClient(value, property = "publicClient") {
50
+ assertDefined(value, property);
51
+ }
52
+ function assertAddress(value, property) {
53
+ _assertDefined({
54
+ value,
55
+ property,
56
+ fn: (value2) => ({
57
+ expectedType: "Address",
58
+ isValid: typeof value2 === "string" && isAddress(value2)
59
+ })
60
+ });
61
+ }
62
+ function assertPositive(value, property) {
63
+ const isPositive = typeof value === "bigint" ? value > 0n : Number(value) > 0;
64
+ if (!isPositive) {
65
+ throw new InvalidArgumentError({
66
+ property,
67
+ value,
68
+ expected: "positive amount"
69
+ });
70
+ }
71
+ }
72
+ function assertAmount(value, property) {
73
+ _assertDefined({
74
+ value,
75
+ property,
76
+ fn: (value2) => ({
77
+ expectedType: "number",
78
+ isValid: (typeof value2 === "string" || typeof value2 === "number") && Number(value2) > 0
79
+ })
80
+ });
81
+ }
82
+
83
+ export {
84
+ assertDefined,
85
+ assertPublicClient,
86
+ assertAddress,
87
+ assertPositive,
88
+ assertAmount
89
+ };
@@ -12,4 +12,3 @@ var ensoWalletV2FactoryAbi = [
12
12
  export {
13
13
  ensoWalletV2FactoryAbi
14
14
  };
15
- //# sourceMappingURL=chunk-JA4DHMTG.mjs.map
@@ -1,24 +1,9 @@
1
1
  import {
2
- InvalidArgumentError
3
- } from "./chunk-7QKRRIHI.mjs";
4
-
5
- // src/utils/parseBaseArgs.ts
2
+ parseBaseArgs
3
+ } from "./chunk-75M6TF7M.mjs";
6
4
  import {
7
- chainConfigs,
8
- defaultChainId
9
- } from "@berachain/config/internal";
10
- function parseBaseArgs(args) {
11
- const chainId = args.chainId ?? defaultChainId;
12
- const config = args.config ?? chainConfigs[chainId];
13
- if (args.chainId && args.chainId !== config.chainId) {
14
- throw new InvalidArgumentError({
15
- property: "chainId",
16
- value: chainId,
17
- expected: `config.chainId: ${config.chainId}`
18
- });
19
- }
20
- return { config, chainId: config.chainId };
21
- }
5
+ InvalidArgumentError
6
+ } from "./chunk-J5I45WGQ.mjs";
22
7
 
23
8
  // src/utils/tokens.ts
24
9
  import { ethAddress, isAddress, zeroAddress } from "viem";
@@ -88,10 +73,8 @@ function isToken(...args) {
88
73
  }
89
74
 
90
75
  export {
91
- parseBaseArgs,
92
76
  beraToken,
93
77
  wBeraToken,
94
78
  getHoneyToken,
95
79
  isToken
96
80
  };
97
- //# sourceMappingURL=chunk-4GFN4LEP.mjs.map
@@ -2,6 +2,7 @@
2
2
  var ContractName = /* @__PURE__ */ ((ContractName2) => {
3
3
  ContractName2["ENSO_ROUTER"] = "enso.router";
4
4
  ContractName2["POL_REWARD_VAULT"] = "pol.rewardVault";
5
+ ContractName2["POL_REWARD_VAULT_HELPER"] = "pol.rewardVaultHelper";
5
6
  ContractName2["BEX_POOL"] = "bex.pool";
6
7
  ContractName2["ERC20"] = "others.erc20";
7
8
  ContractName2["ERC4626"] = "others.erc4626";
@@ -167,4 +168,3 @@ export {
167
168
  HoneySwapAction,
168
169
  TransactionActionType
169
170
  };
170
- //# sourceMappingURL=chunk-I3FTWD6I.mjs.map