@berachain/berajs 0.2.9 → 0.2.11
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/{HoneyConfigProvider-Dkj-_a5x.d.ts → HoneyConfigProvider-COOuDNra.d.ts} +1 -1
- package/dist/actions/clients/exports.d.ts +77 -1
- package/dist/actions/clients/exports.mjs +13 -4
- package/dist/actions/exports.d.ts +121 -39
- package/dist/actions/exports.mjs +75 -34
- package/dist/actions/governance/exports.d.ts +3 -11
- package/dist/actions/governance/exports.mjs +3 -3
- package/dist/actions/server/exports.mjs +4 -4
- package/dist/{chunk-4Z4AK6SH.mjs → chunk-3JJLQ2JX.mjs} +3 -3
- package/dist/{chunk-EXIUPSFN.mjs → chunk-7YVNSDXG.mjs} +2 -2
- package/dist/{chunk-WXXOISTU.mjs → chunk-AUOPN6NK.mjs} +1 -1
- package/dist/{chunk-75M6TF7M.mjs → chunk-DQRH5VE3.mjs} +1 -1
- package/dist/{chunk-CDFWPU2R.mjs → chunk-E7YFXBBQ.mjs} +0 -124
- package/dist/{chunk-AFN4CVD3.mjs → chunk-GUURQAME.mjs} +1 -1
- package/dist/{chunk-KQUMKB66.mjs → chunk-GY6B3PD5.mjs} +1 -1
- package/dist/{chunk-HSSJKHZ4.mjs → chunk-HYDP32P6.mjs} +3 -3
- package/dist/{chunk-NPBQLVL3.mjs → chunk-IXIBY5FP.mjs} +2 -2
- package/dist/{chunk-J5I45WGQ.mjs → chunk-KHXJDYA4.mjs} +7 -0
- package/dist/chunk-MRQGHXAN.mjs +54 -0
- package/dist/{chunk-FFB5LFDW.mjs → chunk-QVHEM4BG.mjs} +2 -2
- package/dist/{chunk-3EARVV7K.mjs → chunk-SXUNCX5E.mjs} +22 -9
- package/dist/chunk-UD5IUNCW.mjs +34 -0
- package/dist/{chunk-QJIXTYTZ.mjs → chunk-VAA2FVPP.mjs} +162 -41
- package/dist/chunk-Y6THHG77.mjs +126 -0
- package/dist/{chunk-XIYN6AL6.mjs → chunk-ZLTMIFCZ.mjs} +10 -5
- package/dist/contexts/exports.d.ts +2 -2
- package/dist/contexts/exports.mjs +11 -9
- package/dist/enum/exports.d.ts +8 -2
- package/dist/errors/exports.mjs +5 -5
- package/dist/getProposalVotes-DAUrdX2n.d.ts +12 -0
- package/dist/{getValidatorQueuedOperatorAddress-Dw5KN5sh.d.ts → getValidatorQueuedOperatorAddress-Cxt-DlL_.d.ts} +2 -2
- package/dist/{global.d-BuGDKh4k.d.ts → global.d-q_LQWQqs.d.ts} +2 -4
- package/dist/hooks/exports.d.ts +114 -164
- package/dist/hooks/exports.mjs +535 -522
- package/dist/hooks/governance/exports.d.ts +20 -15
- package/dist/hooks/governance/exports.mjs +43 -41
- package/dist/{pol.d-CqPA9K6m.d.ts → pol.d-CeRgXBL8.d.ts} +33 -8
- package/dist/types/exports.d.ts +5 -5
- package/dist/{useHoneySwapState-vFmuFF0g.d.ts → useHoneySwapState-twi7NTaO.d.ts} +1 -1
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +15 -9
- package/package.json +9 -8
- package/src/actions/bend/getMaxDeposit.ts +28 -2
- package/src/actions/clients/exports.ts +3 -0
- package/src/actions/clients/fetchBeep.ts +34 -0
- package/src/actions/clients/fetchOpenApi.ts +97 -0
- package/src/actions/clients/fetchOpenApi.unit.test.ts +245 -0
- package/src/actions/clients/fetchRailwayBackend.ts +34 -0
- package/src/actions/enso/getEnsoUserTokensWithBalances.ts +18 -0
- package/src/actions/exports.ts +2 -0
- package/src/actions/honey/getChartData.ts +53 -12
- package/src/actions/honey/getHoney24hVolume.ts +34 -6
- package/src/actions/honey/getHoneyTxns.ts +93 -0
- 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 +21 -10
- package/src/actions/pol/getAutoclaimedIncentivesTxHash.ts +41 -0
- package/src/actions/pol/getBgtIncentiveDistributorPaused.ts +5 -12
- package/src/actions/pol/getEarnedStakedBeraVault.ts +20 -16
- package/src/actions/pol/getRewardVaults.ts +4 -4
- package/src/actions/pol/getStakingDailyAssets.ts +18 -14
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +64 -12
- package/src/actions/validators/utils/getValidatorBoostApy.ts +1 -1
- package/src/contexts/SwrFallback.tsx +2 -1
- package/src/data/contracts.ts +4 -0
- package/src/errors/RequestError.ts +12 -3
- package/src/errors/RequestError.unit.test.ts +55 -0
- package/src/errors/errorMap.ts +8 -0
- package/src/errors/getRevertReason.integration.test.ts +5 -1
- package/src/hooks/bend/useGetConvertToAssets.ts +2 -3
- package/src/hooks/dex/useAggregatorsQuotes.ts +10 -10
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +1 -1
- package/src/hooks/dex/useAllUserPools.ts +7 -5
- package/src/hooks/dex/useApiPool.ts +1 -1
- package/src/hooks/dex/useGlobalLiquidityAndSwapVolume.ts +1 -1
- package/src/hooks/dex/useOnChainPoolData.ts +1 -1
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -2
- package/src/hooks/dex/usePoolEvents.ts +1 -2
- package/src/hooks/dex/usePoolHistoricalData.ts +2 -3
- package/src/hooks/dex/usePools.ts +4 -2
- package/src/hooks/dex/useSingleAggregatorQuote.ts +6 -18
- package/src/hooks/enso/useBendDemultiply.ts +3 -4
- package/src/hooks/enso/useBendMultiply.ts +3 -4
- package/src/hooks/enso/useBendZapSupply.ts +3 -4
- package/src/hooks/enso/useEnsoSwapBundle.ts +1 -1
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +3 -5
- package/src/hooks/enso/useEnsoWalletV2Address.ts +1 -1
- package/src/hooks/enso/useIsBendAuthorized.ts +1 -1
- package/src/hooks/enso/useZapStakeBera.ts +2 -2
- package/src/hooks/exports.ts +2 -0
- package/src/hooks/governance/useGetPastVotes.ts +1 -1
- package/src/hooks/governance/useHasVoted.ts +1 -1
- package/src/hooks/governance/useIsCanceller.ts +1 -1
- package/src/hooks/governance/usePollAllProposals.ts +13 -12
- package/src/hooks/governance/usePollProposal.ts +3 -3
- package/src/hooks/governance/usePollProposalThreshold.ts +1 -1
- package/src/hooks/governance/usePollProposalVotes.ts +23 -5
- package/src/hooks/governance/usePollUserDelegates.ts +3 -3
- package/src/hooks/governance/useProposalFromTx.ts +2 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -3
- package/src/hooks/governance/useProposalState.ts +2 -2
- package/src/hooks/governance/useProposalTimelockState.ts +2 -1
- package/src/hooks/governance/useQuorum.ts +1 -2
- package/src/hooks/honey/useCappedGlobally.ts +3 -6
- package/src/hooks/honey/useCappedRelatively.ts +2 -2
- package/src/hooks/honey/useCollateralWeights.ts +3 -3
- package/src/hooks/honey/useHoney24hVolume.ts +1 -1
- package/src/hooks/honey/useHoneyBalances.ts +1 -1
- package/src/hooks/honey/useHoneyChartData.ts +1 -1
- package/src/hooks/honey/useHoneyVaultsBalance.ts +2 -3
- package/src/hooks/honey/useIsBadCollateralAsset.ts +4 -7
- package/src/hooks/honey/useIsBasketModeEnabled.ts +4 -7
- package/src/hooks/honey/usePythLatestPrices.ts +13 -9
- package/src/hooks/perps/usePythUpdateFee.ts +13 -11
- package/src/hooks/pol/useAutoclaimedIncentives.ts +2 -12
- package/src/hooks/pol/useAutoclaimedIncentivesTxHash.ts +44 -0
- package/src/hooks/pol/useBgtIncentiveDistributorPaused.ts +39 -0
- package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -2
- package/src/hooks/pol/useClaimableFees.ts +1 -1
- package/src/hooks/pol/useHighestVaultsAPR.ts +4 -6
- package/src/hooks/pol/useOnChainRewardVault.ts +77 -72
- package/src/hooks/pol/usePollGlobalData.ts +2 -3
- package/src/hooks/pol/usePollMarkets.ts +2 -2
- package/src/hooks/pol/useQueuedBeraUnlock.ts +2 -2
- package/src/hooks/pol/useRewardTokenToBeraRate.ts +2 -2
- package/src/hooks/pol/useRewardVault.ts +7 -6
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +4 -4
- package/src/hooks/pol/useRewardVaultFromToken.ts +1 -1
- package/src/hooks/pol/useRewardVaultIncentives.ts +1 -1
- package/src/hooks/pol/useRewardVaultRewards.ts +2 -2
- package/src/hooks/pol/useRewardVaults.ts +3 -6
- package/src/hooks/pol/useStakedAPR.ts +1 -2
- package/src/hooks/pol/useStakedData.ts +90 -41
- package/src/hooks/pol/useStakedSnapshots.ts +1 -1
- package/src/hooks/pol/useStakingVaultsMetadata.ts +1 -1
- package/src/hooks/pol/useTotalStakedAmount.ts +1 -2
- package/src/hooks/pol/useUserVaultInfo.ts +2 -2
- package/src/hooks/pol/useUserVaults.ts +2 -3
- package/src/hooks/pol/useVaultAddress.ts +1 -1
- package/src/hooks/pol/useVaultHistory.ts +1 -2
- package/src/hooks/pol/useVaultValidators.ts +2 -2
- package/src/hooks/tokens/useMultipleTokenInformation.ts +2 -2
- package/src/hooks/tokens/usePollAllowances.ts +3 -4
- package/src/hooks/tokens/usePollBalance.ts +2 -2
- package/src/hooks/tokens/usePollWalletBalances.ts +2 -2
- package/src/hooks/tokens/useStakingTokenInformation.ts +2 -2
- package/src/hooks/tokens/useTokenCurrentPrices.ts +11 -13
- package/src/hooks/tokens/useTokenInformation.ts +2 -2
- package/src/hooks/tokens/useTokenPrice.ts +2 -1
- package/src/hooks/tokens/useTokenPrices.ts +3 -4
- package/src/hooks/tokens/useTotalSupply.ts +1 -1
- package/src/hooks/tokens/useUnderlyingAsset.ts +1 -2
- package/src/hooks/useBlockToTimestamp.ts +1 -2
- package/src/hooks/useGetVerifiedAbi.ts +2 -1
- package/src/hooks/validators/useAllValidators.ts +2 -3
- package/src/hooks/validators/useApiEnrichedAllocation.ts +1 -1
- package/src/hooks/validators/useApiValidator.ts +3 -6
- package/src/hooks/validators/useBaselineRewardAllocation.ts +1 -2
- package/src/hooks/validators/useDailyValidatorBlockStats.ts +1 -1
- package/src/hooks/validators/useDefaultRewardAllocation.ts +2 -3
- package/src/hooks/validators/useManagedValidatorRole.ts +2 -2
- package/src/hooks/validators/useOnChainValidator.ts +3 -3
- package/src/hooks/validators/useStakingPoolBatch.ts +3 -4
- package/src/hooks/validators/useUserActiveValidators.ts +2 -3
- package/src/hooks/validators/useUserBoostsOnValidator.ts +1 -1
- package/src/hooks/validators/useUserClaimableIncentives.ts +1 -1
- package/src/hooks/validators/useUserStakingPositions.ts +2 -1
- package/src/hooks/validators/useValidator.ts +4 -8
- package/src/hooks/validators/useValidatorAnalytics.ts +1 -1
- package/src/hooks/validators/useValidatorCommission.ts +2 -2
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +3 -3
- package/src/hooks/validators/useValidatorQueuedCommission.ts +2 -2
- package/src/hooks/validators/useValidatorQueuedOperatorAddress.ts +2 -2
- package/src/hooks/validators/useValidatorQueuedRewardAllocation.ts +2 -2
- package/src/hooks/validators/useValidatorRewardAllocation.ts +2 -2
- package/src/types/bribe-boost.d.ts +14 -3
- package/src/types/global.d.ts +3 -4
- package/src/types/pol.d.ts +17 -3
- package/src/utils/polyfillAbortSignalAny.ts +53 -0
- package/src/utils/polyfillAbortSignalAny.unit.test.ts +81 -0
- package/dist/polling-BKnyavLI.d.ts +0 -8
- /package/dist/{exports-BcUTGFUb.d.ts → getApolloClient-BcUTGFUb.d.ts} +0 -0
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
getProposalFromTx,
|
|
7
7
|
getProposalVotes,
|
|
8
8
|
parseProposalBody
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-GUURQAME.mjs";
|
|
10
10
|
import "../../chunk-DKMAIU74.mjs";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-GY6B3PD5.mjs";
|
|
12
|
+
import "../../chunk-KHXJDYA4.mjs";
|
|
13
13
|
|
|
14
14
|
// src/actions/governance/computeActualStatus.ts
|
|
15
15
|
import {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getApolloClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-3JJLQ2JX.mjs";
|
|
4
|
+
import "../../chunk-DQRH5VE3.mjs";
|
|
5
5
|
import "../../chunk-SZ5C44L5.mjs";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-ZLTMIFCZ.mjs";
|
|
7
|
+
import "../../chunk-KHXJDYA4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/actions/server/getDailyValidatorBlockStats.ts
|
|
10
10
|
import {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseBaseArgs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BeraTracing
|
|
6
6
|
} from "./chunk-SZ5C44L5.mjs";
|
|
7
7
|
import {
|
|
8
8
|
RequestError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZLTMIFCZ.mjs";
|
|
10
10
|
import {
|
|
11
11
|
BeraError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
13
13
|
|
|
14
14
|
// src/actions/clients/BeraApolloClient.ts
|
|
15
15
|
import {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RequestError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZLTMIFCZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
BeraError,
|
|
6
6
|
parseViemError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/errors/initBeraError.ts
|
|
10
10
|
import { BaseError } from "viem";
|
|
@@ -1,123 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BeraTracing
|
|
3
|
-
} from "./chunk-SZ5C44L5.mjs";
|
|
4
|
-
import {
|
|
5
|
-
RequestError
|
|
6
|
-
} from "./chunk-XIYN6AL6.mjs";
|
|
7
|
-
|
|
8
|
-
// src/utils/getErrorResponse.ts
|
|
9
|
-
async function getErrorResponse(response) {
|
|
10
|
-
const contentType = response.headers.get("content-type");
|
|
11
|
-
if (contentType?.includes("application/json")) {
|
|
12
|
-
return response.json();
|
|
13
|
-
} else {
|
|
14
|
-
const text = await response.text();
|
|
15
|
-
try {
|
|
16
|
-
return JSON.parse(text);
|
|
17
|
-
} catch {
|
|
18
|
-
return {
|
|
19
|
-
message: "Unknown error, can't decode response into JSON",
|
|
20
|
-
cause: text
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/utils/sanitizeRpcUrl.ts
|
|
27
|
-
function sanitizeRpcUrl(url) {
|
|
28
|
-
if (!url) return "";
|
|
29
|
-
try {
|
|
30
|
-
const parsed = new URL(url);
|
|
31
|
-
if (parsed.hostname.endsWith(".quiknode.pro")) {
|
|
32
|
-
parsed.pathname = "/";
|
|
33
|
-
parsed.search = "";
|
|
34
|
-
return parsed.toString();
|
|
35
|
-
}
|
|
36
|
-
return url;
|
|
37
|
-
} catch {
|
|
38
|
-
return url;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// src/utils/beraFetch.ts
|
|
43
|
-
async function beraFetch(endpoint, options, spanContext) {
|
|
44
|
-
try {
|
|
45
|
-
let spanUrl = sanitizeRpcUrl(
|
|
46
|
-
typeof endpoint === "string" || endpoint instanceof URL ? endpoint.toString() : endpoint.url.toString()
|
|
47
|
-
).replace(/0x[a-fA-F0-9]{40}/g, ":address");
|
|
48
|
-
if (spanContext?.keepQueryParams !== true && URL.canParse(spanUrl)) {
|
|
49
|
-
const queryParams = new URL(spanUrl).searchParams;
|
|
50
|
-
if (Array.isArray(spanContext?.keepQueryParams)) {
|
|
51
|
-
const searchParams = new URLSearchParams();
|
|
52
|
-
for (const param of spanContext.keepQueryParams) {
|
|
53
|
-
searchParams.set(param, queryParams.get(param) ?? "");
|
|
54
|
-
}
|
|
55
|
-
const newUrl = new URL(spanUrl);
|
|
56
|
-
newUrl.search = searchParams.toString();
|
|
57
|
-
spanUrl = newUrl.toString();
|
|
58
|
-
} else {
|
|
59
|
-
const newUrl = new URL(spanUrl);
|
|
60
|
-
newUrl.search = "";
|
|
61
|
-
spanUrl = newUrl.toString();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const endpointName = typeof endpoint === "string" || endpoint instanceof URL ? void 0 : endpoint.name;
|
|
65
|
-
return await BeraTracing.startSpan(
|
|
66
|
-
{
|
|
67
|
-
op: "beraFetch",
|
|
68
|
-
name: endpointName ? `beraFetch ${endpointName}` : "beraFetch",
|
|
69
|
-
attributes: typeof endpoint === "string" || endpoint instanceof URL ? {
|
|
70
|
-
"operation.source.url": spanUrl,
|
|
71
|
-
...spanContext?.attributes
|
|
72
|
-
} : {
|
|
73
|
-
"operation.source.url": spanUrl,
|
|
74
|
-
"operation.source.type": endpoint.type,
|
|
75
|
-
"operation.source.name": endpoint.name,
|
|
76
|
-
...spanContext?.attributes
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
async () => {
|
|
80
|
-
const response = await fetch(
|
|
81
|
-
typeof endpoint === "string" || endpoint instanceof URL ? endpoint : endpoint.url,
|
|
82
|
-
{
|
|
83
|
-
...options
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
const error = await getErrorResponse(response);
|
|
88
|
-
throw new RequestError({
|
|
89
|
-
cause: error,
|
|
90
|
-
// @to-do import getErrorResponse logic in this function
|
|
91
|
-
// when it's removed from other places
|
|
92
|
-
response,
|
|
93
|
-
endpoint
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
} catch (error) {
|
|
100
|
-
if (error instanceof RequestError) {
|
|
101
|
-
throw error;
|
|
102
|
-
}
|
|
103
|
-
throw new RequestError({
|
|
104
|
-
cause: error,
|
|
105
|
-
endpoint,
|
|
106
|
-
response: void 0
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function beraFetchJson(endpoint, options) {
|
|
111
|
-
const response = await beraFetch(endpoint, {
|
|
112
|
-
...options,
|
|
113
|
-
headers: {
|
|
114
|
-
Accept: "application/json",
|
|
115
|
-
...options?.headers
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return response.json();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
1
|
// src/utils/constants.ts
|
|
122
2
|
import { parseEther } from "viem";
|
|
123
3
|
var CAP_LIMIT_BUFFER = parseEther("0.005");
|
|
@@ -438,10 +318,6 @@ function getTestClient(chainId = defaultChainId) {
|
|
|
438
318
|
|
|
439
319
|
export {
|
|
440
320
|
bignumber_js_default,
|
|
441
|
-
getErrorResponse,
|
|
442
|
-
sanitizeRpcUrl,
|
|
443
|
-
beraFetch,
|
|
444
|
-
beraFetchJson,
|
|
445
321
|
CAP_LIMIT_BUFFER,
|
|
446
322
|
MAX_CUSTOM_DEADLINE,
|
|
447
323
|
MIN_CUSTOM_DEADLINE,
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
assertAddress,
|
|
6
6
|
assertDefined,
|
|
7
7
|
assertPublicClient
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GY6B3PD5.mjs";
|
|
9
9
|
import {
|
|
10
10
|
isToken
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IXIBY5FP.mjs";
|
|
12
12
|
import {
|
|
13
13
|
parseBaseArgs
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
15
15
|
|
|
16
16
|
// src/actions/clients/getEnsoClient.ts
|
|
17
17
|
import { EnsoClient } from "@ensofinance/sdk";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseBaseArgs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
4
4
|
import {
|
|
5
5
|
InvalidArgumentError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
7
7
|
|
|
8
8
|
// src/utils/tokens.ts
|
|
9
9
|
import { ethAddress, isAddress, zeroAddress } from "viem";
|
|
@@ -61,6 +61,13 @@ var errorMsgMap = {
|
|
|
61
61
|
keywords: ["nonce too low: next nonce"],
|
|
62
62
|
errorMSG: "Nonce is too low. Your wallet might have unconfirmed transactions."
|
|
63
63
|
},
|
|
64
|
+
REPLACEMENT_UNDERPRICED: {
|
|
65
|
+
// Transient resubmission issue (gas bump too low). Not function-specific —
|
|
66
|
+
// normalizing the raw RPC string to this key collapses the per-function
|
|
67
|
+
// Sentry groups (functionName is still kept as a tag).
|
|
68
|
+
keywords: ["replacement transaction underpriced"],
|
|
69
|
+
errorMSG: "Your wallet tried to replace a pending transaction without raising the gas enough. Please wait for the previous transaction to finish, or try again."
|
|
70
|
+
},
|
|
64
71
|
GAS_PRICE: {
|
|
65
72
|
keywords: ["gasLimit"],
|
|
66
73
|
errorMSG: "It seems an RPC error has occurred while estimating gas. Please try your request later."
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
beraFetchJson
|
|
3
|
+
} from "./chunk-Y6THHG77.mjs";
|
|
4
|
+
import {
|
|
5
|
+
parseBaseArgs
|
|
6
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
7
|
+
|
|
8
|
+
// src/actions/clients/fetchOpenApi.ts
|
|
9
|
+
import { getUriFromLink } from "@berachain/config";
|
|
10
|
+
function fetchOpenApi(link, path, params, fallbackName) {
|
|
11
|
+
const { path: pathParams, query } = params;
|
|
12
|
+
const pathStr = path;
|
|
13
|
+
const resolvedPath = pathStr.replace(/\{([^}]+)\}/g, (_, key) => {
|
|
14
|
+
const value = pathParams?.[key];
|
|
15
|
+
if (value === void 0) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`fetchOpenApi: missing path param "${key}" for "${pathStr}"`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return encodeURIComponent(String(value));
|
|
21
|
+
});
|
|
22
|
+
const search = query ? new URLSearchParams(
|
|
23
|
+
Object.entries(query).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])
|
|
24
|
+
).toString() : "";
|
|
25
|
+
const url = `${getUriFromLink(link)}${resolvedPath}${search ? `?${search}` : ""}`;
|
|
26
|
+
const name = typeof link === "string" ? fallbackName : link.name;
|
|
27
|
+
return beraFetchJson({ url, name, type: "rest" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/actions/clients/fetchBeep.ts
|
|
31
|
+
function fetchBeep(path, params, args = {}) {
|
|
32
|
+
const { config } = parseBaseArgs(args);
|
|
33
|
+
if (!config.beep) {
|
|
34
|
+
throw new Error("fetchBeep: `beep` backend is not configured.");
|
|
35
|
+
}
|
|
36
|
+
return fetchOpenApi(config.beep, path, params, "beep");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/actions/clients/fetchRailwayBackend.ts
|
|
40
|
+
function fetchRailwayBackend(path, params, args = {}) {
|
|
41
|
+
const { config } = parseBaseArgs(args);
|
|
42
|
+
return fetchOpenApi(
|
|
43
|
+
config.backend,
|
|
44
|
+
path,
|
|
45
|
+
params,
|
|
46
|
+
"backend-railway"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
fetchOpenApi,
|
|
52
|
+
fetchBeep,
|
|
53
|
+
fetchRailwayBackend
|
|
54
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
bignumber_js_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E7YFXBBQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isToken,
|
|
6
6
|
wBeraToken
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-IXIBY5FP.mjs";
|
|
8
8
|
|
|
9
9
|
// src/utils/tokenWrapping.ts
|
|
10
10
|
function wrapNativeToken(token) {
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useSWR
|
|
3
|
+
} from "./chunk-UD5IUNCW.mjs";
|
|
1
4
|
import {
|
|
2
5
|
getBalanceCall,
|
|
3
6
|
getEnsoClient
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HYDP32P6.mjs";
|
|
5
8
|
import {
|
|
6
9
|
BeraMonitoring,
|
|
7
10
|
initBeraError
|
|
8
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7YVNSDXG.mjs";
|
|
9
12
|
import {
|
|
10
13
|
defaultFlags
|
|
11
14
|
} from "./chunk-BGMRHTBQ.mjs";
|
|
12
15
|
import {
|
|
13
16
|
beraToken,
|
|
14
17
|
isToken
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IXIBY5FP.mjs";
|
|
16
19
|
import {
|
|
17
20
|
parseBaseArgs
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-DQRH5VE3.mjs";
|
|
19
22
|
import {
|
|
20
23
|
BeraError,
|
|
21
24
|
InvalidArgumentError
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KHXJDYA4.mjs";
|
|
23
26
|
|
|
24
27
|
// src/contexts/BeraFlags/BeraFlags.tsx
|
|
25
28
|
import { createContext, useContext } from "react";
|
|
@@ -163,7 +166,6 @@ function useHoneyConfig() {
|
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
// src/hooks/enso/useEnsoUserTokensWithBalances.ts
|
|
166
|
-
import useSWR from "swr";
|
|
167
169
|
import { useBeraWallet, useConfig } from "@berachain/wagmi/hooks";
|
|
168
170
|
|
|
169
171
|
// src/actions/enso/getEnsoUserTokensWithBalances.ts
|
|
@@ -180,6 +182,18 @@ async function getEnsoUserTokensWithBalances({
|
|
|
180
182
|
chainId: chainId ?? "all",
|
|
181
183
|
eoaAddress: account
|
|
182
184
|
});
|
|
185
|
+
if (!Array.isArray(ensoBalances)) {
|
|
186
|
+
BeraMonitoring.captureException(
|
|
187
|
+
new InvalidArgumentError({
|
|
188
|
+
property: "ensoBalances",
|
|
189
|
+
value: ensoBalances,
|
|
190
|
+
expected: "BalanceToken[]",
|
|
191
|
+
chainId: typeof chainId === "number" ? chainId : void 0,
|
|
192
|
+
extra: { account, chainId }
|
|
193
|
+
})
|
|
194
|
+
);
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
183
197
|
const tokens = ensoBalances.map(
|
|
184
198
|
(balance) => ({
|
|
185
199
|
name: balance.name,
|
|
@@ -277,7 +291,7 @@ function useEnsoUserTokensWithBalances({ chainId } = {}, options) {
|
|
|
277
291
|
const proxyAggregatorsThroughVercel = useBeraFlag(
|
|
278
292
|
"proxyAggregatorsThroughVercel"
|
|
279
293
|
);
|
|
280
|
-
const isEnabled = !!fromAddress
|
|
294
|
+
const isEnabled = !!fromAddress;
|
|
281
295
|
const QUERY_KEY = isEnabled && wagmiConfig ? [
|
|
282
296
|
"useEnsoUserTokensWithBalances",
|
|
283
297
|
fromAddress,
|
|
@@ -296,8 +310,7 @@ function useEnsoUserTokensWithBalances({ chainId } = {}, options) {
|
|
|
296
310
|
}),
|
|
297
311
|
{
|
|
298
312
|
refreshInterval: 1e5 /* NORMAL */,
|
|
299
|
-
|
|
300
|
-
...options?.opts
|
|
313
|
+
...options
|
|
301
314
|
}
|
|
302
315
|
);
|
|
303
316
|
return {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// ../utils/src/pkg/swr/index.ts
|
|
2
|
+
import {
|
|
3
|
+
mutate,
|
|
4
|
+
preload,
|
|
5
|
+
SWRConfig,
|
|
6
|
+
unstable_serialize,
|
|
7
|
+
useSWRConfig
|
|
8
|
+
} from "swr";
|
|
9
|
+
import useOriginalSWR from "swr";
|
|
10
|
+
import useOriginalSWRImmutable from "swr/immutable";
|
|
11
|
+
function useSWR(key, fetcher, options) {
|
|
12
|
+
const { isEnabled = true, ...swrConfig } = options ?? {};
|
|
13
|
+
return useOriginalSWR(
|
|
14
|
+
isEnabled ? key : null,
|
|
15
|
+
fetcher,
|
|
16
|
+
swrConfig
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function useSWRImmutable(key, fetcher, options) {
|
|
20
|
+
const { isEnabled = true, ...swrConfig } = options ?? {};
|
|
21
|
+
return useOriginalSWRImmutable(
|
|
22
|
+
isEnabled ? key : null,
|
|
23
|
+
fetcher,
|
|
24
|
+
swrConfig
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
var swr_default = useSWR;
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
useSWR,
|
|
31
|
+
useSWRImmutable,
|
|
32
|
+
swr_default,
|
|
33
|
+
SWRConfig
|
|
34
|
+
};
|