diff --git a/packages/experimental/src.ts/eip1193-bridge.ts b/packages/experimental/src.ts/eip1193-bridge.ts index c753a1200f..b06f55a882 100644 --- a/packages/experimental/src.ts/eip1193-bridge.ts +++ b/packages/experimental/src.ts/eip1193-bridge.ts @@ -27,9 +27,13 @@ export class Eip1193Bridge extends EventEmitter { ethers.utils.defineReadOnly(this, "provider", provider || null); } + request(request: { method: string, params?: Array}): Promise { + return this.send(request.method, request.params || []); + } + async send(method: string, params?: Array): Promise { function throwUnsupported(message: string): never { - return logger.throwError("eth_sign requires a signer", ethers.utils.Logger.errors.UNSUPPORTED_OPERATION, { + return logger.throwError(message, ethers.utils.Logger.errors.UNSUPPORTED_OPERATION, { method: method, params: params }); @@ -125,7 +129,7 @@ export class Eip1193Bridge extends EventEmitter { case "eth_sendTransaction": { if (!this.signer) { - return throwUnsupported("eth_sign requires an account"); + return throwUnsupported("eth_sendTransaction requires an account"); } const req = ethers.providers.JsonRpcProvider.hexlifyTransaction(params[0]);