Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit cd00e9a

Browse files
authored
Change to require a Signer so that it can be used with external wallets such as metamask (#25)
1 parent 6ea20a7 commit cd00e9a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/preset/builder/simpleAccount.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ import {
1616
import { UserOperationMiddlewareFn } from "../../types";
1717

1818
export class SimpleAccount extends UserOperationBuilder {
19-
private signer: ethers.Wallet;
19+
private signer: ethers.Signer;
2020
private provider: ethers.providers.JsonRpcProvider;
2121
private entryPoint: EntryPoint;
2222
private factory: SimpleAccountFactory;
2323
private initCode: string;
2424
proxy: SimpleAccountImpl;
2525

2626
private constructor(
27-
signingKey: string,
27+
signer: ethers.Signer,
2828
ERC4337NodeRpc: string,
2929
entryPoint: string,
3030
factory: string
3131
) {
3232
super();
33-
this.signer = new ethers.Wallet(signingKey);
33+
this.signer = signer;
3434
this.provider = new ethers.providers.JsonRpcProvider(ERC4337NodeRpc);
3535
this.entryPoint = EntryPoint__factory.connect(entryPoint, this.provider);
3636
this.factory = SimpleAccountFactory__factory.connect(
@@ -50,14 +50,14 @@ export class SimpleAccount extends UserOperationBuilder {
5050
};
5151

5252
public static async init(
53-
signingKey: string,
53+
signer: ethers.Signer,
5454
ERC4337NodeRpc: string,
5555
entryPoint: string,
5656
factory: string,
5757
paymasterMiddleware?: UserOperationMiddlewareFn
5858
): Promise<SimpleAccount> {
5959
const instance = new SimpleAccount(
60-
signingKey,
60+
signer,
6161
ERC4337NodeRpc,
6262
entryPoint,
6363
factory

src/preset/middleware/signature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ethers } from "ethers";
22
import { UserOperationMiddlewareFn } from "../../types";
33

44
export const EOASignature =
5-
(signer: ethers.Wallet): UserOperationMiddlewareFn =>
5+
(signer: ethers.Signer): UserOperationMiddlewareFn =>
66
async (ctx) => {
77
ctx.op.signature = await signer.signMessage(
88
ethers.utils.arrayify(ctx.getUserOpHash())

0 commit comments

Comments
 (0)