-
Notifications
You must be signed in to change notification settings - Fork 953
/
Copy pathgetBlockProduction.ts
48 lines (40 loc) · 1.55 KB
/
getBlockProduction.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
40
41
42
43
44
45
46
47
48
import { Base58EncodedAddress } from '@solana/addresses';
import { Commitment } from '../commitment';
import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common';
type NumberOfLeaderSlots = U64UnsafeBeyond2Pow53Minus1;
type NumberOfBlocksProduced = U64UnsafeBeyond2Pow53Minus1;
type SlotRange = Readonly<{
firstSlot: Slot;
lastSlot: Slot;
}>;
type GetBlockProductionApiConfigBase = Readonly<{
commitment?: Commitment;
range?: SlotRange;
}>;
type GetBlockProductionApiResponseBase = RpcResponse<{
range: SlotRange;
}>;
type GetBlockProductionApiResponseWithAllIdentities = Readonly<{
value: Readonly<{
byIdentity: Record<Base58EncodedAddress, [NumberOfLeaderSlots, NumberOfBlocksProduced]>;
}>;
}>;
type GetBlockProductionApiResponseWithSingleIdentity<TIdentity extends string> = Readonly<{
value: Readonly<{
byIdentity: Readonly<{ [TAddress in TIdentity]?: [NumberOfLeaderSlots, NumberOfBlocksProduced] }>;
}>;
}>;
export interface GetBlockProductionApi {
/**
* Returns recent block production information from the current or previous epoch.
*/
getBlockProduction<TIdentity extends Base58EncodedAddress>(
config: GetBlockProductionApiConfigBase &
Readonly<{
identity: TIdentity;
}>
): GetBlockProductionApiResponseBase & GetBlockProductionApiResponseWithSingleIdentity<TIdentity>;
getBlockProduction(
config?: GetBlockProductionApiConfigBase
): GetBlockProductionApiResponseBase & GetBlockProductionApiResponseWithAllIdentities;
}