Actions
Modal Actions
Open Modal
// Open default view
Web3Modal.OpenModal();
// Open network selection view
Web3Modal.OpenModal(ViewType.NetworkSearch);
// Open account view
Web3Modal.OpenModal(ViewType.Account);
Close Modal
Web3Modal.CloseModal();
Chain Actions
Set active chain
Chain newChain = ChainConstants.Chains.Ethereum;
await Web3Modal.NetworkController.ChangeActiveChainAsync(newChain);
Get active chain
Chain activeChain = Web3Modal.NetworkController.ActiveChain;
Account Actions
Get active account
// Get active account in CAIP-10 format
Account account = Web3Modal.GetAccount();
Debug.Log(account.Address); // e.g. '0x12345...'
Debug.Log(account.ChainId); // e.g. 'eip155:1'
Debug.Log(account.AccountId); // e.g. 'eip155:1:0x12345...'
Disconnect
await Web3Modal.DisconnectAsync();
Was this helpful?