Exemple #1
0
        public static IJobServicesRegistrant AddDefaultBlockchainIndexingService(
            this IJobServicesRegistrant registrant)
        {
            registrant
            .Builder
            .UseDefaultIndexBlockStrategy(registrant.IndexOnlyOwnTransactions);

            registrant
            .AddDefaultBlockchainService();

            var settings = new DefaultBlockchainIndexingService.Settings
            {
                BlockLockDuration     = registrant.BlockLockDuration,
                MinBlockNumberToIndex = registrant.MinBlockNumberToIndex
            };

            registrant
            .Builder
            .RegisterIfNotRegistered <IBlockchainIndexingService>
            (
                ctx => new DefaultBlockchainIndexingService
                (
                    ctx.Resolve <IBalanceMonitoringTaskRepository>(),
                    ctx.Resolve <IBalanceRepository>(),
                    ctx.Resolve <IBlockchainIndexationStateRepository>(),
                    ctx.Resolve <IBlockchainService>(),
                    ctx.Resolve <IBlockIndexationLockRepository>(),
                    ctx.Resolve <IChaosKitty>(),
                    ctx.Resolve <IIndexBlockStrategy>(),
                    ctx.Resolve <ILogFactory>(),
                    settings,
                    ctx.Resolve <ITransactionReceiptRepository>()
                )
            )
            .SingleInstance();

            return(registrant);
        }
Exemple #2
0
        public static IJobServicesRegistrant AddDefaultBalanceMonitoringService(
            this IJobServicesRegistrant registrant)
        {
            registrant
            .AddDefaultBlockchainService();

            registrant
            .Builder
            .RegisterIfNotRegistered <IBalanceMonitoringService>
            (
                ctx => new DefaultBalanceMonitoringService
                (
                    ctx.Resolve <IBalanceMonitoringTaskRepository>(),
                    ctx.Resolve <IBalanceRepository>(),
                    ctx.Resolve <IBlockchainService>(),
                    ctx.Resolve <IChaosKitty>(),
                    ctx.Resolve <ILogFactory>()
                )
            )
            .SingleInstance();

            return(registrant);
        }