public TransactionExecutor(IFileSystem fileSystem, ExpressChainManager chainManager, bool trace, bool json, TextWriter writer) { this.chainManager = chainManager; expressNode = chainManager.GetExpressNode(trace); this.fileSystem = fileSystem; this.json = json; this.writer = writer; }
public static bool TryGetSigningAccount(this ExpressChainManager chainManager, string name, string password, [MaybeNullWhen(false)] out Wallet wallet, [MaybeNullWhen(false)] out UInt160 accountHash) { if (!string.IsNullOrEmpty(name)) { var settings = chainManager.Chain.GetProtocolSettings(); if (name.Equals(ExpressChainExtensions.GENESIS, StringComparison.OrdinalIgnoreCase)) { (wallet, accountHash) = chainManager.Chain.GetGenesisAccount(settings); return(true); } if (chainManager.Chain.Wallets != null && chainManager.Chain.Wallets.Count > 0) { for (int i = 0; i < chainManager.Chain.Wallets.Count; i++) { var expWallet = chainManager.Chain.Wallets[i]; if (name.Equals(expWallet.Name, StringComparison.OrdinalIgnoreCase)) { wallet = DevWallet.FromExpressWallet(settings, expWallet); accountHash = wallet.GetAccounts().Single(a => a.IsDefault).ScriptHash; return(true); } } } for (int i = 0; i < chainManager.Chain.ConsensusNodes.Count; i++) { var expWallet = chainManager.Chain.ConsensusNodes[i].Wallet; if (name.Equals(expWallet.Name, StringComparison.OrdinalIgnoreCase)) { wallet = DevWallet.FromExpressWallet(settings, expWallet); accountHash = wallet.GetAccounts().Single(a => !a.Contract.Script.IsMultiSigContract()).ScriptHash; return(true); } } if (!string.IsNullOrEmpty(password)) { if (TryGetNEP2Wallet(name, password, settings, out wallet, out accountHash)) { return(true); } if (TryGetNEP6Wallet(name, password, settings, out wallet, out accountHash)) { return(true); } } } wallet = null; accountHash = null; return(false);
public TransactionExecutor Create(ExpressChainManager chainManager, bool trace, bool json) { return(new TransactionExecutor(fileSystem, chainManager, trace, json, console.Out)); }