Пример #1
0
 public TokenTransfer(Release.TokenTransfer t)
 {
     Initiator   = Base58Encoding.Encode(t.Initiator);
     Amount      = t.Amount;
     Time        = ConvUtils.UnixTimeStampToDateTime(t.Time);
     Transaction = ConvUtils.GetTxId(t.Transaction);
 }
Пример #2
0
 public PoolInfo(TestApi.Pool pool)
 {
     Time    = ConvUtils.UnixTimeStampToDateTime(pool.Time);
     Hash    = ConvUtils.ConvertHash(pool.Hash);
     TxCount = pool.TransactionsCount;
     Number  = pool.PoolNumber;
 }
Пример #3
0
 public AccountData(Release.WalletInfo info)
 {
     Address         = Base58Encoding.Encode(info.Address);
     Balance         = ConvUtils.FormatAmount(info.Balance);
     TxCount         = (int)info.TransactionsNumber;
     FirstTxDateTime = ConvUtils.UnixTimeStampToDateTime(info.FirstTransactionTime);
 }
Пример #4
0
 public ContractInfo(TestApi.SmartContract sc)
 {
     Address     = Base58Encoding.Encode(sc.Address);
     SourceCode  = ConvUtils.FormatSrc(sc.SourceCode);
     HashState   = sc.HashState;
     ByteCodeLen = sc.ByteCode.Length;
     Deployer    = Base58Encoding.Encode(sc.Deployer);
 }
Пример #5
0
 public TokenTransaction(Release.TokenTransaction t, int index)
 {
     Index     = index;
     Id        = ConvUtils.GetTxId(t.Transaction);
     Time      = ConvUtils.UnixTimeStampToDateTime(t.Time);
     Initiator = Base58Encoding.Encode(t.Initiator);
     Method    = t.Method;
     Params    = string.Join(", ", t.Params);
 }
Пример #6
0
 public BlockInfo(Release.Pool pool)
 {
     Time    = ConvUtils.UnixTimeStampToDateTime(pool.Time);
     Hash    = ConvUtils.ConvertHash(pool.Hash);
     TxCount = pool.TransactionsCount;
     Number  = pool.PoolNumber;
     Fee     = ConvUtils.FormatAmount(pool.TotalFee);
     Writer  = Base58Encoding.Encode(pool.Writer);
 }
Пример #7
0
 public ContractInfo(SmartContract sc)
 {
     Address     = sc.Address;
     SourceCode  = ConvUtils.FormatSrc(sc.SourceCode);
     HashState   = sc.HashState;
     Method      = sc.Method;
     Params      = string.Join(", ", sc.Params);
     ByteCodeLen = sc.ByteCode.Length;
 }
Пример #8
0
 public PoolInfo(NodeApi.Pool pool)
 {
     Age     = ConvUtils.GetAge(pool.Time);
     Time    = ConvUtils.UnixTimeStampToDateTime(pool.Time);
     Hash    = ConvUtils.ConvertHashAscii(pool.Hash);
     TxCount = pool.TransactionsCount;
     Status  = true;
     Number  = pool.PoolNumber;
 }
Пример #9
0
 public NodeInfo(ServerApi.ServerNode n)
 {
     Ip = n.Ip;
     if (n.PublicKey.All("0123456789ABCDEF".Contains))
     {
         PublicKey = ConvUtils.ConvertHashPartial(n.PublicKey);
     }
     Version = n.Version ?? string.Empty;
     byte.TryParse(n.Platform, out Platform);
     CountTrust       = n.CountTrust;
     TimeRegistration = ConvUtils.UnixTimeStampToDateTimeS(n.TimeRegistration);
     TimeActive       = n.TimeActive;
     Active           = true;
 }
Пример #10
0
 public TransactionInfo(int idx, string id, TestApi.Transaction tr)
 {
     Index       = idx;
     Id          = id;
     Value       = ConvUtils.FormatAmount(tr.Amount);
     FromAccount = Base58Encoding.Encode(tr.Source);
     ToAccount   = Base58Encoding.Encode(tr.Target);
     Currency    = tr.Currency;
     Fee         = "0";
     if (tr.SmartContract == null)
     {
         return;
     }
     SmartContractSource    = tr.SmartContract.SourceCode;
     SmartContractHashState = tr.SmartContract.HashState;
 }
Пример #11
0
 public TransactionInfo(int idx, string id, NodeApi.Transaction tr)
 {
     Index       = idx;
     Id          = id;
     Value       = ConvUtils.FormatAmount(tr.Amount);
     FromAccount = ConvUtils.ConvertHashPartial(tr.Source.Trim());
     ToAccount   = ConvUtils.ConvertHashPartial(tr.Target.Trim());
     Currency    = tr.Currency;
     Fee         = "0";
     if (tr.SmartContract == null)
     {
         return;
     }
     SmartContractSource    = tr.SmartContract.SourceCode;
     SmartContractHashState = tr.SmartContract.HashState;
 }
Пример #12
0
 public TransactionInfo(int idx, Release.TransactionId id, Release.Transaction tr)
 {
     Index = idx;
     if (id != null)
     {
         Id = $"{ConvUtils.ConvertHash(id.PoolHash)}.{id.Index + 1}";
     }
     Value       = ConvUtils.FormatAmount(tr.Amount);
     FromAccount = Base58Encoding.Encode(tr.Source);
     ToAccount   = Base58Encoding.Encode(tr.Target);
     Currency    = "CS";
     Fee         = "0";
     if (tr.SmartContract == null)
     {
         return;
     }
     SmartContractSource    = tr.SmartContract.SourceCode;
     SmartContractHashState = tr.SmartContract.HashState;
 }
Пример #13
0
 public TransactionInfo(int idx, Release.TransactionId id, Release.Transaction tr)
 {
     Index       = idx;
     Id          = ConvUtils.GetTxId(id);
     Value       = ConvUtils.FormatAmount(tr.Amount);
     FromAccount = Base58Encoding.Encode(tr.Source);
     ToAccount   = Base58Encoding.Encode(tr.Target);
     Currency    = "CS";
     Fee         = ConvUtils.FormatAmount(tr.Fee);
     InnerId     = tr.Id;
     if (tr.SmartContract == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(tr.SmartContract.Method))
     {
         return;
     }
     Method = $"{tr.SmartContract.Method}({string.Join(',', tr.SmartContract.Params)})";
 }
Пример #14
0
 public void HideIp()
 {
     Ip = ConvUtils.GetIpCut(Ip);
 }
Пример #15
0
 public static string GetTxId(Release.TransactionId id)
 {
     return(id == null ? null : $"{ConvUtils.ConvertHash(id.PoolHash)}.{id.Index + 1}");
 }
Пример #16
0
 public void RefreshAge(DateTime time)
 {
     Age = ConvUtils.AgeStr(time - Time);
 }