private static WalletAggregate GetJson(JObject jObj) { if (jObj == null) { throw new ArgumentNullException(nameof(jObj)); } var name = jObj.Value <string>("name"); var network = jObj.Value <int>("network"); JToken arrToken = null; var addresses = new List <WalletAggregateAddress>(); if (jObj.TryGetValue("addrs", out arrToken)) { var arr = arrToken as JArray; if (arr != null) { foreach (var adr in arr) { addresses.Add(WalletAggregateAddress.FromJson(JObject.Parse(adr.ToString()))); } } } return(new WalletAggregate { Name = name, Network = (Networks)network, Addresses = addresses }); }
public TransactionOut GetTransactionOut(WalletAggregateAddress walletAddr) { if (walletAddr == null) { throw new ArgumentNullException(nameof(walletAddr)); } if (walletAddr.Key == null) { throw new ArgumentNullException(nameof(walletAddr.Key)); } if (TransactionOut == null || !TransactionOut.Any()) { return(null); } var interpreter = new ScriptInterpreter(); var scriptBuilder = new ScriptBuilder(); var secondScript = scriptBuilder.New() .AddToStack(walletAddr.Key.GetSignature()) .AddToStack(walletAddr.Key.GetPublicKey()) .Build(); foreach (var transactionOut in TransactionOut) { if (interpreter.Check(transactionOut.Script, secondScript)) { return(transactionOut); } } return(null); }