/
lookupBlock.ts
39 lines (36 loc) · 1.04 KB
/
lookupBlock.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import JSONRequest from '../jsonrequest';
import HTTPClient from '../../client';
import IntDecoding from '../../../types/intDecoding';
export default class LookupBlock extends JSONRequest {
/**
* Returns the block for the passed round.
*
* #### Example
* ```typescript
* const targetBlock = 18309917;
* const blockInfo = await indexerClient.lookupBlock(targetBlock).do();
* ```
*
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2blocksround-number)
* @param round - The number of the round to look up.
* @category GET
*/
constructor(c: HTTPClient, intDecoding: IntDecoding, private round: number) {
super(c, intDecoding);
this.round = round;
}
/**
* @returns `/v2/blocks/${round}`
*/
path() {
return `/v2/blocks/${this.round}`;
}
/**
* Header only flag. When this is set to true, returned block does not contain the
* transactions.
*/
headerOnly(headerOnly: boolean) {
this.query['header-only'] = headerOnly;
return this;
}
}