@levrbet/shared 0.1.2 → 0.1.3

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 (2) hide show
  1. package/README.md +76 -31
  2. package/package.json +84 -3
package/README.md CHANGED
@@ -1,56 +1,101 @@
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
+ ```
12
+
13
+ ```typescript
14
+ import { e18, LevrBaseMarket } from "@levrbet/shared/core"
15
+ import { /* React components */ } from "@levrbet/shared/react"
16
+ ```
11
17
 
12
- ## Setup
18
+ ### For Node.js/Server Applications
13
19
 
14
- Install new dependencies appropriately. Dev dependencies should be installed as such (`yarn add -D prettier`). The recommended package manager is yarn.
20
+ ```bash
21
+ npm install @levrbet/shared \
22
+ @privy-io/server-auth @aws-sdk/client-kms @prisma/client \
23
+ ioredis redis axios express winston jose bson \
24
+ @opentelemetry/auto-instrumentations-node @opentelemetry/exporter-metrics-otlp-http \
25
+ @opentelemetry/exporter-trace-otlp-http @opentelemetry/resources @opentelemetry/sdk-metrics \
26
+ @opentelemetry/sdk-node @opentelemetry/api coralogix-logger
27
+
28
+ npm install -D @types/express
29
+ ```
15
30
 
16
- 1. Install existing dependencies with `yarn install`.
31
+ ```typescript
32
+ import { e18, LevrBaseMarket } from "@levrbet/shared/core"
33
+ import { authMiddleWare, validateApiKey } from "@levrbet/shared/server"
34
+ ```
17
35
 
18
- ## 📦 Installation
36
+ ## 📦 Package Structure
19
37
 
20
- To install a package in your project, use one of the following commands:
38
+ ### Core (`@levrbet/shared/core`)
21
39
 
22
- **Using npm:**
40
+ **Universal utilities** - Works in both browser and server environments.
23
41
 
24
- ```bash
25
- npm install @levrbet/shared-core
26
- npm install @levrbet/shared-server
27
- ```
42
+ - Blockchain contracts and ABIs
43
+ - Type definitions
44
+ - Utility functions
45
+ - Validation helpers
28
46
 
29
- **Using yarn:**
47
+ **Minimal dependencies:** Only essential packages like `viem`, `zod`, `ms`
30
48
 
31
- ```bash
32
- yarn add @levrbet/shared-core
33
- yarn add @levrbet/shared-server
34
- ```
49
+ ### React (`@levrbet/shared/react`)
35
50
 
36
- This will add the selected package to your `package.json` and install it in your `node_modules`.
51
+ **React-specific utilities** - For React applications only.
37
52
 
38
- ## 📦 Usage
53
+ - React components
54
+ - Custom hooks
55
+ - Context providers
39
56
 
40
- To use a package in your project, import it as follows:
57
+ **Requires:** `react >=18`
41
58
 
42
- **For core utilities (browser or server):**
59
+ ### Server (`@levrbet/shared/server`)
43
60
 
44
- ```typescript
45
- import { someFunction } from "@levrbet/shared-core"
46
- ```
61
+ **Server-only utilities** - For Node.js/server environments only.
47
62
 
48
- **For server-specific utilities (Node.js):**
63
+ - Authentication middleware
64
+ - Database utilities (Prisma)
65
+ - Redis caching
66
+ - Logging and observability
67
+ - Express middleware
49
68
 
50
- ```typescript
51
- import { serverFunction } from "@levrbet/shared-server"
69
+ **Requires:** Various server-side peer dependencies (see installation above)
70
+
71
+ ## � Advanced Installation
72
+
73
+ ### Core Only (no server/React features)
74
+
75
+ For applications that only need blockchain utilities and types:
76
+
77
+ ```bash
78
+ npm install @levrbet/shared
79
+ # Only core dependencies will be installed
52
80
  ```
53
81
 
82
+ ## 🏗️ Development Setup
83
+
84
+ 1. **Install dependencies:**
85
+ ```bash
86
+ bun install
87
+ ```
88
+
89
+ 2. **Build the package:**
90
+ ```bash
91
+ bun run build
92
+ ```
93
+
94
+ 3. **Clean build artifacts:**
95
+ ```bash
96
+ bun run clean
97
+ ```
98
+
54
99
  ## Setting up pre-commit hooks
55
100
 
56
101
  1. **Install Python (if not already installed)**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levrbet/shared",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -33,18 +33,99 @@
33
33
  "build": "npx prisma generate && npx tsc && npm run copy-assets",
34
34
  "copy-assets": "mkdir -p dist/server/oracle/prisma/generated && cp -r src/server/oracle/prisma/generated/* dist/server/oracle/prisma/generated/ 2>/dev/null || true && mkdir -p dist/server/contracts/clients/relayer-sdk && cp -r src/server/contracts/clients/relayer-sdk/* dist/server/contracts/clients/relayer-sdk/ 2>/dev/null || true",
35
35
  "clean": "rm -rf dist",
36
- "prepare": "npm run build"
36
+ "prepublishOnly": "npm run build"
37
37
  },
38
38
  "peerDependencies": {
39
- "react": ">=18"
39
+ "react": ">=18",
40
+ "@aws-sdk/client-kms": ">=3.0.0",
41
+ "@prisma/client": ">=6.0.0",
42
+ "@privy-io/server-auth": ">=1.0.0",
43
+ "axios": ">=1.0.0",
44
+ "express": ">=4.0.0",
45
+ "ioredis": ">=5.0.0",
46
+ "jose": ">=5.0.0",
47
+ "redis": ">=4.0.0",
48
+ "winston": ">=3.0.0",
49
+ "bson": ">=6.0.0",
50
+ "coralogix-logger": ">=1.1.30",
51
+ "@opentelemetry/auto-instrumentations-node": ">=0.64.1",
52
+ "@opentelemetry/exporter-metrics-otlp-http": ">=0.50.0",
53
+ "@opentelemetry/exporter-trace-otlp-http": ">=0.50.0",
54
+ "@opentelemetry/resources": ">=1.20.0",
55
+ "@opentelemetry/sdk-metrics": ">=1.20.0",
56
+ "@opentelemetry/sdk-node": ">=0.50.0",
57
+ "@opentelemetry/api": ">=1.8.0"
40
58
  },
41
59
  "peerDependenciesMeta": {
42
60
  "react": {
43
61
  "optional": true
62
+ },
63
+ "@aws-sdk/client-kms": {
64
+ "optional": true
65
+ },
66
+ "@prisma/client": {
67
+ "optional": true
68
+ },
69
+ "@privy-io/server-auth": {
70
+ "optional": true
71
+ },
72
+ "axios": {
73
+ "optional": true
74
+ },
75
+ "express": {
76
+ "optional": true
77
+ },
78
+ "ioredis": {
79
+ "optional": true
80
+ },
81
+ "jose": {
82
+ "optional": true
83
+ },
84
+ "redis": {
85
+ "optional": true
86
+ },
87
+ "winston": {
88
+ "optional": true
89
+ },
90
+ "bson": {
91
+ "optional": true
92
+ },
93
+ "@opentelemetry/auto-instrumentations-node": {
94
+ "optional": true
95
+ },
96
+ "@opentelemetry/exporter-metrics-otlp-http": {
97
+ "optional": true
98
+ },
99
+ "@opentelemetry/exporter-trace-otlp-http": {
100
+ "optional": true
101
+ },
102
+ "@opentelemetry/resources": {
103
+ "optional": true
104
+ },
105
+ "@opentelemetry/sdk-metrics": {
106
+ "optional": true
107
+ },
108
+ "@opentelemetry/sdk-node": {
109
+ "optional": true
110
+ },
111
+ "@opentelemetry/api": {
112
+ "optional": true
113
+ },
114
+ "coralogix-logger": {
115
+ "optional": true
44
116
  }
45
117
  },
118
+ "dependencies": {
119
+ "bson": "^6.10.4",
120
+ "ms": "^2.1.3",
121
+ "typescript-memoize": "^1.1.1",
122
+ "viem": "^2.37.6",
123
+ "zod": "^4.1.9"
124
+ },
46
125
  "devDependencies": {
47
126
  "@types/bun": "latest",
127
+ "@types/express": "^5.0.3",
128
+ "@types/ms": "^2.1.0",
48
129
  "@types/node": "^24.5.1",
49
130
  "cross-fetch": "^4.1.0"
50
131
  },