Support order ID linking after order placement in a public entry context
alnoki opened this issue · comments
Currently, if someone places a limit order from the Python SDK in a public entry context there is no immediate feedback providing them with the order ID of the order they just submitted. For them to get this info:
- Before placing a trade call the view function to get active market order IDs, then place trade, then call the view function again and get the diff (but note this only works for orders that post)
- Alternatively just call the relevant event handle and check the order ID described in the last emitted event (the events endpoint accepts an int saying how many events to return, it would be ideal if passing “1” just returned the most recent one)
This does mean that orders need to be serialized, for example submit three orders then get the last 3 events emitted
Some alternative solutions
- Allow client to provide a client order ID, and if the transaction succeeds, they will know the assigned order ID
- Store data on user account with a list of order IDs, for example, in the order that they were submitted, to be queried by a view function
Noting here that txn events can be used to link txn hash with order ID