feat: slot change callback (provides real-time fork information)

This commit is contained in:
Sunny Gleason
2019-11-25 11:04:35 -05:00
committed by Michael Vines
parent ddce1d3c9f
commit 286891fa51
3 changed files with 166 additions and 1 deletions

View File

@ -96,10 +96,17 @@ declare module '@solana/web3.js' {
commission: number,
};
declare export type SlotInfo = {
parent: 'number',
slot: 'number',
root: 'number',
};
declare type AccountChangeCallback = (accountInfo: AccountInfo) => void;
declare type ProgramAccountChangeCallback = (
keyedAccountInfo: KeyedAccountInfo,
) => void;
declare type SlotChangeCallback = (slotInfo: SlotInfo) => void;
declare export type SignatureSuccess = {|
Ok: null,
@ -191,6 +198,7 @@ declare module '@solana/web3.js' {
programId: PublicKey,
callback: ProgramAccountChangeCallback,
): number;
onSlotChange(callback: SlotChangeCallback): number;
removeProgramAccountChangeListener(id: number): Promise<void>;
validatorExit(): Promise<boolean>;
}