diff --git a/docs/index.md b/docs/index.md index ee620776..ec7c3580 100644 --- a/docs/index.md +++ b/docs/index.md @@ -378,7 +378,9 @@ orderSequence | [sequence](#account-sequence-number) | The [account sequence num ```json -23 +{ + "orderSequence": 23 +} ``` @@ -2904,7 +2906,7 @@ Prepare an order cancellation transaction. The prepared transaction must subsequ Name | Type | Description ---- | ---- | ----------- address | [address](#ripple-address) | The address of the account that is creating the transaction. -sequence | [sequence](#account-sequence-number) | The account sequence number of the transaction that created the order to cancel. +orderCancellation | [orderCancellation](#order-cancellation) | The specification of the order cancellation to prepare. instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction ### Return Value @@ -2927,7 +2929,7 @@ instructions | object | The instructions for how to execute the transaction afte ```javascript const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'; -const sequence = 123; +const orderCancellation = {orderSequence: 123}; return api.prepareOrderCancellation(address, sequence) .then(prepared => {/* ... */}); ``` diff --git a/docs/src/prepareOrderCancellation.md.ejs b/docs/src/prepareOrderCancellation.md.ejs index 682e3ac1..53464fdf 100644 --- a/docs/src/prepareOrderCancellation.md.ejs +++ b/docs/src/prepareOrderCancellation.md.ejs @@ -22,7 +22,7 @@ All "prepare" methods have the same return type. ```javascript const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59'; -const sequence = 123; +const orderCancellation = {orderSequence: 123}; return api.prepareOrderCancellation(address, sequence) .then(prepared => {/* ... */}); ``` diff --git a/src/common/schemas/input/prepare-order-cancellation.json b/src/common/schemas/input/prepare-order-cancellation.json index 14636db8..4281b74a 100644 --- a/src/common/schemas/input/prepare-order-cancellation.json +++ b/src/common/schemas/input/prepare-order-cancellation.json @@ -7,12 +7,12 @@ "$ref": "address", "description": "The address of the account that is creating the transaction." }, - "sequence": { - "$ref": "sequence", - "description": "The account sequence number of the transaction that created the order to cancel." + "orderCancellation": { + "$ref": "orderCancellation", + "description": "The specification of the order cancellation to prepare." }, "instructions": {"$ref": "instructions"} }, "additionalProperties": false, - "required": ["address", "sequence"] + "required": ["address", "orderCancellation"] } diff --git a/src/transaction/ordercancellation.js b/src/transaction/ordercancellation.js index a59c463a..6736fd37 100644 --- a/src/transaction/ordercancellation.js +++ b/src/transaction/ordercancellation.js @@ -5,20 +5,20 @@ const validate = utils.common.validate; import type {Instructions, Prepare} from './types.js'; function createOrderCancellationTransaction(account: string, - sequence: number + orderCancellation: Object ): Object { return { TransactionType: 'OfferCancel', Account: account, - OfferSequence: sequence + OfferSequence: orderCancellation.orderSequence }; } -function prepareOrderCancellation(address: string, sequence: number, +function prepareOrderCancellation(address: string, orderCancellation: Object, instructions: Instructions = {} ): Promise { - validate.prepareOrderCancellation({address, sequence, instructions}); - const txJSON = createOrderCancellationTransaction(address, sequence); + validate.prepareOrderCancellation({address, orderCancellation, instructions}); + const txJSON = createOrderCancellationTransaction(address, orderCancellation); return utils.prepareTransaction(txJSON, this, instructions); } diff --git a/test/fixtures/requests/prepare-order-cancellation.json b/test/fixtures/requests/prepare-order-cancellation.json index 40994076..348829dd 100644 --- a/test/fixtures/requests/prepare-order-cancellation.json +++ b/test/fixtures/requests/prepare-order-cancellation.json @@ -1 +1,3 @@ -23 +{ + "orderSequence": 23 +} diff --git a/test/integration/integration-test.js b/test/integration/integration-test.js index 35cf45a7..2e3c0686 100644 --- a/test/integration/integration-test.js +++ b/test/integration/integration-test.js @@ -156,9 +156,9 @@ describe('integration tests', function() { return txData; }); }).then(txData => this.api.prepareOrderCancellation( - address, txData.Sequence, instructions).then(prepared => - testTransaction(this, 'orderCancellation', ledgerVersion, - prepared)) + address, {orderSequence: txData.Sequence}, instructions) + .then(prepared => testTransaction(this, 'orderCancellation', + ledgerVersion, prepared)) ); }); });