Skip to content

Commit

Permalink
Merge pull request #291 from bcnmy/fix-build-package
Browse files Browse the repository at this point in the history
fix: build errors
  • Loading branch information
livingrockrises authored Sep 13, 2023
2 parents 7226a87 + 9fb0475 commit c1ab9a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
3 changes: 2 additions & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@biconomy/modules": "^3.1.1-alpha.0",
"@biconomy/node-client": "^3.1.1-alpha.0",
"@biconomy/paymaster": "^3.1.1-alpha.0",
"ethers": "^5.7.0"
"ethers": "^5.7.0",
"@ethersproject/providers": "^5.7.2"
}
}
29 changes: 10 additions & 19 deletions packages/account/src/BaseSmartAccount.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

import { JsonRpcProvider, Provider } from "@ethersproject/providers";
import { BigNumber, BigNumberish, Signer, BytesLike, ethers, Bytes } from "ethers";
import { BigNumber, BigNumberish, BytesLike, ethers, Bytes } from "ethers";
import { IBaseSmartAccount } from "./interfaces/IBaseSmartAccount";
import { defaultAbiCoder, keccak256, arrayify, Result } from "ethers/lib/utils";
import { defaultAbiCoder, keccak256 } from "ethers/lib/utils";
import { UserOperation, ChainId } from "@biconomy/core-types";
import { calcPreVerificationGas, DefaultGasLimits } from "./utils/Preverificaiton";
import { NotPromise, packUserOp } from "@biconomy/common";
import { NotPromise, packUserOp, Logger, RPC_PROVIDER_URLS } from "@biconomy/common";
import { IBundler, UserOpResponse } from "@biconomy/bundler";
import { IPaymaster, PaymasterAndDataResponse } from "@biconomy/paymaster";
import { EntryPoint_v005, Logger } from "@biconomy/common";
import { BaseSmartAccountConfig, Overrides, TransactionDetailsForUserOp } from "./utils/Types";
import { GasOverheads } from "./utils/Preverificaiton";
import { EntryPoint, EntryPoint__factory } from "@account-abstraction/contracts";
import { DEFAULT_ENTRYPOINT_ADDRESS } from "./utils/Constants";
import { RPC_PROVIDER_URLS } from "@biconomy/common";

type UserOperationKey = keyof UserOperation;

Expand Down Expand Up @@ -275,6 +270,7 @@ export abstract class BaseSmartAccount implements IBaseSmartAccount {
// Making call to bundler to get gas estimations for userOp
const { callGasLimit, verificationGasLimit, preVerificationGas, maxFeePerGas, maxPriorityFeePerGas } =
await this.bundler.estimateUserOpGas(userOp);
// if neither user sent gas fee nor the bundler, estimate gas from provider
if (!userOp.maxFeePerGas && !userOp.maxPriorityFeePerGas && (!maxFeePerGas || !maxPriorityFeePerGas)) {
const feeData = await this.provider.getFeeData();
finalUserOp.maxFeePerGas = feeData.maxFeePerGas ?? feeData.gasPrice ?? (await this.provider.getGasPrice());
Expand Down Expand Up @@ -302,22 +298,17 @@ 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();
let contractCode;
if (this.isDeployed !== undefined || this.isDeployed !== null) {
// already deployed. no need to check anymore.
return this.isDeployed;
}
try {
contractCode = await this.provider.getCode(address);
if (contractCode.length > 2) {
this.isDeployed = true;
} else {
this.isDeployed = false;
}
return this.isDeployed;
} catch (error) {
throw error;
const contractCode = await this.provider.getCode(address);
if (contractCode.length > 2) {
this.isDeployed = true;
} else {
this.isDeployed = false;
}
return this.isDeployed;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@ethersproject/bignumber": "^5.6.0",
"@ethersproject/contracts": "^5.6.0",
"@ethersproject/providers": "^5.7.0",
"ethers": "^6.7.1",
"ethers": "^5.7.2",
"web3-core": "^1.7.1"
}
}

0 comments on commit c1ab9a6

Please sign in to comment.