Skip to content

[Feature 13] Discovery API #32

@onlyhyde

Description

@onlyhyde

Overview

Implement Well-Known discovery endpoint and supporting APIs for facilitator capabilities.

Implementation Details

Files:

  • internal/api/discovery.go - Discovery types and handlers

Endpoints

Method Path Auth Description
GET /.well-known/x402-facilitator None Full discovery info
GET /networks None Supported networks list
GET /assets None Supported assets list
GET /health None Health check

Discovery Response

type DiscoveryResponse struct {
    Version          string           `json:"version"`
    SupportedChains  []ChainInfo      `json:"supportedChains"`
    Endpoints        EndpointInfo     `json:"endpoints"`
    Capabilities     CapabilitiesInfo `json:"capabilities"`
    Metadata         MetadataInfo     `json:"metadata"`
}

type ChainInfo struct {
    Network         string   `json:"network"`
    ChainName       string   `json:"chainName"`
    SupportedAssets []string `json:"supportedAssets"`
    Status          string   `json:"status"`  // "active", "degraded", "inactive"
}

type CapabilitiesInfo struct {
    SupportedMechanisms []string `json:"supportedMechanisms"`
    SupportsEIP1271     bool     `json:"supportsEIP1271"`
    SupportsERC6492     bool     `json:"supportsERC6492"`
    SupportsPermit2     bool     `json:"supportsPermit2"`
}

type MetadataInfo struct {
    Name        string `json:"name"`
    Description string `json:"description,omitempty"`
    Operator    string `json:"operator,omitempty"`
    Contact     string `json:"contact,omitempty"`
    DocsURL     string `json:"docsUrl,omitempty"`
}

Chain Status Detection

  • Integrate with Circuit Breaker state
  • "active" when circuit is closed
  • "degraded" when circuit is half-open
  • "inactive" when circuit is open

Assets Endpoint

type AssetInfo struct {
    Network  string `json:"network"`
    Address  string `json:"address"`
    Symbol   string `json:"symbol"`
    Decimals int    `json:"decimals"`
    Name     string `json:"name"`
}

// GET /assets?network=eip155:8453

Acceptance Criteria

  • /.well-known/x402-facilitator endpoint
  • /networks endpoint
  • /assets endpoint with optional network filter
  • Chain status from circuit breaker
  • Configurable metadata
  • Unit tests
  • Integration tests

Dependencies

Branch

feature/discovery-api

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions