Extensions

extensions/bazaar

Package bazaar provides the Bazaar Discovery Extension for x402 v2 and v1.

import "github.com/x402-foundation/x402/go/v2/extensions/bazaar"

Package bazaar provides the Bazaar Discovery Extension for x402 v2 and v1.

Enables facilitators to automatically catalog and index x402-enabled resources by following the server's provided discovery instructions. Supports both HTTP endpoints and MCP (Model Context Protocol) tools.

V2 Usage

The v2 extension follows a pattern where:

  • info: Contains the actual discovery data (the values)
  • schema: JSON Schema that validates the structure of info

For HTTP Resource Servers (V2)

import "github.com/x402-foundation/x402/go/v2/extensions/bazaar"

// Declare a GET endpoint
extension, err := bazaar.DeclareDiscoveryExtension(
	bazaar.MethodGET,
	map[string]interface{}{"query": "example"},
	bazaar.JSONSchema{
		"properties": map[string]interface{}{
			"query": map[string]interface{}{"type": "string"},
		},
		"required": []string{"query"},
	},
	"",
	nil,
)

// Include in PaymentRequired response
paymentRequired := x402.PaymentRequired{
	X402Version: 2,
	Resource: x402.Resource{...},
	Accepts: []x402.PaymentRequirements{...},
	Extensions: map[string]interface{}{
		bazaar.BAZAAR.Key(): extension,
	},
}

For MCP Tool Servers (V2)

import "github.com/x402-foundation/x402/go/v2/extensions/bazaar"

// Declare an MCP tool
extension, err := bazaar.DeclareMcpDiscoveryExtension(bazaar.DeclareMcpDiscoveryConfig{
	ToolName:    "weather_lookup",
	Description: "Look up weather for a city",
	Transport:   bazaar.TransportStreamableHTTP,
	InputSchema: map[string]interface{}{
		"type": "object",
		"properties": map[string]interface{}{
			"city": map[string]interface{}{"type": "string"},
		},
		"required": []string{"city"},
	},
	Example: map[string]interface{}{"city": "San Francisco"},
})

// Include in PaymentRequired response
paymentRequired := x402.PaymentRequired{
	X402Version: 2,
	Resource: x402.Resource{...},
	Accepts: []x402.PaymentRequirements{...},
	Extensions: map[string]interface{}{
		bazaar.BAZAAR.Key(): extension,
	},
}

For MCP Tool Servers (V2)

import (
	"github.com/x402-foundation/x402/go/v2/extensions/bazaar"
	mcp402 "github.com/x402-foundation/x402/go/v2/mcp"
	"github.com/x402-foundation/x402/go/v2/types"
)

// Declare an MCP tool for Bazaar discovery
extension, err := bazaar.DeclareMcpDiscoveryExtension(bazaar.DeclareMcpDiscoveryConfig{
	ToolName:    "get_weather",
	Description: "Get current weather for a city",
	Transport:   bazaar.TransportSSE,
	InputSchema: bazaar.JSONSchema{
		"properties": map[string]interface{}{
			"city": map[string]interface{}{"type": "string"},
		},
		"required": []string{"city"},
	},
})

// Pass in MCP payment wrapper config
paymentWrapper := mcp402.NewPaymentWrapper(resourceServer, mcp402.PaymentWrapperConfig{
	Accepts: accepts,
	Resource: &types.ResourceInfo{URL: "mcp://tool/get_weather"},
	Extensions: map[string]interface{}{
		bazaar.BAZAAR.Key(): extension,
	},
})

For Facilitators (V2 and V1)

import "github.com/x402-foundation/x402/go/v2/extensions/bazaar"

// Extract from client's PaymentPayload (facilitator hook context)
// V2: Extensions are in PaymentPayload.Extensions (client copied from PaymentRequired)
// V1: Discovery info is in PaymentRequirements.OutputSchema
discovered, err := bazaar.ExtractDiscoveredResourceFromPaymentPayload(
	payloadBytes,
	requirementsBytes,
	true, // validate
)

if discovered != nil {
	// Catalog discovered resource in Bazaar
}

For Clients (Processing 402 Responses)

import "github.com/x402-foundation/x402/go/v2/extensions/bazaar"

// Extract from server's 402 PaymentRequired response
// V2: Checks PaymentRequired.Extensions, falls back to Accepts[0]
// V1: Checks Accepts[0].OutputSchema
discovered, err := bazaar.ExtractDiscoveredResourceFromPaymentRequired(
	paymentRequiredBytes,
	true, // validate
)

if discovered != nil {
	// Use discovered resource to build UI or automate calls
}

V1 Support

V1 discovery information is stored in the outputSchema field of PaymentRequirements. Both extraction functions automatically handle v1 format.

import v1 "github.com/x402-foundation/x402/go/v2/extensions/v1"

// Direct v1 extraction (for advanced use cases)
infoV1, err := v1.ExtractDiscoveryInfoV1(paymentRequirementsV1)

Constants

Re-export method constants

Source: extensions/bazaar/types.go:11

const (
	MethodGET    = types.MethodGET
	MethodHEAD   = types.MethodHEAD
	MethodDELETE = types.MethodDELETE
	MethodPOST   = types.MethodPOST
	MethodPUT    = types.MethodPUT
	MethodPATCH  = types.MethodPATCH
)

Re-export body type constants

Source: extensions/bazaar/types.go:21

const (
	BodyTypeJSON     = types.BodyTypeJSON
	BodyTypeFormData = types.BodyTypeFormData
	BodyTypeText     = types.BodyTypeText
)

Re-export MCP transport constants

Source: extensions/bazaar/types.go:28

const (
	TransportStreamableHTTP = types.TransportStreamableHTTP
	TransportSSE            = types.TransportSSE
)

Variables

Re-export utility functions

Source: extensions/bazaar/types.go:57

var (
	IsQueryMethod = types.IsQueryMethod
	IsBodyMethod  = types.IsBodyMethod
)

Re-export extension identifier

Source: extensions/bazaar/types.go:7

var BAZAAR = types.BAZAAR

Source: extensions/bazaar/server.go:219

var BazaarResourceServerExtension = &bazaarResourceServerExtension{}

Functions

func DeclareDiscoveryExtension( method interface{}, input interface{}, inputSchema types.JSONSchema, bodyType types.BodyType, output *types.OutputConfig, opts ...DeclareDiscoveryExtensionOpts, ) (types.DiscoveryExtension, error)

Source: extensions/bazaar/resource_service.go:63

func DeclareMcpDiscoveryExtension(config types.DeclareMcpDiscoveryConfig) (types.DiscoveryExtension, error)

Source: extensions/bazaar/resource_service.go:128

DeclareMcpDiscoveryExtension creates a discovery extension for an MCP tool.

This function helps servers declare how their MCP tool should be discovered, including the tool name, input schema, and optional transport/description/example.

Args:

  • config: Configuration for the MCP discovery extension

Returns:

  • DiscoveryExtension with both info and schema
  • Error if required fields are missing

Example:

extension, err := bazaar.DeclareMcpDiscoveryExtension(bazaar.DeclareMcpDiscoveryConfig{
    ToolName:    "weather_lookup",
    Description: "Look up weather for a city",
    Transport:   bazaar.TransportStreamableHTTP,
    InputSchema: map[string]interface{}{
        "type": "object",
        "properties": map[string]interface{}{
            "city": map[string]interface{}{"type": "string"},
        },
        "required": []string{"city"},
    },
    Example: map[string]interface{}{"city": "San Francisco"},
})

func ExtractDiscoveredResourceFromPaymentPayload( payloadBytes []byte, requirementsBytes []byte, validate bool, ) (*DiscoveredResource, error)

Source: extensions/bazaar/facilitator.go:286

ExtractDiscoveredResourceFromPaymentPayload extracts a discovered resource from a client's payment payload and requirements. This is useful for facilitators processing payments in their hooks.

Args:

  • payloadBytes: Raw JSON bytes of the payment payload (client's payment)
  • requirementsBytes: Raw JSON bytes of the payment requirements (what the client accepted)
  • validate: Whether to validate the discovery info against the schema (default: true)

Returns:

  • DiscoveredResource with URL, method, version and discovery data, or nil if not found
  • Error if extraction or validation fails

Logic:

  • V2: Reads PaymentPayload.extensions[bazaar] and PaymentPayload.resource
  • V1: Reads PaymentRequirements.outputSchema and PaymentRequirements.resource

Example:

discovered, err := bazaar.ExtractDiscoveredResourceFromPaymentPayload(
    ctx.PayloadBytes,
    ctx.RequirementsBytes,
    true, // validate
)
if err != nil {
    log.Printf("Failed to extract discovered resource: %v", err)
    return nil
}
if discovered != nil {
    // Catalog the discovered resource
}

func ExtractDiscoveredResourceFromPaymentRequired( paymentRequiredBytes []byte, validate bool, ) (*DiscoveredResource, error)

Source: extensions/bazaar/facilitator.go:761

ExtractDiscoveredResourceFromPaymentRequired extracts a discovered resource from a 402 PaymentRequired response. This is useful for clients/facilitators that receive a 402 response and want to discover resource capabilities.

Args:

  • paymentRequiredBytes: Raw JSON bytes of the 402 PaymentRequired response
  • validate: Whether to validate the discovery info against the schema (default: true)

Returns:

  • DiscoveredResource with URL, method, version and discovery data, or nil if not found
  • Error if extraction or validation fails

Logic:

  • V2: First checks PaymentRequired.extensions[bazaar] If not found, falls back to PaymentRequired.accepts[0] extensions Resource URL from PaymentRequired.resource
  • V1: Checks PaymentRequired.accepts[0].outputSchema Resource URL from PaymentRequired.accepts[0].resource

Example:

// When receiving a 402 response
discovered, err := bazaar.ExtractDiscoveredResourceFromPaymentRequired(
    paymentRequiredBytes,
    true, // validate
)
if err != nil {
    log.Printf("Failed to extract discovered resource: %v", err)
    return nil
}
if discovered != nil {
    // Show UI for calling the discovered endpoint
}

func ExtractDiscoveryInfoFromExtension( extension types.DiscoveryExtension, validate bool, ) (*types.DiscoveryInfo, error)

Source: extensions/bazaar/facilitator.go:1010

ExtractDiscoveryInfoFromExtension extracts discovery info from a v2 extension directly

This is a lower-level function for when you already have the extension object. For general use, prefer the main ExtractDiscoveryInfo function.

Args:

  • extension: The discovery extension to extract info from
  • validate: Whether to validate before extracting (default: true)

Returns:

  • The discovery info if valid
  • Error if validation fails and validate is true

func SanitizeResourceServiceMetadata(r *x402types.ResourceInfo) SanitizedResourceServiceMetadata

Source: extensions/bazaar/facilitator.go:687

SanitizeResourceServiceMetadata applies the bazaar service-metadata validation rules to a resource and returns only the fields that survive. Missing or invalid fields are dropped silently (soft-drop semantics - see spec).

func ValidateAndExtract(extension types.DiscoveryExtension) struct { Valid bool Info *types.DiscoveryInfo Errors []string }

Source: extensions/bazaar/facilitator.go:1052

ValidateAndExtract validates and extracts discovery info in one step

This is a convenience function that combines validation and extraction, returning both the validation result and the info if valid.

Args:

  • extension: The discovery extension to validate and extract

Returns:

  • ValidationResult with the discovery info if valid

Example:

extension, _ := bazaar.DeclareDiscoveryExtension(...)
result := bazaar.ValidateAndExtract(extension)

if result.Valid {
    // Use result.Info
} else {
    fmt.Println("Validation errors:", result.Errors)
}

func ValidateDiscoveryExtension(extension types.DiscoveryExtension) ValidationResult

Source: extensions/bazaar/facilitator.go:76

ValidateDiscoveryExtension validates a discovery extension's info against its schema

Args:

  • extension: The discovery extension containing info and schema

Returns:

  • ValidationResult indicating if the info matches the schema

Example:

extension, _ := bazaar.DeclareDiscoveryExtension(...)
result := bazaar.ValidateDiscoveryExtension(extension)

if result.Valid {
    fmt.Println("Extension is valid")
} else {
    fmt.Println("Validation errors:", result.Errors)
}

func ValidateDiscoveryExtensionSpec(extension types.DiscoveryExtension) ValidationResult

Source: extensions/bazaar/facilitator.go:149

ValidateDiscoveryExtensionSpec validates a discovery extension against the Bazaar protocol specification. Unlike ValidateDiscoveryExtension which checks internal consistency (info vs schema), this function enforces protocol-level invariants:

  • info.input.type must be "http" or "mcp"
  • HTTP: if method is present it must be GET/POST/PUT/PATCH/DELETE/HEAD
  • HTTP body methods: bodyType must be "json", "form-data", or "text"
  • MCP: toolName (string) and inputSchema (object) are required
  • MCP: if transport is present it must be "streamable-http" or "sse"

Safe for pre-enrichment HTTP extensions where method may be absent.

func WithBazaar(client *x402http.HTTPFacilitatorClient) *BazaarFacilitatorClient

Source: extensions/bazaar/facilitator_client.go:171

WithBazaar extends a facilitator client with bazaar discovery query functionality.

Example:

client := bazaar.WithBazaar(http.NewHTTPFacilitatorClient(nil))
resources, err := client.ListDiscoveryResources(ctx, &bazaar.ListDiscoveryResourcesParams{
    Type: "http",
    Limit: 20,
})
results, err := client.SearchDiscoveryResources(ctx, &bazaar.SearchDiscoveryResourcesParams{
    Query: "weather APIs",
})

Types

type BazaarFacilitatorClient

Source: extensions/bazaar/facilitator_client.go:155

BazaarFacilitatorClient wraps an HTTPFacilitatorClient with bazaar discovery query functionality. It preserves all original facilitator client capabilities (Verify, Settle, GetSupported) and adds the ability to list and search discovered x402 resources from the facilitator's bazaar.

type BazaarFacilitatorClient struct {
	*x402http.HTTPFacilitatorClient
}
Fields
  • *x402http.HTTPFacilitatorClient

func ListDiscoveryResources( ctx context.Context, params *ListDiscoveryResourcesParams, ) (*DiscoveryResourcesResponse, error)

Source: extensions/bazaar/facilitator_client.go:179

ListDiscoveryResources queries the facilitator's /discovery/resources endpoint to list x402 discovery resources from the bazaar.

Params may be nil to list all resources without filtering.

func SearchDiscoveryResources( ctx context.Context, params *SearchDiscoveryResourcesParams, ) (*SearchDiscoveryResourcesResponse, error)

Source: extensions/bazaar/facilitator_client.go:241

SearchDiscoveryResources queries the facilitator's /discovery/search endpoint to search x402 discovery resources from the bazaar using a natural-language query.

Pagination is optional: facilitators may ignore Limit/Cursor in params, or include response.pagination when pagination is used.

type BodyDiscoveryExtension

Source: extensions/bazaar/types.go:45

Re-export types

type BodyDiscoveryExtension = types.BodyDiscoveryExtension

type BodyDiscoveryInfo

Source: extensions/bazaar/types.go:39

Re-export types

type BodyDiscoveryInfo = types.BodyDiscoveryInfo

type BodyInput

Source: extensions/bazaar/types.go:40

Re-export types

type BodyInput = types.BodyInput

type BodyMethods

Source: extensions/bazaar/types.go:35

Re-export types

type BodyMethods = types.BodyMethods

type BodyType

Source: extensions/bazaar/types.go:36

Re-export types

type BodyType = types.BodyType

type DeclareDiscoveryExtensionOpts

Source: extensions/bazaar/resource_service.go:59

DeclareDiscoveryExtension creates a discovery extension for any HTTP method

This function helps servers declare how their endpoint should be called, including the expected input parameters/body and output format.

Args:

  • method: HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD)
  • input: Example input data (query params for GET/HEAD/DELETE, body for POST/PUT/PATCH)
  • inputSchema: JSON Schema for the input
  • bodyType: Body type for POST/PUT/PATCH methods (optional, defaults to "json")
  • output: Output configuration (optional)

Returns:

  • DiscoveryExtension with both info and schema

Example:

// For a GET endpoint with query params
extension, err := bazaar.DeclareDiscoveryExtension(
    bazaar.MethodGET,
    map[string]interface{}{"query": "example"},
    bazaar.JSONSchema{
        "properties": map[string]interface{}{
            "query": map[string]interface{}{"type": "string"},
        },
        "required": []string{"query"},
    },
    "",
    nil,
)

// For a POST endpoint with JSON body
extension, err := bazaar.DeclareDiscoveryExtension(
    bazaar.MethodPOST,
    map[string]interface{}{"name": "John", "age": 30},
    bazaar.JSONSchema{
        "properties": map[string]interface{}{
            "name": map[string]interface{}{"type": "string"},
            "age": map[string]interface{}{"type": "number"},
        },
        "required": []string{"name"},
    },
    bazaar.BodyTypeJSON,
    &bazaar.OutputConfig{
        Example: map[string]interface{}{"success": true, "id": "123"},
    },
)

DeclareDiscoveryExtensionOpts holds optional parameters for DeclareDiscoveryExtension.

type DeclareDiscoveryExtensionOpts struct {
	PathParamsSchema types.JSONSchema
}
Fields
  • PathParamsSchema types.JSONSchema

type DeclareMcpDiscoveryConfig

Source: extensions/bazaar/types.go:52

Re-export types

type DeclareMcpDiscoveryConfig = types.DeclareMcpDiscoveryConfig

type DiscoveredResource

Source: extensions/bazaar/facilitator.go:223

type DiscoveredResource struct {
	ResourceURL   string
	Method        string
	ToolName      string
	X402Version   int
	DiscoveryInfo *types.DiscoveryInfo
	Description   string
	MimeType      string
	RouteTemplate string
	// Sanitized service metadata. See SanitizeResourceServiceMetadata for rules.
	ServiceName string
	Tags        []string
	IconUrl     string
	Extensions  map[string]any
}
Fields
  • ResourceURL string
  • Method string
  • ToolName string
  • X402Version int
  • DiscoveryInfo *types.DiscoveryInfo
  • Description string
  • MimeType string
  • RouteTemplate string
  • ServiceName string

    Sanitized service metadata. See SanitizeResourceServiceMetadata for rules.

  • Tags []string
  • IconUrl string
  • Extensions map[string]any

func InputType() string

Source: extensions/bazaar/facilitator.go:240

InputType returns the protocol type from discovery info (e.g. "http", "mcp").

type DiscoveryExtension

Source: extensions/bazaar/types.go:46

Re-export types

type DiscoveryExtension = types.DiscoveryExtension

type DiscoveryInfo

Source: extensions/bazaar/types.go:42

Re-export types

type DiscoveryInfo = types.DiscoveryInfo

type DiscoveryResource

Source: extensions/bazaar/facilitator_client.go:68

DiscoveryResource represents a discovered x402 resource from the bazaar.

type DiscoveryResource struct {
	// Resource is the URL or identifier of the discovered resource.
	Resource string `json:"resource"`

	// Type is the protocol type of the resource (e.g., "http").
	Type string `json:"type"`

	// X402Version is the x402 protocol version supported by this resource.
	X402Version int `json:"x402Version"`

	// Accepts is an array of accepted payment methods for this resource.
	Accepts []json.RawMessage `json:"accepts"`

	// LastUpdated is an ISO 8601 timestamp of when the resource was last updated.
	LastUpdated string `json:"lastUpdated"`

	// Description is a human-readable description of the resource.
	Description string `json:"description,omitempty"`

	// MimeType is the MIME type of the resource response.
	MimeType string `json:"mimeType,omitempty"`

	// ServiceName is a human-readable name for the service hosting the resource.
	ServiceName string `json:"serviceName,omitempty"`

	// Tags are short topical tags for discovery search.
	Tags []string `json:"tags,omitempty"`

	// IconUrl is an absolute http(s) URL to a service icon.
	IconUrl string `json:"iconUrl,omitempty"`

	// Extensions contains extension payloads echoed from discovery (e.g. bazaar info/schema).
	Extensions map[string]any `json:"extensions,omitempty"`
}
Fields
  • Resource string `json:"resource"`

    Resource is the URL or identifier of the discovered resource.

  • Type string `json:"type"`

    Type is the protocol type of the resource (e.g., "http").

  • X402Version int `json:"x402Version"`

    X402Version is the x402 protocol version supported by this resource.

  • Accepts []json.RawMessage `json:"accepts"`

    Accepts is an array of accepted payment methods for this resource.

  • LastUpdated string `json:"lastUpdated"`

    LastUpdated is an ISO 8601 timestamp of when the resource was last updated.

  • Description string `json:"description,omitempty"`

    Description is a human-readable description of the resource.

  • MimeType string `json:"mimeType,omitempty"`

    MimeType is the MIME type of the resource response.

  • ServiceName string `json:"serviceName,omitempty"`

    ServiceName is a human-readable name for the service hosting the resource.

  • Tags []string `json:"tags,omitempty"`

    Tags are short topical tags for discovery search.

  • IconUrl string `json:"iconUrl,omitempty"`

    IconUrl is an absolute http(s) URL to a service icon.

  • Extensions map[string]any `json:"extensions,omitempty"`

    Extensions contains extension payloads echoed from discovery (e.g. bazaar info/schema).

type DiscoveryResourcesResponse

Source: extensions/bazaar/facilitator_client.go:116

DiscoveryResourcesResponse is the response from listing discovery resources.

type DiscoveryResourcesResponse struct {
	// X402Version is the x402 protocol version of this response.
	X402Version int `json:"x402Version"`

	// Items is the list of discovered resources.
	Items []DiscoveryResource `json:"items"`

	// Pagination contains pagination information for the response.
	Pagination Pagination `json:"pagination"`
}
Fields
  • X402Version int `json:"x402Version"`

    X402Version is the x402 protocol version of this response.

  • Items []DiscoveryResource `json:"items"`

    Items is the list of discovered resources.

  • Pagination Pagination `json:"pagination"`

    Pagination contains pagination information for the response.

type JSONSchema

Source: extensions/bazaar/types.go:43

Re-export types

type JSONSchema = types.JSONSchema

type ListDiscoveryResourcesParams

Source: extensions/bazaar/facilitator_client.go:17

ListDiscoveryResourcesParams contains optional filtering and pagination parameters for listing discovery resources from a facilitator's bazaar.

type ListDiscoveryResourcesParams struct {
	// Type filters by protocol type (e.g., "http", "mcp").
	Type string

	// PayTo filters by payment recipient address.
	PayTo string

	// Scheme filters by payment scheme (e.g., "exact").
	Scheme string

	// Network filters by payment network (e.g., "eip155:8453").
	Network string

	// Extensions filters by extension key present on the discovered resource.
	Extensions string

	// Limit is the number of discovered x402 resources to return per page.
	Limit int

	// Offset is the offset of the first discovered x402 resource to return.
	Offset int
}
Fields
  • Type string

    Type filters by protocol type (e.g., "http", "mcp").

  • PayTo string

    PayTo filters by payment recipient address.

  • Scheme string

    Scheme filters by payment scheme (e.g., "exact").

  • Network string

    Network filters by payment network (e.g., "eip155:8453").

  • Extensions string

    Extensions filters by extension key present on the discovered resource.

  • Limit int

    Limit is the number of discovered x402 resources to return per page.

  • Offset int

    Offset is the offset of the first discovered x402 resource to return.

type McpDiscoveryExtension

Source: extensions/bazaar/types.go:51

Re-export types

type McpDiscoveryExtension = types.McpDiscoveryExtension

type McpDiscoveryInfo

Source: extensions/bazaar/types.go:50

Re-export types

type McpDiscoveryInfo = types.McpDiscoveryInfo

type McpInput

Source: extensions/bazaar/types.go:49

Re-export types

type McpInput = types.McpInput

type McpTransport

Source: extensions/bazaar/types.go:48

Re-export types

type McpTransport = types.McpTransport

type OutputConfig

Source: extensions/bazaar/types.go:47

Re-export types

type OutputConfig = types.OutputConfig

type OutputInfo

Source: extensions/bazaar/types.go:41

Re-export types

type OutputInfo = types.OutputInfo

type Pagination

Source: extensions/bazaar/facilitator_client.go:104

Pagination contains pagination information for a discovery resources response.

type Pagination struct {
	// Limit is the maximum number of results returned.
	Limit int `json:"limit"`

	// Offset is the number of results skipped.
	Offset int `json:"offset"`

	// Total is the total count of resources matching the query.
	Total int `json:"total"`
}
Fields
  • Limit int `json:"limit"`

    Limit is the maximum number of results returned.

  • Offset int `json:"offset"`

    Offset is the number of results skipped.

  • Total int `json:"total"`

    Total is the total count of resources matching the query.

type QueryDiscoveryExtension

Source: extensions/bazaar/types.go:44

Re-export types

type QueryDiscoveryExtension = types.QueryDiscoveryExtension

type QueryDiscoveryInfo

Source: extensions/bazaar/types.go:37

Re-export types

type QueryDiscoveryInfo = types.QueryDiscoveryInfo

type QueryInput

Source: extensions/bazaar/types.go:38

Re-export types

type QueryInput = types.QueryInput

type QueryParamMethods

Source: extensions/bazaar/types.go:34

Re-export types

type QueryParamMethods = types.QueryParamMethods

type SanitizedResourceServiceMetadata

Source: extensions/bazaar/facilitator.go:677

SanitizedResourceServiceMetadata holds the surviving service metadata fields after applying the soft-drop validation rules. Mirrors the SanitizedResourceServiceMetadata type in TypeScript and the SanitizedResourceServiceMetadata dataclass in Python.

type SanitizedResourceServiceMetadata struct {
	ServiceName string
	Tags        []string
	IconUrl     string
}
Fields
  • ServiceName string
  • Tags []string
  • IconUrl string

type SearchDiscoveryResourcesParams

Source: extensions/bazaar/facilitator_client.go:41

SearchDiscoveryResourcesParams contains parameters for searching discovery resources.

type SearchDiscoveryResourcesParams struct {
	// Query is the natural-language search query (required).
	Query string

	// Type filters by protocol type (e.g., "http", "mcp").
	Type string

	// PayTo filters by payment recipient address.
	PayTo string

	// Scheme filters by payment scheme (e.g., "exact").
	Scheme string

	// Network filters by payment network (e.g., "eip155:8453").
	Network string

	// Extensions filters by extension key present on the discovered resource.
	Extensions string

	// Limit is an advisory maximum number of results. The server may return fewer or ignore this.
	Limit int

	// Cursor is an advisory continuation token from a previous response. The server may ignore this.
	Cursor string
}
Fields
  • Query string

    Query is the natural-language search query (required).

  • Type string

    Type filters by protocol type (e.g., "http", "mcp").

  • PayTo string

    PayTo filters by payment recipient address.

  • Scheme string

    Scheme filters by payment scheme (e.g., "exact").

  • Network string

    Network filters by payment network (e.g., "eip155:8453").

  • Extensions string

    Extensions filters by extension key present on the discovered resource.

  • Limit int

    Limit is an advisory maximum number of results. The server may return fewer or ignore this.

  • Cursor string

    Cursor is an advisory continuation token from a previous response. The server may ignore this.

type SearchDiscoveryResourcesResponse

Source: extensions/bazaar/facilitator_client.go:137

SearchDiscoveryResourcesResponse is the response from searching discovery resources.

type SearchDiscoveryResourcesResponse struct {
	// X402Version is the x402 protocol version of this response.
	X402Version int `json:"x402Version"`

	// Resources is the list of matching discovered resources.
	Resources []DiscoveryResource `json:"resources"`

	// PartialResults indicates additional matches were truncated by facilitator.
	PartialResults bool `json:"partialResults,omitempty"`

	// Pagination contains optional pagination details for paginated responses.
	Pagination *SearchPagination `json:"pagination,omitempty"`
}
Fields
  • X402Version int `json:"x402Version"`

    X402Version is the x402 protocol version of this response.

  • Resources []DiscoveryResource `json:"resources"`

    Resources is the list of matching discovered resources.

  • PartialResults bool `json:"partialResults,omitempty"`

    PartialResults indicates additional matches were truncated by facilitator.

  • Pagination *SearchPagination `json:"pagination,omitempty"`

    Pagination contains optional pagination details for paginated responses.

type SearchPagination

Source: extensions/bazaar/facilitator_client.go:128

SearchPagination describes pagination details for a paginated search response.

type SearchPagination struct {
	// Limit is the number of results in this page.
	Limit int `json:"limit"`

	// Cursor is a continuation token for the next page; may be nil.
	Cursor *string `json:"cursor"`
}
Fields
  • Limit int `json:"limit"`

    Limit is the number of results in this page.

  • Cursor *string `json:"cursor"`

    Cursor is a continuation token for the next page; may be nil.

type ValidationResult

Source: extensions/bazaar/facilitator.go:21

ValidationResult represents the result of validating a discovery extension

type ValidationResult struct {
	Valid  bool
	Errors []string
}
Fields
  • Valid bool
  • Errors []string