econia-labs / econia

Hyper-parallelized on-chain order book for the Aptos blockchain

Home Page:https://econia.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support order ID linking after order placement in a public entry context

alnoki opened this issue · comments

commented

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
commented

Noting here that txn events can be used to link txn hash with order ID