@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.
- package/dist/{transactionStore-BvStaXf3.d.ts → BexStatusProvider-nS3NcdxI.d.cts} +1 -41
- package/dist/{transactionStore-CQrGYSY2.d.cts → BexStatusProvider-nS3NcdxI.d.ts} +1 -41
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +4 -5
- package/dist/actions/exports.d.ts +4 -5
- package/dist/actions/exports.mjs +1 -1
- package/dist/{chunk-OS5AJMYJ.cjs → chunk-22J3YJDN.cjs} +2 -2
- package/dist/chunk-22J3YJDN.cjs.map +1 -0
- package/dist/{chunk-MTS5SZLA.mjs → chunk-2LL3P5PN.mjs} +2 -2
- package/dist/chunk-3YXSUBA5.mjs +2 -0
- package/dist/{chunk-H2QSRMVS.mjs.map → chunk-3YXSUBA5.mjs.map} +1 -1
- package/dist/chunk-55L7STYD.mjs +2 -0
- package/dist/chunk-55L7STYD.mjs.map +1 -0
- package/dist/{chunk-BOYZVULX.cjs → chunk-6LDOG5RL.cjs} +2 -2
- package/dist/chunk-6LDOG5RL.cjs.map +1 -0
- package/dist/{chunk-UQUWMHVF.cjs → chunk-7LNBSOVV.cjs} +2 -2
- package/dist/chunk-7LNBSOVV.cjs.map +1 -0
- package/dist/{chunk-ZQRACIGR.mjs → chunk-7SMWQ6SN.mjs} +2 -2
- package/dist/{chunk-7GWTHOLO.mjs → chunk-7WRTK7RJ.mjs} +2 -2
- package/dist/chunk-A4UDYSB6.mjs +4 -0
- package/dist/chunk-A4UDYSB6.mjs.map +1 -0
- package/dist/chunk-AX2YQQFQ.mjs +2 -0
- package/dist/chunk-AX2YQQFQ.mjs.map +1 -0
- package/dist/chunk-C6ZGUO4H.cjs +2 -0
- package/dist/chunk-C6ZGUO4H.cjs.map +1 -0
- package/dist/chunk-CYKCYPFR.cjs.map +1 -1
- package/dist/chunk-ECRMUMTA.mjs +2 -0
- package/dist/chunk-ECRMUMTA.mjs.map +1 -0
- package/dist/{chunk-ZAKA4TGK.cjs → chunk-FCWDGE62.cjs} +2 -2
- package/dist/chunk-FCWDGE62.cjs.map +1 -0
- package/dist/chunk-FL2N3XHK.cjs.map +1 -1
- package/dist/chunk-MUCEYO3E.cjs +4 -0
- package/dist/chunk-MUCEYO3E.cjs.map +1 -0
- package/dist/chunk-OIYXOKTT.cjs.map +1 -1
- package/dist/chunk-P2Q7CMUD.cjs +2 -0
- package/dist/chunk-P2Q7CMUD.cjs.map +1 -0
- package/dist/chunk-PKXAW6MO.cjs +2 -0
- package/dist/chunk-PKXAW6MO.cjs.map +1 -0
- package/dist/chunk-SWMJQOH6.cjs.map +1 -1
- package/dist/{chunk-YQGZMWDT.mjs → chunk-THATXCJK.mjs} +2 -2
- package/dist/chunk-VP7XUOSI.cjs.map +1 -1
- package/dist/chunk-VXL2ZZ4X.cjs.map +1 -1
- package/dist/chunk-WRFDB3QJ.cjs.map +1 -1
- package/dist/chunk-XNJLSA6P.cjs.map +1 -1
- package/dist/chunk-YZV5LKIP.cjs +2 -0
- package/dist/chunk-YZV5LKIP.cjs.map +1 -0
- package/dist/contexts/exports.cjs +1 -1
- package/dist/contexts/exports.cjs.map +1 -1
- package/dist/contexts/exports.d.cts +2 -10
- package/dist/contexts/exports.d.ts +2 -10
- package/dist/contexts/exports.mjs +1 -1
- package/dist/contexts/exports.mjs.map +1 -1
- package/dist/enum/exports.cjs.map +1 -1
- package/dist/enum/exports.d.cts +1 -2
- package/dist/enum/exports.d.ts +1 -2
- package/dist/errors/exports.cjs +1 -1
- package/dist/errors/exports.cjs.map +1 -1
- package/dist/errors/exports.d.cts +25 -2
- package/dist/errors/exports.d.ts +25 -2
- package/dist/errors/exports.mjs +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-It0GsdvQ.d.cts → getValidatorQueuedOperatorAddress-Dstyaomr.d.cts} +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-BX35p2Lv.d.ts → getValidatorQueuedOperatorAddress-RW4OMcD1.d.ts} +1 -1
- package/dist/{global.d-Ba-NIojH.d.cts → global.d-CN6l2b9E.d.cts} +1 -2
- package/dist/{global.d-By70bEv2.d.ts → global.d-wYu8G8IQ.d.ts} +1 -2
- package/dist/hooks/exports.cjs +2 -2
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +7 -15
- package/dist/hooks/exports.d.ts +7 -15
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-BYNbCxla.d.ts → txnEnum-BlBYhNRl.d.cts} +74 -1
- package/dist/{txnEnum-BYNbCxla.d.cts → txnEnum-BlBYhNRl.d.ts} +74 -1
- package/dist/types/exports.cjs.map +1 -1
- package/dist/types/exports.d.cts +2 -3
- package/dist/types/exports.d.ts +2 -3
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +6 -6
- package/src/actions/dex/aggregators/haiku.ts +1 -1
- package/src/actions/dex/aggregators/oogabooga.ts +1 -1
- package/src/actions/pol/getEarnedStakedBeraVault.ts +1 -1
- package/src/actions/pol/getStakingDailyAssets.ts +4 -1
- package/src/actions/tokens/getWalletBalances.integration.test.ts +1 -1
- package/src/contexts/exports.ts +0 -1
- package/src/data/contracts.ts +1 -1
- package/src/errors/BeraError.ts +11 -2
- package/src/errors/RequestError.ts +27 -1
- package/src/errors/errorMap.ts +7 -6
- package/src/errors/getErrorMessage.ts +59 -20
- package/src/errors/getRevertReason.integration.test.ts +1 -1
- package/src/hooks/exports.ts +0 -4
- package/src/hooks/pol/useStakedData.ts +1 -1
- package/dist/chunk-7SC4VD3U.cjs +0 -2
- package/dist/chunk-7SC4VD3U.cjs.map +0 -1
- package/dist/chunk-BHNQX4XC.mjs +0 -2
- package/dist/chunk-BHNQX4XC.mjs.map +0 -1
- package/dist/chunk-BOYZVULX.cjs.map +0 -1
- package/dist/chunk-C3G5KXCH.mjs +0 -2
- package/dist/chunk-C3G5KXCH.mjs.map +0 -1
- package/dist/chunk-G6NA6NSM.mjs +0 -4
- package/dist/chunk-G6NA6NSM.mjs.map +0 -1
- package/dist/chunk-H2QSRMVS.mjs +0 -2
- package/dist/chunk-IJM76AWK.cjs +0 -4
- package/dist/chunk-IJM76AWK.cjs.map +0 -1
- package/dist/chunk-MUNAP5TM.cjs +0 -2
- package/dist/chunk-MUNAP5TM.cjs.map +0 -1
- package/dist/chunk-OS5AJMYJ.cjs.map +0 -1
- package/dist/chunk-TJWKS54T.mjs +0 -2
- package/dist/chunk-TJWKS54T.mjs.map +0 -1
- package/dist/chunk-UQUWMHVF.cjs.map +0 -1
- package/dist/chunk-UXUWSRVV.cjs +0 -2
- package/dist/chunk-UXUWSRVV.cjs.map +0 -1
- package/dist/chunk-WTCBORPB.cjs +0 -2
- package/dist/chunk-WTCBORPB.cjs.map +0 -1
- package/dist/chunk-ZAKA4TGK.cjs.map +0 -1
- package/dist/contracts-CQIPk0Jc.d.cts +0 -74
- package/dist/contracts-CQIPk0Jc.d.ts +0 -74
- package/src/contexts/TransactionStoreContext.tsx +0 -87
- package/src/hooks/transactions/transactionStore.ts +0 -296
- package/src/hooks/transactions/transactionStore.unit.test.ts +0 -561
- package/src/hooks/transactions/useAddRecentTransaction.ts +0 -29
- package/src/hooks/transactions/useRecentTransactions.ts +0 -27
- package/src/hooks/transactions/useSetTransactionStatus.ts +0 -31
- /package/dist/{chunk-MTS5SZLA.mjs.map → chunk-2LL3P5PN.mjs.map} +0 -0
- /package/dist/{chunk-ZQRACIGR.mjs.map → chunk-7SMWQ6SN.mjs.map} +0 -0
- /package/dist/{chunk-7GWTHOLO.mjs.map → chunk-7WRTK7RJ.mjs.map} +0 -0
- /package/dist/{chunk-YQGZMWDT.mjs.map → chunk-THATXCJK.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/berajs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"gray-matter": "4.0.3",
|
|
21
21
|
"lodash": "4.17.23",
|
|
22
22
|
"swr": "2.3.3",
|
|
23
|
-
"@berachain/
|
|
24
|
-
"@berachain/
|
|
23
|
+
"@berachain/config": "0.1.0",
|
|
24
|
+
"@berachain/utils": "0.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node-fetch": "2.6.12",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"@berachain/wagmi": "0.3.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "tsup",
|
|
59
|
+
"build": "NODE_OPTIONS='--max-old-space-size=8192' tsup",
|
|
60
60
|
"prebuild": "pnpm contracts:update",
|
|
61
61
|
"test": "vitest",
|
|
62
62
|
"clean": "git clean -xdf dist .turbo node_modules",
|
|
63
|
-
"check-types": "tsup --dtsOnly",
|
|
63
|
+
"check-types": "NODE_OPTIONS='--max-old-space-size=8192' tsup --dtsOnly",
|
|
64
64
|
"precheck-types": "pnpm prebuild",
|
|
65
|
-
"dev": "tsup --watch",
|
|
65
|
+
"dev": "NODE_OPTIONS='--max-old-space-size=8192' tsup --watch",
|
|
66
66
|
"lint": "biome lint",
|
|
67
67
|
"lint:fix": "pnpm lint --fix",
|
|
68
68
|
"errors:update": "node .scripts/updateUnkownSignatures.js && biome format src/abi/utils --write",
|
|
@@ -97,7 +97,7 @@ class HaikuAggregator extends BaseAggregator {
|
|
|
97
97
|
amountIn: amount,
|
|
98
98
|
allowanceRequirements: this.parseAllowanceRequirements({
|
|
99
99
|
tokenIn,
|
|
100
|
-
rawAmount:
|
|
100
|
+
rawAmount: amount,
|
|
101
101
|
spender: this.config.bex.aggregatorsRouter,
|
|
102
102
|
}),
|
|
103
103
|
name: this.name,
|
|
@@ -57,7 +57,7 @@ class OogaboogaAggregator extends BaseAggregator {
|
|
|
57
57
|
allowanceRequirements: this.parseAllowanceRequirements({
|
|
58
58
|
tokenIn,
|
|
59
59
|
spender: this.config.bex.aggregatorsRouter,
|
|
60
|
-
rawAmount:
|
|
60
|
+
rawAmount: amount,
|
|
61
61
|
}),
|
|
62
62
|
name: this.name,
|
|
63
63
|
priceImpactPercentage: quote.priceImpact,
|
|
@@ -27,5 +27,5 @@ export async function getEarnedStakedBeraVault({
|
|
|
27
27
|
GetEarnedStakedBeraVaultArgs): Promise<StakingHistoryData> {
|
|
28
28
|
const { config } = parseBaseArgs(args);
|
|
29
29
|
const url = `${config.bonder}/vaults/${address}/earnings/${account}`;
|
|
30
|
-
return beraFetchJson<StakingHistoryData>(url);
|
|
30
|
+
return beraFetchJson<StakingHistoryData>({ url, type: "rest" });
|
|
31
31
|
}
|
|
@@ -17,5 +17,8 @@ export async function getStakingDailyAssets({
|
|
|
17
17
|
|
|
18
18
|
const { config } = parseBaseArgs({});
|
|
19
19
|
const url = `${config.bonder}/vaults/${address}/total-assets-by-day?start=${startDayDate.toISOString().split("T")[0]}`;
|
|
20
|
-
return beraFetchJson<{ _timestamp: number; total_assets: string }[]>(
|
|
20
|
+
return beraFetchJson<{ _timestamp: number; total_assets: string }[]>({
|
|
21
|
+
url,
|
|
22
|
+
type: "rest",
|
|
23
|
+
});
|
|
21
24
|
}
|
|
@@ -51,7 +51,7 @@ describe("getWalletBalances", async () => {
|
|
|
51
51
|
|
|
52
52
|
expect(beraBalance).toBeDefined();
|
|
53
53
|
|
|
54
|
-
expect(BigInt(beraBalance?.balance.raw)).toBeGreaterThan(0n);
|
|
54
|
+
expect(BigInt(beraBalance?.balance.raw ?? "0")).toBeGreaterThan(0n);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it("should have balance for multiple chains", async () => {
|
package/src/contexts/exports.ts
CHANGED
package/src/data/contracts.ts
CHANGED
|
@@ -364,7 +364,7 @@ export const contracts = [
|
|
|
364
364
|
},
|
|
365
365
|
{
|
|
366
366
|
"80069": "0xE5Ad9BA751714ec8cdd554b5a9f12BFcA13980cB",
|
|
367
|
-
"80094": "
|
|
367
|
+
"80094": "0xF5686e448BE103beA465105bEb9d284a34ae7e95",
|
|
368
368
|
name: "honey.pythWrapper",
|
|
369
369
|
},
|
|
370
370
|
{
|
package/src/errors/BeraError.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Abi, BaseError } from "viem";
|
|
|
3
3
|
import { appConfig } from "@berachain/config/internal";
|
|
4
4
|
|
|
5
5
|
import { GENERAL_ERROR } from "./errorMap";
|
|
6
|
-
import {
|
|
6
|
+
import { findMatchingError } from "./getErrorMessage";
|
|
7
7
|
import { parseViemError, rpcErrorToReason } from "./parseViemError";
|
|
8
8
|
import type { SeverityLevel } from "./severity";
|
|
9
9
|
|
|
@@ -218,7 +218,16 @@ export class BeraError extends Error {
|
|
|
218
218
|
|
|
219
219
|
if (!displayMessage) {
|
|
220
220
|
// Match reason (exact) or message (keyword) against errorMap.ts
|
|
221
|
-
|
|
221
|
+
const matched = findMatchingError(this);
|
|
222
|
+
displayMessage = matched?.errorMSG;
|
|
223
|
+
|
|
224
|
+
// ── Reason normalization ──────────────────────────────────────────
|
|
225
|
+
// If the reason was resolved from a raw error message (e.g. "insufficient funds for
|
|
226
|
+
// gas * price + value: have X want Y") rather than a stable key (e.g. "InsufficientFundsError"),
|
|
227
|
+
// normalize it to the matched errorMap key (e.g. "NOT_ENOUGH_GAS") for stable Sentry fingerprinting.
|
|
228
|
+
if (matched && !matched.matchedByReason && this.reason) {
|
|
229
|
+
this.reason = matched.key;
|
|
230
|
+
}
|
|
222
231
|
}
|
|
223
232
|
|
|
224
233
|
this.displayMessage = displayMessage ?? GENERAL_ERROR;
|
|
@@ -35,6 +35,8 @@ export class RequestError extends BeraError {
|
|
|
35
35
|
"https://open-api.openocean.finance/v4/bera/swap",
|
|
36
36
|
// vercel internal proxy
|
|
37
37
|
"/api/aggregators?aggregator",
|
|
38
|
+
// bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
|
|
39
|
+
mainnet.bonder,
|
|
38
40
|
];
|
|
39
41
|
|
|
40
42
|
statusCode: number | undefined;
|
|
@@ -116,7 +118,10 @@ export class RequestError extends BeraError {
|
|
|
116
118
|
message += `HTTP ${this.statusCode} – `;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
const endpointLabel = this.endpoint.type
|
|
122
|
+
? `${this.endpoint.type}(${this.endpoint.url})`
|
|
123
|
+
: this.endpoint.url;
|
|
124
|
+
this.message = `${message}${endpointLabel}: ${this.message}`;
|
|
120
125
|
}
|
|
121
126
|
|
|
122
127
|
setEndpoint(
|
|
@@ -202,6 +207,27 @@ export class RequestError extends BeraError {
|
|
|
202
207
|
}
|
|
203
208
|
}
|
|
204
209
|
|
|
210
|
+
if (
|
|
211
|
+
typeof this.cause === "object" &&
|
|
212
|
+
this.cause !== null &&
|
|
213
|
+
"message" in this.cause &&
|
|
214
|
+
typeof this.cause.message === "string"
|
|
215
|
+
) {
|
|
216
|
+
const message = this.cause.message as string;
|
|
217
|
+
// this is a postgres error message. found in some bonder errors.
|
|
218
|
+
if (
|
|
219
|
+
message.startsWith(
|
|
220
|
+
"error: canceling statement due to lock timeout occurred in",
|
|
221
|
+
)
|
|
222
|
+
) {
|
|
223
|
+
return {
|
|
224
|
+
reason: RequestError.REASON_MAP.NETWORK_ERROR,
|
|
225
|
+
message: message,
|
|
226
|
+
url: this.endpoint.url,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
205
231
|
return false;
|
|
206
232
|
}
|
|
207
233
|
}
|
package/src/errors/errorMap.ts
CHANGED
|
@@ -76,13 +76,19 @@ export const errorMsgMap = {
|
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
RPC: {
|
|
79
|
-
|
|
79
|
+
NOT_ENOUGH_GAS_TOKEN: {
|
|
80
80
|
reasons: ["InsufficientFundsError"],
|
|
81
81
|
keywords: [
|
|
82
|
+
"insufficient funds for gas * price + value:",
|
|
82
83
|
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.",
|
|
83
84
|
],
|
|
84
85
|
errorMSG: "Insufficient BERA balance to perform this action.",
|
|
85
86
|
},
|
|
87
|
+
NONCE_TOO_LOW: {
|
|
88
|
+
keywords: ["nonce too low: next nonce"],
|
|
89
|
+
errorMSG:
|
|
90
|
+
"Nonce is too low. Your wallet might have unconfirmed transactions.",
|
|
91
|
+
},
|
|
86
92
|
GAS_PRICE: {
|
|
87
93
|
keywords: ["gasLimit"],
|
|
88
94
|
errorMSG:
|
|
@@ -94,13 +100,8 @@ export const errorMsgMap = {
|
|
|
94
100
|
errorMSG:
|
|
95
101
|
"It seems an RPC error has occurred. Please try your request one more later.",
|
|
96
102
|
},
|
|
97
|
-
NOT_ENOUGH_GAS: {
|
|
98
|
-
keywords: ["insufficient funds for gas * price + value:"],
|
|
99
|
-
errorMSG: "Gas balance is insufficient to cover the transaction cost.",
|
|
100
|
-
},
|
|
101
103
|
HASH: {
|
|
102
104
|
keywords: ["hash"],
|
|
103
|
-
|
|
104
105
|
errorMSG:
|
|
105
106
|
"It seems an RPC error has occurred. Please check if your transaction was finalized. If not, please try again.",
|
|
106
107
|
},
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { type ErrorCategory, errorMsgMap, GENERAL_ERROR } from "./errorMap";
|
|
2
2
|
|
|
3
|
+
export interface MatchedError {
|
|
4
|
+
/** The error key in the errorMap (e.g. "NOT_ENOUGH_GAS_TOKEN") */
|
|
5
|
+
key: string;
|
|
6
|
+
/** The category in the errorMap (e.g. "RPC", "BEX") */
|
|
7
|
+
category: string;
|
|
8
|
+
/** The user-friendly display message */
|
|
9
|
+
errorMSG: string;
|
|
10
|
+
/** Whether the match was by exact reason (true) or keyword (false) */
|
|
11
|
+
matchedByReason: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
3
14
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* This is the bridge between the automatic reason detection pipeline (parseViemError) and
|
|
7
|
-
* the user-facing error messages. Called by the BeraError constructor.
|
|
15
|
+
* Finds the matching error entry in errorMap by reason or message.
|
|
8
16
|
*
|
|
9
17
|
* ## Matching priority:
|
|
10
18
|
* 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.
|
|
11
|
-
*
|
|
12
|
-
* are matched deterministically.
|
|
13
|
-
* 2. **Keyword fallback**: checks `errorType.keywords` for substring matches in `message`.
|
|
14
|
-
* Use sparingly — keyword matching can cause false positives (e.g. "InsufficientBalance"
|
|
15
|
-
* keyword would also match "InsufficientBalanceToPayPythFee").
|
|
16
|
-
* 3. **GENERAL_ERROR fallback**: "Something went wrong. Please try again later."
|
|
19
|
+
* 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.
|
|
17
20
|
*
|
|
18
|
-
*
|
|
19
|
-
* The reason is auto-detected by parseViemError — you only need to map it to a message here.
|
|
21
|
+
* @returns The matched error entry with key and category, or null if no match found.
|
|
20
22
|
*/
|
|
21
|
-
export function
|
|
23
|
+
export function findMatchingError({
|
|
22
24
|
reason,
|
|
23
25
|
message,
|
|
24
26
|
}: {
|
|
25
27
|
reason?: string | null;
|
|
26
28
|
message?: string;
|
|
27
|
-
}):
|
|
29
|
+
}): MatchedError | null {
|
|
28
30
|
for (const category in errorMsgMap) {
|
|
29
31
|
const categoryKey = category as keyof typeof errorMsgMap;
|
|
30
32
|
const errors = errorMsgMap[categoryKey] as ErrorCategory;
|
|
@@ -39,21 +41,58 @@ export function getErrorMessage({
|
|
|
39
41
|
return r === reason;
|
|
40
42
|
})
|
|
41
43
|
) {
|
|
42
|
-
return
|
|
44
|
+
return {
|
|
45
|
+
key: type,
|
|
46
|
+
category,
|
|
47
|
+
errorMSG: errorType.errorMSG,
|
|
48
|
+
matchedByReason: true,
|
|
49
|
+
};
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
// Priority 2: Keyword substring match on message (fallback, use carefully)
|
|
53
|
+
// Priority 2: Keyword substring match on message (case-insensitive fallback, use carefully)
|
|
47
54
|
if (
|
|
48
55
|
errorType?.keywords?.some((keyword) => {
|
|
49
|
-
return message?.includes(keyword.toLowerCase().trim());
|
|
56
|
+
return message?.toLowerCase().includes(keyword.toLowerCase().trim());
|
|
50
57
|
})
|
|
51
58
|
) {
|
|
52
|
-
return
|
|
59
|
+
return {
|
|
60
|
+
key: type,
|
|
61
|
+
category,
|
|
62
|
+
errorMSG: errorType.errorMSG,
|
|
63
|
+
matchedByReason: false,
|
|
64
|
+
};
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a user-friendly displayMessage by matching `reason` and `message` against `errorMap.ts`.
|
|
74
|
+
*
|
|
75
|
+
* This is the bridge between the automatic reason detection pipeline (parseViemError) and
|
|
76
|
+
* the user-facing error messages. Called by the BeraError constructor.
|
|
77
|
+
*
|
|
78
|
+
* ## Matching priority:
|
|
79
|
+
* 1. **Exact reason match** (preferred): checks `errorType.reasons` for an exact string match.
|
|
80
|
+
* This is the most reliable path — contract revert reasons like "NotEnoughBalance" or "BAL#508"
|
|
81
|
+
* are matched deterministically.
|
|
82
|
+
* 2. **Keyword fallback**: checks `errorType.keywords` for case-insensitive substring matches in `message`.
|
|
83
|
+
* Use sparingly — keyword matching can cause false positives (e.g. "InsufficientBalance"
|
|
84
|
+
* keyword would also match "InsufficientBalanceToPayPythFee").
|
|
85
|
+
* 3. **GENERAL_ERROR fallback**: "Something went wrong. Please try again later."
|
|
86
|
+
*
|
|
87
|
+
* To ensure new contract errors get good displayMessages, add their reason to `errorMap.ts`.
|
|
88
|
+
* The reason is auto-detected by parseViemError — you only need to map it to a message here.
|
|
89
|
+
*/
|
|
90
|
+
export function getErrorMessage({
|
|
91
|
+
reason,
|
|
92
|
+
message,
|
|
93
|
+
}: {
|
|
94
|
+
reason?: string | null;
|
|
95
|
+
message?: string;
|
|
96
|
+
}): string {
|
|
97
|
+
return findMatchingError({ reason, message })?.errorMSG ?? GENERAL_ERROR;
|
|
59
98
|
}
|
|
@@ -263,7 +263,7 @@ describe("parseViemError", () => {
|
|
|
263
263
|
[
|
|
264
264
|
InsufficientFundsError.name,
|
|
265
265
|
new InsufficientFundsError(),
|
|
266
|
-
errorMsgMap.RPC.
|
|
266
|
+
errorMsgMap.RPC.NOT_ENOUGH_GAS_TOKEN.errorMSG,
|
|
267
267
|
],
|
|
268
268
|
[
|
|
269
269
|
UserRejectedRequestError.name,
|
package/src/hooks/exports.ts
CHANGED
|
@@ -98,10 +98,6 @@ export * from "./tokens/useTokenPrice";
|
|
|
98
98
|
export * from "./tokens/useTokenPrices";
|
|
99
99
|
export * from "./tokens/useTokens";
|
|
100
100
|
export * from "./tokens/useTotalSupply";
|
|
101
|
-
export * from "./transactions/transactionStore";
|
|
102
|
-
export * from "./transactions/useAddRecentTransaction";
|
|
103
|
-
export * from "./transactions/useRecentTransactions";
|
|
104
|
-
export * from "./transactions/useSetTransactionStatus";
|
|
105
101
|
export * from "./useBlockToTimestamp";
|
|
106
102
|
export * from "./useContractWrite";
|
|
107
103
|
export * from "./useGetVerifiedAbi";
|
|
@@ -26,7 +26,7 @@ export const useStakedData = (stakingConfigs: StakingConfig[]) => {
|
|
|
26
26
|
const { address: account } = useBeraWallet();
|
|
27
27
|
const QUERY_KEY =
|
|
28
28
|
account && wagmiConfig && stakingConfigs
|
|
29
|
-
? (["
|
|
29
|
+
? (["useStakedData", account, stakingConfigs, window] as const)
|
|
30
30
|
: null;
|
|
31
31
|
return useSWR<StakedBeraAsset[] | undefined, any, typeof QUERY_KEY>(
|
|
32
32
|
QUERY_KEY,
|
package/dist/chunk-7SC4VD3U.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;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&&_optionalChain([s, 'optionalAccess', _2 => _2.reasons, 'optionalAccess', _3 => _3.some, 'call', _4 => _4(l=>l===o)])||_optionalChain([s, 'optionalAccess', _5 => _5.keywords, 'optionalAccess', _6 => _6.some, 'call', _7 => _7(l=>_optionalChain([r, 'optionalAccess', _8 => _8.includes, 'call', _9 => _9(l.toLowerCase().trim())]))]))return s.errorMSG}}return u}var _viem = require('viem');var _internal = require('@berachain/config/internal');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 _viem.BaseError||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)&&_optionalChain([o, 'access', _10 => _10.args, 'optionalAccess', _11 => _11.at, 'call', _12 => _12(0)])?_optionalChain([o, 'access', _13 => _13.args, 'optionalAccess', _14 => _14.at, 'call', _15 => _15(0)]):o.errorName}function M({error:o,abi:r,revertIfUnknown:n=!0}){if(!h(o)){if(n)throw o;return o instanceof _viem.BaseError?{reason:o.shortMessage,rootCause:o}:{reason:o.message,rootCause:o}}let e=o;for(;h(e);){if(t(e,"ContractFunctionExecutionError",_viem.ContractFunctionExecutionError)){e=e.cause;continue}if(t(e,"TransactionExecutionError",_viem.TransactionExecutionError)&&e.cause instanceof _viem.AtomicReadyWalletRejectedUpgradeError)return{reason:"AtomicReadyWalletRejectedUpgradeError",rootCause:e.cause};if(t(e,"RpcRequestError",_viem.RpcRequestError)){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=_viem.decodeErrorResult.call(void 0, {data:e.data,abi:[...S,..._nullishCoalesce(r, () => ([]))]});return{reason:_nullishCoalesce(O(a), () => (e.shortMessage)),rootCause:e}}if(t(e,"ContractFunctionRevertedError",_viem.ContractFunctionRevertedError))return{reason:_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(e.reason, () => (e.signature)), () => (_optionalChain([e, 'access', _16 => _16.data, 'optionalAccess', _17 => _17.errorName]))), () => (e.shortMessage)),rootCause:e};if(t(e,"UserRejectedRequestError",_viem.UserRejectedRequestError))return{reason:"UserRejectedRequestError",rootCause:e};if(t(e,"HttpRequestError",_viem.HttpRequestError))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 =class o extends Error{__init() {this.reason=null}__init2() {this._tags={}}set tags(r){this._tags=r}get tags(){return{...this._tags,"error.displayMessage":this.displayMessage,"error.reason":this.reason,"error.level":this.level}}__init3() {this.level="error"}__init4() {this.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 _viem.BaseError?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});_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);,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=_nullishCoalesce(_optionalChain([w, 'optionalAccess', _18 => _18.reason]), () => (null))}catch (e2){}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=_nullishCoalesce(B, () => (u)),this.tags={...this.tags,...l},!_internal.appConfig.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())}}, _class);var _mainnet = require('@berachain/config/mainnet');var y= (_class2 =class o extends i{static isCorsError(r){return r.cause instanceof Response&&r.cause.type==="cors"}__init5() {this.queryRichfulDomains=[_mainnet.mainnet.bex.aggregatorsProxyUrl,"https://api.fly.trade/aggregator/quote","https://open-api.openocean.finance/v4/bera/swap","/api/aggregators?aggregator"]}static __initStatic() {this.REASON_MAP={429:"RATE_LIMITED_429",NETWORK_ERROR:"NETWORK_ERROR",CORS_ERROR:"CORS"}}constructor(r){if(super(r);_class2.prototype.__init5.call(this);,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=_nullishCoalesce(r.level, () => ("warning"));else{let e=this.tryMatchNetworkError();e&&(this.reason=_nullishCoalesce(this.reason, () => (e.reason)),this.level=_nullishCoalesce(r.level, () => ("warning")),this.endpoint.url=_nullishCoalesce(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 (e3){}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}}, _class2.__initStatic(), _class2);var G=class extends i{constructor(r){super(r),this.level=_nullishCoalesce(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}};exports.a = A; exports.b = S; exports.c = O; exports.d = M; exports.e = i; exports.f = y; exports.g = G;
|
|
2
|
-
//# sourceMappingURL=chunk-7SC4VD3U.cjs.map
|