public PaymentClaimProcessor(IGasPriceService gasPriceService, IConsumerRepository consumerRepository,
                              IPaymentClaimRepository paymentClaimRepository, IPaymentService paymentService, Address coldWalletAddress,
                              ITimestamper timestamper, IRlpObjectDecoder <UnitsRange> unitsRangeRlpDecoder, ILogManager logManager,
                              bool disableSendingPaymentClaimTransaction = false)
 {
     _gasPriceService        = gasPriceService;
     _consumerRepository     = consumerRepository;
     _paymentClaimRepository = paymentClaimRepository;
     _paymentService         = paymentService;
     _coldWalletAddress      = coldWalletAddress;
     _timestamper            = timestamper;
     _unitsRangeRlpDecoder   = unitsRangeRlpDecoder;
     _disableSendingPaymentClaimTransaction = disableSendingPaymentClaimTransaction;
     _logger = logManager.GetClassLogger();
 }
        public static Rlp Encode <T>(this IRlpObjectDecoder <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));
        }
Esempio n. 3
0
 public void Setup()
 {
     _gasPrice               = 20.GWei();
     _gasPriceService        = Substitute.For <IGasPriceService>();
     _consumerRepository     = Substitute.For <IConsumerRepository>();
     _paymentClaimRepository = Substitute.For <IPaymentClaimRepository>();
     _paymentService         = Substitute.For <IPaymentService>();
     _coldWalletAddress      = Address.Zero;
     _consumerRlpDecoder     = Substitute.For <IRlpObjectDecoder <Consumer> >();
     _consumerRlpDecoder.Encode(Arg.Any <Consumer>()).ReturnsForAnyArgs(new Rlp(Array.Empty <byte>()));
     _unitsRangeRlpDecoder = Substitute.For <IRlpObjectDecoder <UnitsRange> >();
     _unitsRangeRlpDecoder.Encode(Arg.Any <UnitsRange>()).ReturnsForAnyArgs(new Rlp(Array.Empty <byte>()));
     _timestamper      = Substitute.For <ITimestamper>();
     _transaction      = Build.A.Transaction.TestObject;
     _transaction.Hash = TestItem.KeccakA;
     _gasPriceService.GetCurrentPaymentClaimGasPriceAsync().Returns(_gasPrice);
     _processor = new PaymentClaimProcessor(_gasPriceService, _consumerRepository, _paymentClaimRepository,
                                            _paymentService, _coldWalletAddress, _timestamper, _unitsRangeRlpDecoder, LimboLogs.Instance);
 }