From 15a0ededc8aacdfdaa3695164bb7838fb6ce64c3 Mon Sep 17 00:00:00 2001 From: wilsonianb Date: Wed, 22 Mar 2017 10:29:49 -0700 Subject: [PATCH] Replace suspended payments with escrow --- docs/index.md | 123 +++++++++--------- docs/src/index.md.ejs | 6 +- docs/src/offline.md.ejs | 6 +- docs/src/prepareEscrowCancellation.md.ejs | 16 +-- docs/src/prepareEscrowCreation.md.ejs | 16 +-- docs/src/prepareEscrowExecution.md.ejs | 16 +-- docs/src/specifications.md.ejs | 18 +-- docs/src/transactions.md.ejs | 14 +- src/api.js | 18 +-- src/common/schema-validator.js | 12 +- .../input/prepare-escrow-cancellation.json | 10 +- .../input/prepare-escrow-creation.json | 10 +- .../input/prepare-escrow-execution.json | 10 +- src/common/schemas/objects/tx-type.json | 4 +- .../schemas/output/get-transaction.json | 12 +- .../specifications/escrow-cancellation.json | 12 +- .../specifications/escrow-creation.json | 12 +- .../specifications/escrow-execution.json | 26 ++-- src/common/validate.js | 12 +- src/ledger/parse/escrow-cancellation.js | 8 +- src/ledger/parse/escrow-creation.js | 8 +- src/ledger/parse/escrow-execution.js | 13 +- src/ledger/parse/transaction.js | 19 ++- src/transaction/escrow-cancellation.js | 26 ++-- src/transaction/escrow-creation.js | 33 +++-- src/transaction/escrow-execution.js | 45 +++---- src/transaction/submit.js | 2 +- test/api-test.js | 74 +++++------ test/fixtures/requests/index.js | 20 +-- .../prepare-escrow-cancellation-memos.json | 2 +- .../requests/prepare-escrow-cancellation.json | 2 +- .../prepare-escrow-creation-full.json | 2 +- .../prepare-escrow-execution-simple.json | 2 +- .../requests/prepare-escrow-execution.json | 7 +- test/fixtures/requests/sign-escrow.json | 2 +- .../get-transaction-escrow-cancellation.json | 4 +- .../get-transaction-escrow-create-iou.json | 4 +- .../get-transaction-escrow-create.json | 4 +- ...t-transaction-escrow-execution-simple.json | 7 +- .../get-transaction-escrow-execution.json | 9 +- test/fixtures/responses/index.js | 40 +++--- .../prepare-escrow-cancellation-memos.json | 2 +- .../prepare-escrow-cancellation.json | 2 +- .../prepare-escrow-creation-full.json | 2 +- .../responses/prepare-escrow-creation.json | 2 +- .../prepare-escrow-execution-simple.json | 2 +- .../responses/prepare-escrow-execution.json | 2 +- test/fixtures/responses/sign-escrow.json | 4 +- test/fixtures/rippled/index.js | 16 +-- .../rippled/tx/escrow-cancellation.json | 4 +- .../rippled/tx/escrow-creation-iou.json | 8 +- test/fixtures/rippled/tx/escrow-creation.json | 8 +- .../rippled/tx/escrow-execution-simple.json | 9 +- .../fixtures/rippled/tx/escrow-execution.json | 11 +- test/mock-rippled.js | 12 +- 55 files changed, 379 insertions(+), 391 deletions(-) diff --git a/docs/index.md b/docs/index.md index f1e15f47..2413ca4c 100644 --- a/docs/index.md +++ b/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` +`prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise` -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` +`prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise` -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` +`prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise` -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, diff --git a/docs/src/index.md.ejs b/docs/src/index.md.ejs index 9d854bb9..71616865 100644 --- a/docs/src/index.md.ejs +++ b/docs/src/index.md.ejs @@ -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 %> diff --git a/docs/src/offline.md.ejs b/docs/src/offline.md.ejs index 93d89802..5ffcc3fd 100644 --- a/docs/src/offline.md.ejs +++ b/docs/src/offline.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) diff --git a/docs/src/prepareEscrowCancellation.md.ejs b/docs/src/prepareEscrowCancellation.md.ejs index 0c759eac..66904b9f 100644 --- a/docs/src/prepareEscrowCancellation.md.ejs +++ b/docs/src/prepareEscrowCancellation.md.ejs @@ -1,14 +1,14 @@ -## prepareSuspendedPaymentCancellation +## prepareEscrowCancellation -`prepareSuspendedPaymentCancellation(address: string, suspendedPaymentCancellation: Object, instructions: Object): Promise` +`prepareEscrowCancellation(address: string, escrowCancellation: Object, instructions: Object): Promise` -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') %> diff --git a/docs/src/prepareEscrowCreation.md.ejs b/docs/src/prepareEscrowCreation.md.ejs index 784933df..3c206c33 100644 --- a/docs/src/prepareEscrowCreation.md.ejs +++ b/docs/src/prepareEscrowCreation.md.ejs @@ -1,14 +1,14 @@ -## prepareSuspendedPaymentCreation +## prepareEscrowCreation -`prepareSuspendedPaymentCreation(address: string, suspendedPaymentCreation: Object, instructions: Object): Promise` +`prepareEscrowCreation(address: string, escrowCreation: Object, instructions: Object): Promise` -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') %> diff --git a/docs/src/prepareEscrowExecution.md.ejs b/docs/src/prepareEscrowExecution.md.ejs index faa80660..6f0b0501 100644 --- a/docs/src/prepareEscrowExecution.md.ejs +++ b/docs/src/prepareEscrowExecution.md.ejs @@ -1,14 +1,14 @@ -## prepareSuspendedPaymentExecution +## prepareEscrowExecution -`prepareSuspendedPaymentExecution(address: string, suspendedPaymentExecution: Object, instructions: Object): Promise` +`prepareEscrowExecution(address: string, escrowExecution: Object, instructions: Object): Promise` -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') %> diff --git a/docs/src/specifications.md.ejs b/docs/src/specifications.md.ejs index a2998664..69e451b2 100644 --- a/docs/src/specifications.md.ejs +++ b/docs/src/specifications.md.ejs @@ -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') %> diff --git a/docs/src/transactions.md.ejs b/docs/src/transactions.md.ejs index 5e389447..e5665e4a 100644 --- a/docs/src/transactions.md.ejs +++ b/docs/src/transactions.md.ejs @@ -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. diff --git a/src/api.js b/src/api.js index 01d2100d..c8cdf24b 100644 --- a/src/api.js +++ b/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, diff --git a/src/common/schema-validator.js b/src/common/schema-validator.js index 3da28279..97628e9f 100644 --- a/src/common/schema-validator.js +++ b/src/common/schema-validator.js @@ -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'), diff --git a/src/common/schemas/input/prepare-escrow-cancellation.json b/src/common/schemas/input/prepare-escrow-cancellation.json index 4151b456..8cff98c6 100644 --- a/src/common/schemas/input/prepare-escrow-cancellation.json +++ b/src/common/schemas/input/prepare-escrow-cancellation.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"] } diff --git a/src/common/schemas/input/prepare-escrow-creation.json b/src/common/schemas/input/prepare-escrow-creation.json index bc89934e..4a9b385e 100644 --- a/src/common/schemas/input/prepare-escrow-creation.json +++ b/src/common/schemas/input/prepare-escrow-creation.json @@ -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"] } diff --git a/src/common/schemas/input/prepare-escrow-execution.json b/src/common/schemas/input/prepare-escrow-execution.json index 6989a201..f09ff2d3 100644 --- a/src/common/schemas/input/prepare-escrow-execution.json +++ b/src/common/schemas/input/prepare-escrow-execution.json @@ -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"] } diff --git a/src/common/schemas/objects/tx-type.json b/src/common/schemas/objects/tx-type.json index d2309542..f6298560 100644 --- a/src/common/schemas/objects/tx-type.json +++ b/src/common/schemas/objects/tx-type.json @@ -5,6 +5,6 @@ "description": "The type of the transaction.", "type": "string", "enum": ["payment", "order", "orderCancellation", "trustline", "settings", - "suspendedPaymentCreation", "suspendedPaymentCancellation", - "suspendedPaymentExecution"] + "escrowCreation", "escrowCancellation", + "escrowExecution"] } diff --git a/src/common/schemas/output/get-transaction.json b/src/common/schemas/output/get-transaction.json index ab42bf57..d5918eb9 100644 --- a/src/common/schemas/output/get-transaction.json +++ b/src/common/schemas/output/get-transaction.json @@ -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"} } } ] diff --git a/src/common/schemas/specifications/escrow-cancellation.json b/src/common/schemas/specifications/escrow-cancellation.json index e3540fa8..96753f0c 100644 --- a/src/common/schemas/specifications/escrow-cancellation.json +++ b/src/common/schemas/specifications/escrow-cancellation.json @@ -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 } diff --git a/src/common/schemas/specifications/escrow-creation.json b/src/common/schemas/specifications/escrow-creation.json index 0acddb26..0c7b52ad 100644 --- a/src/common/schemas/specifications/escrow-creation.json +++ b/src/common/schemas/specifications/escrow-creation.json @@ -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"], diff --git a/src/common/schemas/specifications/escrow-execution.json b/src/common/schemas/specifications/escrow-execution.json index eadc0e18..23fcd3fd 100644 --- a/src/common/schemas/specifications/escrow-execution.json +++ b/src/common/schemas/specifications/escrow-execution.json @@ -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 } diff --git a/src/common/validate.js b/src/common/validate.js index 91c00899..901619ff 100644 --- a/src/common/validate.js +++ b/src/common/validate.js @@ -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'), diff --git a/src/ledger/parse/escrow-cancellation.js b/src/ledger/parse/escrow-cancellation.js index a4b38f15..7c01d8f5 100644 --- a/src/ledger/parse/escrow-cancellation.js +++ b/src/ledger/parse/escrow-cancellation.js @@ -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 diff --git a/src/ledger/parse/escrow-creation.js b/src/ledger/parse/escrow-creation.js index 36e00102..cb2d4adb 100644 --- a/src/ledger/parse/escrow-creation.js +++ b/src/ledger/parse/escrow-creation.js @@ -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 diff --git a/src/ledger/parse/escrow-execution.js b/src/ledger/parse/escrow-execution.js index 43de91d2..7d254ba6 100644 --- a/src/ledger/parse/escrow-execution.js +++ b/src/ledger/parse/escrow-execution.js @@ -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 diff --git a/src/ledger/parse/transaction.js b/src/ledger/parse/transaction.js index 0001f059..6ff656b2 100644 --- a/src/ledger/parse/transaction.js +++ b/src/ledger/parse/transaction.js @@ -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 } diff --git a/src/transaction/escrow-cancellation.js b/src/transaction/escrow-cancellation.js index 99f8be4d..8b9c6ca0 100644 --- a/src/transaction/escrow-cancellation.js +++ b/src/transaction/escrow-cancellation.js @@ -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 } -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 { - 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 diff --git a/src/transaction/escrow-creation.js b/src/transaction/escrow-creation.js index 93d0f6c2..744b722f 100644 --- a/src/transaction/escrow-creation.js +++ b/src/transaction/escrow-creation.js @@ -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, - 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 { - 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 diff --git a/src/transaction/escrow-execution.js b/src/transaction/escrow-execution.js index 2de0456d..06646199 100644 --- a/src/transaction/escrow-execution.js +++ b/src/transaction/escrow-execution.js @@ -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, - 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 { - 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 diff --git a/src/transaction/submit.js b/src/transaction/submit.js index c99f60f0..53d2030c 100644 --- a/src/transaction/submit.js +++ b/src/transaction/submit.js @@ -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') } diff --git a/test/api-test.js b/test/api-test.js index 7f85e809..46d2389d 100644 --- a/test/api-test.js +++ b/test/api-test.js @@ -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')); }); diff --git a/test/fixtures/requests/index.js b/test/fixtures/requests/index.js index 16d421bb..db44593e 100644 --- a/test/fixtures/requests/index.js +++ b/test/fixtures/requests/index.js @@ -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: { diff --git a/test/fixtures/requests/prepare-escrow-cancellation-memos.json b/test/fixtures/requests/prepare-escrow-cancellation-memos.json index 15b3e9fa..fb8f49c0 100644 --- a/test/fixtures/requests/prepare-escrow-cancellation-memos.json +++ b/test/fixtures/requests/prepare-escrow-cancellation-memos.json @@ -1,6 +1,6 @@ { "owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", - "suspensionSequence": 1234, + "escrowSequence": 1234, "memos": [ { "type": "test", diff --git a/test/fixtures/requests/prepare-escrow-cancellation.json b/test/fixtures/requests/prepare-escrow-cancellation.json index ab7dd27d..c263f8ec 100644 --- a/test/fixtures/requests/prepare-escrow-cancellation.json +++ b/test/fixtures/requests/prepare-escrow-cancellation.json @@ -1,4 +1,4 @@ { "owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", - "suspensionSequence": 1234 + "escrowSequence": 1234 } diff --git a/test/fixtures/requests/prepare-escrow-creation-full.json b/test/fixtures/requests/prepare-escrow-creation-full.json index bfaa71e2..38553905 100644 --- a/test/fixtures/requests/prepare-escrow-creation-full.json +++ b/test/fixtures/requests/prepare-escrow-creation-full.json @@ -17,7 +17,7 @@ }, "tag": 2 }, - "digest": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4", + "condition": "8F434346648F6B96DF89DDA901C5176B10A6D83961DD3C1AC88B59B2DC327AA4", "allowExecuteAfter": "2014-09-24T21:21:50.000Z", "memos": [ { diff --git a/test/fixtures/requests/prepare-escrow-execution-simple.json b/test/fixtures/requests/prepare-escrow-execution-simple.json index 15b3e9fa..fb8f49c0 100644 --- a/test/fixtures/requests/prepare-escrow-execution-simple.json +++ b/test/fixtures/requests/prepare-escrow-execution-simple.json @@ -1,6 +1,6 @@ { "owner": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59", - "suspensionSequence": 1234, + "escrowSequence": 1234, "memos": [ { "type": "test", diff --git a/test/fixtures/requests/prepare-escrow-execution.json b/test/fixtures/requests/prepare-escrow-execution.json index 4b0a982b..39abe9a3 100644 --- a/test/fixtures/requests/prepare-escrow-execution.json +++ b/test/fixtures/requests/prepare-escrow-execution.json @@ -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...." } diff --git a/test/fixtures/requests/sign-escrow.json b/test/fixtures/requests/sign-escrow.json index 69df7817..36a8e3bd 100644 --- a/test/fixtures/requests/sign-escrow.json +++ b/test/fixtures/requests/sign-escrow.json @@ -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, diff --git a/test/fixtures/responses/get-transaction-escrow-cancellation.json b/test/fixtures/responses/get-transaction-escrow-cancellation.json index d2db288e..8aebde66 100644 --- a/test/fixtures/responses/get-transaction-escrow-cancellation.json +++ b/test/fixtures/responses/get-transaction-escrow-cancellation.json @@ -1,11 +1,11 @@ { - "type": "suspendedPaymentCancellation", + "type": "escrowCancellation", "address": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", "sequence": 9, "id": "F346E542FFB7A8398C30A87B952668DAB48B7D421094F8B71776DA19775A3B22", "specification": { "owner": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", - "suspensionSequence": 7 + "escrowSequence": 7 }, "outcome": { "result": "tesSUCCESS", diff --git a/test/fixtures/responses/get-transaction-escrow-create-iou.json b/test/fixtures/responses/get-transaction-escrow-create-iou.json index 3d4cb913..cb6a4d63 100644 --- a/test/fixtures/responses/get-transaction-escrow-create-iou.json +++ b/test/fixtures/responses/get-transaction-escrow-create-iou.json @@ -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" }, diff --git a/test/fixtures/responses/get-transaction-escrow-create.json b/test/fixtures/responses/get-transaction-escrow-create.json index 306b5464..ec03794e 100644 --- a/test/fixtures/responses/get-transaction-escrow-create.json +++ b/test/fixtures/responses/get-transaction-escrow-create.json @@ -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" }, diff --git a/test/fixtures/responses/get-transaction-escrow-execution-simple.json b/test/fixtures/responses/get-transaction-escrow-execution-simple.json index 8c9d0b6f..0e6ddb00 100644 --- a/test/fixtures/responses/get-transaction-escrow-execution-simple.json +++ b/test/fixtures/responses/get-transaction-escrow-execution-simple.json @@ -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", diff --git a/test/fixtures/responses/get-transaction-escrow-execution.json b/test/fixtures/responses/get-transaction-escrow-execution.json index 12e40ad9..dd6e5a0a 100644 --- a/test/fixtures/responses/get-transaction-escrow-execution.json +++ b/test/fixtures/responses/get-transaction-escrow-execution.json @@ -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", diff --git a/test/fixtures/responses/index.js b/test/fixtures/responses/index.js index 4318ddc1..a69dd998 100644 --- a/test/fixtures/responses/index.js +++ b/test/fixtures/responses/index.js @@ -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: { diff --git a/test/fixtures/responses/prepare-escrow-cancellation-memos.json b/test/fixtures/responses/prepare-escrow-cancellation-memos.json index ab501488..0d7e89b4 100644 --- a/test/fixtures/responses/prepare-escrow-cancellation-memos.json +++ b/test/fixtures/responses/prepare-escrow-cancellation-memos.json @@ -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, diff --git a/test/fixtures/responses/prepare-escrow-cancellation.json b/test/fixtures/responses/prepare-escrow-cancellation.json index 5250731f..2e891fdd 100644 --- a/test/fixtures/responses/prepare-escrow-cancellation.json +++ b/test/fixtures/responses/prepare-escrow-cancellation.json @@ -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, diff --git a/test/fixtures/responses/prepare-escrow-creation-full.json b/test/fixtures/responses/prepare-escrow-creation-full.json index fcd62d21..034c7125 100644 --- a/test/fixtures/responses/prepare-escrow-creation-full.json +++ b/test/fixtures/responses/prepare-escrow-creation-full.json @@ -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, diff --git a/test/fixtures/responses/prepare-escrow-creation.json b/test/fixtures/responses/prepare-escrow-creation.json index be8c549b..24afa21d 100644 --- a/test/fixtures/responses/prepare-escrow-creation.json +++ b/test/fixtures/responses/prepare-escrow-creation.json @@ -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, diff --git a/test/fixtures/responses/prepare-escrow-execution-simple.json b/test/fixtures/responses/prepare-escrow-execution-simple.json index 36851336..39bfe13c 100644 --- a/test/fixtures/responses/prepare-escrow-execution-simple.json +++ b/test/fixtures/responses/prepare-escrow-execution-simple.json @@ -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, diff --git a/test/fixtures/responses/prepare-escrow-execution.json b/test/fixtures/responses/prepare-escrow-execution.json index ec2800e3..7125c361 100644 --- a/test/fixtures/responses/prepare-escrow-execution.json +++ b/test/fixtures/responses/prepare-escrow-execution.json @@ -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, diff --git a/test/fixtures/responses/sign-escrow.json b/test/fixtures/responses/sign-escrow.json index dca4aa66..e676db50 100644 --- a/test/fixtures/responses/sign-escrow.json +++ b/test/fixtures/responses/sign-escrow.json @@ -1,4 +1,4 @@ { - "signedTransaction": "12000222800000002400000001201900000002201B000000665015712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D68400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD02074473045022100E1DAAD071DC0E556FEC472E0C6CABBAB064901D97FEAD61CA9990DCC17326FFC022051DF3331D340B3E635024D7B9684602EFDEE2D178AAC9E4824722B4DAB6036718114B5F762798A53D543A014CAF8B297CFF8F2F937E88214B5F762798A53D543A014CAF8B297CFF8F2F937E8021001", - "id": "D40E312D9CD2EE8C5940D1D4918E9F5778870CB2FBF1D188061EB21B2E7CF371" + "signedTransaction": "12000222800000002400000001201900000002201B0000006668400000000000000C73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402205CDD40611008680E151EF6C5C70A6DFBF7977DE73800E04F1B6F1FE8688BBE3E022075DB3990E6CBF0BCD990D92FA13E3D3F95510CA2CCBAB92BD2CE288FA6F2F34870102074686973206D757374206861766520333220636861726163746572732E2E2E2E701120712C36933822AD3A3D136C5DF97AA863B69F9CE88B2D6CE6BDD11BFDE290C19D8114B5F762798A53D543A014CAF8B297CFF8F2F937E88214B5F762798A53D543A014CAF8B297CFF8F2F937E8", + "id": "E76178CD799A82BAB6EE83A70DE0060F0BDC8BDE29980F0832D791D8D9D5CACC" } diff --git a/test/fixtures/rippled/index.js b/test/fixtures/rippled/index.js index e11f911f..77c086f0 100644 --- a/test/fixtures/rippled/index.js +++ b/test/fixtures/rippled/index.js @@ -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'), diff --git a/test/fixtures/rippled/tx/escrow-cancellation.json b/test/fixtures/rippled/tx/escrow-cancellation.json index 4992db8f..78b03c5b 100644 --- a/test/fixtures/rippled/tx/escrow-cancellation.json +++ b/test/fixtures/rippled/tx/escrow-cancellation.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" } }, diff --git a/test/fixtures/rippled/tx/escrow-creation-iou.json b/test/fixtures/rippled/tx/escrow-creation-iou.json index e05a1145..a6dc941b 100644 --- a/test/fixtures/rippled/tx/escrow-creation-iou.json +++ b/test/fixtures/rippled/tx/escrow-creation-iou.json @@ -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 } diff --git a/test/fixtures/rippled/tx/escrow-creation.json b/test/fixtures/rippled/tx/escrow-creation.json index d51999e8..54bcdd60 100644 --- a/test/fixtures/rippled/tx/escrow-creation.json +++ b/test/fixtures/rippled/tx/escrow-creation.json @@ -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 } diff --git a/test/fixtures/rippled/tx/escrow-execution-simple.json b/test/fixtures/rippled/tx/escrow-execution-simple.json index 3753a2f1..597dca63 100644 --- a/test/fixtures/rippled/tx/escrow-execution-simple.json +++ b/test/fixtures/rippled/tx/escrow-execution-simple.json @@ -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" } }, diff --git a/test/fixtures/rippled/tx/escrow-execution.json b/test/fixtures/rippled/tx/escrow-execution.json index d9dd9170..82a6333d 100644 --- a/test/fixtures/rippled/tx/escrow-execution.json +++ b/test/fixtures/rippled/tx/escrow-execution.json @@ -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" } }, diff --git a/test/mock-rippled.js b/test/mock-rippled.js index e450d46f..8d8de3ca 100644 --- a/test/mock-rippled.js +++ b/test/mock-rippled.js @@ -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));