@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
99 lines • 5.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateX402Resource = exports.postX402DiscoveryMcp = exports.searchX402Resources = exports.listX402DiscoveryMerchant = exports.listX402DiscoveryResources = exports.supportedX402PaymentKinds = exports.settleX402Payment = exports.verifyX402Payment = void 0;
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
/**
* Verify an x402 protocol payment with a specific scheme and network.
* @summary Verify payment
*/
const verifyX402Payment = (verifyX402PaymentBody, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/x402/verify`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: verifyX402PaymentBody,
}, options);
};
exports.verifyX402Payment = verifyX402Payment;
/**
* Settle an x402 protocol payment with a specific scheme and network.
* @summary Settle payment
*/
const settleX402Payment = (settleX402PaymentBody, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/x402/settle`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: settleX402PaymentBody,
}, options);
};
exports.settleX402Payment = settleX402Payment;
/**
* Get the supported x402 protocol payment schemes and networks that the facilitator is able to verify and settle payments for.
* @summary Get supported payment schemes and networks
*/
const supportedX402PaymentKinds = (options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/supported`, method: "GET" }, options);
};
exports.supportedX402PaymentKinds = supportedX402PaymentKinds;
/**
* Lists all active discovered x402 resources.
This endpoint returns resources that have been discovered and cached by the x402 facilitator, including their payment requirements and metadata.
The response is paginated, and by default, returns 100 items per page.
* @summary List x402 resources
*/
const listX402DiscoveryResources = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/discovery/resources`, method: "GET", params }, options);
};
exports.listX402DiscoveryResources = listX402DiscoveryResources;
/**
* Gets x402 merchant discovery information for a given merchant payment address.
This endpoint returns all active x402 resources associated with the specified `payTo` address, allowing clients to discover what payment-gated resources a merchant exposes and their corresponding payment requirements.
If no active resources are found for the `payTo` address, the endpoint returns an empty `resources` list.
The response is paginated, and by default, returns 20 items per page.
* @summary List merchant discovery info
*/
const listX402DiscoveryMerchant = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/discovery/merchant`, method: "GET", params }, options);
};
exports.listX402DiscoveryMerchant = listX402DiscoveryMerchant;
/**
* Searches for active x402 resources using a text query and optional filters.
Supports both text-based and vector-based search depending on availability. Results are sorted by relevance and quality score.
Legacy network names (e.g., `base`, `base-sepolia`, `solana`) are automatically normalized to their CAIP-2 equivalents.
The response is limited to 20 items per request. If more results exist, `partialResults` will be `true`.
* @summary Search x402 resources
*/
const searchX402Resources = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/x402/discovery/search`, method: "GET", params }, options);
};
exports.searchX402Resources = searchX402Resources;
/**
* Handles JSON-RPC requests for the Model Context Protocol (MCP). Supports MCP methods for discovering x402 payment resources and tools.
* @summary Handle MCP JSON-RPC request
*/
const postX402DiscoveryMcp = (x402McpRequest, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/x402/discovery/mcp`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: x402McpRequest,
}, options);
};
exports.postX402DiscoveryMcp = postX402DiscoveryMcp;
/**
* Validates an x402 endpoint's bazaar-discovery configuration by probing the seller's URL live.
Returns a uniform array of preflight check results (reachable, returns402, hasBazaarExtension, parse) and a simulated facilitator accept/reject decision so sellers and agents can confirm their endpoint is ready to be discovered before going live.
This operation is read-only: it performs no payment and does not index the resource.
* @summary Validate x402 endpoint
*/
const validateX402Resource = (x402ValidateRequest, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/x402/validate`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: x402ValidateRequest,
}, options);
};
exports.validateX402Resource = validateX402Resource;
//# sourceMappingURL=x402-facilitator.js.map