x402-express-mantle 1.0.2 → 1.0.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 +35 -31
  2. package/package.json +14 -3
package/README.md CHANGED
@@ -14,55 +14,55 @@ Complete x402 Express middleware SDK with built-in Mantle testnet support and US
14
14
  ## Installation
15
15
 
16
16
  ```bash
17
- npm install x402-express-mantle
17
+ npm install x402-express-mantle@1.0.2
18
18
  ```
19
19
 
20
20
  ## Quick Start
21
21
 
22
22
  ```javascript
23
- import express from 'express';
24
- import { paymentMiddlewareFromConfig } from 'x402-express-mantle';
25
- import { ExactEvmScheme } from 'x402-express-mantle';
26
- import { HTTPFacilitatorClient } from 'x402-express-mantle';
23
+ import express from "express";
24
+ import { paymentMiddlewareFromConfig } from "x402-express-mantle";
25
+ import { ExactEvmScheme } from "x402-express-mantle";
26
+ import { HTTPFacilitatorClient } from "x402-express-mantle";
27
27
 
28
28
  const app = express();
29
29
 
30
30
  // Connect to your Mantle facilitator
31
- const facilitatorClient = new HTTPFacilitatorClient({
32
- url: 'https://your-mantle-facilitator.com'
31
+ const facilitatorClient = new HTTPFacilitatorClient({
32
+ url: "https://your-mantle-facilitator.com",
33
33
  });
34
34
 
35
35
  // Routes with automatic Mantle payment processing
36
36
  const routes = {
37
- 'GET /premium-data': {
38
- accepts: [{
39
- scheme: 'exact',
40
- price: '$0.001',
41
- network: 'eip155:5003', // Mantle testnet (pre-configured)
42
- payTo: '0xYourMantleWalletAddress'
43
- }],
44
- description: 'Premium data access'
45
- }
37
+ "GET /premium-data": {
38
+ accepts: [
39
+ {
40
+ scheme: "exact",
41
+ price: "$0.001",
42
+ network: "eip155:5003", // Mantle testnet (pre-configured)
43
+ payTo: "0xYourMantleWalletAddress",
44
+ },
45
+ ],
46
+ description: "Premium data access",
47
+ },
46
48
  };
47
49
 
48
50
  // Configure payment schemes (Mantle support built-in)
49
- const schemes = [{
50
- network: 'eip155:5003', // Mantle testnet
51
- server: new ExactEvmScheme()
52
- }];
51
+ const schemes = [
52
+ {
53
+ network: "eip155:5003", // Mantle testnet
54
+ server: new ExactEvmScheme(),
55
+ },
56
+ ];
53
57
 
54
58
  // Add payment middleware
55
- app.use(paymentMiddlewareFromConfig(
56
- routes,
57
- facilitatorClient,
58
- schemes
59
- ));
59
+ app.use(paymentMiddlewareFromConfig(routes, facilitatorClient, schemes));
60
60
 
61
61
  // Your protected route
62
- app.get('/premium-data', (req, res) => {
62
+ app.get("/premium-data", (req, res) => {
63
63
  res.json({
64
- data: 'Premium Mantle content!',
65
- network: 'Mantle Testnet'
64
+ data: "Premium Mantle content!",
65
+ network: "Mantle Testnet",
66
66
  });
67
67
  });
68
68
 
@@ -90,6 +90,7 @@ Direct middleware function using a pre-configured server instance.
90
90
  Configuration-based middleware that creates the server internally.
91
91
 
92
92
  ### Core Classes
93
+
93
94
  - `x402ResourceServer` - Resource server for advanced configurations
94
95
  - `x402HTTPResourceServer` - HTTP resource server
95
96
  - `HTTPFacilitatorClient` - Client for connecting to facilitators
@@ -134,8 +135,8 @@ This SDK includes custom Mantle configurations:
134
135
 
135
136
  ### Vercel
136
137
 
137
- ```bash
138
- npm install x402-express-mantle
138
+ ````bash
139
+ npm install x402-express-mantle@1.0.2
139
140
 
140
141
  ## Quick Example
141
142
 
@@ -146,15 +147,17 @@ npm install
146
147
  cp .env-local .env
147
148
  # Edit .env with your facilitator URL and EVM address
148
149
  npm run dev
149
- ```
150
+ ````
150
151
 
151
152
  The example server demonstrates:
153
+
152
154
  - Mantle testnet payment integration
153
155
  - Multiple pricing tiers ($0.001 and $0.005 USDC)
154
156
  - Free and paid endpoints
155
157
  - Complete payment flow
156
158
 
157
159
  # Deploy to Vercel with your environment variables
160
+
158
161
  ```
159
162
 
160
163
  ### Other Platforms
@@ -171,3 +174,4 @@ Works with any Node.js platform supporting Express.js.
171
174
  ## License
172
175
 
173
176
  Apache-2.0
177
+ ```
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "x402-express-mantle",
3
- "version": "1.0.2",
4
- "main": "./src/index.js",
3
+ "version": "1.0.3",
4
+ "main": "./lib/cjs/index.js",
5
+ "module": "./lib/esm/index.mjs",
6
+ "types": "./lib/cjs/index.d.ts",
5
7
  "type": "module",
6
8
  "scripts": {
7
9
  "test": "echo 'No tests specified'",
@@ -31,7 +33,16 @@
31
33
  "express": "^4.0.0 || ^5.0.0"
32
34
  },
33
35
  "exports": {
34
- ".": "./src/index.js"
36
+ ".": {
37
+ "import": {
38
+ "types": "./lib/esm/index.d.mts",
39
+ "default": "./lib/esm/index.mjs"
40
+ },
41
+ "require": {
42
+ "types": "./lib/cjs/index.d.ts",
43
+ "default": "./lib/cjs/index.js"
44
+ }
45
+ }
35
46
  },
36
47
  "files": [
37
48
  "lib",