Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7524d7a
wip
ciaranightingale Jul 5, 2023
de65f04
merge main
ciaranightingale Jul 5, 2023
98c7018
wip
ciaranightingale Jul 12, 2023
820d4cc
Merge branch 'main' into ciara/tba
ciaranightingale Jul 12, 2023
4755ac0
merge main
ciaranightingale Jul 24, 2023
2580d13
wip
ciaranightingale Jul 24, 2023
279b260
update with clientId & secretKey & requested changes
ciaranightingale Jul 24, 2023
c8445b9
Merge branch 'ciara/tba' of https://github.com/thirdweb-dev/js into c…
ciaranightingale Jul 24, 2023
af57f47
Merge branch 'main' into ciara/tba
ciaranightingale Jul 24, 2023
2db5249
fix build
ciaranightingale Jul 24, 2023
73a51fa
wip
ciaranightingale Jul 26, 2023
39e22b9
wip
ciaranightingale Jul 26, 2023
f34654b
Merge branch 'ciara/tba' of https://github.com/thirdweb-dev/js into c…
ciaranightingale Jul 26, 2023
7477b73
restructure
Jul 26, 2023
5ab826b
cleanup
joaquim-verges Jul 27, 2023
909ca2f
Merge branch 'main' into ciara/tba
joaquim-verges Jul 27, 2023
0c9ada2
Merge branch 'main' into ciara/tba
ciaranightingale Jul 27, 2023
cf5bb93
working code & fix factoryAddress required
ciaranightingale Jul 27, 2023
fdee3f5
Merge branch 'main' into ciara/tba
joaquim-verges Aug 9, 2023
0bdddc0
Merge branch 'main' into ciara/tba
joaquim-verges Aug 9, 2023
f11c12a
Merge branch 'main' into ciara/tba
joaquim-verges Oct 13, 2023
e93da7f
fix types
joaquim-verges Oct 14, 2023
6b4642a
linting
joaquim-verges Oct 14, 2023
8a07db2
fix build
joaquim-verges Oct 14, 2023
a8464f6
Merge branch 'main' into ciara/tba
joaquim-verges Oct 24, 2023
4c8dd1c
require account impl for now
joaquim-verges Oct 24, 2023
c9616ed
changeset
joaquim-verges Oct 24, 2023
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
Prev Previous commit
Next Next commit
Merge branch 'main' into ciara/tba
  • Loading branch information
joaquim-verges committed Jul 27, 2023
commit 909ca2fb9ce1ab5263330cae683f02d357e96239
55 changes: 54 additions & 1 deletion packages/wallets/src/evm/connectors/smart-wallet/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain, getChainByChainId, getChainBySlug } from "@thirdweb-dev/chains";
import { Chain, getChainByChainId } from "@thirdweb-dev/chains";
import { ConnectParams, Connector } from "../../interfaces/connector";
import { ERC4337EthersProvider } from "./lib/erc4337-provider";
import { getVerifyingPaymaster } from "./lib/paymaster";
Expand Down Expand Up @@ -241,6 +241,59 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
return await this.accountApi.isAcountDeployed();
}

/**
* Get the underlying account contract of the smart wallet.
* @returns the account contract of the smart wallet.
*/
async getAccountContract(): Promise<SmartContract> {
const isDeployed = await this.isDeployed();
if (!isDeployed) {
throw new Error(
"Account contract is not deployed yet. You can deploy it manually using SmartWallet.deploy(), or by executing a transaction from this wallet.",
);
}
// getting a new instance everytime
// to avoid caching issues pre/post deployment
const sdk = ThirdwebSDK.fromSigner(
await this.getSigner(),
this.config.chain,
{
clientId: this.config.clientId,
secretKey: this.config.secretKey,
},
);
if (this.config.accountInfo?.abi) {
return sdk.getContract(
await this.getAddress(),
this.config.accountInfo.abi,
);
} else {
return sdk.getContract(await this.getAddress());
}
}

/**
* Get the underlying account factory contract of the smart wallet.
* @returns the account factory contract.
*/
async getFactoryContract(): Promise<SmartContract> {
const sdk = ThirdwebSDK.fromSigner(
await this.getSigner(),
this.config.chain,
{
clientId: this.config.clientId,
secretKey: this.config.secretKey,
},
);
if (this.config.factoryInfo?.abi) {
return sdk.getContract(
this.config.factoryAddress,
this.config.factoryInfo.abi,
);
}
return sdk.getContract(this.config.factoryAddress);
}

protected defaultFactoryInfo(): FactoryContractInfo {
return {
createAccount: async (factory, owner) => {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.