Docs

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 Embedded Wallet email flow.

Must be a string.

personalWallet

Admin signer to use with Smart Wallet 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

Embedded Wallet Authentication Options.

Must be an AuthOptions object.

Return Value

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

string;