From 459069710f6b151f6f37d3e3c6654cf6a802c1d3 Mon Sep 17 00:00:00 2001 From: Alan Cohen Date: Fri, 20 Feb 2015 10:16:40 -0800 Subject: [PATCH 1/2] [DOC] REST: Add `source_amount_submitted` to payment object --- content/ripplerest_api.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/ripplerest_api.md b/content/ripplerest_api.md index c169598d6f..4b95a49988 100644 --- a/content/ripplerest_api.md +++ b/content/ripplerest_api.md @@ -442,15 +442,13 @@ Submitted transactions can have additional fields reflecting the current status | Field | Type | Description | |-------|------|-------------| | direction | String | The direction of the payment relative to the account from the URL, either `"outgoing"` (sent by the account in the URL) or `"incoming"` (received by the account in the URL) | -| state | String | The current status of the payment in transaction processing. A value of `"validated"` indicates that the transaction is finalized. | | result | String | The [Ripple transaction status code](https://wiki.ripple.com/Transaction_errors) for the transaction. A value of `"tesSUCCESS"` indicates a successful transaction. | -| ledger | String | The sequence number of the ledger version that includes this transaction. | -| hash | String | A hash value that uniquely identifies this transaction in the Ripple network. | | timestamp | String | The time the ledger containing this transaction was validated, as a [ISO8601 extended format](http://en.wikipedia.org/wiki/ISO_8601) string in the form `YYYY-MM-DDTHH:mm:ss.sssZ`. | | fee | String (Quoted decimal) | The amount of XRP charged as a transaction fee. | | source_balance_changes | Array | Array of [Amount objects](#amount_object) indicating changes in balances held by the account sending the transaction as a result of the transaction. | | destination_balance_changes | Array | Array of [Amount objects](#amount_object) indicating changes in balances held by the account receiving the transaction as a result of the transaction. | | order\_changes | Array | Array of [Amount objects](#amount_object) indicating changes to orders caused by the Payment. | +| source_amount_submitted | Object | An [Amount object](#amount_object) indicating the source amount submitted (useful when `payment.partial_payment` flag is set to *true* | ### Memo Objects ### From 9dab148a24e9d09eddbbb0faf89b370f237de7e0 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Wed, 25 Feb 2015 21:10:27 -0800 Subject: [PATCH 2/2] [DOC] historical db - updates for prod --- content/historical_data.md | 150 +++++++++++++++---------------------- 1 file changed, 60 insertions(+), 90 deletions(-) diff --git a/content/historical_data.md b/content/historical_data.md index bf0439eb47..a57752e79a 100644 --- a/content/historical_data.md +++ b/content/historical_data.md @@ -17,7 +17,8 @@ The `rippled` Historical Database provides a REST API, with the following method * [Get Transaction By Account and Sequence - `GET /v1/accounts/{:address}/transactions/{:sequence}`](#get-transaction-by-account-and-sequence) * [Get Ledger - `GET /v1/ledgers/{:ledger_identifier}`](#get-ledger) * [Get Transaction - `GET /v1/transactions/{:hash}`](#get-transaction) -* [Get Exchanges - `/v1/exchanges/{:base}/{:counter}`](#get-exchanges) + + # API Objects # @@ -47,7 +48,21 @@ Transactions have two formats - a compact "binary" format where the defining fie ## Ledger Objects ## -TODO +A "ledger" is one block of the shared global ledger. Each ledger object has the following fields: + +| Field | Value | Description | +|--------------|-------|-------------| +| ledger_hash | String - Transaction Hash | An identifying hash unique to this ledger, as a hex string. | +| ledger_index | Number (Unsigned Integer) - Ledger Index | The sequence number of the ledger. Each new ledger has a ledger index 1 higher than the ledger that came before it. | +| parent_hash | String - Transaction Hash | The identifying hash of the previous ledger. | +| total_coins | Unsigned Integer | The total number of drops of XRP still in existence at the time of the ledger. (Each "drop" is 100,000 XRP.) | +| close\_time\_res | Number | Approximate number of seconds between closing one ledger version and closing the next one. | +| accounts\_hash | String - Hash | Hash of the account information contained in this ledger, as hex. | +| transactions\_hash | String - Hash | Hash of the transaction information contained in this ledger, as hex. | +| close_time | Unsigned Integer - UNIX time | The time at which this ledger was closed. | +| close\_time\_human | String - IS0 8601 UTC Timestamp | The time at which this ledger was closed. | + + # API Reference # @@ -105,7 +120,7 @@ A successful response uses the HTTP code **200 OK** and has a JSON body with the Request: ``` -GET http://history.ripple.com/v1/accounts/r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59/transactions?limit=2&type=OfferCreate +GET /v1/accounts/r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59/transactions?limit=2&type=OfferCreate ``` Response: @@ -564,7 +579,7 @@ Response: ## Get Transaction By Account and Sequence ## [[Source]
](https://github.com/ripple/rippled-historical-database/blob/develop/api/routes/accountTxSeq.js "Source") -Retrieve a specific transaction, by account and sequence number. (Not deployed yet.) +Retrieve a specific transaction, by account and sequence number. #### Request Format #### @@ -615,6 +630,9 @@ Response: { "result": "success", "transaction": { + "hash": "F8E33A40A481F037BA788231421737AF2AD13161928B15A14F6ABC5007D6A2B7", + "ledger_index": 8317030, + "date": "2014-08-14T20:21:40+00:00", "tx": { "TransactionType": "OfferCreate", "Flags": 0, @@ -629,11 +647,7 @@ Response: "Fee": "20", "SigningPubKey": "0382A086DB113581E08E439546156D7F34B68F11D70914B65F63A98A36AF9845DC", "TxnSignature": "3045022100AB584255CDA4500BD82B5EA7CBB5ABB706DF657976F79187985209DDEB05C6290220365B67073797D3D4265B6E28ACC7DB7CE4EF3DF9DDB9B62ABE8078F0BF039414", - "Account": "rJnZ4YHCUsHvQu7R6mZohevKJDHFzVD6Zr", - "hash": "F8E33A40A481F037BA788231421737AF2AD13161928B15A14F6ABC5007D6A2B7", - "ledger_index": 8317030, - "executed_time": 1408047700, - "date": 461362900 + "Account": "rJnZ4YHCUsHvQu7R6mZohevKJDHFzVD6Zr" }, "meta": { "TransactionIndex": 7, @@ -690,8 +704,8 @@ Response: }, "FinalFields": { "Flags": 131072, - "LowNode": "43", - "HighNode": "0", + "LowNode": "0000000000000043", + "HighNode": "0000000000000000", "Balance": { "value": "-0.000000007322616", "currency": "BTC", @@ -727,8 +741,8 @@ Response: "FinalFields": { "Flags": 131072, "Sequence": 1404, - "BookNode": "0", - "OwnerNode": "0", + "BookNode": "0000000000000000", + "OwnerNode": "0000000000000000", "BookDirectory": "7B73A610A009249B0CC0D4311E8BA7927B5A34D86634581C5F211CEE1E0697A0", "TakerPays": "182677152", "TakerGets": { @@ -755,8 +769,8 @@ Response: }, "FinalFields": { "Flags": 2228224, - "LowNode": "230", - "HighNode": "0", + "LowNode": "0000000000000230", + "HighNode": "0000000000000000", "Balance": { "value": "-8.849596279263425", "currency": "BTC", @@ -786,8 +800,6 @@ Response: ## Get Ledger ## [[Source]
](https://github.com/ripple/rippled-historical-database/blob/6e4d601d18e60582754c8e0bde592d888cae5efc/api/routes/getLedger.js "Source") -(Not deployed yet.) - Retrieve a specific ledger version. #### Request Format #### @@ -835,15 +847,28 @@ GET /v1/ledgers/3170DA37CE2B7F045F889594CBC323D88686D2E90E8FFD2BBCD9BAD12E416DB5 Response: -```js - +``` +200 OK +{ + "result": "success", + "ledger": { + "ledger_hash": "3170da37ce2b7f045f889594cbc323d88686d2e90e8ffd2bbcd9bad12e416db5", + "ledger_index": 8317037, + "parent_hash": "aff6e04f07f441abc6b4133f8c50c65935b817a85b895f06dba098b3fbc1be90", + "total_coins": 99999980165594400, + "close_time_res": 10, + "accounts_hash": "8ad73e49a34d8b9c31bc13b8a97c56981e45ee70225ef4892e8b198fec5a1f7d", + "transactions_hash": "33e0b9c5fd7766343e67854aed4222f5ed9c9507e0ec0d7ae7d54d0f17adb98e", + "close_time": 1408047740, + "close_time_human": "2014-08-14T20:22:20+00:00" + } +} ``` + ## Get Transaction ## [[Source]
](https://github.com/ripple/rippled-historical-database/blob/24595d37551687aa65209369377d15a803ac8f73/api/routes/getTx.js "Source") -(Not deployed yet.) - Retrieve a specific transaction by its identifying hash. #### Request Format #### @@ -879,7 +904,6 @@ A successful response uses the HTTP code **200 OK** and has a JSON body with the | result | `success` | Indicates that the body represents a successful response. | | transaction | [Transaction object](#transaction-objects) | The requested transaction | - #### Example #### Request: @@ -895,6 +919,9 @@ Response: { "result": "success", "transaction": { + "ledger_index": 8317037, + "date": "2014-08-14T20:22:20+00:00", + "hash": "03EDF724397D2DEE70E49D512AECD619E9EA536BE6CFD48ED167AE2596055C9A", "tx": { "TransactionType": "OfferCreate", "Flags": 131072, @@ -908,11 +935,7 @@ Response: "Fee": "64", "SigningPubKey": "02279DDA900BC53575FC5DFA217113A5B21C1ACB2BB2AEFDD60EA478A074E9E264", "TxnSignature": "3045022100D81FFECC36A3DEF0922EB5D16F1AA5AA0804C30A18ED3B512093A75E87C81AD602206B221E22A4E3158785C109E7508624AD3DE5C0E06108D34FA709FCC9575C9441", - "Account": "r2d2iZiCcJmNL6vhUGFjs8U8BuUq6BnmT", - "hash": "03EDF724397D2DEE70E49D512AECD619E9EA536BE6CFD48ED167AE2596055C9A", - "ledger_index": 8317037, - "executed_time": 1408047740, - "date": 461362940 + "Account": "r2d2iZiCcJmNL6vhUGFjs8U8BuUq6BnmT" }, "meta": { "TransactionIndex": 0, @@ -973,8 +996,8 @@ Response: "Flags": 0, "Sequence": 326320, "Expiration": 461364125, - "BookNode": "0", - "OwnerNode": "3", + "BookNode": "0000000000000000", + "OwnerNode": "0000000000000003", "BookDirectory": "7B73A610A009249B0CC0D4311E8BA7927B5A34D86634581C5F212B4AE944DDE4", "TakerPays": "7869978846", "TakerGets": { @@ -1001,8 +1024,8 @@ Response: }, "FinalFields": { "Flags": 2228224, - "LowNode": "221", - "HighNode": "0", + "LowNode": "0000000000000221", + "HighNode": "0000000000000000", "Balance": { "value": "-2.253363366782792", "currency": "BTC", @@ -1036,8 +1059,8 @@ Response: }, "FinalFields": { "Flags": 131072, - "LowNode": "43", - "HighNode": "0", + "LowNode": "0000000000000043", + "HighNode": "0000000000000000", "Balance": { "value": "0", "currency": "BTC", @@ -1087,8 +1110,8 @@ Response: "Flags": 131072, "Sequence": 1404, "PreviousTxnLgrSeq": 8317030, - "BookNode": "0", - "OwnerNode": "0", + "BookNode": "0000000000000000", + "OwnerNode": "0000000000000000", "PreviousTxnID": "F8E33A40A481F037BA788231421737AF2AD13161928B15A14F6ABC5007D6A2B7", "BookDirectory": "7B73A610A009249B0CC0D4311E8BA7927B5A34D86634581C5F211CEE1E0697A0", "TakerPays": "182676470", @@ -1135,8 +1158,8 @@ Response: }, "FinalFields": { "Flags": 1114112, - "LowNode": "0", - "HighNode": "233", + "LowNode": "0000000000000000", + "HighNode": "0000000000000233", "Balance": { "value": "0.001567373", "currency": "BTC", @@ -1173,58 +1196,5 @@ Response: } ``` -## Get Exchanges ## -[[Source]
](https://github.com/ripple/rippled-historical-database/tree/develop/api/routes "Source") - -(Not yet implemented; no source link.) - -Retrieve currency exchanges by the currency and issuer. (Currency exchanges occur whenever an Offer in the ledger is partially or fully consumed by a matching [OfferCreate](transactions.html#offercreate) or [Payment](transactions.html#payment) transaction.) - -#### Request Format #### - -
- -*REST* - -``` -/v1/exchanges/{:base}/{:counter} -``` - -
-The following URL parameters are required by this API endpoint: - -| Field | Value | Description | -|-------|-------|-------------| -| base | String (currency and issuer) | One currency of the exchange, formatted as a currency code (a 3-letter [ISO 4217](http://www.xe.com/iso4217.php/) code or a 160-bit hex code), followed by a `.`, followed by the currency issuer's Ripple address | -| counter | String (currency and issuer) | (Optional) The other currency of the exchange, in the same format as the `base`. - -Optionally, you can also include the following query parameters: - -| Field | Value | Description | -|-------|-------|-------------| -| (TBD) | | | - -#### Response Format #### - -(Subject to change) - -| Field | Value | Description | -|-------|-------|-------------| -| time | ISO 8601 UTC timestamp (YYYY-MM-DDThh:mmZ) | The time the exchange occurred. | -| price | String (decimal number) | The exchange rate, as the ratio base:counter. | -| base_amount | Amount | The amount of the base currency exchanged. | -| counter_amount | Amount | -| buyer | String (Address) | The Ripple address of the account that received the base currency. | -| seller | String (Address) | The Ripple address of the account that received the counter currency. | -| taker | String (Address) | The Ripple address of the account that completed the exchange. This is the same as either the `buyer` or the `seller`. | -| tx_hash | String (Transaction Hash) | The identifying hash of the transaction where this exchange occurred. | - -**Note:** One transaction can cause multiple exchanges. For example, an OfferCreate could consume the most favorable exchange in the order book and part of the following offer. - -#### Example #### - -```js - -```