示例#1
0
 public static void LoadRecord()
 {
     try
     {
         TxHistory.Clear();
         UtxoHistory.Clear();
         var str    = System.IO.File.ReadAllText("records.json", System.Text.Encoding.UTF8);
         var record = MyJson.Parse(str).AsDict();
         foreach (var item in record["trans"].AsList())
         {
             var newitem = new TranInfo();
             TxHistory.Add(newitem);
             newitem.txid = item.AsDict()["txid"].AsString();
             newitem.type = (ThinNeo.TransactionType)Enum.Parse(typeof(ThinNeo.TransactionType), item.AsDict()["type"].AsString());
             newitem.time = DateTime.FromFileTimeUtc(long.Parse(item.AsDict()["time"].AsString().Substring(4)));
         }
         foreach (var item in record["uxtos"].AsList())
         {
             UtxoHistory.Add(item.AsString());
         }
     }
     catch
     {
     }
 }
示例#2
0
        public static string RecordTran(ThinNeo.Transaction trans)
        {
            var      txid = ThinNeo.Helper.Bytes2HexString(trans.GetHash().Reverse().ToArray());
            TranInfo info = new TranInfo();

            info.time = DateTime.Now;
            info.type = trans.type;
            info.txid = txid;
            TxHistory.Add(info);
            foreach (var input in trans.inputs)
            {
                var txid2   = ThinNeo.Helper.Bytes2HexString(input.hash.Reverse().ToArray());
                var strutxo = txid2 + "_" + input.index;
                UtxoHistory.Add(strutxo);
            }
            return(txid);
        }