tx: Added name to outputs

This commit is contained in:
Nathan Woodburn 2023-06-12 21:35:39 +10:00
parent 092e30799b
commit 43a52cc029
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -34,10 +34,10 @@ namespace FireWallet
this.Text = "TX: " + tx["hash"].ToString(); this.Text = "TX: " + tx["hash"].ToString();
} }
private void TXForm_Load(object sender, EventArgs e) private async void TXForm_Load(object sender, EventArgs e)
{ {
labelHash.Text = "Hash: " + tx["hash"].ToString(); labelHash.Text = "Hash: " + tx["hash"].ToString();
mainForm.AddLog("Viewing:\n" + tx.ToString()); mainForm.AddLog("Viewing TX: " + tx["hash"].ToString());
// For each input // For each input
@ -94,12 +94,24 @@ namespace FireWallet
JObject covenant = (JObject)output["covenant"]; JObject covenant = (JObject)output["covenant"];
if (covenant.ContainsKey("action")) if (covenant.ContainsKey("action"))
{ {
if (covenant["action"].ToString() != "NONE")
{
JArray items = (JArray)covenant["items"];
Label covenantLabel = new Label(); Label covenantLabel = new Label();
covenantLabel.Text = "Type: " + covenant["action"].ToString(); string namehash = items[0].ToString();
string content = "{\"method\": \"getnamebyhash\", \"params\": [\"" +namehash +"\"]}";
JObject name = JObject.Parse(await mainForm.APIPost("",false,content));
covenantLabel.Text = covenant["action"].ToString() + ": " + name["result"].ToString();
covenantLabel.Location = new Point(5, 25); covenantLabel.Location = new Point(5, 25);
covenantLabel.AutoSize = true; covenantLabel.AutoSize = true;
PanelOutput.Controls.Add(covenantLabel); PanelOutput.Controls.Add(covenantLabel);
} }
}
Label amount = new Label(); Label amount = new Label();
Decimal value = Decimal.Parse(output["value"].ToString()) / 1000000; Decimal value = Decimal.Parse(output["value"].ToString()) / 1000000;