public ChainHeaderModel(DynamicTableEntity entity) { ChainOffset = RowKeyHelper.StringToHeight(entity.RowKey); BlockHeaders = new List <BlockHeader>(); foreach (var prop in entity.Properties) { var header = new BlockHeader(); header.FromBytes(prop.Value.BinaryValue); BlockHeaders.Add(header); } }
public BlockSummaryModel(DynamicTableEntity entity) { Height = RowKeyHelper.StringToHeight(entity.RowKey); Hash = entity.Properties["hash"].StringValue; var time = entity.Properties["time"].DateTimeOffsetValue; if (time != null) { Time = Utils.DateTimeToUnixTime(time.Value); } var txcount = entity.Properties["txcount"].Int32Value; if (txcount != null) { TxCount = txcount.Value; } var txtotal = entity.Properties["txtotal"].Int64Value; if (txtotal != null) { TxTotal = Money.Satoshis(txtotal.Value); } var size = entity.Properties["size"].Int32Value; if (size != null) { Size = size.Value; } var posBlock = entity.Properties["pos"].BooleanValue; if (posBlock != null) { PosBlock = posBlock.Value; } }