fix: Use getUserAccount().orders instead of non-existent getOpenOrders()

This commit is contained in:
mindesbunister
2025-12-13 17:39:43 +01:00
parent 05089bb43e
commit c5b27ad802

View File

@@ -29,13 +29,18 @@ async function discoverExistingOrders(symbol: string, marketIndex: number): Prom
const driftService = getDriftService()
const driftClient = driftService.getClient()
// Get all open orders for this user
const orders = driftClient.getOpenOrders()
// Get user account and extract orders
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
const marketOrders = orders.filter(order =>
const marketOrders = userAccount.orders.filter((order: any) =>
order.marketIndex === marketIndex &&
order.reduceOnly === true
order.reduceOnly === true &&
order.orderId && order.orderId !== 0
)
const signatures: any = {}