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 {
2323 private entryPoint : EntryPoint ;
2424 private factory : SimpleAccountFactory ;
2525 private initCode : string ;
26+ private nonceKey : number ;
2627 proxy : SimpleAccountImpl ;
2728
2829 private constructor (
@@ -44,14 +45,15 @@ export class SimpleAccount extends UserOperationBuilder {
4445 this . provider
4546 ) ;
4647 this . initCode = "0x" ;
48+ this . nonceKey = opts ?. nonceKey || 0 ;
4749 this . proxy = SimpleAccount__factory . connect (
4850 ethers . constants . AddressZero ,
4951 this . provider
5052 ) ;
5153 }
5254
5355 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 ) ;
5557 ctx . op . initCode = ctx . op . nonce . eq ( 0 ) ? this . initCode : "0x" ;
5658 } ;
5759
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ export interface IPresetBuilderOpts {
107107 entryPoint ?: string ;
108108 factory ?: string ;
109109 salt ?: BigNumberish ;
110+ nonceKey ?: number ;
110111 paymasterMiddleware ?: UserOperationMiddlewareFn ;
111112 overrideBundlerRpc ?: string ;
112113}
You can’t perform that action at this time.
0 commit comments