示例#1
0
        protected override IEnumerable <TransactionDeclarationEntity> Transform(DataTransformationContext context)
        {
            var signedLedgerState = context.SignedLedgerState;

            var list               = new List <TransactionDeclarationEntity>();
            var processed          = new ProcessedDeclarations();
            var declarationContext = new TransactionDeclarationContext();
            var transactions       = signedLedgerState.Ledger.Ledger.Block.Transactions;

            foreach (var transaction in transactions)
            {
                var hash  = transaction.Hash;
                var index = 0;
                foreach (var declaration in transaction.Transaction.Declarations)
                {
                    var entity = new TransactionDeclarationEntity(hash, index++, GetDeclarationId(declaration, processed));
                    list.Add(entity);
                    processed.Add(entity, declaration);
                    declarationContext.TryAdd(entity, declaration);
                }
            }

            context.SetDeclarations(declarationContext);

            return(list);
        }
 public void SetDeclarations(TransactionDeclarationContext declarations)
 {
     this.declarations = declarations;
     declarationCreated.Set();
 }