packages/core/src/api/getBlockByTimestamp.ts
import {BaseService} from '../service/baseService';
import {Block} from '../model/block';
/**
* Get a block by given timestamp
* @param timestamp The block timestamp is the timestamp in seconds since the genesis block
* @param includeTransactions _true_, if transactions shall be included
* @return The Block
*/
export const getBlockByTimestamp = (service: BaseService): (number, boolean) => Promise<Block> =>
(timestamp: number, includeTransactions: boolean): Promise<Block> =>
service.query('getBlock', {
timestamp,
includeTransactions
});