mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Replace suspended payments with escrow
This commit is contained in:
123
docs/index.md
123
docs/index.md
@@ -24,9 +24,9 @@
|
||||
- [Order](#order)
|
||||
- [Order Cancellation](#order-cancellation)
|
||||
- [Settings](#settings)
|
||||
- [Suspended Payment Creation](#suspended-payment-creation)
|
||||
- [Suspended Payment Cancellation](#suspended-payment-cancellation)
|
||||
- [Suspended Payment Execution](#suspended-payment-execution)
|
||||
- [Escrow Creation](#escrow-creation)
|
||||
- [Escrow Cancellation](#escrow-cancellation)
|
||||
- [Escrow Execution](#escrow-execution)
|
||||
- [API Methods](#api-methods)
|
||||
- [connect](#connect)
|
||||
- [disconnect](#disconnect)
|
||||
@@ -50,9 +50,9 @@
|
||||
- [prepareOrder](#prepareorder)
|
||||
- [prepareOrderCancellation](#prepareordercancellation)
|
||||
- [prepareSettings](#preparesettings)
|
||||
- [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
|
||||
- [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
|
||||
- [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
|
||||
- [prepareEscrowCreation](#prepareescrowcreation)
|
||||
- [prepareEscrowCancellation](#prepareescrowcancellation)
|
||||
- [prepareEscrowExecution](#prepareescrowexecution)
|
||||
- [sign](#sign)
|
||||
- [combine](#combine)
|
||||
- [submit](#submit)
|
||||
@@ -180,9 +180,9 @@ Methods that depend on the state of the Ripple Consensus Ledger are unavailable
|
||||
* [prepareOrder](#prepareorder)
|
||||
* [prepareOrderCancellation](#prepareordercancellation)
|
||||
* [prepareSettings](#preparesettings)
|
||||
* [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
|
||||
* [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
|
||||
* [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
|
||||
* [prepareEscrowCreation](#prepareescrowcreation)
|
||||
* [prepareEscrowCancellation](#prepareescrowcancellation)
|
||||
* [prepareEscrowExecution](#prepareescrowexecution)
|
||||
* [sign](#sign)
|
||||
* [generateAddress](#generateaddress)
|
||||
* [computeLedgerHash](#computeledgerhash)
|
||||
@@ -261,11 +261,11 @@ Type | Description
|
||||
[orderCancellation](#order-cancellation) | An `orderCancellation` transaction cancels an order in the Ripple Consensus Ledger's order book.
|
||||
[trustline](#trustline) | A `trustline` transactions creates or modifies a trust line between two accounts.
|
||||
[settings](#settings) | A `settings` transaction modifies the settings of an account in the Ripple Consensus Ledger.
|
||||
[suspendedPaymentCreation](#suspended-payment-creation) | A `suspendedPaymentCreation` transaction creates a suspended payment on the ledger, which locks XRP until a cryptographic condition is met or it expires. It is like an escrow service where the Ripple network acts as the escrow agent.
|
||||
[suspendedPaymentCancellation](#suspended-payment-cancellation) | A `suspendedPaymentCancellation` transaction unlocks the funds in a suspended payment and sends them back to the creator of the suspended payment, but it will only work after the suspended payment expires.
|
||||
[suspendedPaymentExecution](#suspended-payment-execution) | A `suspendedPaymentExecution` transaction unlocks the funds in a suspended payment and sends them to the destination of the suspended payment, but it will only work if the cryptographic condition is provided.
|
||||
[escrowCreation](#escrow-creation) | An `escrowCreation` transaction creates an escrow on the ledger, which locks XRP until a cryptographic condition is met or it expires. It is like an escrow service where the Ripple network acts as the escrow agent.
|
||||
[escrowCancellation](#escrow-cancellation) | An `escrowCancellation` transaction unlocks the funds in an escrow and sends them back to the creator of the escrow, but it will only work after the escrow expires.
|
||||
[escrowExecution](#escrow-execution) | An `escrowExecution` transaction unlocks the funds in an escrow and sends them to the destination of the escrow, but it will only work if the cryptographic condition is provided.
|
||||
|
||||
The three "suspended payment" transaction types are not supported by the production Ripple peer-to-peer network at this time. They are available for testing purposes if you [configure RippleAPI](#boilerplate) to connect to the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) instead.
|
||||
The three "escrow" transaction types are not supported by the production Ripple peer-to-peer network at this time. They are available for testing purposes if you [configure RippleAPI](#boilerplate) to connect to the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) instead.
|
||||
|
||||
## Transaction Flow
|
||||
|
||||
@@ -277,9 +277,9 @@ Executing a transaction with `RippleAPI` requires the following four steps:
|
||||
* [prepareOrder](#prepareorder)
|
||||
* [prepareOrderCancellation](#prepareordercancellation)
|
||||
* [prepareSettings](#preparesettings)
|
||||
* [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
|
||||
* [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
|
||||
* [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
|
||||
* [prepareEscrowCreation](#prepareescrowcreation)
|
||||
* [prepareEscrowCancellation](#prepareescrowcancellation)
|
||||
* [prepareEscrowExecution](#prepareescrowexecution)
|
||||
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.
|
||||
@@ -518,7 +518,7 @@ transferRate | number,null | *Optional* The fee to charge when users transfer t
|
||||
```
|
||||
|
||||
|
||||
## Suspended Payment Creation
|
||||
## Escrow Creation
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
@@ -532,9 +532,9 @@ destination | object | Fields pertaining to the destination of the payment.
|
||||
*destination.* address | [address](#ripple-address) | The address to receive at.
|
||||
*destination.* amount | [laxAmount](#amount) | An exact amount to deliver to the recipient. If the counterparty is not specified, amounts with any counterparty may be used. (This field is exclusive with destination.minAmount).
|
||||
*destination.* tag | integer | *Optional* An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Ripple account.
|
||||
allowCancelAfter | date-time string | *Optional* If present, the suspended payment may be cancelled after this time.
|
||||
allowExecuteAfter | date-time string | *Optional* If present, the suspended payment can not be executed before this time.
|
||||
digest | string | *Optional* If present, proof is required upon execution.
|
||||
allowCancelAfter | date-time string | *Optional* If present, the escrow may be cancelled after this time.
|
||||
allowExecuteAfter | date-time string | *Optional* If present, the escrow can not be executed before this time.
|
||||
condition | string | *Optional* If present, fulfillment is required upon execution.
|
||||
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
|
||||
|
||||
### Example
|
||||
@@ -563,14 +563,14 @@ memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the
|
||||
```
|
||||
|
||||
|
||||
## Suspended Payment Cancellation
|
||||
## Escrow Cancellation
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
owner | [address](#ripple-address) | The address of the owner of the suspended payment to cancel.
|
||||
suspensionSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to cancel.
|
||||
owner | [address](#ripple-address) | The address of the owner of the escrow to cancel.
|
||||
escrowSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to cancel.
|
||||
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
|
||||
|
||||
### Example
|
||||
@@ -579,23 +579,22 @@ memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the
|
||||
```json
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234
|
||||
"escrowSequence": 1234
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Suspended Payment Execution
|
||||
## Escrow Execution
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
owner | [address](#ripple-address) | The address of the owner of the suspended payment to execute.
|
||||
suspensionSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to execute.
|
||||
digest | string | *Optional* The original `digest` from the suspended payment creation transaction. This is sha256 hash of `proof` string. It is replicated here so that the relatively expensive hashing operation can be delegated to a server without ledger history and the server with ledger history only has to do a quick comparison of the old digest with the new digest.
|
||||
owner | [address](#ripple-address) | The address of the owner of the escrow to execute.
|
||||
escrowSequence | [sequence](#account-sequence-number) | The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to execute.
|
||||
condition | string | *Optional* The original `condition` from the escrow creation transaction. This is sha256 hash of `fulfillment` string. It is replicated here so that the relatively expensive hashing operation can be delegated to a server without ledger history and the server with ledger history only has to do a quick comparison of the old condition with the new condition.
|
||||
fulfillment | string | *Optional* A value that produces the condition when hashed. It must be 32 charaters long and contain only 8-bit characters.
|
||||
memos | [memos](#transaction-memos) | *Optional* Array of memos to attach to the transaction.
|
||||
method | integer | *Optional* The method for verifying the proof; only method `1` is supported.
|
||||
proof | string | *Optional* A value that produces the digest when hashed. It must be 32 charaters long and contain only 8-bit characters.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -603,10 +602,9 @@ proof | string | *Optional* A value that produces the digest when hashed. It mus
|
||||
```json
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234,
|
||||
"method": 1,
|
||||
"digest": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"proof": "this must have 32 characters...."
|
||||
"escrowSequence": 1234,
|
||||
"condition": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"fulfillment": "this must have 32 characters...."
|
||||
}
|
||||
```
|
||||
|
||||
@@ -3132,20 +3130,20 @@ return api.prepareSettings(address, settings)
|
||||
```
|
||||
|
||||
|
||||
## prepareSuspendedPaymentCreation
|
||||
## prepareEscrowCreation
|
||||
|
||||
`prepareSuspendedPaymentCreation(address: string, suspendedPaymentCreation: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
address | [address](#ripple-address) | The address of the account that is creating the transaction.
|
||||
suspendedPaymentCreation | [suspendedPaymentCreation](#suspended-payment-creation) | The specification of the suspended payment creation to prepare.
|
||||
escrowCreation | [escrowCreation](#escrow-creation) | The specification of the escrow creation to prepare.
|
||||
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction
|
||||
|
||||
### Return Value
|
||||
@@ -3168,7 +3166,7 @@ instructions | object | The instructions for how to execute the transaction afte
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentCreation = {
|
||||
const escrowCreation = {
|
||||
"source": {
|
||||
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"maxAmount": {
|
||||
@@ -3187,14 +3185,14 @@ const suspendedPaymentCreation = {
|
||||
},
|
||||
"allowCancelAfter": "2014-09-24T21:21:50.000Z"
|
||||
};
|
||||
return api.prepareSuspendedPaymentCreation(address, suspendedPaymentCreation).then(prepared =>
|
||||
return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
@@ -3204,20 +3202,20 @@ return api.prepareSuspendedPaymentCreation(address, suspendedPaymentCreation).th
|
||||
```
|
||||
|
||||
|
||||
## prepareSuspendedPaymentCancellation
|
||||
## prepareEscrowCancellation
|
||||
|
||||
`prepareSuspendedPaymentCancellation(address: string, suspendedPaymentCancellation: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
address | [address](#ripple-address) | The address of the account that is creating the transaction.
|
||||
suspendedPaymentCancellation | [suspendedPaymentCancellation](#suspended-payment-cancellation) | The specification of the suspended payment cancellation to prepare.
|
||||
escrowCancellation | [escrowCancellation](#escrow-cancellation) | The specification of the escrow cancellation to prepare.
|
||||
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction
|
||||
|
||||
### Return Value
|
||||
@@ -3240,18 +3238,18 @@ instructions | object | The instructions for how to execute the transaction afte
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentCancellation = {
|
||||
const escrowCancellation = {
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234
|
||||
"escrowSequence": 1234
|
||||
};
|
||||
return api.prepareSuspendedPaymentCancellation(address, suspendedPaymentCancellation).then(prepared =>
|
||||
return api.prepareEscrowCancellation(address, escrowCancellation).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
@@ -3261,20 +3259,20 @@ return api.prepareSuspendedPaymentCancellation(address, suspendedPaymentCancella
|
||||
```
|
||||
|
||||
|
||||
## prepareSuspendedPaymentExecution
|
||||
## prepareEscrowExecution
|
||||
|
||||
`prepareSuspendedPaymentExecution(address: string, suspendedPaymentExecution: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment execution transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow execution transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
address | [address](#ripple-address) | The address of the account that is creating the transaction.
|
||||
suspendedPaymentExecution | [suspendedPaymentExecution](#suspended-payment-execution) | The specification of the suspended payment execution to prepare.
|
||||
escrowExecution | [escrowExecution](#escrow-execution) | The specification of the escrow execution to prepare.
|
||||
instructions | [instructions](#transaction-instructions) | *Optional* Instructions for executing the transaction
|
||||
|
||||
### Return Value
|
||||
@@ -3297,21 +3295,20 @@ instructions | object | The instructions for how to execute the transaction afte
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentExecution = {
|
||||
const escrowExecution = {
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234,
|
||||
"method": 1,
|
||||
"digest": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"proof": "this must have 32 characters...."
|
||||
"escrowSequence": 1234,
|
||||
"condition": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"fulfillment": "this must have 32 characters...."
|
||||
};
|
||||
return api.prepareSuspendedPaymentExecution(address, suspendedPaymentExecution).then(prepared =>
|
||||
return api.prepareEscrowExecution(address, escrowExecution).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Method\":1,\"Digest\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Proof\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Condition\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Fulfillment\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
<% include prepareOrder.md.ejs %>
|
||||
<% include prepareOrderCancellation.md.ejs %>
|
||||
<% include prepareSettings.md.ejs %>
|
||||
<% include prepareSuspendedPaymentCreation.md.ejs %>
|
||||
<% include prepareSuspendedPaymentCancellation.md.ejs %>
|
||||
<% include prepareSuspendedPaymentExecution.md.ejs %>
|
||||
<% include prepareEscrowCreation.md.ejs %>
|
||||
<% include prepareEscrowCancellation.md.ejs %>
|
||||
<% include prepareEscrowExecution.md.ejs %>
|
||||
<% include sign.md.ejs %>
|
||||
<% include combine.md.ejs %>
|
||||
<% include submit.md.ejs %>
|
||||
|
||||
@@ -18,9 +18,9 @@ Methods that depend on the state of the Ripple Consensus Ledger are unavailable
|
||||
* [prepareOrder](#prepareorder)
|
||||
* [prepareOrderCancellation](#prepareordercancellation)
|
||||
* [prepareSettings](#preparesettings)
|
||||
* [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
|
||||
* [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
|
||||
* [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
|
||||
* [prepareEscrowCreation](#prepareescrowcreation)
|
||||
* [prepareEscrowCancellation](#prepareescrowcancellation)
|
||||
* [prepareEscrowExecution](#prepareescrowexecution)
|
||||
* [sign](#sign)
|
||||
* [generateAddress](#generateaddress)
|
||||
* [computeLedgerHash](#computeledgerhash)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## prepareSuspendedPaymentCancellation
|
||||
## prepareEscrowCancellation
|
||||
|
||||
`prepareSuspendedPaymentCancellation(address: string, suspendedPaymentCancellation: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow cancellation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
<%- renderSchema('input/prepare-suspended-payment-cancellation.json') %>
|
||||
<%- renderSchema('input/prepare-escrow-cancellation.json') %>
|
||||
|
||||
### Return Value
|
||||
|
||||
@@ -24,9 +24,9 @@ All "prepare*" methods have the same return type.
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentCancellation = <%- importFile('test/fixtures/requests/prepare-suspended-payment-cancellation.json') %>;
|
||||
return api.prepareSuspendedPaymentCancellation(address, suspendedPaymentCancellation).then(prepared =>
|
||||
const escrowCancellation = <%- importFile('test/fixtures/requests/prepare-escrow-cancellation.json') %>;
|
||||
return api.prepareEscrowCancellation(address, escrowCancellation).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
<%- renderFixture('responses/prepare-suspended-payment-cancellation.json') %>
|
||||
<%- renderFixture('responses/prepare-escrow-cancellation.json') %>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## prepareSuspendedPaymentCreation
|
||||
## prepareEscrowCreation
|
||||
|
||||
`prepareSuspendedPaymentCreation(address: string, suspendedPaymentCreation: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow creation transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
<%- renderSchema('input/prepare-suspended-payment-creation.json') %>
|
||||
<%- renderSchema('input/prepare-escrow-creation.json') %>
|
||||
|
||||
### Return Value
|
||||
|
||||
@@ -24,9 +24,9 @@ All "prepare*" methods have the same return type.
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentCreation = <%- importFile('test/fixtures/requests/prepare-suspended-payment-creation.json') %>;
|
||||
return api.prepareSuspendedPaymentCreation(address, suspendedPaymentCreation).then(prepared =>
|
||||
const escrowCreation = <%- importFile('test/fixtures/requests/prepare-escrow-creation.json') %>;
|
||||
return api.prepareEscrowCreation(address, escrowCreation).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
<%- renderFixture('responses/prepare-suspended-payment-creation.json') %>
|
||||
<%- renderFixture('responses/prepare-escrow-creation.json') %>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
## prepareSuspendedPaymentExecution
|
||||
## prepareEscrowExecution
|
||||
|
||||
`prepareSuspendedPaymentExecution(address: string, suspendedPaymentExecution: Object, instructions: Object): Promise<Object>`
|
||||
`prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise<Object>`
|
||||
|
||||
Prepare a suspended payment execution transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
Prepare an escrow execution transaction. The prepared transaction must subsequently be [signed](#sign) and [submitted](#submit).
|
||||
|
||||
**Caution:** Suspended Payments are currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
**Caution:** Escrow is currently available on the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) only.
|
||||
|
||||
### Parameters
|
||||
|
||||
<%- renderSchema('input/prepare-suspended-payment-execution.json') %>
|
||||
<%- renderSchema('input/prepare-escrow-execution.json') %>
|
||||
|
||||
### Return Value
|
||||
|
||||
@@ -24,9 +24,9 @@ All "prepare*" methods have the same return type.
|
||||
|
||||
```javascript
|
||||
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
const suspendedPaymentExecution = <%- importFile('test/fixtures/requests/prepare-suspended-payment-execution.json') %>;
|
||||
return api.prepareSuspendedPaymentExecution(address, suspendedPaymentExecution).then(prepared =>
|
||||
const escrowExecution = <%- importFile('test/fixtures/requests/prepare-escrow-execution.json') %>;
|
||||
return api.prepareEscrowExecution(address, escrowExecution).then(prepared =>
|
||||
{/* ... */});
|
||||
```
|
||||
|
||||
<%- renderFixture('responses/prepare-suspended-payment-execution.json') %>
|
||||
<%- renderFixture('responses/prepare-escrow-execution.json') %>
|
||||
|
||||
@@ -52,32 +52,32 @@ See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
<%- renderFixture('requests/prepare-settings.json') %>
|
||||
|
||||
## Suspended Payment Creation
|
||||
## Escrow Creation
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
<%- renderSchema('specifications/suspended-payment-creation.json') %>
|
||||
<%- renderSchema('specifications/escrow-creation.json') %>
|
||||
|
||||
### Example
|
||||
|
||||
<%- renderFixture('requests/prepare-suspended-payment-creation.json') %>
|
||||
<%- renderFixture('requests/prepare-escrow-creation.json') %>
|
||||
|
||||
## Suspended Payment Cancellation
|
||||
## Escrow Cancellation
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
<%- renderSchema('specifications/suspended-payment-cancellation.json') %>
|
||||
<%- renderSchema('specifications/escrow-cancellation.json') %>
|
||||
|
||||
### Example
|
||||
|
||||
<%- renderFixture('requests/prepare-suspended-payment-cancellation.json') %>
|
||||
<%- renderFixture('requests/prepare-escrow-cancellation.json') %>
|
||||
|
||||
## Suspended Payment Execution
|
||||
## Escrow Execution
|
||||
|
||||
See [Transaction Types](#transaction-types) for a description.
|
||||
|
||||
<%- renderSchema('specifications/suspended-payment-execution.json') %>
|
||||
<%- renderSchema('specifications/escrow-execution.json') %>
|
||||
|
||||
### Example
|
||||
|
||||
<%- renderFixture('requests/prepare-suspended-payment-execution.json') %>
|
||||
<%- renderFixture('requests/prepare-escrow-execution.json') %>
|
||||
|
||||
@@ -11,11 +11,11 @@ Type | Description
|
||||
[orderCancellation](#order-cancellation) | An `orderCancellation` transaction cancels an order in the Ripple Consensus Ledger's order book.
|
||||
[trustline](#trustline) | A `trustline` transactions creates or modifies a trust line between two accounts.
|
||||
[settings](#settings) | A `settings` transaction modifies the settings of an account in the Ripple Consensus Ledger.
|
||||
[suspendedPaymentCreation](#suspended-payment-creation) | A `suspendedPaymentCreation` transaction creates a suspended payment on the ledger, which locks XRP until a cryptographic condition is met or it expires. It is like an escrow service where the Ripple network acts as the escrow agent.
|
||||
[suspendedPaymentCancellation](#suspended-payment-cancellation) | A `suspendedPaymentCancellation` transaction unlocks the funds in a suspended payment and sends them back to the creator of the suspended payment, but it will only work after the suspended payment expires.
|
||||
[suspendedPaymentExecution](#suspended-payment-execution) | A `suspendedPaymentExecution` transaction unlocks the funds in a suspended payment and sends them to the destination of the suspended payment, but it will only work if the cryptographic condition is provided.
|
||||
[escrowCreation](#escrow-creation) | An `escrowCreation` transaction creates an escrow on the ledger, which locks XRP until a cryptographic condition is met or it expires. It is like an escrow service where the Ripple network acts as the escrow agent.
|
||||
[escrowCancellation](#escrow-cancellation) | An `escrowCancellation` transaction unlocks the funds in an escrow and sends them back to the creator of the escrow, but it will only work after the escrow expires.
|
||||
[escrowExecution](#escrow-execution) | An `escrowExecution` transaction unlocks the funds in an escrow and sends them to the destination of the escrow, but it will only work if the cryptographic condition is provided.
|
||||
|
||||
The three "suspended payment" transaction types are not supported by the production Ripple peer-to-peer network at this time. They are available for testing purposes if you [configure RippleAPI](#boilerplate) to connect to the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) instead.
|
||||
The three "escrow" transaction types are not supported by the production Ripple peer-to-peer network at this time. They are available for testing purposes if you [configure RippleAPI](#boilerplate) to connect to the [Ripple Test Net](https://ripple.com/build/ripple-test-net/) instead.
|
||||
|
||||
## Transaction Flow
|
||||
|
||||
@@ -27,9 +27,9 @@ Executing a transaction with `RippleAPI` requires the following four steps:
|
||||
* [prepareOrder](#prepareorder)
|
||||
* [prepareOrderCancellation](#prepareordercancellation)
|
||||
* [prepareSettings](#preparesettings)
|
||||
* [prepareSuspendedPaymentCreation](#preparesuspendedpaymentcreation)
|
||||
* [prepareSuspendedPaymentCancellation](#preparesuspendedpaymentcancellation)
|
||||
* [prepareSuspendedPaymentExecution](#preparesuspendedpaymentexecution)
|
||||
* [prepareEscrowCreation](#prepareescrowcreation)
|
||||
* [prepareEscrowCancellation](#prepareescrowcancellation)
|
||||
* [prepareEscrowExecution](#prepareescrowexecution)
|
||||
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.
|
||||
|
||||
18
src/api.js
18
src/api.js
@@ -36,12 +36,12 @@ const preparePayment = require('./transaction/payment')
|
||||
const prepareTrustline = require('./transaction/trustline')
|
||||
const prepareOrder = require('./transaction/order')
|
||||
const prepareOrderCancellation = require('./transaction/ordercancellation')
|
||||
const prepareSuspendedPaymentCreation =
|
||||
require('./transaction/suspended-payment-creation')
|
||||
const prepareSuspendedPaymentExecution =
|
||||
require('./transaction/suspended-payment-execution')
|
||||
const prepareSuspendedPaymentCancellation =
|
||||
require('./transaction/suspended-payment-cancellation')
|
||||
const prepareEscrowCreation =
|
||||
require('./transaction/escrow-creation')
|
||||
const prepareEscrowExecution =
|
||||
require('./transaction/escrow-execution')
|
||||
const prepareEscrowCancellation =
|
||||
require('./transaction/escrow-cancellation')
|
||||
const prepareSettings = require('./transaction/settings')
|
||||
const sign = require('./transaction/sign')
|
||||
const combine = require('./transaction/combine')
|
||||
@@ -127,9 +127,9 @@ _.assign(RippleAPI.prototype, {
|
||||
prepareTrustline,
|
||||
prepareOrder,
|
||||
prepareOrderCancellation,
|
||||
prepareSuspendedPaymentCreation,
|
||||
prepareSuspendedPaymentExecution,
|
||||
prepareSuspendedPaymentCancellation,
|
||||
prepareEscrowCreation,
|
||||
prepareEscrowExecution,
|
||||
prepareEscrowCancellation,
|
||||
prepareSettings,
|
||||
sign,
|
||||
combine,
|
||||
|
||||
@@ -46,11 +46,11 @@ function loadSchemas() {
|
||||
require('./schemas/objects/settings.json'),
|
||||
require('./schemas/specifications/settings.json'),
|
||||
require('./schemas/specifications/payment.json'),
|
||||
require('./schemas/specifications/suspended-payment-cancellation.json'),
|
||||
require('./schemas/specifications/escrow-cancellation.json'),
|
||||
require('./schemas/specifications/order-cancellation.json'),
|
||||
require('./schemas/specifications/order.json'),
|
||||
require('./schemas/specifications/suspended-payment-execution.json'),
|
||||
require('./schemas/specifications/suspended-payment-creation.json'),
|
||||
require('./schemas/specifications/escrow-execution.json'),
|
||||
require('./schemas/specifications/escrow-creation.json'),
|
||||
require('./schemas/specifications/trustline.json'),
|
||||
require('./schemas/output/sign.json'),
|
||||
require('./schemas/output/submit.json'),
|
||||
@@ -88,9 +88,9 @@ function loadSchemas() {
|
||||
require('./schemas/input/prepare-trustline.json'),
|
||||
require('./schemas/input/prepare-order-cancellation.json'),
|
||||
require('./schemas/input/prepare-settings.json'),
|
||||
require('./schemas/input/prepare-suspended-payment-creation.json'),
|
||||
require('./schemas/input/prepare-suspended-payment-cancellation.json'),
|
||||
require('./schemas/input/prepare-suspended-payment-execution.json'),
|
||||
require('./schemas/input/prepare-escrow-creation.json'),
|
||||
require('./schemas/input/prepare-escrow-cancellation.json'),
|
||||
require('./schemas/input/prepare-escrow-execution.json'),
|
||||
require('./schemas/input/compute-ledger-hash.json'),
|
||||
require('./schemas/input/sign.json'),
|
||||
require('./schemas/input/submit.json'),
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "prepareSuspendedPaymentCancellationParameters",
|
||||
"title": "prepareEscrowCancellationParameters",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {
|
||||
"$ref": "address",
|
||||
"description": "The address of the account that is creating the transaction."
|
||||
},
|
||||
"suspendedPaymentCancellation": {
|
||||
"$ref": "suspendedPaymentCancellation",
|
||||
"description": "The specification of the suspended payment cancellation to prepare."
|
||||
"escrowCancellation": {
|
||||
"$ref": "escrowCancellation",
|
||||
"description": "The specification of the escrow cancellation to prepare."
|
||||
},
|
||||
"instructions": {"$ref": "instructions"}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["address", "suspendedPaymentCancellation"]
|
||||
"required": ["address", "escrowCancellation"]
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "prepareSuspendedPaymentCreationParameters",
|
||||
"title": "prepareEscrowCreationParameters",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {
|
||||
"$ref": "address",
|
||||
"description": "The address of the account that is creating the transaction."
|
||||
},
|
||||
"suspendedPaymentCreation": {
|
||||
"$ref": "suspendedPaymentCreation",
|
||||
"description": "The specification of the suspended payment creation to prepare."
|
||||
"escrowCreation": {
|
||||
"$ref": "escrowCreation",
|
||||
"description": "The specification of the escrow creation to prepare."
|
||||
},
|
||||
"instructions": {"$ref": "instructions"}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["address", "suspendedPaymentCreation"]
|
||||
"required": ["address", "escrowCreation"]
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "prepareSuspendedPaymentExecutionParameters",
|
||||
"title": "prepareEscrowExecutionParameters",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"address": {
|
||||
"$ref": "address",
|
||||
"description": "The address of the account that is creating the transaction."
|
||||
},
|
||||
"suspendedPaymentExecution": {
|
||||
"$ref": "suspendedPaymentExecution",
|
||||
"description": "The specification of the suspended payment execution to prepare."
|
||||
"escrowExecution": {
|
||||
"$ref": "escrowExecution",
|
||||
"description": "The specification of the escrow execution to prepare."
|
||||
},
|
||||
"instructions": {"$ref": "instructions"}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["address", "suspendedPaymentExecution"]
|
||||
"required": ["address", "escrowExecution"]
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
"description": "The type of the transaction.",
|
||||
"type": "string",
|
||||
"enum": ["payment", "order", "orderCancellation", "trustline", "settings",
|
||||
"suspendedPaymentCreation", "suspendedPaymentCancellation",
|
||||
"suspendedPaymentExecution"]
|
||||
"escrowCreation", "escrowCancellation",
|
||||
"escrowExecution"]
|
||||
}
|
||||
|
||||
@@ -59,20 +59,20 @@
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"type": {"enum": ["suspendedPaymentCreation"]},
|
||||
"specification": {"$ref": "suspendedPaymentCreation"}
|
||||
"type": {"enum": ["escrowCreation"]},
|
||||
"specification": {"$ref": "escrowCreation"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"type": {"enum": ["suspendedPaymentCancellation"]},
|
||||
"specification": {"$ref": "suspendedPaymentCancellation"}
|
||||
"type": {"enum": ["escrowCancellation"]},
|
||||
"specification": {"$ref": "escrowCancellation"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"type": {"enum": ["suspendedPaymentExecution"]},
|
||||
"specification": {"$ref": "suspendedPaymentExecution"}
|
||||
"type": {"enum": ["escrowExecution"]},
|
||||
"specification": {"$ref": "escrowExecution"}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "suspendedPaymentCancellation",
|
||||
"link": "suspended-payment-cancellation",
|
||||
"title": "escrowCancellation",
|
||||
"link": "escrow-cancellation",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"memos": {"$ref": "memos"},
|
||||
"owner": {
|
||||
"$ref": "address",
|
||||
"description": "The address of the owner of the suspended payment to cancel."
|
||||
"description": "The address of the owner of the escrow to cancel."
|
||||
},
|
||||
"suspensionSequence": {
|
||||
"escrowSequence": {
|
||||
"$ref": "sequence",
|
||||
"description": "The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to cancel."
|
||||
"description": "The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to cancel."
|
||||
}
|
||||
},
|
||||
"required": ["owner", "suspensionSequence"],
|
||||
"required": ["owner", "escrowSequence"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "suspendedPaymentCreation",
|
||||
"link": "suspended-payment-creation",
|
||||
"title": "escrowCreation",
|
||||
"link": "escrow-creation",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"source": {
|
||||
@@ -13,19 +13,19 @@
|
||||
"description": "Fields pertaining to the destination of the payment."
|
||||
},
|
||||
"memos": {"$ref": "memos"},
|
||||
"digest": {
|
||||
"condition": {
|
||||
"$ref": "hash256",
|
||||
"description": "If present, proof is required upon execution."
|
||||
"description": "If present, fulfillment is required upon execution."
|
||||
},
|
||||
"allowCancelAfter": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "If present, the suspended payment may be cancelled after this time."
|
||||
"description": "If present, the escrow may be cancelled after this time."
|
||||
},
|
||||
"allowExecuteAfter": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "If present, the suspended payment can not be executed before this time."
|
||||
"description": "If present, the escrow can not be executed before this time."
|
||||
}
|
||||
},
|
||||
"required": ["source", "destination"],
|
||||
|
||||
@@ -1,34 +1,28 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "suspendedPaymentExecution",
|
||||
"link": "suspended-payment-execution",
|
||||
"title": "escrowExecution",
|
||||
"link": "escrow-execution",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"memos": {"$ref": "memos"},
|
||||
"owner": {
|
||||
"$ref": "address",
|
||||
"description": "The address of the owner of the suspended payment to execute."
|
||||
"description": "The address of the owner of the escrow to execute."
|
||||
},
|
||||
"suspensionSequence": {
|
||||
"escrowSequence": {
|
||||
"$ref": "sequence",
|
||||
"description": "The [account sequence number](#account-sequence-number) of the [Suspended Payment Creation](#suspended-payment-creation) transaction for the suspended payment to execute."
|
||||
"description": "The [account sequence number](#account-sequence-number) of the [Escrow Creation](#escrow-creation) transaction for the escrow to execute."
|
||||
},
|
||||
"method": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255,
|
||||
"description": "The method for verifying the proof; only method `1` is supported."
|
||||
},
|
||||
"digest": {
|
||||
"condition": {
|
||||
"$ref": "hash256",
|
||||
"description": "The original `digest` from the suspended payment creation transaction. This is sha256 hash of `proof` string. It is replicated here so that the relatively expensive hashing operation can be delegated to a server without ledger history and the server with ledger history only has to do a quick comparison of the old digest with the new digest."
|
||||
"description": "The original `condition` from the escrow creation transaction. This is sha256 hash of `fulfillment` string. It is replicated here so that the relatively expensive hashing operation can be delegated to a server without ledger history and the server with ledger history only has to do a quick comparison of the old condition with the new condition."
|
||||
},
|
||||
"proof": {
|
||||
"fulfillment": {
|
||||
"type": "string",
|
||||
"description": "A value that produces the digest when hashed. It must be 32 charaters long and contain only 8-bit characters.",
|
||||
"description": "A value that produces the condition when hashed. It must be 32 charaters long and contain only 8-bit characters.",
|
||||
"pattern": "^[\\x00-\\xFF]{32}$"
|
||||
}
|
||||
},
|
||||
"required": ["owner", "suspensionSequence"],
|
||||
"required": ["owner", "escrowSequence"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ module.exports = {
|
||||
_.partial(schemaValidate, 'prepareOrderCancellationParameters'),
|
||||
prepareTrustline: _.partial(schemaValidate, 'prepareTrustlineParameters'),
|
||||
prepareSettings: _.partial(schemaValidate, 'prepareSettingsParameters'),
|
||||
prepareSuspendedPaymentCreation: _.partial(schemaValidate,
|
||||
'prepareSuspendedPaymentCreationParameters'),
|
||||
prepareSuspendedPaymentCancellation: _.partial(schemaValidate,
|
||||
'prepareSuspendedPaymentCancellationParameters'),
|
||||
prepareSuspendedPaymentExecution: _.partial(schemaValidate,
|
||||
'prepareSuspendedPaymentExecutionParameters'),
|
||||
prepareEscrowCreation: _.partial(schemaValidate,
|
||||
'prepareEscrowCreationParameters'),
|
||||
prepareEscrowCancellation: _.partial(schemaValidate,
|
||||
'prepareEscrowCancellationParameters'),
|
||||
prepareEscrowExecution: _.partial(schemaValidate,
|
||||
'prepareEscrowExecutionParameters'),
|
||||
sign: _.partial(schemaValidate, 'signParameters'),
|
||||
combine: _.partial(schemaValidate, 'combineParameters'),
|
||||
submit: _.partial(schemaValidate, 'submitParameters'),
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
const assert = require('assert')
|
||||
const utils = require('./utils')
|
||||
|
||||
function parseSuspendedPaymentCancellation(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'SuspendedPaymentCancel')
|
||||
function parseEscrowCancellation(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'EscrowCancel')
|
||||
|
||||
return utils.removeUndefined({
|
||||
memos: utils.parseMemos(tx),
|
||||
owner: tx.Owner,
|
||||
suspensionSequence: tx.OfferSequence
|
||||
escrowSequence: tx.OfferSequence
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = parseSuspendedPaymentCancellation
|
||||
module.exports = parseEscrowCancellation
|
||||
|
||||
@@ -10,8 +10,8 @@ function removeGenericCounterparty(amount, address) {
|
||||
_.omit(amount, 'counterparty') : amount
|
||||
}
|
||||
|
||||
function parseSuspendedPaymentCreation(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'SuspendedPaymentCreate')
|
||||
function parseEscrowCreation(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'EscrowCreate')
|
||||
|
||||
const source = {
|
||||
address: tx.Account,
|
||||
@@ -30,10 +30,10 @@ function parseSuspendedPaymentCreation(tx: Object): Object {
|
||||
source: utils.removeUndefined(source),
|
||||
destination: utils.removeUndefined(destination),
|
||||
memos: utils.parseMemos(tx),
|
||||
digest: tx.Digest,
|
||||
condition: tx.Condition,
|
||||
allowCancelAfter: utils.parseTimestamp(tx.CancelAfter),
|
||||
allowExecuteAfter: utils.parseTimestamp(tx.FinishAfter)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = parseSuspendedPaymentCreation
|
||||
module.exports = parseEscrowCreation
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
const assert = require('assert')
|
||||
const utils = require('./utils')
|
||||
|
||||
function parseSuspendedPaymentExecution(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'SuspendedPaymentFinish')
|
||||
function parseEscrowExecution(tx: Object): Object {
|
||||
assert(tx.TransactionType === 'EscrowFinish')
|
||||
|
||||
return utils.removeUndefined({
|
||||
memos: utils.parseMemos(tx),
|
||||
owner: tx.Owner,
|
||||
suspensionSequence: tx.OfferSequence,
|
||||
method: tx.Method,
|
||||
digest: tx.Digest,
|
||||
proof: tx.Proof ? utils.hexToString(tx.Proof) : undefined
|
||||
escrowSequence: tx.OfferSequence,
|
||||
condition: tx.Condition,
|
||||
fulfillment: tx.Fulfillment ? utils.hexToString(tx.Fulfillment) : undefined
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = parseSuspendedPaymentExecution
|
||||
module.exports = parseEscrowExecution
|
||||
|
||||
@@ -7,10 +7,9 @@ const parseTrustline = require('./trustline')
|
||||
const parseOrder = require('./order')
|
||||
const parseOrderCancellation = require('./cancellation')
|
||||
const parseSettings = require('./settings')
|
||||
const parseSuspendedPaymentCreation = require('./suspended-payment-creation')
|
||||
const parseSuspendedPaymentExecution = require('./suspended-payment-execution')
|
||||
const parseSuspendedPaymentCancellation =
|
||||
require('./suspended-payment-cancellation')
|
||||
const parseEscrowCreation = require('./escrow-creation')
|
||||
const parseEscrowExecution = require('./escrow-execution')
|
||||
const parseEscrowCancellation = require('./escrow-cancellation')
|
||||
const parseFeeUpdate = require('./fee-update')
|
||||
const parseAmendment = require('./amendment')
|
||||
|
||||
@@ -22,9 +21,9 @@ function parseTransactionType(type) {
|
||||
OfferCancel: 'orderCancellation',
|
||||
AccountSet: 'settings',
|
||||
SetRegularKey: 'settings',
|
||||
SuspendedPaymentCreate: 'suspendedPaymentCreation',
|
||||
SuspendedPaymentFinish: 'suspendedPaymentExecution',
|
||||
SuspendedPaymentCancel: 'suspendedPaymentCancellation',
|
||||
EscrowCreate: 'escrowCreation',
|
||||
EscrowFinish: 'escrowExecution',
|
||||
EscrowCancel: 'escrowCancellation',
|
||||
SignerListSet: 'settings',
|
||||
SetFee: 'feeUpdate', // pseudo-transaction
|
||||
EnableAmendment: 'amendment' // pseudo-transaction
|
||||
@@ -40,9 +39,9 @@ function parseTransaction(tx: Object): Object {
|
||||
'order': parseOrder,
|
||||
'orderCancellation': parseOrderCancellation,
|
||||
'settings': parseSettings,
|
||||
'suspendedPaymentCreation': parseSuspendedPaymentCreation,
|
||||
'suspendedPaymentExecution': parseSuspendedPaymentExecution,
|
||||
'suspendedPaymentCancellation': parseSuspendedPaymentCancellation,
|
||||
'escrowCreation': parseEscrowCreation,
|
||||
'escrowExecution': parseEscrowExecution,
|
||||
'escrowCancellation': parseEscrowCancellation,
|
||||
'feeUpdate': parseFeeUpdate,
|
||||
'amendment': parseAmendment
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@ const validate = utils.common.validate
|
||||
import type {Instructions, Prepare} from './types.js'
|
||||
import type {Memo} from '../common/types.js'
|
||||
|
||||
type SuspendedPaymentCancellation = {
|
||||
type EscrowCancellation = {
|
||||
owner: string,
|
||||
suspensionSequence: number,
|
||||
escrowSequence: number,
|
||||
memos?: Array<Memo>
|
||||
}
|
||||
|
||||
function createSuspendedPaymentCancellationTransaction(account: string,
|
||||
payment: SuspendedPaymentCancellation
|
||||
function createEscrowCancellationTransaction(account: string,
|
||||
payment: EscrowCancellation
|
||||
): Object {
|
||||
const txJSON: Object = {
|
||||
TransactionType: 'SuspendedPaymentCancel',
|
||||
TransactionType: 'EscrowCancel',
|
||||
Account: account,
|
||||
Owner: payment.owner,
|
||||
OfferSequence: payment.suspensionSequence
|
||||
OfferSequence: payment.escrowSequence
|
||||
}
|
||||
if (payment.memos !== undefined) {
|
||||
txJSON.Memos = _.map(payment.memos, utils.convertMemo)
|
||||
@@ -27,15 +27,15 @@ function createSuspendedPaymentCancellationTransaction(account: string,
|
||||
return txJSON
|
||||
}
|
||||
|
||||
function prepareSuspendedPaymentCancellation(address: string,
|
||||
suspendedPaymentCancellation: SuspendedPaymentCancellation,
|
||||
function prepareEscrowCancellation(address: string,
|
||||
escrowCancellation: EscrowCancellation,
|
||||
instructions: Instructions = {}
|
||||
): Promise<Prepare> {
|
||||
validate.prepareSuspendedPaymentCancellation(
|
||||
{address, suspendedPaymentCancellation, instructions})
|
||||
const txJSON = createSuspendedPaymentCancellationTransaction(
|
||||
address, suspendedPaymentCancellation)
|
||||
validate.prepareEscrowCancellation(
|
||||
{address, escrowCancellation, instructions})
|
||||
const txJSON = createEscrowCancellationTransaction(
|
||||
address, escrowCancellation)
|
||||
return utils.prepareTransaction(txJSON, this, instructions)
|
||||
}
|
||||
|
||||
module.exports = prepareSuspendedPaymentCancellation
|
||||
module.exports = prepareEscrowCancellation
|
||||
|
||||
@@ -6,27 +6,27 @@ const {validate, iso8601ToRippleTime, toRippledAmount} = utils.common
|
||||
import type {Instructions, Prepare} from './types.js'
|
||||
import type {Adjustment, MaxAdjustment, Memo} from '../common/types.js'
|
||||
|
||||
type SuspendedPaymentCreation = {
|
||||
type EscrowCreation = {
|
||||
source: MaxAdjustment,
|
||||
destination: Adjustment,
|
||||
memos?: Array<Memo>,
|
||||
digest?: string,
|
||||
condition?: string,
|
||||
allowCancelAfter?: string,
|
||||
allowExecuteAfter?: string
|
||||
}
|
||||
|
||||
function createSuspendedPaymentCreationTransaction(account: string,
|
||||
payment: SuspendedPaymentCreation
|
||||
function createEscrowCreationTransaction(account: string,
|
||||
payment: EscrowCreation
|
||||
): Object {
|
||||
const txJSON: Object = {
|
||||
TransactionType: 'SuspendedPaymentCreate',
|
||||
TransactionType: 'EscrowCreate',
|
||||
Account: account,
|
||||
Destination: payment.destination.address,
|
||||
Amount: toRippledAmount(payment.destination.amount)
|
||||
}
|
||||
|
||||
if (payment.digest !== undefined) {
|
||||
txJSON.Digest = payment.digest
|
||||
if (payment.condition !== undefined) {
|
||||
txJSON.Condition = payment.condition
|
||||
}
|
||||
if (payment.allowCancelAfter !== undefined) {
|
||||
txJSON.CancelAfter = iso8601ToRippleTime(payment.allowCancelAfter)
|
||||
@@ -43,18 +43,23 @@ function createSuspendedPaymentCreationTransaction(account: string,
|
||||
if (payment.memos !== undefined) {
|
||||
txJSON.Memos = _.map(payment.memos, utils.convertMemo)
|
||||
}
|
||||
if (Boolean(payment.allowCancelAfter) && Boolean(payment.allowExecuteAfter) &&
|
||||
payment.CancelAfter <= payment.FinishAfter) {
|
||||
throw new ValidationError('"CancelAfter" must be after "FinishAfter" on'
|
||||
+ ' EscrowCreate.')
|
||||
}
|
||||
return txJSON
|
||||
}
|
||||
|
||||
function prepareSuspendedPaymentCreation(address: string,
|
||||
suspendedPaymentCreation: SuspendedPaymentCreation,
|
||||
function prepareEscrowCreation(address: string,
|
||||
escrowCreation: EscrowCreation,
|
||||
instructions: Instructions = {}
|
||||
): Promise<Prepare> {
|
||||
validate.prepareSuspendedPaymentCreation(
|
||||
{address, suspendedPaymentCreation, instructions})
|
||||
const txJSON = createSuspendedPaymentCreationTransaction(
|
||||
address, suspendedPaymentCreation)
|
||||
validate.prepareEscrowCreation(
|
||||
{address, escrowCreation, instructions})
|
||||
const txJSON = createEscrowCreationTransaction(
|
||||
address, escrowCreation)
|
||||
return utils.prepareTransaction(txJSON, this, instructions)
|
||||
}
|
||||
|
||||
module.exports = prepareSuspendedPaymentCreation
|
||||
module.exports = prepareEscrowCreation
|
||||
|
||||
@@ -6,33 +6,34 @@ const validate = utils.common.validate
|
||||
import type {Instructions, Prepare} from './types.js'
|
||||
import type {Memo} from '../common/types.js'
|
||||
|
||||
type SuspendedPaymentExecution = {
|
||||
type EscrowExecution = {
|
||||
owner: string,
|
||||
suspensionSequence: number,
|
||||
escrowSequence: number,
|
||||
memos?: Array<Memo>,
|
||||
method?: number,
|
||||
digest?: string,
|
||||
proof?: string
|
||||
condition?: string,
|
||||
fulfillment?: string
|
||||
}
|
||||
|
||||
function createSuspendedPaymentExecutionTransaction(account: string,
|
||||
payment: SuspendedPaymentExecution
|
||||
function createEscrowExecutionTransaction(account: string,
|
||||
payment: EscrowExecution
|
||||
): Object {
|
||||
const txJSON: Object = {
|
||||
TransactionType: 'SuspendedPaymentFinish',
|
||||
TransactionType: 'EscrowFinish',
|
||||
Account: account,
|
||||
Owner: payment.owner,
|
||||
OfferSequence: payment.suspensionSequence
|
||||
OfferSequence: payment.escrowSequence
|
||||
}
|
||||
|
||||
if (payment.method !== undefined) {
|
||||
txJSON.Method = payment.method
|
||||
if (Boolean(payment.condition) !== Boolean(payment.fulfillment)) {
|
||||
throw new ValidationError('"condition" and "fulfillment" fields on'
|
||||
+ ' EscrowFinish must only be specified together.')
|
||||
}
|
||||
if (payment.digest !== undefined) {
|
||||
txJSON.Digest = payment.digest
|
||||
|
||||
if (payment.condition !== undefined) {
|
||||
txJSON.Condition = payment.condition
|
||||
}
|
||||
if (payment.proof !== undefined) {
|
||||
txJSON.Proof = utils.convertStringToHex(payment.proof)
|
||||
if (payment.fulfillment !== undefined) {
|
||||
txJSON.Fulfillment = utils.convertStringToHex(payment.fulfillment)
|
||||
}
|
||||
if (payment.memos !== undefined) {
|
||||
txJSON.Memos = _.map(payment.memos, utils.convertMemo)
|
||||
@@ -40,15 +41,15 @@ function createSuspendedPaymentExecutionTransaction(account: string,
|
||||
return txJSON
|
||||
}
|
||||
|
||||
function prepareSuspendedPaymentExecution(address: string,
|
||||
suspendedPaymentExecution: SuspendedPaymentExecution,
|
||||
function prepareEscrowExecution(address: string,
|
||||
escrowExecution: EscrowExecution,
|
||||
instructions: Instructions = {}
|
||||
): Promise<Prepare> {
|
||||
validate.prepareSuspendedPaymentExecution(
|
||||
{address, suspendedPaymentExecution, instructions})
|
||||
const txJSON = createSuspendedPaymentExecutionTransaction(
|
||||
address, suspendedPaymentExecution)
|
||||
validate.prepareEscrowExecution(
|
||||
{address, escrowExecution, instructions})
|
||||
const txJSON = createEscrowExecutionTransaction(
|
||||
address, escrowExecution)
|
||||
return utils.prepareTransaction(txJSON, this, instructions)
|
||||
}
|
||||
|
||||
module.exports = prepareSuspendedPaymentExecution
|
||||
module.exports = prepareEscrowExecution
|
||||
|
||||
@@ -11,7 +11,7 @@ function isImmediateRejection(engineResult: string): boolean {
|
||||
// transaction and then process it at a later time, for example
|
||||
// if the required fee changes (this does not occur at the time of
|
||||
// this writing, but it could change in the future)
|
||||
// all other error classes can potentially result in transcation validation
|
||||
// all other error classes can potentially result in transaction validation
|
||||
return _.startsWith(engineResult, 'tem')
|
||||
}
|
||||
|
||||
|
||||
@@ -266,57 +266,57 @@ describe('RippleAPI', function() {
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentCreation', function() {
|
||||
it('prepareEscrowCreation', function() {
|
||||
const localInstructions = _.defaults({
|
||||
maxFee: '0.000012'
|
||||
}, instructions);
|
||||
return this.api.prepareSuspendedPaymentCreation(
|
||||
address, requests.prepareSuspendedPaymentCreation.normal,
|
||||
return this.api.prepareEscrowCreation(
|
||||
address, requests.prepareEscrowCreation.normal,
|
||||
localInstructions).then(
|
||||
_.partial(checkResult, responses.prepareSuspendedPaymentCreation.normal,
|
||||
_.partial(checkResult, responses.prepareEscrowCreation.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentCreation full', function() {
|
||||
return this.api.prepareSuspendedPaymentCreation(
|
||||
address, requests.prepareSuspendedPaymentCreation.full).then(
|
||||
_.partial(checkResult, responses.prepareSuspendedPaymentCreation.full,
|
||||
it('prepareEscrowCreation full', function() {
|
||||
return this.api.prepareEscrowCreation(
|
||||
address, requests.prepareEscrowCreation.full).then(
|
||||
_.partial(checkResult, responses.prepareEscrowCreation.full,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentExecution', function() {
|
||||
return this.api.prepareSuspendedPaymentExecution(
|
||||
it('prepareEscrowExecution', function() {
|
||||
return this.api.prepareEscrowExecution(
|
||||
address,
|
||||
requests.prepareSuspendedPaymentExecution.normal, instructions).then(
|
||||
requests.prepareEscrowExecution.normal, instructions).then(
|
||||
_.partial(checkResult,
|
||||
responses.prepareSuspendedPaymentExecution.normal,
|
||||
responses.prepareEscrowExecution.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentExecution - simple', function() {
|
||||
return this.api.prepareSuspendedPaymentExecution(
|
||||
it('prepareEscrowExecution - simple', function() {
|
||||
return this.api.prepareEscrowExecution(
|
||||
address,
|
||||
requests.prepareSuspendedPaymentExecution.simple).then(
|
||||
requests.prepareEscrowExecution.simple).then(
|
||||
_.partial(checkResult,
|
||||
responses.prepareSuspendedPaymentExecution.simple,
|
||||
responses.prepareEscrowExecution.simple,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentCancellation', function() {
|
||||
return this.api.prepareSuspendedPaymentCancellation(
|
||||
it('prepareEscrowCancellation', function() {
|
||||
return this.api.prepareEscrowCancellation(
|
||||
address,
|
||||
requests.prepareSuspendedPaymentCancellation.normal, instructions).then(
|
||||
requests.prepareEscrowCancellation.normal, instructions).then(
|
||||
_.partial(checkResult,
|
||||
responses.prepareSuspendedPaymentCancellation.normal,
|
||||
responses.prepareEscrowCancellation.normal,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
it('prepareSuspendedPaymentCancellation with memos', function() {
|
||||
return this.api.prepareSuspendedPaymentCancellation(
|
||||
it('prepareEscrowCancellation with memos', function() {
|
||||
return this.api.prepareEscrowCancellation(
|
||||
address,
|
||||
requests.prepareSuspendedPaymentCancellation.memos).then(
|
||||
requests.prepareEscrowCancellation.memos).then(
|
||||
_.partial(checkResult,
|
||||
responses.prepareSuspendedPaymentCancellation.memos,
|
||||
responses.prepareEscrowCancellation.memos,
|
||||
'prepare'));
|
||||
});
|
||||
|
||||
@@ -336,10 +336,10 @@ describe('RippleAPI', function() {
|
||||
}, /txJSON must not contain "TxnSignature" or "Signers" properties/);
|
||||
});
|
||||
|
||||
it('sign - SuspendedPaymentExecution', function() {
|
||||
it('sign - EscrowExecution', function() {
|
||||
const secret = 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb';
|
||||
const result = this.api.sign(requests.sign.suspended.txJSON, secret);
|
||||
assert.deepEqual(result, responses.sign.suspended);
|
||||
const result = this.api.sign(requests.sign.escrow.txJSON, secret);
|
||||
assert.deepEqual(result, responses.sign.escrow);
|
||||
schemaValidator.schemaValidate('sign', result);
|
||||
});
|
||||
|
||||
@@ -640,34 +640,34 @@ describe('RippleAPI', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('getTransaction - SuspendedPaymentCreation', function() {
|
||||
it('getTransaction - EscrowCreation', function() {
|
||||
const hash =
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE1';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.suspendedPaymentCreation,
|
||||
responses.getTransaction.escrowCreation,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - SuspendedPaymentCreation iou', function() {
|
||||
it('getTransaction - EscrowCreation iou', function() {
|
||||
const hash =
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.SuspendedPaymentCreationIOU,
|
||||
responses.getTransaction.EscrowCreationIOU,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - SuspendedPaymentCancellation', function() {
|
||||
it('getTransaction - EscrowCancellation', function() {
|
||||
const hash =
|
||||
'F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.suspendedPaymentCancellation,
|
||||
responses.getTransaction.escrowCancellation,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - SuspendedPaymentExecution', function() {
|
||||
it('getTransaction - EscrowExecution', function() {
|
||||
const options = {
|
||||
minLedgerVersion: 10,
|
||||
maxLedgerVersion: 15
|
||||
@@ -676,16 +676,16 @@ describe('RippleAPI', function() {
|
||||
'CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD136993B';
|
||||
return this.api.getTransaction(hash, options).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.suspendedPaymentExecution,
|
||||
responses.getTransaction.escrowExecution,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
it('getTransaction - SuspendedPaymentExecution simple', function() {
|
||||
it('getTransaction - EscrowExecution simple', function() {
|
||||
const hash =
|
||||
'CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD1369931';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult,
|
||||
responses.getTransaction.suspendedPaymentExecutionSimple,
|
||||
responses.getTransaction.escrowExecutionSimple,
|
||||
'getTransaction'));
|
||||
});
|
||||
|
||||
|
||||
20
test/fixtures/requests/index.js
vendored
20
test/fixtures/requests/index.js
vendored
@@ -24,17 +24,17 @@ module.exports = {
|
||||
domain: require('./prepare-settings'),
|
||||
signers: require('./prepare-settings-signers')
|
||||
},
|
||||
prepareSuspendedPaymentCreation: {
|
||||
normal: require('./prepare-suspended-payment-creation'),
|
||||
full: require('./prepare-suspended-payment-creation-full')
|
||||
prepareEscrowCreation: {
|
||||
normal: require('./prepare-escrow-creation'),
|
||||
full: require('./prepare-escrow-creation-full')
|
||||
},
|
||||
prepareSuspendedPaymentExecution: {
|
||||
normal: require('./prepare-suspended-payment-execution'),
|
||||
simple: require('./prepare-suspended-payment-execution-simple')
|
||||
prepareEscrowExecution: {
|
||||
normal: require('./prepare-escrow-execution'),
|
||||
simple: require('./prepare-escrow-execution-simple')
|
||||
},
|
||||
prepareSuspendedPaymentCancellation: {
|
||||
normal: require('./prepare-suspended-payment-cancellation'),
|
||||
memos: require('./prepare-suspended-payment-cancellation-memos')
|
||||
prepareEscrowCancellation: {
|
||||
normal: require('./prepare-escrow-cancellation'),
|
||||
memos: require('./prepare-escrow-cancellation-memos')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepare-trustline-simple'),
|
||||
@@ -43,7 +43,7 @@ module.exports = {
|
||||
},
|
||||
sign: {
|
||||
normal: require('./sign'),
|
||||
suspended: require('./sign-suspended.json'),
|
||||
escrow: require('./sign-escrow.json'),
|
||||
signAs: require('./sign-as')
|
||||
},
|
||||
getPaths: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234,
|
||||
"escrowSequence": 1234,
|
||||
"memos": [
|
||||
{
|
||||
"type": "test",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234
|
||||
"escrowSequence": 1234
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"tag": 2
|
||||
},
|
||||
"digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"allowExecuteAfter": "2014-09-24T21:21:50.000Z",
|
||||
"memos": [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234,
|
||||
"escrowSequence": 1234,
|
||||
"memos": [
|
||||
{
|
||||
"type": "test",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||
"suspensionSequence": 1234,
|
||||
"method": 1,
|
||||
"digest": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"proof": "this must have 32 characters...."
|
||||
"escrowSequence": 1234,
|
||||
"condition": "712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D",
|
||||
"fulfillment": "this must have 32 characters...."
|
||||
}
|
||||
|
||||
2
test/fixtures/requests/sign-escrow.json
vendored
2
test/fixtures/requests/sign-escrow.json
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"TransactionType\":\"EscrowFinish\",\"Account\":\"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\",\"Owner\":\"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\",\"OfferSequence\":2,\"Method\":1,\"Digest\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Proof\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"Flags\":2147483648,\"LastLedgerSequence\":102,\"Fee\":\"12\",\"Sequence\":1}",
|
||||
"txJSON": "{\"TransactionType\":\"EscrowFinish\",\"Account\":\"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\",\"Owner\":\"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\",\"OfferSequence\":2,\"Condition\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Fulfillment\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"Flags\":2147483648,\"LastLedgerSequence\":102,\"Fee\":\"12\",\"Sequence\":1}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 1,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"type": "suspendedPaymentCancellation",
|
||||
"type": "escrowCancellation",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 9,
|
||||
"id": "F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22",
|
||||
"specification": {
|
||||
"owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"suspensionSequence": 7
|
||||
"escrowSequence": 7
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "suspendedPaymentCreation",
|
||||
"type": "escrowCreation",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 10,
|
||||
"id": "144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2",
|
||||
@@ -28,7 +28,7 @@
|
||||
"data": "mema data"
|
||||
}
|
||||
],
|
||||
"digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"allowCancelAfter": "2015-11-16T06:53:42.000Z",
|
||||
"allowExecuteAfter": "2015-11-16T06:47:42.000Z"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "suspendedPaymentCreation",
|
||||
"type": "escrowCreation",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 10,
|
||||
"id": "144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE1",
|
||||
@@ -27,7 +27,7 @@
|
||||
"data": "mema data"
|
||||
}
|
||||
],
|
||||
"digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"allowCancelAfter": "2015-11-16T06:53:42.000Z",
|
||||
"allowExecuteAfter": "2015-11-16T06:47:42.000Z"
|
||||
},
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"type": "suspendedPaymentExecution",
|
||||
"type": "escrowExecution",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 6,
|
||||
"id": "CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD1369931",
|
||||
"specification": {
|
||||
"owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"suspensionSequence": 5,
|
||||
"method": 1,
|
||||
"digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1"
|
||||
"escrowSequence": 5,
|
||||
"condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1"
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
{
|
||||
"type": "suspendedPaymentExecution",
|
||||
"type": "escrowExecution",
|
||||
"address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"sequence": 6,
|
||||
"id": "CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD136993B",
|
||||
"specification": {
|
||||
"owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"suspensionSequence": 5,
|
||||
"method": 1,
|
||||
"digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"proof": "whateverthis bemusthave 32 chars"
|
||||
"escrowSequence": 5,
|
||||
"condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"fulfillment": "whateverthis bemusthave 32 chars"
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
|
||||
40
test/fixtures/responses/index.js
vendored
40
test/fixtures/responses/index.js
vendored
@@ -34,16 +34,16 @@ module.exports = {
|
||||
trustlineFrozenOff: require('./get-transaction-trust-set-frozen-off.json'),
|
||||
trustlineNoQuality: require('./get-transaction-trust-no-quality.json'),
|
||||
notValidated: require('./get-transaction-not-validated.json'),
|
||||
suspendedPaymentCreation:
|
||||
require('./get-transaction-suspended-payment-create.json'),
|
||||
SuspendedPaymentCreationIOU:
|
||||
require('./get-transaction-suspended-payment-create-iou.json'),
|
||||
suspendedPaymentCancellation:
|
||||
require('./get-transaction-suspended-payment-cancellation.json'),
|
||||
suspendedPaymentExecution:
|
||||
require('./get-transaction-suspended-payment-execution.json'),
|
||||
suspendedPaymentExecutionSimple:
|
||||
require('./get-transaction-suspended-payment-execution-simple.json'),
|
||||
escrowCreation:
|
||||
require('./get-transaction-escrow-create.json'),
|
||||
EscrowCreationIOU:
|
||||
require('./get-transaction-escrow-create-iou.json'),
|
||||
escrowCancellation:
|
||||
require('./get-transaction-escrow-cancellation.json'),
|
||||
escrowExecution:
|
||||
require('./get-transaction-escrow-execution.json'),
|
||||
escrowExecutionSimple:
|
||||
require('./get-transaction-escrow-execution-simple.json'),
|
||||
amendment: require('./get-transaction-amendment.json'),
|
||||
feeUpdate: require('./get-transaction-fee-update.json')
|
||||
},
|
||||
@@ -95,17 +95,17 @@ module.exports = {
|
||||
noMaxLedgerVersion: require('./prepare-settings-no-maxledgerversion.json'),
|
||||
signers: require('./prepare-settings-signers.json')
|
||||
},
|
||||
prepareSuspendedPaymentCreation: {
|
||||
normal: require('./prepare-suspended-payment-creation'),
|
||||
full: require('./prepare-suspended-payment-creation-full')
|
||||
prepareEscrowCreation: {
|
||||
normal: require('./prepare-escrow-creation'),
|
||||
full: require('./prepare-escrow-creation-full')
|
||||
},
|
||||
prepareSuspendedPaymentExecution: {
|
||||
normal: require('./prepare-suspended-payment-execution'),
|
||||
simple: require('./prepare-suspended-payment-execution-simple')
|
||||
prepareEscrowExecution: {
|
||||
normal: require('./prepare-escrow-execution'),
|
||||
simple: require('./prepare-escrow-execution-simple')
|
||||
},
|
||||
prepareSuspendedPaymentCancellation: {
|
||||
normal: require('./prepare-suspended-payment-cancellation'),
|
||||
memos: require('./prepare-suspended-payment-cancellation-memos')
|
||||
prepareEscrowCancellation: {
|
||||
normal: require('./prepare-escrow-cancellation'),
|
||||
memos: require('./prepare-escrow-cancellation-memos')
|
||||
},
|
||||
prepareTrustline: {
|
||||
simple: require('./prepare-trustline-simple.json'),
|
||||
@@ -114,7 +114,7 @@ module.exports = {
|
||||
},
|
||||
sign: {
|
||||
normal: require('./sign.json'),
|
||||
suspended: require('./sign-suspended.json'),
|
||||
escrow: require('./sign-escrow.json'),
|
||||
signAs: require('./sign-as')
|
||||
},
|
||||
combine: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"TransactionType\":\"SuspendedPaymentCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"TransactionType\":\"EscrowCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCancel\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"TransactionType\":\"SuspendedPaymentCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"0.01\"},\"Digest\":\"8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4\",\"FinishAfter\":464908910,\"SourceTag\":1,\"DestinationTag\":2,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"0.01\"},\"Condition\":\"8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4\",\"FinishAfter\":464908910,\"SourceTag\":1,\"DestinationTag\":2,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowCreate\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"Amount\":{\"value\":\"0.01\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"CancelAfter\":464908910,\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"TransactionType\":\"SuspendedPaymentFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"TransactionType\":\"EscrowFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Memos\":[{\"Memo\":{\"MemoData\":\"7465787465642064617461\",\"MemoType\":\"74657374\",\"MemoFormat\":\"706C61696E2F74657874\"}}],\"Flags\":2147483648,\"LastLedgerSequence\":8819954,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"SuspendedPaymentFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Method\":1,\"Digest\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Proof\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"txJSON": "{\"Flags\":2147483648,\"TransactionType\":\"EscrowFinish\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Owner\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"OfferSequence\":1234,\"Condition\":\"712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D\",\"Fulfillment\":\"74686973206D757374206861766520333220636861726163746572732E2E2E2E\",\"LastLedgerSequence\":8820051,\"Fee\":\"12\",\"Sequence\":23}",
|
||||
"instructions": {
|
||||
"fee": "0.000012",
|
||||
"sequence": 23,
|
||||
|
||||
4
test/fixtures/responses/sign-escrow.json
vendored
4
test/fixtures/responses/sign-escrow.json
vendored
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"signedTransaction": "12000222800000002400000001201900000002201B000000665015712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D68400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100E1DAAD071DC0E556FEC472E0C6CABBAB064901D97FEAD61CA9990DCC17326FFC022051DF3331D340B3E635024D7B9684602EFDEE2D178AAC9E4824722B4DAB6036718114B5F762798A53D543A014CAF8B297CFF8F2F937E88214B5F762798A53D543A014CAF8B297CFF8F2F937E8021001",
|
||||
"id": "D40E312D9CD2EE8C5940D1D4918E9F5778870CB2FBF1D188061EB21B2E7CF371"
|
||||
"signedTransaction": "12000222800000002400000001201900000002201B0000006668400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402205CDD40611008680E151EF6C5C70A6DFBF7977DE73800E04F1B6F1FE8688BBE3E022075DB3990E6CBF0BCD990D92FA13E3D3F95510CA2CCBAB92BD2CE288FA6F2F34870102074686973206D757374206861766520333220636861726163746572732E2E2E2E701120712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D8114B5F762798A53D543A014CAF8B297CFF8F2F937E88214B5F762798A53D543A014CAF8B297CFF8F2F937E8",
|
||||
"id": "E76178CD799A82BAB6EE83A70DE0060F0BDC8BDE29980F0832D791D8D9D5CACC"
|
||||
}
|
||||
|
||||
16
test/fixtures/rippled/index.js
vendored
16
test/fixtures/rippled/index.js
vendored
@@ -64,14 +64,14 @@ module.exports = {
|
||||
LedgerWithoutTime: require('./tx/ledger-without-time.json'),
|
||||
NotValidated: require('./tx/not-validated.json'),
|
||||
OfferWithExpiration: require('./tx/order-with-expiration.json'),
|
||||
SuspendedPaymentCreation: require('./tx/suspended-payment-creation.json'),
|
||||
SuspendedPaymentCreationIOU:
|
||||
require('./tx/suspended-payment-creation-iou.json'),
|
||||
SuspendedPaymentCancellation:
|
||||
require('./tx/suspended-payment-cancellation.json'),
|
||||
SuspendedPaymentExecution: require('./tx/suspended-payment-execution.json'),
|
||||
SuspendedPaymentExecutionSimple:
|
||||
require('./tx/suspended-payment-execution-simple.json'),
|
||||
EscrowCreation: require('./tx/escrow-creation.json'),
|
||||
EscrowCreationIOU:
|
||||
require('./tx/escrow-creation-iou.json'),
|
||||
EscrowCancellation:
|
||||
require('./tx/escrow-cancellation.json'),
|
||||
EscrowExecution: require('./tx/escrow-execution.json'),
|
||||
EscrowExecutionSimple:
|
||||
require('./tx/escrow-execution-simple.json'),
|
||||
Unrecognized: require('./tx/unrecognized.json'),
|
||||
NoMeta: require('./tx/no-meta.json'),
|
||||
LedgerZero: require('./tx/ledger-zero.json'),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Sequence": 9,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"TransactionType": "SuspendedPaymentCancel",
|
||||
"TransactionType": "EscrowCancel",
|
||||
"TxnSignature": "304502210095453956DB908E99386D12F266F48C225CD48F076773F577A4EF676F265B7A18022041E45BB638E64D92EC7FB9B99BEDE1A0B28C245804999656BDBE6043D97BB4A1",
|
||||
"date": 500964620,
|
||||
"hash": "F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22",
|
||||
@@ -59,7 +59,7 @@
|
||||
"PreviousTxnLgrSeq": 12,
|
||||
"SourceTag": 1
|
||||
},
|
||||
"LedgerEntryType": "SuspendedPayment",
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "B366B476EFE3A621C96835A36BFDF83C2A5B0008F0EF4A83D751380F53EFCE71"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"CancelAfter": 500972022,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Fee": "12",
|
||||
"FinishAfter": 500971662,
|
||||
"Flags": 2147483648,
|
||||
@@ -23,7 +23,7 @@
|
||||
"Sequence": 10,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"SourceTag": 1,
|
||||
"TransactionType": "SuspendedPaymentCreate",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "3045022100EA1C5433AFA3F0BAAAF7C4146B032B86A0212EB4E2A3551DE9717651A538AE260220228C9E9FC857EC8143F01C2F959A8F134B285B67D8261B49E57BFF8DF76D2255",
|
||||
"date": 500971380,
|
||||
"hash": "144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2",
|
||||
@@ -33,7 +33,7 @@
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "SuspendedPayment",
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "0D7629A23BC20F25C48D9423E2485582255A74B76A25F26EDB46766982E4C2C4",
|
||||
"NewFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
@@ -41,7 +41,7 @@
|
||||
"CancelAfter": 500972022,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"FinishAfter": 500971662,
|
||||
"SourceTag": 1
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"CancelAfter": 500972022,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Fee": "12",
|
||||
"FinishAfter": 500971662,
|
||||
"Flags": 2147483648,
|
||||
@@ -23,7 +23,7 @@
|
||||
"Sequence": 10,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"SourceTag": 1,
|
||||
"TransactionType": "SuspendedPaymentCreate",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "3045022100EA1C5433AFA3F0BAAAF7C4146B032B86A0212EB4E2A3551DE9717651A538AE260220228C9E9FC857EC8143F01C2F959A8F134B285B67D8261B49E57BFF8DF76D2255",
|
||||
"date": 500971380,
|
||||
"hash": "144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE1",
|
||||
@@ -33,7 +33,7 @@
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "SuspendedPayment",
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "0D7629A23BC20F25C48D9423E2485582255A74B76A25F26EDB46766982E4C2C4",
|
||||
"NewFields": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
@@ -41,7 +41,7 @@
|
||||
"CancelAfter": 500972022,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"Condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4",
|
||||
"FinishAfter": 500971662,
|
||||
"SourceTag": 1
|
||||
}
|
||||
|
||||
@@ -2,16 +2,15 @@
|
||||
"id": 0,
|
||||
"result": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Fee": "12",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 113,
|
||||
"Method": 1,
|
||||
"OfferSequence": 5,
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Sequence": 6,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"TransactionType": "SuspendedPaymentFinish",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "304402204E981802BA2F4C3677E69B26387CC157284D31886CF95B73A8AB3E717FE6A6490220519CD84CA01BA5D7A49809B041929F12D56F32E76FAE73F0FAFF7B5E7B8B110B",
|
||||
"date": 501040060,
|
||||
"hash": "CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD1369931",
|
||||
@@ -65,7 +64,7 @@
|
||||
"CancelAfter": 501079458,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"FinishAfter": 501039918,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
@@ -73,7 +72,7 @@
|
||||
"PreviousTxnLgrSeq": 12,
|
||||
"SourceTag": 1
|
||||
},
|
||||
"LedgerEntryType": "SuspendedPayment",
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "AA7D93BDB975252718205C98792BF8940E3FC6E6972213F451AB5D602E8AD971"
|
||||
}
|
||||
},
|
||||
|
||||
11
test/fixtures/rippled/tx/escrow-execution.json
vendored
11
test/fixtures/rippled/tx/escrow-execution.json
vendored
@@ -2,17 +2,16 @@
|
||||
"id": 0,
|
||||
"result": {
|
||||
"Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Fee": "12",
|
||||
"Flags": 2147483648,
|
||||
"LastLedgerSequence": 113,
|
||||
"Method": 1,
|
||||
"OfferSequence": 5,
|
||||
"Owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
|
||||
"Proof": "7768617465766572746869732062656D75737468617665203332206368617273",
|
||||
"Fulfillment": "7768617465766572746869732062656D75737468617665203332206368617273",
|
||||
"Sequence": 6,
|
||||
"SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
|
||||
"TransactionType": "SuspendedPaymentFinish",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "304402204E981802BA2F4C3677E69B26387CC157284D31886CF95B73A8AB3E717FE6A6490220519CD84CA01BA5D7A49809B041929F12D56F32E76FAE73F0FAFF7B5E7B8B110B",
|
||||
"date": 501040060,
|
||||
"hash": "CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD136993B",
|
||||
@@ -66,7 +65,7 @@
|
||||
"CancelAfter": 501079458,
|
||||
"Destination": "rp8rJYTpodf8qbSCHVTNacf8nSW8mRakFw",
|
||||
"DestinationTag": 2,
|
||||
"Digest": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"Condition": "632F2F3E437AE720C397994A985B5D21FE186DE61523A9CA3E8709CC581671A1",
|
||||
"FinishAfter": 501039918,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
@@ -74,7 +73,7 @@
|
||||
"PreviousTxnLgrSeq": 12,
|
||||
"SourceTag": 1
|
||||
},
|
||||
"LedgerEntryType": "SuspendedPayment",
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "AA7D93BDB975252718205C98792BF8940E3FC6E6972213F451AB5D602E8AD971"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -273,22 +273,20 @@ module.exports = function createMockRippled(port) {
|
||||
conn.send(createResponse(request, fixtures.tx.OfferWithExpiration));
|
||||
} else if (request.transaction ===
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE1') {
|
||||
conn.send(createResponse(request, fixtures.tx.SuspendedPaymentCreation));
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCreation));
|
||||
} else if (request.transaction ===
|
||||
'144F272380BDB4F1BD92329A2178BABB70C20F59042C495E10BF72EBFB408EE2') {
|
||||
conn.send(createResponse(request,
|
||||
fixtures.tx.SuspendedPaymentCreationIOU));
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCreationIOU));
|
||||
} else if (request.transaction ===
|
||||
'F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22') {
|
||||
conn.send(createResponse(request,
|
||||
fixtures.tx.SuspendedPaymentCancellation));
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowCancellation));
|
||||
} else if (request.transaction ===
|
||||
'CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD136993B') {
|
||||
conn.send(createResponse(request, fixtures.tx.SuspendedPaymentExecution));
|
||||
conn.send(createResponse(request, fixtures.tx.EscrowExecution));
|
||||
} else if (request.transaction ===
|
||||
'CC5277137B3F25EE8B86259C83CB0EAADE818505E4E9BCBF19B1AC6FD1369931') {
|
||||
conn.send(createResponse(request,
|
||||
fixtures.tx.SuspendedPaymentExecutionSimple));
|
||||
fixtures.tx.EscrowExecutionSimple));
|
||||
} else if (request.transaction ===
|
||||
'AFB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA11') {
|
||||
conn.send(createResponse(request, fixtures.tx.Unrecognized));
|
||||
|
||||
Reference in New Issue
Block a user