mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Prevent 'amount' from being misinterpreted (#924)
The 'amount' field should almost never be used. With partial payments, the field can show an amount that is significantly less than the amount that the transaction actually delivered. This change sets amount to 0 XRP when it may be misleading. This change omits the `amount` when parsing payment transactions. See `HISTORY.md` for recommended alternatives.
This commit is contained in:
12
HISTORY.md
12
HISTORY.md
@@ -1,5 +1,17 @@
|
|||||||
# ripple-lib Release History
|
# ripple-lib Release History
|
||||||
|
|
||||||
|
## UNRELEASED
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
|
||||||
|
+ `getTransaction()` and `getTransactions()`
|
||||||
|
+ The `specification.destination.amount` field has been removed from the parsed transaction response.
|
||||||
|
+ To determine the amount that a transaction delivered, use `outcome.deliveredAmount`.
|
||||||
|
+ If you require the provisional requested `Amount` from the original transaction:
|
||||||
|
+ Use `getTransaction`'s `includeRawTransaction` option, or
|
||||||
|
+ Use `getTransactions`'s `includeRawTransactions` option, or
|
||||||
|
+ Use the rippled APIs directly with `request`. For example, call the API methods `tx`, `account_tx`, etc.
|
||||||
|
|
||||||
## 1.0.0-beta.5 (2018-08-11)
|
## 1.0.0-beta.5 (2018-08-11)
|
||||||
|
|
||||||
+ [Fix a TypeScript error by importing the `Prepare` type](https://github.com/ripple/ripple-lib/commit/7cd517268bda5fe74b91dad02fedf8b51b7eae9b)
|
+ [Fix a TypeScript error by importing the `Prepare` type](https://github.com/ripple/ripple-lib/commit/7cd517268bda5fe74b91dad02fedf8b51b7eae9b)
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ source | object | The source of the funds to be sent.
|
|||||||
*source.* maxAmount | [laxAmount](#amount) | The maximum amount to send. (This field is exclusive with source.amount)
|
*source.* maxAmount | [laxAmount](#amount) | The maximum amount to send. (This field is exclusive with source.amount)
|
||||||
destination | object | The destination of the funds to be sent.
|
destination | object | The destination of the funds to be sent.
|
||||||
*destination.* address | [address](#address) | The address to receive at.
|
*destination.* address | [address](#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.* 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 cannot be used with `destination.minAmount`.)
|
||||||
*destination.* tag | integer | *Optional* An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Ripple account.
|
*destination.* tag | integer | *Optional* An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Ripple account.
|
||||||
*destination.* address | [address](#address) | The address to send to.
|
*destination.* address | [address](#address) | The address to send to.
|
||||||
*destination.* minAmount | [laxAmount](#amount) | The minimum amount to be delivered. (This field is exclusive with destination.amount)
|
*destination.* minAmount | [laxAmount](#amount) | The minimum amount to be delivered. (This field is exclusive with destination.amount)
|
||||||
@@ -763,7 +763,7 @@ ripple-lib relies on [rippled APIs](https://ripple.com/build/rippled-apis/) for
|
|||||||
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://ripple.com/build/rippled-apis/#markers-and-pagination).
|
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://ripple.com/build/rippled-apis/#markers-and-pagination).
|
||||||
* Use `requestNextPage()` to request the next page of data.
|
* Use `requestNextPage()` to request the next page of data.
|
||||||
|
|
||||||
When using rippled APIs, [specify XRP amounts in drops](https://ripple.com/build/rippled-apis/#specifying-currency-amounts). 1 XRP = 1000000 drops.
|
When using rippled APIs, [specify XRP amounts in drops](https://developers.ripple.com/basic-data-types.html#specifying-currency-amounts) and [timestamps as the number of seconds since the "Ripple Epoch"](https://developers.ripple.com/basic-data-types.html#specifying-time).
|
||||||
|
|
||||||
## Listening to streams
|
## Listening to streams
|
||||||
|
|
||||||
@@ -1137,7 +1137,8 @@ Retrieves a transaction by its [Transaction ID](#transaction-id).
|
|||||||
Name | Type | Description
|
Name | Type | Description
|
||||||
---- | ---- | -----------
|
---- | ---- | -----------
|
||||||
id | [transactionHash](#transaction-id) | A hash of a transaction used to identify the transaction, represented in hexadecimal.
|
id | [transactionHash](#transaction-id) | A hash of a transaction used to identify the transaction, represented in hexadecimal.
|
||||||
options | object | *Optional* Options to limit the ledger versions to search.
|
options | object | *Optional* Options to limit the ledger versions to search and/or to include raw transaction data.
|
||||||
|
*options.* includeRawTransaction | object | *Optional* Include raw transaction data. For advanced users; exercise caution when interpreting this data.
|
||||||
*options.* maxLedgerVersion | integer | *Optional* The highest ledger version to search
|
*options.* maxLedgerVersion | integer | *Optional* The highest ledger version to search
|
||||||
*options.* maxLedgerVersion | string | *Optional* The highest ledger version to search
|
*options.* maxLedgerVersion | string | *Optional* The highest ledger version to search
|
||||||
*options.* minLedgerVersion | integer | *Optional* The lowest ledger version to search.
|
*options.* minLedgerVersion | integer | *Optional* The lowest ledger version to search.
|
||||||
@@ -1153,7 +1154,7 @@ id | [transactionHash](#transaction-id) | A hash of the transaction that can be
|
|||||||
address | [address](#address) | The address of the account that initiated the transaction.
|
address | [address](#address) | The address of the account that initiated the transaction.
|
||||||
sequence | [sequence](#account-sequence-number) | The account sequence number of the transaction for the account that initiated it.
|
sequence | [sequence](#account-sequence-number) | The account sequence number of the transaction for the account that initiated it.
|
||||||
type | [transactionType](#transaction-types) | The type of the transaction.
|
type | [transactionType](#transaction-types) | The type of the transaction.
|
||||||
specification | object | A specification that would produce the same outcome as this transaction. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification.
|
specification | object | A specification that would produce the same outcome as this transaction. *Exception:* For payment transactions, this omits the `destination.amount` field, to prevent misunderstanding. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification.
|
||||||
outcome | object | The outcome of the transaction (what effects it had).
|
outcome | object | The outcome of the transaction (what effects it had).
|
||||||
*outcome.* result | string | Result code returned by rippled. See [Transaction Results](https://ripple.com/build/transactions/#full-transaction-response-list) for a complete list.
|
*outcome.* result | string | Result code returned by rippled. See [Transaction Results](https://ripple.com/build/transactions/#full-transaction-response-list) for a complete list.
|
||||||
*outcome.* fee | [value](#value) | The XRP fee that was charged for the transaction.
|
*outcome.* fee | [value](#value) | The XRP fee that was charged for the transaction.
|
||||||
@@ -1173,6 +1174,7 @@ outcome | object | The outcome of the transaction (what effects it had).
|
|||||||
*outcome.* channelChanges | object | *Optional* Properties reflecting the details of the payment channel.
|
*outcome.* channelChanges | object | *Optional* Properties reflecting the details of the payment channel.
|
||||||
*outcome.* deliveredAmount | [amount](#amount) | *Optional* For payment transactions, it is impossible to reliably compute the actual delivered amount from the balanceChanges due to fixed precision. If the payment is not a partial payment and the transaction succeeded, the deliveredAmount should always be considered to be the amount specified in the transaction.
|
*outcome.* deliveredAmount | [amount](#amount) | *Optional* For payment transactions, it is impossible to reliably compute the actual delivered amount from the balanceChanges due to fixed precision. If the payment is not a partial payment and the transaction succeeded, the deliveredAmount should always be considered to be the amount specified in the transaction.
|
||||||
*outcome.* timestamp | date-time string | *Optional* The timestamp when the transaction was validated. (May be missing when requesting transactions in binary mode.)
|
*outcome.* timestamp | date-time string | *Optional* The timestamp when the transaction was validated. (May be missing when requesting transactions in binary mode.)
|
||||||
|
rawTransaction | string | *Optional* The raw transaction data as a JSON string. For advanced users only; exercise caution when interpreting this data.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -1199,11 +1201,7 @@ return api.getTransaction(id).then(transaction => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
||||||
},
|
},
|
||||||
@@ -1296,6 +1294,7 @@ options | object | *Optional* Options to filter the resulting transactions.
|
|||||||
*options.* counterparty | [address](#address) | *Optional* If provided, only return transactions with this account as a counterparty to the transaction.
|
*options.* counterparty | [address](#address) | *Optional* If provided, only return transactions with this account as a counterparty to the transaction.
|
||||||
*options.* earliestFirst | boolean | *Optional* If true, sort transactions so that the earliest ones come first. By default, the newest transactions will come first.
|
*options.* earliestFirst | boolean | *Optional* If true, sort transactions so that the earliest ones come first. By default, the newest transactions will come first.
|
||||||
*options.* excludeFailures | boolean | *Optional* If true, the result will omit transactions that did not succeed.
|
*options.* excludeFailures | boolean | *Optional* If true, the result will omit transactions that did not succeed.
|
||||||
|
*options.* includeRawTransactions | object | *Optional* Include raw transaction data. For advanced users; exercise caution when interpreting this data.
|
||||||
*options.* initiated | boolean | *Optional* If true, return only transactions initiated by the account specified by `address`. If false, return only transactions not initiated by the account specified by `address`.
|
*options.* initiated | boolean | *Optional* If true, return only transactions initiated by the account specified by `address`. If false, return only transactions not initiated by the account specified by `address`.
|
||||||
*options.* limit | integer | *Optional* If specified, return at most this many transactions.
|
*options.* limit | integer | *Optional* If specified, return at most this many transactions.
|
||||||
*options.* maxLedgerVersion | integer | *Optional* Return only transactions in this ledger version or lower.
|
*options.* maxLedgerVersion | integer | *Optional* Return only transactions in this ledger version or lower.
|
||||||
@@ -1341,11 +1340,7 @@ return api.getTransactions(address).then(transaction => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
},
|
},
|
||||||
@@ -1438,11 +1433,7 @@ return api.getTransactions(address).then(transaction => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
},
|
},
|
||||||
@@ -1962,7 +1953,7 @@ source | object | Properties of the source of the payment.
|
|||||||
*source.* maxAmount | [laxAmount](#amount) | The maximum amount to send. (This field is exclusive with source.amount)
|
*source.* maxAmount | [laxAmount](#amount) | The maximum amount to send. (This field is exclusive with source.amount)
|
||||||
destination | object | Properties of the destination of the payment.
|
destination | object | Properties of the destination of the payment.
|
||||||
*destination.* address | [address](#address) | The address to receive at.
|
*destination.* address | [address](#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.* 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 cannot be used with `destination.minAmount`.)
|
||||||
*destination.* tag | integer | *Optional* An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Ripple account.
|
*destination.* tag | integer | *Optional* An arbitrary unsigned 32-bit integer that identifies a reason for payment or a non-Ripple account.
|
||||||
*destination.* address | [address](#address) | The address to send to.
|
*destination.* address | [address](#address) | The address to send to.
|
||||||
*destination.* minAmount | [laxAmount](#amount) | The minimum amount to be delivered. (This field is exclusive with destination.amount)
|
*destination.* minAmount | [laxAmount](#amount) | The minimum amount to be delivered. (This field is exclusive with destination.amount)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ripple-lib relies on [rippled APIs](https://ripple.com/build/rippled-apis/) for
|
|||||||
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://ripple.com/build/rippled-apis/#markers-and-pagination).
|
* Use `hasNextPage()` to determine whether a response has more pages. This is true when the response includes a [`marker` field](https://ripple.com/build/rippled-apis/#markers-and-pagination).
|
||||||
* Use `requestNextPage()` to request the next page of data.
|
* Use `requestNextPage()` to request the next page of data.
|
||||||
|
|
||||||
When using rippled APIs, [specify XRP amounts in drops](https://ripple.com/build/rippled-apis/#specifying-currency-amounts). 1 XRP = 1000000 drops.
|
When using rippled APIs, [specify XRP amounts in drops](https://developers.ripple.com/basic-data-types.html#specifying-currency-amounts) and [timestamps as the number of seconds since the "Ripple Epoch"](https://developers.ripple.com/basic-data-types.html#specifying-time).
|
||||||
|
|
||||||
## Listening to streams
|
## Listening to streams
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ function loadSchemas() {
|
|||||||
require('./schemas/objects/min-adjustment.json'),
|
require('./schemas/objects/min-adjustment.json'),
|
||||||
require('./schemas/objects/source-exact-adjustment.json'),
|
require('./schemas/objects/source-exact-adjustment.json'),
|
||||||
require('./schemas/objects/destination-exact-adjustment.json'),
|
require('./schemas/objects/destination-exact-adjustment.json'),
|
||||||
|
require('./schemas/objects/destination-address-tag.json'),
|
||||||
require('./schemas/objects/transaction-hash.json'),
|
require('./schemas/objects/transaction-hash.json'),
|
||||||
require('./schemas/objects/address.json'),
|
require('./schemas/objects/address.json'),
|
||||||
require('./schemas/objects/adjustment.json'),
|
require('./schemas/objects/adjustment.json'),
|
||||||
@@ -46,6 +47,7 @@ function loadSchemas() {
|
|||||||
require('./schemas/objects/settings-plus-memos.json'),
|
require('./schemas/objects/settings-plus-memos.json'),
|
||||||
require('./schemas/specifications/settings.json'),
|
require('./schemas/specifications/settings.json'),
|
||||||
require('./schemas/specifications/payment.json'),
|
require('./schemas/specifications/payment.json'),
|
||||||
|
require('./schemas/specifications/get-payment.json'),
|
||||||
require('./schemas/specifications/escrow-cancellation.json'),
|
require('./schemas/specifications/escrow-cancellation.json'),
|
||||||
require('./schemas/specifications/order-cancellation.json'),
|
require('./schemas/specifications/order-cancellation.json'),
|
||||||
require('./schemas/specifications/order.json'),
|
require('./schemas/specifications/order.json'),
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"id": {"$ref": "transactionHash"},
|
"id": {"$ref": "transactionHash"},
|
||||||
"options": {
|
"options": {
|
||||||
"description": "Options to limit the ledger versions to search.",
|
"description": "Options to limit the ledger versions to search and/or to include raw transaction data.",
|
||||||
"properties": {
|
"properties": {
|
||||||
"minLedgerVersion": {
|
"minLedgerVersion": {
|
||||||
"$ref": "ledgerVersion",
|
"$ref": "ledgerVersion",
|
||||||
@@ -15,6 +15,9 @@
|
|||||||
"maxLedgerVersion": {
|
"maxLedgerVersion": {
|
||||||
"$ref": "ledgerVersion",
|
"$ref": "ledgerVersion",
|
||||||
"description": "The highest ledger version to search"
|
"description": "The highest ledger version to search"
|
||||||
|
},
|
||||||
|
"includeRawTransaction": {
|
||||||
|
"description": "Include raw transaction data. For advanced users; exercise caution when interpreting this data. "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|||||||
@@ -49,6 +49,9 @@
|
|||||||
"items": {"$ref": "transactionType"},
|
"items": {"$ref": "transactionType"},
|
||||||
"description": "Only return transactions of the specified [Transaction Types](#transaction-types)."
|
"description": "Only return transactions of the specified [Transaction Types](#transaction-types)."
|
||||||
},
|
},
|
||||||
|
"includeRawTransactions": {
|
||||||
|
"description": "Include raw transaction data. For advanced users; exercise caution when interpreting this data. "
|
||||||
|
},
|
||||||
"binary": {
|
"binary": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "If true, the transactions will be sent from the server in a condensed binary format rather than JSON."
|
"description": "If true, the transactions will be sent from the server in a condensed binary format rather than JSON."
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "amount",
|
"title": "amount",
|
||||||
"link": "amount",
|
"link": "amount",
|
||||||
"description": "An Amount on the Ripple Protocol",
|
"description": "An Amount on the XRP Ledger",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{"$ref": "amountbase"},
|
{"$ref": "amountbase"},
|
||||||
{"required": ["value"]}
|
{"required": ["value"]}
|
||||||
|
|||||||
15
src/common/schemas/objects/destination-address-tag.json
Normal file
15
src/common/schemas/objects/destination-address-tag.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "destinationAddressTag",
|
||||||
|
"description": "A destination address and optional tag, with no amount included. When parsing an incoming transaction, the original specification's amount is hidden to prevent misinterpretation. For the amount that the transaction delivered, see `outcome.deliveredAmount`.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"address": {
|
||||||
|
"$ref": "address",
|
||||||
|
"description": "The address to receive at."
|
||||||
|
},
|
||||||
|
"tag": {"$ref": "tag"}
|
||||||
|
},
|
||||||
|
"required": ["address"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"amount": {
|
"amount": {
|
||||||
"$ref": "laxAmount",
|
"$ref": "laxAmount",
|
||||||
"description": "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)."
|
"description": "An exact amount to deliver to the recipient. If the counterparty is not specified, amounts with any counterparty may be used. (This field cannot be used with `destination.minAmount`.)"
|
||||||
},
|
},
|
||||||
"tag": {"$ref": "tag"}
|
"tag": {"$ref": "tag"}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"title": "getTransaction",
|
"title": "getTransaction",
|
||||||
|
"description": "getTransaction response",
|
||||||
"link": "gettransaction",
|
"link": "gettransaction",
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"$ref": "transactionType"
|
"$ref": "transactionType"
|
||||||
},
|
},
|
||||||
"specification": {
|
"specification": {
|
||||||
"description": "A specification that would produce the same outcome as this transaction. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification."
|
"description": "A specification that would produce the same outcome as this transaction. *Exception:* For payment transactions, this omits the `destination.amount` field, to prevent misunderstanding. The structure of the specification depends on the value of the `type` field (see [Transaction Types](#transaction-types) for details). *Note:* This is **not** necessarily the same as the original specification."
|
||||||
},
|
},
|
||||||
"outcome": {
|
"outcome": {
|
||||||
"$ref": "outcome",
|
"$ref": "outcome",
|
||||||
@@ -24,6 +25,10 @@
|
|||||||
"sequence": {
|
"sequence": {
|
||||||
"$ref": "sequence",
|
"$ref": "sequence",
|
||||||
"description": "The account sequence number of the transaction for the account that initiated it."
|
"description": "The account sequence number of the transaction for the account that initiated it."
|
||||||
|
},
|
||||||
|
"rawTransaction": {
|
||||||
|
"description": "The raw transaction data as a JSON string. For advanced users only; exercise caution when interpreting this data.",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@@ -44,7 +49,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"specification": {
|
"specification": {
|
||||||
"$ref": "payment"
|
"$ref": "getPayment"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
39
src/common/schemas/specifications/get-payment.json
Normal file
39
src/common/schemas/specifications/get-payment.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
|
"title": "getPayment",
|
||||||
|
"description": "A specification of a payment in a response for getTransaction or getTransactions.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"source": {
|
||||||
|
"$ref": "sourceAdjustment",
|
||||||
|
"description": "The source of the funds to be sent."
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"$ref": "destinationAddressTag",
|
||||||
|
"description": "The destination of the funds to be sent. Since this is a payment response, the amount is not shown here. For the amount that the transaction delivered, see `outcome.deliveredAmount`."
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The paths of trustlines and orders to use in executing the payment."
|
||||||
|
},
|
||||||
|
"memos": {"$ref": "memos"},
|
||||||
|
"invoiceID": {
|
||||||
|
"description": "A 256-bit hash that can be used to identify a particular payment.",
|
||||||
|
"$ref": "hash256"
|
||||||
|
},
|
||||||
|
"allowPartialPayment": {
|
||||||
|
"description": "If true, this payment should proceed even if the whole amount cannot be delivered due to a lack of liquidity or a lack of funds in the source account.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"noDirectRipple": {
|
||||||
|
"description": "If true and paths are specified, the sender would like the XRP Ledger to disregard any direct paths from the source account to the destination account. This may be used to take advantage of an arbitrage opportunity or by gateways wishing to issue balances from a hot wallet to a user who has mistakenly set a trustline directly to the hot wallet.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"limitQuality": {
|
||||||
|
"description": "Only take paths where all the conversions have an input:output ratio that is equal or better than the ratio of destination.amount:source.maxAmount.",
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["source", "destination"],
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ function parseTransactionWrapper(ledgerVersion, tx) {
|
|||||||
meta: tx.metaData,
|
meta: tx.metaData,
|
||||||
ledger_index: ledgerVersion
|
ledger_index: ledgerVersion
|
||||||
})
|
})
|
||||||
const result = parseTransaction(transaction)
|
const result = parseTransaction(transaction, false)
|
||||||
if (!result.outcome.ledgerVersion) {
|
if (!result.outcome.ledgerVersion) {
|
||||||
result.outcome.ledgerVersion = ledgerVersion
|
result.outcome.ledgerVersion = ledgerVersion
|
||||||
}
|
}
|
||||||
@@ -62,19 +62,20 @@ function parseState(state) {
|
|||||||
|
|
||||||
export function parseLedger(ledger: Ledger): FormattedLedger {
|
export function parseLedger(ledger: Ledger): FormattedLedger {
|
||||||
const ledgerVersion = parseInt(ledger.ledger_index || ledger.seqNum, 10)
|
const ledgerVersion = parseInt(ledger.ledger_index || ledger.seqNum, 10)
|
||||||
return removeUndefined(Object.assign({
|
return removeUndefined(Object.assign(
|
||||||
stateHash: ledger.account_hash,
|
{
|
||||||
closeTime: rippleTimeToISO8601(ledger.close_time),
|
stateHash: ledger.account_hash,
|
||||||
closeTimeResolution: ledger.close_time_resolution,
|
closeTime: rippleTimeToISO8601(ledger.close_time),
|
||||||
closeFlags: ledger.close_flags,
|
closeTimeResolution: ledger.close_time_resolution,
|
||||||
ledgerHash: ledger.hash || ledger.ledger_hash,
|
closeFlags: ledger.close_flags,
|
||||||
ledgerVersion: ledgerVersion,
|
ledgerHash: ledger.hash || ledger.ledger_hash,
|
||||||
parentLedgerHash: ledger.parent_hash,
|
ledgerVersion: ledgerVersion,
|
||||||
parentCloseTime: rippleTimeToISO8601(ledger.parent_close_time),
|
parentLedgerHash: ledger.parent_hash,
|
||||||
totalDrops: ledger.total_coins || ledger.totalCoins,
|
parentCloseTime: rippleTimeToISO8601(ledger.parent_close_time),
|
||||||
transactionHash: ledger.transaction_hash
|
totalDrops: ledger.total_coins || ledger.totalCoins,
|
||||||
},
|
transactionHash: ledger.transaction_hash
|
||||||
parseTransactions(ledger.transactions, ledgerVersion),
|
},
|
||||||
parseState(ledger.accountState)
|
parseTransactions(ledger.transactions, ledgerVersion),
|
||||||
|
parseState(ledger.accountState)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ function parsePayment(tx: any): Object {
|
|||||||
tag: tx.SourceTag
|
tag: tx.SourceTag
|
||||||
}
|
}
|
||||||
|
|
||||||
const destination = {
|
const destination: {
|
||||||
|
address: string,
|
||||||
|
tag: number | undefined
|
||||||
|
} = {
|
||||||
address: tx.Destination,
|
address: tx.Destination,
|
||||||
amount: removeGenericCounterparty(parseAmount(tx.Amount), tx.Destination),
|
|
||||||
tag: tx.DestinationTag
|
tag: tx.DestinationTag
|
||||||
|
// Notice that `amount` is omitted to prevent misinterpretation
|
||||||
}
|
}
|
||||||
|
|
||||||
return removeUndefined({
|
return removeUndefined({
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function parseTransactionType(type) {
|
|||||||
return mapping[type] || null
|
return mapping[type] || null
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseTransaction(tx: any): any {
|
function parseTransaction(tx: any, includeRawTransaction: boolean): any {
|
||||||
const type = parseTransactionType(tx.TransactionType)
|
const type = parseTransactionType(tx.TransactionType)
|
||||||
const mapping = {
|
const mapping = {
|
||||||
'payment': parsePayment,
|
'payment': parsePayment,
|
||||||
@@ -72,7 +72,8 @@ function parseTransaction(tx: any): any {
|
|||||||
sequence: tx.Sequence,
|
sequence: tx.Sequence,
|
||||||
id: tx.hash,
|
id: tx.hash,
|
||||||
specification: removeUndefined(specification),
|
specification: removeUndefined(specification),
|
||||||
outcome: outcome ? removeUndefined(outcome) : undefined
|
outcome: outcome ? removeUndefined(outcome) : undefined,
|
||||||
|
rawTransaction: includeRawTransaction ? JSON.stringify(tx) : undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import {FormattedTransactionType} from '../transaction/types'
|
|||||||
|
|
||||||
export type TransactionOptions = {
|
export type TransactionOptions = {
|
||||||
minLedgerVersion?: number,
|
minLedgerVersion?: number,
|
||||||
maxLedgerVersion?: number
|
maxLedgerVersion?: number,
|
||||||
|
includeRawTransaction?: boolean
|
||||||
}
|
}
|
||||||
type TransactionResponse = FormattedTransactionType & {
|
type TransactionResponse = FormattedTransactionType & {
|
||||||
hash: string,
|
hash: string,
|
||||||
@@ -83,9 +84,9 @@ function convertError(connection: Connection, options: TransactionOptions,
|
|||||||
function formatResponse(options: TransactionOptions, tx: TransactionResponse
|
function formatResponse(options: TransactionOptions, tx: TransactionResponse
|
||||||
): FormattedTransactionType {
|
): FormattedTransactionType {
|
||||||
if (tx.validated !== true || !isTransactionInRange(tx, options)) {
|
if (tx.validated !== true || !isTransactionInRange(tx, options)) {
|
||||||
throw new errors.NotFoundError('Transaction not found')
|
throw new errors.NotFoundError('Transaction not found')
|
||||||
}
|
}
|
||||||
return parseTransaction(tx)
|
return parseTransaction(tx, options.includeRawTransaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getTransaction(id: string, options: TransactionOptions = {}
|
async function getTransaction(id: string, options: TransactionOptions = {}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export type TransactionsOptions = {
|
|||||||
initiated?: boolean,
|
initiated?: boolean,
|
||||||
counterparty?: string,
|
counterparty?: string,
|
||||||
types?: Array<string>,
|
types?: Array<string>,
|
||||||
|
includeRawTransactions?: boolean,
|
||||||
binary?: boolean,
|
binary?: boolean,
|
||||||
startTx?: FormattedTransactionType
|
startTx?: FormattedTransactionType
|
||||||
}
|
}
|
||||||
@@ -35,11 +36,11 @@ function parseBinaryTransaction(transaction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAccountTxTransaction(tx) {
|
function parseAccountTxTransaction(tx, includeRawTransaction: boolean) {
|
||||||
const _tx = tx.tx_blob ? parseBinaryTransaction(tx) : tx
|
const _tx = tx.tx_blob ? parseBinaryTransaction(tx) : tx
|
||||||
// rippled uses a different response format for 'account_tx' than 'tx'
|
// rippled uses a different response format for 'account_tx' than 'tx'
|
||||||
return parseTransaction(_.assign({}, _tx.tx,
|
return parseTransaction(_.assign({}, _tx.tx,
|
||||||
{meta: _tx.meta, validated: _tx.validated}))
|
{meta: _tx.meta, validated: _tx.validated}), includeRawTransaction)
|
||||||
}
|
}
|
||||||
|
|
||||||
function counterpartyFilter(filters, tx: FormattedTransactionType) {
|
function counterpartyFilter(filters, tx: FormattedTransactionType) {
|
||||||
@@ -87,11 +88,13 @@ function orderFilter(
|
|||||||
function formatPartialResponse(address: string,
|
function formatPartialResponse(address: string,
|
||||||
options: TransactionsOptions, data
|
options: TransactionsOptions, data
|
||||||
) {
|
) {
|
||||||
|
const parse = tx =>
|
||||||
|
parseAccountTxTransaction(tx, options.includeRawTransactions)
|
||||||
return {
|
return {
|
||||||
marker: data.marker,
|
marker: data.marker,
|
||||||
results: data.transactions
|
results: data.transactions
|
||||||
.filter(tx => tx.validated)
|
.filter(tx => tx.validated)
|
||||||
.map(parseAccountTxTransaction)
|
.map(parse)
|
||||||
.filter(_.partial(transactionFilter, address, options))
|
.filter(_.partial(transactionFilter, address, options))
|
||||||
.filter(_.partial(orderFilter, options))
|
.filter(_.partial(orderFilter, options))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1447,6 +1447,17 @@ describe('RippleAPI', function () {
|
|||||||
'getTransaction'));
|
'getTransaction'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getTransaction - payment - include raw transaction', function () {
|
||||||
|
const options = {
|
||||||
|
includeRawTransaction: true
|
||||||
|
}
|
||||||
|
return this.api.getTransaction(
|
||||||
|
hashes.VALID_TRANSACTION_HASH, options
|
||||||
|
).then(
|
||||||
|
_.partial(checkResult, responses.getTransaction.paymentIncludeRawTransaction,
|
||||||
|
'getTransaction'));
|
||||||
|
});
|
||||||
|
|
||||||
it('getTransaction - settings', function () {
|
it('getTransaction - settings', function () {
|
||||||
const hash =
|
const hash =
|
||||||
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B';
|
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B';
|
||||||
@@ -1455,6 +1466,19 @@ describe('RippleAPI', function () {
|
|||||||
'getTransaction'));
|
'getTransaction'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getTransaction - settings - include raw transaction', function () {
|
||||||
|
const hash =
|
||||||
|
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B';
|
||||||
|
const options = {
|
||||||
|
includeRawTransaction: true
|
||||||
|
}
|
||||||
|
const expected = responses.getTransaction.settings
|
||||||
|
expected.rawTransaction = "{\"Account\":\"rLVKsA4F9iJBbA6rX2x4wCmkj6drgtqpQe\",\"Fee\":\"10\",\"Flags\":2147483648,\"Sequence\":1,\"SetFlag\":2,\"SigningPubKey\":\"03EA3ADCA632F125EC2CC4F7F6A82DE0DCE2B65290CAC1F22242C5163F0DA9652D\",\"TransactionType\":\"AccountSet\",\"TxnSignature\":\"3045022100DE8B666B1A31EA65011B0F32130AB91A5747E32FA49B3054CEE8E8362DBAB98A022040CF0CF254677A8E5CD04C59CA2ED7F6F15F7E184641BAE169C561650967B226\",\"date\":460832270,\"hash\":\"4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA1B\",\"inLedger\":8206418,\"ledger_index\":8206418,\"meta\":{\"AffectedNodes\":[{\"ModifiedNode\":{\"FinalFields\":{\"Account\":\"rLVKsA4F9iJBbA6rX2x4wCmkj6drgtqpQe\",\"Balance\":\"29999990\",\"Flags\":786432,\"OwnerCount\":0,\"Sequence\":2},\"LedgerEntryType\":\"AccountRoot\",\"LedgerIndex\":\"3F5072C4875F32ED770DAF3610A716600ED7C7BB0348FADC7A98E011BB2CD36F\",\"PreviousFields\":{\"Balance\":\"30000000\",\"Flags\":4194304,\"Sequence\":1},\"PreviousTxnID\":\"3FB0350A3742BBCC0D8AA3C5247D1AEC01177D0A24D9C34762BAA2FEA8AD88B3\",\"PreviousTxnLgrSeq\":8206397}}],\"TransactionIndex\":5,\"TransactionResult\":\"tesSUCCESS\"},\"validated\":true}"
|
||||||
|
return this.api.getTransaction(hash, options).then(
|
||||||
|
_.partial(checkResult, expected,
|
||||||
|
'getTransaction'));
|
||||||
|
});
|
||||||
|
|
||||||
it('getTransaction - order', function () {
|
it('getTransaction - order', function () {
|
||||||
const hash =
|
const hash =
|
||||||
'10A6FB4A66EE80BED46AAE4815D7DC43B97E944984CCD5B93BCF3F8538CABC51';
|
'10A6FB4A66EE80BED46AAE4815D7DC43B97E944984CCD5B93BCF3F8538CABC51';
|
||||||
@@ -1782,6 +1806,18 @@ describe('RippleAPI', function () {
|
|||||||
'getTransactions'));
|
'getTransactions'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getTransactions - include raw transactions', function () {
|
||||||
|
const options = {
|
||||||
|
types: ['payment', 'order'],
|
||||||
|
initiated: true,
|
||||||
|
limit: 2,
|
||||||
|
includeRawTransactions: true
|
||||||
|
};
|
||||||
|
return this.api.getTransactions(address, options).then(
|
||||||
|
_.partial(checkResult, responses.getTransactions.includeRawTransactions,
|
||||||
|
'getTransactions'));
|
||||||
|
});
|
||||||
|
|
||||||
it('getTransactions - earliest first', function () {
|
it('getTransactions - earliest first', function () {
|
||||||
const options = {
|
const options = {
|
||||||
types: ['payment', 'order'], initiated: true, limit: 2,
|
types: ['payment', 'order'], initiated: true, limit: 2,
|
||||||
@@ -2413,8 +2449,6 @@ describe('RippleAPI', function () {
|
|||||||
_.partial(checkResult, responses.getLedger.header, 'getLedger'));
|
_.partial(checkResult, responses.getLedger.header, 'getLedger'));
|
||||||
});
|
});
|
||||||
|
|
||||||
// New in > 0.21.0
|
|
||||||
// future ledger versions are allowed, and passed to rippled as-is.
|
|
||||||
it('getLedger - future ledger version', function () {
|
it('getLedger - future ledger version', function () {
|
||||||
return this.api.getLedger({ ledgerVersion: 14661789 }).then(response => {
|
return this.api.getLedger({ ledgerVersion: 14661789 }).then(response => {
|
||||||
assert(response)
|
assert(response)
|
||||||
@@ -2447,7 +2481,7 @@ describe('RippleAPI', function () {
|
|||||||
const request = {
|
const request = {
|
||||||
includeTransactions: true,
|
includeTransactions: true,
|
||||||
includeAllData: true,
|
includeAllData: true,
|
||||||
ledgerVersion: 100000
|
ledgerVersion: 22420574
|
||||||
};
|
};
|
||||||
return this.api.getLedger(request).then(
|
return this.api.getLedger(request).then(
|
||||||
_.partial(checkResult, responses.getLedger.withPartial, 'getLedger'));
|
_.partial(checkResult, responses.getLedger.withPartial, 'getLedger'));
|
||||||
|
|||||||
6
test/fixtures/responses/get-ledger-full.json
vendored
6
test/fixtures/responses/get-ledger-full.json
vendored
@@ -24,11 +24,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj",
|
"address": "rLQBHVhFnaC5gLEkgr6HgBJJ3bgeZHg9cj"
|
||||||
"amount": {
|
|
||||||
"currency": "XRP",
|
|
||||||
"value": "10000"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outcome": {
|
"outcome": {
|
||||||
|
|||||||
@@ -25,12 +25,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
|
"address": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "10",
|
|
||||||
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"allowPartialPayment": true
|
"allowPartialPayment": true
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -12,11 +12,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
||||||
}
|
}
|
||||||
|
|||||||
89
test/fixtures/responses/get-transaction-payment-include-raw-transaction.json
vendored
Normal file
89
test/fixtures/responses/get-transaction-payment-include-raw-transaction.json
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"type": "payment",
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"sequence": 4,
|
||||||
|
"id": "F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF",
|
||||||
|
"specification": {
|
||||||
|
"source": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"maxAmount": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.112209"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
||||||
|
},
|
||||||
|
"outcome": {
|
||||||
|
"result": "tesSUCCESS",
|
||||||
|
"timestamp": "2013-03-12T23:56:50.000Z",
|
||||||
|
"fee": "0.00001",
|
||||||
|
"deliveredAmount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001",
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"balanceChanges": {
|
||||||
|
"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo": [
|
||||||
|
{
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001002"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM": [
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "-1.101208"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"orderbookChanges": {
|
||||||
|
"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr": [
|
||||||
|
{
|
||||||
|
"direction": "buy",
|
||||||
|
"quantity": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
"totalPrice": {
|
||||||
|
"currency": "USD",
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"value": "0.001002"
|
||||||
|
},
|
||||||
|
"makerExchangeRate": "1099",
|
||||||
|
"sequence": 58,
|
||||||
|
"status": "partially-filled"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ledgerVersion": 348860,
|
||||||
|
"indexInLedger": 0
|
||||||
|
},
|
||||||
|
"rawTransaction": "{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Amount\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"0.001\"},\"Destination\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"Fee\":\"10\",\"Flags\":0,\"Paths\":[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]],\"SendMax\":\"1112209\",\"Sequence\":4,\"SigningPubKey\":\"02BC8C02199949B15C005B997E7C8594574E9B02BA2D0628902E0532989976CF9D\",\"TransactionType\":\"Payment\",\"TxnSignature\":\"304502204EE3E9D1B01D8959B08450FCA9E22025AF503DEF310E34A93863A85CAB3C0BC5022100B61F5B567F77026E8DEED89EED0B7CAF0E6C96C228A2A65216F0DC2D04D52083\",\"date\":416447810,\"hash\":\"F4AB442A6D4CBB935D66E1DA7309A5FC71C7143ED4049053EC14E3875B0CF9BF\",\"inLedger\":348860,\"ledger_index\":348860,\"validated\":true,\"meta\":{\"AffectedNodes\":[{\"ModifiedNode\":{\"FinalFields\":{\"Account\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\",\"BookDirectory\":\"4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5E03E788E09BB000\",\"BookNode\":\"0000000000000000\",\"Flags\":0,\"OwnerNode\":\"0000000000000000\",\"Sequence\":58,\"TakerGets\":{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"value\":\"5.648998\"},\"TakerPays\":\"6208248802\"},\"LedgerEntryType\":\"Offer\",\"LedgerIndex\":\"3CFB3C79D4F1BDB1EE5245259372576D926D9A875713422F7169A6CC60AFA68B\",\"PreviousFields\":{\"TakerGets\":{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"value\":\"5.65\"},\"TakerPays\":\"6209350000\"},\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"PreviousTxnLgrSeq\":348433}},{\"ModifiedNode\":{\"FinalFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-0.001\"},\"Flags\":131072,\"HighLimit\":{\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"value\":\"1\"},\"HighNode\":\"0000000000000000\",\"LowLimit\":{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"value\":\"0\"},\"LowNode\":\"0000000000000002\"},\"LedgerEntryType\":\"RippleState\",\"LedgerIndex\":\"4BD1874F8F3A60EDB0C23F5BD43E07953C2B8741B226648310D113DE2B486F01\",\"PreviousFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"0\"}},\"PreviousTxnID\":\"5B2006DAD0B3130F57ACF7CC5CCAC2EEBCD4B57AAA091A6FD0A24B073D08ABB8\",\"PreviousTxnLgrSeq\":343703}},{\"ModifiedNode\":{\"FinalFields\":{\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Balance\":\"9998898762\",\"Flags\":0,\"OwnerCount\":3,\"Sequence\":5},\"LedgerEntryType\":\"AccountRoot\",\"LedgerIndex\":\"4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05\",\"PreviousFields\":{\"Balance\":\"9999999970\",\"Sequence\":4},\"PreviousTxnID\":\"53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8\",\"PreviousTxnLgrSeq\":343570}},{\"ModifiedNode\":{\"FinalFields\":{\"Account\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\",\"Balance\":\"912695302618\",\"Flags\":0,\"OwnerCount\":10,\"Sequence\":59},\"LedgerEntryType\":\"AccountRoot\",\"LedgerIndex\":\"F3E119AAA87AF3607CF87F5523BB8278A83BCB4142833288305D767DD30C392A\",\"PreviousFields\":{\"Balance\":\"912694201420\"},\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"PreviousTxnLgrSeq\":348433}},{\"ModifiedNode\":{\"FinalFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-5.5541638883365\"},\"Flags\":131072,\"HighLimit\":{\"currency\":\"USD\",\"issuer\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\",\"value\":\"1000\"},\"HighNode\":\"0000000000000000\",\"LowLimit\":{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"value\":\"0\"},\"LowNode\":\"000000000000000C\"},\"LedgerEntryType\":\"RippleState\",\"LedgerIndex\":\"FA1255C2E0407F1945BCF9351257C7C5C28B0F5F09BB81C08D35A03E9F0136BC\",\"PreviousFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-5.5551658883365\"}},\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"PreviousTxnLgrSeq\":348433}}],\"TransactionIndex\":0,\"TransactionResult\":\"tesSUCCESS\"}}"
|
||||||
|
}
|
||||||
@@ -12,11 +12,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"type\":49,\"type_hex\":\"0000000000000031\"}]]"
|
||||||
},
|
},
|
||||||
|
|||||||
190
test/fixtures/responses/get-transactions-include-raw-transactions.json
vendored
Normal file
190
test/fixtures/responses/get-transactions-include-raw-transactions.json
vendored
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "payment",
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"sequence": 4,
|
||||||
|
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
|
||||||
|
"specification": {
|
||||||
|
"memos": [
|
||||||
|
{
|
||||||
|
"type": "client",
|
||||||
|
"format": "rt1.5.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"maxAmount": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.112209"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
|
},
|
||||||
|
"outcome": {
|
||||||
|
"result": "tesSUCCESS",
|
||||||
|
"fee": "0.00001",
|
||||||
|
"deliveredAmount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001",
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"balanceChanges": {
|
||||||
|
"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo": [
|
||||||
|
{
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001002"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM": [
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "-1.101208"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"orderbookChanges": {
|
||||||
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59": [
|
||||||
|
{
|
||||||
|
"direction": "buy",
|
||||||
|
"quantity": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
"totalPrice": {
|
||||||
|
"currency": "USD",
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"value": "0.001002"
|
||||||
|
},
|
||||||
|
"makerExchangeRate": "1099",
|
||||||
|
"sequence": 58,
|
||||||
|
"status": "partially-filled"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ledgerVersion": 348859,
|
||||||
|
"indexInLedger": 0
|
||||||
|
},
|
||||||
|
"rawTransaction": "{\"TransactionType\":\"Payment\",\"Flags\":0,\"Sequence\":4,\"Amount\":{\"value\":\"0.001\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"Fee\":\"10\",\"SendMax\":\"1112209\",\"SigningPubKey\":\"02BC8C02199949B15C005B997E7C8594574E9B02BA2D0628902E0532989976CF9D\",\"TxnSignature\":\"304502204EE3E9D1B01D8959B08450FCA9E22025AF503DEF310E34A93863A85CAB3C0BC5022100B61F5B567F77026E8DEED89EED0B7CAF0E6C96C228A2A65216F0DC2D04D52083\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"Memos\":[{\"Memo\":{\"MemoType\":\"636C69656E74\",\"MemoFormat\":\"7274312E352E32\"}}],\"Paths\":[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]],\"hash\":\"99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865\",\"ledger_index\":348859,\"meta\":{\"TransactionIndex\":0,\"AffectedNodes\":[{\"ModifiedNode\":{\"LedgerEntryType\":\"Offer\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"3CFB3C79D4F1BDB1EE5245259372576D926D9A875713422F7169A6CC60AFA68B\",\"PreviousFields\":{\"TakerPays\":\"6209350000\",\"TakerGets\":{\"value\":\"5.65\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"}},\"FinalFields\":{\"Flags\":0,\"Sequence\":58,\"BookNode\":\"0000000000000000\",\"OwnerNode\":\"0000000000000000\",\"BookDirectory\":\"4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5E03E788E09BB000\",\"TakerPays\":\"6208248802\",\"TakerGets\":{\"value\":\"5.648998\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"RippleState\",\"PreviousTxnLgrSeq\":343703,\"PreviousTxnID\":\"5B2006DAD0B3130F57ACF7CC5CCAC2EEBCD4B57AAA091A6FD0A24B073D08ABB8\",\"LedgerIndex\":\"4BD1874F8F3A60EDB0C23F5BD43E07953C2B8741B226648310D113DE2B486F01\",\"PreviousFields\":{\"Balance\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"}},\"FinalFields\":{\"Flags\":131072,\"LowNode\":\"0000000000000002\",\"HighNode\":\"0000000000000000\",\"Balance\":{\"value\":\"-0.001\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"},\"LowLimit\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"HighLimit\":{\"value\":\"1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"AccountRoot\",\"PreviousTxnLgrSeq\":343570,\"PreviousTxnID\":\"53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8\",\"LedgerIndex\":\"4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05\",\"PreviousFields\":{\"Sequence\":4,\"Balance\":\"9999999970\"},\"FinalFields\":{\"Flags\":0,\"Sequence\":5,\"OwnerCount\":3,\"Balance\":\"9998898762\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"AccountRoot\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"F3E119AAA87AF3607CF87F5523BB8278A83BCB4142833288305D767DD30C392A\",\"PreviousFields\":{\"Balance\":\"912694201420\"},\"FinalFields\":{\"Flags\":0,\"Sequence\":59,\"OwnerCount\":10,\"Balance\":\"912695302618\",\"Account\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"RippleState\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"FA1255C2E0407F1945BCF9351257C7C5C28B0F5F09BB81C08D35A03E9F0136BC\",\"PreviousFields\":{\"Balance\":{\"value\":\"-5.5551658883365\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"}},\"FinalFields\":{\"Flags\":131072,\"LowNode\":\"000000000000000C\",\"HighNode\":\"0000000000000000\",\"Balance\":{\"value\":\"-5.5541638883365\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"},\"LowLimit\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"HighLimit\":{\"value\":\"1000\",\"currency\":\"USD\",\"issuer\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\"}}}}],\"TransactionResult\":\"tesSUCCESS\"},\"validated\":true}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "payment",
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"id": "99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865",
|
||||||
|
"sequence": 4,
|
||||||
|
"specification": {
|
||||||
|
"memos": [
|
||||||
|
{
|
||||||
|
"type": "client",
|
||||||
|
"format": "rt1.5.2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {
|
||||||
|
"address": "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59",
|
||||||
|
"maxAmount": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.112209"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
|
},
|
||||||
|
"outcome": {
|
||||||
|
"result": "tesSUCCESS",
|
||||||
|
"fee": "0.00001",
|
||||||
|
"deliveredAmount": {
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001",
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
|
},
|
||||||
|
"balanceChanges": {
|
||||||
|
"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo": [
|
||||||
|
{
|
||||||
|
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001002"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM": [
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "0.001"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "-1.101208"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr": [
|
||||||
|
{
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"currency": "USD",
|
||||||
|
"value": "-0.001002"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"orderbookChanges": {
|
||||||
|
"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59": [
|
||||||
|
{
|
||||||
|
"direction": "buy",
|
||||||
|
"quantity": {
|
||||||
|
"currency": "XRP",
|
||||||
|
"value": "1.101198"
|
||||||
|
},
|
||||||
|
"totalPrice": {
|
||||||
|
"currency": "USD",
|
||||||
|
"counterparty": "rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo",
|
||||||
|
"value": "0.001002"
|
||||||
|
},
|
||||||
|
"makerExchangeRate": "1099",
|
||||||
|
"sequence": 58,
|
||||||
|
"status": "partially-filled"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ledgerVersion": 348858,
|
||||||
|
"indexInLedger": 0
|
||||||
|
},
|
||||||
|
"rawTransaction": "{\"TransactionType\":\"Payment\",\"Flags\":0,\"Sequence\":4,\"Amount\":{\"value\":\"0.001\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"},\"Fee\":\"10\",\"SendMax\":\"1112209\",\"SigningPubKey\":\"02BC8C02199949B15C005B997E7C8594574E9B02BA2D0628902E0532989976CF9D\",\"TxnSignature\":\"304502204EE3E9D1B01D8959B08450FCA9E22025AF503DEF310E34A93863A85CAB3C0BC5022100B61F5B567F77026E8DEED89EED0B7CAF0E6C96C228A2A65216F0DC2D04D52083\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\",\"Destination\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\",\"Memos\":[{\"Memo\":{\"MemoType\":\"636C69656E74\",\"MemoFormat\":\"7274312E352E32\"}}],\"Paths\":[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]],\"hash\":\"99404A34E8170319521223A6C604AF48B9F1E3000C377E6141F9A1BF60B0B865\",\"ledger_index\":348858,\"meta\":{\"TransactionIndex\":0,\"AffectedNodes\":[{\"ModifiedNode\":{\"LedgerEntryType\":\"Offer\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"3CFB3C79D4F1BDB1EE5245259372576D926D9A875713422F7169A6CC60AFA68B\",\"PreviousFields\":{\"TakerPays\":\"6209350000\",\"TakerGets\":{\"value\":\"5.65\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"}},\"FinalFields\":{\"Flags\":0,\"Sequence\":58,\"BookNode\":\"0000000000000000\",\"OwnerNode\":\"0000000000000000\",\"BookDirectory\":\"4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5E03E788E09BB000\",\"TakerPays\":\"6208248802\",\"TakerGets\":{\"value\":\"5.648998\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"RippleState\",\"PreviousTxnLgrSeq\":343703,\"PreviousTxnID\":\"5B2006DAD0B3130F57ACF7CC5CCAC2EEBCD4B57AAA091A6FD0A24B073D08ABB8\",\"LedgerIndex\":\"4BD1874F8F3A60EDB0C23F5BD43E07953C2B8741B226648310D113DE2B486F01\",\"PreviousFields\":{\"Balance\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"}},\"FinalFields\":{\"Flags\":131072,\"LowNode\":\"0000000000000002\",\"HighNode\":\"0000000000000000\",\"Balance\":{\"value\":\"-0.001\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"},\"LowLimit\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"HighLimit\":{\"value\":\"1\",\"currency\":\"USD\",\"issuer\":\"rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM\"}}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"AccountRoot\",\"PreviousTxnLgrSeq\":343570,\"PreviousTxnID\":\"53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8\",\"LedgerIndex\":\"4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05\",\"PreviousFields\":{\"Sequence\":4,\"Balance\":\"9999999970\"},\"FinalFields\":{\"Flags\":0,\"Sequence\":5,\"OwnerCount\":3,\"Balance\":\"9998898762\",\"Account\":\"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"AccountRoot\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"F3E119AAA87AF3607CF87F5523BB8278A83BCB4142833288305D767DD30C392A\",\"PreviousFields\":{\"Balance\":\"912694201420\"},\"FinalFields\":{\"Flags\":0,\"Sequence\":59,\"OwnerCount\":10,\"Balance\":\"912695302618\",\"Account\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\"}}},{\"ModifiedNode\":{\"LedgerEntryType\":\"RippleState\",\"PreviousTxnLgrSeq\":348433,\"PreviousTxnID\":\"8F571C346688D89AC1F737AE3B6BB5D976702B171CC7B4DE5CA3D444D5B8D6B4\",\"LedgerIndex\":\"FA1255C2E0407F1945BCF9351257C7C5C28B0F5F09BB81C08D35A03E9F0136BC\",\"PreviousFields\":{\"Balance\":{\"value\":\"-5.5551658883365\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"}},\"FinalFields\":{\"Flags\":131072,\"LowNode\":\"000000000000000C\",\"HighNode\":\"0000000000000000\",\"Balance\":{\"value\":\"-5.5541638883365\",\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\"},\"LowLimit\":{\"value\":\"0\",\"currency\":\"USD\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\"},\"HighLimit\":{\"value\":\"1000\",\"currency\":\"USD\",\"issuer\":\"r9tGqzZgKxVFvzKFdUqXAqTzazWBUia8Qr\"}}}}],\"TransactionResult\":\"tesSUCCESS\"},\"validated\":true}"
|
||||||
|
}
|
||||||
|
]
|
||||||
12
test/fixtures/responses/get-transactions.json
vendored
12
test/fixtures/responses/get-transactions.json
vendored
@@ -19,11 +19,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
},
|
},
|
||||||
@@ -116,11 +112,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"destination": {
|
"destination": {
|
||||||
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
"address": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM"
|
||||||
"amount": {
|
|
||||||
"currency": "USD",
|
|
||||||
"value": "0.001"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
"paths": "[[{\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"},{\"account\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"issuer\":\"rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo\",\"currency\":\"USD\"}]]"
|
||||||
},
|
},
|
||||||
|
|||||||
2
test/fixtures/responses/index.js
vendored
2
test/fixtures/responses/index.js
vendored
@@ -35,6 +35,7 @@ module.exports = {
|
|||||||
orderSell: require('./get-transaction-order-sell.json'),
|
orderSell: require('./get-transaction-order-sell.json'),
|
||||||
noMeta: require('./get-transaction-no-meta.json'),
|
noMeta: require('./get-transaction-no-meta.json'),
|
||||||
payment: require('./get-transaction-payment.json'),
|
payment: require('./get-transaction-payment.json'),
|
||||||
|
paymentIncludeRawTransaction: require('./get-transaction-payment-include-raw-transaction.json'),
|
||||||
settings: require('./get-transaction-settings.json'),
|
settings: require('./get-transaction-settings.json'),
|
||||||
trustline: require('./get-transaction-trustline-set.json'),
|
trustline: require('./get-transaction-trustline-set.json'),
|
||||||
trackingOn: require('./get-transaction-settings-tracking-on.json'),
|
trackingOn: require('./get-transaction-settings-tracking-on.json'),
|
||||||
@@ -68,6 +69,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
getTransactions: {
|
getTransactions: {
|
||||||
normal: require('./get-transactions.json'),
|
normal: require('./get-transactions.json'),
|
||||||
|
includeRawTransactions: require('./get-transactions-include-raw-transactions.json'),
|
||||||
one: require('./get-transactions-one.json')
|
one: require('./get-transactions-one.json')
|
||||||
},
|
},
|
||||||
getTrustlines: {
|
getTrustlines: {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -256,7 +256,8 @@ module.exports = function createMockRippled(port) {
|
|||||||
createLedgerResponse(request, fixtures.ledger.withoutCloseTime));
|
createLedgerResponse(request, fixtures.ledger.withoutCloseTime));
|
||||||
} else if (request.ledger_index === 4181996) {
|
} else if (request.ledger_index === 4181996) {
|
||||||
conn.send(createLedgerResponse(request, fixtures.ledger.withSettingsTx));
|
conn.send(createLedgerResponse(request, fixtures.ledger.withSettingsTx));
|
||||||
} else if (request.ledger_index === 100000) {
|
} else if (request.ledger_index === 22420574 &&
|
||||||
|
request.expand === true && request.transactions === true) {
|
||||||
conn.send(
|
conn.send(
|
||||||
createLedgerResponse(request, fixtures.ledger.withPartialPayment));
|
createLedgerResponse(request, fixtures.ledger.withPartialPayment));
|
||||||
} else if (request.ledger_index === 100001) {
|
} else if (request.ledger_index === 100001) {
|
||||||
@@ -266,8 +267,12 @@ module.exports = function createMockRippled(port) {
|
|||||||
const response = _.assign({}, fixtures.ledger.normal,
|
const response = _.assign({}, fixtures.ledger.normal,
|
||||||
{ result: { ledger: fullLedger } });
|
{ result: { ledger: fullLedger } });
|
||||||
conn.send(createLedgerResponse(request, response));
|
conn.send(createLedgerResponse(request, response));
|
||||||
} else {
|
} else if (request.ledger_index === 'validated' ||
|
||||||
|
request.ledger_index === 14661789 ||
|
||||||
|
request.ledger_index === 14661788 /* getTransaction - order */) {
|
||||||
conn.send(createLedgerResponse(request, fixtures.ledger.normal));
|
conn.send(createLedgerResponse(request, fixtures.ledger.normal));
|
||||||
|
} else {
|
||||||
|
assert(false, 'Unrecognized ledger request: ' + JSON.stringify(request));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user