The SDK should give better feedback when submitted offers are deleted by the network
See original GitHub issueSome offers are deleted immediately after being sent to the network (usually when the amount is very small). The offer transactions succeed without errors, and the transactions are on the network, but the offers don’t appear on the orderbook, and it doesn’t appear when you query an account’s offers.
If you inspect the result_xdr
from the response of StellarServer.submitTransaction
, this monster of a path will be equal to manageOfferDeleted
:
StellarSdk.xdr.TransactionResult.fromXDR(result.result_xdr, 'base64').result().value()[0].value().value().success().offer().switch().name
So the task is to find some way to either educate the users how to do find this out (👎) or to surface it in the sdk (👍 ).
Original issue:
Continuing a conversation from stellar/stellar-protocol#195 (and copying from stellar/js-stellar-base#148, I meant to open here initially), extremely small trades (e.g. 0.0000001 XLM) appear to submit successfully, but actually are never placed on the orderbook.
Per this comment it seems that it should be possible to determine when this has happened from the returned XDR, but that seems awfully close to the protocol for a web app to be dealing with.
I believe it would be more appropriate for SDK itself (or Horizon, alternatively) to return an error in this circumstance.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
OK, reasons why not to reject
submitTransaction
in such cases are here: https://github.com/stellar/js-stellar-sdk/pull/243#discussion_r263143220. Let’s look how a discussion in https://github.com/stellar/stellar-protocol/issues/195#issuecomment-470298587 unfolds. Seems like failing the transaction at the protocol level is the best option.As a sidenote, I think we really need to support XDR->JSON conversion in
js-xdr
. Checkingtx_result
using the currentjs-xdr
API is not easy.It seems that inevitably, clients will have to check transaction responses to be sure of failures, so I added documentation to that effect. I think that’s the best we can do right now.