SmartWallet.Create

Instantiate a SmartWallet to enable advanced blockchain interactions, including gasless transactions through account abstraction. This wallet type is especially useful for creating a user-friendly experience in decentralized applications.

Usage

var smartWallet = await SmartWallet.Create(personalWallet, chainId);

Example

Here's how you can create a SmartWallet for a user, assuming you already have a ThirdwebClient and a personal wallet (PrivateKeyWallet or InAppWallet) set up:

var client = ThirdwebClient.Create(clientId: "yourClientId", bundleId: "yourBundleId");
var personalWallet = await PrivateKeyWallet.Create(client, "yourPrivateKeyHex");
BigInteger chainId = 137; // Polygon mainnet
bool gasless = true; // Enable gasless transactions
var smartWallet = await SmartWallet.Create(
personalWallet,
gasless,
);
Console.WriteLine($"SmartWallet address: {await smartWallet.GetAddress()}");
// Sign a message (this will also deploy your smart wallet if it hasn't been deployed yet)
var message = "Hello, Thirdweb!";
var signature = await wallet.PersonalSign(message);
Console.WriteLine($"Signature: {signature}");