UNPKG

@coinbase/cdp-sdk

Version:

SDK for interacting with the Coinbase Developer Platform Wallet API

183 lines (179 loc) 6.85 kB
/** * Generated by orval v7.21.0 🍺 * Do not edit manually. * Coinbase Developer Platform APIs * The Coinbase Developer Platform APIs - leading the world's transition onchain. * OpenAPI spec version: 2.0.0 */ import type { ListX402DiscoveryMerchantParams, ListX402DiscoveryResourcesParams, SearchX402ResourcesParams, SettleX402PaymentBody, VerifyX402PaymentBody, X402DiscoveryMerchantResponse, X402DiscoveryResourcesResponse, X402McpRequest, X402McpResponse, X402SearchResourcesResponse, X402SettleResponseResponse, X402SupportedPaymentKindsResponseResponse, X402ValidateRequest, X402ValidateResponse, X402VerifyResponseResponse, } from "../coinbaseDeveloperPlatformAPIs.schemas.js"; import { cdpApiClient } from "../../cdpApiClient.js"; type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1]; /** * Verify an x402 protocol payment with a specific scheme and network. * @summary Verify payment */ export const verifyX402Payment = ( verifyX402PaymentBody: VerifyX402PaymentBody, options?: SecondParameter<typeof cdpApiClient<X402VerifyResponseResponse>>, ) => { return cdpApiClient<X402VerifyResponseResponse>( { 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: SettleX402PaymentBody, options?: SecondParameter<typeof cdpApiClient<X402SettleResponseResponse>>, ) => { return cdpApiClient<X402SettleResponseResponse>( { 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?: SecondParameter<typeof cdpApiClient<X402SupportedPaymentKindsResponseResponse>>, ) => { return cdpApiClient<X402SupportedPaymentKindsResponseResponse>( { 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?: ListX402DiscoveryResourcesParams, options?: SecondParameter<typeof cdpApiClient<X402DiscoveryResourcesResponse>>, ) => { return cdpApiClient<X402DiscoveryResourcesResponse>( { 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: ListX402DiscoveryMerchantParams, options?: SecondParameter<typeof cdpApiClient<X402DiscoveryMerchantResponse>>, ) => { return cdpApiClient<X402DiscoveryMerchantResponse>( { 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?: SearchX402ResourcesParams, options?: SecondParameter<typeof cdpApiClient<X402SearchResourcesResponse>>, ) => { return cdpApiClient<X402SearchResourcesResponse>( { 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: X402McpRequest, options?: SecondParameter<typeof cdpApiClient<X402McpResponse>>, ) => { return cdpApiClient<X402McpResponse>( { url: `/v2/x402/discovery/mcp`, method: "POST", headers: { "Content-Type": "application/json" }, data: x402McpRequest, }, 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: X402ValidateRequest, options?: SecondParameter<typeof cdpApiClient<X402ValidateResponse>>, ) => { return cdpApiClient<X402ValidateResponse>( { url: `/v2/x402/validate`, method: "POST", headers: { "Content-Type": "application/json" }, data: x402ValidateRequest, }, options, ); }; export type VerifyX402PaymentResult = NonNullable<Awaited<ReturnType<typeof verifyX402Payment>>>; export type SettleX402PaymentResult = NonNullable<Awaited<ReturnType<typeof settleX402Payment>>>; export type SupportedX402PaymentKindsResult = NonNullable< Awaited<ReturnType<typeof supportedX402PaymentKinds>> >; export type ListX402DiscoveryResourcesResult = NonNullable< Awaited<ReturnType<typeof listX402DiscoveryResources>> >; export type ListX402DiscoveryMerchantResult = NonNullable< Awaited<ReturnType<typeof listX402DiscoveryMerchant>> >; export type SearchX402ResourcesResult = NonNullable< Awaited<ReturnType<typeof searchX402Resources>> >; export type PostX402DiscoveryMcpResult = NonNullable< Awaited<ReturnType<typeof postX402DiscoveryMcp>> >; export type ValidateX402ResourceResult = NonNullable< Awaited<ReturnType<typeof validateX402Resource>> >;