@berachain/berajs 0.1.0-alpha.0
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/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/BeraError-CfcNTfpH.d.ts +69 -0
- package/dist/BexStatusProvider-nS3NcdxI.d.ts +70 -0
- package/dist/RequestError-CtJLUaAc.d.ts +57 -0
- package/dist/abi/index.d.ts +26765 -0
- package/dist/abi/index.mjs +1 -0
- package/dist/actions/index.d.ts +1649 -0
- package/dist/actions/index.mjs +1 -0
- package/dist/aggregatorsRouter-Cny4B_MB.d.ts +593 -0
- package/dist/chunk-4IBBLGNS.mjs +1 -0
- package/dist/chunk-5GPS724E.mjs +1 -0
- package/dist/chunk-5UFI7X4U.mjs +1 -0
- package/dist/chunk-AHAZC5K3.mjs +1 -0
- package/dist/chunk-JQDPAEK2.mjs +2 -0
- package/dist/chunk-K4NZIO2Z.mjs +1 -0
- package/dist/chunk-MTBICGRP.mjs +1 -0
- package/dist/chunk-RNESAHY2.mjs +3 -0
- package/dist/chunk-SMZ3PG6A.mjs +1 -0
- package/dist/chunk-XX77QPIR.mjs +1 -0
- package/dist/chunk-YKNKCICU.mjs +1 -0
- package/dist/contexts/index.d.ts +81 -0
- package/dist/contexts/index.mjs +1 -0
- package/dist/defaultFlags-V-tJs2K8.d.ts +10 -0
- package/dist/dex-BD7Bq3pJ.d.ts +562 -0
- package/dist/dex-DreiokgL.d.ts +562 -0
- package/dist/enum/index.d.ts +31 -0
- package/dist/enum/index.mjs +1 -0
- package/dist/errors/index.d.ts +204 -0
- package/dist/errors/index.mjs +1 -0
- package/dist/getValidatorQueuedOperatorAddress--AXNo9IY.d.ts +440 -0
- package/dist/getValidatorQueuedOperatorAddress-DK2Xv19c.d.ts +440 -0
- package/dist/hooks/index.d.ts +1703 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/polling-BKnyavLI.d.ts +8 -0
- package/dist/pythWrapper-CBjsmmsK.d.ts +1958 -0
- package/dist/staking-Cggi38So.d.ts +246 -0
- package/dist/staking-DYbVFigB.d.ts +246 -0
- package/dist/txnEnum-BQKDfaeH.d.ts +81 -0
- package/dist/txnEnum-Diichv9Z.d.ts +80 -0
- package/dist/types/index.d.ts +56 -0
- package/dist/types/index.mjs +1 -0
- package/dist/useHoneySwapState-CW49RVci.d.ts +32 -0
- package/dist/useHoneySwapState-Ci8_c2bT.d.ts +32 -0
- package/dist/utils/index.d.ts +349 -0
- package/dist/utils/index.mjs +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export { A as AggregatedTokenTotals, e as BribeBoostReward, d as BribeBoostRewardItem, B as BribeBoostRewardProof, f as BribeBoostValidatorApr, r as ClaimedIncentives, s as ClaimedIncentivesLocalState, C as CustomProposal, m as CustomProposalActionErrors, c as CustomProposalErrors, G as GovernanceTopic, I as IncentiveReward, q as IncentiveRewardChunksWithValidatorData, l as PROPOSAL_GENRE, g as Proposal, o as ProposalAction, a as ProposalErrorCodes, b as ProposalState, n as ProposalTypeEnum, i as ProposalVotes, P as ProtocolMetadata, S as SafeProposalAction, U as UserVaultInfo, p as VerifiedAbi, V as Vote, j as VoteColorMap, k as VoteEnum, h as Voter } from '../staking-Cggi38So.js';
|
|
2
|
+
export { A as Aggregators, l as AllowanceToken, B as BalanceToken, G as BalanceTokenWithMetadata, O as BexStatus, R as ContractName, D as DefaultHookOptions, E as DefaultHookReturnType, V as HoneySwapAction, H as HoneySwapActions, i as IAggregatorArgs, g as IAggregatorQuote, m as IContractWrite, Q as IContractWriteFn, I as IRawAggregatorQuote, F as IUserPosition, M as MinimalERC20, y as PoolCreationStep, j as PythPriceFeedMap, S as SwapReferrer, N as SwapRequest, a as Token, h as TokenBalance, k as TokenCurrentPriceMap, x as TokenInput, J as TokenPriceInfo, z as TokenWithAmount, b as TokenWithMetadata } from '../dex-DreiokgL.js';
|
|
3
|
+
import { BundleData, EnsoClient } from '@ensofinance/sdk';
|
|
4
|
+
import { TransactionRequest, Address, Hex, PublicClient } from 'viem';
|
|
5
|
+
import '@berachain/graphql/governance';
|
|
6
|
+
import '@berachain/graphql/pol/api';
|
|
7
|
+
import '@berachain-foundation/berancer-sdk';
|
|
8
|
+
import '../aggregatorsRouter-Cny4B_MB.js';
|
|
9
|
+
import 'react/jsx-runtime';
|
|
10
|
+
import 'react';
|
|
11
|
+
import '@wagmi/core';
|
|
12
|
+
import 'swr';
|
|
13
|
+
import '@berachain/config';
|
|
14
|
+
import '../txnEnum-BQKDfaeH.js';
|
|
15
|
+
import '../BeraError-CfcNTfpH.js';
|
|
16
|
+
import '@sentry/nextjs';
|
|
17
|
+
|
|
18
|
+
type Quantity = string | number;
|
|
19
|
+
type ActionOutputReference<T> = T | StrictOutputReference<T>;
|
|
20
|
+
type StrictOutputReference<T> = {
|
|
21
|
+
useOutputOfCallAt: number;
|
|
22
|
+
index?: number;
|
|
23
|
+
};
|
|
24
|
+
interface GetZapTransactionRequestsArgs {
|
|
25
|
+
fromAddress: Address;
|
|
26
|
+
amountIn: Quantity;
|
|
27
|
+
tokenIn: Address;
|
|
28
|
+
tokenOut: Address;
|
|
29
|
+
chainId: number;
|
|
30
|
+
ensoClient: EnsoClient;
|
|
31
|
+
slippage: number;
|
|
32
|
+
destinationChainId?: number;
|
|
33
|
+
publicClient: PublicClient;
|
|
34
|
+
}
|
|
35
|
+
type GetZapTransaction = TransactionRequest & {
|
|
36
|
+
to: Address;
|
|
37
|
+
data: Hex;
|
|
38
|
+
value?: bigint;
|
|
39
|
+
gasLimit?: bigint;
|
|
40
|
+
};
|
|
41
|
+
type GetZapTransactions = GetZapTransaction[];
|
|
42
|
+
interface GetZapTransactionsArgs {
|
|
43
|
+
fromAddress: Address;
|
|
44
|
+
amountIn: Quantity;
|
|
45
|
+
tokenIn: Address;
|
|
46
|
+
chainId: number;
|
|
47
|
+
ensoClient: EnsoClient;
|
|
48
|
+
bundle: BundleData;
|
|
49
|
+
publicClient: PublicClient;
|
|
50
|
+
}
|
|
51
|
+
interface GetZapTransactionResponse {
|
|
52
|
+
bundle: BundleData;
|
|
53
|
+
transactions: GetZapTransactions;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type { ActionOutputReference, GetZapTransaction, GetZapTransactionRequestsArgs, GetZapTransactionResponse, GetZapTransactions, GetZapTransactionsArgs, Quantity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j}from"../chunk-K4NZIO2Z.mjs";export{b as Aggregators,d as ContractName,j as HoneySwapAction,a as PoolCreationStep,h as ProposalErrorCodes,e as ProposalState,i as ProposalTypeEnum,c as SwapReferrer,f as VoteColorMap,g as VoteEnum};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { T as TokenWithOrder, H as HoneySwapActions } from './dex-BD7Bq3pJ.js';
|
|
3
|
+
|
|
4
|
+
interface IHoneySwapState {
|
|
5
|
+
actionType: "mint" | "redeem";
|
|
6
|
+
/**
|
|
7
|
+
* List of current collaterals
|
|
8
|
+
*/
|
|
9
|
+
collaterals: TokenWithOrder[];
|
|
10
|
+
fromAmount: string[];
|
|
11
|
+
toAmount: string[];
|
|
12
|
+
isBasketModeEnabled: boolean | undefined;
|
|
13
|
+
isTyping: boolean;
|
|
14
|
+
isSubmitting: boolean;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function reducer(state: IHoneySwapState, action: HoneySwapActions): IHoneySwapState;
|
|
18
|
+
declare const useHoneySwapState: () => {
|
|
19
|
+
state: {
|
|
20
|
+
collaterals: TokenWithOrder[];
|
|
21
|
+
actionType: "mint" | "redeem";
|
|
22
|
+
fromAmount: string[];
|
|
23
|
+
toAmount: string[];
|
|
24
|
+
isBasketModeEnabled: boolean | undefined;
|
|
25
|
+
isTyping: boolean;
|
|
26
|
+
isSubmitting: boolean;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
};
|
|
29
|
+
dispatch: react.ActionDispatch<[action: HoneySwapActions]>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { type IHoneySwapState as I, reducer as r, useHoneySwapState as u };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { T as TokenWithOrder, H as HoneySwapActions } from './dex-DreiokgL.js';
|
|
3
|
+
|
|
4
|
+
interface IHoneySwapState {
|
|
5
|
+
actionType: "mint" | "redeem";
|
|
6
|
+
/**
|
|
7
|
+
* List of current collaterals
|
|
8
|
+
*/
|
|
9
|
+
collaterals: TokenWithOrder[];
|
|
10
|
+
fromAmount: string[];
|
|
11
|
+
toAmount: string[];
|
|
12
|
+
isBasketModeEnabled: boolean | undefined;
|
|
13
|
+
isTyping: boolean;
|
|
14
|
+
isSubmitting: boolean;
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare function reducer(state: IHoneySwapState, action: HoneySwapActions): IHoneySwapState;
|
|
18
|
+
declare const useHoneySwapState: () => {
|
|
19
|
+
state: {
|
|
20
|
+
collaterals: TokenWithOrder[];
|
|
21
|
+
actionType: "mint" | "redeem";
|
|
22
|
+
fromAmount: string[];
|
|
23
|
+
toAmount: string[];
|
|
24
|
+
isBasketModeEnabled: boolean | undefined;
|
|
25
|
+
isTyping: boolean;
|
|
26
|
+
isSubmitting: boolean;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
};
|
|
29
|
+
dispatch: react.ActionDispatch<[action: HoneySwapActions]>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { type IHoneySwapState as I, reducer as r, useHoneySwapState as u };
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
export { d as defaultBeraFlags } from '../defaultFlags-V-tJs2K8.js';
|
|
2
|
+
import { R as RequestError } from '../RequestError-CtJLUaAc.js';
|
|
3
|
+
import { I as IRawAggregatorQuote, a as Token, g as IAggregatorQuote } from '../dex-DreiokgL.js';
|
|
4
|
+
import * as viem from 'viem';
|
|
5
|
+
import { Address, PublicClient } from 'viem';
|
|
6
|
+
import * as _berachain_config_internal from '@berachain/config/internal';
|
|
7
|
+
import { ChainId, BeraConfig } from '@berachain/config/internal';
|
|
8
|
+
import { I as IHoneySwapState } from '../useHoneySwapState-Ci8_c2bT.js';
|
|
9
|
+
import * as SentryType from '@sentry/nextjs';
|
|
10
|
+
import { GqlValidatorBlockUptimeStatus } from '@berachain/graphql/pol/api';
|
|
11
|
+
import '@berachain/config/internal/flags';
|
|
12
|
+
import '@apollo/client';
|
|
13
|
+
import '../BeraError-CfcNTfpH.js';
|
|
14
|
+
import '@berachain-foundation/berancer-sdk';
|
|
15
|
+
import '../aggregatorsRouter-Cny4B_MB.js';
|
|
16
|
+
import 'react/jsx-runtime';
|
|
17
|
+
import 'react';
|
|
18
|
+
import '@wagmi/core';
|
|
19
|
+
import 'swr';
|
|
20
|
+
import '@berachain/config';
|
|
21
|
+
import '../txnEnum-BQKDfaeH.js';
|
|
22
|
+
|
|
23
|
+
type RequestOptions = RequestInit;
|
|
24
|
+
declare function beraFetch(endpoint: ConstructorParameters<typeof RequestError>[0]["endpoint"], options?: RequestOptions): Promise<Response>;
|
|
25
|
+
declare function beraFetchJson<T>(endpoint: ConstructorParameters<typeof RequestError>[0]["endpoint"], options?: RequestOptions): Promise<T>;
|
|
26
|
+
|
|
27
|
+
declare const CAP_LIMIT_BUFFER: bigint;
|
|
28
|
+
/**
|
|
29
|
+
* Maximum allowed input for a custom deadline in seconds.
|
|
30
|
+
* @type {number}
|
|
31
|
+
*/
|
|
32
|
+
declare const MAX_CUSTOM_DEADLINE = 100000;
|
|
33
|
+
/**
|
|
34
|
+
* Minimum allowed input for a custom deadline in seconds.
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
declare const MIN_CUSTOM_DEADLINE = 1;
|
|
38
|
+
/**
|
|
39
|
+
* Minimum allowed input for a custom slippage tolerance percentage.
|
|
40
|
+
* @type {number}
|
|
41
|
+
*/
|
|
42
|
+
declare const MIN_CUSTOM_SLIPPAGE = 0.1;
|
|
43
|
+
/**
|
|
44
|
+
* Maximum allowed input for a custom slippage tolerance percentage.
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
declare const MAX_CUSTOM_SLIPPAGE = 50;
|
|
48
|
+
/**
|
|
49
|
+
* Default gas limit used by MetaMask
|
|
50
|
+
* @see {@link https://github.com/MetaMask/metamask-extension/blob/06cf7459b963e26d0ae60312d4f9a342d07ab89d/ui/pages/confirmations/send/send.constants.js#L8}
|
|
51
|
+
*/
|
|
52
|
+
declare const DEFAULT_METAMASK_GAS_LIMIT = 7920027n;
|
|
53
|
+
|
|
54
|
+
declare const formatAggregatorsQuotes: (rawQuotes: (IRawAggregatorQuote | IRawAggregatorQuote<false>)[], selectedFrom: Token | undefined, selectedTo: Token | undefined, tokenInPrice: number, tokenOutPrice: number) => IAggregatorQuote[];
|
|
55
|
+
|
|
56
|
+
declare const formatInputTokenValue: (inputValue: string) => string;
|
|
57
|
+
|
|
58
|
+
type BigNumberValue = string | number | BigNumber;
|
|
59
|
+
interface FormatNumberOptions {
|
|
60
|
+
/** Number of visible decimal places */
|
|
61
|
+
visibleDecimals?: number;
|
|
62
|
+
/** Whether to use compact notation (K, M, B, etc.) */
|
|
63
|
+
compact?: boolean;
|
|
64
|
+
/** Show as percentage */
|
|
65
|
+
percent?: boolean;
|
|
66
|
+
/** Round down instead of normal rounding */
|
|
67
|
+
roundDown?: boolean;
|
|
68
|
+
/** Round up instead of normal rounding */
|
|
69
|
+
roundUp?: boolean;
|
|
70
|
+
/** Threshold above which compact notation is used */
|
|
71
|
+
compactThreshold?: number;
|
|
72
|
+
/** Maximum value to display (shows ∞ if exceeded) */
|
|
73
|
+
maxValue?: number;
|
|
74
|
+
/** Currency symbol (e.g., "USD" for $) */
|
|
75
|
+
symbol?: string;
|
|
76
|
+
/** Prefix text */
|
|
77
|
+
prefixText?: string;
|
|
78
|
+
/** Suffix text */
|
|
79
|
+
suffixText?: string;
|
|
80
|
+
/** Show "< min" or "> min" indicators for very small values */
|
|
81
|
+
showIsSmallerThanMin?: boolean;
|
|
82
|
+
/** Text to show if value is null/undefined */
|
|
83
|
+
ifNullish?: string;
|
|
84
|
+
}
|
|
85
|
+
declare function formatNumber(value: BigNumberValue | undefined | null, options?: FormatNumberOptions | number): string;
|
|
86
|
+
declare const getSafeNumber: (value: string | undefined) => number;
|
|
87
|
+
declare const truncateDecimal: (value: string | number | undefined, maxDecimal: number) => string;
|
|
88
|
+
|
|
89
|
+
declare function calculateTimestampFromDays(daysRange: number): number;
|
|
90
|
+
declare function formatUnixTimestamp(unixTimestamp: number, isShort?: boolean): string;
|
|
91
|
+
type LegacyArgs = [number, boolean?, boolean?, boolean?];
|
|
92
|
+
type FormatTimeLeftArgs = [
|
|
93
|
+
number,
|
|
94
|
+
{
|
|
95
|
+
condensed?: boolean;
|
|
96
|
+
greaterUnit?: "days" | "hours" | "minutes";
|
|
97
|
+
showSeconds?: boolean;
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
/**
|
|
101
|
+
* Formats the time left into a string like "8 hours, 23 minutes".
|
|
102
|
+
*
|
|
103
|
+
* @param timeLeftInSeconds - The time left in seconds.
|
|
104
|
+
* @returns A formatted string representing the time left.
|
|
105
|
+
*/
|
|
106
|
+
declare function formatTimeLeft(...args: FormatTimeLeftArgs | LegacyArgs): string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated use the FormattedNumber component instead
|
|
110
|
+
*/
|
|
111
|
+
declare function formatUsd(input: string | number, hideDecimals?: boolean): string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get a human readable name for a contract address.
|
|
115
|
+
*/
|
|
116
|
+
declare function getContractName({ address, chainId, }: {
|
|
117
|
+
address: Address | undefined;
|
|
118
|
+
chainId?: ChainId | "name";
|
|
119
|
+
}): string | undefined;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get the message shown in the transaction confirmation modal for honey swaps
|
|
123
|
+
* @returns {string} The message
|
|
124
|
+
*/
|
|
125
|
+
declare function getHoneySwapMessage({ collaterals, actionType, toAmount, fromAmount, isBasketModeEnabled, }: Pick<IHoneySwapState, "collaterals" | "actionType" | "toAmount" | "fromAmount" | "isBasketModeEnabled">): string;
|
|
126
|
+
|
|
127
|
+
declare const getServerSidePublicClient: (args?: {
|
|
128
|
+
chainId?: ChainId;
|
|
129
|
+
}) => PublicClient;
|
|
130
|
+
|
|
131
|
+
declare function getTestClient(chainId?: ChainId): {
|
|
132
|
+
mode: "anvil";
|
|
133
|
+
account: undefined;
|
|
134
|
+
batch?: viem.ClientConfig["batch"] | undefined;
|
|
135
|
+
cacheTime: number;
|
|
136
|
+
ccipRead?: viem.ClientConfig["ccipRead"] | undefined;
|
|
137
|
+
chain: undefined;
|
|
138
|
+
experimental_blockTag?: viem.BlockTag | undefined;
|
|
139
|
+
key: string;
|
|
140
|
+
name: string;
|
|
141
|
+
pollingInterval: number;
|
|
142
|
+
request: viem.EIP1193RequestFn<viem.TestRpcSchema<"anvil">>;
|
|
143
|
+
transport: viem.TransportConfig<"http", viem.EIP1193RequestFn> & {
|
|
144
|
+
fetchOptions?: viem.HttpTransportConfig["fetchOptions"] | undefined;
|
|
145
|
+
url?: string | undefined;
|
|
146
|
+
};
|
|
147
|
+
type: string;
|
|
148
|
+
uid: string;
|
|
149
|
+
dropTransaction: (args: viem.DropTransactionParameters) => Promise<void>;
|
|
150
|
+
dumpState: () => Promise<viem.DumpStateReturnType>;
|
|
151
|
+
getAutomine: () => Promise<viem.GetAutomineReturnType>;
|
|
152
|
+
getTxpoolContent: () => Promise<viem.GetTxpoolContentReturnType>;
|
|
153
|
+
getTxpoolStatus: () => Promise<viem.GetTxpoolStatusReturnType>;
|
|
154
|
+
impersonateAccount: (args: viem.ImpersonateAccountParameters) => Promise<void>;
|
|
155
|
+
increaseTime: (args: viem.IncreaseTimeParameters) => Promise<viem.Quantity>;
|
|
156
|
+
inspectTxpool: () => Promise<viem.InspectTxpoolReturnType>;
|
|
157
|
+
loadState: (args: viem.LoadStateParameters) => Promise<viem.LoadStateReturnType>;
|
|
158
|
+
mine: (args: viem.MineParameters) => Promise<void>;
|
|
159
|
+
removeBlockTimestampInterval: () => Promise<void>;
|
|
160
|
+
reset: (args?: viem.ResetParameters | undefined) => Promise<void>;
|
|
161
|
+
revert: (args: viem.RevertParameters) => Promise<void>;
|
|
162
|
+
sendUnsignedTransaction: <chain extends viem.Chain | undefined>(args: viem.SendUnsignedTransactionParameters<chain>) => Promise<viem.SendUnsignedTransactionReturnType>;
|
|
163
|
+
setAutomine: (args: boolean) => Promise<void>;
|
|
164
|
+
setBalance: (args: viem.SetBalanceParameters) => Promise<void>;
|
|
165
|
+
setBlockGasLimit: (args: viem.SetBlockGasLimitParameters) => Promise<void>;
|
|
166
|
+
setBlockTimestampInterval: (args: viem.SetBlockTimestampIntervalParameters) => Promise<void>;
|
|
167
|
+
setCode: (args: viem.SetCodeParameters) => Promise<void>;
|
|
168
|
+
setCoinbase: (args: viem.SetCoinbaseParameters) => Promise<void>;
|
|
169
|
+
setIntervalMining: (args: viem.SetIntervalMiningParameters) => Promise<void>;
|
|
170
|
+
setLoggingEnabled: (args: boolean) => Promise<void>;
|
|
171
|
+
setMinGasPrice: (args: viem.SetMinGasPriceParameters) => Promise<void>;
|
|
172
|
+
setNextBlockBaseFeePerGas: (args: viem.SetNextBlockBaseFeePerGasParameters) => Promise<void>;
|
|
173
|
+
setNextBlockTimestamp: (args: viem.SetNextBlockTimestampParameters) => Promise<void>;
|
|
174
|
+
setNonce: (args: viem.SetNonceParameters) => Promise<void>;
|
|
175
|
+
setRpcUrl: (args: string) => Promise<void>;
|
|
176
|
+
setStorageAt: (args: viem.SetStorageAtParameters) => Promise<void>;
|
|
177
|
+
snapshot: () => Promise<viem.Quantity>;
|
|
178
|
+
stopImpersonatingAccount: (args: viem.StopImpersonatingAccountParameters) => Promise<void>;
|
|
179
|
+
extend: <const client extends {
|
|
180
|
+
[x: string]: unknown;
|
|
181
|
+
account?: undefined;
|
|
182
|
+
batch?: undefined;
|
|
183
|
+
cacheTime?: undefined;
|
|
184
|
+
ccipRead?: undefined;
|
|
185
|
+
chain?: undefined;
|
|
186
|
+
experimental_blockTag?: undefined;
|
|
187
|
+
key?: undefined;
|
|
188
|
+
name?: undefined;
|
|
189
|
+
pollingInterval?: undefined;
|
|
190
|
+
request?: undefined;
|
|
191
|
+
transport?: undefined;
|
|
192
|
+
type?: undefined;
|
|
193
|
+
uid?: undefined;
|
|
194
|
+
} & viem.ExactPartial<Pick<viem.PublicActions<viem.HttpTransport<undefined, false>, undefined, undefined>, "call" | "createContractEventFilter" | "createEventFilter" | "estimateContractGas" | "estimateGas" | "getBlock" | "getBlockNumber" | "getChainId" | "getContractEvents" | "getEnsText" | "getFilterChanges" | "getGasPrice" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "prepareTransactionRequest" | "readContract" | "sendRawTransaction" | "simulateContract" | "uninstallFilter" | "watchBlockNumber" | "watchContractEvent"> & Pick<viem.WalletActions<undefined, undefined>, "sendTransaction" | "writeContract">>>(fn: (client: viem.Client<viem.HttpTransport<undefined, false>, undefined, undefined, viem.TestRpcSchema<"anvil">, {
|
|
195
|
+
mode: "anvil";
|
|
196
|
+
} & viem.TestActions>) => client) => viem.Client<viem.HttpTransport<undefined, false>, undefined, undefined, viem.TestRpcSchema<"anvil">, { [K in keyof client]: client[K]; } & {
|
|
197
|
+
mode: "anvil";
|
|
198
|
+
} & viem.TestActions>;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
declare const isDifferenceExceedingThreshold: (initialAmount: string, newAmount: string, threshold: number) => boolean;
|
|
202
|
+
|
|
203
|
+
declare function isSubgraphStale({ lastBlockTimestamp, blockTime, }: {
|
|
204
|
+
lastBlockTimestamp: number | null | undefined;
|
|
205
|
+
blockTime: number;
|
|
206
|
+
}): boolean;
|
|
207
|
+
|
|
208
|
+
declare function parseBaseArgs(args: BeraJS.BaseFunctionArgs): {
|
|
209
|
+
config: BeraConfig;
|
|
210
|
+
chainId: _berachain_config_internal.ChainId;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
declare const getPythDefaultUpdateFee: (tokenListLength: number) => bigint;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Util to make Sentry errors consistent with BeraErrors
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
declare function sentryBeforeSend<TEvent extends SentryType.ErrorEvent, THint extends SentryType.EventHint>(event: TEvent, hint: THint): PromiseLike<SentryType.ErrorEvent | null> | SentryType.ErrorEvent | null;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Convert milliseconds to seconds
|
|
223
|
+
*/
|
|
224
|
+
declare function msToSeconds(ms: number): number;
|
|
225
|
+
/**
|
|
226
|
+
* Time utility functions for converting between different time units.
|
|
227
|
+
*
|
|
228
|
+
* This utility file provides functions to convert between seconds, minutes, hours, and days.
|
|
229
|
+
* Note on naming conventions: We use "seconds" instead of "secondsToMs" because JavaScript
|
|
230
|
+
* is typically based in milliseconds, so the conversion to milliseconds is the more common
|
|
231
|
+
* and expected operation. We use "xxxInSeconds" when converting to second-based units.
|
|
232
|
+
*/
|
|
233
|
+
/**
|
|
234
|
+
* Convert seconds to milliseconds
|
|
235
|
+
*/
|
|
236
|
+
declare function seconds(seconds: number): number;
|
|
237
|
+
/**
|
|
238
|
+
* Convert minutes to milliseconds
|
|
239
|
+
*/
|
|
240
|
+
declare function minutes(minutes: number): number;
|
|
241
|
+
/**
|
|
242
|
+
* Convert minutes to seconds
|
|
243
|
+
*/
|
|
244
|
+
declare function minutesInSeconds(minutes: number): number;
|
|
245
|
+
/**
|
|
246
|
+
* Convert hours to milliseconds
|
|
247
|
+
*/
|
|
248
|
+
declare function hours(hours: number): number;
|
|
249
|
+
/**
|
|
250
|
+
* Convert hours to seconds
|
|
251
|
+
*/
|
|
252
|
+
declare function hoursInSeconds(hours: number): number;
|
|
253
|
+
/**
|
|
254
|
+
* Convert days to milliseconds
|
|
255
|
+
*/
|
|
256
|
+
declare function days(days: number): number;
|
|
257
|
+
/**
|
|
258
|
+
* Convert days to seconds
|
|
259
|
+
*/
|
|
260
|
+
declare function daysInSeconds(days: number): number;
|
|
261
|
+
/**
|
|
262
|
+
* Convert weeks to milliseconds
|
|
263
|
+
*/
|
|
264
|
+
declare function weeks(weeks: number): number;
|
|
265
|
+
/**
|
|
266
|
+
* Convert weeks to seconds
|
|
267
|
+
*/
|
|
268
|
+
declare function weeksInSeconds(weeks: number): number;
|
|
269
|
+
/**
|
|
270
|
+
* Convert months to milliseconds using 30 days per month
|
|
271
|
+
*/
|
|
272
|
+
declare function months(months: number): number;
|
|
273
|
+
/**
|
|
274
|
+
* Convert months to seconds using 30 days per month
|
|
275
|
+
*/
|
|
276
|
+
declare function monthsInSeconds(months: number): number;
|
|
277
|
+
/**
|
|
278
|
+
* Convert years to milliseconds using 365 days per year
|
|
279
|
+
*/
|
|
280
|
+
declare function years(years: number): number;
|
|
281
|
+
/**
|
|
282
|
+
* Convert years to seconds using 365 days per year
|
|
283
|
+
*/
|
|
284
|
+
declare function yearsInSeconds(years: number): number;
|
|
285
|
+
|
|
286
|
+
declare const beraToken: {
|
|
287
|
+
readonly address: "0x0000000000000000000000000000000000000000";
|
|
288
|
+
readonly decimals: 18;
|
|
289
|
+
readonly name: "Bera";
|
|
290
|
+
readonly symbol: "BERA";
|
|
291
|
+
readonly logoURI: "https://res.cloudinary.com/duv0g402y/image/upload/v1738720154/brand/berachain-chain-logo.png.png";
|
|
292
|
+
};
|
|
293
|
+
declare const wBeraToken: {
|
|
294
|
+
readonly address: "0x6969696969696969696969696969696969696969";
|
|
295
|
+
readonly decimals: 18;
|
|
296
|
+
readonly name: "WBera";
|
|
297
|
+
readonly symbol: "WBERA";
|
|
298
|
+
};
|
|
299
|
+
declare function getHoneyToken(baseArgs: BeraJS.BaseFunctionArgs): {
|
|
300
|
+
readonly address: `0x${string}`;
|
|
301
|
+
readonly symbol: "HONEY";
|
|
302
|
+
readonly name: "Honey";
|
|
303
|
+
readonly decimals: 18;
|
|
304
|
+
};
|
|
305
|
+
type KnownTokens = "BERA" | "WBERA" | "BGT" | "HONEY" | "SWBERA" | "ETH";
|
|
306
|
+
type BaseToken$1 = {
|
|
307
|
+
address: Address | string;
|
|
308
|
+
} | Address;
|
|
309
|
+
type InputToken = BaseToken$1 | string | undefined;
|
|
310
|
+
type IsTokenParams = [
|
|
311
|
+
token: InputToken,
|
|
312
|
+
compareTo: BaseToken$1 | Extract<KnownTokens, "BERA" | "WBERA" | "ETH">
|
|
313
|
+
] | [
|
|
314
|
+
token: InputToken,
|
|
315
|
+
compareTo: BaseToken$1 | KnownTokens,
|
|
316
|
+
baseArgs: BeraJS.BaseFunctionArgs
|
|
317
|
+
];
|
|
318
|
+
declare function isToken(...args: IsTokenParams): boolean;
|
|
319
|
+
|
|
320
|
+
type BaseToken = {
|
|
321
|
+
address: string;
|
|
322
|
+
};
|
|
323
|
+
declare function wrapNativeToken<T extends BaseToken>(token: T): T;
|
|
324
|
+
declare function wrapNativeTokens<T extends BaseToken>(tokens: T[]): T[];
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Truncate a transaction or address hash and optionally format with uppercase letters and a lowercase 'x'.
|
|
328
|
+
*/
|
|
329
|
+
declare const truncateHash: (address: `0x${string}` | string, startLength?: number, endLength?: number, formatUppercase?: boolean) => string;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Determines if a validator was the proposer for a specific block.
|
|
333
|
+
* The proposer is responsible for creating and proposing new blocks to the network.
|
|
334
|
+
*
|
|
335
|
+
* @param status - The validator's block uptime status from the GraphQL API
|
|
336
|
+
* @returns boolean
|
|
337
|
+
*/
|
|
338
|
+
declare function isValidatorProposer(status: GqlValidatorBlockUptimeStatus | undefined): boolean | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* Determines if a validator signed a specific block.
|
|
341
|
+
* Block signers participate in consensus by validating and signing blocks.
|
|
342
|
+
*
|
|
343
|
+
* @param status - The validator's block uptime status from the GraphQL API
|
|
344
|
+
* @returns boolean
|
|
345
|
+
*
|
|
346
|
+
*/
|
|
347
|
+
declare function isValidatorSigner(status: GqlValidatorBlockUptimeStatus | undefined): boolean | undefined;
|
|
348
|
+
|
|
349
|
+
export { type BigNumberValue, CAP_LIMIT_BUFFER, DEFAULT_METAMASK_GAS_LIMIT, type FormatNumberOptions, MAX_CUSTOM_DEADLINE, MAX_CUSTOM_SLIPPAGE, MIN_CUSTOM_DEADLINE, MIN_CUSTOM_SLIPPAGE, beraFetch, beraFetchJson, calculateTimestampFromDays, days, daysInSeconds, formatAggregatorsQuotes, formatInputTokenValue, formatNumber, formatTimeLeft, formatUnixTimestamp, formatUsd, getContractName, getHoneySwapMessage, getHoneyToken, getPythDefaultUpdateFee, getSafeNumber, getServerSidePublicClient, getTestClient, hours, hoursInSeconds, beraToken as internal_beraToken, wBeraToken as internal_wBeraToken, isDifferenceExceedingThreshold, isSubgraphStale, isToken, isValidatorProposer, isValidatorSigner, minutes, minutesInSeconds, months, monthsInSeconds, msToSeconds, parseBaseArgs, seconds, sentryBeforeSend, truncateDecimal, truncateHash, weeks, weeksInSeconds, wrapNativeToken, wrapNativeTokens, years, yearsInSeconds };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as E,B as F,C as G,D as H,E as I,F as J,G as K,H as L,I as M,J as N,K as O,L as P,M as Q,N as R,O as S,P as T,Q as U,R as V,S as W,T as X,b,c,d as i,e as j,f as k,g as l,h as m,i as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y,v as z,w as A,x as B,y as C,z as D}from"../chunk-SMZ3PG6A.mjs";import{a,b as d,c as e,d as f,e as g,f as h}from"../chunk-XX77QPIR.mjs";import"../chunk-5UFI7X4U.mjs";import"../chunk-5GPS724E.mjs";export{i as CAP_LIMIT_BUFFER,n as DEFAULT_METAMASK_GAS_LIMIT,j as MAX_CUSTOM_DEADLINE,m as MAX_CUSTOM_SLIPPAGE,k as MIN_CUSTOM_DEADLINE,l as MIN_CUSTOM_SLIPPAGE,b as beraFetch,c as beraFetchJson,t as calculateTimestampFromDays,L as days,M as daysInSeconds,h as defaultBeraFlags,o as formatAggregatorsQuotes,p as formatInputTokenValue,q as formatNumber,v as formatTimeLeft,u as formatUnixTimestamp,w as formatUsd,x as getContractName,y as getHoneySwapMessage,f as getHoneyToken,D as getPythDefaultUpdateFee,r as getSafeNumber,z as getServerSidePublicClient,A as getTestClient,J as hours,K as hoursInSeconds,d as internal_beraToken,e as internal_wBeraToken,B as isDifferenceExceedingThreshold,C as isSubgraphStale,g as isToken,W as isValidatorProposer,X as isValidatorSigner,H as minutes,I as minutesInSeconds,P as months,Q as monthsInSeconds,F as msToSeconds,a as parseBaseArgs,G as seconds,E as sentryBeforeSend,s as truncateDecimal,V as truncateHash,N as weeks,O as weeksInSeconds,T as wrapNativeToken,U as wrapNativeTokens,R as years,S as yearsInSeconds};
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@berachain/berajs",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"author": "Berachain",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@apollo/client": "4.0.7",
|
|
13
|
+
"@berachain-foundation/berancer-sdk": "1.1.2",
|
|
14
|
+
"@berachain/graphql": "0.4.1-beta.2",
|
|
15
|
+
"@ensofinance/sdk": "2.0.12",
|
|
16
|
+
"@wagmi/core": "2.22.1",
|
|
17
|
+
"abitype": "1.0.8",
|
|
18
|
+
"bignumber.js": "9.3.1",
|
|
19
|
+
"gray-matter": "4.0.3",
|
|
20
|
+
"lodash": "4.17.21",
|
|
21
|
+
"swr": "2.3.3",
|
|
22
|
+
"viem": "2.41.2",
|
|
23
|
+
"@berachain/config": "0.0.5"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@pythnetwork/hermes-client": "2.0.0",
|
|
27
|
+
"@sentry/nextjs": "10.27.0",
|
|
28
|
+
"@types/node-fetch": "2.6.12",
|
|
29
|
+
"@types/react-dom": "19.1.6",
|
|
30
|
+
"@types/react": "19.1.8",
|
|
31
|
+
"tsup": "8.4.0",
|
|
32
|
+
"typescript": "5.5.4",
|
|
33
|
+
"vitest": "3.2.4",
|
|
34
|
+
"@berachain/wagmi": "0.1.0-alpha.0"
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
"./*": {
|
|
38
|
+
"types": "./dist/*/index.d.ts",
|
|
39
|
+
"import": "./dist/*/index.mjs",
|
|
40
|
+
"module": "./dist/*/index.mjs",
|
|
41
|
+
"default": "./dist/*/index.cjs"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@sentry/nextjs": "10.27.0",
|
|
46
|
+
"react": "^19.1",
|
|
47
|
+
"react-dom": "^19.1",
|
|
48
|
+
"@berachain/wagmi": "0.1.0-alpha.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup",
|
|
52
|
+
"prebuild": "pnpm contracts:update",
|
|
53
|
+
"test": "vitest",
|
|
54
|
+
"test:numbers": "vitest -- src/errors/assert.test.ts",
|
|
55
|
+
"clean": "git clean -xdf dist .turbo node_modules",
|
|
56
|
+
"check-types": "tsup --dtsOnly",
|
|
57
|
+
"precheck-types": "pnpm prebuild",
|
|
58
|
+
"dev": "tsup --watch",
|
|
59
|
+
"lint": "biome lint",
|
|
60
|
+
"lint:fix": "pnpm lint --fix",
|
|
61
|
+
"errors:update": "node .scripts/updateUnkownSignatures.js && biome format src/abi/utils --write",
|
|
62
|
+
"contracts:update": "node .scripts/getContractNames.js && biome format src/data/contracts.ts --write"
|
|
63
|
+
}
|
|
64
|
+
}
|