@armory-sh/middleware-bun 0.3.21 → 0.3.22-alpha.14.46

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 -51
  2. package/package.json +21 -2
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @armory-sh/middleware-bun
2
2
 
3
- x402 payment middleware for Bun runtime applications.
3
+ Armory x402 SDK — Payment middleware for Bun servers. Accept x402 payments from any client in your Bun app. 100% compatible with Coinbase x402 SDKs.
4
+
5
+ [Documentation](https://armory.sh) | [License](LICENSE)
4
6
 
5
7
  ## Installation
6
8
 
@@ -8,89 +10,112 @@ x402 payment middleware for Bun runtime applications.
8
10
  bun add @armory-sh/middleware-bun
9
11
  ```
10
12
 
11
- ## Features
13
+ ## Why Armory?
14
+
15
+ Armory enables HTTP API payments via EIP-3009 `transferWithAuthorization`. Accept payments from any x402-compatible client—Coinbase SDK, Armory SDK, or your own implementation.
16
+
17
+ ## Key Exports
18
+
19
+ ```typescript
20
+ import {
21
+ // Middleware
22
+ createBunMiddleware,
23
+ createRouteAwareBunMiddleware,
24
+
25
+ // Types
26
+ type BunMiddlewareConfig,
27
+ type RouteAwareBunMiddlewareConfig,
28
+ type BunPaymentContext,
29
+ } from '@armory-sh/middleware-bun';
30
+ ```
12
31
 
13
- - Simple payment middleware for Bun
14
- - Route-aware payment configuration
15
- - Multi-network, multi-token support
16
- - Facilitator integration
17
- - Full TypeScript support
32
+ ## Quick Start
18
33
 
19
- ## Basic Usage
34
+ ### Basic Middleware
20
35
 
21
36
  ```typescript
22
- import { createBunMiddleware } from "@armory-sh/middleware-bun";
37
+ import { createBunMiddleware } from '@armory-sh/middleware-bun'
23
38
 
24
39
  const middleware = createBunMiddleware({
25
- payTo: "0xYourAddress...",
26
- network: "base",
27
- amount: "1.0",
28
- });
40
+ payTo: '0xYourAddress...',
41
+ network: 'base',
42
+ token: 'usdc',
43
+ amount: '1.0'
44
+ })
29
45
 
30
- const server = Bun.serve({
46
+ Bun.serve({
31
47
  port: 3000,
32
48
  async fetch(req) {
33
- const response = await middleware(req);
34
- if (response) return response;
49
+ const response = await middleware(req)
50
+ if (response) return response
35
51
 
36
- return new Response("Hello!");
37
- },
38
- });
52
+ return new Response('Hello!')
53
+ }
54
+ })
39
55
  ```
40
56
 
41
- ## Route-Aware Middleware
57
+ ### Route-Aware Middleware
42
58
 
43
59
  ```typescript
44
- import { createRouteAwareBunMiddleware } from "@armory-sh/middleware-bun";
60
+ import { createRouteAwareBunMiddleware } from '@armory-sh/middleware-bun'
45
61
 
46
62
  const middleware = createRouteAwareBunMiddleware({
47
- routes: ["/api/premium", "/api/vip/*"],
48
- payTo: "0xYourAddress...",
49
- amount: "$5.00",
50
- network: "base",
63
+ routes: ['/api/premium', '/api/vip/*'],
64
+ payTo: '0xYourAddress...',
65
+ amount: '$5.00',
66
+ network: 'base',
51
67
  perRoute: {
52
- "/api/vip/*": {
53
- amount: "$10.00",
68
+ '/api/vip/*': {
69
+ amount: '$10.00'
54
70
  }
55
71
  }
56
- });
72
+ })
57
73
 
58
- const server = Bun.serve({
74
+ Bun.serve({
59
75
  port: 3000,
60
- async fetch(req) {
61
- return middleware(req);
62
- },
63
- });
76
+ fetch: (req) => middleware(req)
77
+ })
64
78
  ```
65
79
 
66
- ## Configuration
67
-
68
- ### BunMiddlewareConfig
80
+ ## Configuration Options
69
81
 
70
82
  ```typescript
71
83
  interface BunMiddlewareConfig {
72
- payTo: string | number; // Payment recipient
73
- network: string | number; // Network (name or chain ID)
74
- amount: string; // Amount to charge
75
- facilitator?: FacilitatorConfig;
76
- settlementMode?: "verify" | "settle" | "async";
77
- defaultVersion?: 1 | 2;
78
- waitForSettlement?: boolean;
84
+ payTo: string | number // Payment recipient
85
+ network: string | number // Network (name or chain ID)
86
+ amount: string // Amount to charge
87
+ facilitator?: FacilitatorConfig
88
+ settlementMode?: 'verify' | 'settle' | 'async'
89
+ defaultVersion?: 1 | 2
90
+ waitForSettlement?: boolean
79
91
  }
80
92
 
81
93
  interface RouteAwareBunMiddlewareConfig extends BunMiddlewareConfig {
82
- route?: string;
83
- routes?: string[];
84
- perRoute?: Record<string, Partial<BunMiddlewareConfig>>;
94
+ route?: string
95
+ routes?: string[]
96
+ perRoute?: Record<string, Partial<BunMiddlewareConfig>>
85
97
  }
86
98
  ```
87
99
 
88
- ## API
100
+ ## Features
101
+
102
+ - **x402 Compatible**: Accept payments from any x402 client
103
+ - **Route-Aware**: Different pricing for different routes
104
+ - **Multi-Network**: Ethereum, Base, SKALE support
105
+ - **Multi-Token**: USDC, EURC, USDT, WBTC, WETH, SKL
106
+ - **Facilitator Integration**: Optional facilitator support
107
+ - **Settlement Modes**: Verify, settle, or async settlement
89
108
 
90
- ### `createBunMiddleware(config)`
109
+ ## Supported Networks
91
110
 
92
- Creates a payment middleware for Bun.
111
+ | Network | Chain ID |
112
+ |---------|----------|
113
+ | Ethereum | 1 |
114
+ | Base | 8453 |
115
+ | Base Sepolia | 84532 |
116
+ | SKALE Base | 1187947933 |
117
+ | SKALE Base Sepolia | 324705682 |
93
118
 
94
- ### `createRouteAwareBunMiddleware(config)`
119
+ ## License
95
120
 
96
- Creates a route-aware payment middleware for Bun.
121
+ MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
package/package.json CHANGED
@@ -1,8 +1,27 @@
1
1
  {
2
2
  "name": "@armory-sh/middleware-bun",
3
- "version": "0.3.21",
3
+ "version": "0.3.22-alpha.14.46",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
+ "keywords": [
7
+ "x402",
8
+ "ai",
9
+ "agentic commerce",
10
+ "ai agent",
11
+ "stablecoins",
12
+ "eip-3009",
13
+ "skale",
14
+ "base",
15
+ "machine economy",
16
+ "payment",
17
+ "crypto",
18
+ "web3",
19
+ "ethereum",
20
+ "usdc",
21
+ "bun",
22
+ "middleware",
23
+ "server"
24
+ ],
6
25
  "type": "module",
7
26
  "main": "./dist/index.js",
8
27
  "types": "./dist/index.d.ts",
@@ -24,7 +43,7 @@
24
43
  "directory": "packages/middleware-bun"
25
44
  },
26
45
  "dependencies": {
27
- "@armory-sh/base": "0.2.23"
46
+ "@armory-sh/base": "0.2.24-alpha.14.46"
28
47
  },
29
48
  "devDependencies": {
30
49
  "bun-types": "latest",