ManagedAccountFactory
Arbitrum NovaIntegrate your account factory
Account Factory
The recommended way to use account factories is to integrate the Connect SDK in your applications. This will ensure account contracts are deployed for your users only when they need it.
import { defineChain } from "thirdweb";import { inAppWallet, smartWallet } from "thirdweb/wallets";
const chain = defineChain(42170);
// First, connect the personal wallet, which can be any wallet (metamask, in-app, etc.)const personalWallet = inAppWallet();const peronalAccount = await personalWallet.connect({ client, chain, strategy: "google",});
// Then, connect the Smart Accountconst wallet = smartWallet({ chain, // the chain where your account will be or is deployed factoryAddress: "0x0c4176D4a4E2bB32ede3bfaB928FD26aD8d15749", // your own deployed account factory address gasless: true, // enable or disable gasless transactions});const smartAccount = await wallet.connect({ client, personalWallet,});
Direct contract interaction (advanced)
Choose a language:
Install the latest version of the SDK:
npm i thirdweb
Initialize the SDK and contract on your project:
import { createThirdwebClient, getContract } from "thirdweb";import { defineChain } from "thirdweb/chains";
// create the client with your clientId, or secretKey if in a server environmentconst client = createThirdwebClient({ clientId: "YOUR_CLIENT_ID" });
// connect to your contractconst contract = getContract({ client, chain: defineChain(42170), address: "0x0c4176D4a4E2bB32ede3bfaB928FD26aD8d15749"});
You will need to pass a client ID/secret key to use thirdweb's infrastructure services. If you don't have any API keys yet you can create one for free from the dashboard settings.
All Functions & Events
import { prepareContractCall, sendTransaction } from "thirdweb";
const transaction = await prepareContractCall({ contract, method: "function _disableFunctionInExtension(string _extensionName, bytes4 _functionSelector)", params: [_extensionName, _functionSelector]});const { transactionHash } = await sendTransaction({ transaction, account});