feat: add onSignature pub sub api

This commit is contained in:
Justin Starry
2020-02-03 23:22:11 +08:00
committed by Michael Vines
parent 7ebf82b19d
commit 740b7a3b23
3 changed files with 159 additions and 17 deletions

View File

@ -58,8 +58,7 @@ declare module '@solana/web3.js' {
declare export type SignatureStatusResult =
| SignatureSuccess
| TransactionError
| null;
| TransactionError;
declare export type BlockhashAndFeeCalculator = {
blockhash: Blockhash,
@ -96,7 +95,7 @@ declare module '@solana/web3.js' {
fee: number,
preBalances: Array<number>,
postBalances: Array<number>,
status: SignatureStatusResult,
status: ?SignatureStatusResult,
},
}>,
};
@ -128,6 +127,9 @@ declare module '@solana/web3.js' {
keyedAccountInfo: KeyedAccountInfo,
) => void;
declare type SlotChangeCallback = (slotInfo: SlotInfo) => void;
declare type SignatureResultCallback = (
signatureResult: SignatureStatusResult,
) => void;
declare export type SignatureSuccess = {|
Ok: null,
@ -227,8 +229,14 @@ declare module '@solana/web3.js' {
programId: PublicKey,
callback: ProgramAccountChangeCallback,
): number;
onSlotChange(callback: SlotChangeCallback): number;
removeProgramAccountChangeListener(id: number): Promise<void>;
onSlotChange(callback: SlotChangeCallback): number;
removeSlotChangeListener(id: number): Promise<void>;
onSignature(
signature: TransactionSignature,
callback: SignatureResultCallback,
): number;
removeSignatureListener(id: number): Promise<void>;
validatorExit(): Promise<boolean>;
getMinimumBalanceForRentExemption(
dataLength: number,