@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.
- package/dist/{BeraError-_mQdkanr.d.cts → BeraError-7-A5JYy_.d.cts} +31 -2
- package/dist/{BeraError-_mQdkanr.d.ts → BeraError-7-A5JYy_.d.ts} +31 -2
- package/dist/{RequestError-DSUzJ1Iy.d.cts → RequestError-02juqN-5.d.cts} +1 -1
- package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.mjs +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +2 -2
- package/dist/actions/exports.d.ts +2 -2
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/governance/exports.cjs +1 -1
- package/dist/actions/governance/exports.cjs.map +1 -1
- package/dist/actions/governance/exports.mjs +1 -1
- package/dist/chunk-2A347ZVN.mjs +2 -0
- package/dist/{chunk-NXXMW2O7.mjs.map → chunk-2A347ZVN.mjs.map} +1 -1
- package/dist/{chunk-WLJHFHKF.mjs → chunk-2VO2D4QO.mjs} +2 -2
- package/dist/chunk-5FVW5XU3.mjs +2 -0
- package/dist/chunk-5FVW5XU3.mjs.map +1 -0
- package/dist/{chunk-GXV2JA36.mjs → chunk-5SIQ7BKT.mjs} +2 -2
- package/dist/chunk-5SIQ7BKT.mjs.map +1 -0
- package/dist/{chunk-ENT2OSXT.mjs → chunk-5XOEJ6XX.mjs} +2 -2
- package/dist/{chunk-ZW2N63FI.mjs → chunk-A5BNPBXN.mjs} +2 -2
- package/dist/{chunk-4TALWNXE.cjs → chunk-COSP3YIF.cjs} +2 -2
- package/dist/chunk-COSP3YIF.cjs.map +1 -0
- package/dist/chunk-D6L7LTA2.cjs.map +1 -1
- package/dist/{chunk-JXM5S4IU.mjs → chunk-DA7GK43B.mjs} +2 -2
- package/dist/chunk-DDEQFR3M.cjs.map +1 -1
- package/dist/{chunk-6JJIZCVY.cjs → chunk-DKZGCMH4.cjs} +2 -2
- package/dist/chunk-DKZGCMH4.cjs.map +1 -0
- package/dist/{chunk-Y2FETC6T.cjs → chunk-F4V5B6F7.cjs} +2 -2
- package/dist/chunk-F4V5B6F7.cjs.map +1 -0
- package/dist/{chunk-QVIAMSZ6.cjs → chunk-FDEUAXET.cjs} +2 -2
- package/dist/chunk-FDEUAXET.cjs.map +1 -0
- package/dist/{chunk-33XNWMPP.cjs → chunk-FQSOUEIJ.cjs} +2 -2
- package/dist/chunk-FQSOUEIJ.cjs.map +1 -0
- package/dist/{chunk-XZC34BHM.cjs → chunk-GEIY554A.cjs} +2 -2
- package/dist/chunk-GEIY554A.cjs.map +1 -0
- package/dist/{chunk-KUQEX7H3.mjs → chunk-JHUVLM54.mjs} +2 -2
- package/dist/{chunk-RCWM55DE.cjs → chunk-JZL5JPDJ.cjs} +2 -2
- package/dist/chunk-JZL5JPDJ.cjs.map +1 -0
- package/dist/{chunk-H6ZO4SLB.mjs → chunk-LUNZGZWN.mjs} +2 -2
- package/dist/{chunk-RJN36GBU.mjs → chunk-OCAMR6XC.mjs} +2 -2
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-OUD27MU7.cjs.map +1 -1
- package/dist/{chunk-JIPSTWKO.mjs → chunk-OYF32BQQ.mjs} +2 -2
- package/dist/{chunk-54BTOQE3.cjs → chunk-PFUVKW6F.cjs} +2 -2
- package/dist/chunk-PFUVKW6F.cjs.map +1 -0
- package/dist/{chunk-JSTCUTXP.cjs → chunk-QHCLZTCK.cjs} +2 -2
- package/dist/chunk-QHCLZTCK.cjs.map +1 -0
- package/dist/chunk-RWOICHRW.cjs.map +1 -1
- package/dist/{chunk-CHFETMC6.cjs → chunk-S2TNHMSV.cjs} +3 -3
- package/dist/chunk-S2TNHMSV.cjs.map +1 -0
- package/dist/chunk-S4CDSVLK.cjs.map +1 -1
- package/dist/{chunk-5QAFKFM5.mjs → chunk-TU63NRNL.mjs} +2 -2
- package/dist/{chunk-REWME3FY.cjs → chunk-W4JE2NIN.cjs} +2 -2
- package/dist/chunk-W4JE2NIN.cjs.map +1 -0
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XB2SEO4Y.cjs +2 -0
- package/dist/chunk-XB2SEO4Y.cjs.map +1 -0
- package/dist/chunk-XCVDZUEF.mjs +2 -0
- package/dist/{chunk-K5L2B4DU.mjs.map → chunk-XCVDZUEF.mjs.map} +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/chunk-YYUSCGVI.cjs +2 -0
- package/dist/chunk-YYUSCGVI.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.mjs +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/governance/exports.cjs.map +1 -1
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +4 -3
- package/dist/errors/exports.d.ts +4 -3
- package/dist/errors/exports.mjs +1 -1
- package/dist/{global.d-ylUk_etZ.d.ts → global.d-C4FnE4cz.d.ts} +1 -1
- package/dist/{global.d-B9nLZ7ul.d.cts → global.d-CicOIudf.d.cts} +1 -1
- package/dist/hooks/exports.cjs +2 -2
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +3 -3
- package/dist/hooks/exports.d.ts +3 -3
- package/dist/hooks/exports.mjs +2 -2
- package/dist/hooks/governance/exports.cjs +1 -1
- package/dist/hooks/governance/exports.cjs.map +1 -1
- package/dist/hooks/governance/exports.d.cts +2 -2
- package/dist/hooks/governance/exports.d.ts +2 -2
- package/dist/hooks/governance/exports.mjs +1 -1
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +2 -2
- package/dist/types/exports.d.ts +2 -2
- package/dist/types/governance/exports.cjs.map +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +13 -4
- package/dist/utils/exports.d.ts +13 -4
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +46 -40
- package/src/actions/__test/transports.ts +61 -0
- package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
- package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
- package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
- package/src/data/contracts.ts +5 -0
- package/src/errors/BeraError.ts +27 -0
- package/src/errors/BeraTracing.unit.test.ts +65 -0
- package/src/errors/RequestError.ts +12 -0
- package/src/errors/exports.ts +5 -0
- package/src/errors/getRevertReason.integration.test.ts +3 -3
- package/src/errors/spanStatus.ts +78 -0
- package/src/errors/spanStatus.unit.test.ts +62 -0
- package/src/utils/beraFetch.ts +9 -3
- package/src/utils/exports.ts +1 -0
- package/src/utils/getServerSideClient.ts +4 -2
- package/src/utils/sanitizeRpcUrl.ts +22 -0
- package/src/utils/tracedTransport.ts +35 -0
- package/dist/chunk-33XNWMPP.cjs.map +0 -1
- package/dist/chunk-4TALWNXE.cjs.map +0 -1
- package/dist/chunk-54BTOQE3.cjs.map +0 -1
- package/dist/chunk-6DIA6PXV.cjs +0 -2
- package/dist/chunk-6DIA6PXV.cjs.map +0 -1
- package/dist/chunk-6JJIZCVY.cjs.map +0 -1
- package/dist/chunk-BE6B4PQF.cjs +0 -2
- package/dist/chunk-BE6B4PQF.cjs.map +0 -1
- package/dist/chunk-CHFETMC6.cjs.map +0 -1
- package/dist/chunk-GXV2JA36.mjs.map +0 -1
- package/dist/chunk-JDDRTHFG.mjs +0 -2
- package/dist/chunk-JDDRTHFG.mjs.map +0 -1
- package/dist/chunk-JSTCUTXP.cjs.map +0 -1
- package/dist/chunk-K5L2B4DU.mjs +0 -2
- package/dist/chunk-NXXMW2O7.mjs +0 -2
- package/dist/chunk-QVIAMSZ6.cjs.map +0 -1
- package/dist/chunk-RCWM55DE.cjs.map +0 -1
- package/dist/chunk-REWME3FY.cjs.map +0 -1
- package/dist/chunk-XZC34BHM.cjs.map +0 -1
- package/dist/chunk-Y2FETC6T.cjs.map +0 -1
- /package/dist/{chunk-WLJHFHKF.mjs.map → chunk-2VO2D4QO.mjs.map} +0 -0
- /package/dist/{chunk-ENT2OSXT.mjs.map → chunk-5XOEJ6XX.mjs.map} +0 -0
- /package/dist/{chunk-ZW2N63FI.mjs.map → chunk-A5BNPBXN.mjs.map} +0 -0
- /package/dist/{chunk-JXM5S4IU.mjs.map → chunk-DA7GK43B.mjs.map} +0 -0
- /package/dist/{chunk-KUQEX7H3.mjs.map → chunk-JHUVLM54.mjs.map} +0 -0
- /package/dist/{chunk-H6ZO4SLB.mjs.map → chunk-LUNZGZWN.mjs.map} +0 -0
- /package/dist/{chunk-RJN36GBU.mjs.map → chunk-OCAMR6XC.mjs.map} +0 -0
- /package/dist/{chunk-JIPSTWKO.mjs.map → chunk-OYF32BQQ.mjs.map} +0 -0
- /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 };
|