BREAKING CHANGE: prepareOrderCancellation now takes orderCancellation specification instead of sequence

This commit is contained in:
Chris Clark
2015-11-23 12:45:44 -08:00
parent ef1e9e1b70
commit 7f33d8a71e
6 changed files with 21 additions and 17 deletions

View File

@@ -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 => {/* ... */});
```

View File

@@ -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 => {/* ... */});
```

View File

@@ -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"]
}

View File

@@ -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<Prepare> {
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);
}

View File

@@ -1 +1,3 @@
23
{
"orderSequence": 23
}

View File

@@ -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))
);
});
});