feat: add context to pubsub notification callbacks

This commit is contained in:
Justin Starry
2020-03-23 22:19:32 +08:00
committed by Michael Vines
parent 1c31e527e2
commit be53ab5aa4
3 changed files with 80 additions and 37 deletions

View File

@ -50,10 +50,12 @@ declare module '@solana/web3.js' {
/* TODO */
// === src/connection.js ===
declare export type Context = {
slot: number,
};
declare export type RpcResponseAndContext<T> = {
context: {
slot: number,
},
context: Context,
value: T,
};
@ -130,13 +132,18 @@ declare module '@solana/web3.js' {
root: 'number',
};
declare type AccountChangeCallback = (accountInfo: AccountInfo) => void;
declare type AccountChangeCallback = (
accountInfo: AccountInfo,
context: Context,
) => void;
declare type ProgramAccountChangeCallback = (
keyedAccountInfo: KeyedAccountInfo,
context: Context,
) => void;
declare type SlotChangeCallback = (slotInfo: SlotInfo) => void;
declare type SignatureResultCallback = (
signatureResult: SignatureStatusResult,
context: Context,
) => void;
declare export type SignatureSuccess = {|