Skip to content

Commit 2911659

Browse files
committed
Updated experimental Eip1193Bridge to support final EIP-1193 API.
1 parent 51f0e1a commit 2911659

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/experimental/src.ts/eip1193-bridge.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ export class Eip1193Bridge extends EventEmitter {
2727
ethers.utils.defineReadOnly(this, "provider", provider || null);
2828
}
2929

30+
request(request: { method: string, params?: Array<any>}): Promise<any> {
31+
return this.send(request.method, request.params || []);
32+
}
33+
3034
async send(method: string, params?: Array<any>): Promise<any> {
3135
function throwUnsupported(message: string): never {
32-
return logger.throwError("eth_sign requires a signer", ethers.utils.Logger.errors.UNSUPPORTED_OPERATION, {
36+
return logger.throwError(message, ethers.utils.Logger.errors.UNSUPPORTED_OPERATION, {
3337
method: method,
3438
params: params
3539
});
@@ -125,7 +129,7 @@ export class Eip1193Bridge extends EventEmitter {
125129

126130
case "eth_sendTransaction": {
127131
if (!this.signer) {
128-
return throwUnsupported("eth_sign requires an account");
132+
return throwUnsupported("eth_sendTransaction requires an account");
129133
}
130134

131135
const req = ethers.providers.JsonRpcProvider.hexlifyTransaction(params[0]);

0 commit comments

Comments
 (0)