This repository was archived by the owner on Oct 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export class SimpleAccount extends UserOperationBuilder {
23
23
private entryPoint : EntryPoint ;
24
24
private factory : SimpleAccountFactory ;
25
25
private initCode : string ;
26
+ private nonceKey : number ;
26
27
proxy : SimpleAccountImpl ;
27
28
28
29
private constructor (
@@ -44,14 +45,15 @@ export class SimpleAccount extends UserOperationBuilder {
44
45
this . provider
45
46
) ;
46
47
this . initCode = "0x" ;
48
+ this . nonceKey = opts ?. nonceKey || 0 ;
47
49
this . proxy = SimpleAccount__factory . connect (
48
50
ethers . constants . AddressZero ,
49
51
this . provider
50
52
) ;
51
53
}
52
54
53
55
private resolveAccount : UserOperationMiddlewareFn = async ( ctx ) => {
54
- ctx . op . nonce = await this . entryPoint . getNonce ( ctx . op . sender , 0 ) ;
56
+ ctx . op . nonce = await this . entryPoint . getNonce ( ctx . op . sender , this . nonceKey ) ;
55
57
ctx . op . initCode = ctx . op . nonce . eq ( 0 ) ? this . initCode : "0x" ;
56
58
} ;
57
59
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ export interface IPresetBuilderOpts {
107
107
entryPoint ?: string ;
108
108
factory ?: string ;
109
109
salt ?: BigNumberish ;
110
+ nonceKey ?: number ;
110
111
paymasterMiddleware ?: UserOperationMiddlewareFn ;
111
112
overrideBundlerRpc ?: string ;
112
113
}
You can’t perform that action at this time.
0 commit comments