{
  "$defs": {
    "CauldronQuote": {
      "additionalProperties": false,
      "description": "A token↔BCH route: input and output amounts, the market price before and after the trade, and the number of pools it routes through. Build the transaction with tx.build.",
      "properties": {
        "input_amount": {
          "description": "Total input amount (integer string, base units).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "input_is_bch": {
          "description": "True if the input is BCH.",
          "type": "boolean"
        },
        "kind": {
          "const": "cauldron"
        },
        "market_post_price": {
          "description": "Market price after the trade (engine decimal string).",
          "type": "string"
        },
        "market_pre_price": {
          "description": "Market spot price before the trade (engine decimal string).",
          "type": "string"
        },
        "output_amount": {
          "description": "Total output amount (integer string, base units).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "output_is_bch": {
          "description": "True if the output is BCH.",
          "type": "boolean"
        },
        "pools": {
          "description": "How many pools the trade routes through.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "input_amount",
        "input_is_bch",
        "output_amount",
        "output_is_bch",
        "market_pre_price",
        "market_post_price",
        "pools"
      ],
      "type": "object"
    },
    "CombinedQuote": {
      "additionalProperties": false,
      "description": "A token↔token route (direct and/or via BCH): the amount sold, the amount received, and the number of pools it routes through. Build the transaction with tx.build.",
      "properties": {
        "kind": {
          "const": "combined"
        },
        "pools": {
          "description": "How many pools the trade routes through.",
          "minimum": 1,
          "type": "integer"
        },
        "token_a_in": {
          "description": "Total token A consumed (integer string, base units).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "token_b_out": {
          "description": "Total token B produced (integer string, base units).",
          "pattern": "^[0-9]+$",
          "type": "string"
        }
      },
      "required": [
        "kind",
        "token_a_in",
        "token_b_out",
        "pools"
      ],
      "type": "object"
    },
    "FundingInput": {
      "additionalProperties": false,
      "description": "A user-supplied funding UTXO.",
      "properties": {
        "script_hex": {
          "description": "The UTXO's scriptPubKey in hex.",
          "type": "string"
        },
        "token": {
          "$ref": "#/$defs/FundingToken"
        },
        "txid": {
          "description": "Funding UTXO txid in display-order hex (32 bytes).",
          "pattern": "^[0-9a-fA-F]{64}$",
          "type": "string"
        },
        "value": {
          "description": "UTXO value in sats (integer string, JS-safe). Must be > 0.",
          "pattern": "^[1-9][0-9]*$",
          "type": "string"
        },
        "vout": {
          "description": "Output index within the funding transaction.",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "txid",
        "vout",
        "value",
        "script_hex"
      ],
      "type": "object"
    },
    "FundingToken": {
      "additionalProperties": false,
      "description": "CashToken payload of a funding UTXO.",
      "properties": {
        "amount": {
          "description": "Token amount in base units (integer string). Must be > 0.",
          "pattern": "^[1-9][0-9]*$",
          "type": "string"
        },
        "category": {
          "description": "Token category in display-order hex (32 bytes).",
          "pattern": "^[0-9a-fA-F]{64}$",
          "type": "string"
        }
      },
      "required": [
        "category",
        "amount"
      ],
      "type": "object"
    },
    "SourceOutput": {
      "additionalProperties": false,
      "description": "A prevout, index-aligned to a tx input, for WizardConnect whole-tx signing.",
      "properties": {
        "locking_script_hex": {
          "description": "Locking script in hex.",
          "type": "string"
        },
        "token": {
          "$ref": "#/$defs/SourceToken"
        },
        "value": {
          "description": "Prevout value in sats (integer string).",
          "pattern": "^[0-9]+$",
          "type": "string"
        }
      },
      "required": [
        "value",
        "locking_script_hex"
      ],
      "type": "object"
    },
    "SourceToken": {
      "additionalProperties": false,
      "description": "Token payload of a SourceOutput (category display-order hex, amount string).",
      "properties": {
        "amount": {
          "description": "Token amount (integer string, base units). Must be > 0.",
          "pattern": "^[1-9][0-9]*$",
          "type": "string"
        },
        "category": {
          "description": "Token category (display-order hex, 32 bytes).",
          "pattern": "^[0-9a-fA-F]{64}$",
          "type": "string"
        }
      },
      "required": [
        "category",
        "amount"
      ],
      "type": "object"
    },
    "WrappedQuote": {
      "additionalProperties": false,
      "description": "A BCH↔token route through Wrapped BCH: input and output amounts (native BCH on the BCH side) and the number of pools it routes through. Build the transaction with tx.build.",
      "properties": {
        "input_amount": {
          "description": "Total input amount (integer string, base units; native BCH on the BCH side).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "input_is_bch": {
          "description": "True if the input is BCH.",
          "type": "boolean"
        },
        "kind": {
          "const": "wrapped"
        },
        "output_amount": {
          "description": "Total output amount (integer string, base units; native BCH on the BCH side).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "output_is_bch": {
          "description": "True if the output is BCH.",
          "type": "boolean"
        },
        "pools": {
          "description": "How many pools the trade routes through.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "input_amount",
        "input_is_bch",
        "output_amount",
        "output_is_bch",
        "pools"
      ],
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Server-pushed notification with a freshly assembled unsigned tx when a subscribed build's pools move. `params` is the same shape as a tx.build result.",
  "properties": {
    "method": {
      "const": "tx.update"
    },
    "params": {
      "additionalProperties": false,
      "properties": {
        "expected_output": {
          "description": "Expected bought-asset amount, slippage reference (integer string).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "fee_sats": {
          "description": "Router fee output value in sats (token↔BCH path). `\"0\"` when fee is in tokens or none.",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "fee_token_amount": {
          "description": "Router fee in the sold token's base units (token↔token path). `\"0\"` when fee is in BCH or none.",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "inputs_to_sign": {
          "description": "Input indices the client signs (funding inputs; preimage mode).",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "miner_fee_sats": {
          "description": "Estimated miner fee in sats (integer string).",
          "pattern": "^[0-9]+$",
          "type": "string"
        },
        "route": {
          "description": "The route the build was assembled for (coarse public view).",
          "oneOf": [
            {
              "$ref": "#/$defs/CauldronQuote"
            },
            {
              "$ref": "#/$defs/CombinedQuote"
            },
            {
              "$ref": "#/$defs/WrappedQuote"
            }
          ]
        },
        "source_outputs": {
          "description": "Prevouts index-aligned to tx inputs (WizardConnect whole-tx signing).",
          "items": {
            "$ref": "#/$defs/SourceOutput"
          },
          "type": "array"
        },
        "unsigned_tx_hex": {
          "description": "The unsigned transaction in hex. The client signs and broadcasts this.",
          "type": "string"
        }
      },
      "required": [
        "unsigned_tx_hex",
        "source_outputs",
        "inputs_to_sign",
        "expected_output",
        "fee_sats",
        "fee_token_amount",
        "miner_fee_sats",
        "route"
      ],
      "type": "object"
    }
  },
  "required": [
    "method",
    "params"
  ],
  "title": "TxUpdateNotification",
  "type": "object"
}