Skip to content

Best method to detect when a placed offer is partially and/or fully filled? #2529

Answered by mvadari
ShaunLaFleur asked this question in Q&A
Discussion options

You must be logged in to vote

The ledger stream data is just useful for telling you when a ledger has closed, so you can requery the ledger object. Here's some code (I didn't actually run this, just an example):

client.on("ledgerClosed", (ledger) => {
  const data = await client.request({command: "ledger_entry", index: "<fill in the offer's ID>"})
  // if the object doesn't exist then it was deleted and you can take a closer look at the transactions
  // if the object does exist, take a look at the `PreviousTxnID` and `PreviousTxnLgrSeq` values to see what transaction/ledger last modified it
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ShaunLaFleur
Comment options

@mvadari
Comment options

Answer selected by ShaunLaFleur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants