-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! refactor(experimental): add
getBlockProduction
API
- Loading branch information
1 parent
18f642a
commit 2c5352c
Showing
3 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
import { Base58EncodedAddress } from '@solana/keys'; | ||
import { Commitment, RpcResponse, U64UnsafeBeyond2Pow53Minus1 } from './common'; | ||
|
||
type NumberOfLeaderSlots = number; | ||
type NumberOfBlocksProduced = number; | ||
type NumberOfLeaderSlots = U64UnsafeBeyond2Pow53Minus1; | ||
type NumberOfBlocksProduced = U64UnsafeBeyond2Pow53Minus1; | ||
|
||
type Range = Readonly<{ | ||
type SlotRange = Readonly<{ | ||
firstSlot: U64UnsafeBeyond2Pow53Minus1; | ||
lastSlot: U64UnsafeBeyond2Pow53Minus1; | ||
}>; | ||
|
||
type GetBlockProductionApiResponse = RpcResponse<{ | ||
byIdentity: Readonly<{ | ||
[address: string]: [NumberOfLeaderSlots, NumberOfBlocksProduced]; | ||
type GetBlockProductionApiResponseBase = RpcResponse<{ | ||
range: SlotRange; | ||
}>; | ||
|
||
type GetBlockProductionApiResponseWithAllIdentities = Readonly<{ | ||
value: Readonly<{ | ||
byIdentity: Record<Base58EncodedAddress, [NumberOfLeaderSlots, NumberOfBlocksProduced]>; | ||
}>; | ||
}>; | ||
|
||
type GetBlockProductionApiResponseWithSingleIdentity<TIdentity extends string> = Readonly<{ | ||
value: Readonly<{ | ||
byIdentity: { [TAddress in TIdentity]?: [NumberOfLeaderSlots, NumberOfBlocksProduced] }; | ||
}>; | ||
range: Range; | ||
}>; | ||
|
||
export interface GetBlockProductionApi { | ||
/** | ||
* Returns recent block production information from the current or previous epoch. | ||
*/ | ||
getBlockProduction( | ||
config: Readonly<{ | ||
commitment?: Commitment; | ||
identity: Base58EncodedAddress; | ||
range?: SlotRange; | ||
}> | ||
): GetBlockProductionApiResponseBase & GetBlockProductionApiResponseWithSingleIdentity<typeof config.identity>; | ||
|
||
getBlockProduction( | ||
config?: Readonly<{ | ||
commitment?: Commitment; | ||
identity?: Base58EncodedAddress; | ||
range?: Range; | ||
identity: undefined; | ||
range?: SlotRange; | ||
}> | ||
): GetBlockProductionApiResponse; | ||
): GetBlockProductionApiResponseBase & GetBlockProductionApiResponseWithAllIdentities; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.