private void button4_Click(object sender, EventArgs e) { context.Verifiable.Witnesses = context.GetWitnesses(); IInventory inventory = (IInventory)context.Verifiable; RelayResultReason reason = Program.BhpSystem.Blockchain.Ask <RelayResultReason>(inventory).Result; if (reason == RelayResultReason.Succeed) { InformationBox.Show(inventory.Hash.ToString(), Strings.RelaySuccessText, Strings.RelaySuccessTitle); } else { MessageBox.Show($"Transaction cannot be broadcast: {reason}"); } }
private void button3_Click(object sender, EventArgs e) { ContractParametersContext context; JObject json1 = JObject.Parse(textBox2.Text); if (json1.ContainsProperty("hex")) { context = ContractParametersContext.FromJson(json1); } else { ContractTransaction tx1 = JsonToRequest(json1); ContractTransaction tx2 = JsonToRequest(JObject.Parse(textBox3.Text)); context = new ContractParametersContext(new ContractTransaction { Attributes = new TransactionAttribute[0], Inputs = tx1.Inputs.Concat(tx2.Inputs).ToArray(), Outputs = tx1.Outputs.Concat(tx2.Outputs).ToArray() }); } Program.CurrentWallet.Sign(context); if (context.Completed) { context.Verifiable.Witnesses = context.GetWitnesses(); ContractTransaction tx = (ContractTransaction)context.Verifiable; Program.CurrentWallet.ApplyTransaction(tx); Program.BhpSystem.LocalNode.Tell(new LocalNode.Relay { Inventory = tx }); InformationBox.Show(tx.Hash.ToString(), Strings.TradeSuccessMessage, Strings.TradeSuccessCaption); } else { InformationBox.Show(context.ToString(), Strings.TradeNeedSignatureMessage, Strings.TradeNeedSignatureCaption); } }
private void button2_Click(object sender, EventArgs e) { InformationBox.Show(context.ToString(), "ParametersContext", "ParametersContext"); }