Browse Source

fix State type (#88)

NorbertBodziony 4 years ago
parent
commit
1ae8b52760
1 changed files with 9 additions and 4 deletions
  1. 9 4
      ts/src/rpc.ts

+ 9 - 4
ts/src/rpc.ts

@@ -130,10 +130,15 @@ type RpcAccounts = {
   [key: string]: PublicKey | RpcAccounts;
 };
 
-export type State = {
-  address: () => Promise<PublicKey>;
-  rpc: Rpcs;
-};
+export type State = () =>
+  | Promise<any>
+  | {
+      address: () => Promise<PublicKey>;
+      rpc: Rpcs;
+      instruction: Ixs;
+      subscribe: (address: PublicKey, commitment?: Commitment) => EventEmitter;
+      unsubscribe: (address: PublicKey) => void;
+    };
 
 // Tracks all subscriptions.
 const subscriptions: Map<string, Subscription> = new Map();