wolverine-ai 5.3.2 → 5.3.3

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.2",
3
+ "version": "5.3.3",
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": {
@@ -132,20 +132,21 @@ async function x402Plugin(fastify, opts) {
132
132
  return;
133
133
  }
134
134
 
135
- // Decode payment
135
+ // Decode payment — parse raw payload directly (matching working project pattern)
136
136
  let decodedPayment;
137
137
  try {
138
- const { exact } = await import("x402/schemes");
139
- const libraryDecoded = exact.evm.decodePayment(paymentHeader);
140
-
141
- // Parse raw payload for metadata
142
138
  const raw = JSON.parse(Buffer.from(paymentHeader, "base64").toString("utf-8"));
143
139
 
140
+ // Validate required fields
141
+ if (!raw.payload?.authorization || !raw.payload?.signature) {
142
+ throw new Error("Missing authorization or signature");
143
+ }
144
+
144
145
  decodedPayment = {
145
146
  x402Version: raw.x402Version || 1,
146
147
  scheme: raw.scheme || "exact",
147
148
  network: raw.network || _network,
148
- payload: libraryDecoded.payload,
149
+ payload: raw.payload,
149
150
  };
150
151
  } catch (err) {
151
152
  reply.code(402).send({ error: "Invalid payment format: " + err.message, accepts: [paymentRequirements] });
@@ -185,10 +186,8 @@ async function x402Plugin(fastify, opts) {
185
186
 
186
187
  try {
187
188
  const paymentHeader = request.headers["x-payment"] || request.headers["payment-signature"];
188
- const { exact } = require("x402/schemes");
189
189
  const raw = JSON.parse(Buffer.from(paymentHeader, "base64").toString("utf-8"));
190
- const libraryDecoded = exact.evm.decodePayment(paymentHeader);
191
- const decodedPayment = { x402Version: raw.x402Version || 1, scheme: raw.scheme || "exact", network: raw.network || _network, payload: libraryDecoded.payload };
190
+ const decodedPayment = { x402Version: raw.x402Version || 1, scheme: raw.scheme || "exact", network: raw.network || _network, payload: raw.payload };
192
191
 
193
192
  const userValue = decodedPayment.payload.authorization.value;
194
193
  const { getAddress } = await import("viem");