{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vibekast-xyz/json-schema/vibekast-xyz-order-schema.json",
  "title": "Order",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vibekast-xyz-openapi.json#/components/schemas/Order",
  "type": "object",
  "properties": {
    "chainId": {
      "type": "number",
      "const": 84532
    },
    "market": {
      "$ref": "#/$defs/Address"
    },
    "quote": {
      "type": "object",
      "properties": {
        "cost": {
          "$ref": "#/$defs/Decimal"
        },
        "fee": {
          "$ref": "#/$defs/Decimal"
        },
        "total": {
          "$ref": "#/$defs/Decimal"
        }
      },
      "required": [
        "cost",
        "fee",
        "total"
      ],
      "additionalProperties": false,
      "description": "Quoted on-chain just now, in tUSDC."
    },
    "maxCost": {
      "description": "The most the buy can cost, slippage included, in tUSDC.",
      "$ref": "#/$defs/Decimal"
    },
    "maxCostWad": {
      "$ref": "#/$defs/WadInteger"
    },
    "shares": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Decimal"
      },
      "description": "Shares bought per price range, in index order."
    },
    "sharesWad": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WadInteger"
      }
    },
    "activeRanges": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "transactions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Transaction"
      },
      "description": "Sign and send in order: approve (when needed), then buy."
    },
    "wallet": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "address": {
              "$ref": "#/$defs/Address"
            },
            "balance": {
              "$ref": "#/$defs/Decimal"
            },
            "allowance": {
              "$ref": "#/$defs/Decimal"
            },
            "needsApproval": {
              "type": "boolean"
            },
            "enoughBalance": {
              "type": "boolean"
            }
          },
          "required": [
            "address",
            "balance",
            "allowance",
            "needsApproval",
            "enoughBalance"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "note": {
      "type": "string"
    }
  },
  "required": [
    "chainId",
    "market",
    "quote",
    "maxCost",
    "maxCostWad",
    "shares",
    "sharesWad",
    "activeRanges",
    "transactions",
    "wallet",
    "note"
  ],
  "additionalProperties": false,
  "$defs": {
    "Address": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$",
      "description": "0x-prefixed 20-byte address."
    },
    "Decimal": {
      "type": "string",
      "pattern": "^-?\\d+(\\.\\d+)?$",
      "description": "Exact decimal number as a string, e.g. \"0.0279\" or \"77000\". Converted directly from the 18-decimal on-chain integer, never through a float."
    },
    "Transaction": {
      "type": "object",
      "properties": {
        "to": {
          "$ref": "#/$defs/Address"
        },
        "data": {
          "type": "string",
          "pattern": "^0x[0-9a-fA-F]*$",
          "description": "ABI-encoded calldata."
        },
        "value": {
          "type": "string",
          "const": "0",
          "description": "ETH to send with the call. Always zero."
        },
        "description": {
          "type": "string"
        }
      },
      "required": [
        "to",
        "data",
        "value",
        "description"
      ],
      "additionalProperties": false,
      "description": "An unsigned transaction. Sign and send it from your own wallet on chain 84532."
    },
    "WadInteger": {
      "type": "string",
      "pattern": "^\\d+$",
      "description": "Integer in 18-decimal base units, as a string. 1 tUSDC = 1000000000000000000."
    }
  }
}