mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 04:05:52 +00:00
BREAKING CHANGE: prepareOrderCancellation now takes orderCancellation specification instead of sequence
This commit is contained in:
@@ -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 => {/* ... */});
|
||||
```
|
||||
|
||||
@@ -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 => {/* ... */});
|
||||
```
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
23
|
||||
{
|
||||
"orderSequence": 23
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user