{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/debridge-com/json-schema/debridge-com-order-dto-schema.json",
  "title": "OrderDTO",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/debridge-com-orders-api-openapi.yml#/components/schemas/OrderDTO",
  "type": "object",
  "properties": {
    "orderId": {
      "oneOf": [
        {
          "$ref": "#/$defs/StringPropertyDTO"
        },
        {
          "$ref": "#/$defs/TransactionHashPropertyDto"
        }
      ],
      "description": "Unique identifier of the order"
    },
    "makerOrderNonce": {
      "type": "integer",
      "description": "Consecutive unique number of the order for given user in given chain",
      "format": "int64"
    },
    "makerSrc": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "giveOfferWithMetadata": {
      "$ref": "#/$defs/OfferWithMetadataDTO"
    },
    "receiverDst": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "takeOfferWithMetadata": {
      "$ref": "#/$defs/OfferWithMetadataDTO"
    },
    "actualFulfillAmount": {
      "$ref": "#/$defs/IntPropertyDTO"
    },
    "givePatchAuthoritySrc": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "orderAuthorityAddressDst": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "allowedTakerDst": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "allowedCancelBeneficiarySrc": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "state": {
      "$ref": "#/$defs/OrderState"
    },
    "externalCallState": {
      "$ref": "#/$defs/ExternalCallState"
    },
    "referralCode": {
      "type": "integer",
      "description": "Referral program code",
      "format": "int32"
    },
    "percentFee": {
      "$ref": "#/$defs/IntPropertyDTO"
    },
    "finalPercentFee": {
      "$ref": "#/$defs/IntPropertyDTO"
    },
    "fixFee": {
      "$ref": "#/$defs/IntPropertyDTO"
    },
    "unlockBeneficiarySrc": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "cancelBeneficiarySrc": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "taker": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "unlockAuthorityDst": {
      "$ref": "#/$defs/AddressPropertyDTO"
    },
    "affiliateFee": {
      "$ref": "#/$defs/AffiliateFeeDTO"
    },
    "createdSrcEventMetadata": {
      "$ref": "#/$defs/TransactionMetadataDTO"
    },
    "fulfilledDstEventMetadata": {
      "$ref": "#/$defs/TransactionMetadataDTO"
    },
    "sentUnlockDstEventInfo": {
      "$ref": "#/$defs/OrderEventDTO"
    },
    "claimedUnlockSrcEventInfo": {
      "$ref": "#/$defs/OrderEventDTO"
    },
    "orderCancelledDstEventMetadata": {
      "$ref": "#/$defs/TransactionMetadataDTO"
    },
    "sentOrderCancelDstEventInfo": {
      "$ref": "#/$defs/OrderEventDTO"
    },
    "claimedOrderCancelSrcEventInfo": {
      "$ref": "#/$defs/OrderEventDTO"
    },
    "preswapData": {
      "$ref": "#/$defs/SwapExecutedEventDTO"
    },
    "externalCallData": {
      "oneOf": [
        {
          "$ref": "#/$defs/StringPropertyDTO"
        },
        {
          "$ref": "#/$defs/TransactionHashPropertyDto"
        }
      ],
      "description": "External call data. Returns the full external call structure if a fulfill event\nhas been tracked, or the keccak256 hash (32 bytes) if only a create event exists."
    },
    "orderMetadata": {
      "oneOf": [
        {
          "$ref": "#/$defs/OrderRawMetadataDTO"
        },
        {
          "$ref": "#/$defs/OrderParsedMetadataDTO"
        }
      ],
      "description": "Metadata of the order"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "AddressPropertyDTO": {
      "type": "object",
      "properties": {
        "Base64Value": {
          "type": [
            "string",
            "null"
          ],
          "description": "Binary representation of the property value",
          "format": "byte"
        },
        "bytesArrayValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Bytes array representation of the value",
          "readOnly": true
        },
        "stringValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "String representation of the property value",
          "readOnly": true
        }
      },
      "additionalProperties": false
    },
    "AffiliateFeeDTO": {
      "type": "object",
      "properties": {
        "beneficiarySrc": {
          "$ref": "#/$defs/AddressPropertyDTO"
        },
        "amount": {
          "$ref": "#/$defs/IntPropertyDTO"
        }
      },
      "additionalProperties": false
    },
    "ExternalCallState": {
      "enum": [
        "NoExtCall",
        "AwaitingOrderFulfillment",
        "AwaitingExecution",
        "Executing",
        "Completed",
        "Failed",
        "Cancelled",
        "OrderCancelled"
      ],
      "type": "string"
    },
    "IntPropertyDTO": {
      "type": "object",
      "properties": {
        "bytesValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Binary representation of the property value",
          "format": "byte"
        },
        "bytesArrayValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Bytes array representation of the value",
          "readOnly": true
        },
        "bigIntegerValue": {
          "type": [
            "number",
            "null"
          ],
          "description": "Integer representation of the property value",
          "format": "int64",
          "readOnly": true
        },
        "stringValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "String representation of the property value",
          "readOnly": true
        }
      },
      "additionalProperties": false
    },
    "MetadataDTO": {
      "type": "object",
      "properties": {
        "decimals": {
          "type": "integer",
          "description": "Decimals of the token",
          "format": "int32"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the token"
        },
        "symbol": {
          "type": [
            "string",
            "null"
          ],
          "description": "Symbol of the token"
        },
        "logoURI": {
          "type": [
            "string",
            "null"
          ],
          "description": "URI of the token's logo"
        }
      },
      "additionalProperties": false,
      "description": "Token metadata DTO"
    },
    "OfferWithMetadataDTO": {
      "type": "object",
      "properties": {
        "chainId": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "tokenAddress": {
          "$ref": "#/$defs/AddressPropertyDTO"
        },
        "amount": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "finalAmount": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "metadata": {
          "$ref": "#/$defs/MetadataDTO"
        },
        "decimals": {
          "type": "integer",
          "description": "Decimals of the token",
          "format": "int32"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the token"
        },
        "symbol": {
          "type": [
            "string",
            "null"
          ],
          "description": "Symbol of the token"
        },
        "logoURI": {
          "type": [
            "string",
            "null"
          ],
          "description": "Token's logo URI"
        }
      },
      "additionalProperties": false,
      "description": "Info about an offer"
    },
    "OrderCreationProcessType": {
      "enum": [
        "SrcAmountSet",
        "DstAmountSet",
        "SrcAndDstAmountSet",
        "SrcAndDstAmountSetNoPreswap"
      ],
      "type": "string"
    },
    "OrderEventDTO": {
      "type": "object",
      "properties": {
        "transactionMetadata": {
          "$ref": "#/$defs/TransactionMetadataDTO"
        },
        "submissionId": {
          "oneOf": [
            {
              "$ref": "#/$defs/StringPropertyDTO"
            },
            {
              "$ref": "#/$defs/TransactionHashPropertyDto"
            }
          ],
          "description": "Debridge's generic protocol's submission Id associated with this event"
        }
      },
      "additionalProperties": false,
      "description": "Information about an orderEvent"
    },
    "OrderMetadataDTO": {
      "type": "object",
      "additionalProperties": false,
      "description": "Order metadata base class"
    },
    "OrderOrigin": {
      "enum": [
        "Default",
        "DeSwap",
        "Dln",
        "DeSwapWidget",
        "DeSwapSolflare",
        "DlnSolflare",
        "Goat",
        "HeyAnon",
        "HeyElza",
        "SolanaAgentKit",
        "Zerepy",
        "Eliza"
      ],
      "type": "string"
    },
    "OrderParsedMetadataDTO": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/OrderMetadataDTO"
        }
      ],
      "properties": {
        "version": {
          "type": "integer",
          "description": "Metadata version",
          "format": "int32"
        },
        "creationProcessType": {
          "$ref": "#/$defs/OrderCreationProcessType"
        },
        "origin": {
          "$ref": "#/$defs/OrderOrigin"
        },
        "additionalTakerIncentiveBps": {
          "type": "integer",
          "description": "Additional taker incentive bps",
          "format": "int32"
        },
        "operatingExpensesAmount": {
          "type": [
            "string",
            "null"
          ],
          "description": "20-byte prepended operating expenses amount in input token currency: integer"
        },
        "recommendedTakeAmount": {
          "type": [
            "string",
            "null"
          ],
          "description": "20-byte recommended take amount in take token currency: integer"
        },
        "metadata": {
          "type": [
            "string",
            "null"
          ],
          "description": "Order's auxiliary metadata [hex]"
        },
        "promotionType": {
          "$ref": "#/$defs/PromotionType"
        },
        "orderTradeType": {
          "$ref": "#/$defs/OrderTradeType"
        },
        "partnerFeeBps": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Partner fee in basis points (v2 metadata only)",
          "format": "int32"
        },
        "srcProtocolChainId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Source protocol chain ID (v2 metadata only)",
          "format": "int32"
        },
        "dstProtocolChainId": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Destination protocol chain ID (v2 metadata only)",
          "format": "int32"
        }
      },
      "additionalProperties": false,
      "description": "Parsed order metadata"
    },
    "OrderRawMetadataDTO": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/OrderMetadataDTO"
        }
      ],
      "properties": {
        "rawMetadataHex": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "description": "Raw order metadata"
    },
    "OrderState": {
      "enum": [
        "None",
        "Created",
        "Fulfilled",
        "SentUnlock",
        "OrderCancelled",
        "SentOrderCancel",
        "ClaimedUnlock",
        "ClaimedOrderCancel"
      ],
      "type": "string"
    },
    "OrderTradeType": {
      "enum": [
        "None",
        "Market",
        "Limit"
      ],
      "type": "string"
    },
    "PromotionType": {
      "enum": [
        "None",
        "ArbitrumHorizon",
        "OpHorizon"
      ],
      "type": "string"
    },
    "StringPropertyDTO": {
      "type": "object",
      "properties": {
        "bytesValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Binary representation of the property value",
          "format": "byte"
        },
        "bytesArrayValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "Bytes array representation of the value",
          "readOnly": true
        },
        "stringValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "String representation of the property value",
          "readOnly": true
        }
      },
      "additionalProperties": false
    },
    "SwapExecutedEventDTO": {
      "type": "object",
      "properties": {
        "chainId": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "inTokenAddress": {
          "$ref": "#/$defs/AddressPropertyDTO"
        },
        "inAmount": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "tokenInMetadata": {
          "$ref": "#/$defs/MetadataDTO"
        },
        "tokenInLogoURI": {
          "type": [
            "string",
            "null"
          ],
          "description": "Logo URI of the token that was used as input of the swap",
          "readOnly": true
        },
        "outTokenAddress": {
          "$ref": "#/$defs/AddressPropertyDTO"
        },
        "outAmount": {
          "$ref": "#/$defs/IntPropertyDTO"
        },
        "tokenOutMetadata": {
          "$ref": "#/$defs/MetadataDTO"
        },
        "tokenOutLogoURI": {
          "type": [
            "string",
            "null"
          ],
          "description": "Logo URI of the token that was received as a result of the swap",
          "readOnly": true
        }
      },
      "additionalProperties": false
    },
    "TransactionHashPropertyDto": {
      "type": "object",
      "allOf": [
        {
          "$ref": "#/$defs/StringPropertyDTO"
        }
      ],
      "properties": {
        "stringValue": {
          "type": [
            "string",
            "null"
          ],
          "description": "String representation of the transaction hash value",
          "readOnly": true
        }
      },
      "additionalProperties": false,
      "description": "Transaction Hash property"
    },
    "TransactionMetadataDTO": {
      "type": "object",
      "properties": {
        "transactionHash": {
          "$ref": "#/$defs/TransactionHashPropertyDto"
        },
        "blockNumber": {
          "type": "integer",
          "description": "Number of a block\\slot this event was produced in",
          "format": "int64"
        },
        "blockHash": {
          "oneOf": [
            {
              "$ref": "#/$defs/StringPropertyDTO"
            },
            {
              "$ref": "#/$defs/TransactionHashPropertyDto"
            }
          ],
          "description": "Hash of a block\\slot this event was produced in"
        },
        "blockTimeStamp": {
          "type": "integer",
          "description": "Timestamp of a block\\slot event was produced in",
          "format": "int64"
        },
        "initiator": {
          "$ref": "#/$defs/AddressPropertyDTO"
        }
      },
      "additionalProperties": false
    }
  }
}