diff --git a/src/services/ProviderTransport.ts b/src/services/ProviderTransport.ts index 8087ab7b1..b5eff481c 100644 --- a/src/services/ProviderTransport.ts +++ b/src/services/ProviderTransport.ts @@ -27,10 +27,20 @@ export interface JRPCResponse extends JRPCBase { } export type SendCallBack = (err: any, providerRes: U) => void; +export type Maybe = T | Partial | null | undefined; + +export interface RequestArguments { + method: string; + params?: T; +} export interface SafeEventEmitterProvider { sendAsync: (req: JRPCRequest) => Promise; - send: (req: JRPCRequest, callback: SendCallBack) => void; + send: ( + req: JRPCRequest, + callback: SendCallBack> + ) => void; + request: (req: RequestArguments) => Promise>; } class ProviderTransport extends Transport { @@ -50,8 +60,8 @@ class ProviderTransport extends Transport { const notifications = getNotifications(data); const batch = getBatchRequests(data); try { - const result = await this.provider.sendAsync( - (data.request as IJSONRPCRequest) as JRPCRequest + const result = await this.provider.request( + (data.request as IJSONRPCRequest) as RequestArguments ); const jsonrpcResponse = { id: data.request.id,