@armory-sh/client-web3 0.2.19 → 0.2.20
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 +68 -12
- package/package.json +21 -2
package/README.md
CHANGED
|
@@ -1,29 +1,85 @@
|
|
|
1
1
|
# @armory-sh/client-web3
|
|
2
2
|
|
|
3
|
-
Web3.js
|
|
3
|
+
Armory x402 SDK — Payment client for Web3.js. Make payments from any Web3.js 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-web3
|
|
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 Web3X402Client,
|
|
36
|
+
type X402ClientConfig,
|
|
37
|
+
type X402TransportConfig,
|
|
38
|
+
type SignPaymentOptions,
|
|
39
|
+
|
|
40
|
+
// Errors
|
|
41
|
+
X402ClientError,
|
|
42
|
+
SigningError,
|
|
43
|
+
PaymentError,
|
|
44
|
+
} from '@armory-sh/client-web3';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
12
48
|
|
|
13
49
|
```typescript
|
|
50
|
+
import { createX402Client } from '@armory-sh/client-web3'
|
|
14
51
|
import { Web3 } from 'web3'
|
|
15
|
-
import { createArmoryPayment } from '@armory-sh/client-web3'
|
|
16
52
|
|
|
17
53
|
const web3 = new Web3('https://mainnet.base.org')
|
|
54
|
+
const account = web3.eth.accounts.create()
|
|
55
|
+
|
|
56
|
+
const client = createX402Client({ account })
|
|
18
57
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
chainId: 'eip155:8453',
|
|
23
|
-
assetId: 'eip155:8453/erc20:0x...'
|
|
24
|
-
})
|
|
58
|
+
// Auto-handles 402 Payment Required responses
|
|
59
|
+
const response = await client.fetch('https://api.example.com/protected')
|
|
60
|
+
const data = await response.json()
|
|
25
61
|
```
|
|
26
62
|
|
|
27
|
-
|
|
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
|
+
- **Web3.js Compatible**: Works with Web3.js v4+
|
|
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
|
|
28
84
|
|
|
29
|
-
MIT
|
|
85
|
+
MIT © [Sawyer Cutler](https://github.com/TheGreatAxios/armory)
|
package/package.json
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armory-sh/client-web3",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
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
|
+
"web3.js",
|
|
22
|
+
"wallet",
|
|
23
|
+
"client"
|
|
24
|
+
],
|
|
6
25
|
"type": "module",
|
|
7
26
|
"main": "./dist/index.js",
|
|
8
27
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +46,7 @@
|
|
|
27
46
|
"directory": "packages/client-web3"
|
|
28
47
|
},
|
|
29
48
|
"dependencies": {
|
|
30
|
-
"@armory-sh/base": "0.2.
|
|
49
|
+
"@armory-sh/base": "0.2.24",
|
|
31
50
|
"web3": "4.16.0",
|
|
32
51
|
"web3-types": "1.10.0"
|
|
33
52
|
},
|