public static bool TryGetAccountHash(this ExpressChain chain, string name, [MaybeNullWhen(false)] out UInt160 accountHash, ProtocolSettings?settings = null) { settings ??= chain.GetProtocolSettings(); if (chain.Wallets != null && chain.Wallets.Count > 0) { for (int i = 0; i < chain.Wallets.Count; i++) { if (string.Equals(name, chain.Wallets[i].Name, StringComparison.OrdinalIgnoreCase)) { var wallet = DevWallet.FromExpressWallet(settings, chain.Wallets[i]); var account = wallet.GetAccounts().Single(a => a.IsDefault); accountHash = account.ScriptHash; return(true); } } } Debug.Assert(chain.ConsensusNodes != null && chain.ConsensusNodes.Count > 0); for (int i = 0; i < chain.ConsensusNodes.Count; i++) { var nodeWallet = chain.ConsensusNodes[i].Wallet; if (string.Equals(name, nodeWallet.Name, StringComparison.OrdinalIgnoreCase)) { var wallet = DevWallet.FromExpressWallet(settings, nodeWallet); var account = wallet.GetAccounts().Single(a => a.IsDefault); accountHash = account.ScriptHash; return(true); } } if (GENESIS.Equals(name, StringComparison.OrdinalIgnoreCase)) { (_, accountHash) = chain.GetGenesisAccount(settings); return(true); } if (TryToScriptHash(name, settings.AddressVersion, out accountHash)) { return(true); } accountHash = default; return(false);