From f8c24a521b9de9cb0d16422cdac1513588068e39 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Wed, 7 Feb 2024 17:13:39 +0500 Subject: [PATCH 1/6] add nonce key for all wallets --- src/sdk/base/SimpleAccountWalletAPI.ts | 5 ++--- src/sdk/base/ZeroDevWalletAPI.ts | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sdk/base/SimpleAccountWalletAPI.ts b/src/sdk/base/SimpleAccountWalletAPI.ts index d1b9dc73..d5955172 100644 --- a/src/sdk/base/SimpleAccountWalletAPI.ts +++ b/src/sdk/base/SimpleAccountWalletAPI.ts @@ -84,13 +84,12 @@ export class SimpleAccountAPI extends BaseAccountAPI { return this.accountAddress; } - async getNonce(): Promise { + async getNonce(key = 0): Promise { console.log('checking nonce...'); if (await this.checkAccountPhantom()) { return BigNumber.from(0); } - const accountContract = await this._getAccountContract(); - return accountContract.getNonce(); + return await this.nonceManager.getNonce(await this.getAccountAddress(), key); } /** diff --git a/src/sdk/base/ZeroDevWalletAPI.ts b/src/sdk/base/ZeroDevWalletAPI.ts index dda4aa16..103c3bf8 100644 --- a/src/sdk/base/ZeroDevWalletAPI.ts +++ b/src/sdk/base/ZeroDevWalletAPI.ts @@ -117,13 +117,12 @@ export class ZeroDevWalletAPI extends BaseAccountAPI { return this.accountAddress; } - async getNonce(): Promise { + async getNonce(key = 0): Promise { console.log('checking nonce...'); if (await this.checkAccountPhantom()) { return BigNumber.from(0); } - const entryPoint = IEntryPoint__factory.connect(this.entryPointAddress, this.provider); - return await entryPoint.getNonce(this.accountAddress, 0); + return await this.nonceManager.getNonce(await this.getAccountAddress(), key); } async signUserOpHash(userOpHash: string): Promise { From 5b5e81b10d9d4a8ad8a6378c5c656539d85ace84 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Wed, 7 Feb 2024 17:13:48 +0500 Subject: [PATCH 2/6] bump package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b4ec2d4..cafc63bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherspot/prime-sdk", - "version": "1.5.0", + "version": "1.5.1", "description": "Etherspot Prime (Account Abstraction) SDK", "keywords": [ "ether", From 339bce245983c418fb53a571570e90aa8a804f75 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Wed, 7 Feb 2024 17:46:44 +0500 Subject: [PATCH 3/6] delete console.log --- src/sdk/base/EtherspotWalletAPI.ts | 1 - src/sdk/base/SimpleAccountWalletAPI.ts | 1 - src/sdk/base/ZeroDevWalletAPI.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/src/sdk/base/EtherspotWalletAPI.ts b/src/sdk/base/EtherspotWalletAPI.ts index 7e30c9e2..c75cd7be 100644 --- a/src/sdk/base/EtherspotWalletAPI.ts +++ b/src/sdk/base/EtherspotWalletAPI.ts @@ -100,7 +100,6 @@ export class EtherspotWalletAPI extends BaseAccountAPI { } async getNonce(key = 0): Promise { - console.log('checking nonce...'); if (await this.checkAccountPhantom()) { return BigNumber.from(0); } diff --git a/src/sdk/base/SimpleAccountWalletAPI.ts b/src/sdk/base/SimpleAccountWalletAPI.ts index d5955172..461422c8 100644 --- a/src/sdk/base/SimpleAccountWalletAPI.ts +++ b/src/sdk/base/SimpleAccountWalletAPI.ts @@ -85,7 +85,6 @@ export class SimpleAccountAPI extends BaseAccountAPI { } async getNonce(key = 0): Promise { - console.log('checking nonce...'); if (await this.checkAccountPhantom()) { return BigNumber.from(0); } diff --git a/src/sdk/base/ZeroDevWalletAPI.ts b/src/sdk/base/ZeroDevWalletAPI.ts index 103c3bf8..091d9e0a 100644 --- a/src/sdk/base/ZeroDevWalletAPI.ts +++ b/src/sdk/base/ZeroDevWalletAPI.ts @@ -118,7 +118,6 @@ export class ZeroDevWalletAPI extends BaseAccountAPI { } async getNonce(key = 0): Promise { - console.log('checking nonce...'); if (await this.checkAccountPhantom()) { return BigNumber.from(0); } From 9723616d9905dc5abf1771e6bdae63dced5cc8df Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Wed, 7 Feb 2024 18:26:52 +0500 Subject: [PATCH 4/6] update changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf727c87..05b73778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog -## [1.4.2] - 2024-01-26 +## [1.5.1] - 2024-01-26 +### Bug fixes +- Added `key` param on SimpleAccount and ZeroDev wallets + +## [1.5.0] - 2024-01-26 ### Breaking changes - Refactored `estimate` method - Added `key` in `estimate` method to include `key` of semi-abstracted nonce (https://eips.ethereum.org/EIPS/eip-4337#semi-abstracted-nonce-support) From f7805ba9e3eaf0c62d82224cad02f81a0c8c92a3 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Wed, 7 Feb 2024 18:35:20 +0500 Subject: [PATCH 5/6] refactor --- src/sdk/base/ZeroDevWalletAPI.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdk/base/ZeroDevWalletAPI.ts b/src/sdk/base/ZeroDevWalletAPI.ts index 091d9e0a..43c72bd7 100644 --- a/src/sdk/base/ZeroDevWalletAPI.ts +++ b/src/sdk/base/ZeroDevWalletAPI.ts @@ -1,7 +1,6 @@ import { BigNumber, BigNumberish, Contract, ethers } from 'ethers'; import { EntryPoint__factory, - IEntryPoint__factory, } from '../contracts'; import { arrayify, hexConcat } from 'ethers/lib/utils'; import { BaseApiParams, BaseAccountAPI } from './BaseAccountAPI'; From b1ee8d96c1d83532b07fdb28013afdf91a18e174 Mon Sep 17 00:00:00 2001 From: marie-fourier Date: Thu, 8 Feb 2024 19:43:49 +0500 Subject: [PATCH 6/6] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05b73778..b5cb1894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog -## [1.5.1] - 2024-01-26 +## [1.5.1] - 2024-02-08 ### Bug fixes - Added `key` param on SimpleAccount and ZeroDev wallets