Market loadOrdersForOwner function breaks
Closed this issue · 3 comments
I'm trying to get the orders of a wallet that I'm connected to with a wallet adapter, but when calling the loadOrdersForOwner function, it gets stuck on the following error:
Error while getting orders: Error: Invalid public key input
at new PublicKey (index.browser.esm.js?156f:151:1)
at eval (market.js?8329:403:1)
at Array.filter ()
at Market.filterForOpenOrdersFromSlab (market.js?8329:403:1)
at Market.filterForOpenOrders (market.js?8329:422:1)
at Market.loadOrdersForOwner
I investigated where that happens, and it seems that in the functions called inside loadOrdersForOwner get to the calling of filterForOpenOrdersFromSlab where it breaks on the following line:
return [...slab]
.filter((o) => openOrders?.address.equals(new PublicKey(o.callbackInfo))) //(market.ts, line 710)
So basically what I suspect is happening is that the callbackInfo from slab objects is not a good input for generating a public key. I tested it with just getting the bids and trying to map their callback info to public keys, and it does indeed break.
Did I do something wrong when creating the market that causes this issue, or is it something else?
Market address:
wUYvayJxdPwXRFuf7E8y9LVSHuVkXhbZWNEbcE2DgTJ
wallet in question's public key:
DrkEjikTWi6VzeLykTaduG9hdXerjiZBMSrhEgb7mX4c
Everything is on devnet.
Thanks! Is the PR going through soon? And will it have a version bump for npm?
This should be good now. Thanks for your contribution!