Open wiseaidev opened 4 months ago
Sorry for the late reply, but these are two different fields. client_order_id
is assigned by you and you can make it whatever you want (sequence number and timestamp are common). order_id
is assigned by the program and it's not possible in all cases to know it before you submit your order. Hope this helps!
Hello!
To generate order ids, we can utilize the built-in
gen_order_id
utility function: https://github.com/openbook-dex/openbook-v2/blob/b954445f532ee1b54fb404139ba3617ec12eb636/programs/openbook-v2/src/state/market.rs#L188But the returned
order_id
type is u128, and when placing a new limit order, it is taking au64
as order id type param: https://github.com/openbook-dex/openbook-v2/blob/b954445f532ee1b54fb404139ba3617ec12eb636/lib/client/src/client.rs#L388Using the above function and downcasting the value to u64 can cause an overflow and returning the same order id each time a limit order is placed. Therefore, I suggest to either make the order id type u128, or make the
gen_order_id
function return a u64 id to match the order id type when placing, cancelling, etc orders.Best!