diff --git a/content/code_samples/escrow/websocket/account_objects-request-receiver.json b/content/code_samples/escrow/websocket/account_objects-request-receiver.json new file mode 100644 index 0000000000..609b7c745f --- /dev/null +++ b/content/code_samples/escrow/websocket/account_objects-request-receiver.json @@ -0,0 +1,7 @@ +{ + "id": 5, + "command": "account_objects", + "account": "rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "ledger_index": "validated", + "type": "escrow" +} diff --git a/content/code_samples/escrow/websocket/account_objects-request-sender.json b/content/code_samples/escrow/websocket/account_objects-request-sender.json index 5249ee088a..74f8ff3e1c 100644 --- a/content/code_samples/escrow/websocket/account_objects-request-sender.json +++ b/content/code_samples/escrow/websocket/account_objects-request-sender.json @@ -1,7 +1,7 @@ { "id": 5, "command": "account_objects", - "account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB", + "account": "r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", "ledger_index": "validated", "type": "escrow" } diff --git a/content/code_samples/escrow/websocket/account_objects-response-receiver.json b/content/code_samples/escrow/websocket/account_objects-response-receiver.json new file mode 100644 index 0000000000..b718a9a679 --- /dev/null +++ b/content/code_samples/escrow/websocket/account_objects-response-receiver.json @@ -0,0 +1,39 @@ +{ + "id":5, + "result":{ + "account":"rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "account_objects":[ + { + "Account":"r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", + "Amount":"2500", + "Destination":"rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "DestinationNode":"0000000000000000", + "FinishAfter":570672000, + "Flags":0, + "LedgerEntryType":"Escrow", + "OwnerNode":"0000000000000000", + "PreviousTxnID":"F403A36E7A05898C68ADF5DC788FC69AF15C34DD84B6AB5345A34320D2BB5489", + "PreviousTxnLgrSeq":4570102, + "index":"07CFC2B7D9B7E8484B39403D00A851E2FD556CEE410EB682D1E9C912CF4ED6FB" + }, + { + "Account":"rnYL8VxgjkasX9NgM5SeMwgnykpRLw2u2v", + "Amount":"2500", + "Destination":"rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "DestinationNode":"0000000000000000", + "FinishAfter":570672000, + "Flags":0, + "LedgerEntryType":"Escrow", + "OwnerNode":"0000000000000000", + "PreviousTxnID":"2FD4FBF8A4BC65936C2DF1259FAA28BD79E4E0FA89612495B006E9BA7FB28971", + "PreviousTxnLgrSeq":4570913, + "index":"098ECEC65981434E549FC2A47620BBC1CFB9AA8D7DA385538C019B3DFE534B88" + } + ], + "ledger_hash":"AF0DB9E937976ECEE2215D9B77C21076A3E1045836102AB682864EF2F8030A22", + "ledger_index":4571007, + "validated":true + }, + "status":"success", + "type":"response" +} diff --git a/content/code_samples/escrow/websocket/account_objects-response-sender.json b/content/code_samples/escrow/websocket/account_objects-response-sender.json index 5b39fac1b4..5ddff9ffbe 100644 --- a/content/code_samples/escrow/websocket/account_objects-response-sender.json +++ b/content/code_samples/escrow/websocket/account_objects-response-sender.json @@ -1,26 +1,48 @@ { "id": 5, - "status": "success", - "type": "response", "result": { - "account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB", - "account_objects": [ - { - "Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB", - "Amount": "100000", - "CancelAfter": 556927412, - "Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120", - "Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", - "Flags": 0, - "LedgerEntryType": "Escrow", - "OwnerNode": "0000000000000000", - "PreviousTxnID": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324", - "PreviousTxnLgrSeq": 1772019, - "index": "E2CF730A31FD419382350C9DBD8DB7CD775BA5AA9B97A9BE9AB07304AA217A75" - } - ], - "ledger_hash": "F2ABEA175F4AB871845B01CB51E4324DBA2C2553EC34448D4AB1EB0A3F2D8EFB", - "ledger_index": 1772020, + "account": "r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", + "account_objects": [{ + "Account": "r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", + "Amount": "2500", + "Destination": "rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "DestinationNode": "0000000000000000", + "FinishAfter": 570672000, + "Flags": 0, + "LedgerEntryType": "Escrow", + "OwnerNode": "0000000000000000", + "PreviousTxnID": "F403A36E7A05898C68ADF5DC788FC69AF15C34DD84B6AB5345A34320D2BB5489", + "PreviousTxnLgrSeq": 4570102, + "index": "07CFC2B7D9B7E8484B39403D00A851E2FD556CEE410EB682D1E9C912CF4ED6FB" + }, { + "Account": "r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", + "Amount": "2500", + "Destination": "rLwsbsEHu3yWn6FBEfXz6B7iwZmxMeY9H7", + "DestinationNode": "0000000000000000", + "FinishAfter": 570672000, + "Flags": 0, + "LedgerEntryType": "Escrow", + "OwnerNode": "0000000000000000", + "PreviousTxnID": "56780536AC1B85029143634416434CAE374213732FDBB284574F2CD8B826A868", + "PreviousTxnLgrSeq": 4570083, + "index": "250AF3071E37089C920832BBF56E66BAA0940F698F48418A9D65D9970C555EE9" + }, { + "Account": "r9yALWi9X6Hz2pQxeXcDbBazvsqEBsukgG", + "Amount": "250", + "Destination": "rLpLGbSaUwEp6RgLCkjBGTHupfKJMkUjiw", + "DestinationNode": "0000000000000000", + "FinishAfter": 570672000, + "Flags": 0, + "LedgerEntryType": "Escrow", + "OwnerNode": "0000000000000000", + "PreviousTxnID": "E6F60C460D768E4C833C14B89168929AAA538374BE5720B9112530AE04E651A5", + "PreviousTxnLgrSeq": 4570975, + "index": "4720F356A6F6A0C3A62D3E3AD72DF05AF45458D3124998D2BFE1CB085E55E302" + }], + "ledger_hash": "007E15650382AC1B1482FF245FC52080C5379E278A92169C50BAD3608A16123E", + "ledger_index": 4570985, "validated": true - } + }, + "status": "success", + "type": "response" } diff --git a/content/tutorial-escrow.md b/content/tutorial-escrow.md index f73a259323..be879072c9 100644 --- a/content/tutorial-escrow.md +++ b/content/tutorial-escrow.md @@ -5,7 +5,7 @@ The XRP Ledger supports held payments, or _escrows_, that can be executed only a - [Send a time-held escrow](#send-a-time-held-escrow) - [Send a conditionally-held escrow](#send-a-conditionally-held-escrow) - [Cancel an expired escrow](#cancel-an-expired-escrow) -- [Look up escrows by sender](#look-up-escrows-by-sender) +- [Look up escrows](#look-up-escrows) @@ -511,9 +511,19 @@ _Websocket_ In the above example, `r3wN3v2vTUkr5qd6daqDc2xE4LSysdVjkT` is the sender of the escrow, and the increase in `Balance` from 99999**8**9990 drops to 99999**9**9990 drops represents the return of the escrowed 10,000 drops of XRP (0.01 XRP). -## Look up escrows by sender +**Tip:** If you don't know what `OfferSequence` to use in the [EscrowFinish transaction][] to execute an escrow, use the [`tx` method](reference-rippled.html) to look up the transaction that created the escrow, using the identifying hash of the transaction in the Escrow's `PreviousTxnID` field. Use the `Sequence` value of that transaction as the `OfferSequence` value when finishing the escrow. -All pending escrows are stored in the ledger as [Escrow objects](reference-ledger-format.html#escrow). You can look up escrow nodes owned by your address using the [`account_objects` method](reference-rippled.html#account-objects). +## Look up escrows + +All pending escrows are stored in the ledger as [Escrow objects](reference-ledger-format.html#escrow). + +You can look up escrow nodes by [sender](#look-up-escrows-by-sender) or [receiver](#look-up-escrows-by-receiver) using the [`account_objects`](reference-rippled.html#account-objects) method. + +###Look up escrows by sender + +You can use the [`account_objects`](reference-rippled.html#account-objects) method to look up escrows by sender. + +The following examples illustrate an escrow lookup by sender. Note that the `account` in the request is the sender `Account` of the escrow `account_objects` returned in the response. Request: @@ -539,6 +549,36 @@ _Websocket_ -**Tip:** If you don't know what `OfferSequence` to use in the [EscrowFinish transaction][] to execute an escrow, use the [`tx` method](reference-rippled.html) to look up the transaction that created the escrow, using the identifying hash of the transaction in the Escrow's `PreviousTxnID` field. Use the `Sequence` value of that transaction as the `OfferSequence` value when finishing the escrow. +###Look up escrows by receiver + +You can use the [`account_objects`](reference-rippled.html#account-objects) method to look up escrows by receiver address. + +Look up by receiver is possible for only pending escrows created after [fix1523](concept-amendments.html#fix1523) was enabled for rippled 0.80.0 on 2017-11-14. + +The following examples illustrate an escrow lookup by receiver. Note that the `account` in the request is the receiver `Destination` of the escrow `account_objects` returned in the response. + +Request: + + + +_Websocket_ + +```json +{% include 'code_samples/escrow/websocket/account_objects-request-receiver.json' %} +``` + + + +Response: + + + +_Websocket_ + +```json +{% include 'code_samples/escrow/websocket/account_objects-response-receiver.json' %} +``` + + {% include 'snippets/tx-type-links.md' %}