// Invoked after successful initialization of AppKit
AppKit.Initialized += (sender, eventArgs) => {
Debug.Log("AppKit initialized successfully");
};
// Invoked after successful connection of an account
AppKit.AccountConnected += (sender, eventArgs) => {
Account activeAccount = eventArgs.Account;
Debug.Log($"Account connected: {activeAccount.Address}");
// Access all connected accounts
foreach (var account in eventArgs.Accounts)
{
Debug.Log($"Available account: {account.Address} on {account.ChainId}");
}
};
// Invoked after successful disconnection of an account
AppKit.AccountDisconnected += (sender, eventArgs) => {
Debug.Log("Account disconnected");
};
// Invoked after account has changed
// This happens when the wallet updates a session or the user changes the active account
AppKit.AccountChanged += (sender, eventArgs) => {
Account newAccount = eventArgs.Account;
Debug.Log($"Account changed to: {newAccount.Address}");
};
// Invoked after active chain has changed
AppKit.ChainChanged += (sender, eventArgs) => {
Chain previousChain = eventArgs.PreviousChain;
Chain newChain = eventArgs.NewChain;
Debug.Log($"Chain changed from {previousChain?.Name} to {newChain?.Name}");
Debug.Log($"New chain ID: {newChain?.ChainId}");
};