mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +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
|
```json
|
||||||
23
|
{
|
||||||
|
"orderSequence": 23
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -2904,7 +2906,7 @@ Prepare an order cancellation transaction. The prepared transaction must subsequ
|
|||||||
Name | Type | Description
|
Name | Type | Description
|
||||||
---- | ---- | -----------
|
---- | ---- | -----------
|
||||||
address | [address](#ripple-address) | The address of the account that is creating the transaction.
|
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
|
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction
|
||||||
|
|
||||||
### Return Value
|
### Return Value
|
||||||
@@ -2927,7 +2929,7 @@ instructions | object | The instructions for how to execute the transaction afte
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||||
const sequence = 123;
|
const orderCancellation = {orderSequence: 123};
|
||||||
return api.prepareOrderCancellation(address, sequence)
|
return api.prepareOrderCancellation(address, sequence)
|
||||||
.then(prepared => {/* ... */});
|
.then(prepared => {/* ... */});
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ All "prepare" methods have the same return type.
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||||
const sequence = 123;
|
const orderCancellation = {orderSequence: 123};
|
||||||
return api.prepareOrderCancellation(address, sequence)
|
return api.prepareOrderCancellation(address, sequence)
|
||||||
.then(prepared => {/* ... */});
|
.then(prepared => {/* ... */});
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
"$ref": "address",
|
"$ref": "address",
|
||||||
"description": "The address of the account that is creating the transaction."
|
"description": "The address of the account that is creating the transaction."
|
||||||
},
|
},
|
||||||
"sequence": {
|
"orderCancellation": {
|
||||||
"$ref": "sequence",
|
"$ref": "orderCancellation",
|
||||||
"description": "The account sequence number of the transaction that created the order to cancel."
|
"description": "The specification of the order cancellation to prepare."
|
||||||
},
|
},
|
||||||
"instructions": {"$ref": "instructions"}
|
"instructions": {"$ref": "instructions"}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": ["address", "sequence"]
|
"required": ["address", "orderCancellation"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,20 +5,20 @@ const validate = utils.common.validate;
|
|||||||
import type {Instructions, Prepare} from './types.js';
|
import type {Instructions, Prepare} from './types.js';
|
||||||
|
|
||||||
function createOrderCancellationTransaction(account: string,
|
function createOrderCancellationTransaction(account: string,
|
||||||
sequence: number
|
orderCancellation: Object
|
||||||
): Object {
|
): Object {
|
||||||
return {
|
return {
|
||||||
TransactionType: 'OfferCancel',
|
TransactionType: 'OfferCancel',
|
||||||
Account: account,
|
Account: account,
|
||||||
OfferSequence: sequence
|
OfferSequence: orderCancellation.orderSequence
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareOrderCancellation(address: string, sequence: number,
|
function prepareOrderCancellation(address: string, orderCancellation: Object,
|
||||||
instructions: Instructions = {}
|
instructions: Instructions = {}
|
||||||
): Promise<Prepare> {
|
): Promise<Prepare> {
|
||||||
validate.prepareOrderCancellation({address, sequence, instructions});
|
validate.prepareOrderCancellation({address, orderCancellation, instructions});
|
||||||
const txJSON = createOrderCancellationTransaction(address, sequence);
|
const txJSON = createOrderCancellationTransaction(address, orderCancellation);
|
||||||
return utils.prepareTransaction(txJSON, this, instructions);
|
return utils.prepareTransaction(txJSON, this, instructions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
23
|
{
|
||||||
|
"orderSequence": 23
|
||||||
|
}
|
||||||
|
|||||||
@@ -156,9 +156,9 @@ describe('integration tests', function() {
|
|||||||
return txData;
|
return txData;
|
||||||
});
|
});
|
||||||
}).then(txData => this.api.prepareOrderCancellation(
|
}).then(txData => this.api.prepareOrderCancellation(
|
||||||
address, txData.Sequence, instructions).then(prepared =>
|
address, {orderSequence: txData.Sequence}, instructions)
|
||||||
testTransaction(this, 'orderCancellation', ledgerVersion,
|
.then(prepared => testTransaction(this, 'orderCancellation',
|
||||||
prepared))
|
ledgerVersion, prepared))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user