Example #1
0
            public API_History_4_3(SealedTransaction T)
            {
                id           = ConvertTransactionId(T.Id);
                source       = Base58CheckEncoding.EncodePlain(T.Trxn.Source);
                target       = Base58CheckEncoding.EncodePlain(T.Trxn.Target);
                amount       = BcToDouble(T.Trxn.Amount);
                fee          = BcFeeConvert(T.Trxn.Fee.Commission);
                timeCreation = new DateTime(T.Trxn.TimeCreation);
                userFields   = T.Trxn.UserFields;
                type         = (API_TransactionType)T.Trxn.Type;

                if (T.Trxn.ExtraFee != null)
                {
                    extraFee = T.Trxn.ExtraFee.Select(m => (API_ExtraFee) new API_ExtraFee_4_3(m)).ToList();
                }

                if (T.Trxn.SmartContract != null)
                {
                    smartContract = new API_SmartContract_4_3(T.Trxn.SmartContract);
                }

                if (T.Trxn.SmartInfo != null)
                {
                    smartInfo = new API_SmartTransInfo_4_3(T.Trxn.SmartInfo);
                }
            }
Example #2
0
        public TransactionApiModel ApiToShorttransaction(SealedTransaction tr)
        {
            var val = Convert.ChangeType(tr.Trxn.Type, tr.Trxn.Type.GetTypeCode());
            var wtr = new TransactionApiModel
            {
                Id          = GetTxId(tr.Id),
                FromAccount = SimpleBase.Base58.Bitcoin.Encode(tr.Trxn.Source),
                ToAccount   = SimpleBase.Base58.Bitcoin.Encode(tr.Trxn.Target),
                Time        = Utils.UnixTimeStampToDateTime(tr.Trxn.TimeCreation),
                Sum         = FormatAmount(tr.Trxn.Amount),
                Fee         = Utils.FeeByIndex(tr.Trxn.Fee.Commission),
                Currency    = (tr.Trxn.Currency == 1) ? "CS" : "",
                InnerId     = tr.Trxn.Id,
                Type        = val.ToString(),
                Status      = "Success"
            };

            return(wtr);
        }