@berachain/berajs 0.2.3 → 0.2.4
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/.claude/skills/berajs/SKILL.md +222 -0
- package/.claude/skills/berajs/references/dex.md +235 -0
- package/.claude/skills/berajs/references/pol.md +194 -0
- package/.claude/skills/berajs/references/staking.md +198 -0
- package/.claude/skills/berajs/references/tokens.md +170 -0
- package/dist/{BexStatusProvider-nS3NcdxI.d.cts → BexStatusProvider-DRymVlQf.d.cts} +1 -1
- package/dist/{BexStatusProvider-nS3NcdxI.d.ts → BexStatusProvider-DRymVlQf.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-CK6mOKFH.d.ts → HoneyConfigProvider-DVP_9KZn.d.ts} +1 -1
- package/dist/{HoneyConfigProvider-Ca3ouozs.d.cts → HoneyConfigProvider-DfkjmzEf.d.cts} +1 -1
- package/dist/abi/exports.cjs +1 -1
- package/dist/abi/exports.cjs.map +1 -1
- package/dist/abi/exports.d.cts +1893 -25347
- package/dist/abi/exports.d.ts +1893 -25347
- package/dist/abi/exports.mjs +1 -1
- package/dist/abi/exports.mjs.map +1 -1
- package/dist/actions/exports.cjs +1 -1
- package/dist/actions/exports.cjs.map +1 -1
- package/dist/actions/exports.d.cts +10 -9
- package/dist/actions/exports.d.ts +10 -9
- package/dist/actions/exports.mjs +1 -1
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/chunk-4GU2O2OW.cjs +4 -0
- package/dist/chunk-4GU2O2OW.cjs.map +1 -0
- package/dist/chunk-5XWELBWR.mjs +2 -0
- package/dist/chunk-5XWELBWR.mjs.map +1 -0
- package/dist/chunk-BS6K7HGH.cjs +2 -0
- package/dist/chunk-BS6K7HGH.cjs.map +1 -0
- package/dist/chunk-NLVWRMGD.mjs +2 -0
- package/dist/chunk-NLVWRMGD.mjs.map +1 -0
- package/dist/chunk-OUD27MU7.cjs +2 -0
- package/dist/chunk-OUD27MU7.cjs.map +1 -0
- package/dist/chunk-RW3JFPED.mjs +4 -0
- package/dist/chunk-RW3JFPED.mjs.map +1 -0
- package/dist/chunk-S3EAKCVM.cjs +2 -0
- package/dist/{chunk-PKXAW6MO.cjs.map → chunk-S3EAKCVM.cjs.map} +1 -1
- package/dist/chunk-YNO7BCCM.mjs +2 -0
- package/dist/{chunk-3YXSUBA5.mjs.map → chunk-YNO7BCCM.mjs.map} +1 -1
- package/dist/contexts/exports.d.cts +3 -3
- package/dist/contexts/exports.d.ts +3 -3
- package/dist/enum/exports.d.cts +1 -1
- package/dist/enum/exports.d.ts +1 -1
- package/dist/errors/exports.d.cts +1 -1
- package/dist/errors/exports.d.ts +1 -1
- package/dist/{getValidatorQueuedOperatorAddress-NrjpnEn8.d.ts → getValidatorQueuedOperatorAddress-CqR6cyqC.d.ts} +3 -3
- package/dist/{getValidatorQueuedOperatorAddress-D_LEt3vv.d.cts → getValidatorQueuedOperatorAddress-DZgrPmZ2.d.cts} +3 -3
- package/dist/{global.d-X3cqpCEB.d.ts → global.d-BeYWDreg.d.ts} +4 -4
- package/dist/{global.d-DLRtrPG5.d.cts → global.d-DghRxpHd.d.cts} +4 -4
- package/dist/hooks/exports.cjs +3 -3
- package/dist/hooks/exports.cjs.map +1 -1
- package/dist/hooks/exports.d.cts +40 -38
- package/dist/hooks/exports.d.ts +40 -38
- package/dist/hooks/exports.mjs +3 -3
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.cts → txnEnum-DxPRHSJt.d.cts} +1 -1
- package/dist/{txnEnum-BlBYhNRl.d.ts → txnEnum-DxPRHSJt.d.ts} +1 -1
- package/dist/types/exports.d.cts +3 -3
- package/dist/types/exports.d.ts +3 -3
- package/dist/{useHoneySwapState-D1DKG_Of.d.ts → useHoneySwapState-B494PQDl.d.ts} +1 -1
- package/dist/{useHoneySwapState-B-vmIP1b.d.cts → useHoneySwapState-D6vpv19r.d.cts} +1 -1
- package/dist/utils/exports.cjs +1 -1
- package/dist/utils/exports.cjs.map +1 -1
- package/dist/utils/exports.d.cts +2 -2
- package/dist/utils/exports.d.ts +2 -2
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/exports.mjs.map +1 -1
- package/package.json +8 -9
- package/src/abi/exports.ts +0 -27
- package/src/actions/bend/getConvertToAssets.ts +1 -1
- package/src/actions/bend/getMaxDeposit.ts +1 -1
- package/src/actions/dex/aggregators/bex.ts +2 -1
- package/src/actions/dex/aggregators/enso/enso.ts +3 -2
- package/src/actions/dex/aggregators/enso/ensoErc4626.debug.test.ts +2 -3
- package/src/actions/dex/aggregators/erc4626.ts +2 -1
- package/src/actions/dex/aggregators/fly.ts +2 -1
- package/src/actions/dex/aggregators/haiku.ts +2 -1
- package/src/actions/dex/aggregators/kyberswap.ts +2 -2
- package/src/actions/dex/aggregators/oogabooga.ts +2 -1
- package/src/actions/dex/aggregators/openOcean.ts +2 -1
- package/src/actions/dex/aggregators/wbera.ts +2 -1
- package/src/actions/dex/getVaultPausedState.ts +2 -1
- package/src/actions/enso/getEnsoUserTokensWithBalances.debug.test.ts +1 -1
- package/src/actions/governance/__tests__/checkProposalField.unit.test.ts +2 -1
- package/src/actions/governance/__tests__/getDecodedFunctionData.integration.test.ts +66 -78
- package/src/actions/governance/__tests__/getQuorum.integration.test.ts +6 -7
- package/src/actions/governance/getDecodedFunctionData.ts +2 -2
- package/src/actions/governance/getProposalFromTx.ts +2 -1
- package/src/actions/governance/getProposalParams.ts +3 -2
- package/src/actions/governance/getQuorum.ts +2 -1
- package/src/actions/honey/getCollateralWeights.ts +2 -1
- package/src/actions/honey/getGlobalCapLimit.ts +2 -1
- package/src/actions/honey/getHoneyCollaterals.ts +2 -1
- package/src/actions/honey/getHoneyFees.ts +2 -1
- package/src/actions/honey/getHoneyPausedState.ts +2 -1
- package/src/actions/honey/getHoneyPreview.ts +2 -1
- package/src/actions/honey/getHoneyPythPriceOracle.ts +1 -1
- package/src/actions/honey/getHoneyRootPriceOracle.ts +2 -1
- package/src/actions/honey/getHoneyVaultsBalance.ts +3 -2
- package/src/actions/honey/getRelativeCapLimit.ts +2 -1
- package/src/actions/honey/getSharesWithoutFees.ts +3 -2
- package/src/actions/honey/getSwapPayload.ts +3 -2
- package/src/actions/honey/isBadCollateralAsset.ts +3 -2
- package/src/actions/honey/isBasketModeEnabled.ts +3 -2
- package/src/actions/pol/getBgtTokenTotalBoosts.ts +2 -1
- package/src/actions/pol/getLSTStakeConfig.ts +2 -1
- package/src/actions/pol/getRewardTokenToBeraRate.ts +2 -1
- package/src/actions/pol/getRewardVaultBeaconImplementation.ts +2 -1
- package/src/actions/pol/getRewardVaultDurationConstants.ts +2 -1
- package/src/actions/pol/getRewardVaultFromToken.ts +2 -1
- package/src/actions/pol/getRewardVaultIncentives.ts +2 -1
- package/src/actions/pol/getRewardVaultRewards.ts +2 -1
- package/src/actions/pol/getRewardVaultStakingToken.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +2 -1
- package/src/actions/pol/getSWBeraVaultMetadata.ts +2 -1
- package/src/actions/pol/getSWBeraWithdrawal.ts +2 -1
- package/src/actions/pol/getStakeWithdrawalCooldown.ts +1 -1
- package/src/actions/pol/getTotalStakedAmount.ts +2 -1
- package/src/actions/pol/getUserVaults.ts +2 -1
- package/src/actions/pol/getUserVaultsBalance.ts +2 -1
- package/src/actions/pol/getUserVaultsReward.ts +1 -1
- package/src/actions/pol/getVaultsSupply.ts +1 -1
- package/src/actions/pyth/getHoneyPythFeeds.ts +2 -1
- package/src/actions/transactions/beraWriteContract.integration.test.ts +48 -51
- package/src/actions/validators/getActiveBoostAndCommissionChangeDelay.ts +3 -2
- package/src/actions/validators/getBaselineRewardAllocation.ts +2 -1
- package/src/actions/validators/getDefaultRewardAllocation.ts +2 -1
- package/src/actions/validators/getUserBoostsOnValidator.ts +2 -1
- package/src/actions/validators/getValidatorCommission.ts +2 -1
- package/src/actions/validators/getValidatorOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedCommission.ts +2 -1
- package/src/actions/validators/getValidatorQueuedOperatorAddress.ts +2 -1
- package/src/actions/validators/getValidatorQueuedRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocation.ts +2 -1
- package/src/actions/validators/getValidatorRewardAllocatorAddress.ts +2 -1
- package/src/actions/validators/utils/__tests__/validatorUtils.integration.test.ts +10 -11
- package/src/errors/getRevertReason.integration.test.ts +115 -107
- package/src/hooks/dex/useAggregatorsRouterFeeBps.ts +2 -1
- package/src/hooks/dex/useCreatePool.ts +2 -1
- package/src/hooks/dex/usePollPoolCreationRelayerApproval.ts +2 -1
- package/src/hooks/governance/useGetPastVotes.ts +2 -1
- package/src/hooks/governance/useHasVoted.ts +2 -1
- package/src/hooks/governance/useIsCanceller.ts +2 -1
- package/src/hooks/governance/usePollProposalThreshold.ts +2 -1
- package/src/hooks/governance/usePollUserDelegates.ts +2 -1
- package/src/hooks/governance/useProposalSnapshot.ts +2 -1
- package/src/hooks/governance/useProposalState.ts +2 -1
- package/src/hooks/governance/useProposalTimelockState.ts +5 -4
- package/src/hooks/pol/useBgtUnstakedBalance.ts +2 -1
- package/src/hooks/pol/useOnChainRewardVault.ts +2 -1
- package/src/hooks/pol/useRewardVaultBalanceFromStakingToken.ts +2 -1
- package/src/hooks/pol/useRewardVaultFromToken.ts +2 -1
- package/src/hooks/validators/useOnChainValidator.ts +4 -3
- package/dist/chunk-3YXSUBA5.mjs +0 -2
- package/dist/chunk-A4UDYSB6.mjs +0 -4
- package/dist/chunk-A4UDYSB6.mjs.map +0 -1
- package/dist/chunk-CYKCYPFR.cjs +0 -2
- package/dist/chunk-CYKCYPFR.cjs.map +0 -1
- package/dist/chunk-ECRMUMTA.mjs +0 -2
- package/dist/chunk-ECRMUMTA.mjs.map +0 -1
- package/dist/chunk-F4BKSBEM.mjs +0 -2
- package/dist/chunk-F4BKSBEM.mjs.map +0 -1
- package/dist/chunk-FL2N3XHK.cjs +0 -2
- package/dist/chunk-FL2N3XHK.cjs.map +0 -1
- package/dist/chunk-MUCEYO3E.cjs +0 -4
- package/dist/chunk-MUCEYO3E.cjs.map +0 -1
- package/dist/chunk-P2Q7CMUD.cjs +0 -2
- package/dist/chunk-P2Q7CMUD.cjs.map +0 -1
- package/dist/chunk-PKXAW6MO.cjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs +0 -2
- package/dist/chunk-Q3SCM6WL.mjs.map +0 -1
- package/dist/chunk-TEBJWAVU.mjs +0 -2
- package/dist/chunk-TEBJWAVU.mjs.map +0 -1
- package/dist/chunk-VP7XUOSI.cjs +0 -2
- package/dist/chunk-VP7XUOSI.cjs.map +0 -1
- package/dist/pythWrapper-CBjsmmsK.d.cts +0 -1958
- package/dist/pythWrapper-CBjsmmsK.d.ts +0 -1958
- package/src/abi/bend/metaMorpho.ts +0 -2584
- package/src/abi/bend/morpho.ts +0 -444
- package/src/abi/bex/aggregatorsRouter.ts +0 -492
- package/src/abi/bex/balancerComposableStablePoolFactoryV6.ts +0 -283
- package/src/abi/bex/balancerPoolCreationHelper.ts +0 -267
- package/src/abi/bex/balancerVault.ts +0 -757
- package/src/abi/governance/governance.ts +0 -1016
- package/src/abi/governance/governanceTimelock.ts +0 -589
- package/src/abi/honey/collateralVault.ts +0 -1144
- package/src/abi/honey/honey.ts +0 -563
- package/src/abi/honey/honeyFactory.ts +0 -1270
- package/src/abi/honey/honeyFactoryReader.ts +0 -894
- package/src/abi/honey/honeyRootOracle.ts +0 -492
- package/src/abi/honey/pythPriceOracle.ts +0 -619
- package/src/abi/honey/pythWrapper.ts +0 -446
- package/src/abi/pol/LSTStakerVault.ts +0 -2032
- package/src/abi/pol/beaconDeposit.ts +0 -595
- package/src/abi/pol/beraChef.ts +0 -1019
- package/src/abi/pol/bgt.ts +0 -1008
- package/src/abi/pol/bgtIncentiveDistributor.ts +0 -640
- package/src/abi/pol/bgtStaker.ts +0 -1034
- package/src/abi/pol/rewardAllocationFactory.ts +0 -408
- package/src/abi/pol/rewardVault.ts +0 -1928
- package/src/abi/pol/rewardVaultFactory.ts +0 -586
- package/src/abi/pol/rewardVaultHelper.ts +0 -882
- package/src/abi/pol/stakeBeraVault.ts +0 -1116
- package/src/abi/pol/stakeBeraVaultWithdrawalRequest.ts +0 -618
- package/src/abi/pol/wbera.ts +0 -366
|
@@ -23,11 +23,12 @@ import {
|
|
|
23
23
|
getRpcUrls,
|
|
24
24
|
} from "@berachain/config/internal";
|
|
25
25
|
|
|
26
|
+
import { metaMorphoV11Abi as metaMorphoAbi } from "@berachain/abis/bend-metamorpho/metaMorphoV11";
|
|
27
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
28
|
+
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
29
|
+
|
|
26
30
|
import { getConfig } from "@berachain/wagmi/config";
|
|
27
31
|
|
|
28
|
-
import { metaMorphoAbi } from "~/abi/bend/metaMorpho";
|
|
29
|
-
import { bgtAbi } from "~/abi/pol/bgt";
|
|
30
|
-
import { rewardVaultAbi } from "~/abi/pol/rewardVault";
|
|
31
32
|
import { beraWriteContract } from "~/actions/transactions/beraWriteContract";
|
|
32
33
|
import { ContractName } from "~/enum/contracts";
|
|
33
34
|
import { TransactionActionType } from "~/enum/txnEnum";
|
|
@@ -146,38 +147,38 @@ describe.skipIf(defaultChainId !== ChainId.MAINNET)("getRevertReason", () => {
|
|
|
146
147
|
expect(revertReason.reason).toBe("ERC20InsufficientAllowance");
|
|
147
148
|
});
|
|
148
149
|
|
|
149
|
-
it.concurrent.each(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
150
|
+
it.concurrent.each(
|
|
151
|
+
errors,
|
|
152
|
+
)("should return the expected revert onchain reason ($error)", async ({
|
|
153
|
+
tx,
|
|
154
|
+
error,
|
|
155
|
+
...args
|
|
156
|
+
}) => {
|
|
157
|
+
const revertReason = await getRevertReason({
|
|
158
|
+
publicClient,
|
|
159
|
+
abi: [...vaultV2Abi, ...metaMorphoAbi, ...rewardVaultAbi],
|
|
160
|
+
txHash: tx,
|
|
161
|
+
});
|
|
157
162
|
|
|
158
|
-
|
|
163
|
+
expect(revertReason.reason).toBe(error);
|
|
159
164
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
});
|
|
178
|
-
expect(revertReason.reason).toBe("AllCapsReached");
|
|
179
|
-
},
|
|
180
|
-
);
|
|
165
|
+
if ("message" in args) {
|
|
166
|
+
expect(getErrorMessage({ reason: error })).toBe(args.message);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it.concurrent("should parse the error from nested contract calls", async () => {
|
|
171
|
+
const revertReason = await getRevertReason({
|
|
172
|
+
publicClient,
|
|
173
|
+
account: "0xC0090EFF4C7818E46FE4eDd46588c6799180aFD4",
|
|
174
|
+
to: "0x56811e1BFfF951B98c7940d3aCe0e549Ec4fDee8",
|
|
175
|
+
value: 0n,
|
|
176
|
+
data: "0x374f435d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000257a41e20bbfe90d750646c2e00ba700d55958c500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064d96ca0b90000000000000000000000000de23153bc280dd95be914ddafb5591ae877e067000000000000000000000000257a41e20bbfe90d750646c2e00ba700d55958c50000000000000000000000000000000000000000000089a4921338674240000000000000000000000000000000000000000000000000000000000000000000000000000000000000257a41e20bbfe90d750646c2e00ba700d55958c500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000846ef5eeae000000000000000000000000c0808a144ce2ea85bf84ebd1ddf5d59429f59dde0000000000000000000000000000000000000000000089a492133867424000000000000000000000000000000000000000000000033b6ec5be4c67d4cc54f101000000000000000000000000c0090eff4c7818e46fe4edd46588c6799180afd400000000000000000000000000000000000000000000000000000000",
|
|
177
|
+
abi: [...rewardVaultAbi, ...metaMorphoAbi],
|
|
178
|
+
blockNumber: 11765133n,
|
|
179
|
+
});
|
|
180
|
+
expect(revertReason.reason).toBe("AllCapsReached");
|
|
181
|
+
});
|
|
181
182
|
|
|
182
183
|
it.concurrent("should return the expected simulation error", async () => {
|
|
183
184
|
expect.hasAssertions();
|
|
@@ -287,43 +288,47 @@ describe("test errors contract", () => {
|
|
|
287
288
|
|
|
288
289
|
const anvilMockAccount = mnemonicToAccount(anvilMnemonic);
|
|
289
290
|
|
|
290
|
-
it.concurrent.each(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
291
|
+
it.concurrent.each(
|
|
292
|
+
expectedRevertReasons,
|
|
293
|
+
)("should return the expected revert reason for $functionName", async ({
|
|
294
|
+
functionName,
|
|
295
|
+
...rest
|
|
296
|
+
}) => {
|
|
297
|
+
expect.hasAssertions();
|
|
298
|
+
const resultPromise = getRevertReason({
|
|
299
|
+
publicClient,
|
|
300
|
+
abi: testErrorContractAbi,
|
|
301
|
+
blockNumber: 11768554n,
|
|
302
|
+
to: "0x47a9E3A4b5a26eEDD0E53BC468bae31c24c9B158",
|
|
303
|
+
functionName,
|
|
304
|
+
args: "args" in rest ? rest.args : undefined,
|
|
305
|
+
account: anvilMockAccount.address,
|
|
306
|
+
});
|
|
303
307
|
|
|
304
|
-
|
|
308
|
+
const result = await resultPromise;
|
|
305
309
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
it.concurrent.each(expectedRevertReasons.filter((i) => !!i.txHashWith5972))(
|
|
313
|
-
"should return the expected revert reason for $functionName with txHashWith5972",
|
|
314
|
-
async ({ txHashWith5972, ...rest }) => {
|
|
315
|
-
expect.hasAssertions();
|
|
316
|
-
const result = await getRevertReason({
|
|
317
|
-
publicClient,
|
|
318
|
-
abi: testErrorContractAbi,
|
|
319
|
-
txHash: txHashWith5972,
|
|
320
|
-
});
|
|
310
|
+
expect(result.reason).toBe(
|
|
311
|
+
"onChainReason" in rest ? rest.onChainReason : rest.revertReason,
|
|
312
|
+
);
|
|
313
|
+
});
|
|
321
314
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
315
|
+
it.concurrent.each(
|
|
316
|
+
expectedRevertReasons.filter((i) => !!i.txHashWith5972),
|
|
317
|
+
)("should return the expected revert reason for $functionName with txHashWith5972", async ({
|
|
318
|
+
txHashWith5972,
|
|
319
|
+
...rest
|
|
320
|
+
}) => {
|
|
321
|
+
expect.hasAssertions();
|
|
322
|
+
const result = await getRevertReason({
|
|
323
|
+
publicClient,
|
|
324
|
+
abi: testErrorContractAbi,
|
|
325
|
+
txHash: txHashWith5972,
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
expect(result.reason).toBe(
|
|
329
|
+
"onChainReason" in rest ? rest.onChainReason : rest.revertReason,
|
|
330
|
+
);
|
|
331
|
+
});
|
|
327
332
|
});
|
|
328
333
|
|
|
329
334
|
/**
|
|
@@ -418,44 +423,47 @@ describe("eip5972 transactions", () => {
|
|
|
418
423
|
});
|
|
419
424
|
const wagmiConfig = beraWagmiConfig.wagmi;
|
|
420
425
|
|
|
421
|
-
it.concurrent.each(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
426
|
+
it.concurrent.each(
|
|
427
|
+
expectedRevertReasons,
|
|
428
|
+
)("should return the expected revert reason on sendCalls for $functionName to be $revertReason", async ({
|
|
429
|
+
functionName,
|
|
430
|
+
revertReason,
|
|
431
|
+
...rest
|
|
432
|
+
}) => {
|
|
433
|
+
await beraWriteContract({
|
|
434
|
+
wagmiConfig,
|
|
435
|
+
walletClient,
|
|
436
|
+
errorsAbi: testErrorContractAbi,
|
|
437
|
+
account: anvilMockAccount,
|
|
438
|
+
enableSimulateCalls: true,
|
|
439
|
+
calls: [
|
|
440
|
+
{
|
|
441
|
+
address: config.tokens.wbera,
|
|
442
|
+
contractName: ContractName.ERC20,
|
|
443
|
+
abi: erc20Abi,
|
|
444
|
+
functionName: "approve",
|
|
445
|
+
params: [zeroAddress, 0n],
|
|
446
|
+
} as NonNullable<IContractWrite["calls"]>[number],
|
|
447
|
+
{
|
|
448
|
+
contractName: ContractName.ERC20,
|
|
449
|
+
address: "0x47a9E3A4b5a26eEDD0E53BC468bae31c24c9B158",
|
|
450
|
+
abi: testErrorContractAbi,
|
|
451
|
+
functionName,
|
|
452
|
+
params: "args" in rest ? rest.args : undefined,
|
|
453
|
+
} as NonNullable<IContractWrite["calls"]>[number],
|
|
454
|
+
],
|
|
455
|
+
message: "test",
|
|
456
|
+
actionType: TransactionActionType.REDEEM_BGT,
|
|
457
|
+
onSuccess: () => {
|
|
458
|
+
assert.fail("Transaction should fail");
|
|
459
|
+
},
|
|
460
|
+
onError: (e) => {
|
|
461
|
+
expect(e).toBeInstanceOf(BeraError);
|
|
462
|
+
if (e instanceof BeraError) {
|
|
463
|
+
expect(e.reason).toBe(revertReason);
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
// assert.fail("Transaction should fail");
|
|
468
|
+
});
|
|
461
469
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWRImmutable from "swr/immutable";
|
|
2
2
|
import { type PublicClient, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
|
+
import { metaAggregatorAbi as aggregatorsRouterAbi } from "@berachain/abis/meta-aggregator/metaAggregator";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { aggregatorsRouterAbi } from "~/abi/bex/aggregatorsRouter";
|
|
7
8
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
8
9
|
|
|
9
10
|
export const useAggregatorsRouterFeeBps = () => {
|
|
@@ -9,13 +9,14 @@ import {
|
|
|
9
9
|
zeroAddress,
|
|
10
10
|
} from "viem";
|
|
11
11
|
|
|
12
|
+
import { poolCreationHelperAbi as balancerPoolCreationHelperAbi } from "@berachain/abis/bex/poolCreationHelper";
|
|
13
|
+
|
|
12
14
|
import {
|
|
13
15
|
GetDedupedSubgraphPools,
|
|
14
16
|
type GetDedupedSubgraphPoolsQuery,
|
|
15
17
|
type SubgraphPoolFragment,
|
|
16
18
|
} from "@berachain/graphql/dex/subgraph";
|
|
17
19
|
|
|
18
|
-
import { balancerPoolCreationHelperAbi } from "~/abi/bex/balancerPoolCreationHelper";
|
|
19
20
|
import { getApolloClient } from "~/actions/clients/getApolloClient";
|
|
20
21
|
import { TransactionActionType } from "~/enum/txnEnum";
|
|
21
22
|
import type { Token, TokenWithAmount } from "~/types/dex";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
|
+
import { vaultAbi as balancerVaultAbi } from "@berachain/abis/bex/vault";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { balancerVaultAbi } from "~/abi/bex/balancerVault";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import type { DefaultHookOptions } from "~/types/global";
|
|
9
10
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWRImmutable from "swr/immutable";
|
|
2
2
|
import { type Address, formatUnits } from "viem";
|
|
3
3
|
|
|
4
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { bgtAbi } from "~/abi/pol/bgt";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
10
|
import { useProposalSnapshot } from "./useProposalSnapshot";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, isAddress } from "viem";
|
|
3
3
|
|
|
4
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { governanceAbi } from "~/abi/governance/governance";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
|
+
import { timeLockAbi as governanceTimelockAbi } from "@berachain/abis/gov/timeLock";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { governanceTimelockAbi } from "~/abi/governance/governanceTimelock";
|
|
7
8
|
import { CANCELLER_ROLE } from "~/actions/governance/constants";
|
|
8
9
|
import { POLLING } from "~/enum/polling";
|
|
9
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, formatEther } from "viem";
|
|
3
3
|
|
|
4
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { governanceAbi } from "~/abi/governance/governance";
|
|
7
8
|
import { POLLING } from "~/enum/polling";
|
|
8
9
|
import { assertPublicClient } from "~/errors/assert";
|
|
9
10
|
import type { DefaultHookReturnType } from "~/types/global";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, formatEther } from "viem";
|
|
3
3
|
|
|
4
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { bgtAbi } from "~/abi/pol/bgt";
|
|
7
8
|
import { POLLING } from "~/enum/polling";
|
|
8
9
|
import { assertPublicClient } from "~/errors/assert";
|
|
9
10
|
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { SWRResponse } from "swr";
|
|
2
2
|
import useSWRImmutable from "swr/immutable";
|
|
3
3
|
|
|
4
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { governanceAbi } from "~/abi/governance/governance";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
10
|
|
|
@@ -2,9 +2,10 @@ import type { SWRResponse } from "swr";
|
|
|
2
2
|
import useSWRImmutable from "swr/immutable";
|
|
3
3
|
import type { Address } from "viem";
|
|
4
4
|
|
|
5
|
+
import { berachainGovernanceAbi as governanceAbi } from "@berachain/abis/gov/berachainGovernance";
|
|
6
|
+
|
|
5
7
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
6
8
|
|
|
7
|
-
import { governanceAbi } from "~/abi/governance/governance";
|
|
8
9
|
import { ProposalState } from "~/enum/governance";
|
|
9
10
|
import { assertPublicClient } from "~/errors/assert";
|
|
10
11
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import useSWR, { type SWRResponse } from "swr";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
|
|
4
|
+
import { timeLockAbi as governanceTimelockAbi } from "@berachain/abis/gov/timeLock";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
8
|
import { POLLING } from "~/enum/polling";
|
|
7
9
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
|
-
import { governanceTimelockAbi } from "../../abi/governance/governanceTimelock";
|
|
9
10
|
|
|
10
11
|
const TimelockOperationState = {
|
|
11
12
|
0: "unset",
|
|
@@ -18,7 +19,7 @@ const TimelockOperationState = {
|
|
|
18
19
|
* Fetches the state of a proposal timelock
|
|
19
20
|
* @returns state of the proposal timelock (unset, waiting, ready, done)
|
|
20
21
|
*/
|
|
21
|
-
export
|
|
22
|
+
export function useProposalTimelockState({
|
|
22
23
|
proposalTimelockId,
|
|
23
24
|
timelockAddress,
|
|
24
25
|
}: {
|
|
@@ -26,7 +27,7 @@ export const useProposalTimelockState = ({
|
|
|
26
27
|
timelockAddress: Address;
|
|
27
28
|
}): SWRResponse<
|
|
28
29
|
(typeof TimelockOperationState)[keyof typeof TimelockOperationState]
|
|
29
|
-
>
|
|
30
|
+
> {
|
|
30
31
|
const publicClient = usePublicClient();
|
|
31
32
|
|
|
32
33
|
const QUERY_KEY =
|
|
@@ -58,4 +59,4 @@ export const useProposalTimelockState = ({
|
|
|
58
59
|
refreshInterval: POLLING.SLOW,
|
|
59
60
|
},
|
|
60
61
|
);
|
|
61
|
-
}
|
|
62
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { formatEther } from "viem";
|
|
3
3
|
|
|
4
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { bgtAbi } from "~/abi/pol/bgt";
|
|
7
8
|
import { POLLING } from "~/enum/polling";
|
|
8
9
|
import { assertPublicClient } from "~/errors/assert";
|
|
9
10
|
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, erc20Abi, formatUnits, isAddress } from "viem";
|
|
3
3
|
|
|
4
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
5
|
+
|
|
4
6
|
import type { ApiVaultFragment } from "@berachain/graphql/pol/api";
|
|
5
7
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
6
8
|
|
|
7
|
-
import { beraChefAbi } from "~/abi/pol/beraChef";
|
|
8
9
|
import { getRewardVaultIncentives } from "~/actions/pol/getRewardVaultIncentives";
|
|
9
10
|
import { getRewardVaultStakingToken } from "~/actions/pol/getRewardVaultStakingToken";
|
|
10
11
|
import { getStakingTokenInformation } from "~/actions/pol/getStakingTokenInformation";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, isAddress, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
|
+
import { rewardVaultAbi } from "@berachain/abis/pol/rewards/rewardVault";
|
|
5
|
+
|
|
4
6
|
import { useBeraWallet, usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { rewardVaultAbi } from "~/abi/pol/rewardVault";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import type { DefaultHookOptions } from "~/types/global";
|
|
9
10
|
import { useRewardVaultFromToken } from "./useRewardVaultFromToken";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import useSWRImmutable from "swr/immutable";
|
|
2
2
|
import { type Address, isAddress, zeroAddress } from "viem";
|
|
3
3
|
|
|
4
|
+
import { rewardVaultFactoryAbi } from "@berachain/abis/pol/rewards/rewardVaultFactory";
|
|
5
|
+
|
|
4
6
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
5
7
|
|
|
6
|
-
import { rewardVaultFactoryAbi } from "~/abi/pol/rewardVaultFactory";
|
|
7
8
|
import { assertPublicClient } from "~/errors/assert";
|
|
8
9
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
|
9
10
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
import { type Address, keccak256 } from "viem";
|
|
3
3
|
|
|
4
|
+
import { beaconDepositAbi } from "@berachain/abis/pol/beaconDeposit";
|
|
5
|
+
import { bgtAbi } from "@berachain/abis/pol/bgt";
|
|
6
|
+
import { beraChefAbi } from "@berachain/abis/pol/rewards/beraChef";
|
|
7
|
+
|
|
4
8
|
import type { ApiValidatorFragment } from "@berachain/graphql/pol/api";
|
|
5
9
|
import { usePublicClient } from "@berachain/wagmi/hooks";
|
|
6
10
|
|
|
7
|
-
import { beaconDepositAbi } from "~/abi/pol/beaconDeposit";
|
|
8
|
-
import { beraChefAbi } from "~/abi/pol/beraChef";
|
|
9
|
-
import { bgtAbi } from "~/abi/pol/bgt";
|
|
10
11
|
import { assertPublicClient } from "~/errors/assert";
|
|
11
12
|
import type { DefaultHookOptions, DefaultHookReturnType } from "~/types/global";
|
|
12
13
|
import { parseBaseArgs } from "~/utils/parseBaseArgs";
|
package/dist/chunk-3YXSUBA5.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-ECRMUMTA.mjs";import{c as T,e as a}from"./chunk-THATXCJK.mjs";function m(e){return{...e,...a(e,"BERA")&&T}}function d(e){return e.map(r=>m(r))}var g=(e,r,i,o)=>{if(!e||!r||!i||!o)return 0;let n=new t(e).times(i),s=new t(r).times(o);if(n.lt(.01)||s.lt(.01)||n.isZero()||s.isZero())return 0;let u=s.div(n);return Number(new t(1).minus(u).toFixed())};export{m as a,d as b,g as c};
|
|
2
|
-
//# sourceMappingURL=chunk-3YXSUBA5.mjs.map
|