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

fix: module-install check to be done only for existing modular-wallet #43

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog

## [2.0.6] - 2024-10-14
### fix
- `getNonce` function to validate for the installed module check only for the existing modular wallet
- `getNonce` function to skip validation check on installed module for to be created modular wallet

## [2.0.5] - 2024-09-26
### fix
- validate the tokenAddress for `enableSessionKey` on `SessionKeyValidator` SDK instance
Expand Down
51 changes: 49 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/modular-sdk",
"version": "2.0.5",
"version": "2.0.6",
"description": "Etherspot Modular SDK - build with ERC-7579 smart accounts modules",
"keywords": [
"ether",
Expand Down
10 changes: 7 additions & 3 deletions src/sdk/base/EtherspotWalletAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,14 @@ export class EtherspotWalletAPI extends BaseAccountAPI {
throw new Error(`Invalid Validator Address: ${nonceAddressPrefix}`);
}

const isValidatorInstalled : boolean = await this.isModuleInstalled(MODULE_TYPE.VALIDATOR, nonceAddressPrefix);
const isAnExistingModularAccount = (await this.provider.getCode(accountAddress) !== '0x');

if(!isValidatorInstalled) {
throw new Error(`Validator: ${nonceAddressPrefix} is not installed in the wallet`);
if(isAnExistingModularAccount) {
const isValidatorInstalled : boolean = await this.isModuleInstalled(MODULE_TYPE.VALIDATOR, nonceAddressPrefix);

if(!isValidatorInstalled) {
throw new Error(`Validator: ${nonceAddressPrefix} is not installed in the wallet`);
}
}

const dummyKey = ethers.utils.getAddress(nonceAddressPrefix) + "00000000";
Expand Down
Loading