Connect
Connect a user’s 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.Coinbase
: Coinbase WalletWalletProvider.MetaMask
: MetaMaskWalletProvider.WalletConnectV1
: WalletConnectWalletProvider.MagicLink
: Magic.LinkWalletProvider.Paper
: PaperWalletProvider.LocalWallet
: Local WalletWalletProvider.SmartWallet
: Smart WalletWalletProvider.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;