@armory-sh/client-viem 0.2.12 → 0.2.13
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/dist/index.d.ts +0 -4
- package/dist/index.js +4 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -96,10 +96,6 @@ type X402Wallet = {
|
|
|
96
96
|
* Detect x402 protocol version from response headers
|
|
97
97
|
*/
|
|
98
98
|
declare function detectX402Version(response: Response): 1 | 2;
|
|
99
|
-
/**
|
|
100
|
-
* Parse x402 PAYMENT-REQUIRED header from response
|
|
101
|
-
* Automatically detects V1 or V2 format
|
|
102
|
-
*/
|
|
103
99
|
interface ParsedPaymentRequirements {
|
|
104
100
|
version: 1 | 2;
|
|
105
101
|
requirements: X402PaymentRequirementsV1 | PaymentRequirementsV2;
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,8 @@ function parsePaymentRequired(response) {
|
|
|
75
75
|
throw new PaymentError("No PAYMENT-REQUIRED header found in 402 response");
|
|
76
76
|
}
|
|
77
77
|
try {
|
|
78
|
-
const
|
|
78
|
+
const decoded = safeBase64Decode(v2Header);
|
|
79
|
+
const parsed = JSON.parse(decoded);
|
|
79
80
|
if (!isX402V2PaymentRequired(parsed)) {
|
|
80
81
|
throw new PaymentError("Invalid x402 V2 payment required format");
|
|
81
82
|
}
|
|
@@ -229,7 +230,8 @@ async function createX402V2Payment(wallet, requirements, fromAddress, nonce, val
|
|
|
229
230
|
};
|
|
230
231
|
return {
|
|
231
232
|
x402Version: 2,
|
|
232
|
-
|
|
233
|
+
scheme: requirements.scheme,
|
|
234
|
+
network: requirements.network,
|
|
233
235
|
payload
|
|
234
236
|
};
|
|
235
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@armory-sh/client-viem",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Sawyer Cutler <sawyer@dirtroad.dev>",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"directory": "packages/client-viem"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@armory-sh/base": "^0.2.
|
|
30
|
+
"@armory-sh/base": "^0.2.13",
|
|
31
31
|
"viem": "2.45.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"bun-types": "latest"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "tsup",
|
|
38
|
+
"build": "rm -rf dist && tsup",
|
|
39
39
|
"test": "bun test",
|
|
40
40
|
"example": "bun run examples/"
|
|
41
41
|
}
|