Skip to content

Commit 153af0e

Browse files
committed
[Update] Refactor account deployment check in ERC4337 extension (#4418)
address: https://app.graphite.dev/github/pr/thirdweb-dev/js/4413/Update-Refactor-NFT-reveal-functionality-and-batch-lazy-minting#comment-PRRC_kwDOH5MG4s5oAmQb <!-- start pr-codex --> --- ## PR-Codex overview The focus of this PR is to refactor the `isAccountDeployed` function by replacing the `getBytecode` call with `isContractDeployed` for improved readability and efficiency. ### Detailed summary - Replaced `getBytecode` call with `isContractDeployed` for checking contract deployment status - Updated function return logic for clarity and simplicity > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 5275fd7 commit 153af0e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/thirdweb/src/extensions/erc4337/account/isAccountDeployed.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { getBytecode } from "../../../contract/actions/get-bytecode.js";
21
import type { BaseTransactionOptions } from "../../../transaction/types.js";
2+
import { isContractDeployed } from "../../../utils/bytecode/is-contract-deployed.js";
33
import * as PredictAddress from "../__generated__/IAccountFactory/read/getAddress.js";
44

55
export {
@@ -29,9 +29,8 @@ export async function isAccountDeployed(
2929
options: BaseTransactionOptions<PredictAddress.GetAddressParams>,
3030
): Promise<boolean> {
3131
const predictedAddress = await PredictAddress.getAddress(options);
32-
const bytecode = await getBytecode({
32+
return isContractDeployed({
3333
...options.contract,
3434
address: predictedAddress,
3535
});
36-
return bytecode !== "0x";
3736
}

0 commit comments

Comments
 (0)