This commit is contained in:
Riordan Panayides 2023-06-23 15:30:59 +01:00
parent 13c2636e00
commit 61dfa18277
2 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@blockworks-foundation/mango-feeds",
"version": "0.1.6",
"version": "0.1.7",
"description": "Typescript Client for mango-feeds.",
"repository": "https://github.com/blockworks-foundation/mango-feeds",
"author": {

View File

@ -61,15 +61,29 @@ interface OrderbookL3Checkpoint {
}
function isOrderbookL2Checkpoint(obj: any): obj is OrderbookL2Checkpoint {
return obj.bids !== undefined && obj.asks !== undefined && obj.bids.every((bid: any) => bid.length() == 2) && obj.asks.every((ask: any) => ask.length() == 2);
return (
obj.bids !== undefined &&
obj.asks !== undefined &&
obj.bids.every((bid: any) => bid.length() == 2) &&
obj.asks.every((ask: any) => ask.length() == 2)
);
}
function isOrderbookL3Checkpoint(obj: any): obj is OrderbookL3Checkpoint {
return obj.bids !== undefined && obj.asks !== undefined && obj.bids.every((order: any) => isOrder(order)) && obj.asks.every((order: any) => isOrder(order));
return (
obj.bids !== undefined &&
obj.asks !== undefined &&
obj.bids.every((order: any) => isOrder(order)) &&
obj.asks.every((order: any) => isOrder(order))
);
}
function isOrder(obj: any): obj is Order {
return obj.price !== undefined && obj.quantity !== undefined && obj.ownerPubkey !== undefined;
return (
obj.price !== undefined &&
obj.quantity !== undefined &&
obj.ownerPubkey !== undefined
);
}
export class OrderbookFeed extends ReconnectingWebsocketFeed {