Ejemplo n.º 1
0
        protected override IEnumerable <MultiSignatureEntity> Transform(DataTransformationContext context)
        {
            var multiSignatures = context.SignedLedgerState.State.MultiSignatures;
            var declarations    = context.GetDeclarations();
            var list            = new List <MultiSignatureEntity>();

            foreach (var multiSignature in multiSignatures)
            {
                list.Add(new MultiSignatureEntity(GetDeclarationId(declarations.AddressDeclarations, multiSignature.Address), multiSignature.Hash, new MultiSignatureAccount(multiSignature.Address, multiSignature.Required)));
            }
            return(list);
        }
Ejemplo n.º 2
0
        protected override IEnumerable <HashLockEntity> Transform(DataTransformationContext context)
        {
            var hashlocks    = context.SignedLedgerState.State.HashLocks;
            var list         = new List <HashLockEntity>();
            var declarations = context.GetDeclarations();

            foreach (var locker in hashlocks)
            {
                list.Add(new HashLockEntity(GetDeclarationId(declarations.AddressDeclarations, locker.Address), new HashLockAccount(locker.Address, locker.SecretHash)));
            }
            return(list);
        }
        protected override IEnumerable <VendingMachineEntity> Transform(DataTransformationContext context)
        {
            var machines = context.SignedLedgerState.State.VendingMachines;
            var list     = new List <VendingMachineEntity>();

            var declarations = context.GetDeclarations();

            foreach (var machine in machines)
            {
                list.Add(new VendingMachineEntity(GetDeclarationId(declarations.AddressDeclarations, machine.Address), new VendingMachineAccount(machine.Address, machine.Owner, machine.CurrencyIn, machine.CurrencyOut, machine.Rate)));
            }
            return(list);
        }
Ejemplo n.º 4
0
        protected override IEnumerable <DeclarationEntity> Transform(DataTransformationContext context)
        {
            var signedLedgerState = context.SignedLedgerState;

            var list         = new List <DeclarationEntity>();
            var transactions = signedLedgerState.Ledger.Ledger.Block.Transactions;
            var declarations = context.GetDeclarations();
            var index        = 0;

            foreach (var transaction in transactions)
            {
                foreach (var declaration in transaction.Transaction.Declarations)
                {
                    list.Add(new DeclarationEntity(GetDeclarationId(declarations.Declarations, index), declaration.Type));
                    index++;
                }
            }
            return(list.Distinct());
        }
        protected override IEnumerable <SecretRevelationEntity> Transform(DataTransformationContext context)
        {
            var signedLedgerState = context.SignedLedgerState;
            var list         = new List <SecretRevelationEntity>();
            var transactions = signedLedgerState.Ledger.Ledger.Block.Transactions;
            var declarations = context.GetDeclarations();
            var index        = 0;

            foreach (var transaction in transactions)
            {
                foreach (var declaration in transaction.Transaction.Declarations)
                {
                    if (declaration.Type == DeclarationType.Secret)
                    {
                        var secret = (SecretRevelation)declaration;
                        list.Add(new SecretRevelationEntity(GetDeclarationId(declarations.Declarations, index), new SecretRevelation(secret.Secret)));
                    }
                    index++;
                }
            }
            return(list);
        }