Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix: fix ganache provider type (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch authored Jun 22, 2020
1 parent d8a1a88 commit 2f81da2
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
declare module "ganache-core" {
import { Provider as Web3Provider } from "web3/providers";
export interface JsonRpcPayload {
jsonrpc: string;
method: string;
params: any[];
id?: string | number;
}

export interface JsonRpcResponse {
jsonrpc: string;
id: number;
result?: any;
error?: string;
}

namespace Ganache {
export interface IProviderOptions {
Expand Down Expand Up @@ -41,7 +53,20 @@ declare module "ganache-core" {
export function provider(opts?: IProviderOptions): Provider;
export function server(opts?: IServerOptions): any;

export interface Provider extends Web3Provider {
export interface Provider {
send(
payload: JsonRpcPayload,
callback: (error: Error | null, result?: JsonRpcResponse) => void
): void;

on(type: string, callback: () => void): void;

once(type: string, callback: () => void): void;

removeListener(type: string, callback: () => void): void;

removeAllListeners(type: string): void;

close: (callback: Function) => void;
}
}
Expand Down

0 comments on commit 2f81da2

Please sign in to comment.