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
)
);

See more script examples.

provider

Available providers:

  • WalletProvider.Injected: Injected (window.ethereum)
  • WalletProvider.Coinbase: Coinbase Wallet
  • WalletProvider.MetaMask: MetaMask
  • WalletProvider.WalletConnectV1: WalletConnect
  • WalletProvider.MagicLink: Magic.Link
  • WalletProvider.Paper: Paper
  • WalletProvider.LocalWallet: Local Wallet
  • WalletProvider.SmartWallet: Smart Wallet
  • WalletProvider.Hyperplay: Hyperplay (connect to their launcher first)

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 used for MagicLink provider.

Must be a string.

personalWallet

Optional WalletProvider to use with WalletProvider.SmartWallet as your main provider.

Defaults to WalletProvider.LocalWallet

Return Value

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

string;