Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nonce key param on all wallets #101

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog
## [1.4.2] - 2024-01-26
## [1.5.1] - 2024-01-26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

### 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)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/prime-sdk",
"version": "1.5.0",
"version": "1.5.1",
"description": "Etherspot Prime (Account Abstraction) SDK",
"keywords": [
"ether",
Expand Down
1 change: 0 additions & 1 deletion src/sdk/base/EtherspotWalletAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export class EtherspotWalletAPI extends BaseAccountAPI {
}

async getNonce(key = 0): Promise<BigNumber> {
console.log('checking nonce...');
if (await this.checkAccountPhantom()) {
return BigNumber.from(0);
}
Expand Down
6 changes: 2 additions & 4 deletions src/sdk/base/SimpleAccountWalletAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ export class SimpleAccountAPI extends BaseAccountAPI {
return this.accountAddress;
}

async getNonce(): Promise<BigNumber> {
console.log('checking nonce...');
async getNonce(key = 0): Promise<BigNumber> {
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);
}

/**
Expand Down
7 changes: 2 additions & 5 deletions src/sdk/base/ZeroDevWalletAPI.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -117,13 +116,11 @@ export class ZeroDevWalletAPI extends BaseAccountAPI {
return this.accountAddress;
}

async getNonce(): Promise<BigNumber> {
console.log('checking nonce...');
async getNonce(key = 0): Promise<BigNumber> {
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<string> {
Expand Down
Loading