@armory-sh/middleware-elysia 0.3.21 → 0.3.22
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 +45 -50
- package/package.json +21 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @armory-sh/middleware-elysia
|
|
2
2
|
|
|
3
|
-
x402
|
|
3
|
+
Armory x402 SDK — Payment middleware for Elysia. Accept x402 payments from any client in your Elysia app. 100% compatible with Coinbase x402 SDKs.
|
|
4
|
+
|
|
5
|
+
[Documentation](https://armory.sh) | [License](LICENSE)
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -8,69 +10,62 @@ x402 payment middleware for Elysia applications.
|
|
|
8
10
|
bun add @armory-sh/middleware-elysia
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Why Armory?
|
|
12
14
|
|
|
13
|
-
-
|
|
14
|
-
- Route-aware payment configuration
|
|
15
|
-
- Multi-network, multi-token support
|
|
16
|
-
- Full TypeScript support
|
|
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.
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## Key Exports
|
|
19
18
|
|
|
20
19
|
```typescript
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
amount: "1000000",
|
|
28
|
-
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" as `0x${string}`,
|
|
29
|
-
payTo: "0xYourAddress..." as `0x${string}`,
|
|
30
|
-
maxTimeoutSeconds: 300,
|
|
31
|
-
extra: {},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const app = new Elysia()
|
|
35
|
-
.use(paymentMiddleware({ requirements }))
|
|
36
|
-
.get("/api/data", ({ payment }) => {
|
|
37
|
-
return {
|
|
38
|
-
data: "protected data",
|
|
39
|
-
payerAddress: payment?.payerAddress,
|
|
40
|
-
};
|
|
41
|
-
})
|
|
42
|
-
.listen(3000);
|
|
20
|
+
import {
|
|
21
|
+
paymentMiddleware,
|
|
22
|
+
routeAwarePaymentMiddleware,
|
|
23
|
+
type PaymentConfig,
|
|
24
|
+
type RouteAwarePaymentConfig,
|
|
25
|
+
} from '@armory-sh/middleware-elysia';
|
|
43
26
|
```
|
|
44
27
|
|
|
45
|
-
##
|
|
28
|
+
## Quick Start
|
|
46
29
|
|
|
47
30
|
```typescript
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
const premiumRequirements = {
|
|
51
|
-
scheme: "exact" as const,
|
|
52
|
-
network: "eip155:8453",
|
|
53
|
-
amount: "5000000",
|
|
54
|
-
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" as `0x${string}`,
|
|
55
|
-
payTo: "0xYourAddress..." as `0x${string}`,
|
|
56
|
-
maxTimeoutSeconds: 300,
|
|
57
|
-
extra: {},
|
|
58
|
-
};
|
|
31
|
+
import { Elysia } from 'elysia'
|
|
32
|
+
import { paymentMiddleware } from '@armory-sh/middleware-elysia'
|
|
59
33
|
|
|
60
34
|
const app = new Elysia()
|
|
61
|
-
.use(
|
|
62
|
-
|
|
63
|
-
|
|
35
|
+
.use(paymentMiddleware({
|
|
36
|
+
requirements: {
|
|
37
|
+
scheme: 'exact',
|
|
38
|
+
network: 'eip155:8453',
|
|
39
|
+
amount: '1000000',
|
|
40
|
+
asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
41
|
+
payTo: '0xYourAddress...',
|
|
42
|
+
maxTimeoutSeconds: 300,
|
|
43
|
+
extra: {}
|
|
44
|
+
}
|
|
64
45
|
}))
|
|
65
|
-
.
|
|
46
|
+
.get('/api/data', ({ payment }) => ({
|
|
47
|
+
payerAddress: payment?.payerAddress
|
|
48
|
+
}))
|
|
49
|
+
.listen(3000)
|
|
66
50
|
```
|
|
67
51
|
|
|
68
|
-
##
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **x402 Compatible**: Accept payments from any x402 client
|
|
55
|
+
- **Route-Aware**: Different pricing for different routes
|
|
56
|
+
- **Multi-Network**: Ethereum, Base, SKALE support
|
|
57
|
+
- **Multi-Token**: USDC, EURC, USDT, WBTC, WETH, SKL
|
|
69
58
|
|
|
70
|
-
|
|
59
|
+
## Supported Networks
|
|
71
60
|
|
|
72
|
-
|
|
61
|
+
| Network | Chain ID |
|
|
62
|
+
|---------|----------|
|
|
63
|
+
| Ethereum | 1 |
|
|
64
|
+
| Base | 8453 |
|
|
65
|
+
| Base Sepolia | 84532 |
|
|
66
|
+
| SKALE Base | 1187947933 |
|
|
67
|
+
| SKALE Base Sepolia | 324705682 |
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
## License
|
|
75
70
|
|
|
76
|
-
|
|
71
|
+
MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
|
package/package.json
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armory-sh/middleware-elysia",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.22",
|
|
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
|
+
"elysia",
|
|
22
|
+
"middleware",
|
|
23
|
+
"server"
|
|
24
|
+
],
|
|
6
25
|
"type": "module",
|
|
7
26
|
"main": "./dist/index.js",
|
|
8
27
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +47,7 @@
|
|
|
28
47
|
"elysia": "^1"
|
|
29
48
|
},
|
|
30
49
|
"dependencies": {
|
|
31
|
-
"@armory-sh/base": "0.2.
|
|
50
|
+
"@armory-sh/base": "0.2.24"
|
|
32
51
|
},
|
|
33
52
|
"devDependencies": {
|
|
34
53
|
"bun-types": "latest",
|