@berachain/berajs 0.2.8-beta.11 → 0.2.8-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.cts} +31 -2
  2. package/dist/{BeraError-_mQdkanr.d.ts → BeraError-7-A5JYy_.d.ts} +31 -2
  3. package/dist/{RequestError-DSUzJ1Iy.d.cts → RequestError-02juqN-5.d.cts} +1 -1
  4. package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
  5. package/dist/abi/exports.cjs.map +1 -1
  6. package/dist/abi/exports.mjs +1 -1
  7. package/dist/actions/exports.cjs +1 -1
  8. package/dist/actions/exports.cjs.map +1 -1
  9. package/dist/actions/exports.d.cts +2 -2
  10. package/dist/actions/exports.d.ts +2 -2
  11. package/dist/actions/exports.mjs +1 -1
  12. package/dist/actions/governance/exports.cjs +1 -1
  13. package/dist/actions/governance/exports.cjs.map +1 -1
  14. package/dist/actions/governance/exports.mjs +1 -1
  15. package/dist/chunk-2A347ZVN.mjs +2 -0
  16. package/dist/{chunk-NXXMW2O7.mjs.map → chunk-2A347ZVN.mjs.map} +1 -1
  17. package/dist/{chunk-WLJHFHKF.mjs → chunk-2VO2D4QO.mjs} +2 -2
  18. package/dist/chunk-5FVW5XU3.mjs +2 -0
  19. package/dist/chunk-5FVW5XU3.mjs.map +1 -0
  20. package/dist/{chunk-GXV2JA36.mjs → chunk-5SIQ7BKT.mjs} +2 -2
  21. package/dist/chunk-5SIQ7BKT.mjs.map +1 -0
  22. package/dist/{chunk-ENT2OSXT.mjs → chunk-5XOEJ6XX.mjs} +2 -2
  23. package/dist/{chunk-ZW2N63FI.mjs → chunk-A5BNPBXN.mjs} +2 -2
  24. package/dist/{chunk-4TALWNXE.cjs → chunk-COSP3YIF.cjs} +2 -2
  25. package/dist/chunk-COSP3YIF.cjs.map +1 -0
  26. package/dist/chunk-D6L7LTA2.cjs.map +1 -1
  27. package/dist/{chunk-JXM5S4IU.mjs → chunk-DA7GK43B.mjs} +2 -2
  28. package/dist/chunk-DDEQFR3M.cjs.map +1 -1
  29. package/dist/{chunk-6JJIZCVY.cjs → chunk-DKZGCMH4.cjs} +2 -2
  30. package/dist/chunk-DKZGCMH4.cjs.map +1 -0
  31. package/dist/{chunk-Y2FETC6T.cjs → chunk-F4V5B6F7.cjs} +2 -2
  32. package/dist/chunk-F4V5B6F7.cjs.map +1 -0
  33. package/dist/{chunk-QVIAMSZ6.cjs → chunk-FDEUAXET.cjs} +2 -2
  34. package/dist/chunk-FDEUAXET.cjs.map +1 -0
  35. package/dist/{chunk-33XNWMPP.cjs → chunk-FQSOUEIJ.cjs} +2 -2
  36. package/dist/chunk-FQSOUEIJ.cjs.map +1 -0
  37. package/dist/{chunk-XZC34BHM.cjs → chunk-GEIY554A.cjs} +2 -2
  38. package/dist/chunk-GEIY554A.cjs.map +1 -0
  39. package/dist/{chunk-KUQEX7H3.mjs → chunk-JHUVLM54.mjs} +2 -2
  40. package/dist/{chunk-RCWM55DE.cjs → chunk-JZL5JPDJ.cjs} +2 -2
  41. package/dist/chunk-JZL5JPDJ.cjs.map +1 -0
  42. package/dist/{chunk-H6ZO4SLB.mjs → chunk-LUNZGZWN.mjs} +2 -2
  43. package/dist/{chunk-RJN36GBU.mjs → chunk-OCAMR6XC.mjs} +2 -2
  44. package/dist/chunk-OIYXOKTT.cjs.map +1 -1
  45. package/dist/chunk-OUD27MU7.cjs.map +1 -1
  46. package/dist/{chunk-JIPSTWKO.mjs → chunk-OYF32BQQ.mjs} +2 -2
  47. package/dist/{chunk-54BTOQE3.cjs → chunk-PFUVKW6F.cjs} +2 -2
  48. package/dist/chunk-PFUVKW6F.cjs.map +1 -0
  49. package/dist/{chunk-JSTCUTXP.cjs → chunk-QHCLZTCK.cjs} +2 -2
  50. package/dist/chunk-QHCLZTCK.cjs.map +1 -0
  51. package/dist/chunk-RWOICHRW.cjs.map +1 -1
  52. package/dist/{chunk-CHFETMC6.cjs → chunk-S2TNHMSV.cjs} +3 -3
  53. package/dist/chunk-S2TNHMSV.cjs.map +1 -0
  54. package/dist/chunk-S4CDSVLK.cjs.map +1 -1
  55. package/dist/{chunk-5QAFKFM5.mjs → chunk-TU63NRNL.mjs} +2 -2
  56. package/dist/{chunk-REWME3FY.cjs → chunk-W4JE2NIN.cjs} +2 -2
  57. package/dist/chunk-W4JE2NIN.cjs.map +1 -0
  58. package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
  59. package/dist/chunk-XB2SEO4Y.cjs +2 -0
  60. package/dist/chunk-XB2SEO4Y.cjs.map +1 -0
  61. package/dist/chunk-XCVDZUEF.mjs +2 -0
  62. package/dist/{chunk-K5L2B4DU.mjs.map → chunk-XCVDZUEF.mjs.map} +1 -1
  63. package/dist/chunk-XNJLSA6P.cjs.map +1 -1
  64. package/dist/chunk-YYUSCGVI.cjs +2 -0
  65. package/dist/chunk-YYUSCGVI.cjs.map +1 -0
  66. package/dist/contexts/exports.cjs +1 -1
  67. package/dist/contexts/exports.cjs.map +1 -1
  68. package/dist/contexts/exports.mjs +1 -1
  69. package/dist/enum/exports.cjs.map +1 -1
  70. package/dist/enum/governance/exports.cjs.map +1 -1
  71. package/dist/errors/exports.cjs +1 -1
  72. package/dist/errors/exports.cjs.map +1 -1
  73. package/dist/errors/exports.d.cts +4 -3
  74. package/dist/errors/exports.d.ts +4 -3
  75. package/dist/errors/exports.mjs +1 -1
  76. package/dist/{global.d-ylUk_etZ.d.ts → global.d-C4FnE4cz.d.ts} +1 -1
  77. package/dist/{global.d-B9nLZ7ul.d.cts → global.d-CicOIudf.d.cts} +1 -1
  78. package/dist/hooks/exports.cjs +2 -2
  79. package/dist/hooks/exports.cjs.map +1 -1
  80. package/dist/hooks/exports.d.cts +3 -3
  81. package/dist/hooks/exports.d.ts +3 -3
  82. package/dist/hooks/exports.mjs +2 -2
  83. package/dist/hooks/governance/exports.cjs +1 -1
  84. package/dist/hooks/governance/exports.cjs.map +1 -1
  85. package/dist/hooks/governance/exports.d.cts +2 -2
  86. package/dist/hooks/governance/exports.d.ts +2 -2
  87. package/dist/hooks/governance/exports.mjs +1 -1
  88. package/dist/types/exports.cjs.map +1 -1
  89. package/dist/types/exports.d.cts +2 -2
  90. package/dist/types/exports.d.ts +2 -2
  91. package/dist/types/governance/exports.cjs.map +1 -1
  92. package/dist/utils/exports.cjs +1 -1
  93. package/dist/utils/exports.cjs.map +1 -1
  94. package/dist/utils/exports.d.cts +13 -4
  95. package/dist/utils/exports.d.ts +13 -4
  96. package/dist/utils/exports.mjs +1 -1
  97. package/dist/utils/exports.mjs.map +1 -1
  98. package/package.json +46 -40
  99. package/src/actions/__test/transports.ts +61 -0
  100. package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
  101. package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
  102. package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
  103. package/src/data/contracts.ts +5 -0
  104. package/src/errors/BeraError.ts +27 -0
  105. package/src/errors/BeraTracing.unit.test.ts +65 -0
  106. package/src/errors/RequestError.ts +12 -0
  107. package/src/errors/exports.ts +5 -0
  108. package/src/errors/getRevertReason.integration.test.ts +3 -3
  109. package/src/errors/spanStatus.ts +78 -0
  110. package/src/errors/spanStatus.unit.test.ts +62 -0
  111. package/src/utils/beraFetch.ts +9 -3
  112. package/src/utils/exports.ts +1 -0
  113. package/src/utils/getServerSideClient.ts +4 -2
  114. package/src/utils/sanitizeRpcUrl.ts +22 -0
  115. package/src/utils/tracedTransport.ts +35 -0
  116. package/dist/chunk-33XNWMPP.cjs.map +0 -1
  117. package/dist/chunk-4TALWNXE.cjs.map +0 -1
  118. package/dist/chunk-54BTOQE3.cjs.map +0 -1
  119. package/dist/chunk-6DIA6PXV.cjs +0 -2
  120. package/dist/chunk-6DIA6PXV.cjs.map +0 -1
  121. package/dist/chunk-6JJIZCVY.cjs.map +0 -1
  122. package/dist/chunk-BE6B4PQF.cjs +0 -2
  123. package/dist/chunk-BE6B4PQF.cjs.map +0 -1
  124. package/dist/chunk-CHFETMC6.cjs.map +0 -1
  125. package/dist/chunk-GXV2JA36.mjs.map +0 -1
  126. package/dist/chunk-JDDRTHFG.mjs +0 -2
  127. package/dist/chunk-JDDRTHFG.mjs.map +0 -1
  128. package/dist/chunk-JSTCUTXP.cjs.map +0 -1
  129. package/dist/chunk-K5L2B4DU.mjs +0 -2
  130. package/dist/chunk-NXXMW2O7.mjs +0 -2
  131. package/dist/chunk-QVIAMSZ6.cjs.map +0 -1
  132. package/dist/chunk-RCWM55DE.cjs.map +0 -1
  133. package/dist/chunk-REWME3FY.cjs.map +0 -1
  134. package/dist/chunk-XZC34BHM.cjs.map +0 -1
  135. package/dist/chunk-Y2FETC6T.cjs.map +0 -1
  136. /package/dist/{chunk-WLJHFHKF.mjs.map → chunk-2VO2D4QO.mjs.map} +0 -0
  137. /package/dist/{chunk-ENT2OSXT.mjs.map → chunk-5XOEJ6XX.mjs.map} +0 -0
  138. /package/dist/{chunk-ZW2N63FI.mjs.map → chunk-A5BNPBXN.mjs.map} +0 -0
  139. /package/dist/{chunk-JXM5S4IU.mjs.map → chunk-DA7GK43B.mjs.map} +0 -0
  140. /package/dist/{chunk-KUQEX7H3.mjs.map → chunk-JHUVLM54.mjs.map} +0 -0
  141. /package/dist/{chunk-H6ZO4SLB.mjs.map → chunk-LUNZGZWN.mjs.map} +0 -0
  142. /package/dist/{chunk-RJN36GBU.mjs.map → chunk-OCAMR6XC.mjs.map} +0 -0
  143. /package/dist/{chunk-JIPSTWKO.mjs.map → chunk-OYF32BQQ.mjs.map} +0 -0
  144. /package/dist/{chunk-5QAFKFM5.mjs.map → chunk-TU63NRNL.mjs.map} +0 -0
@@ -7,6 +7,24 @@ import { Abi } from 'viem';
7
7
  */
8
8
  type SeverityLevel = "fatal" | "error" | "warning" | "log" | "info" | "debug";
9
9
 
10
+ /**
11
+ * Span status codes for tracing.
12
+ * Mirrors Sentry's SpanStatusType for compatibility, but owned by berajs
13
+ * so we don't depend on @sentry/nextjs.
14
+ *
15
+ * @see https://develop.sentry.dev/sdk/foundations/transport/event-payloads/span/
16
+ */
17
+ type SpanStatusType = "ok" | "cancelled" | "unknown_error" | "invalid_argument" | "deadline_exceeded" | "not_found" | "already_exists" | "permission_denied" | "resource_exhausted" | "failed_precondition" | "aborted" | "out_of_range" | "unimplemented" | "internal_error" | "unavailable" | "data_loss" | "unauthenticated";
18
+ /**
19
+ * Maps an HTTP status code to a span status.
20
+ */
21
+ declare function httpStatusToSpanStatus(code: number): SpanStatusType;
22
+ /**
23
+ * Maps a BeraError reason code to a span status.
24
+ * Returns undefined if no mapping exists (caller keeps existing spanStatus).
25
+ */
26
+ declare function reasonToSpanStatus(reason: string | null): SpanStatusType | undefined;
27
+
10
28
  interface IBeraErrorArgs {
11
29
  message?: string;
12
30
  displayMessage?: string;
@@ -26,6 +44,12 @@ interface IBeraErrorArgs {
26
44
  * Optional ABI to be used to parse the error.
27
45
  */
28
46
  abi?: Abi;
47
+ /**
48
+ * Span status for tracing. When set, the tracing adapter uses this to
49
+ * set the span status instead of a generic "internal_error".
50
+ * Auto-inferred from `reason` when not explicitly provided.
51
+ */
52
+ spanStatus?: SpanStatusType;
29
53
  }
30
54
  type Primitive = number | string | boolean | bigint | symbol | null | undefined;
31
55
  /**
@@ -87,8 +111,13 @@ declare class BeraError extends Error {
87
111
  [key: string | TagsKey]: Primitive;
88
112
  };
89
113
  level: SeverityLevel;
114
+ /**
115
+ * Span status for tracing providers.
116
+ * Auto-inferred from `reason` when not explicitly provided.
117
+ */
118
+ spanStatus?: SpanStatusType;
90
119
  extra: Record<string, unknown>;
91
- constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, fingerprint, }: IBeraErrorArgs);
120
+ constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, fingerprint, spanStatus, }: IBeraErrorArgs);
92
121
  }
93
122
 
94
- export { BeraError as B, type IBeraErrorArgs as I, type SeverityLevel as S };
123
+ export { BeraError as B, type IBeraErrorArgs as I, type SeverityLevel as S, type SpanStatusType as a, httpStatusToSpanStatus as h, reasonToSpanStatus as r };
@@ -7,6 +7,24 @@ import { Abi } from 'viem';
7
7
  */
8
8
  type SeverityLevel = "fatal" | "error" | "warning" | "log" | "info" | "debug";
9
9
 
10
+ /**
11
+ * Span status codes for tracing.
12
+ * Mirrors Sentry's SpanStatusType for compatibility, but owned by berajs
13
+ * so we don't depend on @sentry/nextjs.
14
+ *
15
+ * @see https://develop.sentry.dev/sdk/foundations/transport/event-payloads/span/
16
+ */
17
+ type SpanStatusType = "ok" | "cancelled" | "unknown_error" | "invalid_argument" | "deadline_exceeded" | "not_found" | "already_exists" | "permission_denied" | "resource_exhausted" | "failed_precondition" | "aborted" | "out_of_range" | "unimplemented" | "internal_error" | "unavailable" | "data_loss" | "unauthenticated";
18
+ /**
19
+ * Maps an HTTP status code to a span status.
20
+ */
21
+ declare function httpStatusToSpanStatus(code: number): SpanStatusType;
22
+ /**
23
+ * Maps a BeraError reason code to a span status.
24
+ * Returns undefined if no mapping exists (caller keeps existing spanStatus).
25
+ */
26
+ declare function reasonToSpanStatus(reason: string | null): SpanStatusType | undefined;
27
+
10
28
  interface IBeraErrorArgs {
11
29
  message?: string;
12
30
  displayMessage?: string;
@@ -26,6 +44,12 @@ interface IBeraErrorArgs {
26
44
  * Optional ABI to be used to parse the error.
27
45
  */
28
46
  abi?: Abi;
47
+ /**
48
+ * Span status for tracing. When set, the tracing adapter uses this to
49
+ * set the span status instead of a generic "internal_error".
50
+ * Auto-inferred from `reason` when not explicitly provided.
51
+ */
52
+ spanStatus?: SpanStatusType;
29
53
  }
30
54
  type Primitive = number | string | boolean | bigint | symbol | null | undefined;
31
55
  /**
@@ -87,8 +111,13 @@ declare class BeraError extends Error {
87
111
  [key: string | TagsKey]: Primitive;
88
112
  };
89
113
  level: SeverityLevel;
114
+ /**
115
+ * Span status for tracing providers.
116
+ * Auto-inferred from `reason` when not explicitly provided.
117
+ */
118
+ spanStatus?: SpanStatusType;
90
119
  extra: Record<string, unknown>;
91
- constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, fingerprint, }: IBeraErrorArgs);
120
+ constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, fingerprint, spanStatus, }: IBeraErrorArgs);
92
121
  }
93
122
 
94
- export { BeraError as B, type IBeraErrorArgs as I, type SeverityLevel as S };
123
+ export { BeraError as B, type IBeraErrorArgs as I, type SeverityLevel as S, type SpanStatusType as a, httpStatusToSpanStatus as h, reasonToSpanStatus as r };
@@ -1,5 +1,5 @@
1
1
  import { ErrorLike } from '@apollo/client';
2
- import { B as BeraError, I as IBeraErrorArgs } from './BeraError-_mQdkanr.cjs';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-7-A5JYy_.cjs';
3
3
 
4
4
  interface EventsMap {
5
5
  [event: string]: any;
@@ -1,5 +1,5 @@
1
1
  import { ErrorLike } from '@apollo/client';
2
- import { B as BeraError, I as IBeraErrorArgs } from './BeraError-_mQdkanr.js';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-7-A5JYy_.js';
3
3
 
4
4
  interface EventsMap {
5
5
  [event: string]: any;