{
  "openapi": "3.1.0",
  "info": {
    "title": "Nishvault x402 Pre-Send Guard",
    "version": "1.2.0",
    "description": "Machine-readable discovery for Nishvault read-only Base preflight and public-page evidence services."
  },
  "servers": [
    {
      "url": "https://x402-discovery.nishvault.com"
    }
  ],
  "paths": {
    "/payanagent/v1/public-page-evidence": {
      "post": {
        "operationId": "nishvaultPublicPageEvidence",
        "summary": "Convert one public URL to bounded LLM-ready markdown",
        "description": "Uses Jina Reader, returns bounded markdown plus a SHA-256 evidence hash, and rejects local/private literal targets and nonstandard ports.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {"type": "string", "format": "uri"},
                  "max_chars": {"type": "integer", "minimum": 500, "maximum": 20000, "default": 20000}
                },
                "required": ["url"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {"description": "Bounded markdown, title, source URL, truncation flag, and SHA-256 hash."},
          "422": {"description": "Unsafe or invalid input."},
          "502": {"description": "Reader upstream temporarily unavailable."}
        }
      }
    },
    "/payanagent/v1/base-transaction-preflight": {
      "post": {
        "operationId": "nishvaultReadOnlyBasePreflight",
        "summary": "Check revert, gas, and calldata risk on Base",
        "description": "Runs only eth_call and eth_estimateGas against Base mainnet, adds a deterministic risk screen, and never broadcasts.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chainId": {"type": "string", "const": "0x2105"},
                  "from": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"},
                  "to": {"type": "string", "pattern": "^0x[a-fA-F0-9]{40}$"},
                  "data": {"type": "string", "pattern": "^0x(?:[a-fA-F0-9]{2})*$"},
                  "value": {"type": "string", "pattern": "^0x[0-9a-fA-F]+$"}
                },
                "required": ["from", "to", "data"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {"description": "Read-only call result, gas estimate, and sign/review/block verdict."},
          "422": {"description": "Invalid or blocked transaction input."},
          "503": {"description": "Base RPC temporarily unavailable."}
        }
      }
    },
    "/simulate/transaction-preflight": {
      "post": {
        "operationId": "nishvaultTransactionPreflight",
        "summary": "Run a paid pre-send transaction simulation",
        "description": "Returns a $0.01 Base USDC x402 v2 payment challenge when called without payment. It simulates only and never broadcasts a transaction.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "chainId": {
                    "type": "string",
                    "description": "Base mainnet chain ID in hexadecimal.",
                    "example": "0x2105"
                  },
                  "from": {
                    "type": "string",
                    "description": "EVM sender address used for simulation.",
                    "pattern": "^0x[a-fA-F0-9]{40}$",
                    "example": "0x1111111111111111111111111111111111111111"
                  },
                  "to": {
                    "type": "string",
                    "description": "EVM destination address used for simulation.",
                    "pattern": "^0x[a-fA-F0-9]{40}$",
                    "example": "0x2222222222222222222222222222222222222222"
                  },
                  "data": {
                    "type": "string",
                    "description": "Hexadecimal EVM calldata.",
                    "pattern": "^0x(?:[a-fA-F0-9]{2})*$",
                    "example": "0x"
                  },
                  "value": {
                    "type": "string",
                    "description": "Optional hexadecimal wei value.",
                    "example": "0x0"
                  }
                },
                "required": [
                  "from",
                  "to",
                  "data"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "402": {
            "description": "x402 v2 payment challenge for $0.01 Base USDC."
          },
          "200": {
            "description": "Paid preflight result and proof receipt."
          }
        }
      }
    }
  }
}
