Exemple #1
0
        private Task AddOrUpdateAsync(DepositDetails deposit)
        {
            Serialization.Rlp.Rlp rlp = _rlpDecoder.Encode(deposit);
            _database.Set(deposit.Id, rlp.Bytes);

            return(Task.CompletedTask);
        }
        private Task AddOrUpdateAsync(ConsumerSession session)
        {
            Serialization.Rlp.Rlp rlp = _rlpDecoder.Encode(session);
            _database.Set(session.Id, rlp.Bytes);

            return(Task.CompletedTask);
        }
        private Task AddOrUpdateAsync(NdmConfig config)
        {
            Serialization.Rlp.Rlp rlp = _rlpDecoder.Encode(config);
            _database.Set(Keccak.Compute(config.Id), rlp.Bytes);

            return(Task.CompletedTask);
        }
        private Task AddOrUpdateAsync(DepositApproval depositApproval)
        {
            var rlp = _rlpDecoder.Encode(depositApproval);

            _database.Set(depositApproval.Id, rlp.Bytes);

            return(Task.CompletedTask);
        }
Exemple #5
0
        private Task AddOrUpdateAsync(DataDeliveryReceiptDetails receipt)
        {
            var rlp = _rlpDecoder.Encode(receipt);

            _database.Set(receipt.Id, rlp.Bytes);

            return(Task.CompletedTask);
        }
Exemple #6
0
        private Task AddOrUpdateAsync(EthRequest request)
        {
            var rlp = _rlpDecoder.Encode(request);

            _database.Set(request.Id, rlp.Bytes);

            return(Task.CompletedTask);
        }
Exemple #7
0
        public static Rlp Encode <T>(this IRlpDecoder <T> decoder, T[] items, RlpBehaviors behaviors = RlpBehaviors.None)
        {
            if (items == null)
            {
                return(Rlp.OfEmptySequence);
            }

            Rlp[] rlpSequence = new Rlp[items.Length];
            for (int i = 0; i < items.Length; i++)
            {
                rlpSequence[i] = items[i] == null ? Rlp.OfEmptySequence : decoder.Encode(items[i], behaviors);
            }

            return(Rlp.Encode(rlpSequence));
        }
Exemple #8
0
        public static Rlp Encode <T>(T[] items, RlpBehaviors behaviors = RlpBehaviors.None)
        {
            if (Decoders.ContainsKey(typeof(T)))
            {
                IRlpDecoder <T> decoder     = (IRlpDecoder <T>)Decoders[typeof(T)];
                Rlp[]           rlpSequence = new Rlp[items.Length];
                for (int i = 0; i < items.Length; i++)
                {
                    rlpSequence[i] = items[i] == null ? OfEmptySequence : decoder.Encode(items[i], behaviors);
                }

                return(Encode(rlpSequence));
            }

            throw new RlpException($"{nameof(Rlp)} does not support decoding {typeof(T).Name}");
        }