x402-express-mantle 1.0.0 → 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.
- package/README.md +52 -30
- package/lib/cjs/index.d.ts +119 -81
- package/lib/cjs/index.js +3 -3
- package/lib/esm/index.d.mts +5 -5
- package/lib/esm/index.mjs +3 -3
- package/package.json +17 -5
- package/lib/cjs/client/index.d.ts +0 -243
- package/lib/cjs/client/index.js +0 -413
- package/lib/cjs/client/index.js.map +0 -1
- package/lib/cjs/exact/client/index.d.ts +0 -37
- package/lib/cjs/exact/client/index.js +0 -281
- package/lib/cjs/exact/client/index.js.map +0 -1
- package/lib/cjs/exact/facilitator/index.d.ts +0 -110
- package/lib/cjs/exact/facilitator/index.js +0 -714
- package/lib/cjs/exact/facilitator/index.js.map +0 -1
- package/lib/cjs/exact/server/index.d.ts +0 -87
- package/lib/cjs/exact/server/index.js +0 -209
- package/lib/cjs/exact/server/index.js.map +0 -1
- package/lib/cjs/exact/v1/client/index.d.ts +0 -33
- package/lib/cjs/exact/v1/client/index.js +0 -169
- package/lib/cjs/exact/v1/client/index.js.map +0 -1
- package/lib/cjs/exact/v1/facilitator/index.d.ts +0 -71
- package/lib/cjs/exact/v1/facilitator/index.js +0 -384
- package/lib/cjs/exact/v1/facilitator/index.js.map +0 -1
- package/lib/cjs/facilitator/index.d.ts +0 -192
- package/lib/cjs/facilitator/index.js +0 -398
- package/lib/cjs/facilitator/index.js.map +0 -1
- package/lib/cjs/http/index.d.ts +0 -52
- package/lib/cjs/http/index.js +0 -827
- package/lib/cjs/http/index.js.map +0 -1
- package/lib/cjs/mechanisms-CzuGzYsS.d.ts +0 -270
- package/lib/cjs/scheme-MoBRXFM8.d.ts +0 -29
- package/lib/cjs/server/index.d.ts +0 -2
- package/lib/cjs/server/index.js +0 -1305
- package/lib/cjs/server/index.js.map +0 -1
- package/lib/cjs/signer-5OVDxViv.d.ts +0 -79
- package/lib/cjs/signer-BMkbhFYE.d.ts +0 -123
- package/lib/cjs/types/index.d.ts +0 -1
- package/lib/cjs/types/index.js +0 -66
- package/lib/cjs/types/index.js.map +0 -1
- package/lib/cjs/types/v1/index.d.ts +0 -1
- package/lib/cjs/types/v1/index.js +0 -19
- package/lib/cjs/types/v1/index.js.map +0 -1
- package/lib/cjs/utils/index.d.ts +0 -48
- package/lib/cjs/utils/index.js +0 -116
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/v1/index.d.ts +0 -12
- package/lib/cjs/v1/index.js +0 -180
- package/lib/cjs/v1/index.js.map +0 -1
- package/lib/cjs/x402HTTPResourceServer-D1YtlH_r.d.ts +0 -719
- package/lib/esm/chunk-3CEIVWNN.mjs +0 -339
- package/lib/esm/chunk-3CEIVWNN.mjs.map +0 -1
- package/lib/esm/chunk-BJTO5JO5.mjs +0 -11
- package/lib/esm/chunk-BJTO5JO5.mjs.map +0 -1
- package/lib/esm/chunk-EEA7DKZI.mjs +0 -111
- package/lib/esm/chunk-EEA7DKZI.mjs.map +0 -1
- package/lib/esm/chunk-FOUXRQAV.mjs +0 -88
- package/lib/esm/chunk-FOUXRQAV.mjs.map +0 -1
- package/lib/esm/chunk-IKSTWKEM.mjs +0 -157
- package/lib/esm/chunk-IKSTWKEM.mjs.map +0 -1
- package/lib/esm/chunk-JYZWCLMP.mjs +0 -305
- package/lib/esm/chunk-JYZWCLMP.mjs.map +0 -1
- package/lib/esm/chunk-PNSAJQCF.mjs +0 -108
- package/lib/esm/chunk-PNSAJQCF.mjs.map +0 -1
- package/lib/esm/chunk-PSA4YVU2.mjs +0 -92
- package/lib/esm/chunk-PSA4YVU2.mjs.map +0 -1
- package/lib/esm/chunk-QLXM7BIB.mjs +0 -23
- package/lib/esm/chunk-QLXM7BIB.mjs.map +0 -1
- package/lib/esm/chunk-TDLQZ6MP.mjs +0 -86
- package/lib/esm/chunk-TDLQZ6MP.mjs.map +0 -1
- package/lib/esm/chunk-VE37GDG2.mjs +0 -7
- package/lib/esm/chunk-VE37GDG2.mjs.map +0 -1
- package/lib/esm/chunk-WWACQNRQ.mjs +0 -7
- package/lib/esm/chunk-WWACQNRQ.mjs.map +0 -1
- package/lib/esm/chunk-X4W4S5RB.mjs +0 -39
- package/lib/esm/chunk-X4W4S5RB.mjs.map +0 -1
- package/lib/esm/chunk-Z4QX3O5V.mjs +0 -748
- package/lib/esm/chunk-Z4QX3O5V.mjs.map +0 -1
- package/lib/esm/chunk-ZYXTTU74.mjs +0 -88
- package/lib/esm/chunk-ZYXTTU74.mjs.map +0 -1
- package/lib/esm/client/index.d.mts +0 -243
- package/lib/esm/client/index.mjs +0 -260
- package/lib/esm/client/index.mjs.map +0 -1
- package/lib/esm/exact/client/index.d.mts +0 -37
- package/lib/esm/exact/client/index.mjs +0 -36
- package/lib/esm/exact/client/index.mjs.map +0 -1
- package/lib/esm/exact/facilitator/index.d.mts +0 -110
- package/lib/esm/exact/facilitator/index.mjs +0 -350
- package/lib/esm/exact/facilitator/index.mjs.map +0 -1
- package/lib/esm/exact/server/index.d.mts +0 -87
- package/lib/esm/exact/server/index.mjs +0 -129
- package/lib/esm/exact/server/index.mjs.map +0 -1
- package/lib/esm/exact/v1/client/index.d.mts +0 -33
- package/lib/esm/exact/v1/client/index.mjs +0 -8
- package/lib/esm/exact/v1/client/index.mjs.map +0 -1
- package/lib/esm/exact/v1/facilitator/index.d.mts +0 -71
- package/lib/esm/exact/v1/facilitator/index.mjs +0 -8
- package/lib/esm/exact/v1/facilitator/index.mjs.map +0 -1
- package/lib/esm/facilitator/index.d.mts +0 -192
- package/lib/esm/facilitator/index.mjs +0 -373
- package/lib/esm/facilitator/index.mjs.map +0 -1
- package/lib/esm/http/index.d.mts +0 -52
- package/lib/esm/http/index.mjs +0 -29
- package/lib/esm/http/index.mjs.map +0 -1
- package/lib/esm/mechanisms-CzuGzYsS.d.mts +0 -270
- package/lib/esm/scheme-fjF-9LhT.d.mts +0 -29
- package/lib/esm/server/index.d.mts +0 -2
- package/lib/esm/server/index.mjs +0 -563
- package/lib/esm/server/index.mjs.map +0 -1
- package/lib/esm/signer-5OVDxViv.d.mts +0 -79
- package/lib/esm/signer-BMkbhFYE.d.mts +0 -123
- package/lib/esm/types/index.d.mts +0 -1
- package/lib/esm/types/index.mjs +0 -10
- package/lib/esm/types/index.mjs.map +0 -1
- package/lib/esm/types/v1/index.d.mts +0 -1
- package/lib/esm/types/v1/index.mjs +0 -1
- package/lib/esm/types/v1/index.mjs.map +0 -1
- package/lib/esm/utils/index.d.mts +0 -48
- package/lib/esm/utils/index.mjs +0 -20
- package/lib/esm/utils/index.mjs.map +0 -1
- package/lib/esm/v1/index.d.mts +0 -12
- package/lib/esm/v1/index.mjs +0 -13
- package/lib/esm/v1/index.mjs.map +0 -1
- package/lib/esm/x402HTTPResourceServer-BIfIK5HS.d.mts +0 -719
- package/src/index.js +0 -4
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
|
|
24
|
-
import { paymentMiddlewareFromConfig } from
|
|
25
|
-
import { ExactEvmScheme } from
|
|
26
|
-
import { HTTPFacilitatorClient } from
|
|
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:
|
|
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
|
-
|
|
38
|
-
accepts: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
51
|
-
|
|
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(
|
|
62
|
+
app.get("/premium-data", (req, res) => {
|
|
63
63
|
res.json({
|
|
64
|
-
data:
|
|
65
|
-
network:
|
|
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
|
|
@@ -116,7 +117,7 @@ EVM_ADDRESS=0xYourMantleWalletAddress
|
|
|
116
117
|
Check the `examples/` directory for complete working examples:
|
|
117
118
|
|
|
118
119
|
```bash
|
|
119
|
-
cd
|
|
120
|
+
cd examples/express
|
|
120
121
|
npm install
|
|
121
122
|
npm start
|
|
122
123
|
```
|
|
@@ -134,9 +135,29 @@ This SDK includes custom Mantle configurations:
|
|
|
134
135
|
|
|
135
136
|
### Vercel
|
|
136
137
|
|
|
138
|
+
````bash
|
|
139
|
+
npm install x402-express-mantle@1.0.2
|
|
140
|
+
|
|
141
|
+
## Quick Example
|
|
142
|
+
|
|
137
143
|
```bash
|
|
138
|
-
|
|
144
|
+
# Try the example server
|
|
145
|
+
cd examples/express
|
|
146
|
+
npm install
|
|
147
|
+
cp .env-local .env
|
|
148
|
+
# Edit .env with your facilitator URL and EVM address
|
|
149
|
+
npm run dev
|
|
150
|
+
````
|
|
151
|
+
|
|
152
|
+
The example server demonstrates:
|
|
153
|
+
|
|
154
|
+
- Mantle testnet payment integration
|
|
155
|
+
- Multiple pricing tiers ($0.001 and $0.005 USDC)
|
|
156
|
+
- Free and paid endpoints
|
|
157
|
+
- Complete payment flow
|
|
158
|
+
|
|
139
159
|
# Deploy to Vercel with your environment variables
|
|
160
|
+
|
|
140
161
|
```
|
|
141
162
|
|
|
142
163
|
### Other Platforms
|
|
@@ -153,3 +174,4 @@ Works with any Node.js platform supporting Express.js.
|
|
|
153
174
|
## License
|
|
154
175
|
|
|
155
176
|
Apache-2.0
|
|
177
|
+
```
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,91 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
HTTPAdapter,
|
|
3
|
+
RoutesConfig,
|
|
4
|
+
x402ResourceServer,
|
|
5
|
+
PaywallConfig,
|
|
6
|
+
PaywallProvider,
|
|
7
|
+
FacilitatorClient,
|
|
8
|
+
} from "x402-core-mantle/server";
|
|
9
|
+
export {
|
|
10
|
+
PaywallConfig,
|
|
11
|
+
PaywallProvider,
|
|
12
|
+
RouteConfigurationError,
|
|
13
|
+
RouteValidationError,
|
|
14
|
+
x402HTTPResourceServer,
|
|
15
|
+
x402ResourceServer,
|
|
16
|
+
} from "x402-core-mantle/server";
|
|
17
|
+
import { Network, SchemeNetworkServer } from "x402-core-mantle/types";
|
|
18
|
+
export {
|
|
19
|
+
Network,
|
|
20
|
+
PaymentPayload,
|
|
21
|
+
PaymentRequired,
|
|
22
|
+
PaymentRequirements,
|
|
23
|
+
SchemeNetworkServer,
|
|
24
|
+
} from "x402-core-mantle/types";
|
|
25
|
+
import { Request, Response, NextFunction } from "express";
|
|
6
26
|
|
|
7
27
|
/**
|
|
8
28
|
* Express adapter implementation
|
|
9
29
|
*/
|
|
10
30
|
declare class ExpressAdapter implements HTTPAdapter {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
31
|
+
private req;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new ExpressAdapter instance.
|
|
34
|
+
*
|
|
35
|
+
* @param req - The Express request object
|
|
36
|
+
*/
|
|
37
|
+
constructor(req: Request);
|
|
38
|
+
/**
|
|
39
|
+
* Gets a header value from the request.
|
|
40
|
+
*
|
|
41
|
+
* @param name - The header name
|
|
42
|
+
* @returns The header value or undefined
|
|
43
|
+
*/
|
|
44
|
+
getHeader(name: string): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the HTTP method of the request.
|
|
47
|
+
*
|
|
48
|
+
* @returns The HTTP method
|
|
49
|
+
*/
|
|
50
|
+
getMethod(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the path of the request.
|
|
53
|
+
*
|
|
54
|
+
* @returns The request path
|
|
55
|
+
*/
|
|
56
|
+
getPath(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the full URL of the request.
|
|
59
|
+
*
|
|
60
|
+
* @returns The full request URL
|
|
61
|
+
*/
|
|
62
|
+
getUrl(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the Accept header from the request.
|
|
65
|
+
*
|
|
66
|
+
* @returns The Accept header value or empty string
|
|
67
|
+
*/
|
|
68
|
+
getAcceptHeader(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the User-Agent header from the request.
|
|
71
|
+
*
|
|
72
|
+
* @returns The User-Agent header value or empty string
|
|
73
|
+
*/
|
|
74
|
+
getUserAgent(): string;
|
|
75
|
+
/**
|
|
76
|
+
* Gets all query parameters from the request URL.
|
|
77
|
+
*
|
|
78
|
+
* @returns Record of query parameter key-value pairs
|
|
79
|
+
*/
|
|
80
|
+
getQueryParams(): Record<string, string | string[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Gets a specific query parameter by name.
|
|
83
|
+
*
|
|
84
|
+
* @param name - The query parameter name
|
|
85
|
+
* @returns The query parameter value(s) or undefined
|
|
86
|
+
*/
|
|
87
|
+
getQueryParam(name: string): string | string[] | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Gets the parsed request body.
|
|
90
|
+
* Requires express.json() or express.urlencoded() middleware.
|
|
91
|
+
*
|
|
92
|
+
* @returns The parsed request body
|
|
93
|
+
*/
|
|
94
|
+
getBody(): unknown;
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
/**
|
|
78
98
|
* Configuration for registering a payment scheme with a specific network
|
|
79
99
|
*/
|
|
80
100
|
interface SchemeRegistration {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
/**
|
|
102
|
+
* The network identifier (e.g., 'eip155:84532', 'solana:mainnet')
|
|
103
|
+
*/
|
|
104
|
+
network: Network;
|
|
105
|
+
/**
|
|
106
|
+
* The scheme server implementation for this network
|
|
107
|
+
*/
|
|
108
|
+
server: SchemeNetworkServer;
|
|
89
109
|
}
|
|
90
110
|
/**
|
|
91
111
|
* Express payment middleware for x402 protocol (direct server instance).
|
|
@@ -104,7 +124,7 @@ interface SchemeRegistration {
|
|
|
104
124
|
* @example
|
|
105
125
|
* ```typescript
|
|
106
126
|
* import { paymentMiddleware } from "@x402/express";
|
|
107
|
-
* import { x402ResourceServer } from "
|
|
127
|
+
* import { x402ResourceServer } from "x402-core-mantle/server";
|
|
108
128
|
* import { registerExactEvmScheme } from "@x402/evm/exact/server";
|
|
109
129
|
*
|
|
110
130
|
* const server = new x402ResourceServer(myFacilitatorClient);
|
|
@@ -113,7 +133,13 @@ interface SchemeRegistration {
|
|
|
113
133
|
* app.use(paymentMiddleware(routes, server, paywallConfig));
|
|
114
134
|
* ```
|
|
115
135
|
*/
|
|
116
|
-
declare function paymentMiddleware(
|
|
136
|
+
declare function paymentMiddleware(
|
|
137
|
+
routes: RoutesConfig,
|
|
138
|
+
server: x402ResourceServer,
|
|
139
|
+
paywallConfig?: PaywallConfig,
|
|
140
|
+
paywall?: PaywallProvider,
|
|
141
|
+
syncFacilitatorOnStart?: boolean
|
|
142
|
+
): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
117
143
|
/**
|
|
118
144
|
* Express payment middleware for x402 protocol (configuration-based).
|
|
119
145
|
*
|
|
@@ -140,6 +166,18 @@ declare function paymentMiddleware(routes: RoutesConfig, server: x402ResourceSer
|
|
|
140
166
|
* ));
|
|
141
167
|
* ```
|
|
142
168
|
*/
|
|
143
|
-
declare function paymentMiddlewareFromConfig(
|
|
169
|
+
declare function paymentMiddlewareFromConfig(
|
|
170
|
+
routes: RoutesConfig,
|
|
171
|
+
facilitatorClients?: FacilitatorClient | FacilitatorClient[],
|
|
172
|
+
schemes?: SchemeRegistration[],
|
|
173
|
+
paywallConfig?: PaywallConfig,
|
|
174
|
+
paywall?: PaywallProvider,
|
|
175
|
+
syncFacilitatorOnStart?: boolean
|
|
176
|
+
): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
144
177
|
|
|
145
|
-
export {
|
|
178
|
+
export {
|
|
179
|
+
ExpressAdapter,
|
|
180
|
+
type SchemeRegistration,
|
|
181
|
+
paymentMiddleware,
|
|
182
|
+
paymentMiddlewareFromConfig,
|
|
183
|
+
};
|
package/lib/cjs/index.js
CHANGED
|
@@ -38,7 +38,7 @@ __export(src_exports, {
|
|
|
38
38
|
x402ResourceServer: () => import_server2.x402ResourceServer
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(src_exports);
|
|
41
|
-
var import_server = require("
|
|
41
|
+
var import_server = require("x402-core-mantle/server");
|
|
42
42
|
|
|
43
43
|
// src/adapter.ts
|
|
44
44
|
var ExpressAdapter = class {
|
|
@@ -130,8 +130,8 @@ var ExpressAdapter = class {
|
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
// src/index.ts
|
|
133
|
-
var import_server2 = require("
|
|
134
|
-
var import_server3 = require("
|
|
133
|
+
var import_server2 = require("x402-core-mantle/server");
|
|
134
|
+
var import_server3 = require("x402-core-mantle/server");
|
|
135
135
|
function checkIfBazaarNeeded(routes) {
|
|
136
136
|
if ("accepts" in routes) {
|
|
137
137
|
return !!(routes.extensions && "bazaar" in routes.extensions);
|
package/lib/esm/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HTTPAdapter, RoutesConfig, x402ResourceServer, PaywallConfig, PaywallProvider, FacilitatorClient } from '
|
|
2
|
-
export { PaywallConfig, PaywallProvider, RouteConfigurationError, RouteValidationError, x402HTTPResourceServer, x402ResourceServer } from '
|
|
3
|
-
import { Network, SchemeNetworkServer } from '
|
|
4
|
-
export { Network, PaymentPayload, PaymentRequired, PaymentRequirements, SchemeNetworkServer } from '
|
|
1
|
+
import { HTTPAdapter, RoutesConfig, x402ResourceServer, PaywallConfig, PaywallProvider, FacilitatorClient } from 'x402-core-mantle/server';
|
|
2
|
+
export { PaywallConfig, PaywallProvider, RouteConfigurationError, RouteValidationError, x402HTTPResourceServer, x402ResourceServer } from 'x402-core-mantle/server';
|
|
3
|
+
import { Network, SchemeNetworkServer } from 'x402-core-mantle/types';
|
|
4
|
+
export { Network, PaymentPayload, PaymentRequired, PaymentRequirements, SchemeNetworkServer } from 'x402-core-mantle/types';
|
|
5
5
|
import { Request, Response, NextFunction } from 'express';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -104,7 +104,7 @@ interface SchemeRegistration {
|
|
|
104
104
|
* @example
|
|
105
105
|
* ```typescript
|
|
106
106
|
* import { paymentMiddleware } from "@x402/express";
|
|
107
|
-
* import { x402ResourceServer } from "
|
|
107
|
+
* import { x402ResourceServer } from "x402-core-mantle/server";
|
|
108
108
|
* import { registerExactEvmScheme } from "@x402/evm/exact/server";
|
|
109
109
|
*
|
|
110
110
|
* const server = new x402ResourceServer(myFacilitatorClient);
|
package/lib/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
x402HTTPResourceServer,
|
|
4
4
|
x402ResourceServer
|
|
5
|
-
} from "
|
|
5
|
+
} from "x402-core-mantle/server";
|
|
6
6
|
|
|
7
7
|
// src/adapter.ts
|
|
8
8
|
var ExpressAdapter = class {
|
|
@@ -94,8 +94,8 @@ var ExpressAdapter = class {
|
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
// src/index.ts
|
|
97
|
-
import { x402ResourceServer as x402ResourceServer2, x402HTTPResourceServer as x402HTTPResourceServer2 } from "
|
|
98
|
-
import { RouteConfigurationError } from "
|
|
97
|
+
import { x402ResourceServer as x402ResourceServer2, x402HTTPResourceServer as x402HTTPResourceServer2 } from "x402-core-mantle/server";
|
|
98
|
+
import { RouteConfigurationError } from "x402-core-mantle/server";
|
|
99
99
|
function checkIfBazaarNeeded(routes) {
|
|
100
100
|
if ("accepts" in routes) {
|
|
101
101
|
return !!(routes.extensions && "bazaar" in routes.extensions);
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x402-express-mantle",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "./
|
|
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'",
|
|
@@ -20,6 +22,9 @@
|
|
|
20
22
|
"author": "Mantle x402 Team",
|
|
21
23
|
"description": "x402 Express middleware SDK with built-in Mantle testnet support and USDC Token configurations",
|
|
22
24
|
"dependencies": {
|
|
25
|
+
"x402-core-mantle": "2.1.1-mantle",
|
|
26
|
+
"x402-evm-mantle": "2.1.1-mantle",
|
|
27
|
+
"x402-svm-mantle": "2.1.1-mantle",
|
|
23
28
|
"@solana/kit": "^2.1.1",
|
|
24
29
|
"viem": "^2.39.3",
|
|
25
30
|
"zod": "^3.24.2"
|
|
@@ -28,12 +33,19 @@
|
|
|
28
33
|
"express": "^4.0.0 || ^5.0.0"
|
|
29
34
|
},
|
|
30
35
|
"exports": {
|
|
31
|
-
".":
|
|
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
|
+
}
|
|
32
46
|
},
|
|
33
47
|
"files": [
|
|
34
|
-
"src",
|
|
35
48
|
"lib",
|
|
36
|
-
"examples",
|
|
37
49
|
"README.md"
|
|
38
50
|
]
|
|
39
51
|
}
|