Skip to content

Commit

Permalink
fix: gitInitCode cache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AmanRaj1608 committed Sep 15, 2023
1 parent 325f5ef commit 4df3502
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions packages/account/src/BaseSmartAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export abstract class BaseSmartAccount implements IBaseSmartAccount {
// Review : compare with BaseAccountAPI
// private senderAddress!: string

private isDeployed = false;

bundler?: IBundler; // httpRpcClient

paymaster?: IPaymaster; // paymasterAPI
Expand Down Expand Up @@ -61,14 +59,6 @@ export abstract class BaseSmartAccount implements IBaseSmartAccount {
throw new Error(`EntryPoint not deployed at ${this.entryPointAddress} at chainId ${this.chainId}}`);
}

// Note: Review
// on Init itself since we're already getting account address, mark isDeployed as well!

if ((await this.provider.getCode(await this.getAccountAddress())) === "0x") {
this.isDeployed = false;
} else {
this.isDeployed = true;
}
return this;
}

Expand Down Expand Up @@ -298,17 +288,14 @@ export abstract class BaseSmartAccount implements IBaseSmartAccount {
// Review : usage trace of this method. in the order of init and methods called on the Account
async isAccountDeployed(address: string): Promise<boolean> {
this.isProviderDefined();
if (this.isDeployed !== undefined || this.isDeployed !== null) {
// already deployed. no need to check anymore.
return this.isDeployed;
}
let isDeployed = false;
const contractCode = await this.provider.getCode(address);
if (contractCode.length > 2) {
this.isDeployed = true;
isDeployed = true;
} else {
this.isDeployed = false;
isDeployed = false;
}
return this.isDeployed;
return isDeployed;
}

/**
Expand Down

0 comments on commit 4df3502

Please sign in to comment.