diff --git a/CHANGELOG.md b/CHANGELOG.md index bf727c87..b5cb1894 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog -## [1.4.2] - 2024-01-26 +## [1.5.1] - 2024-02-08 +### 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) 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", 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 d1b9dc73..461422c8 100644 --- a/src/sdk/base/SimpleAccountWalletAPI.ts +++ b/src/sdk/base/SimpleAccountWalletAPI.ts @@ -84,13 +84,11 @@ export class SimpleAccountAPI extends BaseAccountAPI { return this.accountAddress; } - async getNonce(): Promise { - console.log('checking nonce...'); + async getNonce(key = 0): Promise { 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..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'; @@ -117,13 +116,11 @@ export class ZeroDevWalletAPI extends BaseAccountAPI { return this.accountAddress; } - async getNonce(): Promise { - console.log('checking nonce...'); + async getNonce(key = 0): Promise { 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 {