@levrbet/shared 0.1.2 → 0.1.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 (80) hide show
  1. package/README.md +94 -75
  2. package/dist/server/index.d.ts +2 -2
  3. package/dist/server/index.js +2 -2
  4. package/dist/server/index.js.map +1 -1
  5. package/dist/server/oracle/prisma/generated/client/edge.js +6 -6
  6. package/dist/server/oracle/prisma/generated/client/index-browser.js +0 -1
  7. package/dist/server/oracle/prisma/generated/client/index.d.ts +204 -513
  8. package/dist/server/oracle/prisma/generated/client/index.js +6 -6
  9. package/dist/server/oracle/prisma/generated/client/package.json +1 -1
  10. package/dist/server/oracle/prisma/generated/client/schema.prisma +6 -12
  11. package/dist/server/oracle/prisma/generated/client/wasm.js +6 -6
  12. package/dist/server/oracle/types/game/game.types.d.ts +1 -0
  13. package/dist/server/oracle/types/game/game.types.js.map +1 -1
  14. package/package.json +32 -3
  15. package/dist/core/contracts/dist/config/index.d.ts +0 -1
  16. package/dist/core/contracts/dist/config/index.js +0 -22
  17. package/dist/core/contracts/dist/config/index.js.map +0 -1
  18. package/dist/core/contracts/dist/config/urls.d.ts +0 -55
  19. package/dist/core/contracts/dist/config/urls.js +0 -48
  20. package/dist/core/contracts/dist/config/urls.js.map +0 -1
  21. package/dist/core/contracts/dist/contracts/abis/LevrBaseMarket.d.ts +0 -61
  22. package/dist/core/contracts/dist/contracts/abis/LevrBaseMarket.js +0 -1149
  23. package/dist/core/contracts/dist/contracts/abis/LevrBaseMarket.js.map +0 -1
  24. package/dist/core/contracts/dist/contracts/abis/LevrConfigProvider.d.ts +0 -52
  25. package/dist/core/contracts/dist/contracts/abis/LevrConfigProvider.js +0 -2551
  26. package/dist/core/contracts/dist/contracts/abis/LevrConfigProvider.js.map +0 -1
  27. package/dist/core/contracts/dist/contracts/abis/LevrManager.d.ts +0 -72
  28. package/dist/core/contracts/dist/contracts/abis/LevrManager.js +0 -1043
  29. package/dist/core/contracts/dist/contracts/abis/LevrManager.js.map +0 -1
  30. package/dist/core/contracts/dist/contracts/abis/LevrMarketFeed.d.ts +0 -72
  31. package/dist/core/contracts/dist/contracts/abis/LevrMarketFeed.js +0 -572
  32. package/dist/core/contracts/dist/contracts/abis/LevrMarketFeed.js.map +0 -1
  33. package/dist/core/contracts/dist/contracts/abis/LevrOrderbook.d.ts +0 -85
  34. package/dist/core/contracts/dist/contracts/abis/LevrOrderbook.js +0 -486
  35. package/dist/core/contracts/dist/contracts/abis/LevrOrderbook.js.map +0 -1
  36. package/dist/core/contracts/dist/contracts/abis/Storage.d.ts +0 -33
  37. package/dist/core/contracts/dist/contracts/abis/Storage.js +0 -47
  38. package/dist/core/contracts/dist/contracts/abis/Storage.js.map +0 -1
  39. package/dist/core/contracts/dist/contracts/abis/index.d.ts +0 -8
  40. package/dist/core/contracts/dist/contracts/abis/index.js +0 -21
  41. package/dist/core/contracts/dist/contracts/abis/index.js.map +0 -1
  42. package/dist/core/contracts/dist/contracts/addresses.d.ts +0 -89
  43. package/dist/core/contracts/dist/contracts/addresses.js +0 -90
  44. package/dist/core/contracts/dist/contracts/addresses.js.map +0 -1
  45. package/dist/core/contracts/dist/contracts/chains.d.ts +0 -111
  46. package/dist/core/contracts/dist/contracts/chains.js +0 -13
  47. package/dist/core/contracts/dist/contracts/chains.js.map +0 -1
  48. package/dist/core/contracts/dist/contracts/clients/index.d.ts +0 -1
  49. package/dist/core/contracts/dist/contracts/clients/index.js +0 -22
  50. package/dist/core/contracts/dist/contracts/clients/index.js.map +0 -1
  51. package/dist/core/contracts/dist/contracts/clients/publicClients.d.ts +0 -2
  52. package/dist/core/contracts/dist/contracts/clients/publicClients.js +0 -18
  53. package/dist/core/contracts/dist/contracts/clients/publicClients.js.map +0 -1
  54. package/dist/core/contracts/dist/contracts/constants.d.ts +0 -6
  55. package/dist/core/contracts/dist/contracts/constants.js +0 -25
  56. package/dist/core/contracts/dist/contracts/constants.js.map +0 -1
  57. package/dist/core/contracts/dist/contracts/index.d.ts +0 -1
  58. package/dist/core/contracts/dist/contracts/index.js +0 -27
  59. package/dist/core/contracts/dist/contracts/index.js.map +0 -1
  60. package/dist/core/contracts/dist/contracts/instances.d.ts +0 -3
  61. package/dist/core/contracts/dist/contracts/instances.js +0 -54
  62. package/dist/core/contracts/dist/contracts/instances.js.map +0 -1
  63. package/dist/core/contracts/dist/index.d.ts +0 -1
  64. package/dist/core/contracts/dist/index.js +0 -24
  65. package/dist/core/contracts/dist/index.js.map +0 -1
  66. package/dist/core/contracts/dist/types/blockchain/chains.types.d.ts +0 -2
  67. package/dist/core/contracts/dist/types/blockchain/chains.types.js +0 -10
  68. package/dist/core/contracts/dist/types/blockchain/chains.types.js.map +0 -1
  69. package/dist/core/contracts/dist/types/blockchain/index.d.ts +0 -1
  70. package/dist/core/contracts/dist/types/blockchain/index.js +0 -23
  71. package/dist/core/contracts/dist/types/blockchain/index.js.map +0 -1
  72. package/dist/core/contracts/dist/types/blockchain/oz.relayer.types.d.ts +0 -2
  73. package/dist/core/contracts/dist/types/blockchain/oz.relayer.types.js +0 -8
  74. package/dist/core/contracts/dist/types/blockchain/oz.relayer.types.js.map +0 -1
  75. package/dist/core/contracts/dist/types/index.d.ts +0 -1
  76. package/dist/core/contracts/dist/types/index.js +0 -23
  77. package/dist/core/contracts/dist/types/index.js.map +0 -1
  78. package/dist/core/contracts/dist/types/misc.types.d.ts +0 -2
  79. package/dist/core/contracts/dist/types/misc.types.js +0 -11
  80. package/dist/core/contracts/dist/types/misc.types.js.map +0 -1
package/README.md CHANGED
@@ -1,114 +1,133 @@
1
- # levr-shared
1
+ # @levrbet/shared
2
2
 
3
- Contains shared packages, libraries and utilities for Levr's microservices. This code is meant to be reused by other applications, so ensure strict compliance with TypeScript standards.
3
+ Shared utilities, components, and types for the LEVR platform. This package provides core blockchain utilities, server-side tools, and React components in a single, well-organized library.
4
4
 
5
- ## Packages
5
+ ## 🚀 Quick Start
6
6
 
7
- There are two main packages available:
7
+ ### For React Applications
8
8
 
9
- - **@levrbet/shared-core**: Contains core utilities and code that can be used in any JavaScript/TypeScript environment, including browsers and server-side applications.
10
- - **@levrbet/shared-server**: Contains server-specific utilities and code intended for Node.js runtime environments.
9
+ ```bash
10
+ npm install @levrbet/shared react
11
+ ```
11
12
 
12
- ## Setup
13
+ ```typescript
14
+ import { e18, LevrBaseMarket } from "@levrbet/shared/core"
15
+ import { /* React components */ } from "@levrbet/shared/react"
16
+ ```
13
17
 
14
- Install new dependencies appropriately. Dev dependencies should be installed as such (`yarn add -D prettier`). The recommended package manager is yarn.
18
+ ### For Node.js/Server Applications
15
19
 
16
- 1. Install existing dependencies with `yarn install`.
20
+ ```bash
21
+ npm install @levrbet/shared
22
+ ```
17
23
 
18
- ## 📦 Installation
24
+ ```typescript
25
+ import { e18, LevrBaseMarket } from "@levrbet/shared/core"
26
+ import { authMiddleWare, validateApiKey } from "@levrbet/shared/server"
27
+ ```
19
28
 
20
- To install a package in your project, use one of the following commands:
29
+ ## 📦 Package Structure
21
30
 
22
- **Using npm:**
31
+ ### Core (`@levrbet/shared/core`)
23
32
 
24
- ```bash
25
- npm install @levrbet/shared-core
26
- npm install @levrbet/shared-server
27
- ```
33
+ **Universal utilities** - Works in both browser and server environments.
34
+
35
+ - Blockchain contracts and ABIs
36
+ - Type definitions
37
+ - Utility functions
38
+ - Validation helpers
39
+
40
+ **Minimal dependencies:** Only essential packages like `viem`, `zod`, `ms`
41
+
42
+ ### React (`@levrbet/shared/react`)
43
+
44
+ **React-specific utilities** - For React applications only.
45
+
46
+ - React components
47
+ - Custom hooks
48
+ - Context providers
49
+
50
+ **Requires:** `react >=18`
51
+
52
+ ### Server (`@levrbet/shared/server`)
28
53
 
29
- **Using yarn:**
54
+ **Server-only utilities** - For Node.js/server environments only.
55
+
56
+ - Authentication middleware
57
+ - Database utilities (Prisma)
58
+ - Redis caching
59
+ - Logging and observability
60
+ - Express middleware
61
+
62
+ **Dependencies included:** All server dependencies are bundled - no manual installation needed!
63
+
64
+ ## 🔧 Advanced Installation
65
+
66
+ ### Core Only (no server/React features)
67
+
68
+ For applications that only need blockchain utilities and types:
30
69
 
31
70
  ```bash
32
- yarn add @levrbet/shared-core
33
- yarn add @levrbet/shared-server
71
+ npm install @levrbet/shared
72
+ # Only core dependencies will be installed
34
73
  ```
35
74
 
36
- This will add the selected package to your `package.json` and install it in your `node_modules`.
75
+ ## 💡 Why This Approach?
37
76
 
38
- ## 📦 Usage
77
+ This package bundles server dependencies for the best developer experience:
39
78
 
40
- To use a package in your project, import it as follows:
79
+ - **React apps** - Only install React as peer dependency
80
+ - ✅ **Server apps** - Single `npm install` gets everything
81
+ - ✅ **No dependency hell** - All server dependencies work together
82
+ - ✅ **Version compatibility** - Pre-tested dependency combinations
41
83
 
42
- **For core utilities (browser or server):**
84
+ ### Bundle Size Considerations
43
85
 
44
- ```typescript
45
- import { someFunction } from "@levrbet/shared-core"
46
- ```
86
+ - **React apps**: Only get core utilities (~lightweight)
87
+ - **Server apps**: Get full functionality with managed dependencies
88
+ - **Tree-shaking**: Unused modules are eliminated in your final bundle
47
89
 
48
- **For server-specific utilities (Node.js):**
90
+ ## 🏗️ Development Setup
49
91
 
50
- ```typescript
51
- import { serverFunction } from "@levrbet/shared-server"
52
- ```
92
+ 1. **Install dependencies:**
53
93
 
54
- ## Setting up pre-commit hooks
94
+ ```bash
95
+ bun install
96
+ ```
55
97
 
56
- 1. **Install Python (if not already installed)**
57
- - Download and install Python 3.11+ from [python.org/downloads](https://www.python.org/downloads/).
58
- - Make sure to check **"Add Python to PATH"** during installation on Windows.
98
+ 2. **Build the package:**
59
99
 
60
- 2. **Create a virtual environment using VS Code (recommended)**
61
- - Open the project folder in VS Code.
62
- - Open the Command Palette (**Ctrl + Shift + P** or **Cmd + Shift + P** on macOS).
63
- - Search for **"Python: Create Environment"** → select **Venv** → select **Python 3.x** → choose **requirements.txt** (if present) or skip package selection.
64
- - VS Code will automatically create and activate a `.venv` folder for this project.
100
+ ```bash
101
+ bun run build
102
+ ```
65
103
 
66
- 3. **Install pre-commit in the virtual environment**
67
- - Open a terminal inside VS Code (it should show `.venv` active).
68
- - Run:
104
+ 3. **Clean build artifacts:**
69
105
 
70
- ```bash
71
- pip install -r requirements.txt
72
- ```
106
+ ```bash
107
+ bun run clean
108
+ ```
73
109
 
74
- 4. **Verify the hook installation**
75
- - Run:
110
+ ## 🔒 Pre-commit Hooks Setup
76
111
 
77
- ```bash
78
- pre-commit run --all-files
79
- ```
112
+ 1. **Install Python 3.11+** from [python.org/downloads](https://www.python.org/downloads/)
80
113
 
81
- - This will check your entire codebase with the configured hooks. If everything works, you’re ready to commit safely!
114
+ 2. **Create virtual environment in VS Code:**
115
+ - Open Command Palette (**Ctrl + Shift + P**)
116
+ - Select **"Python: Create Environment"** → **Venv** → **Python 3.x**
117
+ - Choose **requirements.txt** if prompted
82
118
 
83
- 5. **Managing .secrets.baseline**
84
- We use [detect-secrets](https://github.com/Yelp/detect-secrets) to prevent committing API keys, tokens, or other sensitive data.
85
- What is `.secrets.baseline`?
86
- It's a snapshot of potential secrets already present in the repository.
87
- Pre-commit will not fail on these existing entries but will block any new secrets.
88
- This file must be kept under version control so the whole team uses the same baseline.
89
- When do you need to generate or update it?
90
- If the repo already contains .secrets.baseline:
91
- Just pull it. Pre-commit will automatically use it. No extra work needed.
92
- If setting up from scratch (first time only):
119
+ 3. **Install pre-commit:**
93
120
 
94
121
  ```bash
95
- detect-secrets scan > .secrets.baseline
96
- detect-secrets audit .secrets.baseline
97
- git add .secrets.baseline
98
- git commit -m "chore(security): add detect-secrets baseline"
122
+ pip install -r requirements.txt
99
123
  ```
100
124
 
101
- To update when code changes significantly:
125
+ 4. **Verify setup:**
102
126
 
103
127
  ```bash
104
- detect-secrets scan --baseline .secrets.baseline
105
- detect-secrets audit .secrets.baseline
106
- git add .secrets.baseline
107
- git commit -m "chore(security): update detect-secrets baseline"
128
+ pre-commit run --all-files
108
129
  ```
109
130
 
110
- 6. **Team rules for .secrets.baseline**
111
- - Never delete it — it's required to keep secret scanning consistent.
112
- - Do not mark real secrets as safe — rotate/remove secrets instead.
113
- - Review all baseline changes in PRs — treat them like code.
114
- - Pre-commit will block new secrets automatically — fix or rotate them before committing.
131
+ ## 📝 License
132
+
133
+ This project is proprietary to LEVR Labs.
@@ -1,8 +1,8 @@
1
+ export * from "../core";
1
2
  export * from "./auth";
2
3
  export * from "./config";
3
4
  export * from "./contracts";
5
+ export * from "./liquidation-engine";
4
6
  export * from "./logging";
5
7
  export * from "./oracle";
6
- export * from "./liquidation-engine";
7
8
  export * from "./utils";
8
- export * from "../core";
@@ -14,14 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../core"), exports);
17
18
  __exportStar(require("./auth"), exports);
18
19
  __exportStar(require("./config"), exports);
19
20
  __exportStar(require("./contracts"), exports);
21
+ __exportStar(require("./liquidation-engine"), exports);
20
22
  __exportStar(require("./logging"), exports);
21
23
  __exportStar(require("./oracle"), exports);
22
- __exportStar(require("./liquidation-engine"), exports);
23
24
  __exportStar(require("./utils"), exports);
24
- __exportStar(require("../core"), exports);
25
25
  // export { sdk } from "./instrumentation"
26
26
  // export { sdk as instrumentation } from "./instrumentation"
27
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,4CAAyB;AACzB,2CAAwB;AACxB,uDAAoC;AACpC,0CAAuB;AACvB,0CAAuB;AAEvB,0CAA0C;AAC1C,6DAA6D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,uDAAoC;AACpC,4CAAyB;AACzB,2CAAwB;AACxB,0CAAuB;AAEvB,0CAA0C;AAC1C,6DAA6D"}