@berachain/berajs 0.1.0-alpha.3 → 0.1.0-alpha.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.
Files changed (44) hide show
  1. package/dist/{dex-D9U93Ib-.d.cts → HoneyConfigProvider-B7pZiyOD.d.cts} +171 -171
  2. package/dist/{dex-BD7Bq3pJ.d.ts → HoneyConfigProvider-DJ5cZbB5.d.ts} +171 -171
  3. package/dist/abi/index.cjs +1 -1
  4. package/dist/abi/index.mjs +1 -1
  5. package/dist/actions/index.cjs +1 -1
  6. package/dist/actions/index.d.cts +7 -7
  7. package/dist/actions/index.d.ts +7 -7
  8. package/dist/actions/index.mjs +1 -1
  9. package/dist/{chunk-JQDPAEK2.mjs → chunk-5N57PBAR.mjs} +2 -2
  10. package/dist/chunk-7DPUKGDT.cjs +1 -0
  11. package/dist/chunk-7LKILKNX.cjs +1 -0
  12. package/dist/{chunk-SMZ3PG6A.mjs → chunk-7SDDMT3W.mjs} +1 -1
  13. package/dist/chunk-DNBQFEY3.mjs +1 -0
  14. package/dist/chunk-H5477UEM.mjs +3 -0
  15. package/dist/chunk-HOCEXCQJ.mjs +1 -0
  16. package/dist/{chunk-ILYYJYGV.cjs → chunk-NNYEN6SA.cjs} +2 -2
  17. package/dist/{chunk-LHFVY26H.cjs → chunk-QIWSS7FQ.cjs} +2 -2
  18. package/dist/{chunk-SW47CI6T.cjs → chunk-TYTNDYXV.cjs} +1 -1
  19. package/dist/contexts/index.cjs +1 -1
  20. package/dist/contexts/index.d.cts +3 -3
  21. package/dist/contexts/index.d.ts +3 -3
  22. package/dist/contexts/index.mjs +1 -1
  23. package/dist/{getValidatorQueuedOperatorAddress-BbyH7asf.d.cts → getValidatorQueuedOperatorAddress-C2w750UQ.d.ts} +2 -2
  24. package/dist/{getValidatorQueuedOperatorAddress--AXNo9IY.d.ts → getValidatorQueuedOperatorAddress-CfiY8nIA.d.cts} +2 -2
  25. package/dist/hooks/index.cjs +2 -2
  26. package/dist/hooks/index.d.cts +6 -6
  27. package/dist/hooks/index.d.ts +6 -6
  28. package/dist/hooks/index.mjs +2 -2
  29. package/dist/{staking-DHCsSRru.d.cts → staking-CimqAVL0.d.ts} +1 -1
  30. package/dist/{staking-DYbVFigB.d.ts → staking-DbIi5eSK.d.cts} +1 -1
  31. package/dist/types/index.d.cts +4 -4
  32. package/dist/types/index.d.ts +4 -4
  33. package/dist/{useHoneySwapState-A9cyIoOS.d.cts → useHoneySwapState-BA96cjbO.d.ts} +1 -1
  34. package/dist/{useHoneySwapState-CW49RVci.d.ts → useHoneySwapState-BRU2LVkE.d.cts} +1 -1
  35. package/dist/utils/index.cjs +1 -1
  36. package/dist/utils/index.d.cts +4 -4
  37. package/dist/utils/index.d.ts +4 -4
  38. package/dist/utils/index.mjs +1 -1
  39. package/package.json +2 -2
  40. package/dist/chunk-AHAZC5K3.mjs +0 -1
  41. package/dist/chunk-KIA6GUIN.cjs +0 -1
  42. package/dist/chunk-RNESAHY2.mjs +0 -3
  43. package/dist/chunk-XX77QPIR.mjs +0 -1
  44. package/dist/chunk-YKKMWJX5.cjs +0 -1
@@ -1,9 +1,9 @@
1
- import { SwapKind } from '@berachain-foundation/berancer-sdk';
2
- import { Address, PublicClient, Hex, Abi, ContractFunctionName, ContractFunctionArgs, TransactionReceipt, WalletCallReceipt, Account } from 'viem';
3
- import { a as aggregatorsRouterAbi } from './aggregatorsRouter-Cny4B_MB.cjs';
4
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
2
  import * as react from 'react';
3
+ import { Address, PublicClient, Abi, ContractFunctionName, ContractFunctionArgs, TransactionReceipt, WalletCallReceipt, Hex, Account } from 'viem';
6
4
  import { Token as Token$1 } from '@berachain/graphql/pol/api';
5
+ import { SwapKind } from '@berachain-foundation/berancer-sdk';
6
+ import { a as aggregatorsRouterAbi } from './aggregatorsRouter-Cny4B_MB.cjs';
7
7
  import { Config, GetWalletClientReturnType } from '@wagmi/core';
8
8
  import { SWRConfiguration, SWRResponse } from 'swr';
9
9
  import { ChainId, BeraConfig } from '@berachain/config';
@@ -32,174 +32,6 @@ interface CollateralRatesArgs extends BeraJS.BaseFunctionArgs {
32
32
  */
33
33
  declare function getHoneyFees({ client, collateralList, ...args }: CollateralRatesArgs): Promise<HoneyFeeMap>;
34
34
 
35
- /**
36
- * Interface representing the latest Pyth price updates
37
- * @interface PythLatestUpdates
38
- * @property {`0x${string}`[]} calldata - Array of hex-encoded calldata for price updates
39
- * @property {string[]} prices - Array of formatted price strings
40
- */
41
- interface PythLatestUpdates {
42
- calldata: `0x${string}`[];
43
- prices: string[];
44
- }
45
- /**
46
- * Fetches the latest price updates from Pyth Network's Hermes service
47
- * @param {Object} params - The parameters object
48
- * @param {string[]} params.priceFeedId - Array of Pyth price feed IDs to fetch updates for
49
- * @returns {Promise<PythLatestUpdates>} Promise resolving to the latest price updates
50
- * @example
51
- * ```ts
52
- * const updates = await getPythLatestPrices({
53
- * priceFeedId: ["0x123...", "0x456..."]
54
- * });
55
- * ```
56
- */
57
- declare function getPythLatestPrices({ priceFeedId, }: {
58
- priceFeedId: string[];
59
- }): Promise<PythLatestUpdates>;
60
-
61
- declare enum HoneyPreviewMethod {
62
- Mint = "previewMintHoney",
63
- MintWithPrice = "previewMintHoneyWithPrices",
64
- RequiredCollateral = "previewMintCollaterals",
65
- RequiredCollateralWithPrice = "previewMintCollateralsWithPrices",
66
- Redeem = "previewRedeemCollaterals",
67
- RedeemWithPrice = "previewRedeemCollateralsWithPrices",
68
- HoneyToRedeem = "previewRedeemHoney",
69
- HoneyToRedeemWithPrice = "previewRedeemHoneyWithPrices"
70
- }
71
- interface HoneyPreviewArgs extends BeraJS.BaseFunctionArgs {
72
- client: PublicClient;
73
- collateral: Token;
74
- collateralList: TokenWithOrder[];
75
- amount: string;
76
- method: HoneyPreviewMethod;
77
- latestPrices?: PythLatestUpdates;
78
- isPythWrapperEnabled: boolean;
79
- }
80
- interface HoneyPreviewResult {
81
- collaterals: Record<Address, bigint>;
82
- honey: bigint;
83
- }
84
- interface HoneyPreviewReadResult {
85
- collaterals: bigint[];
86
- honey: bigint;
87
- }
88
- /**
89
- * Calculates preview amounts for Honey protocol operations including minting and redeeming.
90
- * This function handles different preview methods to calculate either the amount of Honey tokens
91
- * that can be minted with given collateral or the amount of collateral needed to mint/redeem Honey tokens.
92
- *
93
- * @param {Object} params - The parameters for the preview calculation
94
- * @param {PublicClient} params.client - The Viem public client for blockchain interaction
95
- * @param {Token} params.collateral - The primary collateral token being used
96
- * @param {Address[]} params.collateralList - List of all supported collateral tokens
97
- * @param {string} params.amount - The amount to calculate preview for (in token units)
98
- * @param {HoneyPreviewMethod} params.method - The type of preview calculation to perform
99
- * @param {PythLatestUpdates | undefined} params.latestPrices - Optional latest price updates from Pyth oracle
100
- *
101
- * @returns {Promise<HoneyPreviewResult | undefined>} An object containing:
102
- * - collaterals: Record mapping collateral token addresses to their respective amounts
103
- * - honey: The amount of Honey tokens involved in the operation
104
- *
105
- * @throws {Error} If there's an error during the contract interaction or calculation
106
- */
107
- declare function getHoneyPreview({ client, collateral, collateralList, amount, method, latestPrices, isPythWrapperEnabled, ...baseArgs }: HoneyPreviewArgs): Promise<HoneyPreviewResult | undefined>;
108
-
109
- declare enum HoneySwapAction {
110
- RESET_AMOUNTS = "RESET_AMOUNTS",
111
- ACTION_TYPE_CHANGE = "ACTION_TYPE_CHANGE",
112
- COLLATERALS_CHANGE = "COLLATERALS_CHANGE",
113
- FROM_AMOUNT_CHANGE = "FROM_AMOUNT_CHANGE",
114
- TO_AMOUNT_CHANGE = "TO_AMOUNT_CHANGE",
115
- PREVIEW_CHANGE = "PREVIEW_CHANGE",
116
- IS_BASKET_MODE_ENABLED_CHANGE = "IS_BASKET_MODE_ENABLED_CHANGE",
117
- IS_TYPING_CHANGE = "IS_TYPING_CHANGE",
118
- IS_SUBMITTING_CHANGE = "IS_SUBMITTING_CHANGE",
119
- IS_LOADING_CHANGE = "IS_LOADING_CHANGE"
120
- }
121
- type PythPriceFeedMap = Record<Address, Hex>;
122
- type HoneySwapActions = {
123
- type: HoneySwapAction.RESET_AMOUNTS;
124
- } | {
125
- type: HoneySwapAction.ACTION_TYPE_CHANGE;
126
- value: "mint" | "redeem";
127
- } | {
128
- type: HoneySwapAction.COLLATERALS_CHANGE;
129
- value: TokenWithOrder[];
130
- } | {
131
- type: HoneySwapAction.FROM_AMOUNT_CHANGE;
132
- index: number;
133
- value: string;
134
- } | {
135
- type: HoneySwapAction.TO_AMOUNT_CHANGE;
136
- index: number;
137
- value: string;
138
- } | {
139
- type: HoneySwapAction.PREVIEW_CHANGE;
140
- value: HoneyPreviewResult;
141
- changedAsset: Address;
142
- } | {
143
- type: HoneySwapAction.IS_BASKET_MODE_ENABLED_CHANGE;
144
- value: boolean;
145
- } | {
146
- type: HoneySwapAction.IS_TYPING_CHANGE;
147
- value: boolean;
148
- } | {
149
- type: HoneySwapAction.IS_SUBMITTING_CHANGE;
150
- value: boolean;
151
- } | {
152
- type: HoneySwapAction.IS_LOADING_CHANGE;
153
- value: boolean;
154
- };
155
-
156
- declare const HoneyConfigContext: react.Context<HoneyConfigContextReturn | undefined>;
157
- type TokenWithOrder = TokenWithMetadata & {
158
- order: number;
159
- };
160
- interface HoneyConfigContextReturn {
161
- /**
162
- * Map of the Pyth price feed ids for each collateral
163
- */
164
- priceFeedMap: PythPriceFeedMap;
165
- /**
166
- * This is the list of all the collaterals that are supported by the Honey protocol
167
- */
168
- collateralList: TokenWithOrder[];
169
- /**
170
- * This is the main collateral that is used to calculate the relative cap limit
171
- */
172
- referenceCollateral: TokenWithOrder;
173
- /**
174
- * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode
175
- */
176
- feeMap: HoneyFeeMap;
177
- flags: {
178
- /**
179
- * If true, mint/redeem will also update pyth prices
180
- */
181
- isPythWrapperEnabled: boolean;
182
- };
183
- /**
184
- * Honey protocol configs
185
- */
186
- protocol: {
187
- /**
188
- * Honey protocol paused state
189
- */
190
- isPaused: boolean;
191
- /**
192
- * The label for the Honey protocol paused message
193
- */
194
- pausedBannerLabel?: string;
195
- };
196
- }
197
- interface HoneyConfigProviderProps extends HoneyConfigContextReturn {
198
- children: React.ReactNode;
199
- }
200
- declare function HoneyConfigProvider({ children, ...props }: HoneyConfigProviderProps): react_jsx_runtime.JSX.Element;
201
- declare function useHoneyConfig(): HoneyConfigContextReturn;
202
-
203
35
  interface UseContractWriteApi {
204
36
  isLoading: boolean;
205
37
  isSubmitting: boolean;
@@ -559,4 +391,172 @@ declare enum SwapReferrer {
559
391
  ZAP = "ZAP"
560
392
  }
561
393
 
394
+ /**
395
+ * Interface representing the latest Pyth price updates
396
+ * @interface PythLatestUpdates
397
+ * @property {`0x${string}`[]} calldata - Array of hex-encoded calldata for price updates
398
+ * @property {string[]} prices - Array of formatted price strings
399
+ */
400
+ interface PythLatestUpdates {
401
+ calldata: `0x${string}`[];
402
+ prices: string[];
403
+ }
404
+ /**
405
+ * Fetches the latest price updates from Pyth Network's Hermes service
406
+ * @param {Object} params - The parameters object
407
+ * @param {string[]} params.priceFeedId - Array of Pyth price feed IDs to fetch updates for
408
+ * @returns {Promise<PythLatestUpdates>} Promise resolving to the latest price updates
409
+ * @example
410
+ * ```ts
411
+ * const updates = await getPythLatestPrices({
412
+ * priceFeedId: ["0x123...", "0x456..."]
413
+ * });
414
+ * ```
415
+ */
416
+ declare function getPythLatestPrices({ priceFeedId, }: {
417
+ priceFeedId: string[];
418
+ }): Promise<PythLatestUpdates>;
419
+
420
+ declare enum HoneyPreviewMethod {
421
+ Mint = "previewMintHoney",
422
+ MintWithPrice = "previewMintHoneyWithPrices",
423
+ RequiredCollateral = "previewMintCollaterals",
424
+ RequiredCollateralWithPrice = "previewMintCollateralsWithPrices",
425
+ Redeem = "previewRedeemCollaterals",
426
+ RedeemWithPrice = "previewRedeemCollateralsWithPrices",
427
+ HoneyToRedeem = "previewRedeemHoney",
428
+ HoneyToRedeemWithPrice = "previewRedeemHoneyWithPrices"
429
+ }
430
+ interface HoneyPreviewArgs extends BeraJS.BaseFunctionArgs {
431
+ client: PublicClient;
432
+ collateral: Token;
433
+ collateralList: TokenWithOrder[];
434
+ amount: string;
435
+ method: HoneyPreviewMethod;
436
+ latestPrices?: PythLatestUpdates;
437
+ isPythWrapperEnabled: boolean;
438
+ }
439
+ interface HoneyPreviewResult {
440
+ collaterals: Record<Address, bigint>;
441
+ honey: bigint;
442
+ }
443
+ interface HoneyPreviewReadResult {
444
+ collaterals: bigint[];
445
+ honey: bigint;
446
+ }
447
+ /**
448
+ * Calculates preview amounts for Honey protocol operations including minting and redeeming.
449
+ * This function handles different preview methods to calculate either the amount of Honey tokens
450
+ * that can be minted with given collateral or the amount of collateral needed to mint/redeem Honey tokens.
451
+ *
452
+ * @param {Object} params - The parameters for the preview calculation
453
+ * @param {PublicClient} params.client - The Viem public client for blockchain interaction
454
+ * @param {Token} params.collateral - The primary collateral token being used
455
+ * @param {Address[]} params.collateralList - List of all supported collateral tokens
456
+ * @param {string} params.amount - The amount to calculate preview for (in token units)
457
+ * @param {HoneyPreviewMethod} params.method - The type of preview calculation to perform
458
+ * @param {PythLatestUpdates | undefined} params.latestPrices - Optional latest price updates from Pyth oracle
459
+ *
460
+ * @returns {Promise<HoneyPreviewResult | undefined>} An object containing:
461
+ * - collaterals: Record mapping collateral token addresses to their respective amounts
462
+ * - honey: The amount of Honey tokens involved in the operation
463
+ *
464
+ * @throws {Error} If there's an error during the contract interaction or calculation
465
+ */
466
+ declare function getHoneyPreview({ client, collateral, collateralList, amount, method, latestPrices, isPythWrapperEnabled, ...baseArgs }: HoneyPreviewArgs): Promise<HoneyPreviewResult | undefined>;
467
+
468
+ declare enum HoneySwapAction {
469
+ RESET_AMOUNTS = "RESET_AMOUNTS",
470
+ ACTION_TYPE_CHANGE = "ACTION_TYPE_CHANGE",
471
+ COLLATERALS_CHANGE = "COLLATERALS_CHANGE",
472
+ FROM_AMOUNT_CHANGE = "FROM_AMOUNT_CHANGE",
473
+ TO_AMOUNT_CHANGE = "TO_AMOUNT_CHANGE",
474
+ PREVIEW_CHANGE = "PREVIEW_CHANGE",
475
+ IS_BASKET_MODE_ENABLED_CHANGE = "IS_BASKET_MODE_ENABLED_CHANGE",
476
+ IS_TYPING_CHANGE = "IS_TYPING_CHANGE",
477
+ IS_SUBMITTING_CHANGE = "IS_SUBMITTING_CHANGE",
478
+ IS_LOADING_CHANGE = "IS_LOADING_CHANGE"
479
+ }
480
+ type PythPriceFeedMap = Record<Address, Hex>;
481
+ type HoneySwapActions = {
482
+ type: HoneySwapAction.RESET_AMOUNTS;
483
+ } | {
484
+ type: HoneySwapAction.ACTION_TYPE_CHANGE;
485
+ value: "mint" | "redeem";
486
+ } | {
487
+ type: HoneySwapAction.COLLATERALS_CHANGE;
488
+ value: TokenWithOrder[];
489
+ } | {
490
+ type: HoneySwapAction.FROM_AMOUNT_CHANGE;
491
+ index: number;
492
+ value: string;
493
+ } | {
494
+ type: HoneySwapAction.TO_AMOUNT_CHANGE;
495
+ index: number;
496
+ value: string;
497
+ } | {
498
+ type: HoneySwapAction.PREVIEW_CHANGE;
499
+ value: HoneyPreviewResult;
500
+ changedAsset: Address;
501
+ } | {
502
+ type: HoneySwapAction.IS_BASKET_MODE_ENABLED_CHANGE;
503
+ value: boolean;
504
+ } | {
505
+ type: HoneySwapAction.IS_TYPING_CHANGE;
506
+ value: boolean;
507
+ } | {
508
+ type: HoneySwapAction.IS_SUBMITTING_CHANGE;
509
+ value: boolean;
510
+ } | {
511
+ type: HoneySwapAction.IS_LOADING_CHANGE;
512
+ value: boolean;
513
+ };
514
+
515
+ declare const HoneyConfigContext: react.Context<HoneyConfigContextReturn | undefined>;
516
+ type TokenWithOrder = TokenWithMetadata & {
517
+ order: number;
518
+ };
519
+ interface HoneyConfigContextReturn {
520
+ /**
521
+ * Map of the Pyth price feed ids for each collateral
522
+ */
523
+ priceFeedMap: PythPriceFeedMap;
524
+ /**
525
+ * This is the list of all the collaterals that are supported by the Honey protocol
526
+ */
527
+ collateralList: TokenWithOrder[];
528
+ /**
529
+ * This is the main collateral that is used to calculate the relative cap limit
530
+ */
531
+ referenceCollateral: TokenWithOrder;
532
+ /**
533
+ * An object that maps the redeem/mint rate for each collateral and the weighted rates for the basket mode
534
+ */
535
+ feeMap: HoneyFeeMap;
536
+ flags: {
537
+ /**
538
+ * If true, mint/redeem will also update pyth prices
539
+ */
540
+ isPythWrapperEnabled: boolean;
541
+ };
542
+ /**
543
+ * Honey protocol configs
544
+ */
545
+ protocol: {
546
+ /**
547
+ * Honey protocol paused state
548
+ */
549
+ isPaused: boolean;
550
+ /**
551
+ * The label for the Honey protocol paused message
552
+ */
553
+ pausedBannerLabel?: string;
554
+ };
555
+ }
556
+ interface HoneyConfigProviderProps extends HoneyConfigContextReturn {
557
+ children: React.ReactNode;
558
+ }
559
+ declare function HoneyConfigProvider({ children, ...props }: HoneyConfigProviderProps): react_jsx_runtime.JSX.Element;
560
+ declare function useHoneyConfig(): HoneyConfigContextReturn;
561
+
562
562
  export { Aggregators as A, type BalanceToken as B, type CollateralRates as C, type DefaultHookOptions as D, type DefaultHookReturnType as E, type IUserPosition as F, type BalanceTokenWithMetadata as G, type HoneySwapActions as H, type IRawAggregatorQuote as I, type TokenPriceInfo as J, type IUseContractWriteArgs as K, type TxnEventKeys as L, type MinimalERC20 as M, type SwapRequest as N, type BexStatus as O, type PythLatestUpdates as P, type IContractWriteFn as Q, ContractName as R, SwapReferrer as S, type TokenWithOrder as T, type UseContractWriteApi as U, HoneySwapAction as V, type Token as a, type TokenWithMetadata as b, HoneyConfigContext as c, type HoneyConfigContextReturn as d, type HoneyConfigProviderProps as e, HoneyConfigProvider as f, type IAggregatorQuote as g, type TokenBalance as h, type IAggregatorArgs as i, type PythPriceFeedMap as j, type TokenCurrentPriceMap as k, type AllowanceToken as l, type IContractWrite as m, type HoneyFeeMap as n, type CollateralRatesArgs as o, getHoneyFees as p, HoneyPreviewMethod as q, type HoneyPreviewArgs as r, type HoneyPreviewResult as s, type HoneyPreviewReadResult as t, useHoneyConfig as u, getHoneyPreview as v, getPythLatestPrices as w, type TokenInput as x, PoolCreationStep as y, type TokenWithAmount as z };