@armory-sh/client-ethers 0.2.26-alpha.23.78 → 0.2.26-alpha.23.80

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 +20 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -8,6 +8,7 @@ Armory x402 SDK — Payment client for ethers.js v6. Make payments from any ethe
8
8
 
9
9
  ```bash
10
10
  bun add @armory-sh/client-ethers
11
+ bun add @armory-sh/client-hooks # optional preference/logger hooks
11
12
  ```
12
13
 
13
14
  ## Why Armory?
@@ -60,6 +61,25 @@ const response = await client.fetch('https://api.example.com/protected')
60
61
  const data = await response.json()
61
62
  ```
62
63
 
64
+ ## Hook Pipeline
65
+
66
+ ```typescript
67
+ import { createX402Client } from '@armory-sh/client-ethers'
68
+ import { PaymentPreference, Logger } from '@armory-sh/client-hooks'
69
+
70
+ const client = createX402Client({
71
+ signer,
72
+ hooks: [
73
+ PaymentPreference.chain(['base', 'polygon', 'skale']),
74
+ PaymentPreference.token(['USDT', 'USDC', 'WBTC']),
75
+ PaymentPreference.cheapest(),
76
+ Logger.console(),
77
+ ],
78
+ })
79
+ ```
80
+
81
+ `parsePaymentRequired` returns `accepts[]` (x402 v2 challenge options). Clients select from this list.
82
+
63
83
  ## Features
64
84
 
65
85
  - **Auto 402 Handling**: Automatically intercepts and pays for 402 responses
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/client-ethers",
3
- "version": "0.2.26-alpha.23.78",
3
+ "version": "0.2.26-alpha.23.80",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
6
  "keywords": [
@@ -47,7 +47,7 @@
47
47
  "directory": "packages/client-ethers"
48
48
  },
49
49
  "dependencies": {
50
- "@armory-sh/base": "0.2.27-alpha.23.78",
50
+ "@armory-sh/base": "0.2.27-alpha.23.80",
51
51
  "ethers": "6.16.0"
52
52
  },
53
53
  "devDependencies": {