@berachain/berajs 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (67) hide show
  1. package/README.md +8 -0
  2. package/dist/{BeraError-CfcNTfpH.d.ts → BeraError-D1HS_rbb.d.cts} +3 -3
  3. package/dist/BeraError-D1HS_rbb.d.ts +69 -0
  4. package/dist/BexStatusProvider-nS3NcdxI.d.cts +70 -0
  5. package/dist/RequestError-D8AE6xnI.d.cts +57 -0
  6. package/dist/{RequestError-CtJLUaAc.d.ts → RequestError-m4jxyM7D.d.ts} +1 -1
  7. package/dist/abi/index.cjs +1 -0
  8. package/dist/abi/index.d.cts +26765 -0
  9. package/dist/actions/index.cjs +1 -0
  10. package/dist/actions/index.d.cts +1650 -0
  11. package/dist/actions/index.d.ts +10 -9
  12. package/dist/actions/index.mjs +1 -1
  13. package/dist/aggregatorsRouter-Cny4B_MB.d.cts +593 -0
  14. package/dist/{chunk-YKNKCICU.mjs → chunk-2422CKAT.mjs} +1 -1
  15. package/dist/{chunk-JQDPAEK2.mjs → chunk-3V2MGZRD.mjs} +1 -1
  16. package/dist/chunk-4E5JGLUM.cjs +1 -0
  17. package/dist/chunk-4GY57XKG.cjs +1 -0
  18. package/dist/{chunk-5GPS724E.mjs → chunk-ASRHUDAH.mjs} +1 -1
  19. package/dist/chunk-B47PDJZM.cjs +1 -0
  20. package/dist/{chunk-SMZ3PG6A.mjs → chunk-ELUMRVNE.mjs} +1 -1
  21. package/dist/chunk-IKAE7CQU.cjs +1 -0
  22. package/dist/{chunk-XX77QPIR.mjs → chunk-JHCSZSJS.mjs} +1 -1
  23. package/dist/chunk-K2FCHQHA.cjs +1 -0
  24. package/dist/chunk-KIA6GUIN.cjs +1 -0
  25. package/dist/chunk-LX5CM4Y6.cjs +1 -0
  26. package/dist/chunk-LZPBQLKP.mjs +3 -0
  27. package/dist/chunk-M5BKM52U.cjs +1 -0
  28. package/dist/chunk-NOV7UCGA.cjs +1 -0
  29. package/dist/{chunk-5UFI7X4U.mjs → chunk-VA37UBED.mjs} +1 -1
  30. package/dist/chunk-WDFIETJS.cjs +2 -0
  31. package/dist/chunk-WZLPSG5R.cjs +3 -0
  32. package/dist/contexts/index.cjs +1 -0
  33. package/dist/contexts/index.d.cts +81 -0
  34. package/dist/contexts/index.d.ts +4 -4
  35. package/dist/contexts/index.mjs +1 -1
  36. package/dist/defaultFlags-V-tJs2K8.d.cts +10 -0
  37. package/dist/{dex-BD7Bq3pJ.d.ts → dex-CxzGqVLe.d.ts} +1 -1
  38. package/dist/{dex-DreiokgL.d.ts → dex-jD95agMv.d.cts} +3 -3
  39. package/dist/enum/index.cjs +1 -0
  40. package/dist/enum/index.d.cts +31 -0
  41. package/dist/enum/index.d.ts +1 -1
  42. package/dist/errors/index.cjs +1 -0
  43. package/dist/errors/index.d.cts +204 -0
  44. package/dist/errors/index.d.ts +3 -3
  45. package/dist/errors/index.mjs +1 -1
  46. package/dist/{getValidatorQueuedOperatorAddress-DK2Xv19c.d.ts → getValidatorQueuedOperatorAddress-9jSXlAse.d.ts} +2 -2
  47. package/dist/{getValidatorQueuedOperatorAddress--AXNo9IY.d.ts → getValidatorQueuedOperatorAddress-BCYlvah3.d.cts} +2 -2
  48. package/dist/hooks/index.cjs +3 -0
  49. package/dist/hooks/index.d.cts +1703 -0
  50. package/dist/hooks/index.d.ts +8 -8
  51. package/dist/hooks/index.mjs +2 -2
  52. package/dist/polling-BKnyavLI.d.cts +8 -0
  53. package/dist/pythWrapper-CBjsmmsK.d.cts +1958 -0
  54. package/dist/{staking-Cggi38So.d.ts → staking-Bw46L2PT.d.ts} +1 -1
  55. package/dist/{staking-DYbVFigB.d.ts → staking-BxYDlMtj.d.cts} +1 -1
  56. package/dist/{txnEnum-BQKDfaeH.d.ts → txnEnum-Diichv9Z.d.cts} +0 -1
  57. package/dist/types/index.cjs +1 -0
  58. package/dist/types/index.d.cts +56 -0
  59. package/dist/types/index.d.ts +4 -4
  60. package/dist/{useHoneySwapState-CW49RVci.d.ts → useHoneySwapState-CD8v6y1k.d.ts} +1 -1
  61. package/dist/{useHoneySwapState-Ci8_c2bT.d.ts → useHoneySwapState-YfMSTWY3.d.cts} +1 -1
  62. package/dist/utils/index.cjs +1 -0
  63. package/dist/utils/index.d.cts +349 -0
  64. package/dist/utils/index.d.ts +5 -5
  65. package/dist/utils/index.mjs +1 -1
  66. package/package.json +20 -8
  67. package/dist/chunk-RNESAHY2.mjs +0 -3
package/README.md CHANGED
@@ -5,6 +5,14 @@ provides a suite of React Hooks using [swr](https://swr.vercel.app/) and a suite
5
5
 
6
6
  Berajs is documented [here]("")
7
7
 
8
+ ## Installation
9
+
10
+ ```
11
+ pnpm install @berachain/berajs
12
+ ```
13
+
14
+ If you want to use hooks, you're also going to need to have `wagmi` installed as well.
15
+
8
16
 
9
17
  ## Commands
10
18
 
@@ -1,4 +1,4 @@
1
- import { SeverityLevel } from '@sentry/nextjs';
1
+ import * as SentryType from '@sentry/nextjs';
2
2
  import { Abi } from 'viem';
3
3
 
4
4
  interface IBeraErrorArgs {
@@ -10,7 +10,7 @@ interface IBeraErrorArgs {
10
10
  /**
11
11
  * The level of the error to be used for Sentry.
12
12
  */
13
- level?: SeverityLevel;
13
+ level?: SentryType.SeverityLevel;
14
14
  tags?: {
15
15
  [key in TagsKey]?: Primitive;
16
16
  };
@@ -61,7 +61,7 @@ declare class BeraError extends Error {
61
61
  get tags(): {
62
62
  [key: string | TagsKey]: Primitive;
63
63
  };
64
- level: SeverityLevel;
64
+ level: SentryType.SeverityLevel;
65
65
  extra: Record<string, unknown>;
66
66
  constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, }: IBeraErrorArgs);
67
67
  }
@@ -0,0 +1,69 @@
1
+ import * as SentryType from '@sentry/nextjs';
2
+ import { Abi } from 'viem';
3
+
4
+ interface IBeraErrorArgs {
5
+ message?: string;
6
+ displayMessage?: string;
7
+ cause?: unknown;
8
+ reason?: string;
9
+ chainId?: number;
10
+ /**
11
+ * The level of the error to be used for Sentry.
12
+ */
13
+ level?: SentryType.SeverityLevel;
14
+ tags?: {
15
+ [key in TagsKey]?: Primitive;
16
+ };
17
+ extra?: Record<string, unknown>;
18
+ /**
19
+ * Optional ABI to be used to parse the error.
20
+ */
21
+ abi?: Abi;
22
+ }
23
+ /**
24
+ * Copy pasted from sentry types
25
+ */
26
+ type Primitive = number | string | boolean | bigint | symbol | null | undefined;
27
+ /**
28
+ * An helper type to make sure we only use the allowed tags. Sync this with docs/errors.md
29
+ */
30
+ type TagsKey = "wallet.chain" | "wallet.connector" | "wallet.address" | "error.reason" | "operation.type" | "operation.key" | "operation.txn.functionName" | "operation.txn.to" | "operation.txn.status" | "operation.source.url" | "operation.source.name" | "operation.source.queryName" | "operation.source.type";
31
+ /**
32
+ * This is a generic error class that can be used to handle errors in the SDK.
33
+ */
34
+ declare class BeraError extends Error {
35
+ /**
36
+ * A human-readable message that can be displayed to end user.
37
+ *
38
+ * In berachain dapps, this is shown in the error pop-up.
39
+ */
40
+ displayMessage: string;
41
+ /**
42
+ * The cause of the error.
43
+ *
44
+ * This is typically the error that was thrown.
45
+ */
46
+ cause: unknown;
47
+ /**
48
+ * The chain id of the error.
49
+ */
50
+ chainId?: number;
51
+ /**
52
+ * The code for the reason for the error.
53
+ *
54
+ * This is typically the error code can be found in the errorMap.ts file. I.e. NotEnoughBalance or BAL#508
55
+ */
56
+ reason: string | null;
57
+ private _tags;
58
+ set tags(tags: {
59
+ [key: string | TagsKey]: Primitive;
60
+ });
61
+ get tags(): {
62
+ [key: string | TagsKey]: Primitive;
63
+ };
64
+ level: SentryType.SeverityLevel;
65
+ extra: Record<string, unknown>;
66
+ constructor({ message: m, displayMessage: dm, cause, reason, level, abi, tags, chainId, }: IBeraErrorArgs);
67
+ }
68
+
69
+ export { BeraError as B, type IBeraErrorArgs as I };
@@ -0,0 +1,70 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { Dispatch, SetStateAction, PropsWithChildren } from 'react';
4
+ import { Hex } from 'viem';
5
+ import { EdgeConfigSchema } from '@berachain/config/internal/edge-config';
6
+
7
+ type FactoryStatus = {
8
+ /**
9
+ * If the composable stable factory is enabled
10
+ */
11
+ composableStable: "paused" | "enabled";
12
+ /**
13
+ * If the weighted factory is enabled
14
+ */
15
+ weighted: "paused" | "enabled";
16
+ };
17
+ interface BexStatusProviderProps {
18
+ isVaultPaused: boolean;
19
+ pool?: {
20
+ id: Hex;
21
+ isInRecoveryMode: boolean;
22
+ isPaused: boolean;
23
+ };
24
+ factories: FactoryStatus;
25
+ labels?: NonNullable<EdgeConfigSchema["bex"]>["emergencyLabels"];
26
+ }
27
+ declare const BexStateContext: react.Context<{
28
+ protocol: {
29
+ isPaused: boolean;
30
+ factories: FactoryStatus & {
31
+ allPaused: boolean;
32
+ };
33
+ };
34
+ onPoolChange: Dispatch<SetStateAction<BexStatusProviderProps["pool"]>>;
35
+ pool?: {
36
+ id: Hex;
37
+ isInRecoveryMode: boolean;
38
+ isPaused: boolean;
39
+ disablePoolWithdrawals: boolean;
40
+ disablePoolDeposits: boolean;
41
+ };
42
+ labels?: NonNullable<EdgeConfigSchema["bex"]>["emergencyLabels"];
43
+ }>;
44
+ /**
45
+ * @description Determines the status of a pool or vault and returns the appropriate messages and flags to disable functionality.
46
+ * More information here https://www.notion.so/berachain/BEX-RecoveryMode-and-Pause-explained-17c6120abced80e0985dd589b57ff018
47
+ *
48
+ * @returns status flags to enable/disable/notify users across the BEX
49
+ *
50
+ **/
51
+ declare function useBexStatus(): {
52
+ protocol: {
53
+ isPaused: boolean;
54
+ factories: FactoryStatus & {
55
+ allPaused: boolean;
56
+ };
57
+ };
58
+ onPoolChange: Dispatch<SetStateAction<BexStatusProviderProps["pool"]>>;
59
+ pool?: {
60
+ id: Hex;
61
+ isInRecoveryMode: boolean;
62
+ isPaused: boolean;
63
+ disablePoolWithdrawals: boolean;
64
+ disablePoolDeposits: boolean;
65
+ };
66
+ labels?: NonNullable<EdgeConfigSchema["bex"]>["emergencyLabels"];
67
+ };
68
+ declare function BexStatusProvider({ children, isVaultPaused, labels, factories, }: PropsWithChildren<BexStatusProviderProps>): react_jsx_runtime.JSX.Element;
69
+
70
+ export { type BexStatusProviderProps as B, BexStateContext as a, BexStatusProvider as b, useBexStatus as u };
@@ -0,0 +1,57 @@
1
+ import { ErrorLike } from '@apollo/client';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-D1HS_rbb.cjs';
3
+
4
+ /**
5
+ * This is an error class that should be used to handle errors from fetch requests.
6
+ */
7
+ declare class RequestError extends BeraError {
8
+ /**
9
+ * The error response from the request.
10
+ */
11
+ response: Response | ErrorLike | undefined;
12
+ static isCorsError(error: Error): boolean;
13
+ /**
14
+ * The endpoint that was requested.
15
+ */
16
+ endpoint: {
17
+ name?: string;
18
+ url: string;
19
+ type?: "rest" | "graphql" | "rpc";
20
+ };
21
+ /**
22
+ * A list of domains that should have their query params removed.
23
+ */
24
+ private queryRichfulDomains;
25
+ statusCode: number | undefined;
26
+ payload?: object;
27
+ static readonly REASON_MAP: {
28
+ readonly 429: "RATE_LIMITED_429";
29
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
30
+ readonly CORS_ERROR: "CORS";
31
+ };
32
+ constructor(args: IBeraErrorArgs & {
33
+ response: Response | ErrorLike | undefined;
34
+ /**
35
+ * The payload sent to the request.
36
+ */
37
+ payload?: object;
38
+ endpoint: string | URL | {
39
+ name?: string;
40
+ url: string | URL;
41
+ type: "rest" | "graphql" | "rpc";
42
+ };
43
+ statusCode?: number;
44
+ });
45
+ setEndpoint(endpoint: string | URL | {
46
+ name?: string;
47
+ url: string | URL;
48
+ type?: "rest" | "graphql" | "rpc";
49
+ }): {
50
+ name?: string;
51
+ url: string;
52
+ type?: "rest" | "graphql" | "rpc";
53
+ };
54
+ private tryMatchNetworkError;
55
+ }
56
+
57
+ export { RequestError as R };
@@ -1,5 +1,5 @@
1
1
  import { ErrorLike } from '@apollo/client';
2
- import { B as BeraError, I as IBeraErrorArgs } from './BeraError-CfcNTfpH.js';
2
+ import { B as BeraError, I as IBeraErrorArgs } from './BeraError-D1HS_rbb.js';
3
3
 
4
4
  /**
5
5
  * This is an error class that should be used to handle errors from fetch requests.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIKAE7CQUcjs = require('../chunk-IKAE7CQU.cjs');var _chunkKIA6GUINcjs = require('../chunk-KIA6GUIN.cjs');exports.EIP7702StatelessDelegatorAbi = _chunkIKAE7CQUcjs.p; exports.aggregatorsRouterAbi = _chunkIKAE7CQUcjs.f; exports.balancerComposableStablePoolFactoryV6 = _chunkIKAE7CQUcjs.g; exports.balancerPoolCreationHelperAbi = _chunkIKAE7CQUcjs.h; exports.balancerVaultAbi = _chunkKIA6GUINcjs.b; exports.beaconDepositAbi = _chunkKIA6GUINcjs.k; exports.beraChefAbi = _chunkKIA6GUINcjs.l; exports.bgtAbi = _chunkKIA6GUINcjs.m; exports.bgtIncentiveDistributorAbi = _chunkIKAE7CQUcjs.j; exports.bgtStakerAbi = _chunkIKAE7CQUcjs.k; exports.bundlerAbi = _chunkIKAE7CQUcjs.a; exports.collateralVaultAbi = _chunkKIA6GUINcjs.d; exports.generalAdapterAbi = _chunkIKAE7CQUcjs.b; exports.governanceAbi = _chunkKIA6GUINcjs.c; exports.governanceTimelockAbi = _chunkIKAE7CQUcjs.i; exports.honeyAbi = _chunkKIA6GUINcjs.e; exports.honeyFactoryAbi = _chunkKIA6GUINcjs.f; exports.honeyFactoryReaderAbi = _chunkKIA6GUINcjs.g; exports.honeyRootOracleAbi = _chunkKIA6GUINcjs.h; exports.merkleDistributorAbi = _chunkIKAE7CQUcjs.q; exports.metaMorphoAbi = _chunkKIA6GUINcjs.a; exports.morphoAbi = _chunkIKAE7CQUcjs.c; exports.morphoVaultAbi = _chunkIKAE7CQUcjs.d; exports.multicall3Abi = _chunkKIA6GUINcjs.r; exports.publicAllocatorAbi = _chunkIKAE7CQUcjs.e; exports.pythAbi = _chunkKIA6GUINcjs.q; exports.pythErrorsAbi = _chunkIKAE7CQUcjs.o; exports.pythPriceOracleAbi = _chunkKIA6GUINcjs.i; exports.pythWrapperAbi = _chunkKIA6GUINcjs.j; exports.rewardVaultAbi = _chunkKIA6GUINcjs.n; exports.rewardVaultFactoryAbi = _chunkKIA6GUINcjs.o; exports.rewardVaultHelperAbi = _chunkIKAE7CQUcjs.l; exports.stakeBeraVaultAbi = _chunkKIA6GUINcjs.p; exports.stakeBeraVaultWithdrawalRequestAbi = _chunkIKAE7CQUcjs.m; exports.wberaAbi = _chunkIKAE7CQUcjs.n;