Beispiel #1
0
        private void ConvertThroughProto(Transaction source)
        {
            Com.DigitalAsset.Ledger.Api.V1.Transaction protoValue = source.ToProto();
            Transaction target = Transaction.FromProto(protoValue);

            Assert.IsTrue(source == target);
        }
Beispiel #2
0
        public Com.DigitalAsset.Ledger.Api.V1.Transaction ToProto()
        {
            var transaction = new Com.DigitalAsset.Ledger.Api.V1.Transaction {
                TransactionId = TransactionId, CommandId = CommandId, WorkflowId = WorkflowId,
                EffectiveAt   = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTimeOffset(EffectiveAt), Offset = Offset
            };

            transaction.Events.AddRange(from e in Events select EventHelper.ToProtoEvent(e));
            return(transaction);
        }
Beispiel #3
0
        public static Transaction FromProto(Com.DigitalAsset.Ledger.Api.V1.Transaction transaction)
        {
            var events = (from e in transaction.Events select EventHelper.FromProtoEvent(e)).ToList();

            return(new Transaction(transaction.TransactionId, transaction.CommandId, transaction.WorkflowId, transaction.EffectiveAt.ToDateTimeOffset(), events, transaction.Offset));
        }