Connect

Connect a user's wallet to your game.

Usage

using Thirdweb;
public async void ConnectWallet()
{
// Reference to your Thirdweb SDK
var sdk = ThirdwebManager.Instance.SDK;
// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.Metamask, // The wallet provider you want to connect to (Required)
chainId: 5 // The chain you want to connect to (Required)
);
// Connect the wallet
string address = await sdk.Wallet.Connect(connection);
}

Configuration

walletConnection

Your Wallet Connection configuration, this is an object that can be used with any of the available providers.

provider

Available providers:

chainId

The ID of the blockchain to switch to upon connection.

Must be a BigInteger (or int).

password

Optional password for encrypted Local Wallet account, uses auto-generated password if left empty.

Must be a string.

email

Optional email for default In-App Wallet email flow.

Must be a string.

phoneNumber

Optional phone number for default In-App Wallet phone flow.

Optional email for default In-App Wallet email flow.

Must be a string.

personalWallet

Admin signer to use with Smart Account as your main provider.

Must be a WalletProvider.

smartWalletAccountOverride

Optionally choose to connect to a smart account the personal wallet is not an admin of. Useful for advanced session key use cases.

Must be a string.

authOptions

In-App Wallet Authentication Options.

Must be an AuthOptions object.

Return Value

Returns a string representing the connected wallet address with a valid checksum.

string;