From 4c9a2ff53849338f3757706a72e5c42e2a268d3a Mon Sep 17 00:00:00 2001 From: Elliot Lee Date: Fri, 10 Aug 2018 15:50:48 -0700 Subject: [PATCH] Improve Order docs. Fix #776 --- docs/index.md | 6 ++++-- docs/src/specifications.md.ejs | 2 ++ src/common/schemas/specifications/order.json | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index c670988e..eaaf9013 100644 --- a/docs/index.md +++ b/docs/index.md @@ -448,12 +448,14 @@ direction | string | Equal to "buy" for buy orders and "sell" for sell orders. quantity | [amount](#amount) | The amount of currency to buy or sell. totalPrice | [amount](#amount) | The total price to be paid for the `quantity` to be bought or sold. expirationTime | date-time string | *Optional* Time after which the offer is no longer active, as an [ISO 8601 date-time](https://en.wikipedia.org/wiki/ISO_8601). -fillOrKill | boolean | *Optional* Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged. -immediateOrCancel | boolean | *Optional* Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger. +fillOrKill | boolean | *Optional* Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged. This cannot be used with `immediateOrCancel`. +immediateOrCancel | boolean | *Optional* Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger. This cannot be used with `fillOrKill`. memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction. orderToReplace | [sequence](#account-sequence-number) | *Optional* The [account sequence number](#account-sequence-number) of an order to cancel before the new order is created, effectively replacing the old order. passive | boolean | *Optional* If enabled, the offer will not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It will still consume offers that cross it. +The following invalid flag combination causes a `ValidationError`: `immediateOrCancel` and `fillOrKill`. These fields are mutually exclusive, and cannot both be set at the same time. + ### Example diff --git a/docs/src/specifications.md.ejs b/docs/src/specifications.md.ejs index 0ab1cb0d..aa6bc14f 100644 --- a/docs/src/specifications.md.ejs +++ b/docs/src/specifications.md.ejs @@ -28,6 +28,8 @@ See [Transaction Types](#transaction-types) for a description. <%- renderSchema('specifications/order.json') %> +The following invalid flag combination causes a `ValidationError`: `immediateOrCancel` and `fillOrKill`. These fields are mutually exclusive, and cannot both be set at the same time. + ### Example <%- renderFixture('requests/prepare-order.json') %> diff --git a/src/common/schemas/specifications/order.json b/src/common/schemas/specifications/order.json index 5ee42b98..a11654c0 100644 --- a/src/common/schemas/specifications/order.json +++ b/src/common/schemas/specifications/order.json @@ -19,11 +19,11 @@ }, "immediateOrCancel": { "type": "boolean", - "description": "Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger." + "description": "Treat the offer as an [Immediate or Cancel order](http://en.wikipedia.org/wiki/Immediate_or_cancel). If enabled, the offer will never become a ledger node: it only attempts to match existing offers in the ledger. This cannot be used with `fillOrKill`." }, "fillOrKill": { "type": "boolean", - "description": "Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged." + "description": "Treat the offer as a [Fill or Kill order](http://en.wikipedia.org/wiki/Fill_or_kill). Only attempt to match existing offers in the ledger, and only do so if the entire quantity can be exchanged. This cannot be used with `immediateOrCancel`." }, "passive": { "description": "If enabled, the offer will not consume offers that exactly match it, and instead becomes an Offer node in the ledger. It will still consume offers that cross it.",