{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aimeat-io/json-schema/aimeat-io-wallet-schema.json",
  "title": "Wallet",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aimeat-io-economy-api-openapi.yml#/components/schemas/Wallet",
  "type": "object",
  "properties": {
    "@context": {
      "type": "object",
      "description": "JSON-LD context for semantic interoperability",
      "properties": {
        "schema": {
          "type": "string"
        },
        "aimeat": {
          "type": "string"
        }
      }
    },
    "@type": {
      "type": "string",
      "description": "Semantic type annotation"
    },
    "gaii": {
      "$ref": "#/$defs/GAII"
    },
    "balance": {
      "type": "integer"
    },
    "in_escrow": {
      "type": "integer"
    },
    "available": {
      "type": "integer"
    },
    "daily_allowance": {
      "type": "object",
      "properties": {
        "amount": {
          "type": "integer"
        },
        "next_credit_at": {
          "type": "string",
          "format": "date-time"
        },
        "accumulation_cap": {
          "type": "integer"
        }
      }
    },
    "pacing": {
      "type": "object",
      "description": "Whether this node paces metered use by default, to bound how fast agents consume\ncapabilities. `enabled` is true when the operator's default pacing amount is above 0 (0 is\noff and is the shipped default). An offer may declare its own `toll_morsels`, which this\ndoes not describe. Each pacing charge burns the burn rate's share and credits the rest to\nthe provider.\n",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "toll_default": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "pacing_pack": {
      "description": "The pacing capacity this node's operator sells for money, or null when it sells none (the\npack is off while `morsel_policy.pacing_pack_morsels` or `morsel_policy.pacing_pack_price`\nis 0). Buy it by opening a checkout with `checkout_item` as the line item.\n",
      "anyOf": [
        {
          "$ref": "#/$defs/PacingPack"
        },
        {
          "type": "null"
        }
      ]
    },
    "lifetime": {
      "type": "object",
      "description": "Computed from every row kind of the ledger (services/wallet-stats.ts). `earned` is every\npositive row that came from somebody (work, tool calls, sales, offers, fees); the daily pace,\nthe welcome bonus and an operator mint are received, not earned. `unrecorded` is\n`balance − ledger_sum`: what reached the balance without a row, which is what the daily pace\ndoes.\n",
      "properties": {
        "earned": {
          "type": "integer"
        },
        "spent": {
          "type": "integer"
        },
        "received_allowance": {
          "type": "integer"
        },
        "welcome_bonus": {
          "type": "integer"
        },
        "in": {
          "type": "integer",
          "description": "Every positive row, the pace and gifts included."
        },
        "out": {
          "type": "integer",
          "description": "Every negative row, as a positive figure."
        },
        "ledger_sum": {
          "type": "integer",
          "description": "The signed sum of every row."
        },
        "unrecorded": {
          "type": "integer",
          "description": "balance − ledger_sum; what accrued without a row."
        },
        "total_rows": {
          "type": "integer"
        },
        "by_type": {
          "type": "object",
          "description": "One entry per row kind.",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer"
              },
              "sum": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "GAII": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]#[a-z0-9][a-z0-9-]{0,38}[a-z0-9]@[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$"
    },
    "PacingPack": {
      "type": "object",
      "description": "Pacing capacity the operator sells for money. Set by `morsel_policy.pacing_pack_morsels`, `morsel_policy.pacing_pack_price` and `morsel_policy.pacing_pack_currency`. Fulfilment adds the morsels to the buyer's owner, inside the node's daily mint ceiling (`AIMEAT_MAX_OPERATOR_MINT_PER_DAY`, counted together with operator mints). Past the ceiling the checkout's completion fails and the money goes back.\n",
      "required": [
        "morsels",
        "price",
        "checkout_item"
      ],
      "properties": {
        "morsels": {
          "type": "integer",
          "minimum": 1
        },
        "price": {
          "type": "object",
          "required": [
            "amount",
            "currency"
          ],
          "properties": {
            "amount": {
              "type": "integer",
              "minimum": 1,
              "description": "Money in 6-decimal micro-units (1 EUR = 1000000)."
            },
            "currency": {
              "type": "string",
              "enum": [
                "EUR",
                "USD"
              ]
            }
          }
        },
        "checkout_item": {
          "type": "object",
          "description": "The line item to send in POST /v1/commerce/checkout-sessions `items`.",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "pacing-pack"
              ]
            },
            "quantity": {
              "type": "integer",
              "minimum": 1
            }
          }
        }
      }
    }
  }
}