UNPKG

@thorium-dev-group/x402-mcp-extension

Version:
25 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assemblePaymentRequirements = assemblePaymentRequirements; const shared_1 = require("x402/shared"); function assemblePaymentRequirements(options, resourcePath, x402Config, baseUrl) { const result = (0, shared_1.processPriceToAtomicAmount)(options.amount, x402Config.network); if ('error' in result) { throw new Error(`Failed to process price for amount ${options.amount} on network ${x402Config.network}: ${result.error}`); } const resourceUrl = baseUrl ? new URL(resourcePath, baseUrl).toString() : resourcePath; return { scheme: "exact", network: x402Config.network, maxAmountRequired: result.maxAmountRequired, resource: resourceUrl, description: options.description || "", mimeType: "application/json", payTo: x402Config.payTo, maxTimeoutSeconds: 60, asset: result.asset.address, outputSchema: undefined, extra: result.asset.eip712, }; } //# sourceMappingURL=payment-utils.js.map