@berachain/berajs 0.3.0 → 0.3.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/actions/clients/clientName.unit.test.d.ts +2 -0
- package/dist/actions/clients/clientName.unit.test.d.ts.map +1 -0
- package/dist/actions/clients/exports.mjs +3 -3
- package/dist/actions/clients/exports.mjs.map +1 -1
- package/dist/actions/clients/fetchBeep.d.ts +2 -2
- package/dist/actions/clients/fetchBeep.d.ts.map +1 -1
- package/dist/actions/clients/fetchEnso.d.ts +2 -2
- package/dist/actions/clients/fetchEnso.d.ts.map +1 -1
- package/dist/actions/clients/fetchLayerzero.d.ts +2 -2
- package/dist/actions/clients/fetchLayerzero.d.ts.map +1 -1
- package/dist/actions/clients/fetchOpenApi.unit.test.d.ts +2 -0
- package/dist/actions/clients/fetchOpenApi.unit.test.d.ts.map +1 -0
- package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts +2 -0
- package/dist/actions/dex/__tests__/aggregators.unit.test.d.ts.map +1 -0
- package/dist/actions/dex/__tests__/allPools.integration.test.d.ts +2 -0
- package/dist/actions/dex/__tests__/allPools.integration.test.d.ts.map +1 -0
- package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts +2 -0
- package/dist/actions/dex/__tests__/getOnChainPool.unit.test.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts +2 -0
- package/dist/actions/dex/aggregators/enso/ensoErc4626.debug.test.d.ts.map +1 -0
- package/dist/actions/dex/aggregators/haiku.integration.test.d.ts +2 -0
- package/dist/actions/dex/aggregators/haiku.integration.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.action.unit.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/getBendDemultiplyBundle.unit.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.action.unit.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/getBendMultiplyBundle.unit.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/getEnsoUserTokensWithBalances.debug.test.d.ts.map +1 -0
- package/dist/actions/enso/__tests__/util.unit.test.d.ts +2 -0
- package/dist/actions/enso/__tests__/util.unit.test.d.ts.map +1 -0
- package/dist/actions/exports.mjs +5 -17
- package/dist/actions/exports.mjs.map +1 -1
- package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts +2 -0
- package/dist/actions/governance/__tests__/checkProposalField.unit.test.d.ts.map +1 -0
- package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts +2 -0
- package/dist/actions/governance/__tests__/getDecodedFunctionData.integration.test.d.ts.map +1 -0
- package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts +2 -0
- package/dist/actions/governance/__tests__/getQuorum.integration.test.d.ts.map +1 -0
- package/dist/actions/honey/getChartData.d.ts +1 -1
- package/dist/actions/honey/getChartData.d.ts.map +1 -1
- package/dist/actions/honey/getHoneyTxns.d.ts +1 -1
- package/dist/actions/honey/getHoneyTxns.d.ts.map +1 -1
- package/dist/actions/honey/tests/pyth.integration.test.d.ts +2 -0
- package/dist/actions/honey/tests/pyth.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts +2 -0
- package/dist/actions/pol/__tests__/getAllValidators.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts +2 -0
- package/dist/actions/pol/__tests__/getValidator.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts +2 -0
- package/dist/actions/pol/__tests__/rewardVaults.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/getBGTGlobalInfo.d.ts +0 -1
- package/dist/actions/pol/getBGTGlobalInfo.d.ts.map +1 -1
- package/dist/actions/pol/getBeraTokenTotalSupply.d.ts.map +1 -1
- package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts +2 -0
- package/dist/actions/pol/getBgtAprSimultaion.unit.test.d.ts.map +1 -0
- package/dist/actions/pol/getBlockTime.debug.test.d.ts +2 -0
- package/dist/actions/pol/getBlockTime.debug.test.d.ts.map +1 -0
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts +4 -4
- package/dist/actions/pol/getEarnedStakedBeraVault.d.ts.map +1 -1
- package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts +2 -0
- package/dist/actions/pol/getRewardVaultBeaconImplementation.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts +2 -0
- package/dist/actions/pol/getRewardVaultDurationConstants.integration.test.d.ts.map +1 -0
- package/dist/actions/pol/getRewardVaults.d.ts.map +1 -1
- package/dist/actions/pol/getStakedBeraAPY.d.ts.map +1 -1
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts +1 -1
- package/dist/actions/pol/getStakedBeraSnapshots.d.ts.map +1 -1
- package/dist/actions/pol/getStakingDailyAssets.d.ts +2 -2
- package/dist/actions/pol/getStakingDailyAssets.d.ts.map +1 -1
- package/dist/actions/prices/__tests__/prices.integration.test.d.ts +2 -0
- package/dist/actions/prices/__tests__/prices.integration.test.d.ts.map +1 -0
- package/dist/actions/server/exports.mjs +1 -1
- package/dist/actions/server/exports.mjs.map +1 -1
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts +1 -1
- package/dist/actions/server/getDailyValidatorBlockStats.d.ts.map +1 -1
- package/dist/actions/tokens/getWalletBalances.integration.test.d.ts +2 -0
- package/dist/actions/tokens/getWalletBalances.integration.test.d.ts.map +1 -0
- package/dist/actions/transactions/beraWriteContract.integration.test.d.ts +2 -0
- package/dist/actions/transactions/beraWriteContract.integration.test.d.ts.map +1 -0
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts +2 -0
- package/dist/actions/validators/getActiveBoostAndCommissionChangeDelay.integration.test.d.ts.map +1 -0
- package/dist/actions/validators/getValidatorIncentiveDistribution.d.ts +1 -1
- package/dist/actions/validators/getValidatorIncentiveDistribution.d.ts.map +1 -1
- package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts +2 -0
- package/dist/actions/validators/utils/__tests__/validatorUtils.integration.test.d.ts.map +1 -0
- package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts +2 -0
- package/dist/actions/validators/utils/aggregateValidatorIncentives.unit.test.d.ts.map +1 -0
- package/dist/{chunk-J6GM7HWX.mjs → chunk-3TRTSTDH.mjs} +1 -1
- package/dist/chunk-3TRTSTDH.mjs.map +1 -0
- package/dist/{chunk-BZKA6DBM.mjs → chunk-5MUCX35C.mjs} +2 -2
- package/dist/{chunk-5PBYMJRG.mjs → chunk-6D4S3EAC.mjs} +3 -3
- package/dist/chunk-6D4S3EAC.mjs.map +1 -0
- package/dist/{chunk-7OESHTBN.mjs → chunk-GDUKRUHE.mjs} +1 -1
- package/dist/chunk-GDUKRUHE.mjs.map +1 -0
- package/dist/{chunk-SMBAW7AG.mjs → chunk-KY7JMIIS.mjs} +3 -5
- package/dist/chunk-KY7JMIIS.mjs.map +1 -0
- package/dist/{chunk-BSLXKPX4.mjs → chunk-Z337NBBW.mjs} +2 -2
- package/dist/chunk-Z337NBBW.mjs.map +1 -0
- package/dist/contexts/exports.mjs +1 -1
- package/dist/enum/exports.mjs +1 -1
- package/dist/enum/txnEnum.d.ts +1 -1
- package/dist/enum/txnEnum.d.ts.map +1 -1
- package/dist/errors/BeraError.unit.test.d.ts +2 -0
- package/dist/errors/BeraError.unit.test.d.ts.map +1 -0
- package/dist/errors/BeraTracing.unit.test.d.ts +2 -0
- package/dist/errors/BeraTracing.unit.test.d.ts.map +1 -0
- package/dist/errors/RequestError.unit.test.d.ts +2 -0
- package/dist/errors/RequestError.unit.test.d.ts.map +1 -0
- package/dist/errors/assert.unit.test.d.ts +2 -0
- package/dist/errors/assert.unit.test.d.ts.map +1 -0
- package/dist/errors/getErrorMessage.unit.test.d.ts +2 -0
- package/dist/errors/getErrorMessage.unit.test.d.ts.map +1 -0
- package/dist/errors/getRevertReason.integration.test.d.ts +2 -0
- package/dist/errors/getRevertReason.integration.test.d.ts.map +1 -0
- package/dist/errors/spanStatus.unit.test.d.ts +2 -0
- package/dist/errors/spanStatus.unit.test.d.ts.map +1 -0
- package/dist/generated/beep.d.ts +1597 -0
- package/dist/generated/beep.d.ts.map +1 -0
- package/dist/generated/enso.d.ts +4957 -0
- package/dist/generated/enso.d.ts.map +1 -0
- package/dist/generated/layerzero.d.ts +2057 -0
- package/dist/generated/layerzero.d.ts.map +1 -0
- package/dist/hooks/dex/useCrossChainNativeFee.unit.test.d.ts +2 -0
- package/dist/hooks/dex/useCrossChainNativeFee.unit.test.d.ts.map +1 -0
- package/dist/hooks/dex/useSingleAggregatorQuote.d.ts.map +1 -1
- package/dist/hooks/dex/useSingleAggregatorQuote.unit.test.d.ts +2 -0
- package/dist/hooks/dex/useSingleAggregatorQuote.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useBendZapSupply.d.ts.map +1 -1
- package/dist/hooks/enso/useBendZapSupply.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useBendZapSupply.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.d.ts.map +1 -1
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useEnsoUserTokensWithBalances.unit.test.d.ts.map +1 -0
- package/dist/hooks/enso/useZapStakeBera.d.ts.map +1 -1
- package/dist/hooks/enso/useZapStakeBera.unit.test.d.ts +2 -0
- package/dist/hooks/enso/useZapStakeBera.unit.test.d.ts.map +1 -0
- package/dist/hooks/exports.mjs +38 -19
- package/dist/hooks/exports.mjs.map +1 -1
- package/dist/hooks/honey/useHoneyChartData.d.ts +4 -4
- package/dist/hooks/honey/useHoneyChartData.d.ts.map +1 -1
- package/dist/hooks/pol/useAutoclaimedIncentives.d.ts.map +1 -1
- package/dist/hooks/pol/useAutoclaimedIncentivesTxHash.d.ts.map +1 -1
- package/dist/hooks/pol/useRewardVaults.d.ts.map +1 -1
- package/dist/hooks/pol/useStakedData.d.ts +2 -0
- package/dist/hooks/pol/useStakedData.d.ts.map +1 -1
- package/dist/hooks/pol/useStakedSnapshots.d.ts +1 -1
- package/dist/hooks/pol/useStakedSnapshots.d.ts.map +1 -1
- package/dist/hooks/tokens/useMultipleTokenInformation.unit.test.d.ts +2 -0
- package/dist/hooks/tokens/useMultipleTokenInformation.unit.test.d.ts.map +1 -0
- package/dist/hooks/validators/useValidator.d.ts +0 -1
- package/dist/hooks/validators/useValidator.d.ts.map +1 -1
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts +1 -1
- package/dist/hooks/validators/useValidatorIncentiveDistribution.d.ts.map +1 -1
- package/dist/types/beep/exports.d.ts +2 -0
- package/dist/types/beep/exports.d.ts.map +1 -0
- package/dist/types/beep/exports.mjs +1 -0
- package/dist/types/beep/exports.mjs.map +1 -0
- package/dist/types/bribeBoost.d.ts +20 -0
- package/dist/types/dex.d.ts +242 -0
- package/dist/types/enso.d.ts +50 -0
- package/dist/types/global.d.ts +205 -0
- package/dist/types/governance.d.ts +112 -0
- package/dist/types/honeySwap.d.ts +23 -0
- package/dist/types/pol.d.ts +33 -0
- package/dist/types/staking.d.ts +22 -0
- package/dist/utils/createEmitter.unit.test.d.ts +2 -0
- package/dist/utils/createEmitter.unit.test.d.ts.map +1 -0
- package/dist/utils/crossChainBridge.unit.test.d.ts +2 -0
- package/dist/utils/crossChainBridge.unit.test.d.ts.map +1 -0
- package/dist/utils/exports.mjs +1 -1
- package/dist/utils/formatNumber.unit.test.d.ts +2 -0
- package/dist/utils/formatNumber.unit.test.d.ts.map +1 -0
- package/dist/utils/formatTimestamps.unit.test.d.ts +2 -0
- package/dist/utils/formatTimestamps.unit.test.d.ts.map +1 -0
- package/dist/utils/getContractName.unit.test.d.ts +2 -0
- package/dist/utils/getContractName.unit.test.d.ts.map +1 -0
- package/dist/utils/getHoneySwapMessage.test.d.ts +2 -0
- package/dist/utils/getHoneySwapMessage.test.d.ts.map +1 -0
- package/dist/utils/math.unit.test.d.ts +2 -0
- package/dist/utils/math.unit.test.d.ts.map +1 -0
- package/dist/utils/parseBaseArgs.unit.test.d.ts +2 -0
- package/dist/utils/parseBaseArgs.unit.test.d.ts.map +1 -0
- package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts +2 -0
- package/dist/utils/polyfillAbortSignalAny.unit.test.d.ts.map +1 -0
- package/dist/utils/time.unit.test.d.ts +2 -0
- package/dist/utils/time.unit.test.d.ts.map +1 -0
- package/dist/utils/tokens.unit.test.d.ts +2 -0
- package/dist/utils/tokens.unit.test.d.ts.map +1 -0
- package/dist/utils/truncateHash.unit.test.d.ts +2 -0
- package/dist/utils/truncateHash.unit.test.d.ts.map +1 -0
- package/package.json +9 -7
- package/src/actions/clients/fetchBeep.ts +2 -3
- package/src/actions/clients/fetchEnso.ts +2 -3
- package/src/actions/clients/fetchLayerzero.ts +2 -3
- package/src/actions/clients/fetchOpenApi.unit.test.ts +1 -2
- package/src/actions/honey/getChartData.ts +2 -3
- package/src/actions/honey/getHoney24hVolume.ts +1 -1
- package/src/actions/honey/getHoneyTxns.ts +2 -3
- package/src/actions/pol/getBGTGlobalInfo.ts +0 -2
- package/src/actions/pol/getEarnedStakedBeraVault.ts +1 -1
- package/src/actions/pol/getRewardVaults.ts +0 -1
- package/src/actions/pol/getStakedBeraAPY.ts +1 -2
- package/src/actions/pol/getStakedBeraSnapshots.ts +1 -2
- package/src/actions/pol/getStakingDailyAssets.ts +1 -1
- package/src/actions/server/getDailyValidatorBlockStats.ts +1 -2
- package/src/actions/validators/getValidatorIncentiveDistribution.ts +1 -2
- package/src/enum/txnEnum.ts +1 -1
- package/src/generated/beep.ts +1605 -0
- package/src/generated/enso.ts +4965 -0
- package/src/generated/layerzero.ts +2065 -0
- package/src/hooks/dex/useSingleAggregatorQuote.ts +6 -3
- package/src/hooks/dex/useSingleAggregatorQuote.unit.test.ts +86 -0
- package/src/hooks/enso/useBendZapSupply.ts +1 -0
- package/src/hooks/enso/useBendZapSupply.unit.test.ts +98 -0
- package/src/hooks/enso/useEnsoUserTokensWithBalances.ts +3 -1
- package/src/hooks/enso/useEnsoUserTokensWithBalances.unit.test.ts +69 -0
- package/src/hooks/enso/useZapStakeBera.ts +7 -0
- package/src/hooks/enso/useZapStakeBera.unit.test.ts +97 -0
- package/src/hooks/pol/useStakedData.ts +2 -0
- package/src/hooks/pol/useStakedSnapshots.ts +1 -1
- package/src/hooks/validators/useValidatorIncentiveDistribution.ts +1 -1
- package/src/types/beep/exports.ts +4 -0
- package/dist/chunk-5PBYMJRG.mjs.map +0 -1
- package/dist/chunk-7OESHTBN.mjs.map +0 -1
- package/dist/chunk-BSLXKPX4.mjs.map +0 -1
- package/dist/chunk-J6GM7HWX.mjs.map +0 -1
- package/dist/chunk-SMBAW7AG.mjs.map +0 -1
- /package/dist/{chunk-BZKA6DBM.mjs.map → chunk-5MUCX35C.mjs.map} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { AbiFunction, Address, Hex } from "viem";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
ProposalVoteFragment,
|
|
5
|
+
ProposalWithVotesFragment,
|
|
6
|
+
} from "@berachain/graphql/governance";
|
|
7
|
+
|
|
8
|
+
import type { ProposalErrorCodes, ProposalTypeEnum } from "../enum/governance";
|
|
9
|
+
|
|
10
|
+
export type Proposal = ProposalWithVotesFragment;
|
|
11
|
+
|
|
12
|
+
export type Vote = ProposalVoteFragment;
|
|
13
|
+
|
|
14
|
+
export type Voter = Address;
|
|
15
|
+
|
|
16
|
+
export type ProposalVotes = {
|
|
17
|
+
yes: number;
|
|
18
|
+
no: number;
|
|
19
|
+
abstain: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type PROPOSAL_GENRE = "berahub" | "honey" | "bend" | "berps" | "general";
|
|
23
|
+
|
|
24
|
+
export type CustomProposalActionErrors = {
|
|
25
|
+
type?: null | ProposalErrorCodes;
|
|
26
|
+
target?: null | ProposalErrorCodes;
|
|
27
|
+
value?: null | ProposalErrorCodes;
|
|
28
|
+
ABI?: null | ProposalErrorCodes;
|
|
29
|
+
functionSignature?: null | ProposalErrorCodes;
|
|
30
|
+
args?: (null | ProposalErrorCodes)[];
|
|
31
|
+
vault?: null | ProposalErrorCodes;
|
|
32
|
+
isFriend?: null | ProposalErrorCodes;
|
|
33
|
+
to?: null | ProposalErrorCodes;
|
|
34
|
+
amount?: null | ProposalErrorCodes;
|
|
35
|
+
minIncentiveRate?: null | ProposalErrorCodes;
|
|
36
|
+
managerAddress?: null | ProposalErrorCodes;
|
|
37
|
+
input?: null | ProposalErrorCodes;
|
|
38
|
+
token?: null | ProposalErrorCodes;
|
|
39
|
+
rawCalldata?: null | ProposalErrorCodes;
|
|
40
|
+
message?: null | ProposalErrorCodes;
|
|
41
|
+
} | null;
|
|
42
|
+
|
|
43
|
+
export type CustomProposalErrors = {
|
|
44
|
+
title?: null | ProposalErrorCodes;
|
|
45
|
+
description?: null | ProposalErrorCodes;
|
|
46
|
+
forumLink?: null | ProposalErrorCodes;
|
|
47
|
+
actions?: CustomProposalActionErrors[];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type GovernanceTopic = {
|
|
51
|
+
id: PROPOSAL_GENRE;
|
|
52
|
+
color: string;
|
|
53
|
+
icon: React.ReactNode;
|
|
54
|
+
iconBackground?: string;
|
|
55
|
+
name: string;
|
|
56
|
+
slug: string;
|
|
57
|
+
forumLink: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
comingSoon?: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type CustomProposal = {
|
|
62
|
+
title: string;
|
|
63
|
+
description: any;
|
|
64
|
+
actions: ProposalAction[];
|
|
65
|
+
forumLink: string;
|
|
66
|
+
topic: Set<PROPOSAL_GENRE>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type SafeProposalAction = {
|
|
70
|
+
value: bigint;
|
|
71
|
+
target: "" | Address;
|
|
72
|
+
} & (
|
|
73
|
+
| {
|
|
74
|
+
type: ProposalTypeEnum.CUSTOM_PROPOSAL;
|
|
75
|
+
input: "ABI" | "rawCalldata" | "message";
|
|
76
|
+
ABI: string;
|
|
77
|
+
_isVerifiedAbi?: boolean;
|
|
78
|
+
functionSignature: string;
|
|
79
|
+
args: string[];
|
|
80
|
+
rawCalldata: Hex;
|
|
81
|
+
message: string;
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
type:
|
|
85
|
+
| ProposalTypeEnum.WHITELIST_REWARD_VAULT
|
|
86
|
+
| ProposalTypeEnum.BLACKLIST_REWARD_VAULT;
|
|
87
|
+
vault: Address;
|
|
88
|
+
}
|
|
89
|
+
| {
|
|
90
|
+
type: ProposalTypeEnum.ERC20_TRANSFER;
|
|
91
|
+
to: Address;
|
|
92
|
+
amount: string;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
type: ProposalTypeEnum.WHITELIST_REWARD_VAULT_INCENTIVE;
|
|
96
|
+
vault: Address;
|
|
97
|
+
token: Address;
|
|
98
|
+
minIncentiveRate: string;
|
|
99
|
+
managerAddress: Address;
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export type ProposalAction = Partial<SafeProposalAction> & {
|
|
104
|
+
type: SafeProposalAction["type"];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type VerifiedAbi = {
|
|
108
|
+
abiItem?: AbiFunction;
|
|
109
|
+
functionName?: string;
|
|
110
|
+
args: readonly unknown[];
|
|
111
|
+
functionSignature?: string;
|
|
112
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
|
|
3
|
+
import type { HoneyPreviewResult } from "../actions/honey/getHoneyPreview";
|
|
4
|
+
import type { TokenWithOrder } from "../contexts/HoneyConfigProvider";
|
|
5
|
+
import type { HoneySwapAction } from "../enum/honey";
|
|
6
|
+
|
|
7
|
+
export type PythPriceFeedMap = Record<Address, Hex>;
|
|
8
|
+
|
|
9
|
+
export type HoneySwapActions =
|
|
10
|
+
| { type: HoneySwapAction.RESET_AMOUNTS }
|
|
11
|
+
| { type: HoneySwapAction.ACTION_TYPE_CHANGE; value: "mint" | "redeem" }
|
|
12
|
+
| { type: HoneySwapAction.COLLATERALS_CHANGE; value: TokenWithOrder[] }
|
|
13
|
+
| { type: HoneySwapAction.FROM_AMOUNT_CHANGE; index: number; value: string }
|
|
14
|
+
| { type: HoneySwapAction.TO_AMOUNT_CHANGE; index: number; value: string }
|
|
15
|
+
| {
|
|
16
|
+
type: HoneySwapAction.PREVIEW_CHANGE;
|
|
17
|
+
value: HoneyPreviewResult;
|
|
18
|
+
changedAsset: Address;
|
|
19
|
+
}
|
|
20
|
+
| { type: HoneySwapAction.IS_BASKET_MODE_ENABLED_CHANGE; value: boolean }
|
|
21
|
+
| { type: HoneySwapAction.IS_TYPING_CHANGE; value: boolean }
|
|
22
|
+
| { type: HoneySwapAction.IS_SUBMITTING_CHANGE; value: boolean }
|
|
23
|
+
| { type: HoneySwapAction.IS_LOADING_CHANGE; value: boolean };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TokenWithMetadata } from "./dex";
|
|
2
|
+
|
|
3
|
+
export interface UserVaultInfo {
|
|
4
|
+
balance: bigint;
|
|
5
|
+
delegatedBalance: bigint;
|
|
6
|
+
withdrawableBalance: bigint;
|
|
7
|
+
rewards: string;
|
|
8
|
+
percentage: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type StakedBeraAsset = {
|
|
12
|
+
token: TokenWithMetadata;
|
|
13
|
+
/**
|
|
14
|
+
* Staking APY, or `undefined` when unavailable (e.g. the APY backend is
|
|
15
|
+
* down). `undefined` lets the UI render a "—" placeholder instead of a
|
|
16
|
+
* misleading "0%".
|
|
17
|
+
*/
|
|
18
|
+
apy: number | undefined;
|
|
19
|
+
stakedAmount: number;
|
|
20
|
+
/**
|
|
21
|
+
* USD value of the staked amount, or `undefined` when the token price is
|
|
22
|
+
* unavailable (e.g. the price backend is down). `undefined` lets the UI
|
|
23
|
+
* render a "—" placeholder instead of a misleading "$0.00".
|
|
24
|
+
*/
|
|
25
|
+
stakedAmountUsd: number | undefined;
|
|
26
|
+
earnedAmount: number;
|
|
27
|
+
/**
|
|
28
|
+
* USD value of the earned amount, or `undefined` when the token price is
|
|
29
|
+
* unavailable. See {@link stakedAmountUsd}.
|
|
30
|
+
*/
|
|
31
|
+
earnedAmountUsd: number | undefined;
|
|
32
|
+
isLoadingEarnings?: boolean;
|
|
33
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TokenWithMetadata } from "./dex";
|
|
2
|
+
|
|
3
|
+
export interface ProtocolMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
logoURI: string;
|
|
6
|
+
url: string;
|
|
7
|
+
description: string;
|
|
8
|
+
tags?: string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for a single staking option.
|
|
13
|
+
* Maps receipt tokens to their accepted input tokens.
|
|
14
|
+
*/
|
|
15
|
+
export type StakingConfig = {
|
|
16
|
+
/** Unique identifier for this staking config */
|
|
17
|
+
id: string;
|
|
18
|
+
/** The token received when staking (e.g., sWBERA, siBERA) */
|
|
19
|
+
receiptToken: TokenWithMetadata;
|
|
20
|
+
/** Tokens that can be staked to receive the receipt token */
|
|
21
|
+
inputTokens: TokenWithMetadata[];
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEmitter.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/createEmitter.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crossChainBridge.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/crossChainBridge.unit.test.ts"],"names":[],"mappings":""}
|
package/dist/utils/exports.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatNumber.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/formatNumber.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatTimestamps.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/formatTimestamps.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContractName.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/getContractName.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHoneySwapMessage.test.d.ts","sourceRoot":"","sources":["../../src/utils/getHoneySwapMessage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/math.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseBaseArgs.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/parseBaseArgs.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfillAbortSignalAny.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/polyfillAbortSignalAny.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/time.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/tokens.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncateHash.unit.test.d.ts","sourceRoot":"","sources":["../../src/utils/truncateHash.unit.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@berachain/berajs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@apollo/client": "4.1.6",
|
|
14
14
|
"@berachain-foundation/berancer-sdk": "1.1.7",
|
|
15
15
|
"@berachain/abis": "0.1.3",
|
|
16
|
-
"@berachain/config": "0.2.
|
|
17
|
-
"@berachain/graphql": "0.
|
|
16
|
+
"@berachain/config": "0.2.2",
|
|
17
|
+
"@berachain/graphql": "0.8.0",
|
|
18
18
|
"@ensofinance/sdk": "2.5.0",
|
|
19
19
|
"@pythnetwork/hermes-client": "2.0.0",
|
|
20
20
|
"@vercel/edge-config": "1.4.3",
|
|
@@ -27,14 +27,15 @@
|
|
|
27
27
|
"@types/react-dom": "19.2.3",
|
|
28
28
|
"@types/react": "19.2.14",
|
|
29
29
|
"@typescript/analyze-trace": "0.10.1",
|
|
30
|
+
"openapi-typescript": "7.13.0",
|
|
30
31
|
"swr": "2.4.1",
|
|
31
32
|
"tsup": "8.5.1",
|
|
32
33
|
"typescript": "5.5.4",
|
|
33
34
|
"viem": "2.54.6",
|
|
34
35
|
"vitest": "3.2.6",
|
|
36
|
+
"@berachain/wagmi": "0.4.2-beta.6",
|
|
35
37
|
"@berachain/edge-config": "0.1.0",
|
|
36
|
-
"@berachain/utils": "0.1.0"
|
|
37
|
-
"@berachain/wagmi": "0.4.2-beta.6"
|
|
38
|
+
"@berachain/utils": "0.1.0"
|
|
38
39
|
},
|
|
39
40
|
"exports": {
|
|
40
41
|
"./actions/*": {
|
|
@@ -107,9 +108,10 @@
|
|
|
107
108
|
},
|
|
108
109
|
"scripts": {
|
|
109
110
|
"build": "NODE_OPTIONS='--max-old-space-size=8192' tsup",
|
|
110
|
-
"prebuild": "pnpm contracts:update",
|
|
111
|
+
"prebuild": "pnpm contracts:update && pnpm codegen:api",
|
|
112
|
+
"codegen:api": "node ./.scripts/generate-api-types.mjs",
|
|
111
113
|
"test": "vitest",
|
|
112
|
-
"clean": "git clean -xdf dist .turbo node_modules",
|
|
114
|
+
"clean": "git clean -xdf dist .turbo node_modules src/generated",
|
|
113
115
|
"check-types": "NODE_OPTIONS='--max-old-space-size=8192' node ../../.scripts/commands.mjs check-types:dts",
|
|
114
116
|
"precheck-types": "pnpm prebuild",
|
|
115
117
|
"dev": "tsup --watch",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { paths } from "
|
|
2
|
-
|
|
1
|
+
import type { paths } from "../../generated/beep";
|
|
3
2
|
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
4
3
|
import { getClientName } from "./clientName";
|
|
5
4
|
import {
|
|
@@ -13,7 +12,7 @@ import {
|
|
|
13
12
|
* Typed GET against the next-gen "beep" backend.
|
|
14
13
|
*
|
|
15
14
|
* The `path`, its path/query params and the response are all type-checked
|
|
16
|
-
* against the beep schema (
|
|
15
|
+
* against the beep schema (`src/generated/beep`), so route shapes (e.g.
|
|
17
16
|
* the `/v0/stake/*` namespace) can never drift out of sync with the backend.
|
|
18
17
|
* The base URL is resolved from `config.beep`.
|
|
19
18
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { appConfig } from "@berachain/config/internal";
|
|
2
2
|
|
|
3
|
-
import type { paths } from "
|
|
4
|
-
|
|
3
|
+
import type { paths } from "../../generated/enso";
|
|
5
4
|
import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
6
5
|
import {
|
|
7
6
|
type DefinedParams,
|
|
@@ -20,7 +19,7 @@ const ENSO_API_ORIGIN = "https://api.enso.build";
|
|
|
20
19
|
* Typed GET against the Enso API.
|
|
21
20
|
*
|
|
22
21
|
* The `path`, its path/query params and the response are all type-checked
|
|
23
|
-
* against the Enso schema (
|
|
22
|
+
* against the Enso schema (`src/generated/enso`). Base URL and auth mirror
|
|
24
23
|
* {@link getEnsoClient}: in production requests go through the aggregators proxy
|
|
25
24
|
* (which injects Enso auth), and in dev/test they hit Enso directly with the
|
|
26
25
|
* public API key.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { paths } from "
|
|
2
|
-
|
|
1
|
+
import type { paths } from "../../generated/layerzero";
|
|
3
2
|
import {
|
|
4
3
|
type DefinedParams,
|
|
5
4
|
fetchOpenApi,
|
|
@@ -17,7 +16,7 @@ const LAYERZERO_SCAN_ORIGIN = "https://scan.layerzero-api.com/v1";
|
|
|
17
16
|
* Typed GET against the LayerZero Scan API.
|
|
18
17
|
*
|
|
19
18
|
* The `path`, its path/query params and the response are all type-checked
|
|
20
|
-
* against the LayerZero schema (
|
|
19
|
+
* against the LayerZero schema (`src/generated/layerzero`). The Scan API is
|
|
21
20
|
* public (no auth), so requests hit it directly — no proxy split like
|
|
22
21
|
* {@link fetchEnso}.
|
|
23
22
|
*/
|
|
@@ -16,8 +16,7 @@ import type {
|
|
|
16
16
|
StakeEarningResponse,
|
|
17
17
|
StakeStatsByDayResponse,
|
|
18
18
|
ValidatorsResponse,
|
|
19
|
-
} from "
|
|
20
|
-
|
|
19
|
+
} from "../../generated/beep";
|
|
21
20
|
import { getClientName } from "./clientName";
|
|
22
21
|
import { fetchBeep } from "./fetchBeep";
|
|
23
22
|
import { fetchOpenApi } from "./fetchOpenApi";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { HoneySnapshotResponse } from "@berachain/graphql/beep";
|
|
2
|
-
|
|
3
1
|
import { BeraError } from "../../errors/BeraError";
|
|
2
|
+
import type { HoneySnapshotResponse } from "../../generated/beep";
|
|
4
3
|
import { fetchBeep } from "../clients/fetchBeep";
|
|
5
4
|
|
|
6
5
|
/**
|
|
@@ -24,7 +23,7 @@ export async function getChartData({
|
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
// beep backend (next-gen), typed against
|
|
26
|
+
// beep backend (next-gen), typed against `src/generated/beep`. Queried
|
|
28
27
|
// directly from the browser — no Vercel proxy.
|
|
29
28
|
return fetchBeep("/v0/honey/snapshots/{interval}", {
|
|
30
29
|
path: { interval: "day" },
|
|
@@ -9,7 +9,7 @@ import { fetchBeep } from "../clients/fetchBeep";
|
|
|
9
9
|
* snapshot. Safe to call from either the browser or the server.
|
|
10
10
|
*/
|
|
11
11
|
export async function getHoney24hVolume(): Promise<BigNumber | undefined> {
|
|
12
|
-
// beep backend (next-gen), typed against
|
|
12
|
+
// beep backend (next-gen), typed against `src/generated/beep`. Queried
|
|
13
13
|
// directly, no Vercel proxy.
|
|
14
14
|
const snapshots = await fetchBeep("/v0/honey/snapshots/{interval}", {
|
|
15
15
|
path: { interval: "hour" },
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { HoneyTransactionsLatestResponse } from "@berachain/graphql/beep";
|
|
2
|
-
|
|
3
1
|
import { BeraError } from "../../errors/BeraError";
|
|
2
|
+
import type { HoneyTransactionsLatestResponse } from "../../generated/beep";
|
|
4
3
|
import { fetchBeep } from "../clients/fetchBeep";
|
|
5
4
|
|
|
6
5
|
type HoneyTxn = HoneyTransactionsLatestResponse[number];
|
|
@@ -35,7 +34,7 @@ export async function getHoneyTxns({
|
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
// beep backend (next-gen), typed against
|
|
37
|
+
// beep backend (next-gen), typed against `src/generated/beep`. Queried
|
|
39
38
|
// directly from the browser — no Vercel proxy. beep's `page` is 1-indexed and
|
|
40
39
|
// filters server-side by `type`; `fetchOpenApi` omits `type` when `txnType`
|
|
41
40
|
// is undefined (the "all" tab), so each tab paginates its own filtered feed.
|
|
@@ -9,7 +9,6 @@ import { parseBaseArgs } from "../../utils/parseBaseArgs";
|
|
|
9
9
|
import { getApolloClient } from "../clients/getApolloClient";
|
|
10
10
|
|
|
11
11
|
type ReturnedFromQuery = GlobalDataQuery["polGetGlobalInfo"] & {
|
|
12
|
-
top3EmittingValidators: GlobalDataQuery["top3EmittingValidators"]["validators"];
|
|
13
12
|
allValidatorsCount: number;
|
|
14
13
|
};
|
|
15
14
|
|
|
@@ -37,7 +36,6 @@ export async function getBGTGlobalInfo(
|
|
|
37
36
|
// allValidatorCount include inactive validators for the purpose of ranking
|
|
38
37
|
return {
|
|
39
38
|
...data.polGetGlobalInfo,
|
|
40
|
-
top3EmittingValidators: apiRes.data.top3EmittingValidators.validators,
|
|
41
39
|
allValidatorsCount: apiRes.data.allValidatorsCount.pagination.totalCount,
|
|
42
40
|
} satisfies GlobalInfo;
|
|
43
41
|
}
|
|
@@ -17,7 +17,7 @@ export async function getEarnedStakedBeraVault({
|
|
|
17
17
|
account,
|
|
18
18
|
...args
|
|
19
19
|
}: BeraJS.BaseFunctionArgs & GetEarnedStakedBeraVaultArgs) {
|
|
20
|
-
// beep backend (next-gen), typed against
|
|
20
|
+
// beep backend (next-gen), typed against `src/generated/beep`.
|
|
21
21
|
return fetchBeep(
|
|
22
22
|
"/v0/stake/{vault}/earnings/{owner}",
|
|
23
23
|
{ path: { vault: address, owner: account } },
|
|
@@ -87,7 +87,6 @@ export async function getRewardVaults({
|
|
|
87
87
|
...vault,
|
|
88
88
|
dynamicData: {
|
|
89
89
|
...vault.dynamicData,
|
|
90
|
-
allTimeRewards: vault.dynamicData?.allTimeRewards ?? "0",
|
|
91
90
|
rewardCapturePercentage:
|
|
92
91
|
vault.dynamicData?.rewardCapturePercentage ?? 0,
|
|
93
92
|
activeIncentivesValueUsd: totalIncentiveInUsdc.toString(),
|
|
@@ -9,7 +9,7 @@ export async function getStakingDailyAssets({
|
|
|
9
9
|
address: Address;
|
|
10
10
|
range: 30 | 60 | 90;
|
|
11
11
|
}) {
|
|
12
|
-
// beep backend (next-gen), typed against
|
|
12
|
+
// beep backend (next-gen), typed against `src/generated/beep`.
|
|
13
13
|
return fetchBeep("/v0/stake/{vault}/stats-by-day", {
|
|
14
14
|
path: { vault: address },
|
|
15
15
|
query: { days: `${range}` },
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
|
|
3
|
-
import type { ValidatorIncentivesResponse } from "@berachain/graphql/beep";
|
|
4
|
-
|
|
5
3
|
import { BeraError } from "../../errors/BeraError";
|
|
4
|
+
import type { ValidatorIncentivesResponse } from "../../generated/beep";
|
|
6
5
|
import { calculateTimestampFromDays } from "../../utils/formatTimestamps";
|
|
7
6
|
import { fetchBeep } from "../clients/fetchBeep";
|
|
8
7
|
|
package/src/enum/txnEnum.ts
CHANGED
|
@@ -41,7 +41,7 @@ export enum TransactionActionType {
|
|
|
41
41
|
RESET_REWARD_MODE = "Reset Reward Mode",
|
|
42
42
|
CREATE_BRIBE = "Add Incentives",
|
|
43
43
|
CLAIMING_BRIBES = "Claiming Incentives", // claiming others
|
|
44
|
-
CLAIMING_REWARDS = "Claiming
|
|
44
|
+
CLAIMING_REWARDS = "Claiming BERA",
|
|
45
45
|
CLAIM_ALL_REWARDS = "Claim All Rewards",
|
|
46
46
|
|
|
47
47
|
RECOVER_FUNDS = "Recover Bex Funds",
|