コード例 #1
0
        internal static void AddSummaryForAccount(TxSummary summary)
        {
            var folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            var specificFolder = Path.Combine(folder, "XEMSign");

            var path = Path.Combine(specificFolder, "XEMSignJsonData.txt");

            var data = File.ReadAllText(path);

            var summaries = JsonConvert.DeserializeObject <List <TxSummary> >(data);

            summaries.Add(summary);

            var json = JsonConvert.SerializeObject(summaries);

            File.WriteAllText(path, json);
        }
コード例 #2
0
        private static void SignTransaction(PrivateKeyAccountClient acc, Transactions.TransactionData t, string multisigAcc)
        {
            Console.WriteLine("signing transaction");
            try
            {
                acc.BeginSignatureTransactionAsync(ar => {
                    try {
                        if (ar.Content.Code == 1)
                        {
                            var sum = new TxSummary()
                            {
                                AccAddress = multisigAcc,
                                DateOfTx   = DateTime.Now,
                                Amount     = t.transaction.otherTrans.amount
                            };

                            TxSummaryController.AddSummaryForAccount(sum);
                        }
                        else
                        {
                            Console.WriteLine(ar.Content.Code);
                        }
                        Console.WriteLine(ar.Content.Message);
                        Console.WriteLine();
                        Console.WriteLine();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                }, new MultisigSignatureTransactionData
                {
                    Deadline = int.Parse(ConfigurationManager.AppSettings["deadline"]) == 0
                      ? 82800 : int.Parse(ConfigurationManager.AppSettings["deadline"]),
                    TransactionHash = t.meta.data,
                    MultisigAddress = new Address(multisigAcc),
                }).AsyncWaitHandle.WaitOne();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                SignTransaction(acc, t, multisigAcc);
            }
        }