{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sigelo-io/json-schema/sigelo-io-spend-approval-schema.json",
  "title": "SpendApproval",
  "description": "The keeper-local spend-approval body (apps/keeper/approval.ts; not a SPEC object, no bundle slot accepts it). The approver signs exactly the body the 202 handed out.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sigelo-io-openapi.yaml#/components/schemas/SpendApproval",
  "type": "object",
  "required": [
    "v",
    "typ",
    "keeper",
    "net",
    "agent",
    "ref",
    "to",
    "amount",
    "purpose",
    "nonce",
    "iat",
    "exp"
  ],
  "additionalProperties": false,
  "properties": {
    "v": {
      "const": "sigelo/0"
    },
    "typ": {
      "const": "spend-approval"
    },
    "keeper": {
      "$ref": "../../schema/common.json#/$defs/did"
    },
    "net": {
      "$ref": "#/$defs/Net"
    },
    "agent": {
      "$ref": "../../schema/common.json#/$defs/did"
    },
    "ref": {
      "type": "string",
      "minLength": 1
    },
    "to": {
      "type": "string",
      "description": "The resolved destination address."
    },
    "amount": {
      "$ref": "#/$defs/Atomic"
    },
    "purpose": {
      "type": "string",
      "minLength": 1
    },
    "nonce": {
      "type": "string",
      "pattern": "^[0-9a-f]{32}$"
    },
    "iat": {
      "$ref": "../../schema/common.json#/$defs/unixSeconds"
    },
    "exp": {
      "$ref": "../../schema/common.json#/$defs/unixSeconds"
    }
  },
  "$defs": {
    "Atomic": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)$",
      "description": "Atomic units as a decimal string (1 XMR = 10^12). Never a JSON number."
    },
    "Net": {
      "enum": [
        "mainnet",
        "stagenet",
        "testnet"
      ]
    }
  }
}