Files
server/order.js
2023-11-06 23:49:08 -04:00

24 lines
739 B
JavaScript

import {redis, vaultOpenOrders} from "./cache.js";
export function subVaultOrders( socket, chainId, vault ) {
vaultOpenOrders.get(chainId, vault).then(async (orderIndexes)=>{
for( const orderIndex of JSON.parse(orderIndexes) ) {
// there is a race condition here since we need multiple queries to get the complete order status,
// so we diligently check for nulls and exclude such an order, since it was deleted and no longer active.
const status = orderStatus( chainId, vault, orderIndex )
if( status != null ) {
}
}
})
}
export function unsubVaultOrders( socket, chainId, vault ) {
}
export function orderStatus( chainId, vault, orderIndex ) {
}