void update() { this.textASM.Text = ThinNeo.Helper.Bytes2HexString(this.vscript); var scripthash = ThinNeo.Helper.GetScriptHashFromScript(this.vscript); this.info1.Text = ThinNeo.Helper.Bytes2HexString(scripthash); this.info2.Text = ThinNeo.Helper.GetAddressFromScriptHash(scripthash); MyJson.JsonNode_Array arr = new MyJson.JsonNode_Array(); arr.AddArrayValue("(str)0214"); arr.Add(new MyJson.JsonNode_Array()); var sb = new StringBuilder(); arr.ConvertToStringWithFormat(sb, 4); this.jsonParam.Text = sb.ToString(); if (this.iscript != null) { this.asmList.Items.Clear(); var ops = ThinNeo.Compiler.Avm2Asm.Trans(this.iscript); for (int i = 0; i < ops.Length; i++) { this.asmList.Items.Add(ops[i]); } this.asmBinText.Text = ThinNeo.Helper.Bytes2HexString(this.iscript); } }
private void Button_Click(object sender, RoutedEventArgs e) { try { var sh = ThinNeo.Helper.HexString2Bytes(textScriptHash.Text); var json = rpc_getScript(sh); if (json == null) { info1.Text = "no script"; info2.Text = "can't help you to fill the parameter json."; } else { info1.Text = "scripthash=" + json.AsDict()["hash"].AsString(); info2.Text = "scriptlen=" + (json.AsDict()["script"].AsString().Length / 2); var param = json.AsDict()["parameters"]; var array = new MyJson.JsonNode_Array(); foreach (var p in param.AsList()) { if (p.AsString() == "String") { array.Add(new MyJson.JsonNode_ValueString("(str)textParam")); } if (p.AsString() == "Array") { array.Add(new MyJson.JsonNode_Array()); } if (p.AsString() == "Boolean") { array.Add(new MyJson.JsonNode_ValueNumber(false)); } if (p.AsString() == "Bytes") { array.Add(new MyJson.JsonNode_ValueString("(hex)0x00")); } if (p.AsString() == "UINT160") { array.Add(new MyJson.JsonNode_ValueString("(hexbig)0xaa020304050607080910bb020304050607080910")); } if (p.AsString() == "UINT256") { array.Add(new MyJson.JsonNode_ValueString("(hexbig)0xaa020304050607080910bb020304050607080910cc020304050607080910dd02")); } if (p.AsString() == "BigInteger") { array.Add(new MyJson.JsonNode_ValueString("(int)735200")); } } StringBuilder sb = new StringBuilder(); array.ConvertToStringWithFormat(sb, 4); jsonParam.Text = sb.ToString(); } } catch { } }
private async void Button_Click_3(object sender, RoutedEventArgs e) { System.Net.WebClient wc = new System.Net.WebClient(); var sid = this.textContractHash.Text; try { ThinNeo.Helper.HexString2Bytes(sid); } catch { MessageBox.Show("请输入正确的合约hash"); return; } var str = Helper.MakeRpcUrl(url, "getcontractstate", new MyJson.IJsonNode[] { new MyJson.JsonNode_ValueString(sid) }); var result = await Helper.HttpGet(str); if (result == null) { MessageBox.Show("合约不存在"); return; } var json = MyJson.Parse(result).AsDict()["result"].AsList()[0]; var param = json.AsDict()["parameters"]; var array = new MyJson.JsonNode_Array(); foreach (var p in param.AsList()) { if (p.AsString() == "String") { array.Add(new MyJson.JsonNode_ValueString("(str)textParam")); } if (p.AsString() == "Array") { array.Add(new MyJson.JsonNode_Array()); } if (p.AsString() == "Boolean") { array.Add(new MyJson.JsonNode_ValueNumber(false)); } if (p.AsString() == "Bytes") { array.Add(new MyJson.JsonNode_ValueString("(hex)0x00")); } if (p.AsString() == "UINT160") { array.Add(new MyJson.JsonNode_ValueString("(hexbig)0xaa020304050607080910bb020304050607080910")); } if (p.AsString() == "UINT256") { array.Add(new MyJson.JsonNode_ValueString("(hexbig)0xaa020304050607080910bb020304050607080910cc020304050607080910dd02")); } if (p.AsString() == "BigInteger") { array.Add(new MyJson.JsonNode_ValueString("(int)735200")); } } StringBuilder sb = new StringBuilder(); array.ConvertToStringWithFormat(sb, 4); this.textParams.Text = sb.ToString(); }