moltspay 0.8.5 → 0.8.6

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.mjs CHANGED
@@ -30935,10 +30935,18 @@ var MoltsPayClient = class {
30935
30935
  if (!req) {
30936
30936
  throw new Error(`No matching payment option for ${network}`);
30937
30937
  }
30938
- const amount = Number(req.maxAmountRequired) / 1e6;
30938
+ const amountRaw = req.amount || req.maxAmountRequired;
30939
+ if (!amountRaw) {
30940
+ throw new Error("Missing amount in payment requirements");
30941
+ }
30942
+ const amount = Number(amountRaw) / 1e6;
30939
30943
  this.checkLimits(amount);
30940
30944
  console.log(`[MoltsPay] Signing payment: $${amount} USDC (gasless)`);
30941
- const authorization = await this.signEIP3009(req.resource, amount, chain2);
30945
+ const payTo = req.payTo || req.resource;
30946
+ if (!payTo) {
30947
+ throw new Error("Missing payTo address in payment requirements");
30948
+ }
30949
+ const authorization = await this.signEIP3009(payTo, amount, chain2);
30942
30950
  const payload = {
30943
30951
  x402Version: X402_VERSION2,
30944
30952
  scheme: "exact",