/// <summary> /// Load existing transaction from NBitcoin.Transaction object /// </summary> /// <param name="tx"></param> /// <returns></returns> public async Task LoadTransaction(Transaction tx) { try { if (Inputs.Count > 0) { foreach (var i in Inputs) { await RemoveInput(i.Value.Utxo.Txid, (int)i.Value.Utxo.Index); } } } catch { // } foreach (var inp in tx.Inputs) { await AddInput(inp.PrevOut.Hash.ToString(), (int)inp.PrevOut.N); } try { if (Outputs.Count > 0) { foreach (var i in Outputs) { await RemoveOutput(Outputs.IndexOf(i)); } } } catch (Exception ex) { } foreach (var o in tx.Outputs) { await AddNeblioOutput((int)o.Value.Satoshi); NewTransaction.Outputs[tx.Outputs.IndexOf(o)].ScriptPubKey = o.ScriptPubKey; if (o.ScriptPubKey.ToString().Contains("OP_RETURN")) { OP_RETURN = o.ScriptPubKey.ToString(); } } await RefreshInputSummary(); await RefreshOutputSummary(); SenderRefreshed?.Invoke(this, null); }
private void NeblioBuilderTransaction_SenderRefreshed(object sender, EventArgs e) { SenderRefreshed?.Invoke(this, null); }