Wallet State
Once a user has connected to your game, use the Wallet class to interact with the connected wallet.
Read Wallet State
Read information about the connected wallet.
Check Wallet Connection
Check if the user has connected their wallet to your game.
bool isConnected = await sdk.wallet.IsConnected();
Wallet Address
If the user has connected their wallet to your game, read their wallet address.
string address = await sdk.wallet.GetAddress();
Current Network
View the chain ID of the network the user is connected to.
int chainId = await sdk.wallet.GetChainId();
Balance (Native Token)
Read the balance of the native token of the network the user is connected to.
For example, if the user is connected to the Ethereum Mainnet, this will return the balance of ETH.
CurrencyValue balance = await sdk.wallet.GetBalance();
Change Wallet State
Request the user to change their wallet state.
These functions are especially useful to ensure the user is on the correct network before signing a transaction.
Switch Network
await sdk.wallet.SwitchNetwork(chainId);
Disconnect Wallet
await sdk.wallet.Disconnect();