Merge pull request #1324 from elmurci/develop

Tickets Support
This commit is contained in:
elmurci
2020-12-04 07:10:45 -05:00
committed by GitHub
61 changed files with 889 additions and 73 deletions

View File

@@ -78,6 +78,7 @@
- [prepareCheckCreate](#preparecheckcreate)
- [prepareCheckCancel](#preparecheckcancel)
- [prepareCheckCash](#preparecheckcash)
- [prepareTicketCreate](#prepareticketcreate)
- [sign](#sign)
- [combine](#combine)
- [submit](#submit)
@@ -249,7 +250,7 @@ An *X-address* encodes a hash of the account's public key, a tag, and a checksum
## Account Sequence Number
Every XRP Ledger account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
Every XRP Ledger account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence or a ticketSequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it, or uses a previously generated ticketSequence number. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
## Currency
@@ -319,6 +320,7 @@ Type | Description
[paymentChannelCreate](#payment-channel-create) | A `paymentChannelCreate` transaction opens a payment channel between two addresses with XRP set aside for asynchronous payments.
[paymentChannelFund](#payment-channel-fund) | A `paymentChannelFund` transaction adds XRP to a payment channel and optionally sets a new expiration for the channel.
[paymentChannelClaim](#payment-channel-claim) | A `paymentChannelClaim` transaction withdraws XRP from a channel and optionally requests to close it.
[ticketCreate](#ticket-create) | A successful `ticketCreate` transaction adds a Ticket in the directory of the owning account.
## Transaction Flow
@@ -336,6 +338,7 @@ Executing a transaction with `RippleAPI` requires the following four steps:
* [prepareCheckCreate](#preparecheckcreate)
* [prepareCheckCancel](#preparecheckcancel)
* [prepareCheckCash](#preparecheckcash)
* [prepareTicketCreate](#prepareticketcreate)
2. [Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place. For multisignature transactions, the `signedTransaction` fields returned by `sign` must be collected and passed to the [combine](#combine) method.
3. [Submit](#submit) - Submit the transaction to the connected server.
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.
@@ -359,8 +362,9 @@ maxFee | [value](#value) | *Optional* Deprecated: Use `maxFeeXRP` in the RippleA
maxLedgerVersion | integer,null | *Optional* The highest ledger version that the transaction can be included in. If this option and `maxLedgerVersionOffset` are both omitted, the `maxLedgerVersion` option will default to 3 greater than the current validated ledger version (equivalent to `maxLedgerVersionOffset=3`). Use `null` to not set a maximum ledger version. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
maxLedgerVersion | string,null | *Optional* The highest ledger version that the transaction can be included in. If this option and `maxLedgerVersionOffset` are both omitted, the `maxLedgerVersion` option will default to 3 greater than the current validated ledger version (equivalent to `maxLedgerVersionOffset=3`). Use `null` to not set a maximum ledger version. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
maxLedgerVersionOffset | integer | *Optional* Offset from current validated ledger version to highest ledger version that the transaction can be included in.
sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction.
sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
signersCount | integer | *Optional* Number of signers that will be signing this transaction.
ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The ticket sequence to be used for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
We recommend that you specify a `maxLedgerVersion` so that you can quickly determine that a failed transaction will never succeed in the future. It is impossible for a transaction to succeed after the XRP Ledger's consensus-validated ledger version exceeds the transaction's `maxLedgerVersion`. If you omit `maxLedgerVersion`, the "prepare\*" method automatically supplies a `maxLedgerVersion` equal to the current ledger plus 3, which it includes in the return value from the "prepare\*" method.
@@ -4568,9 +4572,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4623,9 +4628,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4696,9 +4702,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4764,9 +4771,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4832,9 +4840,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4885,9 +4894,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -4955,9 +4965,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5013,9 +5024,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5069,9 +5081,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5127,9 +5140,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5185,9 +5199,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5240,9 +5255,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5296,9 +5312,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5355,9 +5372,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5410,9 +5428,10 @@ Name | Type | Description
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* sequence | [sequence](#account-sequence-number) | The initiating account's sequence number for this transaction.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
@@ -5442,6 +5461,64 @@ return api.prepareCheckCash(address, checkCash).then(prepared =>
```
## prepareTicketCreate
`prepareTicketCreate(address: string, ticketCount: number, instructions: object): Promise<object>`
Prepare a ticket transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Ticket functionality requires the [TicketBatch amendment](https://github.com/ripple/xrpl-dev-portal/issues/898). As of 2020-11-24, this amendment is not activated on the Mainnet, Testnet, or Devnet.
### Parameters
Name | Type | Description
---- | ---- | -----------
address | [address](#address) | The address of the account that is creating the transaction.
ticketCount | number | The number of tickets to be created.
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction
### Return Value
This method returns a promise that resolves with an object with the following structure:
<aside class="notice">
All "prepare*" methods have the same return type.
</aside>
Name | Type | Description
---- | ---- | -----------
txJSON | string | The prepared transaction in rippled JSON format.
instructions | object | The instructions for how to execute the transaction after adding automatic defaults.
*instructions.* fee | [value](#value) | The fee to pay for the transaction. See [Transaction Fees](#transaction-fees) for more information. For multi-signed transactions, this fee will be multiplied by (N+1), where N is the number of signatures you plan to provide.
*instructions.* maxLedgerVersion | integer,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* maxLedgerVersion | string,null | The highest ledger version that the transaction can be included in. Set to `null` if there is no maximum. If not null, this must be an integer greater than 0, or one of the following strings: 'validated', 'closed', 'current'.
*instructions.* sequence | [sequence](#account-sequence-number) | *Optional* The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
*instructions.* ticketSequence | [ticket-sequence](#account-sequence-number) | *Optional* The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.
### Example
```javascript
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
return api.prepareTicketCreate(address, 2).then(prepared => {
/* ... */
}).catch(error => {
/* ... as with all prepare* methods, use a Promise catch block to handle errors ... */
})
```
```json
{
"TransactionType": "TicketCreate",
"Account": "r4SDqUD1ZcfoZrhnsZ94XNFKxYL4oHYJyA",
"TicketCount": 2,
"LastLedgerSequence": 13,
"Fee": "12",
"Sequence": 25
}
```
## sign
```

View File

@@ -1,3 +1,5 @@
Usage:
babel-node balances.js
babel-node cancelall.js (requires setting address and secret in source file first)
babel-node payment.js (requires setting address and secret in source file first)
babel-node ticket.js (requires setting address and secret in source file first)

31
docs/samples/ticket.js Normal file
View File

@@ -0,0 +1,31 @@
'use strict';
const RippleAPI = require('../../src').RippleAPI; // require('ripple-lib')
const address = 'INSERT ADDRESS HERE';
const secret = 'INSERT SECRET HERE';
const api = new RippleAPI({server: 'wss://s1.ripple.com:443'});
const instructions = {
maxLedgerVersionOffset: 5
};
const numberOfTickets = 1;
function quit(message) {
console.log(message);
process.exit(0);
}
function fail(message) {
console.error(message);
process.exit(1);
}
api.connect().then(() => {
console.log('Connected...');
return api.prepareTicketCreate(address, numberOfTickets, instructions).then(prepared => {
console.log('Ticket transaction prepared...');
const {signedTransaction} = api.sign(prepared.txJSON, secret);
console.log('Ticket transaction signed...');
api.submit(signedTransaction).then(quit, fail);
});
}).catch(fail);

View File

@@ -22,7 +22,7 @@ An *X-address* encodes a hash of the account's public key, a tag, and a checksum
## Account Sequence Number
Every XRP Ledger account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
Every XRP Ledger account has a *sequence number* that is used to keep transactions in order. Every transaction must have a sequence or a ticketSequence number. A transaction can only be executed if it has the next sequence number in order, of the account sending it, or uses a previously generated ticketSequence number. This prevents one transaction from executing twice and transactions executing out of order. The sequence number starts at `1` and increments for each transaction that the account makes.
## Currency

View File

@@ -49,6 +49,7 @@
<%- include('prepareCheckCreate.md.ejs') %>
<%- include('prepareCheckCancel.md.ejs') %>
<%- include('prepareCheckCash.md.ejs') %>
<%- include('prepareTicketCreate.md.ejs') %>
<%- include('sign.md.ejs') %>
<%- include('combine.md.ejs') %>
<%- include('submit.md.ejs') %>

View File

@@ -0,0 +1,34 @@
## prepareTicketCreate
`prepareTicketCreate(address: string, ticketCount: number, instructions: object): Promise<object>`
Prepare a ticket transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
Ticket functionality requires the [TicketBatch amendment](https://github.com/ripple/xrpl-dev-portal/issues/898). As of 2020-11-24, this amendment is not activated on the Mainnet, Testnet, or Devnet.
### Parameters
<%- renderSchema("input/prepare-ticket-create.json") %>
### Return Value
This method returns a promise that resolves with an object with the following structure:
<aside class="notice">
All "prepare*" methods have the same return type.
</aside>
<%- renderSchema("output/prepare.json") %>
### Example
```javascript
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
return api.prepareTicketCreate(address, 2).then(prepared => {
/* ... */
}).catch(error => {
/* ... as with all prepare* methods, use a Promise catch block to handle errors ... */
})
```
<%- renderFixture("responses/prepare-ticket-create.json") %>

View File

@@ -20,6 +20,7 @@ Type | Description
[paymentChannelCreate](#payment-channel-create) | A `paymentChannelCreate` transaction opens a payment channel between two addresses with XRP set aside for asynchronous payments.
[paymentChannelFund](#payment-channel-fund) | A `paymentChannelFund` transaction adds XRP to a payment channel and optionally sets a new expiration for the channel.
[paymentChannelClaim](#payment-channel-claim) | A `paymentChannelClaim` transaction withdraws XRP from a channel and optionally requests to close it.
[ticketCreate](#ticket-create) | A successful `ticketCreate` transaction adds a Ticket in the directory of the owning account.
## Transaction Flow
@@ -37,6 +38,7 @@ Executing a transaction with `RippleAPI` requires the following four steps:
* [prepareCheckCreate](#preparecheckcreate)
* [prepareCheckCancel](#preparecheckcancel)
* [prepareCheckCash](#preparecheckcash)
* [prepareTicketCreate](#prepareticketcreate)
2. [Sign](#sign) - Cryptographically sign the transaction locally and save the [transaction ID](#transaction-id). Signing is how the owner of an account authorizes a transaction to take place. For multisignature transactions, the `signedTransaction` fields returned by `sign` must be collected and passed to the [combine](#combine) method.
3. [Submit](#submit) - Submit the transaction to the connected server.
4. Verify - Verify that the transaction got validated by querying with [getTransaction](#gettransaction). This is necessary because transactions may fail even if they were successfully submitted.

View File

@@ -28,7 +28,7 @@
"lodash": "^4.17.4",
"lodash.isequal": "^4.5.0",
"ripple-address-codec": "^4.1.1",
"ripple-binary-codec": "^0.2.7",
"ripple-binary-codec": "1.1.0-beta.0",
"ripple-keypairs": "^1.0.0",
"ripple-lib-transactionparser": "0.8.2",
"ws": "^7.2.0"

View File

@@ -43,6 +43,7 @@ import prepareCheckCreate from './transaction/check-create'
import prepareCheckCancel from './transaction/check-cancel'
import prepareCheckCash from './transaction/check-cash'
import prepareSettings from './transaction/settings'
import prepareTicketCreate from './transaction/ticket'
import sign from './transaction/sign'
import combine from './transaction/combine'
import submit from './transaction/submit'
@@ -395,6 +396,7 @@ class RippleAPI extends EventEmitter {
prepareCheckCreate = prepareCheckCreate
prepareCheckCash = prepareCheckCash
prepareCheckCancel = prepareCheckCancel
prepareTicketCreate = prepareTicketCreate
prepareSettings = prepareSettings
sign = sign
combine = combine

View File

@@ -13,6 +13,7 @@ function loadSchemas() {
require('./schemas/objects/hash128.json'),
require('./schemas/objects/hash256.json'),
require('./schemas/objects/sequence.json'),
require('./schemas/objects/ticket-sequence.json'),
require('./schemas/objects/signature.json'),
require('./schemas/objects/issue.json'),
require('./schemas/objects/ledger-version.json'),
@@ -115,6 +116,7 @@ function loadSchemas() {
require('./schemas/input/prepare-check-create.json'),
require('./schemas/input/prepare-check-cash.json'),
require('./schemas/input/prepare-check-cancel.json'),
require('./schemas/input/prepare-ticket-create.json'),
require('./schemas/input/compute-ledger-hash.json'),
require('./schemas/input/sign.json'),
require('./schemas/input/submit.json'),

View File

@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "prepareTicketParameters",
"type": "object",
"properties": {
"address": {
"$ref": "address",
"description": "The address of the account that is creating the transaction."
},
"ticketCount": {
"type": "number",
"description": "The number of tickets to be created."
},
"instructions": {"$ref": "instructions"}
},
"additionalProperties": false,
"required": ["address", "ticketCount"]
}

View File

@@ -6,9 +6,13 @@
"type": "object",
"properties": {
"sequence": {
"description": "The initiating account's sequence number for this transaction.",
"description": "The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.",
"$ref": "sequence"
},
"ticketSequence": {
"description": "The ticket sequence to be used for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set.",
"$ref": "ticket-sequence"
},
"fee": {
"description": "An exact fee to pay for the transaction, before multiplying for multi-signed transactions. See [Transaction Fees](#transaction-fees) for more information.",
"$ref": "value"
@@ -45,6 +49,10 @@
{
"description": "maxLedgerVersion and maxLedgerVersionOffset are mutually exclusive",
"required": ["maxLedgerVersion", "maxLedgerVersionOffset"]
},
{
"description": "sequence and ticketSequence are mutually exclusive",
"required": ["sequence", "ticketSequence"]
}
]
}

View File

@@ -4,5 +4,5 @@
"link": "account-sequence-number",
"description": "An account transaction sequence number",
"type": "integer",
"minimum": 1
"minimum": 0
}

View File

@@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ticket-sequence",
"link": "account-sequence-number",
"description": "An account transaction tickt sequence number",
"type": "integer",
"minimum": 1
}

View File

@@ -18,7 +18,11 @@
},
"sequence": {
"$ref": "sequence",
"description": "The initiating account's sequence number for this transaction."
"description": "The initiating account's sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set."
},
"ticketSequence": {
"$ref": "ticket-sequence",
"description": "The initiating account's ticket sequence number for this transaction. `sequence` and `ticketSequence` are mutually exclusive, only one of them can be set."
},
"maxLedgerVersion": {
"oneOf": [
@@ -29,8 +33,14 @@
}
},
"additionalProperties": false,
"required": ["fee", "sequence", "maxLedgerVersion"]
}
"required": ["fee", "maxLedgerVersion"],
"anyOf": [
{ "required":
[ "sequence" ] },
{ "required":
[ "ticketSequence" ] }
]
}
},
"additionalProperties": false,
"required": ["txJSON", "instructions"]

View File

@@ -132,6 +132,11 @@ export const prepareCheckCancel = _.partial(
'prepareCheckCancelParameters'
)
export const prepareTicketCreate = _.partial(
schemaValidate,
'prepareTicketParameters'
)
export const sign = _.partial(schemaValidate, 'signParameters')
export const combine = _.partial(schemaValidate, 'combineParameters')

View File

@@ -0,0 +1,11 @@
import * as assert from 'assert'
import {removeUndefined} from '../../common'
function parseTicketCreate(tx: any): object {
assert.ok(tx.TransactionType === 'TicketCreate')
return removeUndefined({
ticketCount: tx.TicketCount
})
}
export default parseTicketCreate

View File

@@ -16,6 +16,7 @@ import parsePayment from './payment'
import parsePaymentChannelClaim from './payment-channel-claim'
import parsePaymentChannelCreate from './payment-channel-create'
import parsePaymentChannelFund from './payment-channel-fund'
import parseTicketCreate from './ticket-create'
import parseTrustline from './trustline'
import parseAmendment from './amendment' // pseudo-transaction
@@ -41,6 +42,7 @@ function parseTransactionType(type) {
PaymentChannelFund: 'paymentChannelFund',
SetRegularKey: 'settings',
SignerListSet: 'settings',
TicketCreate: 'ticketCreate',
TrustSet: 'trustline',
EnableAmendment: 'amendment', // pseudo-transaction
@@ -68,6 +70,7 @@ function parseTransaction(tx: any, includeRawTransaction: boolean): any {
paymentChannelClaim: parsePaymentChannelClaim,
paymentChannelCreate: parsePaymentChannelCreate,
paymentChannelFund: parsePaymentChannelFund,
ticketCreate: parseTicketCreate,
trustline: parseTrustline,
amendment: parseAmendment, // pseudo-transaction

View File

@@ -56,11 +56,8 @@ function signWithKeypair(
keypair.privateKey
)
}
const serialized = binaryCodec.encode(txToSignAndEncode)
checkTxSerialization(serialized, tx)
return {
signedTransaction: serialized,
id: computeBinaryTransactionHash(serialized)

45
src/transaction/ticket.ts Normal file
View File

@@ -0,0 +1,45 @@
import * as _ from 'lodash'
import * as utils from './utils'
import {Prepare, TransactionJSON, Instructions} from './types'
import {RippleAPI} from '..'
const validate = utils.common.validate
const ValidationError = utils.common.errors.ValidationError
export interface Ticket {
account: string
sequence: number
}
function createTicketTransaction(
account: string,
ticketCount: number
): TransactionJSON {
if (!ticketCount || ticketCount === 0)
throw new ValidationError('Ticket count must be greater than 0.')
const txJSON: any = {
TransactionType: 'TicketCreate',
Account: account,
TicketCount: ticketCount
}
return txJSON
}
function prepareTicketCreate(
this: RippleAPI,
address: string,
ticketCount: number,
instructions: Instructions = {}
): Promise<Prepare> {
try {
validate.prepareTicketCreate({address, ticketCount, instructions})
const txJSON = createTicketTransaction(address, ticketCount)
return utils.prepareTransaction(txJSON, this, instructions)
} catch (e) {
return Promise.reject(e)
}
}
export default prepareTicketCreate

View File

@@ -19,6 +19,7 @@ export type TransactionJSON = {
export type Instructions = {
sequence?: number
ticketSequence?: number
fee?: string
// @deprecated
maxFee?: string
@@ -31,7 +32,8 @@ export type Prepare = {
txJSON: string
instructions: {
fee: string
sequence: number
sequence?: number
ticketSequence?: number
maxLedgerVersion?: number
}
}

View File

@@ -23,10 +23,14 @@ export type ApiMemo = {
function formatPrepareResponse(txJSON: any): Prepare {
const instructions = {
fee: common.dropsToXrp(txJSON.Fee),
sequence: txJSON.Sequence,
maxLedgerVersion:
txJSON.LastLedgerSequence === undefined ? null : txJSON.LastLedgerSequence
}
if (txJSON.TicketSequence !== undefined) {
instructions['ticketSequence'] = txJSON.TicketSequence
} else {
instructions['sequence'] = txJSON.Sequence
}
return {
txJSON: JSON.stringify(txJSON),
instructions
@@ -110,11 +114,20 @@ function prepareTransaction(
): Promise<Prepare> {
common.validate.instructions(instructions)
common.validate.tx_json(txJSON)
// We allow 0 values in the Sequence schema to support the Tickets feature
// When a ticketSequence is used, sequence has to be 0
// We validate that a sequence with value 0 is not passed even if the json schema allows it
if (instructions.sequence !== undefined && instructions.sequence === 0) {
return Promise.reject(new ValidationError('`sequence` cannot be 0'))
}
const disallowedFieldsInTxJSON = [
'maxLedgerVersion',
'maxLedgerVersionOffset',
'fee',
'sequence'
'sequence',
'ticketSequence'
]
const badFields = disallowedFieldsInTxJSON.filter((field) => txJSON[field])
if (badFields.length) {
@@ -320,10 +333,18 @@ function prepareTransaction(
)
}
}
if (newTxJSON.Sequence !== undefined) {
return Promise.resolve()
}
// Ticket Sequence
if (instructions.ticketSequence !== undefined) {
newTxJSON.Sequence = 0
newTxJSON.TicketSequence = instructions.ticketSequence
return Promise.resolve()
}
try {
// Consider requesting from the 'current' ledger (instead of 'validated').
const response = await api.request('account_info', {

View File

@@ -1,6 +1,7 @@
import requests from '../../fixtures/requests'
import responses from '../../fixtures/responses'
import {assertResultMatch, TestSuite} from '../../utils'
const instructionsWithMaxLedgerVersionOffset = {maxLedgerVersionOffset: 100}
/**
* Every test suite exports their tests in the default object.
@@ -8,11 +9,25 @@ import {assertResultMatch, TestSuite} from '../../utils'
* - Check out "test/api/index.ts" for more information about the test runner.
*/
export default <TestSuite>{
prepareCheckCancel: async (api, address) => {
'prepareCheckCancel': async (api, address) => {
const result = await api.prepareCheckCancel(
address,
requests.prepareCheckCancel.normal
)
assertResultMatch(result, responses.prepareCheckCancel.normal, 'prepare')
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareCheckCancel(
address,
requests.prepareCheckCancel.normal,
localInstructions
)
assertResultMatch(result, responses.prepareCheckCancel.ticket, 'prepare')
}
}

View File

@@ -1,6 +1,7 @@
import requests from '../../fixtures/requests'
import responses from '../../fixtures/responses'
import {assertResultMatch, TestSuite} from '../../utils'
const instructionsWithMaxLedgerVersionOffset = {maxLedgerVersionOffset: 100}
/**
* Every test suite exports their tests in the default object.
@@ -22,5 +23,19 @@ export default <TestSuite>{
requests.prepareCheckCash.deliverMin
)
assertResultMatch(result, responses.prepareCheckCash.deliverMin, 'prepare')
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareCheckCash(
address,
requests.prepareCheckCash.amount,
localInstructions
)
assertResultMatch(result, responses.prepareCheckCash.ticket, 'prepare')
}
}

View File

@@ -28,5 +28,19 @@ export default <TestSuite>{
requests.prepareCheckCreate.full
)
assertResultMatch(result, responses.prepareCheckCreate.full, 'prepare')
},
'prepareCheckCreate with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareCheckCreate(
address,
requests.prepareCheckCreate.normal,
localInstructions
)
assertResultMatch(result, responses.prepareCheckCreate.ticket, 'prepare')
}
}

View File

@@ -32,5 +32,23 @@ export default <TestSuite>{
responses.prepareEscrowCancellation.memos,
'prepare'
)
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareEscrowCancellation(
address,
requests.prepareEscrowCancellation.normal,
localInstructions
)
assertResultMatch(
result,
responses.prepareEscrowCancellation.ticket,
'prepare'
)
}
}

View File

@@ -45,5 +45,19 @@ export default <TestSuite>{
api.errors.ValidationError,
'instance.escrowCreation requires property "amount"'
)
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000396',
ticketSequence: 23
}
const result = await api.prepareEscrowCreation(
address,
requests.prepareEscrowCreation.normal,
localInstructions
)
assertResultMatch(result, responses.prepareEscrowCreation.ticket, 'prepare')
}
}

View File

@@ -56,5 +56,23 @@ export default <TestSuite>{
api.errors.ValidationError,
'"condition" and "fulfillment" fields on EscrowFinish must only be specified together.'
)
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000396',
ticketSequence: 23
}
const result = await api.prepareEscrowExecution(
address,
requests.prepareEscrowExecution.normal,
localInstructions
)
assertResultMatch(
result,
responses.prepareEscrowExecution.ticket,
'prepare'
)
}
}

View File

@@ -48,5 +48,16 @@ export default <TestSuite>{
api.errors.ValidationError,
'instance.order requires property "direction"'
)
},
'with ticket': async (api, address) => {
const request = requests.prepareOrder.sell
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareOrder(address, request, localInstructions)
assertResultMatch(result, responses.prepareOrder.ticket, 'prepare')
}
}

View File

@@ -55,5 +55,24 @@ export default <TestSuite>{
api.errors.ValidationError,
'instance.orderCancellation requires property "orderSequence"'
)
},
'with ticket': async (api, address) => {
const request = requests.prepareOrderCancellation.simple
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareOrderCancellation(
address,
request,
localInstructions
)
assertResultMatch(
result,
responses.prepareOrderCancellation.ticket,
'prepare'
)
}
}

View File

@@ -492,5 +492,43 @@ export default <TestSuite>{
instructionsWithMaxLedgerVersionOffset
)
assertResultMatch(response, expectedResponse, 'prepare')
},
// Tickets
'preparePayment with ticketSequence': async (api, address) => {
const version = await api.getLedgerVersion()
const localInstructions = {
maxLedgerVersion: version + 100,
fee: '0.000012',
ticketSequence: 23
}
const response = await api.preparePayment(
address,
REQUEST_FIXTURES.allOptions,
localInstructions
)
assertResultMatch(response, RESPONSE_FIXTURES.ticketSequence, 'prepare')
},
'throws when both sequence and ticketSequence are set': async (
api,
address
) => {
const version = await api.getLedgerVersion()
const localInstructions = {
maxLedgerVersion: version + 100,
fee: '0.000012',
ticketSequence: 23,
sequence: 12
}
return assertRejects(
api.preparePayment(
address,
REQUEST_FIXTURES.allOptions,
localInstructions
),
ValidationError,
'instance.instructions is of prohibited type [object Object]'
)
}
}

View File

@@ -51,6 +51,20 @@ export default <TestSuite>{
assertResultMatch(response, RESPONSE_FIXTURES.close, 'prepare')
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const response = await api.preparePaymentChannelClaim(
address,
REQUEST_FIXTURES.normal,
localInstructions
)
assertResultMatch(response, RESPONSE_FIXTURES.ticket, 'prepare')
},
'rejects Promise on preparePaymentChannelClaim with renew and close': async (
api,
address

View File

@@ -43,5 +43,23 @@ export default <TestSuite>{
responses.preparePaymentChannelCreate.full,
'prepare'
)
},
'preparePaymentChannelCreate with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.preparePaymentChannelCreate(
address,
requests.preparePaymentChannelCreate.normal,
localInstructions
)
assertResultMatch(
result,
responses.preparePaymentChannelCreate.ticket,
'prepare'
)
}
}

View File

@@ -36,5 +36,23 @@ export default <TestSuite>{
responses.preparePaymentChannelFund.full,
'prepare'
)
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.preparePaymentChannelFund(
address,
requests.preparePaymentChannelFund.normal,
localInstructions
)
assertResultMatch(
result,
responses.preparePaymentChannelFund.ticket,
'prepare'
)
}
}

View File

@@ -251,5 +251,18 @@ export default <TestSuite>{
api.sign(result.txJSON, secret),
responses.prepareSettings.signed
)
},
'prepare settings with ticket': async (api, address) => {
const instructions = {
ticketSequence: 23,
maxLedgerVersion: 8820051,
fee: '0.000012'
}
const response = await api.prepareSettings(
address,
requests.prepareSettings.domain,
instructions
)
assertResultMatch(response, responses.prepareSettings.ticket, 'prepare')
}
}

View File

@@ -0,0 +1,56 @@
import {assertResultMatch, TestSuite} from '../../utils'
// import responses from '../../fixtures/responses'
// import requests from '../../fixtures/requests'
// import {ValidationError} from 'ripple-api/common/errors'
// import binary from 'ripple-binary-codec'
// import assert from 'assert-diff'
// import {RippleAPI} from 'ripple-api'
// const {schemaValidator} = RippleAPI._PRIVATE
// const instructionsWithMaxLedgerVersionOffset = {maxLedgerVersionOffset: 100}
// const {preparePayment: REQUEST_FIXTURES} = requests
// const {preparePayment: RESPONSE_FIXTURES} = responses
// const ADDRESS = 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo'
/**
* Every test suite exports their tests in the default object.
* - Check out the "TestSuite" type for documentation on the interface.
* - Check out "test/api/index.ts" for more information about the test runner.
*/
export default <TestSuite>{
'creates a ticket successfully with a sequence number': async (
api,
address
) => {
const expected = {
txJSON:
'{"TransactionType":"TicketCreate", "TicketCount": 2, "Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Flags":2147483648,"LastLedgerSequence":8819954,"Sequence":23,"Fee":"12"}',
instructions: {
maxLedgerVersion: 8819954,
sequence: 23,
fee: '0.000012'
}
}
const response = await api.prepareTicketCreate(address, 2)
assertResultMatch(response, expected, 'prepare')
},
'creates a ticket successfully with another ticket': async (api, address) => {
const expected = {
txJSON:
'{"TransactionType":"TicketCreate", "TicketCount": 1, "Account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","Flags":2147483648,"LastLedgerSequence":8819954,"Sequence": 0,"TicketSequence":23,"Fee":"12"}',
instructions: {
maxLedgerVersion: 8819954,
ticketSequence: 23,
fee: '0.000012'
}
}
const instructions = {
maxLedgerVersion: 8819954,
ticketSequence: 23,
fee: '0.000012'
}
const response = await api.prepareTicketCreate(address, 1, instructions)
assertResultMatch(response, expected, 'prepare')
}
}

View File

@@ -1242,5 +1242,88 @@ export default <TestSuite>{
responses.preparePaymentChannelClaim.close,
'prepare'
)
},
'rejects Promise if both sequence and ticketSecuence are set': async (
api,
address
) => {
const localInstructions = {
ticketSequence: 23,
sequence: 23
}
const txJSON = {
TransactionType: 'DepositPreauth',
Account: address,
Authorize: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
Fee: '16'
}
await assertRejects(
api.prepareTransaction(txJSON, localInstructions),
ValidationError,
'instance is of prohibited type [object Object]'
)
},
'sets sequence to 0 if a ticketSequence is passed': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const txJSON = {
TransactionType: 'Payment',
Account: address,
Destination: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
Amount: {
currency: 'USD',
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
value: '0.01'
},
SendMax: {
currency: 'USD',
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
value: '0.01'
},
Flags: 0
}
const response = await api.prepareTransaction(txJSON, localInstructions)
assertResultMatch(response, responses.preparePayment.ticket, 'prepare')
},
'rejects Promise if a sequence with value 0 is passed': async (
api,
address
) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
sequence: 0
}
const txJSON = {
TransactionType: 'Payment',
Account: address,
Destination: 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo',
Amount: {
currency: 'USD',
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
value: '0.01'
},
SendMax: {
currency: 'USD',
issuer: 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM',
value: '0.01'
},
Flags: 0
}
await assertRejects(
api.prepareTransaction(txJSON, localInstructions),
ValidationError,
'`sequence` cannot be 0'
)
}
}

View File

@@ -9,7 +9,7 @@ const instructionsWithMaxLedgerVersionOffset = {maxLedgerVersionOffset: 100}
* - Check out "test/api/index.ts" for more information about the test runner.
*/
export default <TestSuite>{
simple: async (api, address) => {
'simple': async (api, address) => {
const result = await api.prepareTrustline(
address,
requests.prepareTrustline.simple,
@@ -18,7 +18,7 @@ export default <TestSuite>{
assertResultMatch(result, responses.prepareTrustline.simple, 'prepare')
},
frozen: async (api, address) => {
'frozen': async (api, address) => {
const result = await api.prepareTrustline(
address,
requests.prepareTrustline.frozen
@@ -26,7 +26,7 @@ export default <TestSuite>{
assertResultMatch(result, responses.prepareTrustline.frozen, 'prepare')
},
complex: async (api, address) => {
'complex': async (api, address) => {
const result = await api.prepareTrustline(
address,
requests.prepareTrustline.complex,
@@ -35,7 +35,7 @@ export default <TestSuite>{
assertResultMatch(result, responses.prepareTrustline.complex, 'prepare')
},
invalid: async (api, address) => {
'invalid': async (api, address) => {
const trustline = Object.assign({}, requests.prepareTrustline.complex)
delete trustline.limit // Make invalid
@@ -48,5 +48,19 @@ export default <TestSuite>{
api.errors.ValidationError,
'instance.trustline requires property "limit"'
)
},
'with ticket': async (api, address) => {
const localInstructions = {
...instructionsWithMaxLedgerVersionOffset,
maxFee: '0.000012',
ticketSequence: 23
}
const result = await api.prepareTrustline(
address,
requests.prepareTrustline.simple,
localInstructions
)
assertResultMatch(result, responses.prepareTrustline.ticket, 'prepare')
}
}

View File

@@ -333,5 +333,12 @@ export default <TestSuite>{
assert.deepEqual(result, expectedResponse)
schemaValidator.schemaValidate('sign', result)
},
'sign with ticket': async (api, address) => {
const secret = 'sn7n5R1cR5Y3fRFkuWXA94Ts1frVJ'
const result = api.sign(REQUEST_FIXTURES.ticket.txJSON, secret)
assert.deepEqual(result, RESPONSE_FIXTURES.ticket)
schemaValidator.schemaValidate('sign', result)
}
}

View File

@@ -76,6 +76,7 @@ module.exports = {
},
sign: {
normal: require('./sign'),
ticket: require('./sign-ticket'),
escrow: require('./sign-escrow.json'),
signAs: require('./sign-as')
},

View File

@@ -0,0 +1,9 @@
{
"txJSON": "{\"TransactionType\": \"TicketCreate\", \"TicketCount\": 1, \"Account\": \"r4SDqUD1ZcfoZrhnsZ94XNFKxYL4oHYJyA\", \"Sequence\": 0, \"TicketSequence\": 23, \"Fee\": \"10000\"}",
"instructions": {
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -94,26 +94,31 @@ module.exports = {
},
prepareOrder: {
buy: require('./prepare-order.json'),
ticket: require('./prepare-order-ticket.json'),
sell: require('./prepare-order-sell.json'),
expiration: require('./prepare-order-expiration')
},
prepareOrderCancellation: {
normal: require('./prepare-order-cancellation.json'),
ticket: require('./prepare-order-cancellation-ticket.json'),
withMemos: require('./prepare-order-cancellation-memos.json'),
noInstructions: require('./prepare-order-cancellation-no-instructions.json')
},
preparePayment: {
normal: require('./prepare-payment.json'),
ticket: require('./prepare-payment-ticket'),
minAmountXRP: require('./prepare-payment-min-amount-xrp.json'),
minAmountXRPXRP: require('./prepare-payment-min-amount-xrp-xrp.json'),
allOptions: require('./prepare-payment-all-options.json'),
noCounterparty: require('./prepare-payment-no-counterparty.json'),
minAmount: require('./prepare-payment-min-amount.json')
minAmount: require('./prepare-payment-min-amount.json'),
ticketSequence: require('./prepare-payment-ticket-sequence.json')
},
prepareSettings: {
regularKey: require('./prepare-settings-regular-key.json'),
removeRegularKey: require('./prepare-settings-remove-regular-key.json'),
flags: require('./prepare-settings.json'),
ticket: require('./prepare-settings-ticket.json'),
flagsMultisign: require('./prepare-settings-multisign.json'),
flagSet: require('./prepare-settings-flag-set.json'),
flagClear: require('./prepare-settings-flag-clear.json'),
@@ -130,54 +135,65 @@ module.exports = {
},
prepareCheckCreate: {
normal: require('./prepare-check-create'),
ticket: require('./prepare-check-create-ticket'),
full: require('./prepare-check-create-full')
},
prepareCheckCash: {
amount: require('./prepare-check-cash-amount'),
ticket: require('./prepare-check-cash-ticket'),
deliverMin: require('./prepare-check-cash-delivermin')
},
prepareCheckCancel: {
normal: require('./prepare-check-cancel')
normal: require('./prepare-check-cancel'),
ticket: require('./prepare-check-cancel-ticket')
},
prepareEscrowCreation: {
normal: require('./prepare-escrow-creation'),
ticket: require('./prepare-escrow-creation-ticket'),
full: require('./prepare-escrow-creation-full')
},
prepareEscrowExecution: {
normal: require('./prepare-escrow-execution'),
ticket: require('./prepare-escrow-execution-ticket'),
simple: require('./prepare-escrow-execution-simple')
},
prepareEscrowCancellation: {
normal: require('./prepare-escrow-cancellation'),
ticket: require('./prepare-escrow-cancellation-ticket'),
memos: require('./prepare-escrow-cancellation-memos')
},
preparePaymentChannelCreate: {
normal: require('./prepare-payment-channel-create'),
ticket: require('./prepare-payment-channel-create-ticket'),
full: require('./prepare-payment-channel-create-full')
},
preparePaymentChannelFund: {
normal: require('./prepare-payment-channel-fund'),
ticket: require('./prepare-payment-channel-fund-ticket'),
full: require('./prepare-payment-channel-fund-full')
},
preparePaymentChannelClaim: {
normal: require('./prepare-payment-channel-claim'),
ticket: require('./prepare-payment-channel-claim-ticket'),
renew: require('./prepare-payment-channel-claim-renew'),
close: require('./prepare-payment-channel-claim-close')
},
prepareTrustline: {
simple: require('./prepare-trustline-simple.json'),
frozen: require('./prepare-trustline-frozen.json'),
complex: require('./prepare-trustline.json')
simple: require('./prepare-trustline-simple'),
ticket: require('./prepare-trustline-ticket'),
frozen: require('./prepare-trustline-frozen'),
complex: require('./prepare-trustline')
},
sign: {
normal: require('./sign.json'),
escrow: require('./sign-escrow.json'),
normal: require('./sign'),
ticket: require('./sign-ticket'),
escrow: require('./sign-escrow'),
signAs: require('./sign-as')
},
signPaymentChannelClaim: require('./sign-payment-channel-claim'),
combine: {
single: require('./combine.json')
single: require('./combine')
},
submit: require('./submit.json'),
ledgerEvent: require('./ledger-event.json')
submit: require('./submit'),
ledgerEvent: require('./ledger-event')
};

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"CheckCancel\",\"CheckID\":\"49647F0D748DC3FE26BDACBC57F251AADEFFF391403EC9BF87C97F67E9977FB0\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"CheckCash\",\"CheckID\":\"838766BA2B995C00744175F69A1B11E32C3DBC40E64801A4056FCBD657F57334\",\"Amount\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Sequence\":0,\"TicketSequence\":23,\"Fee\":\"12\"}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"CheckCreate\",\"Destination\":\"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW\",\"SendMax\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Sequence\":0,\"TicketSequence\":23,\"Fee\":\"12\"}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"CancelAfter\":536544000,\"FinishAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Condition\":\"A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100\",\"Fulfillment\":\"A0028000\",\"LastLedgerSequence\":8820051,\"Fee\":\"396\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000396",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"OfferCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":23,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"TransactionType\":\"OfferCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TakerGets\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"10.1\"},\"TakerPays\":\"2000000\",\"Flags\":2148139008,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"746578742F706C61696E\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23,\"OfferSequence\":12345}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelClaim\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelCreate\",\"Amount\":\"1000000\",\"Destination\":\"rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW\",\"SettleDelay\":86400,\"PublicKey\":\"32D2471DB72B27E3310F355BB33E339BF26F8392D5A93D3BC0FC3B566612DA0F0A\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON":"{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"TransactionType\":\"PaymentChannelFund\",\"Channel\":\"C1AE6DDDEEC05CF2978C0BAD6FE302948E9533691DC749DCDD3B9E5992CA6198\",\"Amount\":\"1000000\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147811328,\"TransactionType\":\"Payment\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":\"10000\",\"InvoiceID\":\"A98FD36C17BE2B8511AD36DC335478E7E89F06262949F36EB88E2D683BBCC50A\",\"SourceTag\":14,\"DestinationTag\":58,\"Memos\":[{\"Memo\":{\"MemoType\":\"74657374\",\"MemoFormat\":\"746578742F706C61696E\",\"MemoData\":\"7465787465642064617461\"}}],\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"Payment\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"SendMax\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"TransactionType\":\"AccountSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"746578742F706C61696E\"}}],\"Domain\":\"726970706C652E636F6D\",\"Flags\":2147483648,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,8 @@
{
"TransactionType": "TicketCreate",
"Account": "r4SDqUD1ZcfoZrhnsZ94XNFKxYL4oHYJyA",
"TicketCount": 2,
"LastLedgerSequence": 13,
"Fee": "12",
"Sequence": 25
}

View File

@@ -0,0 +1,8 @@
{
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"TrustSet\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"LimitAmount\":{\"value\":\"0.1\",\"currency\":\"BTC\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":0,\"TicketSequence\":23}",
"instructions": {
"fee": "0.000012",
"ticketSequence": 23,
"maxLedgerVersion": 8820051
}
}

View File

@@ -0,0 +1,4 @@
{
"signedTransaction": "12000A2400000000202800000001202900000017684000000000002710732103E985C55BDCE4171394A0521AA84C71F81425680A7CE510AEF49662CF5A78D38674473045022100A77F102B632779C0E3F25B8715CB8FF2A15A702F3A39D1E6416C981B604D2E0302207E1DB8418D547E8AE322F49585E1C554E8759C0FBF7B88158BE3D0EE6B2E4E0A8114EB1FC04FDA0248FB6DE5BA4235425773D61DF0F3",
"id": "9F1002A8DB9D06D5F3AB2070387F17E12421DCE8444EED13E5F6928291EB4F43"
}

View File

@@ -348,6 +348,16 @@ describe('integration tests', function () {
})
})
it('ticket', function () {
return this.api.getLedgerVersion().then((ledgerVersion) => {
return this.api
.prepareTicketCreate(address, 1, instructions)
.then((prepared) =>
testTransaction(this, 'ticket', ledgerVersion, prepared)
)
})
})
it('isConnected', function () {
assert(this.api.isConnected())
})

View File

@@ -673,14 +673,6 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
babel-runtime@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4=
dependencies:
core-js "^2.4.0"
regenerator-runtime "^0.11.0"
bail@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.5.tgz#b6fa133404a392cbc1f8c4bf63f5953351e7a776"
@@ -726,6 +718,11 @@ bfj@^6.1.1:
hoopy "^0.1.4"
tryer "^1.0.1"
big-integer@^1.6.48:
version "1.6.48"
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.48.tgz#8fd88bd1632cba4a1c8c3e3d7159f08bb95b4b9e"
integrity sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w==
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
@@ -1282,11 +1279,6 @@ copy-descriptor@^0.1.0:
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
core-js@^2.4.0:
version "2.6.11"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c"
integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -3957,11 +3949,6 @@ reduce-flatten@^2.0.0:
resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27"
integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==
regenerator-runtime@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"
integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==
regex-not@^1.0.0, regex-not@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"
@@ -4133,7 +4120,7 @@ ripple-address-codec@^4.0.0:
base-x "3.0.7"
create-hash "^1.1.2"
ripple-address-codec@^4.1.0, ripple-address-codec@^4.1.1:
ripple-address-codec@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-4.1.1.tgz#48e5d76b00b6b9752b1d376646d5abbcd3c8bd67"
integrity sha512-mcVD8f7+CH6XaBnLkRcmw4KyHMufa0HTJE3TYeaecwleIQASLYVenjQmVJLgmJQcDUS2Ldh/EltqktmiFMFgkg==
@@ -4141,18 +4128,15 @@ ripple-address-codec@^4.1.0, ripple-address-codec@^4.1.1:
base-x "3.0.7"
create-hash "^1.1.2"
ripple-binary-codec@^0.2.7:
version "0.2.7"
resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-0.2.7.tgz#c5390e97e4072747a3ff386ee99558b496c6e5ab"
integrity sha512-VD+sHgZK76q3kmO765klFHPDCEveS5SUeg/bUNVpNrj7w2alyDNkbF17XNbAjFv+kSYhfsUudQanoaSs2Y6uzw==
ripple-binary-codec@1.1.0-beta.0:
version "1.1.0-beta.0"
resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-1.1.0-beta.0.tgz#65ae46f873fd9e362eb72507cce222b1a1f27d43"
integrity sha512-brpgGK6bIg/KrAr0S81tGDgnK11zLVZKuZ7Y3D7kAwwcc7HvMaCC5N0CNf2wU22fImg8Mjc+Yxc9L5DcuL4Ijw==
dependencies:
babel-runtime "^6.26.0"
bn.js "^5.1.1"
big-integer "^1.6.48"
create-hash "^1.2.0"
decimal.js "^10.2.0"
inherits "^2.0.4"
lodash "^4.17.15"
ripple-address-codec "^4.1.0"
ripple-address-codec "^4.1.1"
ripple-keypairs@^1.0.0:
version "1.0.0"