@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
103 lines • 4.94 kB
JavaScript
import { cdpApiClient } from "../../cdpApiClient.js";
/**
* Verify an x402 protocol payment with a specific scheme and network.
* @summary Verify payment
*/
export const verifyX402Payment = (verifyX402PaymentBody, options) => {
return cdpApiClient({
url: `/v2/x402/verify`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: verifyX402PaymentBody,
}, options);
};
/**
* Settle an x402 protocol payment with a specific scheme and network.
* @summary Settle payment
*/
export const settleX402Payment = (settleX402PaymentBody, options) => {
return cdpApiClient({
url: `/v2/x402/settle`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: settleX402PaymentBody,
}, options);
};
/**
* 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
*/
export const supportedX402PaymentKinds = (options) => {
return cdpApiClient({ url: `/v2/x402/supported`, method: "GET" }, options);
};
/**
* 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
*/
export const listX402DiscoveryResources = (params, options) => {
return cdpApiClient({ url: `/v2/x402/discovery/resources`, method: "GET", params }, options);
};
/**
* 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
*/
export const listX402DiscoveryMerchant = (params, options) => {
return cdpApiClient({ url: `/v2/x402/discovery/merchant`, method: "GET", params }, options);
};
/**
* 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
*/
export const searchX402Resources = (params, options) => {
return cdpApiClient({ url: `/v2/x402/discovery/search`, method: "GET", params }, options);
};
/**
* 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
*/
export const postX402DiscoveryMcp = (x402McpRequest, options) => {
return cdpApiClient({
url: `/v2/x402/discovery/mcp`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: x402McpRequest,
}, options);
};
/**
* Lists the available curated x402 workflow bundles. A bundle is an ordered, named grouping of curated x402 resources that together cover a common agent workflow.
The result set is small and server-controlled, so this endpoint is not paginated.
* @summary List x402 bundles
*/
export const listX402Bundles = (options) => {
return cdpApiClient({ url: `/v2/x402/discovery/bundles`, method: "GET" }, options);
};
/**
* Gets a single curated x402 workflow bundle by its bundle slug, including the bundle metadata and its ordered member resources joined to their full discovery metadata.
* @summary Get an x402 bundle
*/
export const getX402Bundle = (bundleSlug, options) => {
return cdpApiClient({ url: `/v2/x402/discovery/bundles/${bundleSlug}`, method: "GET" }, options);
};
/**
* 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
*/
export const validateX402Resource = (x402ValidateRequest, options) => {
return cdpApiClient({
url: `/v2/x402/validate`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: x402ValidateRequest,
}, options);
};
//# sourceMappingURL=x402-facilitator.js.map