Skip to main content

Connect

Connect a users wallet to your game.

Usage

string address = await sdk.wallet.Connect();

Configuration

walletConnection

The type of wallet to connect to, and which chain to connect to.

// Connect to the user's wallet via CoinbaseWallet
string address = await sdk.wallet.Connect(new WalletConnection()
{
provider = WalletProvider.WalletConnect, // e.g. use WalletConnect on any platform
chainId = 1 // Switch the wallet Ethereum Mainnet on connection
});

provider

Available providers:

  • WalletProvider.Injected: Injected (window.ethereum)
  • WalletProvider.CoinbaseWallet: Coinbase Wallet
  • WalletProvider.MetaMask: MetaMask
  • WalletProvider.WalletConnect: WalletConnect
  • WalletProvider.MagicAuth: Magic.Link

chainId

The ID of the blockchain to switch to upon connection.

Must be an int.

password

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

Must be a string.

privateKey

Private key based account (not recommended).

Must be a string.

Return Value

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

string;