Open leofisG opened 3 years ago
It turns out that it's an error on my end. So basically the above error is caused by the clientId
argument should be a BN
instead of a number
.
Furthermore, client Id of 0
gets ignored. And it will reports InstructionError(0, Custom(16778880))
. So I think the order must have a non-zero client id for it to be able to get cancelled.
If the user supplies an id that doesn't exist in the open order, say the order book only has an order with client id 22
, but the client tries to cancel 23
it will throw an InstructionError(0, Custom(41))
corresponding to ClientIdNotFound
(here).
Also, I think this error only get thrown if there are no (whether cancelled or not) orders from the given OpenOrdersAccount
.
So say, I used to have an order with client Id, say, 22
but it got cancelled. If I want to cancel it again, it will not throw Custom(41)
error.
Actually not sure if we want to support 0
as a valid client id, maybe easier to understand if 0
can also work instead of producing an error....
Or at least output an error on the client side say something like it should be non-zero.
And it's telling me:
If it's due to the error on my side, it will be really appreciated if someone can provide a working example. Many thanks~