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?