fix: Use getUserAccount().orders instead of non-existent getOpenOrders()
This commit is contained in:
@@ -29,13 +29,18 @@ async function discoverExistingOrders(symbol: string, marketIndex: number): Prom
|
|||||||
const driftService = getDriftService()
|
const driftService = getDriftService()
|
||||||
const driftClient = driftService.getClient()
|
const driftClient = driftService.getClient()
|
||||||
|
|
||||||
// Get all open orders for this user
|
// Get user account and extract orders
|
||||||
const orders = driftClient.getOpenOrders()
|
const userAccount = driftClient.getUserAccount()
|
||||||
|
if (!userAccount) {
|
||||||
|
console.log('⚠️ No user account found, cannot discover orders')
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
// Filter for orders on this market that are reduce-only
|
// Filter for orders on this market that are reduce-only
|
||||||
const marketOrders = orders.filter(order =>
|
const marketOrders = userAccount.orders.filter((order: any) =>
|
||||||
order.marketIndex === marketIndex &&
|
order.marketIndex === marketIndex &&
|
||||||
order.reduceOnly === true
|
order.reduceOnly === true &&
|
||||||
|
order.orderId && order.orderId !== 0
|
||||||
)
|
)
|
||||||
|
|
||||||
const signatures: any = {}
|
const signatures: any = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user