@iexec/web3telegram
Version:
Enables secure, blockchain-based messaging by encrypting Telegram user IDs for privacy. It lets users message Ethereum account holders without knowing their Telegram details.
29 lines (24 loc) • 665 B
text/typescript
import { PublishedWorkerpoolorder } from 'iexec/IExecOrderbookModule';
export function filterWorkerpoolOrders({
workerpoolOrders,
workerpoolMaxPrice,
}: {
workerpoolOrders: PublishedWorkerpoolorder[];
workerpoolMaxPrice: number;
}) {
if (workerpoolOrders.length === 0) {
return null;
}
const eligibleWorkerpoolOrders = [...workerpoolOrders];
const [cheapestOrder] = eligibleWorkerpoolOrders.sort(
(order1, order2) =>
order1.order.workerpoolprice - order2.order.workerpoolprice
);
if (
!cheapestOrder ||
cheapestOrder.order.workerpoolprice > workerpoolMaxPrice
) {
return null;
}
return cheapestOrder.order;
}