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

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

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