wolverine-ai 5.3.1 → 5.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wolverine-ai",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "description": "Self-healing Node.js server framework powered by AI. Catches crashes, diagnoses errors, generates fixes, verifies, and restarts — automatically.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -99,15 +99,20 @@ async function x402Plugin(fastify, opts) {
99
99
 
100
100
  // Build payment requirements (v1 format matching @coinbase/x402)
101
101
  const { getAddress } = await import("viem");
102
+ // Build full resource URL (required by facilitator)
103
+ const proto = request.headers["x-forwarded-proto"] || "https";
104
+ const host = request.headers["x-forwarded-host"] || request.headers.host || "localhost";
105
+ const resourceUrl = `${proto}://${host}${request.url}`;
106
+
102
107
  const paymentRequirements = {
103
108
  scheme: "exact",
104
109
  network: _network,
105
110
  maxAmountRequired: usdcAtomicAmount,
106
- resource: `${request.method} ${request.url}`,
107
- description: routeConfig.description || `Payment for ${request.method} ${request.url}`,
111
+ resource: resourceUrl,
112
+ description: routeConfig.description || `Payment of $${dollarAmount.toFixed(2)} USDC`,
108
113
  mimeType: "application/json",
109
114
  payTo: getAddress(_payTo),
110
- maxTimeoutSeconds: 300,
115
+ maxTimeoutSeconds: 60,
111
116
  asset: getAddress(USDC_ADDRESS),
112
117
  extra: USDC_EIP712,
113
118
  };
@@ -187,10 +192,12 @@ async function x402Plugin(fastify, opts) {
187
192
 
188
193
  const userValue = decodedPayment.payload.authorization.value;
189
194
  const { getAddress } = await import("viem");
195
+ const proto = request.headers["x-forwarded-proto"] || "https";
196
+ const host = request.headers["x-forwarded-host"] || request.headers.host || "localhost";
190
197
  const requirements = {
191
198
  scheme: "exact", network: _network, maxAmountRequired: userValue,
192
- resource: `${request.method} ${request.url}`, description: "", mimeType: "application/json",
193
- payTo: getAddress(_payTo), maxTimeoutSeconds: 300, asset: getAddress(USDC_ADDRESS), extra: USDC_EIP712,
199
+ resource: `${proto}://${host}${request.url}`, description: "", mimeType: "application/json",
200
+ payTo: getAddress(_payTo), maxTimeoutSeconds: 60, asset: getAddress(USDC_ADDRESS), extra: USDC_EIP712,
194
201
  };
195
202
 
196
203
  const settleResult = await _facilitatorClient.settle(decodedPayment, requirements);