Skip to content

Commit

Permalink
(feat): fix #83
Browse files Browse the repository at this point in the history
  • Loading branch information
adenekan41 committed Sep 1, 2021
1 parent 72cdb48 commit 8f41ef1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/@magic-sdk/provider/src/core/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { EthNetworkConfiguration, QueryParameters } from '@magic-sdk/types';
import semverSatisfies from 'semver/functions/satisfies';
import type { AbstractProvider } from 'web3-core';
import { encodeJSON } from '../util/base64-json';
import {
createMissingApiKeyError,
Expand Down Expand Up @@ -164,7 +165,7 @@ export class SDKBase {
* Contains a Web3-compliant provider. Pass this module to your Web3/Ethers
* instance for automatic compatibility with Ethereum methods.
*/
public readonly rpcProvider: RPCProviderModule;
public readonly rpcProvider: RPCProviderModule & AbstractProvider;

/**
* Creates an instance of Magic SDK.
Expand All @@ -183,7 +184,7 @@ export class SDKBase {
// Prepare built-in modules
this.auth = new AuthModule(this);
this.user = new UserModule(this);
this.rpcProvider = new RPCProviderModule(this);
this.rpcProvider = new RPCProviderModule(this) as any;

// Prepare extensions
const extConfig: any = prepareExtensions.call(this, options);
Expand Down
16 changes: 11 additions & 5 deletions packages/@magic-sdk/provider/src/modules/rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export class RPCProviderModule extends BaseModule implements TypedEmitter {
/* eslint-disable prettier/prettier */
public sendAsync(payload: Partial<JsonRpcRequestPayload>, onRequestComplete: JsonRpcRequestCallback): void;
public sendAsync(payload: Partial<JsonRpcRequestPayload>[], onRequestComplete: JsonRpcBatchRequestCallback): void;
public sendAsync(payload: Partial<JsonRpcRequestPayload> | Partial<JsonRpcRequestPayload>[], onRequestComplete: JsonRpcRequestCallback | JsonRpcBatchRequestCallback): void;
public sendAsync(
payload: Partial<JsonRpcRequestPayload> | Partial<JsonRpcRequestPayload>[],
onRequestComplete: JsonRpcRequestCallback | JsonRpcBatchRequestCallback,
): void;
/* eslint-enable prettier/prettier */
public sendAsync(
payload: Partial<JsonRpcRequestPayload> | Partial<JsonRpcRequestPayload>[],
Expand Down Expand Up @@ -75,10 +78,13 @@ export class RPCProviderModule extends BaseModule implements TypedEmitter {
}

/* eslint-disable prettier/prettier */
public send<ResultType = any>(method: string, params?: any[]): PromiEvent<ResultType>;
public send(payload: JsonRpcRequestPayload | JsonRpcRequestPayload[], onRequestComplete: JsonRpcRequestCallback): void;
public send<ResultType>(payload: JsonRpcRequestPayload, none: void): JsonRpcResponsePayload<ResultType>;
/* eslint-enable prettier/prettier */
public send<ResultType = any>(method: string, params?: any[]): PromiEvent<ResultType>;
public send(
payload: JsonRpcRequestPayload | JsonRpcRequestPayload[],
onRequestComplete: JsonRpcRequestCallback,
): void;
public send<ResultType>(payload: JsonRpcRequestPayload, none: void): JsonRpcResponsePayload<ResultType>;
/* eslint-enable prettier/prettier */
public send<ResultType = any>(
payloadOrMethod: string | JsonRpcRequestPayload | JsonRpcRequestPayload[],
onRequestCompleteOrParams: JsonRpcRequestCallback | any[] | void,
Expand Down

0 comments on commit 8f41ef1

Please sign in to comment.