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

11
web3.js/module.d.ts vendored
View File

@ -114,6 +114,9 @@ declare module '@solana/web3.js' {
keyedAccountInfo: KeyedAccountInfo,
) => void;
export type SlotChangeCallback = (slotInfo: SlotInfo) => void;
export type SignatureResultCallback = (
signatureResult: SignatureStatusResult,
) => void;
export type SignatureSuccess = {
Ok: null;
@ -213,8 +216,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,