{
 "openapi": "3.1.0",
 "info": {
  "title": "Foundry x402 data endpoints",
  "version": "1.0.0",
  "description": "Pay-per-call data products over x402 (HTTP 402 + USDC). No account, no API key: call the URL, read the 402 challenge, pay, retry."
 },
 "servers": [
  {
   "url": "https://api.darangilau.com"
  }
 ],
 "paths": {
  "/contract-code-hash": {
   "get": {
    "summary": "Contract Code Identity",
    "description": "Check a deployed contract's code identity - keccak256 code hash read from the node via eth_getProof, confirmed on a second independent node, plus EIP-1167/1967/1822 proxy resolution.",
    "operationId": "contract_code_hash",
    "parameters": [
     {
      "name": "address",
      "in": "query",
      "required": true,
      "description": "contract address to check",
      "schema": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{40}$"
      }
     },
     {
      "name": "chain",
      "in": "query",
      "required": false,
      "description": "",
      "schema": {
       "type": "string",
       "enum": [
        "base",
        "ethereum"
       ],
       "default": "base"
      }
     },
     {
      "name": "expected",
      "in": "query",
      "required": false,
      "description": "optional: the keccak256 code hash you expect, e.g. from your audit report or a prior verification",
      "schema": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{64}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Paid result.",
      "content": {
       "application/json": {
        "example": {
         "chain": "base",
         "chain_id": 8453,
         "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
         "is_contract": true,
         "code_size_bytes": 1852,
         "code_hash": "0xa6705a10bb756b5dea144591118b0ee0c3f0b4b2c0b0e0d0\u2026",
         "hash_confirmations": 2,
         "hash_disagreement": false,
         "proxy": {
          "type": "legacy_openzeppelin_proxy",
          "implementation": "0x2ce6311ddae708829bc0784c967b7d77d19fd779"
         },
         "expected_match": null,
         "block_number": 49460000,
         "as_of": "2026-08-02T12:00:00Z",
         "scope": "Deployed-bytecode identity from public RPC. A hash match means the code IS what you named - NOT that it is safe."
        }
       }
      }
     },
     "402": {
      "description": "Payment required: $0.01 USDC on base. The x402 PaymentRequired object is in the PAYMENT-REQUIRED response header (base64 JSON) and in the body. Pay, then retry the same request with an X-PAYMENT header."
     },
     "400": {
      "description": "Invalid or missing query parameters."
     }
    }
   }
  },
  "/surplus-sold-comps": {
   "get": {
    "summary": "Surplus Sold Comps",
    "description": "Sold-price comps for US government surplus - closed GSA auction lots matching an item query, with hammer prices, bidder counts, dates and locations, from a daily-archived lot history.",
    "operationId": "surplus_sold_comps",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "description": "item keywords, e.g. 'dell laptop', 'ford f-150', 'cisco switch'",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "description": "",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 100,
       "default": 20
      }
     },
     {
      "name": "days",
      "in": "query",
      "required": false,
      "description": "look-back window in days",
      "schema": {
       "type": "integer",
       "default": 365
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Paid result.",
      "content": {
       "application/json": {
        "example": {
         "query": "dell laptop",
         "sample_size": 16,
         "comps": [
          {
           "item_name": "Dell Laptops",
           "hammer_usd": 1005.0,
           "bidders": 6,
           "closed_at": "2026-07-21T12:45:02+00:00",
           "city": "CAROLINA",
           "state": "PR",
           "agency": "Bureau of Land Management",
           "url": "https://www.gsaauctions.gov/auctions/preview/370246"
          }
         ],
         "hammer_stats": {
          "mean": 601.33,
          "median": 557.5,
          "min": 10.0,
          "max": 1272.0
         },
         "window_days": 365,
         "as_of": "2026-07-31T21:00:00+00:00",
         "scope": "GSA Auctions archive; hammer = last observed high bid before close (proxy, not settlement invoice)",
         "unmodeled_factors": [
          "condition/damage",
          "lot quantity variations",
          "pickup logistics",
          "reserve not met cases"
         ]
        }
       }
      }
     },
     "402": {
      "description": "Payment required: $0.02 USDC on base. The x402 PaymentRequired object is in the PAYMENT-REQUIRED response header (base64 JSON) and in the body. Pay, then retry the same request with an X-PAYMENT header."
     },
     "400": {
      "description": "Invalid or missing query parameters."
     }
    }
   }
  },
  "/wallet-revenue-authenticity": {
   "get": {
    "summary": "Wallet Revenue Authenticity",
    "description": "Score whether an x402 seller wallet's revenue is real - distinct payers, repeat share, calls per payer, self-pay and round-trip flags, from Base USDC settlement history on chain.",
    "operationId": "wallet_revenue_authenticity",
    "parameters": [
     {
      "name": "address",
      "in": "query",
      "required": true,
      "description": "EVM address of the seller wallet (payTo) to score",
      "schema": {
       "type": "string",
       "pattern": "^0x[a-fA-F0-9]{40}$"
      }
     },
     {
      "name": "days",
      "in": "query",
      "required": false,
      "description": "",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 90,
       "default": 30
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Paid result.",
      "content": {
       "application/json": {
        "example": {
         "address": "0x2b6d4988db4723e6908db86ab2b8dfbc51fc32c5",
         "settles_30d": 4438,
         "distinct_payers": 203,
         "repeat_share": 0.734,
         "calls_per_payer": 21.86,
         "method_split": {
          "x402_settles": 4438,
          "direct_transfers": 0
         },
         "total_usd_in": 9.02,
         "median_usd": 0.0012,
         "circularity_flags": {
          "self_pay_count": 0,
          "round_trip_payers": 0,
          "detected": false
         },
         "concentration": "diverse",
         "temporal": "steady",
         "revenue_age_days": 9,
         "sample_window_days": 30,
         "data_indexed": true,
         "scope": "Base USDC settlement history from our local index; data_indexed=false means UNKNOWN, not innocent"
        }
       }
      }
     },
     "402": {
      "description": "Payment required: $0.05 USDC on base. The x402 PaymentRequired object is in the PAYMENT-REQUIRED response header (base64 JSON) and in the body. Pay, then retry the same request with an X-PAYMENT header."
     },
     "400": {
      "description": "Invalid or missing query parameters."
     }
    }
   }
  },
  "/health": {
   "get": {
    "summary": "Liveness",
    "operationId": "health",
    "responses": {
     "200": {
      "description": "ok"
     }
    }
   }
  }
 }
}