public TransactionEntity(string partitionKey, Transaction tx, uint256 blockId) : base(partitionKey) { Timestamp = DateTimeOffset.UtcNow; TxId = tx.GetHash(); Transaction = tx; BlockId = blockId; Type = blockId == null ? TransactionEntryType.Mempool : TransactionEntryType.ConfirmedTransaction; }
public TransactionEntity(DynamicTableEntity entity) : base(entity.PartitionKey) { var splitted = entity.RowKey.Split(new[] { "-" }, StringSplitOptions.None); Timestamp = entity.Timestamp; TxId = uint256.Parse(splitted[0]); Type = GetType(splitted[1]); if (splitted.Length >= 3 && splitted[2] != string.Empty) { BlockId = uint256.Parse(splitted[2]); } var bytes = Helper.GetEntityProperty(entity, "tx"); if (bytes != null && bytes.Length != 0) { Transaction = new Transaction(); Transaction.ReadWrite(bytes); } bytes = Helper.GetEntityProperty(entity, "ctx"); if (bytes != null && bytes.Length != 0) { ColoredTransaction = new ColoredTransaction(); ColoredTransaction.ReadWrite(bytes); } PreviousTxOuts = Helper.DeserializeList <TxOut>(Helper.GetEntityProperty(entity, "previoustxouts")); var timestamp = Helper.GetEntityProperty(entity, "time"); if (timestamp != null && timestamp.Length == 8) { Timestamp = new DateTimeOffset((long)ToUInt64(timestamp, 0), TimeSpan.Zero); } }
public TransactionEntity(string partitionKey, uint256 txId, ColoredTransaction colored) : base(partitionKey) { TxId = txId ?? throw new ArgumentNullException("txId"); ColoredTransaction = colored; Type = TransactionEntryType.Colored; }