Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/new-poems-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/wallets": patch
---

Expose data param for smart wallet util functions
7 changes: 5 additions & 2 deletions packages/wallets/src/evm/connectors/smart-wallet/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
isContractDeployed,
ThirdwebSDK,
} from "@thirdweb-dev/sdk";
import { BytesLike } from "ethers";

export type AccessibleSmartWallets = {
owned: string;
Expand Down Expand Up @@ -81,12 +82,13 @@ export async function isSmartWalletDeployed(
chain: ChainOrRpcUrl,
factoryAddress: string,
personalWalletAddress: string,
data: BytesLike = "0x",
) {
const readOnlySDK = getSDK(chain);
const factoryContract = await readOnlySDK.getContract(factoryAddress);
const accountAddress = await factoryContract.call("getAddress", [
personalWalletAddress,
"0x",
data,
]);
const isDeployed = await isContractDeployed(
accountAddress,
Expand All @@ -106,12 +108,13 @@ export async function getSmartWalletAddress(
chain: ChainOrRpcUrl,
factoryAddress: string,
personalWalletAddress: string,
data: BytesLike = "0x",
): Promise<string> {
const readOnlySDK = getSDK(chain);
const factoryContract = await readOnlySDK.getContract(factoryAddress);
const accountAddress = await factoryContract.call("getAddress", [
personalWalletAddress,
"0x",
data,
]);
return accountAddress;
}