@berachain/berajs 0.2.8-beta.9 → 0.2.10
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.ts} +31 -2
- package/dist/{HoneyConfigProvider-DVP_9KZn.d.ts → HoneyConfigProvider-Dkj-_a5x.d.ts} +1 -1
- package/dist/{RequestError-BRIiJgHk.d.ts → RequestError-DBOIV65x.d.ts} +1 -1
- package/dist/abi/exports.mjs +4452 -2
- package/dist/actions/clients/exports.d.ts +78 -0
- package/dist/actions/clients/exports.mjs +21 -0
- package/dist/actions/exports.d.ts +154 -207
- package/dist/actions/exports.mjs +853 -2
- package/dist/actions/governance/exports.d.ts +140 -0
- package/dist/actions/governance/exports.mjs +226 -0
- package/dist/actions/server/exports.d.ts +13 -0
- package/dist/actions/server/exports.mjs +27 -0
- package/dist/chunk-3JJLQ2JX.mjs +211 -0
- package/dist/chunk-7YVNSDXG.mjs +86 -0
- package/dist/chunk-AUOPN6NK.mjs +96 -0
- package/dist/chunk-BGMRHTBQ.mjs +23 -0
- package/dist/chunk-CDK4YV3D.mjs +571 -0
- package/dist/chunk-DKMAIU74.mjs +62 -0
- package/dist/chunk-DQRH5VE3.mjs +25 -0
- package/dist/chunk-E7YFXBBQ.mjs +349 -0
- package/dist/chunk-GUURQAME.mjs +326 -0
- package/dist/chunk-GY6B3PD5.mjs +89 -0
- package/dist/chunk-HQCOU6GY.mjs +243 -0
- package/dist/chunk-HYDP32P6.mjs +135 -0
- package/dist/chunk-IXIBY5FP.mjs +80 -0
- package/dist/chunk-KHXJDYA4.mjs +1776 -0
- package/dist/chunk-NBYLMO2L.mjs +14 -0
- package/dist/chunk-O2NQFKJK.mjs +170 -0
- package/dist/chunk-P5WXXULM.mjs +54 -0
- package/dist/chunk-QBBOWFMH.mjs +4129 -0
- package/dist/chunk-QVHEM4BG.mjs +35 -0
- package/dist/chunk-SGIJVHZO.mjs +12 -0
- package/dist/chunk-SZ5C44L5.mjs +35 -0
- package/dist/chunk-WNBWX23Q.mjs +426 -0
- package/dist/chunk-Y6THHG77.mjs +126 -0
- package/dist/chunk-ZLTMIFCZ.mjs +165 -0
- package/dist/contexts/exports.d.ts +2 -2
- package/dist/contexts/exports.mjs +85 -2
- package/dist/enum/exports.d.ts +1 -1
- package/dist/enum/exports.mjs +46 -2
- package/dist/enum/governance/exports.d.ts +60 -0
- package/dist/enum/governance/exports.mjs +14 -0
- package/dist/errors/exports.d.ts +4 -3
- package/dist/errors/exports.mjs +48 -2
- package/dist/getApolloClient-BcUTGFUb.d.ts +40 -0
- package/dist/{getValidatorQueuedOperatorAddress-BcyxE9uw.d.ts → getValidatorQueuedOperatorAddress-DphU3qhE.d.ts} +2 -2
- package/dist/{global.d-5w_lvl2J.d.ts → global.d-BuGDKh4k.d.ts} +4 -240
- package/dist/hooks/exports.d.ts +83 -226
- package/dist/hooks/exports.mjs +7463 -4
- package/dist/hooks/governance/exports.d.ts +181 -0
- package/dist/hooks/governance/exports.mjs +888 -0
- package/dist/pol.d-Dw5SQcRX.d.ts +153 -0
- package/dist/{txnEnum-7_o92X3N.d.cts → txnEnum-ByI5dtDi.d.ts} +2 -60
- package/dist/types/exports.d.ts +9 -9
- package/dist/types/exports.mjs +0 -1
- package/dist/types/governance/exports.d.ts +109 -0
- package/dist/types/governance/exports.mjs +0 -0
- package/dist/{useHoneySwapState-B494PQDl.d.ts → useHoneySwapState-vFmuFF0g.d.ts} +1 -1
- package/dist/utils/exports.d.ts +15 -6
- package/dist/utils/exports.mjs +827 -2
- package/package.json +49 -13
- package/src/actions/__test/transports.ts +61 -0
- package/src/actions/clients/exports.ts +7 -0
- package/src/actions/clients/fetchBeep.ts +34 -0
- package/src/actions/clients/fetchOpenApi.ts +93 -0
- package/src/actions/clients/fetchOpenApi.unit.test.ts +223 -0
- package/src/actions/clients/fetchRailwayBackend.ts +34 -0
- package/src/actions/clients/getApolloClient.ts +58 -23
- package/src/actions/clients/getEnsoClient.ts +20 -9
- package/src/actions/dex/aggregators/enso/enso.ts +27 -17
- package/src/actions/dex/aggregators/enso/ensoErc4626.ts +2 -2
- package/src/actions/dex/aggregators/kyberswap.ts +18 -23
- package/src/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.ts +3 -6
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
- package/src/actions/exports.ts +5 -9
- package/src/actions/governance/exports.ts +9 -0
- package/src/actions/governance/getAllProposals.ts +10 -65
- package/src/actions/governance/getProposalDetails.ts +6 -33
- package/src/actions/governance/getProposalVotes.ts +8 -15
- package/src/actions/honey/getChartData.ts +27 -21
- package/src/actions/honey/getHoney24hVolume.ts +19 -22
- package/src/actions/honey/getPythLatestPrices.ts +7 -0
- package/src/actions/pol/__tests__/rewardVaults.integration.test.ts +1 -1
- package/src/actions/pol/getAutoclaimedIncentives.ts +41 -0
- package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
- package/src/actions/pol/getBeraTokenTotalSupply.ts +45 -0
- package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +28 -0
- package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -20
- package/src/actions/pol/getGlobalData.ts +1 -0
- package/src/actions/pol/getHeroEarnVaults.ts +62 -0
- package/src/actions/pol/getIncentiveFeeClaimStats.ts +19 -38
- package/src/actions/pol/getRewardVaults.ts +4 -4
- package/src/actions/pol/getSWBeraVaultMetadata.ts +1 -1
- package/src/actions/pol/getStakingDailyAssets.ts +18 -17
- package/src/actions/server/exports.ts +1 -0
- package/src/actions/server/getDailyValidatorBlockStats.ts +33 -0
- package/src/actions/tokens/getWalletBalances.integration.test.ts +3 -6
- package/src/actions/transactions/beraWriteContract.integration.test.ts +3 -6
- package/src/actions/validators/getDailyValidatorBlockStats.ts +25 -24
- package/src/actions/validators/getValidatorAnalytics.ts +20 -21
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +33 -0
- package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
- package/src/enum/contracts.ts +1 -0
- package/src/enum/exports.ts +0 -1
- package/src/enum/governance/exports.ts +1 -0
- package/src/errors/BeraError.ts +47 -7
- package/src/errors/BeraTracing.unit.test.ts +65 -0
- package/src/errors/RequestError.ts +25 -4
- package/src/errors/RequestError.unit.test.ts +55 -0
- package/src/errors/errorMap.ts +8 -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/hooks/dex/useCreatePool.ts +1 -88
- package/src/hooks/dex/useOnChainPoolData.ts +27 -2
- package/src/hooks/dex/usePriceImpact.ts +12 -5
- package/src/hooks/enso/useBendDemultiply.ts +9 -1
- package/src/hooks/enso/useBendMultiply.ts +9 -1
- package/src/hooks/enso/useBendZapSupply.ts +26 -7
- package/src/hooks/enso/useEnsoSwapBundle.ts +17 -3
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +13 -2
- package/src/hooks/exports.ts +3 -15
- package/src/hooks/governance/exports.ts +14 -0
- package/src/hooks/pol/useAutoclaimedIncentives.ts +40 -0
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +45 -0
- package/src/hooks/pol/useStakedAPR.ts +2 -2
- package/src/hooks/pol/useStakedSnapshots.ts +5 -9
- package/src/hooks/validators/useValidator.ts +6 -8
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +39 -0
- package/src/types/bribe-boost.d.ts +19 -0
- package/src/types/exports.ts +0 -1
- package/src/types/governance/exports.ts +1 -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/polyfillAbortSignalAny.ts +53 -0
- package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
- package/src/utils/sanitizeRpcUrl.ts +22 -0
- package/src/utils/tracedTransport.ts +35 -0
- package/dist/BeraError-_mQdkanr.d.ts +0 -94
- package/dist/BexStatusProvider-DRymVlQf.d.cts +0 -70
- package/dist/HoneyConfigProvider-DfkjmzEf.d.cts +0 -390
- package/dist/RequestError-DSUzJ1Iy.d.cts +0 -144
- package/dist/abi/exports.cjs +0 -2
- package/dist/abi/exports.cjs.map +0 -1
- package/dist/abi/exports.d.cts +0 -6574
- package/dist/abi/exports.mjs.map +0 -1
- package/dist/actions/exports.cjs +0 -2
- package/dist/actions/exports.cjs.map +0 -1
- package/dist/actions/exports.d.cts +0 -1650
- package/dist/actions/exports.mjs.map +0 -1
- package/dist/chunk-45HIEVNI.cjs +0 -4
- package/dist/chunk-45HIEVNI.cjs.map +0 -1
- package/dist/chunk-47ILYVHC.mjs +0 -2
- package/dist/chunk-47ILYVHC.mjs.map +0 -1
- package/dist/chunk-575OK77P.mjs +0 -2
- package/dist/chunk-575OK77P.mjs.map +0 -1
- package/dist/chunk-5NVZG5N6.mjs +0 -2
- package/dist/chunk-5NVZG5N6.mjs.map +0 -1
- package/dist/chunk-6DIA6PXV.cjs +0 -2
- package/dist/chunk-6DIA6PXV.cjs.map +0 -1
- package/dist/chunk-6JJIZCVY.cjs +0 -2
- package/dist/chunk-6JJIZCVY.cjs.map +0 -1
- package/dist/chunk-7F72ZH4Q.mjs +0 -2
- package/dist/chunk-7F72ZH4Q.mjs.map +0 -1
- package/dist/chunk-AUA42YIG.mjs +0 -4
- package/dist/chunk-AUA42YIG.mjs.map +0 -1
- package/dist/chunk-BC2WX6O6.cjs +0 -2
- package/dist/chunk-BC2WX6O6.cjs.map +0 -1
- package/dist/chunk-CJOZC5Z2.cjs +0 -2
- package/dist/chunk-CJOZC5Z2.cjs.map +0 -1
- package/dist/chunk-D6L7LTA2.cjs +0 -2
- package/dist/chunk-D6L7LTA2.cjs.map +0 -1
- package/dist/chunk-DDEQFR3M.cjs +0 -2
- package/dist/chunk-DDEQFR3M.cjs.map +0 -1
- package/dist/chunk-GXV2JA36.mjs +0 -2
- package/dist/chunk-GXV2JA36.mjs.map +0 -1
- package/dist/chunk-ISYNEDET.mjs +0 -2
- package/dist/chunk-ISYNEDET.mjs.map +0 -1
- package/dist/chunk-JDDRTHFG.mjs +0 -2
- package/dist/chunk-JDDRTHFG.mjs.map +0 -1
- package/dist/chunk-JDZGYU5T.mjs +0 -2
- package/dist/chunk-JDZGYU5T.mjs.map +0 -1
- package/dist/chunk-LVOXBZMA.cjs +0 -2
- package/dist/chunk-LVOXBZMA.cjs.map +0 -1
- package/dist/chunk-MK5NS5B5.mjs +0 -2
- package/dist/chunk-MK5NS5B5.mjs.map +0 -1
- package/dist/chunk-NAXAZJJY.mjs +0 -2
- package/dist/chunk-NAXAZJJY.mjs.map +0 -1
- package/dist/chunk-NLVWRMGD.mjs +0 -2
- package/dist/chunk-NLVWRMGD.mjs.map +0 -1
- package/dist/chunk-OGBD5YOG.mjs +0 -2
- package/dist/chunk-OGBD5YOG.mjs.map +0 -1
- package/dist/chunk-OGJMSGB2.mjs +0 -2
- package/dist/chunk-OGJMSGB2.mjs.map +0 -1
- package/dist/chunk-OIYXOKTT.cjs +0 -2
- package/dist/chunk-OIYXOKTT.cjs.map +0 -1
- package/dist/chunk-OUD27MU7.cjs +0 -2
- package/dist/chunk-OUD27MU7.cjs.map +0 -1
- package/dist/chunk-PRLVZIKD.mjs +0 -2
- package/dist/chunk-PRLVZIKD.mjs.map +0 -1
- package/dist/chunk-Q2SNRLW3.cjs +0 -2
- package/dist/chunk-Q2SNRLW3.cjs.map +0 -1
- package/dist/chunk-REWME3FY.cjs +0 -2
- package/dist/chunk-REWME3FY.cjs.map +0 -1
- package/dist/chunk-RJN36GBU.mjs +0 -2
- package/dist/chunk-RJN36GBU.mjs.map +0 -1
- package/dist/chunk-RWOICHRW.cjs +0 -2
- package/dist/chunk-RWOICHRW.cjs.map +0 -1
- package/dist/chunk-S4CDSVLK.cjs +0 -2
- package/dist/chunk-S4CDSVLK.cjs.map +0 -1
- package/dist/chunk-SFEULGSX.cjs +0 -2
- package/dist/chunk-SFEULGSX.cjs.map +0 -1
- package/dist/chunk-WBTS6KFG.mjs +0 -2
- package/dist/chunk-WBTS6KFG.mjs.map +0 -1
- package/dist/chunk-WRFDB3QJ.cjs +0 -2
- package/dist/chunk-WRFDB3QJ.cjs.map +0 -1
- package/dist/chunk-XNJLSA6P.cjs +0 -2
- package/dist/chunk-XNJLSA6P.cjs.map +0 -1
- package/dist/contexts/exports.cjs +0 -2
- package/dist/contexts/exports.cjs.map +0 -1
- package/dist/contexts/exports.d.cts +0 -66
- package/dist/contexts/exports.mjs.map +0 -1
- package/dist/defaultFlags-D6KfkTZx.d.cts +0 -10
- package/dist/dex-C_BB0b0O.d.cts +0 -37
- package/dist/enum/exports.cjs +0 -2
- package/dist/enum/exports.cjs.map +0 -1
- package/dist/enum/exports.d.cts +0 -23
- package/dist/enum/exports.mjs.map +0 -1
- package/dist/errors/exports.cjs +0 -2
- package/dist/errors/exports.cjs.map +0 -1
- package/dist/errors/exports.d.cts +0 -327
- package/dist/errors/exports.mjs.map +0 -1
- package/dist/getValidatorQueuedOperatorAddress-Cql_D50j.d.cts +0 -562
- package/dist/global.d-B7IeayVX.d.cts +0 -474
- package/dist/honey-CYm0RWf4.d.cts +0 -14
- package/dist/hooks/exports.cjs +0 -4
- package/dist/hooks/exports.cjs.map +0 -1
- package/dist/hooks/exports.d.cts +0 -1734
- package/dist/hooks/exports.mjs.map +0 -1
- package/dist/polling-BKnyavLI.d.cts +0 -8
- package/dist/txnEnum-7_o92X3N.d.ts +0 -164
- package/dist/types/exports.cjs +0 -1
- package/dist/types/exports.cjs.map +0 -1
- package/dist/types/exports.d.cts +0 -90
- package/dist/types/exports.mjs.map +0 -1
- package/dist/useHoneySwapState-D6vpv19r.d.cts +0 -32
- package/dist/utils/exports.cjs +0 -2
- package/dist/utils/exports.cjs.map +0 -1
- package/dist/utils/exports.d.cts +0 -420
- package/dist/utils/exports.mjs.map +0 -1
- package/src/actions/dex/getIsTokenExploited.ts +0 -63
- package/src/hooks/dex/useExploitedTokens.ts +0 -57
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BeraError,
|
|
3
|
+
errorMsgMap,
|
|
4
|
+
httpStatusToSpanStatus,
|
|
5
|
+
reasonToSpanStatus
|
|
6
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
7
|
+
|
|
8
|
+
// src/errors/RequestError.ts
|
|
9
|
+
import { getUriFromLink } from "@berachain/config";
|
|
10
|
+
import { bepolia } from "@berachain/config/bepolia";
|
|
11
|
+
import { mainnet } from "@berachain/config/mainnet";
|
|
12
|
+
var RequestError = class _RequestError extends BeraError {
|
|
13
|
+
/**
|
|
14
|
+
* The error response from the request.
|
|
15
|
+
*/
|
|
16
|
+
response;
|
|
17
|
+
static isCorsError(error) {
|
|
18
|
+
return error.cause instanceof Response && error.cause.type === "cors";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The endpoint that was requested.
|
|
22
|
+
*/
|
|
23
|
+
endpoint;
|
|
24
|
+
/**
|
|
25
|
+
* A list of domains that should have their query params removed.
|
|
26
|
+
*/
|
|
27
|
+
queryRichfulDomains = [
|
|
28
|
+
mainnet.bex.aggregatorsProxyUrl,
|
|
29
|
+
// covers both /aggregator/quote and /aggregator/transaction?quoteId=...
|
|
30
|
+
// (the transaction endpoint's quoteId would otherwise fragment grouping)
|
|
31
|
+
"https://api.fly.trade/aggregator",
|
|
32
|
+
"https://open-api.openocean.finance/v4/bera/swap",
|
|
33
|
+
// vercel internal proxy
|
|
34
|
+
"/api/aggregators?aggregator",
|
|
35
|
+
// bonder endpoints have date-based query params (e.g. ?start=2025-11-28)
|
|
36
|
+
mainnet.backend,
|
|
37
|
+
// beep (next-gen backend) on testnet — same date-based bonder query params
|
|
38
|
+
bepolia.beep
|
|
39
|
+
];
|
|
40
|
+
statusCode;
|
|
41
|
+
payload;
|
|
42
|
+
static REASON_MAP = {
|
|
43
|
+
429: "RATE_LIMITED_429",
|
|
44
|
+
NETWORK_ERROR: "NETWORK_ERROR",
|
|
45
|
+
CORS_ERROR: "CORS"
|
|
46
|
+
};
|
|
47
|
+
constructor(args) {
|
|
48
|
+
super(args);
|
|
49
|
+
this.name = "RequestError";
|
|
50
|
+
this.response = args.response;
|
|
51
|
+
this.payload = args.payload;
|
|
52
|
+
this.endpoint = this.setEndpoint(args.endpoint);
|
|
53
|
+
if (!this.message && typeof this.cause === "object" && this.cause !== null) {
|
|
54
|
+
if ("error" in this.cause && typeof this.cause.error === "string") {
|
|
55
|
+
this.message = this.cause.error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (args.statusCode) {
|
|
59
|
+
this.statusCode = args.statusCode;
|
|
60
|
+
} else if (this.response instanceof Response) {
|
|
61
|
+
this.statusCode = this.response.status;
|
|
62
|
+
}
|
|
63
|
+
if (this.statusCode === 429) {
|
|
64
|
+
this.reason = _RequestError.REASON_MAP[429];
|
|
65
|
+
this.displayMessage = errorMsgMap.HTTP.RATE_LIMITED_429.errorMSG;
|
|
66
|
+
this.level = args.level ?? "warning";
|
|
67
|
+
} else {
|
|
68
|
+
const networkError = this.tryMatchNetworkError();
|
|
69
|
+
if (networkError) {
|
|
70
|
+
this.reason = this.reason ?? networkError.reason;
|
|
71
|
+
this.level = args.level ?? "warning";
|
|
72
|
+
this.endpoint.url = this.endpoint.url ?? networkError.url;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!this.spanStatus && this.reason) {
|
|
76
|
+
this.spanStatus = reasonToSpanStatus(this.reason);
|
|
77
|
+
}
|
|
78
|
+
if (!this.spanStatus && this.statusCode) {
|
|
79
|
+
this.spanStatus = httpStatusToSpanStatus(this.statusCode);
|
|
80
|
+
}
|
|
81
|
+
this.tags = {
|
|
82
|
+
...this.tags,
|
|
83
|
+
"error.statusCode": this.statusCode,
|
|
84
|
+
"operation.type": "query",
|
|
85
|
+
...args.tags
|
|
86
|
+
};
|
|
87
|
+
let message = "";
|
|
88
|
+
if (this.reason) {
|
|
89
|
+
message += `${this.reason} \u2013 `;
|
|
90
|
+
} else if (this.statusCode && this.statusCode >= 400) {
|
|
91
|
+
message += `HTTP ${this.statusCode} \u2013 `;
|
|
92
|
+
}
|
|
93
|
+
const endpointLabel = this.endpoint.type ? `${this.endpoint.type}(${this.endpoint.url})` : this.endpoint.url;
|
|
94
|
+
this.message = `${message}${endpointLabel}: ${this.message}`;
|
|
95
|
+
}
|
|
96
|
+
setEndpoint(endpoint) {
|
|
97
|
+
if (typeof endpoint === "string" || endpoint instanceof URL) {
|
|
98
|
+
this.endpoint = {
|
|
99
|
+
url: typeof endpoint === "string" ? endpoint : endpoint.toString()
|
|
100
|
+
};
|
|
101
|
+
} else {
|
|
102
|
+
this.endpoint = {
|
|
103
|
+
...this.endpoint,
|
|
104
|
+
...endpoint,
|
|
105
|
+
url: endpoint.url.toString()
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (this.queryRichfulDomains.some(
|
|
109
|
+
(domain) => this.endpoint.url.includes(getUriFromLink(domain))
|
|
110
|
+
)) {
|
|
111
|
+
try {
|
|
112
|
+
const url = new URL(this.endpoint.url);
|
|
113
|
+
url.search = "";
|
|
114
|
+
this.endpoint.url = url.toString();
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.tags = {
|
|
119
|
+
...this.tags,
|
|
120
|
+
"operation.source.url": this.endpoint.url,
|
|
121
|
+
"operation.source.name": this.endpoint.name,
|
|
122
|
+
"operation.source.type": this.endpoint.type
|
|
123
|
+
};
|
|
124
|
+
return this.endpoint;
|
|
125
|
+
}
|
|
126
|
+
tryMatchNetworkError() {
|
|
127
|
+
if (this.cause instanceof Error && "message" in this.cause && typeof this.cause.message === "string" || this.cause instanceof TypeError) {
|
|
128
|
+
const message = this.cause.message;
|
|
129
|
+
if (message.startsWith("Network Error")) {
|
|
130
|
+
return {
|
|
131
|
+
reason: _RequestError.REASON_MAP.NETWORK_ERROR,
|
|
132
|
+
message,
|
|
133
|
+
url: this.endpoint.url
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const failedToFetchMatch = message.match(
|
|
137
|
+
/^(?:NetworkError when attempting to fetch resource\.|Failed to fetch|Load failed)(?: \(([a-z0-9-.]+)\))?$/
|
|
138
|
+
);
|
|
139
|
+
if (failedToFetchMatch) {
|
|
140
|
+
return {
|
|
141
|
+
reason: _RequestError.REASON_MAP.NETWORK_ERROR,
|
|
142
|
+
message,
|
|
143
|
+
url: failedToFetchMatch[1] ?? this.endpoint.url
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (typeof this.cause === "object" && this.cause !== null && "message" in this.cause && typeof this.cause.message === "string") {
|
|
148
|
+
const message = this.cause.message;
|
|
149
|
+
if (message.startsWith(
|
|
150
|
+
"error: canceling statement due to lock timeout occurred in"
|
|
151
|
+
)) {
|
|
152
|
+
return {
|
|
153
|
+
reason: _RequestError.REASON_MAP.NETWORK_ERROR,
|
|
154
|
+
message,
|
|
155
|
+
url: this.endpoint.url
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
RequestError
|
|
165
|
+
};
|
|
@@ -4,8 +4,8 @@ import { B as BeraFlags } from '../defaultFlags-D6KfkTZx.js';
|
|
|
4
4
|
export { B as BexStateContext, a as BexStatusProvider, b as BexStatusProviderProps, u as useBexStatus } from '../BexStatusProvider-DRymVlQf.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { PropsWithChildren } from 'react';
|
|
7
|
-
import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-
|
|
8
|
-
export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-
|
|
7
|
+
import { a as TokenWithMetadata, b as Token, B as BalanceToken } from '../HoneyConfigProvider-Dkj-_a5x.js';
|
|
8
|
+
export { c as HoneyConfigContext, d as HoneyConfigContextReturn, e as HoneyConfigProvider, f as HoneyConfigProviderProps, T as TokenWithOrder, u as useHoneyConfig } from '../HoneyConfigProvider-Dkj-_a5x.js';
|
|
9
9
|
import '@berachain/config/internal/flags';
|
|
10
10
|
import 'viem';
|
|
11
11
|
import '@berachain/graphql/pol/api';
|
|
@@ -1,2 +1,85 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
BeraFlagsProvider,
|
|
4
|
+
BexStateContext,
|
|
5
|
+
BexStatusProvider,
|
|
6
|
+
BlockTimeContext,
|
|
7
|
+
BlockTimeProvider,
|
|
8
|
+
HoneyConfigContext,
|
|
9
|
+
HoneyConfigProvider,
|
|
10
|
+
TokenContext,
|
|
11
|
+
TokensProvider,
|
|
12
|
+
useBeraFlag,
|
|
13
|
+
useBeraFlags,
|
|
14
|
+
useBexStatus,
|
|
15
|
+
useBlockTime,
|
|
16
|
+
useHoneyConfig
|
|
17
|
+
} from "../chunk-WNBWX23Q.mjs";
|
|
18
|
+
import "../chunk-HYDP32P6.mjs";
|
|
19
|
+
import "../chunk-HQCOU6GY.mjs";
|
|
20
|
+
import "../chunk-SGIJVHZO.mjs";
|
|
21
|
+
import {
|
|
22
|
+
BeraMonitoring
|
|
23
|
+
} from "../chunk-7YVNSDXG.mjs";
|
|
24
|
+
import "../chunk-GY6B3PD5.mjs";
|
|
25
|
+
import "../chunk-BGMRHTBQ.mjs";
|
|
26
|
+
import "../chunk-IXIBY5FP.mjs";
|
|
27
|
+
import "../chunk-DQRH5VE3.mjs";
|
|
28
|
+
import "../chunk-ZLTMIFCZ.mjs";
|
|
29
|
+
import {
|
|
30
|
+
BeraError
|
|
31
|
+
} from "../chunk-KHXJDYA4.mjs";
|
|
32
|
+
|
|
33
|
+
// src/contexts/SwrFallback.tsx
|
|
34
|
+
import { useEffect } from "react";
|
|
35
|
+
import { SWRConfig } from "swr";
|
|
36
|
+
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
function SWRFallback({
|
|
38
|
+
fallback,
|
|
39
|
+
children
|
|
40
|
+
}) {
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
Object.entries(fallback).some(([key, value]) => {
|
|
43
|
+
if (!key) {
|
|
44
|
+
console.warn("SWRFallback", key, value);
|
|
45
|
+
BeraMonitoring.captureException(
|
|
46
|
+
new BeraError({
|
|
47
|
+
message: "Empty key in SWRFallback. This will lead to wrong query returns when key is null. Should be reported to SWR.",
|
|
48
|
+
level: "warning",
|
|
49
|
+
extra: {
|
|
50
|
+
key,
|
|
51
|
+
value
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
return true;
|
|
56
|
+
} else return false;
|
|
57
|
+
});
|
|
58
|
+
}, [fallback]);
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
SWRConfig,
|
|
61
|
+
{
|
|
62
|
+
value: {
|
|
63
|
+
fallback
|
|
64
|
+
},
|
|
65
|
+
children
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
BeraFlagsProvider,
|
|
71
|
+
BexStateContext,
|
|
72
|
+
BexStatusProvider,
|
|
73
|
+
BlockTimeContext,
|
|
74
|
+
BlockTimeProvider,
|
|
75
|
+
HoneyConfigContext,
|
|
76
|
+
HoneyConfigProvider,
|
|
77
|
+
SWRFallback,
|
|
78
|
+
TokenContext,
|
|
79
|
+
TokensProvider,
|
|
80
|
+
useBeraFlag,
|
|
81
|
+
useBeraFlags,
|
|
82
|
+
useBexStatus,
|
|
83
|
+
useBlockTime,
|
|
84
|
+
useHoneyConfig
|
|
85
|
+
};
|
package/dist/enum/exports.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as ContractName,
|
|
1
|
+
export { C as ContractName, T as TransactionActionType } from '../txnEnum-ByI5dtDi.js';
|
|
2
2
|
export { A as Aggregators, O as OwnershipType, P as ParameterPreset, a as PoolCreationStep, S as SwapReferrer } from '../dex-C_BB0b0O.js';
|
|
3
3
|
export { H as HoneySwapAction } from '../honey-CYm0RWf4.js';
|
|
4
4
|
export { P as POLLING } from '../polling-BKnyavLI.js';
|
package/dist/enum/exports.mjs
CHANGED
|
@@ -1,2 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Aggregators,
|
|
3
|
+
ContractName,
|
|
4
|
+
HoneySwapAction,
|
|
5
|
+
OwnershipType,
|
|
6
|
+
ParameterPreset,
|
|
7
|
+
PoolCreationStep,
|
|
8
|
+
SwapReferrer,
|
|
9
|
+
TransactionActionType
|
|
10
|
+
} from "../chunk-O2NQFKJK.mjs";
|
|
11
|
+
import {
|
|
12
|
+
POLLING
|
|
13
|
+
} from "../chunk-SGIJVHZO.mjs";
|
|
14
|
+
|
|
15
|
+
// src/enum/slippage.ts
|
|
16
|
+
var DEFAULT_SLIPPAGE = 0.5;
|
|
17
|
+
var SLIPPAGE_DEGEN_VALUE = 25;
|
|
18
|
+
var DEFAULT_DEADLINE = 60;
|
|
19
|
+
var SLIPPAGE_MODE = /* @__PURE__ */ ((SLIPPAGE_MODE2) => {
|
|
20
|
+
SLIPPAGE_MODE2["AUTO"] = "auto";
|
|
21
|
+
SLIPPAGE_MODE2["CUSTOM"] = "custom";
|
|
22
|
+
SLIPPAGE_MODE2["DEGEN"] = "degen";
|
|
23
|
+
return SLIPPAGE_MODE2;
|
|
24
|
+
})(SLIPPAGE_MODE || {});
|
|
25
|
+
var TRANSACTION_MODE = /* @__PURE__ */ ((TRANSACTION_MODE2) => {
|
|
26
|
+
TRANSACTION_MODE2["AUTO"] = "auto";
|
|
27
|
+
TRANSACTION_MODE2["CUSTOM"] = "custom";
|
|
28
|
+
TRANSACTION_MODE2["INFINITY"] = "infinity";
|
|
29
|
+
return TRANSACTION_MODE2;
|
|
30
|
+
})(TRANSACTION_MODE || {});
|
|
31
|
+
export {
|
|
32
|
+
Aggregators,
|
|
33
|
+
ContractName,
|
|
34
|
+
DEFAULT_DEADLINE,
|
|
35
|
+
DEFAULT_SLIPPAGE,
|
|
36
|
+
HoneySwapAction,
|
|
37
|
+
OwnershipType,
|
|
38
|
+
POLLING,
|
|
39
|
+
ParameterPreset,
|
|
40
|
+
PoolCreationStep,
|
|
41
|
+
SLIPPAGE_DEGEN_VALUE,
|
|
42
|
+
SLIPPAGE_MODE,
|
|
43
|
+
SwapReferrer,
|
|
44
|
+
TRANSACTION_MODE,
|
|
45
|
+
TransactionActionType
|
|
46
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps the proposal state from the governor contract to a more human-readable format.
|
|
3
|
+
* Don't edit this enum manually, it's synced with the governor contract.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/governance/IGovernor.sol
|
|
6
|
+
*/
|
|
7
|
+
declare enum ProposalState {
|
|
8
|
+
Pending = 0,
|
|
9
|
+
Active = 1,
|
|
10
|
+
Canceled = 2,
|
|
11
|
+
Defeated = 3,
|
|
12
|
+
Succeeded = 4,
|
|
13
|
+
Queued = 5,
|
|
14
|
+
Expired = 6,
|
|
15
|
+
Executed = 7
|
|
16
|
+
}
|
|
17
|
+
declare enum VoteEnum {
|
|
18
|
+
AGAINST = "no",
|
|
19
|
+
FOR = "yes",
|
|
20
|
+
ABSTAIN = "abstain"
|
|
21
|
+
}
|
|
22
|
+
declare enum ProposalErrorCodes {
|
|
23
|
+
REQUIRED = "Required",
|
|
24
|
+
INVALID_AMOUNT = "Invalid amount",
|
|
25
|
+
NEGATIVE_AMOUNT = "Negative amount",
|
|
26
|
+
INVALID_ADDRESS = "Invalid address",
|
|
27
|
+
INVALID_ACTION = "Invalid action",
|
|
28
|
+
INVALID_ABI = "Invalid ABI",
|
|
29
|
+
MUST_BE_HTTPS = "Must be HTTPS",
|
|
30
|
+
MUST_BE_HTTPS_OR_IPFS = "Must be HTTPS or IPFS",
|
|
31
|
+
INVALID_BASEPATH = "Must be a berachain forum link",
|
|
32
|
+
/**
|
|
33
|
+
* Mainly used when it's not a reward vault
|
|
34
|
+
*/
|
|
35
|
+
INVALID_CONTRACT = "This is not a valid contract"
|
|
36
|
+
}
|
|
37
|
+
declare enum ProposalTypeEnum {
|
|
38
|
+
CUSTOM_PROPOSAL = "custom-action",
|
|
39
|
+
WHITELIST_REWARD_VAULT = "whitelist-reward-vault",
|
|
40
|
+
BLACKLIST_REWARD_VAULT = "blacklist-reward-vault",
|
|
41
|
+
ERC20_TRANSFER = "erc20-transfer",
|
|
42
|
+
WHITELIST_REWARD_VAULT_INCENTIVE = "whitelist-reward-vault-incentive"
|
|
43
|
+
}
|
|
44
|
+
declare const VoteColorMap: {
|
|
45
|
+
readonly yes: "#059669";
|
|
46
|
+
readonly 1: "#059669";
|
|
47
|
+
readonly no: "#DC2629";
|
|
48
|
+
readonly 2: "#DC2629";
|
|
49
|
+
readonly veto: "#0284C7";
|
|
50
|
+
readonly 4: "#0284C7";
|
|
51
|
+
readonly abstain: "#78716c";
|
|
52
|
+
readonly 3: "#78716c";
|
|
53
|
+
readonly yes_secondary: "#ECFDF5";
|
|
54
|
+
readonly no_secondary: "#FEF2F2";
|
|
55
|
+
readonly veto_secondary: "#F0F9FF";
|
|
56
|
+
readonly abstain_secondary: "#E7E5E4";
|
|
57
|
+
readonly default: "#57534e";
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { ProposalErrorCodes, ProposalState, ProposalTypeEnum, VoteColorMap, VoteEnum };
|
package/dist/errors/exports.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { GetPublicClientReturnType } from '@wagmi/core';
|
|
2
2
|
import { Address, PublicClient, TransactionReceipt } from 'viem';
|
|
3
|
-
import { B as BeraError, S as SeverityLevel, I as IBeraErrorArgs } from '../BeraError-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { B as BeraError, S as SeverityLevel, I as IBeraErrorArgs } from '../BeraError-7-A5JYy_.js';
|
|
4
|
+
export { a as SpanStatusType, h as httpStatusToSpanStatus, r as reasonToSpanStatus } from '../BeraError-7-A5JYy_.js';
|
|
5
|
+
import { E as EmitterMixin } from '../RequestError-DBOIV65x.js';
|
|
6
|
+
export { B as BeraTracing, R as RequestError, S as SpanContext } from '../RequestError-DBOIV65x.js';
|
|
6
7
|
import { Hex } from '@berachain-foundation/berancer-sdk';
|
|
7
8
|
import '@apollo/client';
|
|
8
9
|
|
package/dist/errors/exports.mjs
CHANGED
|
@@ -1,2 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
NotFoundError,
|
|
3
|
+
TransactionFailedError
|
|
4
|
+
} from "../chunk-AUOPN6NK.mjs";
|
|
5
|
+
import {
|
|
6
|
+
BeraMonitoring,
|
|
7
|
+
initBeraError
|
|
8
|
+
} from "../chunk-7YVNSDXG.mjs";
|
|
9
|
+
import {
|
|
10
|
+
assertAddress,
|
|
11
|
+
assertAmount,
|
|
12
|
+
assertDefined,
|
|
13
|
+
assertPositive,
|
|
14
|
+
assertPublicClient
|
|
15
|
+
} from "../chunk-GY6B3PD5.mjs";
|
|
16
|
+
import {
|
|
17
|
+
BeraTracing
|
|
18
|
+
} from "../chunk-SZ5C44L5.mjs";
|
|
19
|
+
import {
|
|
20
|
+
RequestError
|
|
21
|
+
} from "../chunk-ZLTMIFCZ.mjs";
|
|
22
|
+
import {
|
|
23
|
+
BeraError,
|
|
24
|
+
InvalidArgumentError,
|
|
25
|
+
findMatchingError,
|
|
26
|
+
getErrorMessage,
|
|
27
|
+
httpStatusToSpanStatus,
|
|
28
|
+
reasonToSpanStatus
|
|
29
|
+
} from "../chunk-KHXJDYA4.mjs";
|
|
30
|
+
export {
|
|
31
|
+
BeraError,
|
|
32
|
+
BeraMonitoring,
|
|
33
|
+
BeraTracing,
|
|
34
|
+
InvalidArgumentError,
|
|
35
|
+
NotFoundError,
|
|
36
|
+
RequestError,
|
|
37
|
+
TransactionFailedError,
|
|
38
|
+
assertAddress,
|
|
39
|
+
assertAmount,
|
|
40
|
+
assertDefined,
|
|
41
|
+
assertPositive,
|
|
42
|
+
assertPublicClient,
|
|
43
|
+
findMatchingError,
|
|
44
|
+
getErrorMessage,
|
|
45
|
+
httpStatusToSpanStatus,
|
|
46
|
+
initBeraError,
|
|
47
|
+
reasonToSpanStatus
|
|
48
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApolloClient, OperationVariables } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is a wrapper around the ApolloClient that throws a BeraError if the query returns an error or no data.
|
|
5
|
+
*
|
|
6
|
+
* It's mostly a typescript helper that keeps data always defined since we use errorPolicy: "none" by default.
|
|
7
|
+
* Such setting will throw an error if the query returns an error, rather than returning an object with undefined data and an error property.
|
|
8
|
+
*/
|
|
9
|
+
declare class BeraApolloClient extends ApolloClient {
|
|
10
|
+
/**
|
|
11
|
+
* The URL of the endpoint. Used for error reporting only.
|
|
12
|
+
*/
|
|
13
|
+
protected url: string;
|
|
14
|
+
protected serviceName: string;
|
|
15
|
+
constructor(options: ApolloClient.Options & {
|
|
16
|
+
/**
|
|
17
|
+
* The URL of the endpoint. Used for error reporting only.
|
|
18
|
+
*/
|
|
19
|
+
url: string;
|
|
20
|
+
/**
|
|
21
|
+
* The name of the graphql service. Used for error reporting only.
|
|
22
|
+
*/
|
|
23
|
+
name: string;
|
|
24
|
+
});
|
|
25
|
+
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: Omit<ApolloClient.QueryOptions<TData, TVariables>, "errorPolicy">): Promise<{
|
|
26
|
+
data: TData;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Browser-reachable Apollo client factory for `api` and Bend's `whisk`
|
|
32
|
+
* endpoints. Subgraph clients (honey/pol) are server-only; browser data
|
|
33
|
+
* access goes through the typed `/api/honey/*` and `/api/pol/*` REST
|
|
34
|
+
* endpoints. Same auth shape as bend.whiskApi — non-public env values only
|
|
35
|
+
* resolve server-side.
|
|
36
|
+
*/
|
|
37
|
+
type GraphqlClient = "api" | "bend.whisk" | "honey.subgraph" | "pol.subgraph";
|
|
38
|
+
declare function getApolloClient(clientName: GraphqlClient, { ...args }: BeraJS.BaseFunctionArgs): BeraApolloClient;
|
|
39
|
+
|
|
40
|
+
export { BeraApolloClient as B, getApolloClient as g };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Address, PublicClient, Hex } from 'viem';
|
|
2
2
|
import { BeraConfig, ChainId } from '@berachain/config/internal';
|
|
3
|
-
import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-
|
|
3
|
+
import { I as IAggregatorArgs, g as IRawAggregatorQuote, b as Token, d as HoneyConfigContextReturn, B as BalanceToken, P as PythLatestUpdates } from './HoneyConfigProvider-Dkj-_a5x.js';
|
|
4
4
|
import { A as Aggregators } from './dex-C_BB0b0O.js';
|
|
5
5
|
import { GqlPoolType, GlobalDataQuery, ApiVaultFragment, GetVaultsQueryVariables, GqlChain, GetVaultHistoryQueryVariables, GetVaultHistoryQuery, ApiValidatorInListFragment } from '@berachain/graphql/pol/api';
|
|
6
|
-
import { P as ProtocolMetadata } from './
|
|
6
|
+
import { P as ProtocolMetadata } from './pol.d-Dw5SQcRX.js';
|
|
7
7
|
|
|
8
8
|
interface GetConvertToAssetsProps {
|
|
9
9
|
sharesAmount: bigint;
|