@armory-sh/client-ethers 0.2.22 → 0.2.23
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 +69 -14
- package/package.json +22 -2
package/README.md
CHANGED
|
@@ -1,30 +1,85 @@
|
|
|
1
1
|
# @armory-sh/client-ethers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Armory x402 SDK — Payment client for ethers.js v6. Make payments from any ethers.js v6 wallet. 100% compatible with Coinbase x402 SDKs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Documentation](https://armory.sh) | [License](LICENSE)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
10
|
bun add @armory-sh/client-ethers
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Why Armory?
|
|
14
|
+
|
|
15
|
+
Armory enables HTTP API payments via EIP-3009 `transferWithAuthorization`. Let your users pay with USDC directly from their wallet—no credit cards, no middlemen, no gas for payers.
|
|
16
|
+
|
|
17
|
+
## Key Exports
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
// Client Creation
|
|
22
|
+
createX402Client,
|
|
23
|
+
createX402Transport,
|
|
24
|
+
|
|
25
|
+
// Protocol
|
|
26
|
+
detectX402Version,
|
|
27
|
+
parsePaymentRequired,
|
|
28
|
+
|
|
29
|
+
// Signing
|
|
30
|
+
signPayment,
|
|
31
|
+
signEIP3009,
|
|
32
|
+
recoverEIP3009Signer,
|
|
33
|
+
|
|
34
|
+
// Types
|
|
35
|
+
type X402Client,
|
|
36
|
+
type X402ClientConfig,
|
|
37
|
+
type X402TransportConfig,
|
|
38
|
+
type SignPaymentOptions,
|
|
39
|
+
|
|
40
|
+
// Errors
|
|
41
|
+
X402ClientError,
|
|
42
|
+
SigningError,
|
|
43
|
+
PaymentError,
|
|
44
|
+
} from '@armory-sh/client-ethers';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
12
48
|
|
|
13
49
|
```typescript
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
50
|
+
import { createX402Client } from '@armory-sh/client-ethers'
|
|
51
|
+
import { BrowserProvider } from 'ethers'
|
|
16
52
|
|
|
17
|
-
const provider = new
|
|
53
|
+
const provider = new BrowserProvider(window.ethereum)
|
|
18
54
|
const signer = await provider.getSigner()
|
|
19
55
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})
|
|
56
|
+
const client = createX402Client({ signer })
|
|
57
|
+
|
|
58
|
+
// Auto-handles 402 Payment Required responses
|
|
59
|
+
const response = await client.fetch('https://api.example.com/protected')
|
|
60
|
+
const data = await response.json()
|
|
26
61
|
```
|
|
27
62
|
|
|
28
|
-
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
- **Auto 402 Handling**: Automatically intercepts and pays for 402 responses
|
|
66
|
+
- **EIP-3009 Signing**: Full support for EIP-3009 TransferWithAuthorization
|
|
67
|
+
- **Multi-Network**: Ethereum, Base, SKALE support
|
|
68
|
+
- **Multi-Token**: USDC, EURC, USDT, WBTC, WETH, SKL
|
|
69
|
+
- **Extension Support**: SIWX, Payment ID, custom extensions
|
|
70
|
+
- **Transport Wrapper**: Create fetch function with payment handling
|
|
71
|
+
- **Ethers v6 Compatible**: Works with any ethers.js v6 Signer
|
|
72
|
+
|
|
73
|
+
## Supported Networks
|
|
74
|
+
|
|
75
|
+
| Network | Chain ID |
|
|
76
|
+
|---------|----------|
|
|
77
|
+
| Ethereum | 1 |
|
|
78
|
+
| Base | 8453 |
|
|
79
|
+
| Base Sepolia | 84532 |
|
|
80
|
+
| SKALE Base | 1187947933 |
|
|
81
|
+
| SKALE Base Sepolia | 324705682 |
|
|
82
|
+
|
|
83
|
+
## License
|
|
29
84
|
|
|
30
|
-
MIT
|
|
85
|
+
MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
|
package/package.json
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armory-sh/client-ethers",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
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
|
+
"ethers",
|
|
22
|
+
"ethers.js",
|
|
23
|
+
"wallet",
|
|
24
|
+
"client"
|
|
25
|
+
],
|
|
6
26
|
"type": "module",
|
|
7
27
|
"main": "./dist/index.js",
|
|
8
28
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +47,7 @@
|
|
|
27
47
|
"directory": "packages/client-ethers"
|
|
28
48
|
},
|
|
29
49
|
"dependencies": {
|
|
30
|
-
"@armory-sh/base": "0.2.
|
|
50
|
+
"@armory-sh/base": "0.2.24",
|
|
31
51
|
"ethers": "6.16.0"
|
|
32
52
|
},
|
|
33
53
|
"devDependencies": {
|